RexXiong commented on code in PR #2373:
URL: https://github.com/apache/celeborn/pull/2373#discussion_r1912616209


##########
assets/spark-patch/Celeborn-Optimize-Skew-Partitions-spark3_2.patch:
##########
@@ -0,0 +1,257 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+diff --git a/core/src/main/scala/org/apache/spark/MapOutputTracker.scala 
b/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
+index e469c9989f2..245d9b3b9de 100644
+--- a/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
++++ b/core/src/main/scala/org/apache/spark/MapOutputTracker.scala
+@@ -661,6 +661,8 @@ private[spark] class MapOutputTrackerMaster(
+     pool
+   }
+ 
++  val skewShuffleIds = ConcurrentHashMap.newKeySet[Int]()
++
+   // Make sure that we aren't going to exceed the max RPC message size by 
making sure
+   // we use broadcast to send large map output statuses.
+   if (minSizeForBroadcast > maxRpcMessageSize) {
+@@ -839,6 +841,7 @@ private[spark] class MapOutputTrackerMaster(
+         shuffleStatus.invalidateSerializedMergeOutputStatusCache()
+       }
+     }
++    skewShuffleIds.remove(shuffleId)
+   }
+ 
+   /**
+diff --git a/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala 
b/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
+index b950c07f3d8..d081b4642c9 100644
+--- a/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
++++ b/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
+@@ -1369,7 +1369,10 @@ private[spark] class DAGScheduler(
+     // The operation here can make sure for the partially completed 
intermediate stage,
+     // `findMissingPartitions()` returns all partitions every time.
+     stage match {
+-      case sms: ShuffleMapStage if stage.isIndeterminate && !sms.isAvailable 
=>
++      case sms: ShuffleMapStage if (stage.isIndeterminate && 
!sms.isAvailable) ||
++        mapOutputTracker.skewShuffleIds.contains(sms.shuffleDep.shuffleId) =>
++        logInfo(s"Unregistering shuffle output for stage ${stage.id}" +
++          s" shuffle ${sms.shuffleDep.shuffleId}")
+         
mapOutputTracker.unregisterAllMapAndMergeOutput(sms.shuffleDep.shuffleId)
+         sms.shuffleDep.newShuffleMergeState()
+       case _ =>
+@@ -1780,7 +1783,7 @@ private[spark] class DAGScheduler(
+           failedStage.failedAttemptIds.add(task.stageAttemptId)
+           val shouldAbortStage =
+             failedStage.failedAttemptIds.size >= maxConsecutiveStageAttempts 
||
+-            disallowStageRetryForTest
++            disallowStageRetryForTest || 
mapOutputTracker.skewShuffleIds.contains(shuffleId)

Review Comment:
   This pr will support skew read stage abort, stage rerun would be supported 
in next prs.



-- 
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: issues-unsubscr...@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to