mirror of https://github.com/apache/lucene.git
SOLR-6123: Make CLUSTERSTATE Api unblocked and non-blocking always
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1600535 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0c7183cd8f
commit
19da2d5f1e
|
@ -321,7 +321,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
|||
}
|
||||
|
||||
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 implements Runnable, ClosableThread {
|
|||
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 implements Runnable, ClosableThread {
|
|||
} 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 implements Runnable, ClosableThread {
|
|||
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 implements Runnable, ClosableThread {
|
|||
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 implements Runnable, ClosableThread {
|
|||
runningTasks.remove(id);
|
||||
}
|
||||
|
||||
if (collectionName != null) {
|
||||
if (!CLUSTERSTATUS.isEqual(operation) && collectionName != null) {
|
||||
synchronized (collectionWip) {
|
||||
collectionWip.remove(collectionName);
|
||||
}
|
||||
|
|
|
@ -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 extends AbstractFullDistribZkTestBase {
|
|||
|
||||
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." +
|
||||
|
|
Loading…
Reference in New Issue