cancel recovery before trying to sync as new leader - also improve logging

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1370317 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-08-07 15:29:51 +00:00
parent 42a91f6db1
commit 904a504825
1 changed files with 5 additions and 3 deletions

View File

@ -152,17 +152,19 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
if (zkClient.exists(leaderPath, true)) {
zkClient.delete(leaderPath, -1, true);
}
// System.out.println("I may be the new Leader:" + leaderPath
// + " - I need to try and sync");
log.info("I may be the new leader - try and sync");
// we are going to attempt to be the leader
// first cancel any current recovery
core.getUpdateHandler().getSolrCoreState().cancelRecovery();
boolean success = syncStrategy.sync(zkController, core, leaderProps);
if (!success && anyoneElseActive()) {
rejoinLeaderElection(leaderSeqPath, core);
return;
}
}
log.info("I am the new leader: " + ZkCoreNodeProps.getCoreUrl(leaderProps));
// If I am going to be the leader I have to be active
// System.out.println("I am leader go active");
core.getUpdateHandler().getSolrCoreState().cancelRecovery();
zkController.publish(core.getCoreDescriptor(), ZkStateReader.ACTIVE);