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/05/27 15:29:32 UTC

svn commit: r1682016 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/core/SolrCore.java

Author: thelabdude
Date: Wed May 27 13:29:32 2015
New Revision: 1682016

URL: http://svn.apache.org/r1682016
Log:
SOLR-7587: Move the call to seed version buckets to before buffering updates during core construction

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1682016&r1=1682015&r2=1682016&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed May 27 13:29:32 2015
@@ -363,6 +363,11 @@ Bug Fixes
 * SOLR-7585: Fix NoSuchElementException in LFUCache resulting from heavy writes
   making concurrent put() calls. (Maciej Zasada via Shawn Heisey)
 
+* SOLR-7587: Seeding bucket versions from index when the firstSearcher event fires has a race condition
+  that leads to an infinite wait on VersionInfo's ReentrantReadWriteLock because the read-lock acquired
+  during a commit cannot be upgraded to a write-lock needed to block updates; solution is to move the
+  call out of the firstSearcher event path and into the SolrCore constructor. (Timothy Potter)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1682016&r1=1682015&r2=1682016&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java Wed May 27 13:29:32 2015
@@ -841,6 +841,9 @@ public final class SolrCore implements S
       }
     }
 
+    // seed version buckets with max from index during core initialization ... requires a searcher!
+    seedVersionBucketsWithMaxFromIndex();
+
     bufferUpdatesIfConstructing(coreDescriptor);
     
     // For debugging   
@@ -849,16 +852,20 @@ public final class SolrCore implements S
 
     this.ruleExpiryLock = new ReentrantLock();
     registerConfListener();
+  }
 
-    // seed version buckets with max from index during core initialization
-    if (this.updateHandler != null && this.updateHandler.getUpdateLog() != null) {
+  private void seedVersionBucketsWithMaxFromIndex() {
+    UpdateHandler uh = getUpdateHandler();
+    if (uh != null && uh.getUpdateLog() != null) {
       RefCounted<SolrIndexSearcher> newestSearcher = getRealtimeSearcher();
       if (newestSearcher != null) {
         try {
-          this.updateHandler.getUpdateLog().onFirstSearcher(newestSearcher.get());
+          uh.getUpdateLog().onFirstSearcher(newestSearcher.get());
         } finally {
           newestSearcher.decref();
         }
+      } else {
+        log.warn("No searcher available! Cannot seed version buckets with max from index.");
       }
     }
   }