This is an automated email from the ASF dual-hosted git repository.

zhouky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new 343f1e62d [CELEBORN-537][FOLLOWUP] Fix blacklist potentially lost 
failure workers (#1449)
343f1e62d is described below

commit 343f1e62d22500290aefad26bc8016510f909c4a
Author: Shuang <[email protected]>
AuthorDate: Sun Apr 23 10:16:21 2023 +0800

    [CELEBORN-537][FOLLOWUP] Fix blacklist potentially lost failure workers 
(#1449)
---
 .../apache/celeborn/client/WorkerStatusTracker.scala    | 17 ++++++++++++-----
 .../celeborn/client/WorkerStatusTrackerSuite.scala      |  5 +++++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git 
a/client/src/main/scala/org/apache/celeborn/client/WorkerStatusTracker.scala 
b/client/src/main/scala/org/apache/celeborn/client/WorkerStatusTracker.scala
index 49595dc5e..89e4f8618 100644
--- a/client/src/main/scala/org/apache/celeborn/client/WorkerStatusTracker.scala
+++ b/client/src/main/scala/org/apache/celeborn/client/WorkerStatusTracker.scala
@@ -131,7 +131,6 @@ class WorkerStatusTracker(
     if (res.statusCode == StatusCode.SUCCESS) {
       logDebug(s"Received Blacklist from Master, blacklist: ${res.blacklist} " 
+
         s"unknown workers: ${res.unknownWorkers}, shutdown workers: 
${res.shuttingWorkers}")
-      val newShutdownWorkers = resolveShutdownWorkers(res.shuttingWorkers)
       val current = System.currentTimeMillis()
 
       blacklist.asScala.foreach {
@@ -147,7 +146,12 @@ class WorkerStatusTracker(
                 StatusCode.PUSH_DATA_TIMEOUT_MASTER |
                 StatusCode.PUSH_DATA_TIMEOUT_SLAVE
                 if current - registerTime < workerExcludedExpireTimeout => // 
reserve
-            case _ => blacklist.remove(workerInfo)
+            case _ =>
+              if (!res.blacklist.contains(workerInfo) &&
+                !res.shuttingWorkers.contains(workerInfo) &&
+                !res.unknownWorkers.contains(workerInfo)) {
+                blacklist.remove(workerInfo)
+              }
           }
       }
 
@@ -156,12 +160,15 @@ class WorkerStatusTracker(
           .map(_ -> (StatusCode.WORKER_IN_BLACKLIST -> current)).toMap.asJava)
       }
 
-      if (!res.unknownWorkers.isEmpty || !newShutdownWorkers.isEmpty) {
-        
blacklist.putAll(res.unknownWorkers.asScala.filterNot(blacklist.containsKey)
-          .map(_ -> (StatusCode.UNKNOWN_WORKER -> current)).toMap.asJava)
+      if (!res.shuttingWorkers.isEmpty) {
         
blacklist.putAll(res.shuttingWorkers.asScala.filterNot(blacklist.containsKey)
           .map(_ -> (StatusCode.WORKER_SHUTDOWN -> current)).toMap.asJava)
+      }
 
+      val newShutdownWorkers = resolveShutdownWorkers(res.shuttingWorkers)
+      if (!res.unknownWorkers.isEmpty || !newShutdownWorkers.isEmpty) {
+        
blacklist.putAll(res.unknownWorkers.asScala.filterNot(blacklist.containsKey)
+          .map(_ -> (StatusCode.UNKNOWN_WORKER -> current)).toMap.asJava)
         val workerStatus = new WorkersStatus(res.unknownWorkers, 
newShutdownWorkers)
         workerStatusListeners.asScala.foreach { listener =>
           try {
diff --git 
a/client/src/test/scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala
 
b/client/src/test/scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala
index 9120a4936..9496d8f01 100644
--- 
a/client/src/test/scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala
+++ 
b/client/src/test/scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala
@@ -63,6 +63,11 @@ class WorkerStatusTrackerSuite extends CelebornFunSuite {
     Assert.assertTrue(statusTracker.blacklist.containsKey(mock("host3")))
     Assert.assertTrue(statusTracker.blacklist.containsKey(mock("host4")))
 
+    // test re heartbeat with shutdown workers
+    val response3 = buildResponse(Array.empty, Array.empty, Array("host4"))
+    statusTracker.handleHeartbeatResponse(response3)
+    Assert.assertTrue(statusTracker.blacklist.containsKey(mock("host4")))
+
     // test remove
     val workers = new util.HashSet[WorkerInfo]
     workers.add(mock("host4"))

Reply via email to