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 <[email protected]>
  • Loading branch information
sachinpkale authored and harshavamsi committed Jul 12, 2024
1 parent 6cb4967 commit f5f72ba
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 f5f72ba

Please sign in to comment.