Skip to content

Commit 49d9dee

Browse files
Fix flaky test IndexShardTests.testCommitLevelRestoreShardFromRemoteStore (#14418) (#14422)
(cherry picked from commit 3a0c0c0) Signed-off-by: Sachin Kale <kalsac@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 82077a6 commit 49d9dee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server/src/test/java/org/opensearch/index/shard/IndexShardTests.java

+8
Original file line numberDiff line numberDiff line change
@@ -2894,6 +2894,14 @@ public void testRestoreShardFromRemoteStore(boolean performFlush) throws IOExcep
28942894
)
28952895
);
28962896

2897+
// Make sure to drain refreshes from the shard. Otherwise, if the refresh is in-progress, it overlaps with
2898+
// deletion of segment files in the subsequent code block.
2899+
for (ReferenceManager.RefreshListener refreshListener : target.getEngine().config().getInternalRefreshListener()) {
2900+
if (refreshListener instanceof ReleasableRetryableRefreshListener) {
2901+
((ReleasableRetryableRefreshListener) refreshListener).drainRefreshes();
2902+
}
2903+
}
2904+
28972905
// Delete files in store directory to restore from remote directory
28982906
Directory storeDirectory = target.store().directory();
28992907

0 commit comments

Comments
 (0)