Apache Lucene open-source search software
SOLR-12823: fix failures in CloudHttp2SolrClientTest CloudSolrClientTest TestCloudSolrClientConnections (#1565)
murblancb4dcbfa3de7c
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.javaindex a1d5531c047..c5e5ee72843 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@@ -476,27 +476,32 @@ public class ZkStateReader implements SolrCloseable {log.debug("Updating cluster state from ZooKeeper... ");- // on reconnect of SolrZkClient force refresh and re-add watches.- loadClusterProperties();- refreshLiveNodes(new LiveNodeWatcher());- refreshCollections();- refreshCollectionList(new CollectionsChildWatcher());- refreshAliases(aliasesManager);-- if (securityNodeListener != null) {- addSecurityNodeWatcher(pair -> {- ConfigData cd = new ConfigData();- cd.data = pair.first() == null || pair.first().length == 0 ? EMPTY_MAP : Utils.getDeepCopy((Map) fromJSON(pair.first()), 4, false);- cd.version = pair.second() == null ? -1 : pair.second().getVersion();- securityData = cd;- securityNodeListener.run();+ try {+ // on reconnect of SolrZkClient force refresh and re-add watches.+ loadClusterProperties();+ refreshLiveNodes(new LiveNodeWatcher());+ refreshCollections();+ refreshCollectionList(new CollectionsChildWatcher());+ refreshAliases(aliasesManager);++ if (securityNodeListener != null) {+ addSecurityNodeWatcher(pair -> {+ ConfigData cd = new ConfigData();+ cd.data = pair.first() == null || pair.first().length == 0 ? EMPTY_MAP : Utils.getDeepCopy((Map) fromJSON(pair.first()), 4, false);+ cd.version = pair.second() == null ? -1 : pair.second().getVersion();+ securityData = cd;+ securityNodeListener.run();+ });+ securityData = getSecurityProps(true);+ }++ collectionPropsObservers.forEach((k, v) -> {+ collectionPropsWatchers.computeIfAbsent(k, PropsWatcher::new).refreshAndWatch(true);});- securityData = getSecurityProps(true);+ } catch (KeeperException.NoNodeException nne) {+ throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,+ "Cannot connect to cluster at " + zkClient.getZkServerAddress() + ": cluster not found/not ready");}-- collectionPropsObservers.forEach((k, v) -> {- collectionPropsWatchers.computeIfAbsent(k, PropsWatcher::new).refreshAndWatch(true);- });}private void addSecurityNodeWatcher(final Callable<Pair<byte[], Stat>> callback)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.javaindex eeab99d5de0..3b95b110a39 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@@ -777,7 +777,6 @@ public class CloudHttp2SolrClientTest extends SolrCloudTestCase {public ExpectedException exception = ExpectedException.none();@Test- @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12823")public void testWrongZkChrootTest() throws IOException {exception.expect(SolrException.class);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.javaindex 320c37179c0..d6aec6222a0 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@@ -761,7 +761,6 @@ public class CloudSolrClientTest extends SolrCloudTestCase {public ExpectedException exception = ExpectedException.none();@Test- @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12823")public void testWrongZkChrootTest() throws IOException {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/TestCloudSolrClientConnections.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.javaindex cabebee5b12..4289ebffcaa 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java@@ -31,7 +31,6 @@ import org.junit.Test;public class TestCloudSolrClientConnections extends SolrTestCaseJ4 {@Test- @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12823")public void testCloudClientCanConnectAfterClusterComesUp() throws Exception {// Start by creating a cluster with no jetties@@ -59,7 +58,6 @@ public class TestCloudSolrClientConnections extends SolrTestCaseJ4 {}@Test- @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12823")public void testCloudClientUploads() throws Exception {Path configPath = getFile("solrj").toPath().resolve("solr/configsets/configset-2/conf");