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/12 12:13:18 UTC

[lucene-solr] branch reference_impl_dev updated: @526 Shine it up - latch released a line early

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 062e5e6  @526 Shine it up - latch released a line early
062e5e6 is described below

commit 062e5e68735b29384154c690deb59eb37eef0500
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Aug 12 07:06:59 2020 -0500

    @526 Shine it up - latch released a line early
---
 .../src/java/org/apache/solr/core/PluginBag.java   |  2 +-
 .../src/java/org/apache/solr/core/SolrCore.java    | 24 ++++++----------------
 2 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/core/PluginBag.java b/solr/core/src/java/org/apache/solr/core/PluginBag.java
index 9300c84..3f4d651 100644
--- a/solr/core/src/java/org/apache/solr/core/PluginBag.java
+++ b/solr/core/src/java/org/apache/solr/core/PluginBag.java
@@ -455,7 +455,7 @@ public class PluginBag<T> implements AutoCloseable {
     private final SolrConfig.SolrPluginInfo pluginMeta;
     protected SolrException solrException;
     private final SolrCore core;
-    protected ResourceLoader resourceLoader;
+    protected final ResourceLoader resourceLoader;
     private final boolean isRuntimeLib;
 
 
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index aee3a15..32509bd 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -215,7 +215,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
   private final PluginBag<UpdateRequestProcessorFactory> updateProcessors = new PluginBag<>(UpdateRequestProcessorFactory.class, this, true);
   private final Map<String, UpdateRequestProcessorChain> updateProcessorChains;
   private final SolrCoreMetricManager coreMetricManager;
-  private final Map<String, SolrInfoBean> infoRegistry = new ConcurrentHashMap<>(256, 0.75f, 12);
+  private final Map<String, SolrInfoBean> infoRegistry = new ConcurrentHashMap<>(64, 0.75f, 6);
   private final IndexDeletionPolicyWrapper solrDelPolicy;
   private final SolrSnapshotMetaDataManager snapshotMgr;
   private final DirectoryFactory directoryFactory;
@@ -236,7 +236,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
   private volatile Counter newSearcherOtherErrorsCounter;
   private final CoreContainer coreContainer;
 
-  private final Set<String> metricNames = ConcurrentHashMap.newKeySet();
+  private final Set<String> metricNames = ConcurrentHashMap.newKeySet(64);
   private final String metricTag = SolrMetricProducer.getUniqueMetricTag(this, null);
   private final SolrMetricsContext solrMetricsContext;
 
@@ -278,8 +278,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
 
   static int boolean_query_max_clause_count = Integer.MIN_VALUE;
 
-  private ExecutorService coreAsyncTaskExecutor = ExecutorUtil.newMDCAwareCachedThreadPool("Core Async Task");
-
   /**
    * The SolrResourceLoader used to load all resources for this core.
    *
@@ -1088,8 +1086,8 @@ public final class SolrCore implements SolrInfoBean, Closeable {
         solrCoreState.increfSolrCoreState();
       }
 
-      latch.countDown();
       resourceLoader.inform(this); // last call before the latch is released.
+      latch.countDown();
     } catch (Throwable e) {
       // release the latch, otherwise we block trying to do the close. This
       // should be fine, since counting down on a latch of 0 is still fine
@@ -1597,11 +1595,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
       synchronized (searcherLock) {
         this.isClosed = true;
         searcherExecutor.shutdown();
-        try {
-          coreAsyncTaskExecutor.shutdown();
-        } catch (Throwable e) {
-          ParWork.propegateInterrupt(e);
-        }
       }
 
       List<Callable<Object>> closeHookCalls = new ArrayList<>();
@@ -1665,11 +1658,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
         return solrCoreState;
       });
 
-      closer.add("coreAsyncTaskExecutor", coreAsyncTaskExecutor, () -> {
-
-        return "Searcher";
-      });
-
       closer.add("shutdown", () -> {
 
         synchronized (searcherLock) {
@@ -2410,7 +2398,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
 
         if (currSearcher == null) {
           future = searcherExecutor.submit(() -> {
-            try (ParWork work = new ParWork(this, true)) {
+            try (ParWork work = new ParWork(this, false)) {
               for (SolrEventListener listener : firstSearcherListeners) {
                 work.collect(() -> {
                   listener.newSearcher(newSearcher, null);
@@ -2424,7 +2412,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
 
         if (currSearcher != null) {
           future = searcherExecutor.submit(() -> {
-            try (ParWork work = new ParWork(this, true)) {
+            try (ParWork work = new ParWork(this, false)) {
               for (SolrEventListener listener : newSearcherListeners) {
                 work.collect(() -> {
                   listener.newSearcher(newSearcher, null);
@@ -3321,6 +3309,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
    * @param r the task to run
    */
   public void runAsync(Runnable r) {
-    coreAsyncTaskExecutor.submit(r);
+    ParWork.getExecutor().submit(r);
   }
 }