[ 
https://issues.apache.org/jira/browse/SOLR-5689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889390#comment-13889390
 ] 

Daniel Collins commented on SOLR-5689:
--------------------------------------

My understanding of what `LeaderElector.setup()` does is that it just creates 
the `/overseer_elect/election` "directory" in ZK.  This isn't ephemeral, so in 
reality should only be a one-off job?  Unless ZK has been wiped whilst the node 
was disconnected from ZK, that directory should still be there.  It shouldn't 
hurt to add in the call to setup in reconnect, but I don't believe it is 
necessary.

cancelElection() removes the `leaderSeqPath` which is the ephemeral node(s) 
under that "directory", e.g. 
"19127283862405127-xxxxxxx:yyyyy_solr-n_0000000368" in my case.

> On reconnect, ZkController cancels election on first context rather than 
> latest
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-5689
>                 URL: https://issues.apache.org/jira/browse/SOLR-5689
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.6.1, 5.0, 4.7
>            Reporter: Gregory Chanan
>
> I haven't tested this yet, so I could be wrong, but this is my reading of the 
> code:
> During init:
> {code}
> ElectionContext context = new OverseerElectionContext(zkClient, overseer, 
> getNodeName());
> overseerElector.setup(context);
> overseerElector.joinElection(context, false);
> {code}
> On reconnect:
> {code}
> ElectionContext context = new OverseerElectionContext(zkClient,overseer, 
> getNodeName());
>               
> ElectionContext prevContext = overseerElector.getContext();
> if (prevContext != null) {
>   prevContext.cancelElection();
> }
>               
> overseerElector.joinElection(context, true);
> {code}
> setup doesn't appear to be called on reconnect, so the new context is never 
> set and the first context gets cancelled over and over.
> A call to overseerElector.setup(context); before joinElection in the 
> reconnect case would address this.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to