Skip to content

Commit 93f2cd6

Browse files
committed
Merge branch 'deprecate-index-thread-pool' into remove-index-thread-pool
* deprecate-index-thread-pool: Deprecate the index thread pool
2 parents 970b7f7 + c18e5ab commit 93f2cd6

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed

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

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,28 @@ public final class FixedExecutorBuilder extends ExecutorBuilder<FixedExecutorBui
4141
private final Setting<Integer> queueSizeSetting;
4242

4343
/**
44-
* Construct a fixed executor builder; the settings will have the
45-
* key prefix "thread_pool." followed by the executor name.
44+
* Construct a fixed executor builder; the settings will have the key prefix "thread_pool." followed by the executor name.
4645
*
4746
* @param settings the node-level settings
4847
* @param name the name of the executor
4948
* @param size the fixed number of threads
5049
* @param queueSize the size of the backing queue, -1 for unbounded
5150
*/
5251
FixedExecutorBuilder(final Settings settings, final String name, final int size, final int queueSize) {
53-
this(settings, name, size, queueSize, "thread_pool." + name);
52+
this(settings, name, size, queueSize, false);
53+
}
54+
55+
/**
56+
* Construct a fixed executor builder; the settings will have the key prefix "thread_pool." followed by the executor name.
57+
*
58+
* @param settings the node-level settings
59+
* @param name the name of the executor
60+
* @param size the fixed number of threads
61+
* @param queueSize the size of the backing queue, -1 for unbounded
62+
* @param deprecated whether or not the thread pool is deprecated
63+
*/
64+
FixedExecutorBuilder(final Settings settings, final String name, final int size, final int queueSize, final boolean deprecated) {
65+
this(settings, name, size, queueSize, "thread_pool." + name, deprecated);
5466
}
5567

5668
/**
@@ -63,17 +75,41 @@ public final class FixedExecutorBuilder extends ExecutorBuilder<FixedExecutorBui
6375
* @param prefix the prefix for the settings keys
6476
*/
6577
public FixedExecutorBuilder(final Settings settings, final String name, final int size, final int queueSize, final String prefix) {
78+
this(settings, name, size, queueSize, prefix, false);
79+
}
80+
81+
/**
82+
* Construct a fixed executor builder.
83+
*
84+
* @param settings the node-level settings
85+
* @param name the name of the executor
86+
* @param size the fixed number of threads
87+
* @param queueSize the size of the backing queue, -1 for unbounded
88+
* @param prefix the prefix for the settings keys
89+
*/
90+
private FixedExecutorBuilder(
91+
final Settings settings,
92+
final String name,
93+
final int size,
94+
final int queueSize,
95+
final String prefix,
96+
final boolean deprecated) {
6697
super(name);
6798
final String sizeKey = settingsKey(prefix, "size");
99+
final Setting.Property[] properties;
100+
if (deprecated) {
101+
properties = new Setting.Property[]{Setting.Property.NodeScope, Setting.Property.Deprecated};
102+
} else {
103+
properties = new Setting.Property[]{Setting.Property.NodeScope};
104+
}
68105
this.sizeSetting =
69-
new Setting<>(
70-
sizeKey,
71-
s -> Integer.toString(size),
72-
s -> Setting.parseInt(s, 1, applyHardSizeLimit(settings, name), sizeKey),
73-
Setting.Property.NodeScope);
106+
new Setting<>(
107+
sizeKey,
108+
s -> Integer.toString(size),
109+
s -> Setting.parseInt(s, 1, applyHardSizeLimit(settings, name), sizeKey),
110+
properties);
74111
final String queueSizeKey = settingsKey(prefix, "queue_size");
75-
this.queueSizeSetting =
76-
Setting.intSetting(queueSizeKey, queueSize, Setting.Property.NodeScope);
112+
this.queueSizeSetting = Setting.intSetting(queueSizeKey, queueSize, properties);
77113
}
78114

79115
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public ThreadPool(final Settings settings, final ExecutorBuilder<?>... customBui
170170
final int halfProcMaxAt10 = halfNumberOfProcessorsMaxTen(availableProcessors);
171171
final int genericThreadPoolMax = boundedBy(4 * availableProcessors, 128, 512);
172172
builders.put(Names.GENERIC, new ScalingExecutorBuilder(Names.GENERIC, 4, genericThreadPoolMax, TimeValue.timeValueSeconds(30)));
173-
builders.put(Names.INDEX, new FixedExecutorBuilder(settings, Names.INDEX, availableProcessors, 200));
173+
builders.put(Names.INDEX, new FixedExecutorBuilder(settings, Names.INDEX, availableProcessors, 200, true));
174174
builders.put(Names.BULK, new FixedExecutorBuilder(settings, Names.BULK, availableProcessors, 200)); // now that we reuse bulk for index/delete ops
175175
builders.put(Names.GET, new FixedExecutorBuilder(settings, Names.GET, availableProcessors, 1000));
176176
builders.put(Names.SEARCH, new AutoQueueAdjustingExecutorBuilder(settings,

0 commit comments

Comments
 (0)