No (easy) way to get the current session id

Bug #1298175 reported by Tarrant Rollins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gozk
New
Undecided
Unassigned

Bug Description

After doing a zookeeper.Conn.Get you are given a zookeeper.Stat struct. One of the methods on the Stat struct is EphemeralOwner which returns an int64.

The issue is that you can't lookup your own id from the zookeeper.Conn or zookeeper.ClientId.

Looking through the zookeeper documentation for the Java code they have a `getSessionId` (http://zookeeper.apache.org/doc/r3.4.2/api/org/apache/zookeeper/ZooKeeper.html#getSessionId()) on their Zookeeper object (what appears to be our zookeeper.Conn). It would be nice to have this method.

As a work around I could create a random ephemeral znode, do a stat, get the owner id and then store that locally for comparison, this is a much larger hassle than I'd prefer.

-T

Revision history for this message
Tarrant Rollins (tarrant-8) wrote :

I've attached a patch which adds a very simple `ClientId.SessionId()` method

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.