lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject lucene-solr:branch_6x: SOLR-10588: Prevent redundant double core reload on config update.
Date Wed, 03 May 2017 05:33:23 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x d496d1726 -> 4901daee8


SOLR-10588: Prevent redundant double core reload on config update.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4901daee
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4901daee
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4901daee

Branch: refs/heads/branch_6x
Commit: 4901daee85acd867bd120f3f77c41821ab2aa7fb
Parents: d496d17
Author: Mikhail Khludnev <mkhl@apache.org>
Authored: Sun Apr 30 23:37:51 2017 +0300
Committer: Mikhail Khludnev <mkhl@apache.org>
Committed: Wed May 3 08:33:08 2017 +0300

----------------------------------------------------------------------
 solr/CHANGES.txt                                  |  2 ++
 .../src/java/org/apache/solr/core/SolrCore.java   | 18 ++++++++++++++----
 .../apache/solr/handler/SolrConfigHandler.java    |  5 +++++
 3 files changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4901daee/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 74d46b3..aaf73b7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -166,6 +166,8 @@ Bug Fixes
 
 * SOLR-10316: Unloading a core can remove a ZK SolrCore registration entry for the wrong
SolrCore. (Mark Miller)
 
+* SOLR-10588: Prevent redundant core reload on config update (Mikhail Khludnev)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4901daee/solr/core/src/java/org/apache/solr/core/SolrCore.java
----------------------------------------------------------------------
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 9040685..e17266d 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -99,6 +99,7 @@ import org.apache.solr.core.snapshots.SolrSnapshotMetaDataManager.SnapshotMetaDa
 import org.apache.solr.handler.IndexFetcher;
 import org.apache.solr.handler.ReplicationHandler;
 import org.apache.solr.handler.RequestHandlerBase;
+import org.apache.solr.handler.SolrConfigHandler;
 import org.apache.solr.handler.component.HighlightComponent;
 import org.apache.solr.handler.component.SearchComponent;
 import org.apache.solr.logging.MDCLoggingContext;
@@ -2942,10 +2943,19 @@ public final class SolrCore implements SolrInfoMBean, SolrMetricProducer,
Closea
           checkStale(zkClient, solrConfigPath, overlayVersion) ||
           checkStale(zkClient, managedSchmaResourcePath, managedSchemaVersion)) {
         log.info("core reload {}", coreName);
-        try {
-          cc.reload(coreName);
-        } catch (SolrCoreState.CoreIsClosedException e) {
-          /*no problem this core is already closed*/
+        SolrConfigHandler configHandler = ((SolrConfigHandler)core.getRequestHandler("/config"));
+        if (configHandler.getReloadLock().tryLock()){
+          
+          try {
+            cc.reload(coreName);
+          } catch (SolrCoreState.CoreIsClosedException e) {
+            /*no problem this core is already closed*/
+          } finally {
+            configHandler.getReloadLock().unlock();
+          }
+        
+        } else {
+          log.info("Another reload is in progress. Not doing anything.");
         }
         return;
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4901daee/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java b/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java
index 2409e4b..938925e 100644
--- a/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java
@@ -104,6 +104,11 @@ public class SolrConfigHandler extends RequestHandlerBase implements
SolrCoreAwa
   public static final boolean configEditing_disabled = Boolean.getBoolean(CONFIGSET_EDITING_DISABLED_ARG);
   private static final Map<String, SolrConfig.SolrPluginInfo> namedPlugins;
   private Lock reloadLock = new ReentrantLock(true);
+
+  public Lock getReloadLock() {
+    return reloadLock;
+  }
+
   private boolean isImmutableConfigSet = false;
 
   static {


Mime
View raw message