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 2020/09/02 18:12:04 UTC
[lucene-solr] 07/11: @709 Close SolrCmdDistributor if container
fails creation.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 55ea488ec52af2bb11261ca9eb83944c04622936
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Sep 2 11:06:51 2020 -0500
@709 Close SolrCmdDistributor if container fails creation.
---
.../org/apache/solr/update/SolrCmdDistributor.java | 18 ++++++++++------
.../processor/DistributedZkUpdateProcessor.java | 25 +++++++++++++---------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index 05425cd..94aefe2 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -66,12 +66,7 @@ public class SolrCmdDistributor implements Closeable {
private final Http2SolrClient solrClient;
- private final Phaser phaser = new Phaser(1) {
- @Override
- protected boolean onAdvance(int phase, int parties) {
- return false;
- }
- };
+ private final Phaser phaser = new RequestPhaser();
public SolrCmdDistributor(UpdateShardHandler updateShardHandler) {
assert ObjectReleaseTracker.track(this);
@@ -579,5 +574,16 @@ public class SolrCmdDistributor implements Closeable {
public Set<Error> getErrors() {
return allErrors;
}
+
+ private static class RequestPhaser extends Phaser {
+ public RequestPhaser() {
+ super(1);
+ }
+
+ @Override
+ protected boolean onAdvance(int phase, int parties) {
+ return false;
+ }
+ }
}
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
index 9816a5a..cc5d616 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
@@ -114,15 +114,20 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
cloudDesc = req.getCore().getCoreDescriptor().getCloudDescriptor();
zkController = cc.getZkController();
cmdDistrib = new SolrCmdDistributor(cc.getUpdateShardHandler());
- cloneRequiredOnLeader = isCloneRequiredOnLeader(next);
- collection = cloudDesc.getCollectionName();
- clusterState = zkController.getClusterState();
- DocCollection coll = clusterState.getCollectionOrNull(collection, true);
- if (coll != null) {
- // check readOnly property in coll state
- readOnlyCollection = coll.isReadOnly();
- } else {
- readOnlyCollection = false;
+ try {
+ cloneRequiredOnLeader = isCloneRequiredOnLeader(next);
+ collection = cloudDesc.getCollectionName();
+ clusterState = zkController.getClusterState();
+ DocCollection coll = clusterState.getCollectionOrNull(collection, true);
+ if (coll != null) {
+ // check readOnly property in coll state
+ readOnlyCollection = coll.isReadOnly();
+ } else {
+ readOnlyCollection = false;
+ }
+ } catch (Exception e) {
+ cmdDistrib.close();
+ throw new SolrException(ErrorCode.SERVER_ERROR, e);
}
}
@@ -749,7 +754,7 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
forwardToLeader = false;
return null;
} else if (isLeader || isSubShardLeader) {
- log.info("We are the leader, forward update to replicas..");
+ if (log.isDebugEnabled()) log.debug("We are the leader, forward update to replicas..");
// that means I want to forward onto my replicas...
// so get the replicas...
forwardToLeader = false;