Skip to content

Commit 73d1927

Browse files
Fix Races in testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRepos (elastic#62431) (elastic#62614)
This test (in-part) verifies that snapshot creation is not retried on master fail-over once a snaphot has been started already. Unless we wait for the snapshot creation to show up in the cluster state before failing the master node though, we could run into a race where the snapshot wasn't yet in the cluster state and a retry goes through successfully.
1 parent d87268a commit 73d1927

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/internalClusterTest/java/org/elasticsearch/snapshots/ConcurrentSnapshotsIT.java

+4
Original file line numberDiff line numberDiff line change
@@ -784,17 +784,21 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRep
784784
blockNodeOnAnyFiles(blockedRepoName, masterNode);
785785
final ActionFuture<AcknowledgedResponse> deleteFuture = startDeleteFromNonMasterClient(blockedRepoName, "*");
786786
waitForBlock(masterNode, blockedRepoName, TimeValue.timeValueSeconds(30L));
787+
awaitNDeletionsInProgress(1);
787788
final ActionFuture<CreateSnapshotResponse> createBlockedSnapshot =
788789
startFullSnapshotFromNonMasterClient(blockedRepoName, "queued-snapshot");
790+
awaitNSnapshotsInProgress(1);
789791

790792
final long generation = getRepositoryData(repoName).getGenId();
791793
blockNodeOnAnyFiles(repoName, masterNode);
792794
final ActionFuture<CreateSnapshotResponse> snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three");
793795
waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L));
796+
awaitNSnapshotsInProgress(2);
794797

795798
corruptIndexN(repoPath, generation);
796799

797800
final ActionFuture<CreateSnapshotResponse> snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four");
801+
awaitNSnapshotsInProgress(3);
798802
internalCluster().stopCurrentMasterNode();
799803
ensureStableCluster(3);
800804

0 commit comments

Comments
 (0)