Árni Már Jónsson commented on ZOOKEEPER-555:


Thank you for the advice.

The use case I'm interested involves leader election. I have a set servers, 1 
master and multiple slaves. Each server publishes an ephemeral sequence child 
znode into a commonly known znode, of the form host:port. The first node 
(sorted on the sequence number) is considered to be the master. The servers 
only publish their existence, and are generally not aware of each other.

Clients are responsible for notifying the servers if they are master, or if 
they are slaves, and if so who is the master. They do this when they first read 
the child list, and each time the child list changes.  The notifications are 
idempotent, but if e.g. the list changes 2 times, and one client is able to 
notify the servers of both version before some other client sees them, the 
servers will have their status changes 4 times instead of 2. Worst case is N x 
#clients, for N changes, instead of N.

I'd like to keep the cost of these as small as possible. One way is to include 
the child list version number with the notification, and have the server only 
accept it, if the version is larger than one seen before.

I'll prepare a new patch which fits your requirements.

> Add stat information to GetChildrenResponse
> -------------------------------------------
>                 Key: ZOOKEEPER-555
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-555
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: c client, contrib-bindings, java client, server
>    Affects Versions: 3.3.0
>            Reporter: Árni Már Jónsson
>            Assignee: Árni Már Jónsson
>            Priority: Minor
>             Fix For: 3.3.0
>         Attachments: getchildren_stat.patch
> GetChildren() is the only non-create/delete API which does not include the 
> node stat information. I propose that the definition of GetChildren() should 
> be:
>     class GetChildrenResponse {
>         vector<ustring> children;
>         org.apache.zookeeper.data.Stat stat;
>     }
> There is a trivial fix to the server (FinalRequestProcessor.java): rsp = new 
> GetChildrenResponse(children, stat);
> And something similar to the  client library.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Reply via email to