-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Adding support for dynamically updating Leader/follower checker timeouts #10528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4e18263
making leader check timeout dynamic
niyatiagg 3dc6ae3
making follower check timeout dynamic
niyatiagg 6a2dbb9
fixing existing unit tests
niyatiagg 42904b6
fixing checkstyle violations
niyatiagg 315f600
adding tests for leader/follower check timeout
niyatiagg c07510a
setting maximum and minimum timeout value for leader/follower checker
niyatiagg 5782c32
adding tests for checking boundary cases
niyatiagg a577e40
Fixing checkstyle violations
niyatiagg 5518ff3
changed the log file and added other suggested changes
niyatiagg da55586
fixing checkstyle violations
niyatiagg d4b5a00
Merge remote-tracking branch 'origin/main' into os-10377
niyatiagg ab143da
Addressing review comments
niyatiagg a333b80
Merge remote-tracking branch 'origin/main' into os-10377
niyatiagg 9a79455
addressing proposed changes
niyatiagg c3aabb1
Applying checkstyle fixes
niyatiagg fbf2c36
Merge branch 'main' into os-10377
niyatiagg 9341ea7
Fixing flakiness for existing tests
niyatiagg 3cffde9
Applying checkstyle fixes
niyatiagg 672a371
Merge branch 'main' into os-10377
niyatiagg 6cf3dde
Fixing the timeout value limits for randomSettings
niyatiagg 8ca8da6
Merge remote-tracking branch 'origin/main' into os-10377
niyatiagg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
113 changes: 113 additions & 0 deletions
113
...r/src/test/java/org/opensearch/cluster/coordination/CoordinationCheckerSettingsTests.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cluster.coordination; | ||
|
||
import org.opensearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; | ||
import org.opensearch.common.settings.Setting; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.common.unit.TimeValue; | ||
import org.opensearch.test.OpenSearchSingleNodeTestCase; | ||
|
||
import static org.opensearch.cluster.coordination.FollowersChecker.FOLLOWER_CHECK_TIMEOUT_SETTING; | ||
import static org.opensearch.cluster.coordination.LeaderChecker.LEADER_CHECK_TIMEOUT_SETTING; | ||
import static org.opensearch.common.unit.TimeValue.timeValueSeconds; | ||
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; | ||
|
||
public class CoordinationCheckerSettingsTests extends OpenSearchSingleNodeTestCase { | ||
public void testFollowerCheckTimeoutValueUpdate() { | ||
Setting<TimeValue> setting1 = FOLLOWER_CHECK_TIMEOUT_SETTING; | ||
Settings timeSettings1 = Settings.builder().put(setting1.getKey(), "60s").build(); | ||
try { | ||
ClusterUpdateSettingsResponse response = client().admin() | ||
.cluster() | ||
.prepareUpdateSettings() | ||
.setPersistentSettings(timeSettings1) | ||
.execute() | ||
.actionGet(); | ||
|
||
assertAcked(response); | ||
assertEquals(timeValueSeconds(60), setting1.get(response.getPersistentSettings())); | ||
} finally { | ||
// cleanup | ||
timeSettings1 = Settings.builder().putNull(setting1.getKey()).build(); | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(timeSettings1).execute().actionGet(); | ||
} | ||
} | ||
|
||
public void testFollowerCheckTimeoutMaxValue() { | ||
Setting<TimeValue> setting1 = FOLLOWER_CHECK_TIMEOUT_SETTING; | ||
Settings timeSettings1 = Settings.builder().put(setting1.getKey(), "61s").build(); | ||
|
||
assertThrows( | ||
"failed to parse value [61s] for setting [" + setting1.getKey() + "], must be <= [60000ms]", | ||
IllegalArgumentException.class, | ||
() -> { | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(timeSettings1).execute().actionGet(); | ||
} | ||
); | ||
} | ||
|
||
public void testFollowerCheckTimeoutMinValue() { | ||
Setting<TimeValue> setting1 = FOLLOWER_CHECK_TIMEOUT_SETTING; | ||
Settings timeSettings1 = Settings.builder().put(setting1.getKey(), "0s").build(); | ||
|
||
assertThrows( | ||
"failed to parse value [0s] for setting [" + setting1.getKey() + "], must be >= [1ms]", | ||
IllegalArgumentException.class, | ||
() -> { | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(timeSettings1).execute().actionGet(); | ||
} | ||
); | ||
} | ||
|
||
public void testLeaderCheckTimeoutValueUpdate() { | ||
Setting<TimeValue> setting1 = LEADER_CHECK_TIMEOUT_SETTING; | ||
Settings timeSettings1 = Settings.builder().put(setting1.getKey(), "60s").build(); | ||
try { | ||
ClusterUpdateSettingsResponse response = client().admin() | ||
.cluster() | ||
.prepareUpdateSettings() | ||
.setPersistentSettings(timeSettings1) | ||
.execute() | ||
.actionGet(); | ||
assertAcked(response); | ||
assertEquals(timeValueSeconds(60), setting1.get(response.getPersistentSettings())); | ||
} finally { | ||
// cleanup | ||
timeSettings1 = Settings.builder().putNull(setting1.getKey()).build(); | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(timeSettings1).execute().actionGet(); | ||
} | ||
} | ||
|
||
public void testLeaderCheckTimeoutMaxValue() { | ||
Setting<TimeValue> setting1 = LEADER_CHECK_TIMEOUT_SETTING; | ||
Settings timeSettings1 = Settings.builder().put(setting1.getKey(), "61s").build(); | ||
|
||
assertThrows( | ||
"failed to parse value [61s] for setting [" + setting1.getKey() + "], must be <= [60000ms]", | ||
IllegalArgumentException.class, | ||
() -> { | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(timeSettings1).execute().actionGet(); | ||
} | ||
); | ||
} | ||
|
||
public void testLeaderCheckTimeoutMinValue() { | ||
Setting<TimeValue> setting1 = LEADER_CHECK_TIMEOUT_SETTING; | ||
Settings timeSettings1 = Settings.builder().put(setting1.getKey(), "0s").build(); | ||
|
||
assertThrows( | ||
"failed to parse value [0s] for setting [" + setting1.getKey() + "], must be >= [1ms]", | ||
IllegalArgumentException.class, | ||
() -> { | ||
client().admin().cluster().prepareUpdateSettings().setPersistentSettings(timeSettings1).execute().actionGet(); | ||
} | ||
); | ||
} | ||
} |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.