Skip to content

Commit dc3d475

Browse files
Fix Test SharedClusterSnapshotRestoreIT.testDataFileFailureDuringRestore (#80515) (#124282)
This is a test/assertion only issue. We were removing the tracking of a shard restore after invoking the listener for the restore. The whole mechanics around `onGoingRestores` though is used to wait for the blobstore to go idle during node shutdown. The problem with removing the tracking for the shard after resolving the listener is that if the restore is retried very quickly due to some reroute or so, then we have a race where it's retried before the failed restore is removed from `onGoingRestores`. => fixed by just removing the tracking before resolving the listener which is more correct anyway since we are done with the blobstore at this point. closes #80477 (cherry picked from commit ea93bdb) Co-authored-by: Armin Braun <[email protected]>
1 parent 313a84a commit dc3d475

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2992,7 +2992,7 @@ public void restoreShard(
29922992
final boolean added = ongoingRestores.add(shardId);
29932993
assert added : "add restore for [" + shardId + "] that already has an existing restore";
29942994
}
2995-
executor.execute(ActionRunnable.wrap(ActionListener.runAfter(restoreListener, () -> {
2995+
executor.execute(ActionRunnable.wrap(ActionListener.runBefore(restoreListener, () -> {
29962996
final List<ActionListener<Void>> onEmptyListeners;
29972997
synchronized (ongoingRestores) {
29982998
if (ongoingRestores.remove(shardId) && ongoingRestores.isEmpty() && emptyListeners != null) {

0 commit comments

Comments
 (0)