diff --git a/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java b/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java index 4b205a55370..e0b9a4e48ac 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java +++ b/server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java @@ -357,6 +357,9 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements return; } + // Clear request deduplicator since we need to send all requests that were potentially not handled by the previous + // master again + remoteFailedRequestDeduplicator.clear(); for (SnapshotsInProgress.Entry snapshot : snapshotsInProgress.entries()) { if (snapshot.state() == State.STARTED || snapshot.state() == State.ABORTED) { Map localShards = currentSnapshotShards(snapshot.snapshot()); diff --git a/server/src/main/java/org/elasticsearch/transport/TransportRequestDeduplicator.java b/server/src/main/java/org/elasticsearch/transport/TransportRequestDeduplicator.java index d929ef34ce2..6249975bf3e 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportRequestDeduplicator.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportRequestDeduplicator.java @@ -53,6 +53,14 @@ public final class TransportRequestDeduplicator { } } + /** + * Remove all tracked requests from this instance so that the first time {@link #executeOnce} is invoked with any request it triggers + * an actual request execution. Use this e.g. for requests to master that need to be sent again on master failover. + */ + public void clear() { + requests.clear(); + } + public int size() { return requests.size(); }