Skip to content
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

Fix bwc for cluster manager throttling settings #5305

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ public boolean isThrottlingEnabled() {
}

void validateSetting(final Settings settings) {
if (minNodeVersionSupplier.get().compareTo(Version.V_2_4_0) < 0) {
throw new IllegalArgumentException("All the nodes in cluster should be on version later than or equal to 2.4.0");
}
Map<String, Settings> groups = settings.getAsGroups();
if (groups.size() > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my understanding what does this validate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validateSetting method gets invoked every time even when this setting is not changed.

When other settings get changes this validate method gets called with empty settings. So that's why added check to avoid version check when called with empty setting.

Since this is group setting, if it is empty setting, it's size will be zero.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When other settings get changes this validate method gets called with empty settings. So that's why added check to avoid version check when called with empty setting.

@dhwanilpatel can you point to code where this happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to go through the code to find out the pointers, I have seen this behavior in local testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (minNodeVersionSupplier.get().compareTo(Version.V_2_4_0) < 0) {
throw new IllegalArgumentException("All the nodes in cluster should be on version later than or equal to 2.4.0");
}
}
for (String key : groups.keySet()) {
if (!THROTTLING_TASK_KEYS.containsKey(key)) {
throw new IllegalArgumentException("Cluster manager task throttling is not configured for given task type: " + key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ public void testValidateSettingsForDifferentVersion() {

Settings newSettings = Settings.builder().put("cluster_manager.throttling.thresholds.put-mapping.value", newLimit).build();
assertThrows(IllegalArgumentException.class, () -> throttler.validateSetting(newSettings));

// validate for empty setting, it shouldn't throw exception
Settings emptySettings = Settings.builder().build();
try {
throttler.validateSetting(emptySettings);
} catch (Exception e) {
// it shouldn't throw exception
throw new AssertionError(e);
}
}

public void testValidateSettingsForTaskWihtoutRetryOnDataNode() {
Expand Down