Skip to content

Commit db974cf

Browse files
authored
Remove the listener thread pool (#53314)
This commit completes the work to remove the listener thread pool, having removed all uses of it in the server codebase, and deprecated it in 7.x. With this commit, we also remove the infrastructgure to deprecate a fixed thread pool, which was added as part of this work, since it is easy to bring back if needed.
1 parent 51dd8d8 commit db974cf

File tree

5 files changed

+7
-80
lines changed

5 files changed

+7
-80
lines changed

docs/reference/migration/migrate_8_0/settings.asciidoc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,3 @@ processors. As this leads to more context switches and more threads but without
3737
an increase in the number of physical CPUs on which to schedule these additional
3838
threads, the `node.processors` setting is now bounded by the number of available
3939
processors.
40-
41-
[float]
42-
==== `thread_pool.listener.size` and `thread_pool.listener.queue_size` have been deprecated
43-
44-
The listener thread pool is no longer used internally by Elasticsearch.
45-
Therefore, these settings have been deprecated. You can safely remove these
46-
settings from the configuration of your nodes.

server/src/main/java/org/elasticsearch/threadpool/FixedExecutorBuilder.java

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,7 @@ public final class FixedExecutorBuilder extends ExecutorBuilder<FixedExecutorBui
5151
* @param trackEWMA whether to track the exponentially weighted moving average of the task execution time
5252
*/
5353
FixedExecutorBuilder(final Settings settings, final String name, final int size, final int queueSize, final boolean trackEWMA) {
54-
this(settings, name, size, queueSize, trackEWMA, false);
55-
}
56-
57-
/**
58-
* Construct a fixed executor builder; the settings will have the key prefix "thread_pool." followed by the executor name.
59-
*
60-
* @param settings the node-level settings
61-
* @param name the name of the executor
62-
* @param size the fixed number of threads
63-
* @param queueSize the size of the backing queue, -1 for unbounded
64-
* @param trackEWMA whether to track the exponentially weighted moving average of the task execution time
65-
* @param deprecated whether or not the thread pool is deprecated
66-
*/
67-
FixedExecutorBuilder(
68-
final Settings settings,
69-
final String name,
70-
final int size,
71-
final int queueSize,
72-
final boolean trackEWMA,
73-
final boolean deprecated
74-
) {
75-
this(settings, name, size, queueSize, "thread_pool." + name, trackEWMA, deprecated);
54+
this(settings, name, size, queueSize, "thread_pool." + name, trackEWMA);
7655
}
7756

7857
/**
@@ -87,45 +66,16 @@ public final class FixedExecutorBuilder extends ExecutorBuilder<FixedExecutorBui
8766
*/
8867
public FixedExecutorBuilder(final Settings settings, final String name, final int size, final int queueSize, final String prefix,
8968
final boolean trackEWMA) {
90-
this(settings, name, size, queueSize, prefix, trackEWMA, false);
91-
}
92-
93-
/**
94-
* Construct a fixed executor builder.
95-
*
96-
* @param settings the node-level settings
97-
* @param name the name of the executor
98-
* @param size the fixed number of threads
99-
* @param queueSize the size of the backing queue, -1 for unbounded
100-
* @param prefix the prefix for the settings keys
101-
* @param trackEWMA whether to track the exponentially weighted moving average of the task execution time
102-
* @param deprecated whether or not the thread pool is deprecated
103-
*/
104-
public FixedExecutorBuilder(
105-
final Settings settings,
106-
final String name,
107-
final int size,
108-
final int queueSize,
109-
final String prefix,
110-
final boolean trackEWMA,
111-
final boolean deprecated
112-
) {
11369
super(name);
11470
final String sizeKey = settingsKey(prefix, "size");
115-
final Setting.Property[] properties;
116-
if (deprecated) {
117-
properties = new Setting.Property[]{Setting.Property.NodeScope, Setting.Property.Deprecated};
118-
} else {
119-
properties = new Setting.Property[]{Setting.Property.NodeScope};
120-
}
12171
this.sizeSetting =
122-
new Setting<>(
123-
sizeKey,
124-
s -> Integer.toString(size),
125-
s -> Setting.parseInt(s, 1, applyHardSizeLimit(settings, name), sizeKey),
126-
properties);
72+
new Setting<>(
73+
sizeKey,
74+
s -> Integer.toString(size),
75+
s -> Setting.parseInt(s, 1, applyHardSizeLimit(settings, name), sizeKey),
76+
Setting.Property.NodeScope);
12777
final String queueSizeKey = settingsKey(prefix, "queue_size");
128-
this.queueSizeSetting = Setting.intSetting(queueSizeKey, queueSize, properties);
78+
this.queueSizeSetting = Setting.intSetting(queueSizeKey, queueSize, Setting.Property.NodeScope);
12979
this.trackEWMA = trackEWMA;
13080
}
13181

server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class ThreadPool implements Scheduler {
6868
public static class Names {
6969
public static final String SAME = "same";
7070
public static final String GENERIC = "generic";
71-
@Deprecated public static final String LISTENER = "listener";
7271
public static final String GET = "get";
7372
public static final String ANALYZE = "analyze";
7473
public static final String WRITE = "write";
@@ -115,7 +114,6 @@ public static ThreadPoolType fromType(String type) {
115114
public static final Map<String, ThreadPoolType> THREAD_POOL_TYPES = Map.ofEntries(
116115
entry(Names.SAME, ThreadPoolType.DIRECT),
117116
entry(Names.GENERIC, ThreadPoolType.SCALING),
118-
entry(Names.LISTENER, ThreadPoolType.FIXED),
119117
entry(Names.GET, ThreadPoolType.FIXED),
120118
entry(Names.ANALYZE, ThreadPoolType.FIXED),
121119
entry(Names.WRITE, ThreadPoolType.FIXED),
@@ -172,7 +170,6 @@ public ThreadPool(final Settings settings, final ExecutorBuilder<?>... customBui
172170
builders.put(Names.MANAGEMENT, new ScalingExecutorBuilder(Names.MANAGEMENT, 1, 5, TimeValue.timeValueMinutes(5)));
173171
// no queue as this means clients will need to handle rejections on listener queue even if the operation succeeded
174172
// the assumption here is that the listeners should be very lightweight on the listeners side
175-
builders.put(Names.LISTENER, new FixedExecutorBuilder(settings, Names.LISTENER, halfProcMaxAt10, -1, false, true));
176173
builders.put(Names.FLUSH, new ScalingExecutorBuilder(Names.FLUSH, 1, halfProcMaxAt5, TimeValue.timeValueMinutes(5)));
177174
builders.put(Names.REFRESH, new ScalingExecutorBuilder(Names.REFRESH, 1, halfProcMaxAt10, TimeValue.timeValueMinutes(5)));
178175
builders.put(Names.WARMER, new ScalingExecutorBuilder(Names.WARMER, 1, halfProcMaxAt5, TimeValue.timeValueMinutes(5)));

server/src/test/java/org/elasticsearch/threadpool/FixedThreadPoolTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.elasticsearch.common.settings.Settings;
2323
import org.elasticsearch.common.util.concurrent.EsExecutors;
2424
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
25-
import org.elasticsearch.threadpool.ThreadPool.Names;
2625

2726
import java.util.concurrent.CountDownLatch;
2827

@@ -89,10 +88,6 @@ public void testRejectedExecutionCounter() throws InterruptedException {
8988
} finally {
9089
terminateThreadPoolIfNeeded(threadPool);
9190
}
92-
93-
if (Names.LISTENER.equals(threadPoolName)) {
94-
assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.queue_size", "thread_pool.listener.size"});
95-
}
9691
}
9792

9893
}

server/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ public void testFixedExecutorType() throws InterruptedException {
118118
} finally {
119119
terminateThreadPoolIfNeeded(threadPool);
120120
}
121-
122-
if (Names.LISTENER.equals(threadPoolName)) {
123-
assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.size"});
124-
}
125121
}
126122

127123
public void testScalingExecutorType() throws InterruptedException {
@@ -177,10 +173,6 @@ public void testShutdownNowInterrupts() throws Exception {
177173
} finally {
178174
terminateThreadPoolIfNeeded(threadPool);
179175
}
180-
181-
if (Names.LISTENER.equals(threadPoolName)) {
182-
assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.queue_size"});
183-
}
184176
}
185177

186178
public void testCustomThreadPool() throws Exception {

0 commit comments

Comments
 (0)