From a3581959d792e130162be4034d7797ff8d423d00 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Sat, 17 May 2014 11:18:11 -0400 Subject: [PATCH] [TESTS] Ignore SnapshotMissingException in snapshotWithStuckNodeTest The retry mechanism in the transport layer might cause the delete snapshot request to be executed twice if the cluster master is closed while the request is executed. First time delete snapshot request is getting successfully executed on the old master and then it is retried on the newly elected master. When the new master tries to delete the snapshot - the snapshot no longer exists (since it was successfully deleted by the old master) and SnapshotMissingException is returned. --- .../DedicatedClusterSnapshotRestoreTests.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java b/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java index 42341df7656..1bfb4abab5c 100644 --- a/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java +++ b/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java @@ -178,8 +178,14 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests unblockNode(blockedNode); logger.info("--> stopping node", blockedNode); stopNode(blockedNode); - DeleteSnapshotResponse deleteSnapshotResponse = deleteSnapshotResponseFuture.get(); - assertThat(deleteSnapshotResponse.isAcknowledged(), equalTo(true)); + try { + DeleteSnapshotResponse deleteSnapshotResponse = deleteSnapshotResponseFuture.actionGet(); + assertThat(deleteSnapshotResponse.isAcknowledged(), equalTo(true)); + } catch (SnapshotMissingException ex) { + // When master node is closed during this test, it sometime manages to delete the snapshot files before + // completely stopping. In this case the retried delete snapshot operation on the new master can fail + // with SnapshotMissingException + } logger.info("--> making sure that snapshot no longer exists"); assertThrows(client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").execute(), SnapshotMissingException.class);