Skip to content

Commit

Permalink
CURATOR-688. SharedCount will be never updated successful when versio…
Browse files Browse the repository at this point in the history
…n of ZNode is overflow.
  • Loading branch information
Hexiaoqiao committed Aug 31, 2023
1 parent 72beebc commit 052450f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ public boolean trySetValue(VersionedValue<byte[]> previous, byte[] newValue) thr
private void updateValue(int version, byte[] bytes) {
while (true) {
VersionedValue<byte[]> current = currentValue.get();
if (current.getVersion() >= version) {
// A newer version was concurrently set.
// Update currentValue only when no newer version was concurrently set
// AND the current version is not uninitialized AND remote znode version is not MIN_VALUE.
// WARN: When the version return to -1 after overflow, it will setData blindly.
if (current.getVersion() >= version
&& current.getVersion() != UNINITIALIZED_VERSION
&& version != Integer.MIN_VALUE) {
return;
}
if (currentValue.compareAndSet(current, new VersionedValue<byte[]>(version, bytes))) {
Expand Down

0 comments on commit 052450f

Please sign in to comment.