Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ private void reassignAndResendForFailedBlocks(FailedBlockSendTracker failedBlock
for (Long blockId : failedBlockIds) {
List<TrackingBlockStatus> failedBlockStatus =
failedBlockSendTracker.getFailedBlockStatus(blockId);
if (CollectionUtils.isEmpty(failedBlockStatus)) {
continue;
}
synchronized (failedBlockStatus) {
int retryCnt =
failedBlockStatus.stream()
Expand Down Expand Up @@ -180,6 +183,9 @@ private void reassignAndResendForFailedBlocks(FailedBlockSendTracker failedBlock
resendBlocks.addAll(failedBlockStatus);
}
}
if (resendBlocks.isEmpty()) {
return;
}
reassignAndResendBlocks(resendBlocks);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.uniffle.shuffle;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -44,6 +45,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;

public class ReassignExecutorTest {
Expand Down Expand Up @@ -104,6 +106,18 @@ void testRetryExceededShouldFailAndReleaseResources() {
verify(blockInfo).executeCompletionCallback(true);
}

@Test
void testRemovedFailureStatusShouldBeIgnored() {
long blockId = 100L;
when(failedBlockSendTracker.getFailedBlockIds())
.thenReturn(new HashSet<>(Arrays.asList(blockId)));
when(failedBlockSendTracker.getFailedBlockStatus(blockId)).thenReturn(Collections.emptyList());

executor.reassign();

verifyNoInteractions(removeBlockStatsFunction, resendBlocksFunction, shuffleManagerClient);
}

@Test
public void testMixedSameAndDifferent() throws Exception {
Map<Integer, Pair<List<String>, List<String>>> map = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ public void clearAndReleaseBlockResources() {
}

public Set<Long> getFailedBlockIds() {
return trackingBlockStatusMap.keySet();
return Sets.newHashSet(trackingBlockStatusMap.keySet());
}

public List<TrackingBlockStatus> getFailedBlockStatus(Long blockId) {
return trackingBlockStatusMap.get(blockId);
List<TrackingBlockStatus> statuses = trackingBlockStatusMap.get(blockId);
return statuses == null ? Collections.emptyList() : statuses;
}

public Set<ShuffleServerInfo> getFaultyShuffleServers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.uniffle.client.impl;

import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

Expand All @@ -30,6 +31,8 @@
import org.apache.uniffle.common.rpc.StatusCode;

import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class FailedBlockSendTrackerTest {
@Test
Expand Down Expand Up @@ -72,4 +75,30 @@ public void test() throws Exception {
return CollectionUtils.isEqualCollection(expected, actual);
});
}

@Test
public void getFailedBlockIdsShouldReturnSnapshot() {
FailedBlockSendTracker tracker = new FailedBlockSendTracker();
ShuffleServerInfo shuffleServerInfo = new ShuffleServerInfo("host1", 19999);
ShuffleBlockInfo shuffleBlockInfo =
new ShuffleBlockInfo(
0,
0,
1L,
0,
0L,
new byte[] {},
Lists.newArrayList(shuffleServerInfo),
0,
0L,
0L);

tracker.add(shuffleBlockInfo, shuffleServerInfo, StatusCode.INTERNAL_ERROR);

Set<Long> failedBlockIds = tracker.getFailedBlockIds();
tracker.remove(shuffleBlockInfo.getBlockId());

assertEquals(1, failedBlockIds.size());
assertTrue(tracker.getFailedBlockStatus(shuffleBlockInfo.getBlockId()).isEmpty());
}
}