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 2014/01/20 04:00:00 UTC

svn commit: r1559620 - in /lucene/dev/trunk/solr: CHANGES.txt solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java

Author: markrmiller
Date: Mon Jan 20 02:59:59 2014
New Revision: 1559620

URL: http://svn.apache.org/r1559620
Log:
SOLR-5643: ConcurrentUpdateSolrServer will sometimes not spawn a new Runner thread even though there are updates in the queue.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1559620&r1=1559619&r2=1559620&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Mon Jan 20 02:59:59 2014
@@ -210,6 +210,9 @@ Bug Fixes
   distributed searching for some field types such as legacy numeric
   types (Rob Muir, Mike McCandless)
 
+* SOLR-5643: ConcurrentUpdateSolrServer will sometimes not spawn a new Runner
+  thread even though there are updates in the queue. (Mark Miller)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java?rev=1559620&r1=1559619&r2=1559620&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServer.java Mon Jan 20 02:59:59 2014
@@ -255,16 +255,8 @@ public class ConcurrentUpdateSolrServer 
         }
         handleError(e);
       } finally {
-
-        // remove it from the list of running things unless we are the last
-        // runner and the queue is full...
-        // in which case, the next queue.put() would block and there would be no
-        // runners to handle it.
-        // This case has been further handled by using offer instead of put, and
-        // using a retry loop
-        // to avoid blocking forever (see request()).
         synchronized (runners) {
-          if (runners.size() == 1 && queue.remainingCapacity() == 0) {
+          if (runners.size() == 1 && !queue.isEmpty()) {
             // keep this runner alive
             scheduler.execute(this);
           } else {
@@ -394,6 +386,10 @@ public class ConcurrentUpdateSolrServer 
           runner.runnerLock.lock();
           runner.runnerLock.unlock();
         } else if (!queue.isEmpty()) {
+          // failsafe - should not be necessary, but a good
+          // precaution to ensure blockUntilFinished guarantees
+          // all updates are emptied from the queue regardless of
+          // any bugs around starting or retaining runners
           Runner r = new Runner();
           runners.add(r);
           scheduler.execute(r);