kezhuw commented on code in PR #478:
URL: https://github.com/apache/curator/pull/478#discussion_r1624284557
##########
curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java:
##########
@@ -193,14 +199,13 @@ public boolean trySetValue(VersionedValue<byte[]>
previous, byte[] newValue) thr
return false;
}
- private void updateValue(int version, byte[] bytes) {
+ private void updateValue(long zxid, int version, byte[] bytes) {
while (true) {
VersionedValue<byte[]> current = currentValue.get();
- if (current.getVersion() >= version) {
- // A newer version was concurrently set.
+ if (current.getZxid() >= zxid) {
Review Comment:
This is paranoid -:).
> ZooKeeper guarantees a total order of messages, and it also guarantees a
total order of proposals. ZooKeeper exposes the total ordering using a
ZooKeeper transaction id (zxid). All proposals will be stamped with a zxid when
it is proposed and exactly reflects the total ordering. --
https://zookeeper.apache.org/doc/r3.9.0/zookeeperInternals.html
> Every change to the ZooKeeper state receives a stamp in the form of a zxid
(ZooKeeper Transaction Id). This exposes the total ordering of all changes to
ZooKeeper. Each change will have a unique zxid and if zxid1 is smaller than
zxid2 then zxid1 happened before zxid2. --
https://zookeeper.apache.org/doc/r3.9.0/zookeeperProgrammers.html
In case of above situation, I believed that ZooKeeper is doomed to failure.
The "never updated" should be negligible in case of the disaster.
--
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]