Skip to content

Commit

Permalink
Adding a deprecation info check for fixed_auto_queue_size threadpool …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
masseyke authored Sep 2, 2021
1 parent 686d507 commit c3e815c
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private DeprecationChecks() {
NodeDeprecationChecks::checkImplicitlyDisabledSecurityOnBasicAndTrial,
NodeDeprecationChecks::checkSearchRemoteSettings,
NodeDeprecationChecks::checkMonitoringExporterPassword,
NodeDeprecationChecks::checkFixedAutoQueueSizeThreadpool,
NodeDeprecationChecks::checkJoinTimeoutSetting,
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
NodeDeprecationChecks::checkClusterRoutingRequireSetting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,42 @@ static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(f
);
}

static DeprecationIssue checkFixedAutoQueueSizeThreadpool(final Settings settings,
final PluginsAndModules pluginsAndModules,
final ClusterState clusterState,
final XPackLicenseState licenseState) {
List<Setting<Integer>> deprecatedSettings = new ArrayList<>();
deprecatedSettings.add(Setting.intSetting("thread_pool.search.min_queue_size", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search.max_queue_size", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search.auto_queue_frame_size", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search.target_response_time", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.min_queue_size", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.max_queue_size", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.auto_queue_frame_size", 1, Setting.Property.Deprecated));
deprecatedSettings.add(Setting.intSetting("thread_pool.search_throttled.target_response_time", 1, Setting.Property.Deprecated));
List<Setting<Integer>> existingSettings =
deprecatedSettings.stream().filter(deprecatedSetting -> deprecatedSetting.exists(settings)).collect(Collectors.toList());
if (existingSettings.isEmpty()) {
return null;
}
final String settingNames = existingSettings.stream().map(Setting::getKey).collect(Collectors.joining(","));
final String message = String.format(
Locale.ROOT,
"cannot use properties [%s] because fixed_auto_queue_size threadpool type has been deprecated and will be removed in the next" +
" major version",
settingNames
);
final String details = String.format(
Locale.ROOT,
"cannot use properties [%s] because fixed_auto_queue_size threadpool type has been deprecated and will be removed in the next" +
" major version",
settingNames
);
final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0" +
".html#breaking_80_threadpool_changes";
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
}

static DeprecationIssue checkClusterRoutingRequireSetting(final Settings settings,
final PluginsAndModules pluginsAndModules,
final ClusterState clusterState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,44 @@ public void testImplicitlyConfiguredSecurityOnGoldPlus() {
assertThat(issues, empty());
}

public void testCheckFixedAutoQueueSizeThreadpool() {
String settingKey = "thread_pool.search.min_queue_size";
String settingValue = "";
Settings settings = Settings.builder()
.put("thread_pool.search.min_queue_size", randomIntBetween(30, 100))
.put("thread_pool.search.max_queue_size", randomIntBetween(1, 25))
.put("thread_pool.search.auto_queue_frame_size", randomIntBetween(1, 25))
.put("thread_pool.search.target_response_time", randomIntBetween(1, 25))
.put("thread_pool.search_throttled.min_queue_size", randomIntBetween(30, 100))
.put("thread_pool.search_throttled.max_queue_size", randomIntBetween(1, 25))
.put("thread_pool.search_throttled.auto_queue_frame_size", randomIntBetween(1, 25))
.put("thread_pool.search_throttled.target_response_time", randomIntBetween(1, 25))
.build();
final ClusterState clusterState = ClusterState.EMPTY_STATE;
final DeprecationIssue expectedIssue = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"cannot use properties [thread_pool.search.min_queue_size,thread_pool.search.max_queue_size,thread_pool.search" +
".auto_queue_frame_size,thread_pool.search.target_response_time,thread_pool.search_throttled.min_queue_size," +
"thread_pool.search_throttled.max_queue_size,thread_pool.search_throttled.auto_queue_frame_size,thread_pool" +
".search_throttled.target_response_time] because fixed_auto_queue_size threadpool type has been deprecated" +
" and will be removed in the next major version",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#breaking_80_threadpool_changes",
"cannot use properties [thread_pool.search.min_queue_size,thread_pool.search.max_queue_size,thread_pool.search" +
".auto_queue_frame_size,thread_pool.search.target_response_time,thread_pool.search_throttled.min_queue_size," +
"thread_pool.search_throttled.max_queue_size,thread_pool.search_throttled.auto_queue_frame_size,thread_pool" +
".search_throttled.target_response_time] because fixed_auto_queue_size threadpool type has been deprecated" +
" and will be removed in the next major version",
false, null
);
final XPackLicenseState licenseState = mock(XPackLicenseState.class);
when(licenseState.getOperationMode())
.thenReturn(randomValueOtherThanMany((m -> m.equals(License.OperationMode.BASIC) || m.equals(License.OperationMode.TRIAL)),
() -> randomFrom(License.OperationMode.values())));
assertThat(
NodeDeprecationChecks.checkFixedAutoQueueSizeThreadpool(settings, null, clusterState, licenseState),
equalTo(expectedIssue)
);
}

public void testTierAllocationSettings() {
String settingValue = DataTier.DATA_HOT;
final Settings settings = settings(Version.CURRENT)
Expand Down

0 comments on commit c3e815c

Please sign in to comment.