SOLR-4806: Shard splitting does not abort if WaitForState times out

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1481145 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2013-05-10 19:01:20 +00:00
parent 3f0814fb79
commit aec783468c
2 changed files with 27 additions and 31 deletions

View File

@ -162,6 +162,8 @@ Bug Fixes
* SOLR-4791: solr.xml sharedLib does not work in 4.3.0 (Ryan Ernst, Jan Høydahl via * SOLR-4791: solr.xml sharedLib does not work in 4.3.0 (Ryan Ernst, Jan Høydahl via
Erick Erickson) Erick Erickson)
* SOLR-4806: Shard splitting does not abort if WaitForState times out (shalin)
Other Changes Other Changes
---------------------- ----------------------

View File

@ -372,13 +372,10 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
} }
} }
ShardResponse srsp; // do not abort splitshard if the unloading fails
do { // this can happen because the replicas created previously may be down
srsp = shardHandler.takeCompletedOrError(); // the only side effect of this is that the sub shard may end up having more replicas than we want
if (srsp != null) { collectShardResponses(results, false, null);
processResponse(results, srsp);
}
} while (srsp != null);
for (int i=0; i<subRanges.size(); i++) { for (int i=0; i<subRanges.size(); i++) {
String subSlice = subSlices.get(i); String subSlice = subSlices.get(i);
@ -413,12 +410,8 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
sendShardRequest(nodeName, new ModifiableSolrParams(cmd.getParams())); sendShardRequest(nodeName, new ModifiableSolrParams(cmd.getParams()));
} }
do { collectShardResponses(results, true,
srsp = shardHandler.takeCompletedOrError(); "SPLTSHARD failed to create subshard leaders or timed out waiting for them to come up");
if (srsp != null) {
processResponse(results, srsp);
}
} while (srsp != null);
log.info("Successfully created all sub-shards for collection " log.info("Successfully created all sub-shards for collection "
+ collectionName + " parent shard: " + slice + " on: " + parentShardLeader); + collectionName + " parent shard: " + slice + " on: " + parentShardLeader);
@ -436,12 +429,7 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
} }
sendShardRequest(parentShardLeader.getNodeName(), params); sendShardRequest(parentShardLeader.getNodeName(), params);
do { collectShardResponses(results, true, "SPLITSHARD failed to invoke SPLIT core admin command");
srsp = shardHandler.takeCompletedOrError();
if (srsp != null) {
processResponse(results, srsp);
}
} while (srsp != null);
log.info("Index on shard: " + nodeName + " split into two successfully"); log.info("Index on shard: " + nodeName + " split into two successfully");
@ -458,12 +446,8 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
sendShardRequest(nodeName, params); sendShardRequest(nodeName, params);
} }
do { collectShardResponses(results, true,
srsp = shardHandler.takeCompletedOrError(); "SPLITSHARD failed while asking sub shard leaders to apply buffered updates");
if (srsp != null) {
processResponse(results, srsp);
}
} while (srsp != null);
log.info("Successfully applied buffered updates on : " + subShardNames); log.info("Successfully applied buffered updates on : " + subShardNames);
@ -535,12 +519,9 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
} }
} }
do { collectShardResponses(results, true,
srsp = shardHandler.takeCompletedOrError(); "SPLTSHARD failed to create subshard replicas or timed out waiting for them to come up");
if (srsp != null) {
processResponse(results, srsp);
}
} while (srsp != null);
log.info("Successfully created all replica shards for all sub-slices " log.info("Successfully created all replica shards for all sub-slices "
+ subSlices); + subSlices);
@ -565,6 +546,19 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
} }
} }
private void collectShardResponses(NamedList results, boolean abortOnError, String msgOnError) {
ShardResponse srsp;
do {
srsp = shardHandler.takeCompletedOrError();
if (srsp != null) {
processResponse(results, srsp);
if (abortOnError && srsp.getException() != null) {
throw new SolrException(ErrorCode.SERVER_ERROR, msgOnError, srsp.getException());
}
}
} while (srsp != null);
}
private void sendShardRequest(String nodeName, ModifiableSolrParams params) { private void sendShardRequest(String nodeName, ModifiableSolrParams params) {
ShardRequest sreq = new ShardRequest(); ShardRequest sreq = new ShardRequest();
params.set("qt", adminPath); params.set("qt", adminPath);