FMX commented on code in PR #2532:
URL: https://github.com/apache/celeborn/pull/2532#discussion_r1680617224
##########
client/src/main/scala/org/apache/celeborn/client/ChangePartitionManager.scala:
##########
@@ -79,14 +85,27 @@ class ChangePartitionManager(
batchHandleChangePartitionExecutors.submit {
new Runnable {
override def run(): Unit = {
- val distinctPartitions = requests.synchronized {
- // For each partition only need handle one request
- requests.asScala.filter { case (partitionId, _) =>
-
!inBatchPartitions.get(shuffleId).contains(partitionId)
- }.map { case (partitionId, request) =>
- inBatchPartitions.get(shuffleId).add(partitionId)
- request.asScala.toArray.maxBy(_.epoch)
- }.toArray
+ val distinctPartitions = {
+ val requestSet = inBatchPartitions.get(shuffleId)
+ val locksForShuffle = locks.computeIfAbsent(shuffleId,
locksRegisterFunc)
+ requests.asScala.map { case (partitionId, request) =>
+ locksForShuffle(partitionId %
locksForShuffle.length).synchronized {
+ if (!requestSet.contains(partitionId)) {
Review Comment:
```suggestion
if (!requestSet.contains(partitionId) && requests.containsKey(partitionId)) {
```
Adding this check can remove the getLatestPartition method and guarantee
requests with new epochs are handled.
--
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]