venkata91 commented on code in PR #58437:
URL: https://github.com/apache/spark/pull/58437#discussion_r4527500322
##########
core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala:
##########
@@ -4940,27 +4979,49 @@ private[spark] class DAGScheduler(
clearCacheLocs()
}
if (fileLost) {
- // When the fetch failure is for a merged shuffle chunk,
ignoreShuffleFileLostEpoch is true
- // and so all the files will be removed.
- val remove = if (ignoreShuffleFileLostEpoch) {
- true
- } else if (!shuffleFileLostEpoch.contains(execId) ||
- shuffleFileLostEpoch(execId) < currentEpoch) {
- shuffleFileLostEpoch(execId) = currentEpoch
- true
- } else {
- false
+ // A FetchFailed for a reliable shuffle may pass a rejecting executor
fence once per epoch:
+ // executor loss kept that shuffle, so it must still be cleaned when
proven gone.
Review Comment:
updated. it now says the fence can come from executor loss or another
shuffle's FetchFailed.
##########
core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala:
##########
@@ -4832,23 +4853,30 @@ private[spark] class DAGScheduler(
* Responds to an executor being lost. This is called inside the event loop,
so it assumes it can
* modify the scheduler's internal state. Use executorLost() to post a loss
event from outside.
*
- * We will also assume that we've lost all shuffle blocks associated with
the executor if the
- * executor serves its own blocks (i.e., we're not using an external shuffle
service), or the
- * entire Standalone worker is lost.
+ * We will also assume that we've lost all non-reliably-stored shuffle
blocks associated with the
+ * executor if the executor serves its own blocks (i.e., we're not using an
external shuffle
+ * service), or the entire Standalone worker is lost.
*/
private[scheduler] def handleExecutorLost(
execId: String,
workerHost: Option[String]): Unit = {
// if the cluster manager explicitly tells us that the entire worker was
lost, then
// we know to unregister shuffle output. (Note that "worker" specifically
refers to the process
// from a Standalone cluster, where the shuffle service lives in the
Worker.)
- val fileLost = !sc.shuffleDriverComponents.supportsReliableStorage() &&
+ // Skip it if nothing is removable: the global flag is on, every
registered shuffle is reliably
+ // stored, and no host was lost under push-based shuffle (its merge
results must go).
+ // TODO: that host pass still bumps the epoch when the host held nothing.
+ val nothingRemovable =
sc.shuffleDriverComponents.supportsReliableStorage() &&
+ !mapOutputTracker.hasUnreliablyStoredShuffle &&
Review Comment:
done. the cheap checks go first, so we only walk the registry when it
decides the outcome. added a test with the service on that asserts
`hasUnreliablyStoredShuffle` is never called and the epoch does not move. the
other two cases were already covered by the per-shuffle override test and the
`pushBased=true` worker-host loss test.
##########
core/src/main/scala/org/apache/spark/shuffle/ShuffleHandle.scala:
##########
@@ -25,4 +27,14 @@ import org.apache.spark.annotation.DeveloperApi
* @param shuffleId ID of the shuffle
*/
@DeveloperApi
-abstract class ShuffleHandle(val shuffleId: Int) extends Serializable {}
+abstract class ShuffleHandle(val shuffleId: Int) extends Serializable {
+ /**
+ * Whether this shuffle's output survives losing the executor or host that
wrote it (e.g. on a
+ * remote shuffle service). If so, executor or worker loss keeps its map
output registered.
+ *
+ * Overrides `ShuffleDriverComponents.supportsReliableStorage()` for this
shuffle. Empty (the
+ * default) falls back to that flag, so with the flag on, worker removal and
a map-output
+ * FetchFailed keep other shuffles' map output. A pipelined shuffle must
leave it empty.
Review Comment:
restored the earlier wording and added when it's read: once on the driver at
registration, then everything uses the recorded value.
##########
core/src/main/scala/org/apache/spark/shuffle/ShuffleHandle.scala:
##########
@@ -25,4 +27,14 @@ import org.apache.spark.annotation.DeveloperApi
* @param shuffleId ID of the shuffle
*/
@DeveloperApi
-abstract class ShuffleHandle(val shuffleId: Int) extends Serializable {}
+abstract class ShuffleHandle(val shuffleId: Int) extends Serializable {
+ /**
+ * Whether this shuffle's output survives losing the executor or host that
wrote it (e.g. on a
+ * remote shuffle service). If so, executor or worker loss keeps its map
output registered.
+ *
+ * Overrides `ShuffleDriverComponents.supportsReliableStorage()` for this
shuffle. Empty (the
Review Comment:
added a sentence naming `executorHoldSupported` and the EAM argument, plus a
TODO. the follow-ups update that note as they land.
##########
core/src/main/scala/org/apache/spark/MapOutputTracker.scala:
##########
@@ -1045,19 +1103,73 @@ private[spark] class MapOutputTrackerMaster(
* Removes all shuffle outputs associated with this host. Note that this
will also remove
* outputs which are served by an external shuffle server (if one exists).
*/
- def removeOutputsOnHost(host: String): Unit = {
- shuffleStatuses.valuesIterator.foreach { _.removeOutputsOnHost(host) }
- incrementEpoch()
- }
+ def removeOutputsOnHost(host: String): Unit =
+ removeOutputsOnHost(host, respectReliablyStored = false)
/**
* Removes all shuffle outputs associated with this executor. Note that this
will also remove
* outputs which are served by an external shuffle server (if one exists),
as they are still
* registered with this execId.
*/
- def removeOutputsOnExecutor(execId: String): Unit = {
- shuffleStatuses.valuesIterator.foreach { _.removeOutputsOnExecutor(execId)
}
- incrementEpoch()
+ def removeOutputsOnExecutor(execId: String): Unit =
+ removeOutputsOnExecutor(execId, respectReliablyStored = false)
+
+ /** Like `removeOutputsOnHost(host)`, but keeps reliably-stored map output
if asked. */
+ def removeOutputsOnHost(host: String, respectReliablyStored: Boolean):
CleanupOutcome =
+ removeOutputsOnHost(host, respectReliablyStored, None)
+
+ /** See `removeSelectively` for `failedShuffleId` and
`restrictToFailedShuffle`. */
+ def removeOutputsOnHost(
+ host: String,
+ respectReliablyStored: Boolean,
+ failedShuffleId: Option[Int],
+ restrictToFailedShuffle: Boolean = false): CleanupOutcome = {
+ val outcome = removeSelectively(
+ respectReliablyStored, failedShuffleId, restrictToFailedShuffle)(
+ (status, respect) => status.removeOutputsOnHost(host, respect))
+ if (outcome.shouldBumpEpoch) incrementEpoch()
+ outcome
+ }
+
+ /** Like `removeOutputsOnExecutor(execId)`, but keeps reliably-stored map
output if asked. */
+ def removeOutputsOnExecutor(execId: String, respectReliablyStored: Boolean):
CleanupOutcome =
+ removeOutputsOnExecutor(execId, respectReliablyStored, None)
+
+ /** See `removeSelectively` for `failedShuffleId` and
`restrictToFailedShuffle`. */
+ def removeOutputsOnExecutor(
+ execId: String,
+ respectReliablyStored: Boolean,
+ failedShuffleId: Option[Int],
+ restrictToFailedShuffle: Boolean = false): CleanupOutcome = {
+ val outcome = removeSelectively(
+ respectReliablyStored, failedShuffleId, restrictToFailedShuffle)(
+ (status, respect) => status.removeOutputsOnExecutor(execId, respect))
+ if (outcome.shouldBumpEpoch) incrementEpoch()
+ outcome
+ }
+
+ /**
+ * Applies `remove` to each shuffle and aggregates the results; the caller
bumps the epoch.
+ * `failedShuffleId` is cleaned even if reliable; `restrictToFailedShuffle`
touches only it.
+ */
+ private def removeSelectively(
+ respectReliablyStored: Boolean,
+ failedShuffleId: Option[Int],
+ restrictToFailedShuffle: Boolean = false)(
+ remove: (ShuffleStatus, Boolean) => ShuffleRemovalResult):
CleanupOutcome = {
+ require(!restrictToFailedShuffle || failedShuffleId.isDefined,
+ "restrictToFailedShuffle requires a failedShuffleId to restrict to")
+ var metadataChanged = false
+ var preservedReliable = false
+ shuffleStatuses.foreach { case (shuffleId, status) =>
Review Comment:
done, the restricted path looks up the failed shuffle directly. added a case
for a shuffle that's gone: nothing removed, epoch still advances.
##########
core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala:
##########
@@ -4267,7 +4272,8 @@ private[spark] class DAGScheduler(
fileLost: Boolean,
hostToUnregisterOutputs: Option[String],
maybeEpoch: Option[Long] = None,
- ignoreShuffleFileLostEpoch: Boolean = false): Unit = {
+ ignoreShuffleFileLostEpoch: Boolean = false,
+ respectReliablyStored: Boolean = false): Unit = {
Review Comment:
restored.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]