RexXiong commented on code in PR #2962:
URL: https://github.com/apache/celeborn/pull/2962#discussion_r1886129249


##########
client/src/main/scala/org/apache/celeborn/client/CommitManager.scala:
##########
@@ -114,17 +114,23 @@ class CommitManager(appUniqueId: String, val conf: 
CelebornConf, lifecycleManage
 
                     if (workerToRequests.nonEmpty) {
                       val commitFilesFailedWorkers = new ShuffleFailedWorkers()
+                      val workerInfoSnapshots =
+                        
lifecycleManager.shuffleAllocatedWorkers.get(shuffleId).keySet().asScala
+                          .map(worker => worker.toUniqueId() -> worker).toMap
+                      def getWorkerInfo(worker: WorkerInfo): WorkerInfo = {
+                        workerInfoSnapshots.get(worker.toUniqueId()).getOrElse(
+                          lifecycleManager.shuffleAllocatedWorkers
+                            .get(shuffleId)
+                            .asScala
+                            .find(_._1.equals(worker))
+                            .get
+                            ._1)
+                      }
                       try {
                         val params = new 
ArrayBuffer[CommitFilesParam](workerToRequests.size)
                         workerToRequests.foreach {
                           case (worker, requests) =>
-                            val workerInfo =
-                              lifecycleManager.shuffleAllocatedWorkers
-                                .get(shuffleId)
-                                .asScala
-                                .find(_._1.equals(worker))
-                                .get
-                                ._1
+                            val workerInfo = getWorkerInfo(worker)

Review Comment:
   Can we cache this for future commit requests? We need to ensure that it gets 
updated whenever the shuffle-related workers are modified.



##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala:
##########
@@ -453,16 +453,11 @@ private[deploy] class Controller(
     }
 
     // Update shuffleMapperAttempts
-    shuffleMapperAttempts.putIfAbsent(shuffleKey, new 
AtomicIntegerArray(mapAttempts))
-    val attempts = shuffleMapperAttempts.get(shuffleKey)
-    if (mapAttempts.exists(_ != -1)) {
-      attempts.synchronized {
-        0 until attempts.length() foreach (idx => {
-          if (mapAttempts(idx) != -1 && attempts.get(idx) == -1) {
-            attempts.set(idx, mapAttempts(idx))
-          }
-        })
-      }
+    val shuffleMapAttempts = shuffleMapperAttempts.get(shuffleKey)
+    if (shuffleMapAttempts == null) {
+      shuffleMapperAttempts.putIfAbsent(shuffleKey, new 
AtomicIntegerArray(mapAttempts))
+    } else {
+      updateShuffleMapperAttempts(mapAttempts, shuffleMapAttempts)

Review Comment:
   IMO, the updateShuffleMapperAttempts should be invoked even when 
shuffleMapAttempts is null.



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

Reply via email to