You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Shakeel Rao <sh...@twitter.com.INVALID> on 2021/11/01 21:43:08 UTC

Ephemeral Node Guarantees with Local Sessions Enabled

Hi folks,

I was interested in the ephemeral node guarantees provided by ZooKeeper
when a client reconnects after a session expiry event and stumbled across
this discussion from 2017:
https://www.mail-archive.com/user@zookeeper.apache.org/msg07578.html, which
posed the exact question I was interested in:

"Does ZK guarantee that ephemeral nodes from a client are removed on the
server by the time the client receives a session expiration event?"

The conclusion of the thread was that, indeed, if a client receives a
session expiry event and then reconnects to ZooKeeper, it should *not* see
any of the ephemeral nodes created during the previous session:

"If you ask whether the client will see its ephemerals upon creating a new
session, then the answer is that it shouldn't because the createSession txn
will be ordered necessarily before the closeSession txn, which implies
that the client should not see the ephemerals."

However, this leads me to today's question: does the answer above still
hold if local sessions are enabled?

Consider the following sequence of events, where the ZooKeeper cluster has
*localSessionsEnabled* and *localSessionsUpgradingEnabled* on:
(1) Client A creates an ephemeral node with path */foo/bar/baz*
(2) Client A receives a session expiry event
(3) Client A creates a new ZK session
(4) Client A calls *exists()* for */foo/bar/baz *(the path of the ephemeral
node created in step 1)

Based on the original answer (when local sessions did not exist in
ZooKeeper), client A will never see a non-null value in (4). My question
is: does this property still hold if local sessions are enabled?

Thanks,
Shakeel