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/24 22:23:00 UTC

[lucene-solr] branch reference_impl_dev updated: @1384 Some reuse cleanup.

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 2688074  @1384 Some reuse cleanup.
2688074 is described below

commit 2688074707fb8aa576f1fcc29981e2f8b66b0611
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Feb 24 16:22:28 2021 -0600

    @1384 Some reuse cleanup.
    
    Took 12 minutes
---
 .../apache/solr/handler/extraction/ExtractingDocumentLoader.java | 2 +-
 solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java  | 1 -
 solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java  | 1 +
 solr/core/src/java/org/apache/solr/update/UpdateLog.java         | 1 +
 .../apache/solr/update/processor/DistributedUpdateProcessor.java | 8 ++++----
 .../solr/update/processor/DistributedZkUpdateProcessor.java      | 5 -----
 .../solrj/src/java/org/apache/solr/common/SolrInputDocument.java | 9 ---------
 7 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java
index 585d9bd..ae40b7e 100644
--- a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java
+++ b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/ExtractingDocumentLoader.java
@@ -108,7 +108,7 @@ public class ExtractingDocumentLoader extends ContentStreamLoader {
     this.processor = processor;
 
     templateAdd = AddUpdateCommand.THREAD_LOCAL_AddUpdateCommand.get();
-
+    templateAdd.clear();
     this.req = req;
     this.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
     this.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
diff --git a/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java b/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
index d4dd732..6054a5b 100644
--- a/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
+++ b/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
@@ -85,7 +85,6 @@ public class SolrRequestInfo {
       threadLocal.remove();
       AddUpdateCommand.THREAD_LOCAL_AddUpdateCommand.get().clearAll();
       AddUpdateCommand.THREAD_LOCAL_AddUpdateCommand_TLOG.get().clearAll();
-      SolrInputDocument.THREAD_LOCAL_MaskCharSolrInputDocument.get().clear();
       SolrInputDocument.THREAD_LOCAL_SolrInputDocument.get().clear();
     }
   }
diff --git a/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java b/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
index 7e2d8c7..b44b1d4 100644
--- a/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
+++ b/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
@@ -105,6 +105,7 @@ public class AddUpdateCommand extends UpdateCommand {
      prevVersion = -1;
      overwrite = true;
      commitWithin = -1;
+     req = null;
    }
 
   public void clearAll() {
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
index 47ae031..0ef00b9 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -2107,6 +2107,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
 
                 AddUpdateCommand cmd = AddUpdateCommand.THREAD_LOCAL_AddUpdateCommand_TLOG.get();
                 cmd.clear();
+                cmd.setReq(req);
                 execute(cmd, executor, pendingTasks, proc, exceptionOnExecuteUpdate, req, (SolrInputDocument) entry.get(entry.size() - 1), oper, version, prevVersion);
                 break;
               }
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
index 081f677..ddf5354 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
@@ -1034,14 +1034,14 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
   // internal helper method to setup request by processors who use this class.
   // NOTE: not called by this class!
   protected void setupRequest(UpdateCommand cmd) {
+    if (req.getCore().getCoreContainer().isZooKeeperAware()) {
+      throw new IllegalStateException();
+    }
+
     updateCommand = cmd;
     isLeader = getNonZkLeaderAssumption(req);
   }
 
-  boolean noDistrib() {
-    return false;
-  }
-
   protected List<SolrCmdDistributor.Node> getNodes() {
     return null;
   }
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 a0b50b2..7ac2640 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
@@ -663,11 +663,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
     }
   }
 
-  @Override
-  boolean noDistrib() {
-    return !forwardToLeader && nodes == null && !isSubShardLeader; // MRM TODO: what about sub shard leader?
-  }
-
   protected List<SolrCmdDistributor.Node> setupRequest(String id, SolrInputDocument doc) {
     return setupRequest(id, doc, null);
   }
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java b/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java
index 77a46c4..73a2946 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java
@@ -26,7 +26,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.function.BiConsumer;
 
-import org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec;
 import org.apache.solr.common.params.CommonParams;
 
 /**
@@ -46,14 +45,6 @@ public class SolrInputDocument extends SolrDocumentBase<SolrInputField, SolrInpu
     }
   };
 
-  public final static ThreadLocal<SolrInputDocument> THREAD_LOCAL_MaskCharSolrInputDocument= new ThreadLocal<>(){
-    protected SolrInputDocument initialValue() {
-      return new JavaBinUpdateRequestCodec.MaskCharSequenceSolrInputDoc(new LinkedHashMap());
-    }
-  };
-
-
-
   private final Map<String,SolrInputField> _fields;
   private List<SolrInputDocument> _childDocuments;