Skip to content

Commit c1cf293

Browse files
committed
PR feedback: rename acquireSearcherSupplier
Call the variant that takes a splitShardCountSummary acquireExternalSearcherSupplier.
1 parent a7290fd commit c1cf293

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,14 @@ public Engine.SearcherSupplier acquireSearcherSupplier() {
17131713
return acquireSearcherSupplier(Engine.SearcherScope.EXTERNAL);
17141714
}
17151715

1716-
public Engine.SearcherSupplier acquireSearcherSupplier(SplitShardCountSummary splitShardCountSummary) {
1716+
/**
1717+
* Acquires a point-in-time reader that can be used to create {@link Engine.Searcher}s on demand.
1718+
* The supplier is aware of shard splits and will filter documents that have been moved to other shards
1719+
* according to the provided {@link SplitShardCountSummary}.
1720+
* @param splitShardCountSummary a summary of the shard routing state seen when the search request was created
1721+
* @return a searcher supplier
1722+
*/
1723+
public Engine.SearcherSupplier acquireExternalSearcherSupplier(SplitShardCountSummary splitShardCountSummary) {
17171724
return acquireSearcherSupplier(Engine.SearcherScope.EXTERNAL, splitShardCountSummary);
17181725
}
17191726

server/src/main/java/org/elasticsearch/search/SearchService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ final ReaderContext createOrGetReaderContext(ShardSearchRequest request) {
12721272
// calculated from the ids of the underlying segments of an index commit
12731273
final IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
12741274
final IndexShard shard = indexService.getShard(request.shardId().id());
1275-
final Engine.SearcherSupplier searcherSupplier = shard.acquireSearcherSupplier(request.getSplitShardCountSummary());
1275+
final Engine.SearcherSupplier searcherSupplier = shard.acquireExternalSearcherSupplier(request.getSplitShardCountSummary());
12761276
if (contextId.sameSearcherIdsAs(searcherSupplier.getSearcherId()) == false) {
12771277
searcherSupplier.close();
12781278
throw e;
@@ -1300,7 +1300,7 @@ final ReaderContext createOrGetReaderContext(ShardSearchRequest request) {
13001300
request,
13011301
indexService,
13021302
shard,
1303-
shard.acquireSearcherSupplier(request.getSplitShardCountSummary()),
1303+
shard.acquireExternalSearcherSupplier(request.getSplitShardCountSummary()),
13041304
keepAliveInMillis
13051305
);
13061306
}
@@ -1454,7 +1454,7 @@ protected SearchContext createContext(
14541454
public SearchContext createSearchContext(ShardSearchRequest request, TimeValue timeout) throws IOException {
14551455
final IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
14561456
final IndexShard indexShard = indexService.getShard(request.shardId().getId());
1457-
final Engine.SearcherSupplier reader = indexShard.acquireSearcherSupplier(request.getSplitShardCountSummary());
1457+
final Engine.SearcherSupplier reader = indexShard.acquireExternalSearcherSupplier(request.getSplitShardCountSummary());
14581458
final ShardSearchContextId id = new ShardSearchContextId(sessionId, idGenerator.incrementAndGet(), reader.getSearcherId());
14591459
try (ReaderContext readerContext = new ReaderContext(id, indexService, indexShard, reader, -1L, true)) {
14601460
// Use ResultsType.QUERY so that the created search context can execute queries correctly.

0 commit comments

Comments
 (0)