You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2015/04/01 17:50:03 UTC

svn commit: r1670688 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/update/processor/ solr/core/src/test/org/apache/solr/update/processor/

Author: thelabdude
Date: Wed Apr  1 15:50:03 2015
New Revision: 1670688

URL: http://svn.apache.org/r1670688
Log:
SOLR-7266: The IgnoreCommitOptimizeUpdateProcessor blocks commit requests from replicas needing to recover.

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactoryTest.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1670688&r1=1670687&r2=1670688&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Wed Apr  1 15:50:03 2015
@@ -323,6 +323,9 @@ Bug Fixes
 * SOLR-6924: The config API forcefully refreshes all replicas in the collection to ensure all are
   updated (Noble Paul)
 
+* SOLR-7266: The IgnoreCommitOptimizeUpdateProcessor blocks commit requests from
+  replicas needing to recover. (Jessica Cheng Mallet, Timothy Potter)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java?rev=1670688&r1=1670687&r2=1670688&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactory.java Wed Apr  1 15:50:03 2015
@@ -118,6 +118,12 @@ class IgnoreCommitOptimizeUpdateProcesso
       return;
     }
 
+    if (cmd.getReq().getParams().getBool(DistributedUpdateProcessor.COMMIT_END_POINT, false)) {
+      // this is a targeted commit from replica to leader needed for recovery, so can't be ignored
+      if (next != null) next.processCommit(cmd);
+      return;
+    }
+
     final String cmdType = cmd.optimize ? "optimize" : "commit";
     if (errorCode != null) {
       IgnoreCommitOptimizeUpdateProcessorFactory.log.info(

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactoryTest.java?rev=1670688&r1=1670687&r2=1670688&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/processor/IgnoreCommitOptimizeUpdateProcessorFactoryTest.java Wed Apr  1 15:50:03 2015
@@ -52,15 +52,29 @@ public class IgnoreCommitOptimizeUpdateP
 
     rsp = processCommit("ignore-optimize-only-from-client-403", true);
     assertNotNull("Sending an optimize should have resulted in an exception in the response", rsp.getException());
+    // commit should happen if DistributedUpdateProcessor.COMMIT_END_POINT == true
+    rsp = processCommit("ignore-commit-from-client-403", false, new Boolean(true));
+    shouldBeNull = rsp.getException();
+    assertNull("Sending a commit should NOT have resulted in an exception in the response: "+shouldBeNull, shouldBeNull);
   }
 
   SolrQueryResponse processCommit(final String chain, boolean optimize) throws IOException {
+    return processCommit(chain, optimize, null);
+  }
+
+  SolrQueryResponse processCommit(final String chain, boolean optimize, Boolean commitEndPoint) throws IOException {
     SolrCore core = h.getCore();
     UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain);
     assertNotNull("No Chain named: " + chain, pc);
 
     SolrQueryResponse rsp = new SolrQueryResponse();
     SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
+
+    if (commitEndPoint != null) {
+      ((ModifiableSolrParams)req.getParams()).set(
+          DistributedUpdateProcessor.COMMIT_END_POINT, commitEndPoint.booleanValue());
+    }
+
     try {
       SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req,rsp));
       CommitUpdateCommand cmd = new CommitUpdateCommand(req, false);