Skip to content

Commit f318f22

Browse files
arteamkingherc
andauthored
Give executor to cache instead of string (#111711) (#112091)
Relates ES-8155 Co-authored-by: Iraklis Psaroudakis <[email protected]>
1 parent 29453cb commit f318f22

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/shared/SharedBlobCacheService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public SharedBlobCacheService(
333333
NodeEnvironment environment,
334334
Settings settings,
335335
ThreadPool threadPool,
336-
String ioExecutor,
336+
Executor ioExecutor,
337337
BlobCacheMetrics blobCacheMetrics
338338
) {
339339
this(environment, settings, threadPool, ioExecutor, blobCacheMetrics, System::nanoTime);
@@ -343,12 +343,12 @@ public SharedBlobCacheService(
343343
NodeEnvironment environment,
344344
Settings settings,
345345
ThreadPool threadPool,
346-
String ioExecutor,
346+
Executor ioExecutor,
347347
BlobCacheMetrics blobCacheMetrics,
348348
LongSupplier relativeTimeInNanosSupplier
349349
) {
350350
this.threadPool = threadPool;
351-
this.ioExecutor = threadPool.executor(ioExecutor);
351+
this.ioExecutor = ioExecutor;
352352
long totalFsSize;
353353
try {
354354
totalFsSize = FsProbe.getTotal(Environment.getFileStore(environment.nodeDataPaths()[0]));

x-pack/plugin/blob-cache/src/test/java/org/elasticsearch/blobcache/shared/SharedBlobCacheServiceTests.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void testBasicEviction() throws IOException {
9494
environment,
9595
settings,
9696
taskQueue.getThreadPool(),
97-
ThreadPool.Names.GENERIC,
97+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
9898
BlobCacheMetrics.NOOP
9999
)
100100
) {
@@ -175,7 +175,7 @@ public void testAutoEviction() throws IOException {
175175
environment,
176176
settings,
177177
taskQueue.getThreadPool(),
178-
ThreadPool.Names.GENERIC,
178+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
179179
BlobCacheMetrics.NOOP
180180
)
181181
) {
@@ -219,7 +219,7 @@ public void testForceEviction() throws IOException {
219219
environment,
220220
settings,
221221
taskQueue.getThreadPool(),
222-
ThreadPool.Names.GENERIC,
222+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
223223
BlobCacheMetrics.NOOP
224224
)
225225
) {
@@ -253,7 +253,7 @@ public void testForceEvictResponse() throws IOException {
253253
environment,
254254
settings,
255255
taskQueue.getThreadPool(),
256-
ThreadPool.Names.GENERIC,
256+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
257257
BlobCacheMetrics.NOOP
258258
)
259259
) {
@@ -287,7 +287,7 @@ public void testDecay() throws IOException {
287287
environment,
288288
settings,
289289
taskQueue.getThreadPool(),
290-
ThreadPool.Names.GENERIC,
290+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
291291
BlobCacheMetrics.NOOP
292292
)
293293
) {
@@ -395,7 +395,7 @@ public void testMassiveDecay() throws IOException {
395395
environment,
396396
settings,
397397
taskQueue.getThreadPool(),
398-
ThreadPool.Names.GENERIC,
398+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
399399
BlobCacheMetrics.NOOP
400400
)
401401
) {
@@ -470,7 +470,7 @@ public void testGetMultiThreaded() throws IOException {
470470
environment,
471471
settings,
472472
threadPool,
473-
ThreadPool.Names.GENERIC,
473+
threadPool.executor(ThreadPool.Names.GENERIC),
474474
BlobCacheMetrics.NOOP
475475
)
476476
) {
@@ -550,7 +550,7 @@ public void execute(Runnable command) {
550550
environment,
551551
settings,
552552
threadPool,
553-
ThreadPool.Names.GENERIC,
553+
threadPool.executor(ThreadPool.Names.GENERIC),
554554
BlobCacheMetrics.NOOP
555555
)
556556
) {
@@ -618,7 +618,7 @@ public void testFetchFullCacheEntryConcurrently() throws Exception {
618618
environment,
619619
settings,
620620
threadPool,
621-
ThreadPool.Names.GENERIC,
621+
threadPool.executor(ThreadPool.Names.GENERIC),
622622
BlobCacheMetrics.NOOP
623623
)
624624
) {
@@ -826,7 +826,7 @@ public void testCacheSizeChanges() throws IOException {
826826
environment,
827827
settings,
828828
taskQueue.getThreadPool(),
829-
ThreadPool.Names.GENERIC,
829+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
830830
BlobCacheMetrics.NOOP
831831
)
832832
) {
@@ -844,7 +844,7 @@ public void testCacheSizeChanges() throws IOException {
844844
environment,
845845
settings,
846846
taskQueue.getThreadPool(),
847-
ThreadPool.Names.GENERIC,
847+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
848848
BlobCacheMetrics.NOOP
849849
)
850850
) {
@@ -869,7 +869,7 @@ public void testMaybeEvictLeastUsed() throws Exception {
869869
environment,
870870
settings,
871871
taskQueue.getThreadPool(),
872-
ThreadPool.Names.GENERIC,
872+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
873873
BlobCacheMetrics.NOOP
874874
)
875875
) {
@@ -967,7 +967,7 @@ public void execute(Runnable command) {
967967
environment,
968968
settings,
969969
threadPool,
970-
ThreadPool.Names.GENERIC,
970+
threadPool.executor(ThreadPool.Names.GENERIC),
971971
BlobCacheMetrics.NOOP
972972
)
973973
) {
@@ -1117,7 +1117,7 @@ public void execute(Runnable command) {
11171117
environment,
11181118
settings,
11191119
threadPool,
1120-
ThreadPool.Names.GENERIC,
1120+
threadPool.executor(ThreadPool.Names.GENERIC),
11211121
BlobCacheMetrics.NOOP
11221122
)
11231123
) {
@@ -1278,7 +1278,7 @@ public void testPopulate() throws Exception {
12781278
environment,
12791279
settings,
12801280
taskQueue.getThreadPool(),
1281-
ThreadPool.Names.GENERIC,
1281+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
12821282
BlobCacheMetrics.NOOP
12831283
)
12841284
) {
@@ -1394,7 +1394,7 @@ public void testUseFullRegionSize() throws IOException {
13941394
environment,
13951395
settings,
13961396
taskQueue.getThreadPool(),
1397-
ThreadPool.Names.GENERIC,
1397+
taskQueue.getThreadPool().executor(ThreadPool.Names.GENERIC),
13981398
BlobCacheMetrics.NOOP
13991399
) {
14001400
@Override
@@ -1435,7 +1435,7 @@ public void testSharedSourceInputStreamFactory() throws Exception {
14351435
environment,
14361436
settings,
14371437
threadPool,
1438-
ThreadPool.Names.GENERIC,
1438+
threadPool.executor(ThreadPool.Names.GENERIC),
14391439
BlobCacheMetrics.NOOP
14401440
)
14411441
) {

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public Collection<?> createComponents(PluginServices services) {
331331
nodeEnvironment,
332332
settings,
333333
threadPool,
334-
SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME,
334+
threadPool.executor(SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME),
335335
new BlobCacheMetrics(services.telemetryProvider().getMeterRegistry())
336336
);
337337
this.frozenCacheService.set(sharedBlobCacheService);

x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsTestCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ protected SharedBlobCacheService<CacheKey> defaultFrozenCacheService() {
144144
nodeEnvironment,
145145
Settings.EMPTY,
146146
threadPool,
147-
SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME,
147+
threadPool.executor(SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME),
148148
BlobCacheMetrics.NOOP
149149
);
150150
}
@@ -167,7 +167,7 @@ protected SharedBlobCacheService<CacheKey> randomFrozenCacheService() {
167167
singlePathNodeEnvironment,
168168
cacheSettings.build(),
169169
threadPool,
170-
SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME,
170+
threadPool.executor(SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME),
171171
BlobCacheMetrics.NOOP
172172
);
173173
}
@@ -192,7 +192,7 @@ protected SharedBlobCacheService<CacheKey> createFrozenCacheService(final ByteSi
192192
.put(SharedBlobCacheService.SHARED_CACHE_RANGE_SIZE_SETTING.getKey(), cacheRangeSize)
193193
.build(),
194194
threadPool,
195-
SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME,
195+
threadPool.executor(SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME),
196196
BlobCacheMetrics.NOOP
197197
);
198198
}

x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/store/input/FrozenIndexInputTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void testRandomReads() throws IOException {
111111
nodeEnvironment,
112112
settings,
113113
threadPool,
114-
SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME,
114+
threadPool.executor(SearchableSnapshots.CACHE_FETCH_ASYNC_THREAD_POOL_NAME),
115115
BlobCacheMetrics.NOOP
116116
);
117117
CacheService cacheService = randomCacheService();

0 commit comments

Comments
 (0)