You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2021/03/09 19:05:13 UTC
[lucene-solr] 05/09: @1429 Fixes.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit f4ac64792eb3c7c5da66b5c4b7e0f2fc2922bd03
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sat Mar 6 16:37:31 2021 -0600
@1429 Fixes.
Took 49 minutes
Took 29 seconds
---
.../org/apache/solr/handler/admin/CollectionsHandler.java | 2 --
.../src/test/org/apache/solr/cloud/TestCloudRecovery.java | 14 ++++++++++++--
.../java/org/apache/solr/common/cloud/SolrZkClient.java | 9 +++++----
.../java/org/apache/solr/common/cloud/ZkCmdExecutor.java | 6 +++---
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
index 623802b..3cf09f8 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
@@ -23,8 +23,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.solr.api.Api;
import org.apache.solr.client.solrj.SolrResponse;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.CoreAdminRequest.RequestSyncShard;
import org.apache.solr.client.solrj.response.RequestStatusState;
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java
index 4997b57..3d22977 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery.java
@@ -143,6 +143,17 @@ public class TestCloudRecovery extends SolrCloudTestCase {
assertTrue( countReplayLog.get() >=2);
// check metrics
+ int replicationCount = getReplicationCount();
+
+ if (replicationCount < 2) {
+ Thread.sleep(100);
+ replicationCount = getReplicationCount();
+ }
+
+ assertTrue("cnt:" + replicationCount , replicationCount >= 2);
+ }
+
+ private int getReplicationCount() {
int replicationCount = 0;
int errorsCount = 0;
int skippedCount = 0;
@@ -164,8 +175,7 @@ public class TestCloudRecovery extends SolrCloudTestCase {
}
}
}
-
- assertTrue(replicationCount >= 2);
+ return replicationCount;
}
@Test
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
index c71babd..cb1aff9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
@@ -1176,14 +1176,15 @@ public class SolrZkClient implements Closeable {
}
public boolean isClosed() {
- return isClosed;
+ ZooKeeper zk = connManager.getKeeper();
+ return zk == null || !zk.getState().isAlive();
}
public SolrZooKeeper getSolrZooKeeper() {
- if (connManager.getKeeper() == null) {
- throw new AlreadyClosedException("No ZooKeeper object");
- }
+// if (connManager.getKeeper() == null) {
+// throw new AlreadyClosedException("No ZooKeeper object");
+// }
return (SolrZooKeeper) connManager.getKeeper();
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java
index 084a4b3..06b8586 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkCmdExecutor.java
@@ -59,9 +59,9 @@ public class ZkCmdExecutor {
@SuppressWarnings("unchecked")
public static <T> T retryOperation(ZkCmdExecutor zkCmdExecutor, ZkOperation operation, boolean retryOnSessionExp)
throws KeeperException, InterruptedException {
- if (zkCmdExecutor.solrZkClient.isClosed()) {
- throw new AlreadyClosedException("SolrZkClient is already closed");
- }
+// if (zkCmdExecutor.solrZkClient.isClosed()) {
+// throw new AlreadyClosedException("SolrZkClient is already closed");
+// }
KeeperException exception = null;
int tryCnt = 0;
while (tryCnt < zkCmdExecutor.retryCount) {