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/02/27 03:49:42 UTC

[lucene-solr] branch reference_impl_dev updated: @1414 Try and avoid tlog replay fail due to thread safety.

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new faa49cd  @1414 Try and avoid tlog replay fail due to thread safety.
faa49cd is described below

commit faa49cdfa72a0ae0ca77ad392f73ad1424fc7e60
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Feb 26 21:49:19 2021 -0600

    @1414 Try and avoid tlog replay fail due to thread safety.
    
    Took 25 minutes
---
 .../update/processor/LogUpdateProcessorFactory.java     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java b/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
index 2be93c3..b838470 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/LogUpdateProcessorFactory.java
@@ -31,6 +31,7 @@ import org.apache.solr.update.CommitUpdateCommand;
 import org.apache.solr.update.DeleteUpdateCommand;
 import org.apache.solr.update.MergeIndexesCommand;
 import org.apache.solr.update.RollbackUpdateCommand;
+import org.apache.solr.update.UpdateCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -105,6 +106,12 @@ public class LogUpdateProcessorFactory extends UpdateRequestProcessorFactory imp
       // call delegate first so we can log things like the version that get set later
       if (next != null) next.processAdd(cmd);
 
+      if ((cmd.getFlags() & UpdateCommand.REPLAY) != 0) {
+        // replays can come multi threaded from the replay executor
+        // and these lists are not thread safe or really that desirable anyway
+        return;
+      }
+
       // Add a list of added id's to the response
       if (adds == null) {
         adds = new ArrayList<>();
@@ -128,6 +135,11 @@ public class LogUpdateProcessorFactory extends UpdateRequestProcessorFactory imp
       }
       if (next != null) next.processDelete(cmd);
 
+      if ((cmd.getFlags() & UpdateCommand.REPLAY) != 0) {
+        // replays can come multi threaded from the replay executor
+        // and these lists are not thread safe or really that desirable anyway
+        return;
+      }
       if (cmd.isDeleteById()) {
         if (deletes == null) {
           deletes = new ArrayList<>();
@@ -168,6 +180,11 @@ public class LogUpdateProcessorFactory extends UpdateRequestProcessorFactory imp
       }
       if (next != null) next.processCommit(cmd);
 
+      if ((cmd.getFlags() & UpdateCommand.REPLAY) != 0) {
+        // replays can come multi threaded from the replay executor
+        // and these lists are not thread safe or really that desirable anyway
+        return;
+      }
 
       final String msg = cmd.optimize ? "optimize" : "commit";
       toLog.add(msg, "");