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/08/17 23:11:48 UTC

[lucene-solr] 18/49: @532 Oh, I'll find it, never fear, I'll find it.

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 2f17913a311b66d7c0e75d40760852cb96458e0c
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Aug 12 10:06:32 2020 -0500

    @532 Oh, I'll find it, never fear, I'll find it.
---
 .../processor/DistributedZkUpdateProcessor.java    | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

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 b0af3f1..2989df3 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
@@ -159,8 +159,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
 
   @Override
   public void processCommit(CommitUpdateCommand cmd) throws IOException {
-    setupRequest(cmd);
-
     log.info("processCommit - start commit isLeader={} commit_end_point={} replicaType={}", isLeader, req.getParams().get(COMMIT_END_POINT), replicaType);
 
       try (ParWork worker = new ParWork(this, false, true)) {
@@ -213,7 +211,7 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
         log.info(
             "processCommit - distrib commit isLeader={} commit_end_point={} replicaType={}",
             isLeader, req.getParams().get(COMMIT_END_POINT), replicaType);
-        if (!isLeader && req.getParams().get(COMMIT_END_POINT, "").equals("replicas")) {
+        if (req.getParams().get(COMMIT_END_POINT, "").equals("replicas")) {
           if (replicaType == Replica.Type.PULL) {
             log.warn("processCommit - Commit not supported on replicas of type "
                 + Replica.Type.PULL);
@@ -232,6 +230,21 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
 
             params.set(DISTRIB_UPDATE_PARAM, DistribPhase.TOLEADER.toString());
             params.set(COMMIT_END_POINT, "leaders");
+
+            if (isLeader) {
+
+              worker.collect(() -> {
+                log.info(
+                    "processCommit - Do a local commit on NRT endpoint for leader");
+                try {
+                  doLocalCommit(cmd);
+                } catch (IOException e) {
+                  log.error("Error on local commit");
+                  throw new SolrException(ErrorCode.SERVER_ERROR, e);
+                }
+              });
+            }
+
             if (useNodes != null && useNodes.size() > 0) {
               log.info("processCommit - send commit to leaders nodes={}",
                   useNodes);
@@ -247,17 +260,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
           }
           if (isLeader) {
 
-            worker.collect(() -> {
-              log.info(
-                  "processCommit - Do a local commit on NRT endpoint for leader");
-              try {
-                doLocalCommit(cmd);
-              } catch (IOException e) {
-                log.error("Error on local commit");
-                throw new SolrException(ErrorCode.SERVER_ERROR, e);
-              }
-            });
-
             params.set(DISTRIB_UPDATE_PARAM, DistribPhase.FROMLEADER.toString());
 
             params.set(COMMIT_END_POINT, "replicas");