RATIS-2061. Fix setCloseThreshold parameter in RaftServerConfigKeys#1070
Merged
szetszwo merged 3 commits intoapache:masterfrom Apr 26, 2024
Merged
RATIS-2061. Fix setCloseThreshold parameter in RaftServerConfigKeys#1070szetszwo merged 3 commits intoapache:masterfrom
szetszwo merged 3 commits intoapache:masterfrom
Conversation
Fix setCloseThreshold parameter in RaftServerConfigKeys
szetszwo
reviewed
Apr 25, 2024
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
@whbing , thanks for working on this! Since they are in ratis-server-api, let's deprecate them first:
+++ b/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
@@ -77,9 +77,14 @@ public interface RaftServerConfigKeys {
return getTimeDuration(properties.getTimeDuration(SLEEP_DEVIATION_THRESHOLD_DEFAULT.getUnit()),
SLEEP_DEVIATION_THRESHOLD_KEY, SLEEP_DEVIATION_THRESHOLD_DEFAULT, getDefaultLog());
}
+ /** @deprecated use {@link #setSleepDeviationThreshold(RaftProperties, TimeDuration)}. */
+ @Deprecated
static void setSleepDeviationThreshold(RaftProperties properties, int thresholdMs) {
setInt(properties::setInt, SLEEP_DEVIATION_THRESHOLD_KEY, thresholdMs);
}
+ static void setSleepDeviationThreshold(RaftProperties properties, TimeDuration threshold) {
+ setTimeDuration(properties::setTimeDuration, SLEEP_DEVIATION_THRESHOLD_KEY, threshold);
+ }
String CLOSE_THRESHOLD_KEY = PREFIX + ".close.threshold";
TimeDuration CLOSE_THRESHOLD_DEFAULT = TimeDuration.valueOf(60, TimeUnit.SECONDS);
@@ -87,9 +92,14 @@ public interface RaftServerConfigKeys {
return getTimeDuration(properties.getTimeDuration(CLOSE_THRESHOLD_DEFAULT.getUnit()),
CLOSE_THRESHOLD_KEY, CLOSE_THRESHOLD_DEFAULT, getDefaultLog());
}
+ /** @deprecated use {@link #setCloseThreshold(RaftProperties, TimeDuration)}. */
+ @Deprecated
static void setCloseThreshold(RaftProperties properties, int thresholdMs) {
setInt(properties::setInt, CLOSE_THRESHOLD_KEY, thresholdMs);
}
+ static void setCloseThreshold(RaftProperties properties, TimeDuration threshold) {
+ setTimeDuration(properties::setTimeDuration, CLOSE_THRESHOLD_KEY, threshold);
+ }
Contributor
Author
|
Updated. @szetszwo Thanks for review ! |
szetszwo
approved these changes
Apr 26, 2024
Contributor
szetszwo
left a comment
There was a problem hiding this comment.
+1 the change looks good.
szetszwo
reviewed
Apr 26, 2024
Comment on lines
+97
to
+98
| static void setCloseThreshold(RaftProperties properties, int thresholdSec) { | ||
| setInt(properties::setInt, CLOSE_THRESHOLD_KEY, thresholdSec); |
SzyWilliam
pushed a commit
to SzyWilliam/ratis
that referenced
this pull request
Jun 12, 2024
szetszwo
pushed a commit
to szetszwo/ratis
that referenced
this pull request
Jun 16, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
int thresholdMsinRaftServerConfigKeys#setCloseThresholdis misrepresented as milliseconds while the correct unit is seconds. So fix the unit to TimeDuration.setSleepDeviationThresholdparameter unit to TimeDuration.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2061
How was this patch tested?
manual tests : It passes the parameter verification in ozone project.