jerqi commented on code in PR #470:
URL: https://github.com/apache/incubator-uniffle/pull/470#discussion_r1068881027


##########
client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java:
##########
@@ -246,6 +259,18 @@ public SendShuffleDataResult sendShuffleData(String appId, 
List<ShuffleBlockInfo
     // which is minimum number when there is at most *replicaWrite - replica* 
sending server failures.
     for (ShuffleBlockInfo sbi : shuffleBlockInfoList) {
       List<ShuffleServerInfo> allServers = sbi.getShuffleServerInfos();
+      if (replica > 1 && !shuffleServerBlacklist.isEmpty()) {
+        // We can't modify allServers directly, because allServers is shared 
and is not thread safe
+        List<ShuffleServerInfo> newServerList = new ArrayList<>(allServers);
+        for (int i = newServerList.size() - 2; i >= 0; i--) {
+          ShuffleServerInfo serverInfo = newServerList.get(i);
+          if (shuffleServerBlacklist.contains(serverInfo)) {
+            newServerList.remove(i);
+            newServerList.add(serverInfo);
+          }
+        }
+        sbi.setShuffleServerInfos(newServerList);

Review Comment:
   This method isn't thread safe, too.



##########
client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java:
##########
@@ -246,6 +259,18 @@ public SendShuffleDataResult sendShuffleData(String appId, 
List<ShuffleBlockInfo
     // which is minimum number when there is at most *replicaWrite - replica* 
sending server failures.
     for (ShuffleBlockInfo sbi : shuffleBlockInfoList) {
       List<ShuffleServerInfo> allServers = sbi.getShuffleServerInfos();
+      if (replica > 1 && !shuffleServerBlacklist.isEmpty()) {
+        // We can't modify allServers directly, because allServers is shared 
and is not thread safe
+        List<ShuffleServerInfo> newServerList = new ArrayList<>(allServers);
+        for (int i = newServerList.size() - 2; i >= 0; i--) {
+          ShuffleServerInfo serverInfo = newServerList.get(i);
+          if (shuffleServerBlacklist.contains(serverInfo)) {
+            newServerList.remove(i);
+            newServerList.add(serverInfo);
+          }
+        }
+        sbi.setShuffleServerInfos(newServerList);

Review Comment:
   This method `setShuffleServerInfos` isn't thread safe, too.



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