Skip to content
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
1 change: 1 addition & 0 deletions docs/reference/migration/migrate_7_7.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ do this. The behavior is now the same for both field types like documented in
<<range-query-date-math-rounding>>.

[float]
[[deprecate-listener-thread-pool]]
==== `thread_pool.listener.size` and `thread_pool.listener.queue_size` have been deprecated

The listener thread pool is no longer used internally by Elasticsearch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ private DeprecationChecks() {
NodeDeprecationChecks::checkPidfile,
NodeDeprecationChecks::checkProcessors,
NodeDeprecationChecks::checkMissingRealmOrders,
NodeDeprecationChecks::checkUniqueRealmOrders
NodeDeprecationChecks::checkUniqueRealmOrders,
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerQueueSize(settings),
(settings, pluginsAndModules) -> NodeDeprecationChecks.checkThreadPoolListenerSize(settings)
));

static List<Function<IndexMetaData, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.env.Environment;
import org.elasticsearch.threadpool.FixedExecutorBuilder;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
import org.elasticsearch.xpack.core.security.authc.RealmSettings;

import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -96,6 +98,25 @@ static DeprecationIssue checkUniqueRealmOrders(final Settings settings, final Pl
);
}

static DeprecationIssue checkThreadPoolListenerQueueSize(final Settings settings) {
return checkThreadPoolListenerSetting("thread_pool.listener.queue_size", settings);
}

static DeprecationIssue checkThreadPoolListenerSize(final Settings settings) {
return checkThreadPoolListenerSetting("thread_pool.listener.size", settings);
}

private static DeprecationIssue checkThreadPoolListenerSetting(final String name, final Settings settings) {
final FixedExecutorBuilder builder = new FixedExecutorBuilder(settings, "listener", 1, -1, "thread_pool.listener", true);
final List<Setting<?>> listenerSettings = builder.getRegisteredSettings();
final Optional<Setting<?>> setting = listenerSettings.stream().filter(s -> s.getKey().equals(name)).findFirst();
assert setting.isPresent();
return checkRemovedSetting(
settings,
setting.get(),
"https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.7.html#deprecate-listener-thread-pool");
}

private static DeprecationIssue checkDeprecatedSetting(
final Settings settings,
final PluginsAndModules pluginsAndModules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,36 @@ public void testCorrectRealmOrders() {
assertEquals(0, deprecationIssues.size());
}

public void testThreadPoolListenerQueueSize() {
final int size = randomIntBetween(1, 4);
final Settings settings = Settings.builder().put("thread_pool.listener.queue_size", size).build();
final PluginsAndModules pluginsAndModules = new PluginsAndModules(Collections.emptyList(), Collections.emptyList());
final List<DeprecationIssue> issues =
DeprecationChecks.filterChecks(DeprecationChecks.NODE_SETTINGS_CHECKS, c -> c.apply(settings, pluginsAndModules));
final DeprecationIssue expected = new DeprecationIssue(
DeprecationIssue.Level.CRITICAL,
"setting [thread_pool.listener.queue_size] is deprecated and will be removed in the next major version",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.7.html#deprecate-listener-thread-pool",
"the setting [thread_pool.listener.queue_size] is currently set to [" + size + "], remove this setting");
assertThat(issues, contains(expected));
assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.queue_size"});
}

public void testThreadPoolListenerSize() {
final int size = randomIntBetween(1, 4);
final Settings settings = Settings.builder().put("thread_pool.listener.size", size).build();
final PluginsAndModules pluginsAndModules = new PluginsAndModules(Collections.emptyList(), Collections.emptyList());
final List<DeprecationIssue> issues =
DeprecationChecks.filterChecks(DeprecationChecks.NODE_SETTINGS_CHECKS, c -> c.apply(settings, pluginsAndModules));
final DeprecationIssue expected = new DeprecationIssue(
DeprecationIssue.Level.CRITICAL,
"setting [thread_pool.listener.size] is deprecated and will be removed in the next major version",
"https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.7.html#deprecate-listener-thread-pool",
"the setting [thread_pool.listener.size] is currently set to [" + size + "], remove this setting");
assertThat(issues, contains(expected));
assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.size"});
}

public void testRemovedSettingNotSet() {
final Settings settings = Settings.EMPTY;
final Setting<?> removedSetting = Setting.simpleString("node.removed_setting");
Expand Down