kezhuw commented on PR #478: URL: https://github.com/apache/curator/pull/478#issuecomment-1717815870
> 'we have to throw exception if previous.getVersion() equals to -1 in call chain of trySetCount', Will it never update successfully when dataversion is back to -1 if we need to guarantee this rule? Yes, and no. When `previous.getVersion` reach to `-1`, `trySetCount` has few choices: 1. Exception to caller for limitation of the implementation, that is `Stat.version` overflowed and wraparound to `-1` and [`setData` with `-1` `version`](https://github.com/apache/zookeeper/blob/b31f776471fef79ab161f416d58367bdffaf37a9/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java#L2187) is a blind update. 2. Keep silent and do a blind update. The later behavior is a bug due to the contract what `trySetCount` try to express. As a library, I don't think Curator should do that for callers silently. For the "no" part, callers can risk themselves by doing a blind update through `setCount`. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
