You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2014/06/05 01:02:57 UTC
svn commit: r1600535 - in /lucene/dev/trunk/solr/core/src:
java/org/apache/solr/cloud/OverseerCollectionProcessor.java
test/org/apache/solr/cloud/MultiThreadedOCPTest.java
Author: anshum
Date: Wed Jun 4 23:02:56 2014
New Revision: 1600535
URL: http://svn.apache.org/r1600535
Log:
SOLR-6123: Make CLUSTERSTATE Api unblocked and non-blocking always
Modified:
lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1600535&r1=1600534&r2=1600535&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java Wed Jun 4 23:02:56 2014
@@ -321,7 +321,7 @@ public class OverseerCollectionProcessor
}
try {
- markTaskAsRunning(head, collectionName, asyncId);
+ markTaskAsRunning(head, collectionName, asyncId, message);
log.debug("Marked task [{}] as running", head.getId());
} catch (KeeperException.NodeExistsException e) {
// This should never happen
@@ -366,6 +366,10 @@ public class OverseerCollectionProcessor
if(collectionName == null)
return true;
+ // CLUSTERSTATUS is always mutually exclusive
+ if(CLUSTERSTATUS.isEqual(message.getStr(Overseer.QUEUE_OPERATION)))
+ return true;
+
if(collectionWip.contains(collectionName))
return false;
@@ -2560,7 +2564,8 @@ public class OverseerCollectionProcessor
} while(true);
}
- private void markTaskAsRunning(QueueEvent head, String collectionName,String asyncId)
+ private void markTaskAsRunning(QueueEvent head, String collectionName,
+ String asyncId, ZkNodeProps message)
throws KeeperException, InterruptedException {
synchronized (runningZKTasks) {
runningZKTasks.add(head.getId());
@@ -2569,7 +2574,7 @@ public class OverseerCollectionProcessor
synchronized (runningTasks) {
runningTasks.add(head.getId());
}
- if(collectionName != null) {
+ if(!CLUSTERSTATUS.isEqual(message.getStr(Overseer.QUEUE_OPERATION)) && collectionName != null) {
synchronized (collectionWip) {
collectionWip.add(collectionName);
}
@@ -2662,7 +2667,7 @@ public class OverseerCollectionProcessor
if(asyncId != null)
runningMap.remove(asyncId);
- if(collectionName != null) {
+ if(!CLUSTERSTATUS.isEqual(operation) && collectionName != null) {
synchronized (collectionWip) {
collectionWip.remove(collectionName);
}
@@ -2679,7 +2684,7 @@ public class OverseerCollectionProcessor
runningTasks.remove(id);
}
- if (collectionName != null) {
+ if (!CLUSTERSTATUS.isEqual(operation) && collectionName != null) {
synchronized (collectionWip) {
collectionWip.remove(collectionName);
}
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java?rev=1600535&r1=1600534&r2=1600535&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java Wed Jun 4 23:02:56 2014
@@ -17,12 +17,15 @@ package org.apache.solr.cloud;
* limitations under the License.
*/
+import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.common.params.CollectionParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.update.DirectUpdateHandler2;
import org.junit.Before;
@@ -191,6 +194,16 @@ public class MultiThreadedOCPTest extend
invokeCollectionApi("action", CollectionParams.CollectionAction.OVERSEERSTATUS.toLower());
+ // CLUSTERSTATE is always mutually exclusive, it should return with a response before the split completes
+
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.set("action", CollectionParams.CollectionAction.CLUSTERSTATUS.toString());
+ params.set("collection", "collection1");
+ SolrRequest request = new QueryRequest(params);
+ request.setPath("/admin/collections");
+
+ server.request(request);
+
state = getRequestState("2000", server);
assertTrue("After invoking OVERSEERSTATUS, SplitShard task [2000] was still supposed to be in [running] but isn't." +