Skip to content

Commit

Permalink
Fix testConcurrentSnapshotDeleteAndDeleteIndex (#61228) (#61249)
Browse files Browse the repository at this point in the history
There is a corner case here in which during partial snapshot the index is
deleted right between starting the snapshot in the CS and the data node getting to work
on it, causing the data node the fail that shard snapshot and making the snapshot `PARTIAL`.

Closes #61208
  • Loading branch information
original-brownbear authored Aug 18, 2020
1 parent a0af82c commit 6ffa7f0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ public void onFailure(Exception e) {
assertThat(snapshotIds, hasSize(1));

final SnapshotInfo snapshotInfo = repository.getSnapshotInfo(snapshotIds.iterator().next());
assertEquals(SnapshotState.SUCCESS, snapshotInfo.state());
if (partialSnapshot) {
assertThat(snapshotInfo.state(), either(is(SnapshotState.SUCCESS)).or(is(SnapshotState.PARTIAL)));
// Single shard for each index so we either get all indices or all except for the deleted index
assertThat(snapshotInfo.successfulShards(), either(is(indices + 1)).or(is(indices)));
if (snapshotInfo.successfulShards() == indices + 1) {
Expand All @@ -790,6 +790,7 @@ public void onFailure(Exception e) {
assertEquals(indexMetadata.getIndex(), firstIndex.get());
}
} else {
assertEquals(snapshotInfo.state(), SnapshotState.SUCCESS);
// Index delete must be blocked for non-partial snapshots and we get a snapshot for every index
assertEquals(snapshotInfo.successfulShards(), indices + 1);
}
Expand Down

0 comments on commit 6ffa7f0

Please sign in to comment.