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 69e14fd34 [CELEBORN-1128] Fix incorrect method reference in 
ConcurrentHashMap.contains
69e14fd34 is described below

commit 69e14fd3419f2d8b61f1a9f09f7a9ce0c452d861
Author: liangyongyuan <[email protected]>
AuthorDate: Wed Nov 15 19:48:39 2023 +0800

    [CELEBORN-1128] Fix incorrect method reference in ConcurrentHashMap.contains
    
    ### What changes were proposed in this pull request?
    ConcurrentHashMap.contains main containsValue ,not containsKey. In the 
current codebase, there is a misuse of the contains method in the 
ConcurrentHashMap class.
    
    ### Why are the changes needed?
    ConcurrentHashMap.contains misuse
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    No
    
    Closes #2102 from lyy-pineapple/hashMap.
    
    Authored-by: liangyongyuan <[email protected]>
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 .../scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala   | 4 ++--
 .../scala/org/apache/celeborn/service/deploy/worker/Controller.scala  | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

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 5d3355a33..1f606dd32 100644
--- 
a/client/src/test/scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala
+++ 
b/client/src/test/scala/org/apache/celeborn/client/WorkerStatusTrackerSuite.scala
@@ -61,13 +61,13 @@ class WorkerStatusTrackerSuite extends CelebornFunSuite {
     // test new added workers
     Assert.assertTrue(statusTracker.excludedWorkers.containsKey(mock("host0")))
     Assert.assertTrue(statusTracker.excludedWorkers.containsKey(mock("host3")))
-    Assert.assertTrue(!statusTracker.excludedWorkers.contains(mock("host4")))
+    
Assert.assertTrue(!statusTracker.excludedWorkers.containsKey(mock("host4")))
     Assert.assertTrue(statusTracker.shuttingWorkers.contains(mock("host4")))
 
     // test re heartbeat with shutdown workers
     val response3 = buildResponse(Array.empty, Array.empty, Array("host4"))
     statusTracker.handleHeartbeatResponse(response3)
-    Assert.assertTrue(!statusTracker.excludedWorkers.contains(mock("host4")))
+    
Assert.assertTrue(!statusTracker.excludedWorkers.containsKey(mock("host4")))
     Assert.assertTrue(statusTracker.shuttingWorkers.contains(mock("host4")))
 
     // test remove
diff --git 
a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala
 
b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala
index 8418d69d6..d55b7dadb 100644
--- 
a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala
+++ 
b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/Controller.scala
@@ -353,7 +353,8 @@ private[deploy] class Controller(
       epoch: Long): Unit = {
 
     def alreadyCommitted(shuffleKey: String, epoch: Long): Boolean = {
-      shuffleCommitInfos.contains(shuffleKey) && 
shuffleCommitInfos.get(shuffleKey).contains(epoch)
+      shuffleCommitInfos.containsKey(shuffleKey) && 
shuffleCommitInfos.get(shuffleKey).containsKey(
+        epoch)
     }
 
     // Reply SHUFFLE_NOT_REGISTERED if shuffleKey does not exist AND the 
shuffle is not committed.

Reply via email to