Skip to content

Commit 8645976

Browse files
committed
Assert in IndexReshardingState.Split ctor that source shards are not all done
1 parent 1398524 commit 8645976

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/IndexReshardingState.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ public static TargetShardState readFrom(StreamInput in) throws IOException {
181181
private final TargetShardState[] targetShards;
182182

183183
Split(SourceShardState[] sourceShards, TargetShardState[] targetShards) {
184+
// The resharding metadata is deleted when the last source shard transitions to done
185+
assert Arrays.stream(sourceShards).allMatch((state) -> state == SourceShardState.DONE) == false;
186+
184187
this.sourceShards = sourceShards;
185188
this.targetShards = targetShards;
186189

0 commit comments

Comments
 (0)