|
50 | 50 | import org.elasticsearch.common.util.CollectionUtils; |
51 | 51 | import org.elasticsearch.common.util.FeatureFlag; |
52 | 52 | import org.elasticsearch.common.util.concurrent.AbstractRunnable; |
53 | | -import org.elasticsearch.common.util.concurrent.ConcurrentCollections; |
54 | 53 | import org.elasticsearch.common.util.concurrent.EsExecutors; |
55 | 54 | import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; |
56 | 55 | import org.elasticsearch.core.IOUtils; |
@@ -372,8 +371,6 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv |
372 | 371 | private final String sessionId; |
373 | 372 |
|
374 | 373 | private final Tracer tracer; |
375 | | - private Map<ShardId, Set<Supplier<ReaderContext>>> relocatingContexts = ConcurrentCollections |
376 | | - .newConcurrentMapWithAggressiveConcurrency(); |
377 | 374 |
|
378 | 375 | public SearchService( |
379 | 376 | ClusterService clusterService, |
@@ -1382,10 +1379,6 @@ protected void putRelocatedReaderContext(Long mappingKey, ReaderContext context) |
1382 | 1379 | } |
1383 | 1380 | } |
1384 | 1381 |
|
1385 | | - public void addRelocatingContext(ShardId shardId, Supplier<ReaderContext> readerContext) { |
1386 | | - this.relocatingContexts.computeIfAbsent(shardId, k -> ConcurrentCollections.newConcurrentSet()).add(readerContext); |
1387 | | - } |
1388 | | - |
1389 | 1382 | /** |
1390 | 1383 | * Opens the reader context for given shardId. The newly opened reader context will be keep |
1391 | 1384 | * until the {@code keepAlive} elapsed unless it is manually released. |
@@ -1425,19 +1418,6 @@ public void openReaderContext(ShardId shardId, TimeValue keepAlive, ActionListen |
1425 | 1418 | }); |
1426 | 1419 | } |
1427 | 1420 |
|
1428 | | - public void afterIndexShardStarted(IndexShard indexShard) { |
1429 | | - logger.debug("afterIndexShardStarted [{}]", indexShard); |
1430 | | - ShardId shardId = indexShard.shardId(); |
1431 | | - if (relocatingContexts.containsKey(shardId)) { |
1432 | | - Set<Supplier<ReaderContext>> readerContexts = relocatingContexts.get(shardId); |
1433 | | - for (Supplier<ReaderContext> readerContext : readerContexts) { |
1434 | | - ReaderContext newReaderContext = readerContext.get(); |
1435 | | - logger.debug("added context [{}] to active readers", newReaderContext.id()); |
1436 | | - } |
1437 | | - relocatingContexts.remove(shardId); |
1438 | | - } |
1439 | | - } |
1440 | | - |
1441 | 1421 | protected SearchContext createContext( |
1442 | 1422 | ReaderContext readerContext, |
1443 | 1423 | ShardSearchRequest request, |
@@ -1987,15 +1967,6 @@ protected void doRun() { |
1987 | 1967 | freeReaderContext(context.id()); |
1988 | 1968 | } |
1989 | 1969 | } |
1990 | | - // TODO clean up pending relocating contexts. How long to wait for a relocation to complete? |
1991 | | - // for (Set<Supplier<ReaderContext>> contexts : relocatingContexts.values()) { |
1992 | | - // for (Supplier<ReaderContext> context : contexts) { |
1993 | | - // if (context.isExpired()) { |
1994 | | - // logger.debug("freeing relocating search context [{}]", context.id()); |
1995 | | - // freeReaderContext(context.id()); |
1996 | | - // } |
1997 | | - // } |
1998 | | - // }< |
1999 | 1970 | } |
2000 | 1971 |
|
2001 | 1972 | @Override |
|
0 commit comments