Skip to content

Commit 2a2422b

Browse files
retry on master failover
1 parent 026dda4 commit 2a2422b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,9 +1369,15 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
13691369
logger.debug(() -> new ParameterizedMessage("Snapshot [{}] was aborted during INIT", snapshot), e);
13701370
listener.onResponse(null);
13711371
} else {
1372-
logger.warn("deleted snapshot failed", e);
1373-
listener.onFailure(
1374-
new SnapshotMissingException(snapshot.getRepository(), snapshot.getSnapshotId(), e));
1372+
if (ExceptionsHelper.unwrap(e, NotMasterException.class, FailedToCommitClusterStateException.class) != null) {
1373+
logger.warn("master failover before deleted snapshot could complete", e);
1374+
// Just pass the exception to the transport handler as is so it is retried on the new master
1375+
listener.onFailure(e);
1376+
} else {
1377+
logger.warn("deleted snapshot failed", e);
1378+
listener.onFailure(
1379+
new SnapshotMissingException(snapshot.getRepository(), snapshot.getSnapshotId(), e));
1380+
}
13751381
}
13761382
}
13771383
));

0 commit comments

Comments
 (0)