Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
According to the Zookeeper docs ZNode sequence numbers will rollover to -2147483648 after reaching 2147483647 (I've also confirmed this is the case in practice):
https://zookeeper.apache.org/doc/r3.7.0/zookeeperProgrammers.html#Sequence+Nodes+–+Unique+Naming
When this rollover happens the negative symbol is incorrectly stripped off the sequence number in ZNodeName due to this code searching for the last index of "-", thus the sequence number parsed is always the absolute value:
https://github.com/apache/zookeeper/blob/1e74a3395a9c3c4d67093f9a073bffb5a176916c/zookeeper-recipes/zookeeper-recipes-lock/src/main/java/org/apache/zookeeper/recipes/lock/ZNodeName.java#L54
This results in any subsequently created sequence numbers being considered the "lowest" due to the absolute value decrementing until reaching 0. It also looks like there is no test to check parsing of negative sequence numbers.
For context, this same issue arose in the unofficial Golang client recipe and there is a proposed fix there: https://github.com/go-zookeeper/zk/pull/65
Attachments
Issue Links
- links to