curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Ferreira <>
Subject Re: Regarding leadership status
Date Tue, 27 Jan 2015 11:31:50 GMT
Cam, that's not exactly the problem I'm facing.

My question is that all nodes that are connected to Zookeeper think they're
not leaders, because the node that was a leader died and ZK didn't caught
the event yet.

In my case this will result in some operations to never be executed,
because their the leader's responsibility.

On Tue, Jan 27, 2015 at 11:04 AM, Cameron McKenzie <>

> hey Ricardo,
> That's an interesting problem.
> If a node is disconnected from ZK it will report that it did not have
> leadership, regardless of whether its ephemeral node on ZK has been removed
> or not.
> If a node is not connected to ZK then I guess it could persist messages
> until it is reconnected and then process them afterwards. The issue being
> that it may no longer be leader in which case the messages would not be
> processed by any node. Not sure if it's possible / practical, but I guess
> the node could re-broadcast all of the persisted messages to all nodes (or
> just the current leader) once it reconnected to ZK.
> cheers
> Cam
> On Tue, Jan 27, 2015 at 8:20 PM, Ricardo Ferreira <>
> wrote:
>> Hello all,
>> I'm using Zookeeper (through Curator) for leadership election on an
>> application I'm currently developing.
>> Some operations can only be written by one of the members of the cluster,
>> so I'm using a node's leadership
>> status to this effect.
>> For example, let's say a message arrives to all nodes but only one should
>> do something about it. What I do
>> is to check if the node is leader (through
>> LeaderSelector#hasLeadership()), and if it is then it does whatever
>> it needs to do with the message. If it's not, it simply ignores it.
>> My question is this: How can I be sure a node *really is* the leader?
>> What if the leader node is actually down but
>> this hasn't been detected by Zookeeper yet? Then the non-leader nodes
>> will ignore the message and it will
>> never be processed.
>> How is this usually dealt with?
>> Regards

View raw message