zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lahiru Gunathilake <glah...@gmail.com>
Subject Re: EPEHMERAL_SEQUENCIAL and EPHEMERAL_SEQUENTIAL constants
Date Fri, 20 Jun 2014 13:50:49 GMT
Hi Edward,

Thank You very much for the response.

Yes I wanted to know about sequencial node part.

so the usecase is when two clients try to create same nodes with same name
zk change the naming ? If my system is well defined and no random node
creation I do not need this feature ?

If I have random node creation I always have to get the childnodes and then
get the nodes based on naming ? or can I just stick to the name I gave when
I tried to save the node ?
In your example I think clients tried to create the nodes with the name
/leader/serv but zk created something else.
ex: leader/serv_000000001

In this case can I just get the node with /leader/serv or should I get with
/leader/serv_000000001

Anyways for my application I do not need this because I do not have a
scenario where naming is nondeterministic between zk clients.

Regards
Lahiru


On Fri, Jun 20, 2014 at 9:42 AM, Edward Ribeiro <edward.ribeiro@gmail.com>
wrote:

> Hi Lahiru,
>
> You mean EPHEMERAL and EPHEMERAL_SEQUENTIAL, right?
>
> A znode is created by a client logged on a session. Both EPHEMERAL and
> EPHEMERAL_SEQUENTIAL znodes are deleted once the session -- where the znode
> was created --  expires (that is, the user disconnects). The difference
> between the two types of ephemeral node is that EPHEMERAL_SEQUENTIAL allows
> you to create an atomic and sequentially increasing number suffixes.
>
> For example, if three clients are trying to create child
> ephemeral_sequential znodes of a '/leader' parent znode at the same time
> they will be generated as follows (for example):
>
> /leader/serv_000000001
> /leader/serv_000000002
> /leader/serv_000000003
>
> the number suffix was automatically appended by ZK such that no two clients
> will generate the same znode (serv_00000001, for example). If the client
> which created znode 'serv_00000002' disconnects then ZK automatically
> deletes that znode.
>
> Got it?
>
> Edward
>
>
>
>
>
> On Thu, Jun 19, 2014 at 2:53 PM, Lahiru Gunathilake <glahiru@gmail.com>
> wrote:
>
> > When creating a node we have to parse the constants and there are four.
> > PERSISTENT, PERSISTENT_SEQUENTIAL, EPHEMERAL, EPHEMERAL_SEQUENTIAL
> >
> > I do not really get the description of two constants EPEHMERAL_SEQUENCIAL
> > and EPHEMERAL_SEQUENTIAL. In API docs it says like below.
> >
> > The znode will be deleted upon the client's disconnect, and its name will
> > be appended with a monotonically increasing number.
> >
> > Can someone please describe me what this is about.
> >
> > Regards
> > Lahiru
> >
> > --
> > System Analyst Programmer
> > PTI Lab
> > Indiana University
> >
>



-- 
System Analyst Programmer
PTI Lab
Indiana University

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message