-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CURATOR-688. Fix SharedCount/SharedValue not update after Stat.versio…
…n overflowed (#478) Co-authored-by: Kezhu Wang <kezhuw@apache.org> Co-authored-by: tison <wander4096@gmail.com> Signed-off-by: tison <wander4096@gmail.com>
- Loading branch information
1 parent
5af5404
commit a9a8020
Showing
5 changed files
with
100 additions
and
27 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
.../main/java/org/apache/curator/framework/recipes/shared/IllegalTrySetVersionException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.curator.framework.recipes.shared; | ||
|
||
import org.apache.zookeeper.data.Stat; | ||
|
||
/** | ||
* Exception to alert overflowed {@link Stat#getVersion()} {@code -1} which is not suitable in | ||
* {@link SharedValue#trySetValue(VersionedValue, byte[])} and {@link SharedCount#trySetCount(VersionedValue, int)}. | ||
* | ||
* <p>In case of this exception, clients have to choose: | ||
* <ul> | ||
* <li>Take their own risk to do a blind set.</li> | ||
* <li>Update ZooKeeper cluster to solve <a href="https://issues.apache.org/jira/browse/ZOOKEEPER-4743">ZOOKEEPER-4743</a>.</li> | ||
* </ul> | ||
*/ | ||
public class IllegalTrySetVersionException extends IllegalArgumentException { | ||
@Override | ||
public String getMessage() { | ||
return "overflowed Stat.version -1 is not suitable for trySet(a.k.a. compare-and-set ZooKeeper::setData)"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters