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 ;
@@ -1243,7 +1244,9 @@ static List<SearchShardIterator> getRemoteShardsIterator(
1243
1244
null ,
1244
1245
searchShardsGroup .preFiltered (),
1245
1246
searchShardsGroup .skipped (),
1246
- 0 // TODO
1247
+ // This parameter is specific to the resharding feature.
1248
+ // Resharding is currently not supported with CCS.
1249
+ IndexReshardingMetadata .NOOP_RESHARD_SPLIT_SHARD_COUNT_SUMMARY
1247
1250
);
1248
1251
remoteShardIterators .add (shardIterator );
1249
1252
}
@@ -1297,7 +1300,9 @@ static List<SearchShardIterator> getRemoteShardsIteratorFromPointInTime(
1297
1300
searchContextKeepAlive ,
1298
1301
false ,
1299
1302
false ,
1300
- 0 // TODO
1303
+ // This parameter is specific to the resharding feature.
1304
+ // Resharding is currently not supported with CCS.
1305
+ IndexReshardingMetadata .NOOP_RESHARD_SPLIT_SHARD_COUNT_SUMMARY
1301
1306
);
1302
1307
remoteShardIterators .add (shardIterator );
1303
1308
}
@@ -1980,7 +1985,15 @@ static List<SearchShardIterator> getLocalShardsIteratorFromPointInTime(
1980
1985
keepAlive ,
1981
1986
false ,
1982
1987
false ,
1983
- 0 // TODO
1988
+ // This parameter is specific to the resharding feature.
1989
+ // It is used when creating a searcher to apply filtering needed to have correct search results
1990
+ // while resharding is in progress.
1991
+ // In context of PIT the searcher is reused or can be recreated only in read-only scenarios.
1992
+ // If a searcher is reused, this value won't be used
1993
+ // (it was calculated and used when PIT was created).
1994
+ // In read-only scenarios (e.g. searchable snapshots) we don't expect resharding to happen
1995
+ // so the value doesn't matter.
1996
+ IndexReshardingMetadata .NOOP_RESHARD_SPLIT_SHARD_COUNT_SUMMARY
1984
1997
)
1985
1998
);
1986
1999
}
@@ -2005,7 +2018,7 @@ List<SearchShardIterator> getLocalShardsIterator(
2005
2018
searchRequest .routing (),
2006
2019
searchRequest .indices ()
2007
2020
);
2008
- List <SearchShardRouting > shardRoutings = clusterService .operationRouting ()
2021
+ List <SearchShardRouting > searchShards = clusterService .operationRouting ()
2009
2022
.searchShards (
2010
2023
projectState ,
2011
2024
concreteIndices ,
@@ -2020,18 +2033,19 @@ List<SearchShardIterator> getLocalShardsIterator(
2020
2033
concreteIndices ,
2021
2034
searchRequest .indicesOptions ()
2022
2035
);
2023
- SearchShardIterator [] list = new SearchShardIterator [shardRoutings .size ()];
2036
+ SearchShardIterator [] list = new SearchShardIterator [searchShards .size ()];
2024
2037
int i = 0 ;
2025
- for (SearchShardRouting shardRouting : shardRoutings ) {
2026
- final ShardId shardId = shardRouting .iterator ().shardId ();
2038
+ for (SearchShardRouting shardInfo : searchShards ) {
2039
+ ShardIterator iterator = shardInfo .iterator ();
2040
+ final ShardId shardId = iterator .shardId ();
2027
2041
OriginalIndices finalIndices = originalIndices .get (shardId .getIndex ().getName ());
2028
2042
assert finalIndices != null ;
2029
2043
list [i ++] = new SearchShardIterator (
2030
2044
clusterAlias ,
2031
2045
shardId ,
2032
- shardRouting . iterator () .getShardRoutings (),
2046
+ iterator .getShardRoutings (),
2033
2047
finalIndices ,
2034
- shardRouting .reshardSplitShardCountSummary ()
2048
+ shardInfo .reshardSplitShardCountSummary ()
2035
2049
);
2036
2050
}
2037
2051
// the returned list must support in-place sorting, so this is the most memory efficient we can do here
0 commit comments