File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
server/src/main/java/org/elasticsearch/cluster/metadata Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -1158,10 +1158,13 @@ public int getNumberOfShards() {
11581158 * @return Effective shard count as seen by an operation using this IndexMetadata
11591159 */
11601160 public int getReshardSplitShardCount (int shardId , IndexReshardingState .Split .TargetShardState minShardState ) {
1161+ assert shardId >= 0 && shardId < getNumberOfShards (): "shardId is out of bounds" ;
11611162 int shardCount = getNumberOfShards ();
11621163 if (reshardingMetadata != null ) {
11631164 if (reshardingMetadata .getSplit ().isTargetShard (shardId )) {
11641165 // TODO: Assert that target state is atleast minShardState
1166+ int sourceShardId = reshardingMetadata .getSplit ().sourceShard (shardId );
1167+ assert reshardingMetadata .getSplit ().allTargetStatesAtLeast (sourceShardId , minShardState ): "unexpected target state" ;
11651168 shardCount = reshardingMetadata .getSplit ().shardCountAfter ();
11661169 } else if (reshardingMetadata .getSplit ().isSourceShard (shardId )) {
11671170 if (reshardingMetadata .getSplit ().allTargetStatesAtLeast (shardId , minShardState )) {
You can’t perform that action at this time.
0 commit comments