Skip to content

Commit c3e815c

Browse files
authored
Adding a deprecation info check for fixed_auto_queue_size threadpool settings (#76995)
The fixed_auto_queue_size threadpool has been removed in 8.0. This commit checks for configuration that is specific to that threadpool type and issues a deprecation info API message about it. Relates #42404 #52280
1 parent 686d507 commit c3e815c

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ private DeprecationChecks() {
9797
NodeDeprecationChecks::checkImplicitlyDisabledSecurityOnBasicAndTrial,
9898
NodeDeprecationChecks::checkSearchRemoteSettings,
9999
NodeDeprecationChecks::checkMonitoringExporterPassword,
100+
NodeDeprecationChecks::checkFixedAutoQueueSizeThreadpool,
100101
NodeDeprecationChecks::checkJoinTimeoutSetting,
101102
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
102103
NodeDeprecationChecks::checkClusterRoutingRequireSetting,

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java

+36
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,42 @@ static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(f
665665
);
666666
}
667667

668+
static DeprecationIssue checkFixedAutoQueueSizeThreadpool(final Settings settings,
669+
final PluginsAndModules pluginsAndModules,
670+
final ClusterState clusterState,
671+
final XPackLicenseState licenseState) {
672+
List<Setting<Integer>> deprecatedSettings = new ArrayList<>();
673+
deprecatedSettings.add(Setting.intSetting("thread_pool.search.min_queue_size", 1, Setting.Property.Deprecated));
674+
deprecatedSettings.add(Setting.intSetting("thread_pool.search.max_queue_size", 1, Setting.Property.Deprecated));
675+
deprecatedSettings.add(Setting.intSetting("thread_pool.search.auto_queue_frame_size", 1, Setting.Property.Deprecated));
676+
deprecatedSettings.add(Setting.intSetting("thread_pool.search.target_response_time", 1, Setting.Property.Deprecated));
677+
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.min_queue_size", 1, Setting.Property.Deprecated));
678+
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.max_queue_size", 1, Setting.Property.Deprecated));
679+
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.auto_queue_frame_size", 1, Setting.Property.Deprecated));
680+
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.target_response_time", 1, Setting.Property.Deprecated));
681+
List<Setting<Integer>> existingSettings =
682+
deprecatedSettings.stream().filter(deprecatedSetting -> deprecatedSetting.exists(settings)).collect(Collectors.toList());
683+
if (existingSettings.isEmpty()) {
684+
return null;
685+
}
686+
final String settingNames = existingSettings.stream().map(Setting::getKey).collect(Collectors.joining(","));
687+
final String message = String.format(
688+
Locale.ROOT,
689+
"cannot use properties [%s] because fixed_auto_queue_size threadpool type has been deprecated and will be removed in the next" +
690+
" major version",
691+
settingNames
692+
);
693+
final String details = String.format(
694+
Locale.ROOT,
695+
"cannot use properties [%s] because fixed_auto_queue_size threadpool type has been deprecated and will be removed in the next" +
696+
" major version",
697+
settingNames
698+
);
699+
final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0" +
700+
".html#breaking_80_threadpool_changes";
701+
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
702+
}
703+
668704
static DeprecationIssue checkClusterRoutingRequireSetting(final Settings settings,
669705
final PluginsAndModules pluginsAndModules,
670706
final ClusterState clusterState,

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java

+38
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,44 @@ public void testImplicitlyConfiguredSecurityOnGoldPlus() {
961961
assertThat(issues, empty());
962962
}
963963

964+
public void testCheckFixedAutoQueueSizeThreadpool() {
965+
String settingKey = "thread_pool.search.min_queue_size";
966+
String settingValue = "";
967+
Settings settings = Settings.builder()
968+
.put("thread_pool.search.min_queue_size", randomIntBetween(30, 100))
969+
.put("thread_pool.search.max_queue_size", randomIntBetween(1, 25))
970+
.put("thread_pool.search.auto_queue_frame_size", randomIntBetween(1, 25))
971+
.put("thread_pool.search.target_response_time", randomIntBetween(1, 25))
972+
.put("thread_pool.search_throttled.min_queue_size", randomIntBetween(30, 100))
973+
.put("thread_pool.search_throttled.max_queue_size", randomIntBetween(1, 25))
974+
.put("thread_pool.search_throttled.auto_queue_frame_size", randomIntBetween(1, 25))
975+
.put("thread_pool.search_throttled.target_response_time", randomIntBetween(1, 25))
976+
.build();
977+
final ClusterState clusterState = ClusterState.EMPTY_STATE;
978+
final DeprecationIssue expectedIssue = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
979+
"cannot use properties [thread_pool.search.min_queue_size,thread_pool.search.max_queue_size,thread_pool.search" +
980+
".auto_queue_frame_size,thread_pool.search.target_response_time,thread_pool.search_throttled.min_queue_size," +
981+
"thread_pool.search_throttled.max_queue_size,thread_pool.search_throttled.auto_queue_frame_size,thread_pool" +
982+
".search_throttled.target_response_time] because fixed_auto_queue_size threadpool type has been deprecated" +
983+
" and will be removed in the next major version",
984+
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_threadpool_changes",
985+
"cannot use properties [thread_pool.search.min_queue_size,thread_pool.search.max_queue_size,thread_pool.search" +
986+
".auto_queue_frame_size,thread_pool.search.target_response_time,thread_pool.search_throttled.min_queue_size," +
987+
"thread_pool.search_throttled.max_queue_size,thread_pool.search_throttled.auto_queue_frame_size,thread_pool" +
988+
".search_throttled.target_response_time] because fixed_auto_queue_size threadpool type has been deprecated" +
989+
" and will be removed in the next major version",
990+
false, null
991+
);
992+
final XPackLicenseState licenseState = mock(XPackLicenseState.class);
993+
when(licenseState.getOperationMode())
994+
.thenReturn(randomValueOtherThanMany((m -> m.equals(License.OperationMode.BASIC) || m.equals(License.OperationMode.TRIAL)),
995+
() -> randomFrom(License.OperationMode.values())));
996+
assertThat(
997+
NodeDeprecationChecks.checkFixedAutoQueueSizeThreadpool(settings, null, clusterState, licenseState),
998+
equalTo(expectedIssue)
999+
);
1000+
}
1001+
9641002
public void testTierAllocationSettings() {
9651003
String settingValue = DataTier.DATA_HOT;
9661004
final Settings settings = settings(Version.CURRENT)

0 commit comments

Comments
 (0)