|
@@ -716,6 +716,8 @@ public class SnapshotResiliencyTests extends ESTestCase {
|
|
|
continueOrDie(createRepoAndIndex(repoName, index, shards),
|
|
|
createIndexResponse -> client().admin().cluster().state(new ClusterStateRequest(), clusterStateResponseStepListener));
|
|
|
|
|
|
+ final StepListener<CreateSnapshotResponse> snapshotStartedListener = new StepListener<>();
|
|
|
+
|
|
|
continueOrDie(clusterStateResponseStepListener, clusterStateResponse -> {
|
|
|
final ShardRouting shardToRelocate = clusterStateResponse.getState().routingTable().allShards(index).get(0);
|
|
|
final TestClusterNodes.TestClusterNode currentPrimaryNode = testClusterNodes.nodeById(shardToRelocate.currentNodeId());
|
|
@@ -734,11 +736,7 @@ public class SnapshotResiliencyTests extends ESTestCase {
|
|
|
scheduleNow(() -> testClusterNodes.stopNode(masterNode));
|
|
|
}
|
|
|
testClusterNodes.randomDataNodeSafe().client.admin().cluster().prepareCreateSnapshot(repoName, snapshotName)
|
|
|
- .execute(ActionListener.wrap(() -> {
|
|
|
- createdSnapshot.set(true);
|
|
|
- testClusterNodes.randomDataNodeSafe().client.admin().cluster().deleteSnapshot(
|
|
|
- new DeleteSnapshotRequest(repoName, snapshotName), noopListener());
|
|
|
- }));
|
|
|
+ .execute(snapshotStartedListener);
|
|
|
scheduleNow(
|
|
|
() -> testClusterNodes.randomMasterNodeSafe().client.admin().cluster().reroute(
|
|
|
new ClusterRerouteRequest().add(new AllocateEmptyPrimaryAllocationCommand(
|
|
@@ -751,6 +749,12 @@ public class SnapshotResiliencyTests extends ESTestCase {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ continueOrDie(snapshotStartedListener, snapshotResponse -> {
|
|
|
+ createdSnapshot.set(true);
|
|
|
+ testClusterNodes.randomDataNodeSafe().client.admin().cluster().deleteSnapshot(
|
|
|
+ new DeleteSnapshotRequest(repoName, snapshotName), noopListener());
|
|
|
+ });
|
|
|
+
|
|
|
runUntil(() -> testClusterNodes.randomMasterNode().map(master -> {
|
|
|
if (createdSnapshot.get() == false) {
|
|
|
return false;
|