Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15549: Better error message for missing ZK nodes in ZkStateReader. (#224)

Houston Putman122c88a07487
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 82641c1f26a..4bea2e20bb7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -377,6 +377,8 @@ Improvements
* SOLR-15525: Read ZK credentials from a file specified using a system property instead of exposing plain-text
credentials as system properties (Timothy Potter)
+* SOLR-15549: ZkStateReader now supports connecting to 9.0 Solr Clouds (Houston Putman)
+
Optimizations
---------------------
* SOLR-15433: Replace transient core cache LRU by Caffeine cache. (Bruno Roustant)
diff --git a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
index ae0caeba754..e6b7a354dfa 100644
--- a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
+++ b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc
@@ -170,6 +170,10 @@ Upgrade is to be done using Collection API MIGRATESTATEFORMAT action using a pre
See for example https://solr.apache.org/guide/8_8/cluster-node-management.html#migratestateforma[Solr 8.8 Ref Guide].
// Can't link directly to .adoc file, need to link to 8.something ref guide as MIGRATESTATEFORMAT no longer exists in 9.0.
+* If you're using a SolrJ CloudClient to connect to your Solr cluster, you must be using SolrJ version 8.10 or higher (8.x) when upgrading your SolrCloud from 8.x to 9.x.
+Otherwise, SolrJ will not be able to connect to the cluster once it has upgraded to Solr 9.
+Once you have upgraded all Solr clusters that the client is connecting to, you can upgrade the SolrJ client to 9.x.
+
* If you're using Solr in standalone mode with the <<query-elevation-component.adoc#,Query Elevation Component>> with it's elevation file in the data directory, you'll have to move it to the <<config-sets.adoc#,Configset>> instead.
The only reason QEC supported the data directory was to support loading its changes on a commit instead of a more expensive core reload.
That feature now works from the configset dir too.
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 3401ee7fe68..461dbaf9f96 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -416,7 +416,8 @@ public class ZkStateReader implements SolrCloseable {
});
} catch (KeeperException.NoNodeException nne) {
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
- "Cannot connect to cluster at " + zkClient.getZkServerAddress() + ": cluster not found/not ready");
+ "Cannot connect to cluster at " + zkClient.getZkServerAddress() + ": cluster not found/not ready." +
+ " Expected node '" + nne.getPath() + "' does not exist.");
}
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
index 9f96eb25255..86b032cbab5 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
@@ -61,6 +61,7 @@ import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.DocRouter;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
@@ -772,9 +773,9 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {
@Test
public void testWrongZkChrootTest() throws IOException {
-
exception.expect(SolrException.class);
exception.expectMessage("cluster not found/not ready");
+ exception.expectMessage("Expected node '" + ZkStateReader.ALIASES + "' does not exist");
try (CloudSolrClient client = getCloudSolrClient(cluster.getZkServer().getZkAddress() + "/xyz/foo")) {
client.setZkClientTimeout(1000 * 60);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
index c1c5416f7c4..fc6f9bb2234 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
@@ -62,6 +62,7 @@ import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.DocRouter;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
@@ -72,6 +73,8 @@ import org.apache.solr.handler.admin.CollectionsHandler;
import org.apache.solr.handler.admin.ConfigSetsHandler;
import org.apache.solr.handler.admin.CoreAdminHandler;
import org.apache.solr.util.LogLevel;
+import org.hamcrest.MatcherAssert;
+import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -773,7 +776,8 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
try (CloudSolrClient client = getCloudSolrClient(cluster.getZkServer().getZkAddress() + "/xyz/foo")) {
client.setZkClientTimeout(1000 * 60);
SolrException ex = expectThrows(SolrException.class, client::connect);
- assertTrue(ex.getMessage().contains("cluster not found/not ready"));
+ MatcherAssert.assertThat("Wrong error message for empty chRoot", ex.getMessage(), Matchers.containsString("cluster not found/not ready"));
+ MatcherAssert.assertThat("Wrong node missing message for empty chRoot", ex.getMessage(), Matchers.containsString("Expected node '" + ZkStateReader.ALIASES + "' does not exist"));
}
}