Skip to content

Commit

Permalink
Fix flaky RemoteStoreRefreshListenerTests test #11256 (#11803)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <[email protected]>
  • Loading branch information
ashking94 authored Jan 17, 2024
1 parent 6d2d4dd commit 517f091
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,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 @@ -473,6 +473,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 @@ -554,7 +562,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 517f091

Please sign in to comment.