xumanbu commented on code in PR #1445:
URL:
https://github.com/apache/incubator-uniffle/pull/1445#discussion_r1454847175
##########
client-spark/spark3/src/main/java/org/apache/spark/shuffle/writer/RssShuffleWriter.java:
##########
@@ -402,6 +416,105 @@ private void checkIfBlocksFailed() {
}
}
+ private boolean needReAssignShuffleServer(Set<Long> failedBlockIds) {
+ boolean result = true;
+ FailedBlockSendTracker failedBlockTracker =
shuffleManager.getBlockIdsFailedSendTracker(taskId);
+ for (Long failedBlockId : failedBlockIds) {
+ result =
+ failedBlockTracker.getFailedBlockStatus(failedBlockId).stream()
+ // todo: more status need reassign
+ .allMatch(
+ trackBlockStatus -> trackBlockStatus.getStatusCode() ==
StatusCode.NO_BUFFER);
+ }
+ return result;
+ }
+
+ private void reAssignServerForFailedBlockIds(Set<Long> failedBlockIds) {
+ List<ShuffleBlockInfo> reAssignSeverBlockInfoList = Lists.newArrayList();
+ List<ShuffleBlockInfo> failedBlockInfoList = Lists.newArrayList();
+ for (Long failedBlockId : failedBlockIds) {
+ FailedBlockSendTracker failedBlockTracker =
+ shuffleManager.getBlockIdsFailedSendTracker(taskId);
+ Set<TrackBlockStatus> trackBlockStatusSet =
+ failedBlockTracker.getFailedBlockStatus(failedBlockId);
+
+ Map<ShuffleServerInfo, List<TrackBlockStatus>> faultyServerToPartitions =
+ trackBlockStatusSet.stream()
+ .collect(Collectors.groupingBy(d -> d.getShuffleServerInfo()));
+
+ faultyServerToPartitions.entrySet().stream()
+ .forEach(
+ t -> {
+ Set<String> partitionIds =
+ t.getValue().stream()
+ .map(x ->
String.valueOf(x.getShuffleBlockInfo().getPartitionId()))
+ .collect(Collectors.toSet());
+ ShuffleServerInfo dynamicShuffleServer =
+
shuffleManager.getReassignedFaultyServers().get(t.getKey().getId());
+ if (dynamicShuffleServer == null) {
+ dynamicShuffleServer =
+ reAssignFaultyShuffleServer(partitionIds,
t.getKey().getId());
+ if (dynamicShuffleServer == null) {
Review Comment:
good catch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]