AngersZhuuuu commented on code in PR #990:
URL: 
https://github.com/apache/incubator-celeborn/pull/990#discussion_r1034257101


##########
client/src/main/scala/org/apache/celeborn/client/LifecycleManager.scala:
##########
@@ -249,6 +284,111 @@ class LifecycleManager(appId: String, val conf: 
CelebornConf) extends RpcEndpoin
         batchHandleChangePartitionRequestInterval,
         TimeUnit.MILLISECONDS)
     }
+
+    batchHandleCommitPartitionSchedulerThread.foreach {
+      _.scheduleAtFixedRate(
+        new Runnable {
+          override def run(): Unit = {
+            committedPartitionInfo.asScala.foreach { case (shuffleId, 
shuffleCommittedInfo) =>
+              batchHandleCommitPartitionExecutors.submit {
+                new Runnable {
+                  override def run(): Unit = {
+                    if (inProcessStageEndShuffleSet.contains(shuffleId) ||
+                      stageEndShuffleSet.contains(shuffleId)) {
+                      logWarning(s"Shuffle $shuffleId ended or during 
processing stage end.")
+                      shuffleCommittedInfo.synchronized {
+                        shuffleCommittedInfo.commitPartitionRequests.clear()
+                      }
+                    } else {
+                      val currentBatch = shuffleCommittedInfo.synchronized {
+                        val batch = new util.HashSet[CommitPartitionRequest]()
+                        
batch.addAll(shuffleCommittedInfo.commitPartitionRequests)
+                        val currentBatch = batch.asScala.filterNot { request =>
+                          shuffleCommittedInfo.handledCommitPartitionRequests
+                            .contains(request.partition)
+                        }
+                        shuffleCommittedInfo.commitPartitionRequests.clear()
+                        currentBatch.foreach { commitPartitionRequest =>
+                          shuffleCommittedInfo.handledCommitPartitionRequests
+                            .add(commitPartitionRequest.partition)
+                          if (commitPartitionRequest.partition.getPeer != 
null) {
+                            shuffleCommittedInfo.handledCommitPartitionRequests
+                              .add(commitPartitionRequest.partition.getPeer)
+                          }
+                        }
+                        // When running to here, if handleStageEnd got lock 
first and commitFiles,
+                        // then this batch get this lock, 
commitPartitionRequests may contains
+                        // partitions which are already committed by stageEnd 
process.
+                        // But inProcessStageEndShuffleSet should have contain 
this shuffle id,
+                        // can directly return.
+                        if (inProcessStageEndShuffleSet.contains(shuffleId) ||
+                          stageEndShuffleSet.contains(shuffleId)) {
+                          logWarning(s"Shuffle $shuffleId ended or during 
processing stage end.")
+                          Seq.empty
+                        } else {
+                          currentBatch
+                        }

Review Comment:
   @RexXiong How about current?



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