diff --git a/docs/changelog/84089.yaml b/docs/changelog/84089.yaml new file mode 100644 index 0000000000000..5404d331ebd3c --- /dev/null +++ b/docs/changelog/84089.yaml @@ -0,0 +1,6 @@ +pr: 84089 +summary: Preserve context in `snapshotDeletionListeners` +area: Snapshot/Restore +type: bug +issues: + - 84036 diff --git a/server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java b/server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java index b22967eb7b626..38957ac3d9db6 100644 --- a/server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java +++ b/server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java @@ -2289,7 +2289,8 @@ private static boolean isWritingToRepository(SnapshotsInProgress.Entry entry) { } private void addDeleteListener(String deleteUUID, ActionListener listener) { - snapshotDeletionListeners.computeIfAbsent(deleteUUID, k -> new CopyOnWriteArrayList<>()).add(listener); + snapshotDeletionListeners.computeIfAbsent(deleteUUID, k -> new CopyOnWriteArrayList<>()) + .add(ContextPreservingActionListener.wrapPreservingContext(listener, threadPool.getThreadContext())); } /**