Skip to content

Commit

Permalink
Fix flaky RemoteStoreRefreshListenerTests test #11256 (#11803) (#11902)
Browse files Browse the repository at this point in the history
(cherry picked from commit 517f091)

Signed-off-by: Ashish Singh <[email protected]>
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>
  • Loading branch information
1 parent 8a30378 commit 52706da
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public void testTrackerData() throws Exception {
RemoteStoreRefreshListener listener = tuple.v1();
RemoteStoreStatsTrackerFactory trackerFactory = tuple.v2();
RemoteSegmentTransferTracker tracker = trackerFactory.getRemoteSegmentTransferTracker(indexShard.shardId());
assertNoLag(tracker);
assertBusy(() -> assertNoLag(tracker));
indexDocs(100, randomIntBetween(100, 200));
indexShard.refresh("test");
listener.afterRefresh(true);
Expand Down Expand Up @@ -533,6 +533,14 @@ private Tuple<RemoteStoreRefreshListener, RemoteStoreStatsTrackerFactory> mockIn
new InternalEngineFactory()
);

RemoteSegmentTransferTracker tracker = indexShard.getRemoteStoreStatsTrackerFactory()
.getRemoteSegmentTransferTracker(indexShard.shardId());
try {
assertBusy(() -> assertTrue(tracker.getTotalUploadsSucceeded() > 0));
} catch (Exception e) {
assert false;
}

indexDocs(1, randomIntBetween(1, 100));

// Mock indexShard.store().directory()
Expand Down Expand Up @@ -619,7 +627,6 @@ private Tuple<RemoteStoreRefreshListener, RemoteStoreStatsTrackerFactory> mockIn
RecoverySettings recoverySettings = mock(RecoverySettings.class);
when(recoverySettings.getMinRemoteSegmentMetadataFiles()).thenReturn(10);
when(shard.getRecoverySettings()).thenReturn(recoverySettings);
RemoteSegmentTransferTracker tracker = remoteStoreStatsTrackerFactory.getRemoteSegmentTransferTracker(indexShard.shardId());
RemoteStoreRefreshListener refreshListener = new RemoteStoreRefreshListener(shard, emptyCheckpointPublisher, tracker);
refreshListener.afterRefresh(true);
return Tuple.tuple(refreshListener, remoteStoreStatsTrackerFactory);
Expand Down

0 comments on commit 52706da

Please sign in to comment.