Skip to content

Commit

Permalink
Fix DedicatedClusterSnapshotRestoreIT testSnapshotWithStuckNode
Browse files Browse the repository at this point in the history
* See comment in the test: The problem is that when the snapshot delete works out partially on master failover and the retry fails on `SnapshotMissingException` no repository cleanup is run => we still failed even with repo cleanup logic in the delete path now
   * Fixed the test by rerunning a create snapshot and delete loop to clean up the repo before verifying file counts
* Closes elastic#39852
  • Loading branch information
original-brownbear committed Jun 24, 2019
1 parent 45e8d54 commit 0806334
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ public void testSnapshotDuringNodeShutdown() throws Exception {
logger.info("--> done");
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39852")
public void testSnapshotWithStuckNode() throws Exception {
logger.info("--> start 2 nodes");
ArrayList<String> nodes = new ArrayList<>();
Expand Down Expand Up @@ -483,11 +482,20 @@ public void testSnapshotWithStuckNode() throws Exception {
}

logger.info("--> making sure that snapshot no longer exists");
assertThrows(client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").execute(),
SnapshotMissingException.class);
expectThrows(SnapshotMissingException.class,
() -> client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap")
.execute().actionGet().getSnapshots("test-repo"));

logger.info("--> Go through a loop of creating and deleting a snapshot to trigger repository cleanup");
client().admin().cluster().prepareCreateSnapshot("test-repo", "test-snap-tmp")
.setWaitForCompletion(true)
.setIndices("test-idx")
.get();
client().admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap-tmp").get();

// Subtract four files that will remain in the repository:
// (1) index-1
// (2) index-0 (because we keep the previous version) and
// (1) index-(N+1)
// (2) index-N (because we keep the previous version) and
// (3) index-latest
// (4) incompatible-snapshots
assertFileCount(repo, 4);
Expand Down

0 comments on commit 0806334

Please sign in to comment.