41
41
import org .elasticsearch .cluster .metadata .IndexMetadata ;
42
42
import org .elasticsearch .cluster .metadata .IndexNameExpressionResolver ;
43
43
import org .elasticsearch .cluster .metadata .IndexNameExpressionResolver .ResolvedExpression ;
44
+ import org .elasticsearch .cluster .metadata .IndexReshardingMetadata ;
44
45
import org .elasticsearch .cluster .metadata .ProjectMetadata ;
45
46
import org .elasticsearch .cluster .node .DiscoveryNode ;
46
47
import org .elasticsearch .cluster .node .DiscoveryNodes ;
@@ -1249,7 +1250,9 @@ static List<SearchShardIterator> getRemoteShardsIterator(
1249
1250
null ,
1250
1251
searchShardsGroup .preFiltered (),
1251
1252
searchShardsGroup .skipped (),
1252
- 0 // TODO
1253
+ // This parameter is specific to the resharding feature.
1254
+ // Resharding is currently not supported with CCS.
1255
+ IndexReshardingMetadata .NOOP_RESHARD_SPLIT_SHARD_COUNT_SUMMARY
1253
1256
);
1254
1257
remoteShardIterators .add (shardIterator );
1255
1258
}
@@ -1303,7 +1306,9 @@ static List<SearchShardIterator> getRemoteShardsIteratorFromPointInTime(
1303
1306
searchContextKeepAlive ,
1304
1307
false ,
1305
1308
false ,
1306
- 0 // TODO
1309
+ // This parameter is specific to the resharding feature.
1310
+ // Resharding is currently not supported with CCS.
1311
+ IndexReshardingMetadata .NOOP_RESHARD_SPLIT_SHARD_COUNT_SUMMARY
1307
1312
);
1308
1313
remoteShardIterators .add (shardIterator );
1309
1314
}
@@ -1986,7 +1991,15 @@ static List<SearchShardIterator> getLocalShardsIteratorFromPointInTime(
1986
1991
keepAlive ,
1987
1992
false ,
1988
1993
false ,
1989
- 0 // TODO
1994
+ // This parameter is specific to the resharding feature.
1995
+ // It is used when creating a searcher to apply filtering needed to have correct search results
1996
+ // while resharding is in progress.
1997
+ // In context of PIT the searcher is reused or can be recreated only in read-only scenarios.
1998
+ // If a searcher is reused, this value won't be used
1999
+ // (it was calculated and used when PIT was created).
2000
+ // In read-only scenarios (e.g. searchable snapshots) we don't expect resharding to happen
2001
+ // so the value doesn't matter.
2002
+ IndexReshardingMetadata .NOOP_RESHARD_SPLIT_SHARD_COUNT_SUMMARY
1990
2003
)
1991
2004
);
1992
2005
}
@@ -2011,7 +2024,7 @@ List<SearchShardIterator> getLocalShardsIterator(
2011
2024
searchRequest .routing (),
2012
2025
searchRequest .indices ()
2013
2026
);
2014
- List <SearchShardRouting > shardRoutings = clusterService .operationRouting ()
2027
+ List <SearchShardRouting > searchShards = clusterService .operationRouting ()
2015
2028
.searchShards (
2016
2029
projectState ,
2017
2030
concreteIndices ,
@@ -2026,18 +2039,19 @@ List<SearchShardIterator> getLocalShardsIterator(
2026
2039
concreteIndices ,
2027
2040
searchRequest .indicesOptions ()
2028
2041
);
2029
- SearchShardIterator [] list = new SearchShardIterator [shardRoutings .size ()];
2042
+ SearchShardIterator [] list = new SearchShardIterator [searchShards .size ()];
2030
2043
int i = 0 ;
2031
- for (SearchShardRouting shardRouting : shardRoutings ) {
2032
- final ShardId shardId = shardRouting .iterator ().shardId ();
2044
+ for (SearchShardRouting shardInfo : searchShards ) {
2045
+ ShardIterator iterator = shardInfo .iterator ();
2046
+ final ShardId shardId = iterator .shardId ();
2033
2047
OriginalIndices finalIndices = originalIndices .get (shardId .getIndex ().getName ());
2034
2048
assert finalIndices != null ;
2035
2049
list [i ++] = new SearchShardIterator (
2036
2050
clusterAlias ,
2037
2051
shardId ,
2038
- shardRouting . iterator () .getShardRoutings (),
2052
+ iterator .getShardRoutings (),
2039
2053
finalIndices ,
2040
- shardRouting .reshardSplitShardCountSummary ()
2054
+ shardInfo .reshardSplitShardCountSummary ()
2041
2055
);
2042
2056
}
2043
2057
// the returned list must support in-place sorting, so this is the most memory efficient we can do here
0 commit comments