You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jay Zarfoss (JIRA)" <ji...@apache.org> on 2013/07/19 03:58:48 UTC

[jira] [Commented] (CURATOR-44) LeaderSelector does not assign leader randomly

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

Jay Zarfoss commented on CURATOR-44:
------------------------------------

I'm thinking it may be best to simply update the Javadoc for LeaderSelector and then consider some new Leader-election paradigm.

In order for leadership to really be random for a given group of nodes, we'd need to randomly re-evaluate the leadership every time a node entered the group.  Otherwise in the pathological case where node A always starts two minutes before node B, node A will always be the leader for everything (which is probably what you're experiencing).     So for leadership to be random in this case that means that node A would need to get voted off the island, which to me implies something like a "loseLeadership()" method in the callback, which probably would warrant a new Leadership paradigm like "VulnerableLeaderSelector".  

Thoughts?
                
> LeaderSelector does not assign leader randomly
> ----------------------------------------------
>
>                 Key: CURATOR-44
>                 URL: https://issues.apache.org/jira/browse/CURATOR-44
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.0.1-incubating
>            Reporter: Anders Wallgren
>
> The javadoc for LeaderSelector says leadership is assigned randomly but this does not appear to be the case.
> A fair mutex is used so it appears that leaders are selected in the order that they attempt to acquire the mutex.
> This probably wouldn't be much more than a documentation issue except that it tends to concentrate leaders on one node in the cluster when each node participates in more than one election (and assuming the node starts the LeaderSelectors right around the time the node comes up, which is the case in our usage).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Created] (CURATOR-44) LeaderSelector does not assign leader randomly

Posted by Jay Zarfoss <jz...@netflix.com>.
> it seems like having the application choose to "give up" leadership either
periodically or based on having "too many" tasks that it is in charge of.

Agreed that definitely smells better.  So sounds like this issue is just a
javadoc update.



On Thu, Jul 18, 2013 at 7:12 PM, Eric Tschetter <ec...@gmail.com> wrote:

> I'm not quite sure I fully understand the use case, but if you are counting
> on randomness to create an even distribution of leaders across your nodes,
> it seems like having the application choose to "give up" leadership either
> periodically or based on having "too many" tasks that it is in charge of.
>
> It would be pretty difficult to figure out how to correctly interrupt the
> current leader at the correct time from Curator, but it should be pretty
> simple for the application itself to know when a good time is.
>

Re: [jira] [Created] (CURATOR-44) LeaderSelector does not assign leader randomly

Posted by Eric Tschetter <ec...@gmail.com>.
I'm not quite sure I fully understand the use case, but if you are counting
on randomness to create an even distribution of leaders across your nodes,
it seems like having the application choose to "give up" leadership either
periodically or based on having "too many" tasks that it is in charge of.

It would be pretty difficult to figure out how to correctly interrupt the
current leader at the correct time from Curator, but it should be pretty
simple for the application itself to know when a good time is.