Tweak leadership election trace to aid debugging

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1685446 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ramkumar Aiyengar 2015-06-14 19:16:11 +00:00
parent 164972785c
commit 0b0189f77c
1 changed files with 3 additions and 3 deletions

View File

@ -181,6 +181,7 @@ public class LeaderElector {
String watchedNode = holdElectionPath + "/" + seqs.get(toWatch);
zkClient.getData(watchedNode, watcher = new ElectionWatcher(context.leaderSeqPath , watchedNode,seq, context) , null, true);
log.info("Watching path {} to know if I could be the leader", watchedNode);
} catch (KeeperException.SessionExpiredException e) {
throw e;
} catch (KeeperException e) {
@ -278,7 +279,7 @@ public class LeaderElector {
while (cont) {
try {
if(joinAtHead){
log.info("node {} Trying to join election at the head ", id);
log.info("Node {} trying to join election at the head", id);
List<String> nodes = OverseerCollectionProcessor.getSortedElectionNodes(zkClient, shardsElectZkPath);
if(nodes.size() <2){
leaderSeqPath = zkClient.create(shardsElectZkPath + "/" + id + "-n_", null,
@ -293,14 +294,13 @@ public class LeaderElector {
}
leaderSeqPath = shardsElectZkPath + "/" + id + "-n_"+ m.group(1);
zkClient.create(leaderSeqPath, null, CreateMode.EPHEMERAL, false);
log.info("Joined at the head {}", leaderSeqPath );
}
} else {
leaderSeqPath = zkClient.create(shardsElectZkPath + "/" + id + "-n_", null,
CreateMode.EPHEMERAL_SEQUENTIAL, false);
}
log.info("Joined leadership election with path: {}", leaderSeqPath);
context.leaderSeqPath = leaderSeqPath;
cont = false;
} catch (ConnectionLossException e) {