SOLR-5516: Try only waiting if we are a replacement leader and waiting a bit longer.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1546851 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-12-01 20:15:47 +00:00
parent bbd4548428
commit 2cc87df6ef
2 changed files with 12 additions and 7 deletions

View File

@ -185,6 +185,17 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
// we are going to attempt to be the leader
// first cancel any current recovery
core.getUpdateHandler().getSolrCoreState().cancelRecovery();
if (weAreReplacement) {
// wait a moment for any floating updates to finish
try {
Thread.sleep(2500);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, e);
}
}
boolean success = false;
try {
success = syncStrategy.sync(zkController, core, leaderProps);

View File

@ -94,13 +94,7 @@ public class SyncStrategy {
log.error("No UpdateLog found - cannot sync");
return false;
}
// wait a second for any floating updates to finish
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, e);
}
success = syncReplicas(zkController, core, leaderProps);
} finally {
SolrRequestInfo.clearRequestInfo();