EdColeman commented on issue #637:
URL: https://github.com/apache/accumulo/issues/637#issuecomment-753216625


   The advantage of using the uuid in the name vs. putting it in as a value is 
that the node names and sequence can be determined by calling getChildren() and 
then parsing the name.  If the uuid was only in the value, then you would need 
to call getChildren to get the node names, and then each client would need to 
call getData to read the uuid on at least the node with the lowest sequence id. 
If a client needed to know its place in the sequence, that client would need to 
keep calling getData until if found its uuid (if existed at all).
   
   To confirm that the sequence id is based on the parent node I manually 
generated some nodes.  The parent path is `/lock_test/myLocks/` and the 
sequential, ephemeral nodes are named lock-9999`-,` `lock-1234-`, `lock-9876-` 
(and in this order) - the 9999 node should have the lowest sequential id.  
Looking in zookeeper, the nodes created are:
   
   `[zk: localhost:2181(CONNECTED) 5] ls /lock_test/myLocks
   [lock-1234-0000000001, lock-9876-0000000002, lock-9999-0000000000]
   `
   The nodes were created using:
   
   ` zk.create(
           root + "/myLocks/lock-9999-",
           null,
           ZooDefs.Ids.OPEN_ACL_UNSAFE,
           CreateMode.EPHEMERAL_SEQUENTIAL);
   
       zk.create(
           root + "/myLocks/lock-1234-",
           null,
           ZooDefs.Ids.OPEN_ACL_UNSAFE,
           CreateMode.EPHEMERAL_SEQUENTIAL);
   
       zk.create(
           root + "/myLocks/lock-9876-",
           null,
           ZooDefs.Ids.OPEN_ACL_UNSAFE,
           CreateMode.EPHEMERAL_SEQUENTIAL);
   `
   After the test exits, but with the zookeeper instance still running - the 
sequential ids continue to increase, but the order remains as expected. On the 
second run, the created nodes are:
   
   `[zk: localhost:2181(CONNECTED) 7] ls /lock_test/myLocks
   [lock-1234-0000000004, lock-9876-0000000005, lock-9999-0000000003]
   `


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to