mirror of https://github.com/apache/lucene.git
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:
parent
bbd4548428
commit
2cc87df6ef
|
@ -185,6 +185,17 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
|
||||||
// we are going to attempt to be the leader
|
// we are going to attempt to be the leader
|
||||||
// first cancel any current recovery
|
// first cancel any current recovery
|
||||||
core.getUpdateHandler().getSolrCoreState().cancelRecovery();
|
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;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
success = syncStrategy.sync(zkController, core, leaderProps);
|
success = syncStrategy.sync(zkController, core, leaderProps);
|
||||||
|
|
|
@ -94,13 +94,7 @@ public class SyncStrategy {
|
||||||
log.error("No UpdateLog found - cannot sync");
|
log.error("No UpdateLog found - cannot sync");
|
||||||
return false;
|
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);
|
success = syncReplicas(zkController, core, leaderProps);
|
||||||
} finally {
|
} finally {
|
||||||
SolrRequestInfo.clearRequestInfo();
|
SolrRequestInfo.clearRequestInfo();
|
||||||
|
|
Loading…
Reference in New Issue