File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
main/java/org/opensearch/cluster/service
test/java/org/opensearch/cluster/service Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -108,10 +108,12 @@ public boolean isThrottlingEnabled() {
108
108
}
109
109
110
110
void validateSetting (final Settings settings ) {
111
- if (minNodeVersionSupplier .get ().compareTo (Version .V_2_4_0 ) < 0 ) {
112
- throw new IllegalArgumentException ("All the nodes in cluster should be on version later than or equal to 2.4.0" );
113
- }
114
111
Map <String , Settings > groups = settings .getAsGroups ();
112
+ if (groups .size () > 0 ) {
113
+ if (minNodeVersionSupplier .get ().compareTo (Version .V_2_4_0 ) < 0 ) {
114
+ throw new IllegalArgumentException ("All the nodes in cluster should be on version later than or equal to 2.4.0" );
115
+ }
116
+ }
115
117
for (String key : groups .keySet ()) {
116
118
if (!THROTTLING_TASK_KEYS .containsKey (key )) {
117
119
throw new IllegalArgumentException ("Cluster manager task throttling is not configured for given task type: " + key );
Original file line number Diff line number Diff line change @@ -114,6 +114,15 @@ public void testValidateSettingsForDifferentVersion() {
114
114
115
115
Settings newSettings = Settings .builder ().put ("cluster_manager.throttling.thresholds.put-mapping.value" , newLimit ).build ();
116
116
assertThrows (IllegalArgumentException .class , () -> throttler .validateSetting (newSettings ));
117
+
118
+ // validate for empty setting, it shouldn't throw exception
119
+ Settings emptySettings = Settings .builder ().build ();
120
+ try {
121
+ throttler .validateSetting (emptySettings );
122
+ } catch (Exception e ) {
123
+ // it shouldn't throw exception
124
+ throw new AssertionError (e );
125
+ }
117
126
}
118
127
119
128
public void testValidateSettingsForTaskWihtoutRetryOnDataNode () {
You can’t perform that action at this time.
0 commit comments