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)

Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
sachinpkale committed Jun 18, 2024
1 parent e22b651 commit 3a0c0c0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,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 3a0c0c0

Please sign in to comment.