Skip to content

Commit

Permalink
[CELEBORN-1128] Fix incorrect method reference in ConcurrentHashMap.c…
Browse files Browse the repository at this point in the history
…ontains

### 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]>
  • Loading branch information
lyy-pineapple authored and waitinfuture committed Nov 15, 2023
1 parent 7263f64 commit 69e14fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 69e14fd

Please sign in to comment.