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 wangdongyu.danny committed Aug 22, 2024
1 parent 5ee5c10 commit e22ef98
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 e22ef98

Please sign in to comment.