xumanbu commented on code in PR #1445:
URL: 
https://github.com/apache/incubator-uniffle/pull/1445#discussion_r1457276071


##########
client-spark/spark3/src/main/java/org/apache/spark/shuffle/RssShuffleManager.java:
##########
@@ -1187,6 +1195,82 @@ public synchronized boolean reassignShuffleServers(
     }
   }
 
+  @Override
+  public ShuffleServerInfo reassignFaultyShuffleServer(
+      int shuffleId, Set<String> partitionIds, String faultyShuffleServerId) {
+    ShuffleServerInfo newShuffleServerInfo;
+    synchronized (this) {
+      if (getReassignedFaultyServers().containsKey(faultyShuffleServerId)) {
+        return getReassignedFaultyServers().get(faultyShuffleServerId);
+      }
+      newShuffleServerInfo = assignShuffleServer(shuffleId, 
faultyShuffleServerId);
+      if (newShuffleServerInfo == null) {
+        return null;
+      }
+      getReassignedFaultyServers().put(faultyShuffleServerId, 
newShuffleServerInfo);
+    }
+    ShuffleHandleInfo shuffleHandleInfo = 
shuffleIdToShuffleHandleInfo.get(shuffleId);
+    for (String partitionId : partitionIds) {
+      List<ShuffleServerInfo> shuffleServerInfoList =
+          shuffleHandleInfo.getPartitionToServers().get(partitionId);
+      for (int i = 0; i < shuffleServerInfoList.size(); i++) {
+        if 
(shuffleServerInfoList.get(i).getId().equals(faultyShuffleServerId)) {
+          shuffleHandleInfo
+              .getDynamicAssignedPartitionServers()
+              .computeIfAbsent(Integer.valueOf(partitionId), k -> 
Maps.newHashMap());
+          shuffleHandleInfo
+              .getDynamicAssignedPartitionServers()
+              .get(partitionId)
+              .computeIfAbsent(i, j -> Lists.newArrayList())
+              .add(newShuffleServerInfo);
+        }
+      }
+    }
+    return newShuffleServerInfo;
+  }
+
+  private Map<String, ShuffleServerInfo> reassignedFaultyServers = 
Maps.newConcurrentMap();
+
+  public Map<String, ShuffleServerInfo> getReassignedFaultyServers() {
+    return reassignedFaultyServers;
+  }
+
+  private ShuffleServerInfo assignShuffleServer(int shuffleId, String 
faultyShuffleServerId) {

Review Comment:
   ok,I'll  extract a method. 
   
   should we add a new rpc in coordinator for assgin only one shuffle server?



-- 
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]

Reply via email to