Skip to content

Commit

Permalink
Fix flaky test IndexShardTests.testCommitLevelRestoreShardFromRemoteS…
Browse files Browse the repository at this point in the history
…tore (opensearch-project#14418) (opensearch-project#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>
Signed-off-by: kkewwei <kkewwei@163.com>
  • Loading branch information
2 people authored and kkewwei committed Jul 24, 2024
1 parent fd5d876 commit ee7205e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,14 @@ public void testRestoreShardFromRemoteStore(boolean performFlush) throws IOExcep
)
);

// Make sure to drain refreshes from the shard. Otherwise, if the refresh is in-progress, it overlaps with
// deletion of segment files in the subsequent code block.
for (ReferenceManager.RefreshListener refreshListener : target.getEngine().config().getInternalRefreshListener()) {
if (refreshListener instanceof ReleasableRetryableRefreshListener) {
((ReleasableRetryableRefreshListener) refreshListener).drainRefreshes();
}
}

// Delete files in store directory to restore from remote directory
Directory storeDirectory = target.store().directory();

Expand Down

0 comments on commit ee7205e

Please sign in to comment.