Skip to content

Commit

Permalink
[#1782] fix: Fix flaky test ShuffleBufferManagerTest (#2100)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

As title.

### Why are the changes needed?

Fix: #1782

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing UTs.
  • Loading branch information
maobaolong authored Jan 4, 2025
1 parent fd27a08 commit 8aa3616
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.roaringbitmap.longlong.Roaring64NavigableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.uniffle.common.PartitionRange;
import org.apache.uniffle.common.RemoteStorageInfo;
Expand Down Expand Up @@ -70,6 +72,8 @@
import static org.mockito.Mockito.when;

public class ShuffleBufferManagerTest extends BufferTestBase {
private static final Logger LOG = LoggerFactory.getLogger(ShuffleBufferManagerTest.class);

private ShuffleBufferManager shuffleBufferManager;
private ShuffleFlushManager mockShuffleFlushManager;
private ShuffleServer mockShuffleServer;
Expand Down Expand Up @@ -656,8 +660,13 @@ private void waitForFlush(
int retry = 0;
long committedCount = 0;
do {
committedCount =
shuffleFlushManager.getCommittedBlockIds(appId, shuffleId).getLongCardinality();
try {
committedCount =
shuffleFlushManager.getCommittedBlockIds(appId, shuffleId).getLongCardinality();
} catch (Throwable e) {
// ignore ArrayIndexOutOfBoundsException and ConcurrentModificationException
LOG.error("Ignored exception.", e);
}
if (committedCount < expectedBlockNum) {
Thread.sleep(500);
}
Expand Down

0 comments on commit 8aa3616

Please sign in to comment.