venkata91 commented on code in PR #58437:
URL: https://github.com/apache/spark/pull/58437#discussion_r4518448747
##########
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala:
##########
@@ -1116,11 +1130,347 @@ class DAGSchedulerSuite extends SparkFunSuite with
TempLocalSparkContext with Ti
completeShuffleMapStageSuccessfully(0, 0, 1)
runEvent(ExecutorLost("hostA-exec", event))
verify(blockManagerMaster, times(1)).removeExecutorAsync("hostA-exec")
- verify(mapOutputTracker, times(0)).removeOutputsOnExecutor("hostA-exec")
+ verify(mapOutputTracker, times(0)).removeOutputsOnExecutor("hostA-exec",
true)
assert(mapOutputTracker.getMapSizesByExecutorId(shuffleId,
0).map(_._1).toSet ===
HashSet(makeBlockManagerId("hostA"), makeBlockManagerId("hostB")))
}
+ /**
+ * Submit a job over a single reliably-stored shuffle (service off) and
complete its map stage,
+ * returning the job id and shuffle dependency. Shared by the fence/bypass
tests that start alike.
+ */
+ private def submitReliableShuffleJob(
+ numMaps: Int,
+ numReduces: Int,
+ hostNames: Seq[String] = Nil): (Int, ReliablyStoredShuffleDependency) = {
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+ val shuffleMapRdd = new MyRDD(sc, numMaps, Nil)
+ val shuffleDep =
+ new ReliablyStoredShuffleDependency(shuffleMapRdd, new
HashPartitioner(numReduces))
+ val reduceRdd = new MyRDD(sc, numReduces, List(shuffleDep), tracker =
mapOutputTracker)
+ val jobId = submit(reduceRdd, (0 until numReduces).toArray)
+ val stageId = scheduler.shuffleIdToMapStage(shuffleDep.shuffleId).id
+ completeShuffleMapStageSuccessfully(stageId, 0, numReduces, hostNames =
hostNames)
+ (jobId, shuffleDep)
+ }
+
+ test("SPARK-59138: executor loss keeps a reliably-stored shuffle but drops a
local-disk one") {
+ // No external shuffle service, so a plain (local-disk) shuffle's outputs
are lost on executor
+ // loss, but a per-shuffle reliably-stored one survives.
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+
+ val reliableRdd = new MyRDD(sc, 2, Nil)
+ val reliableDep = new ReliablyStoredShuffleDependency(reliableRdd, new
HashPartitioner(1))
+ val localRdd = new MyRDD(sc, 2, Nil)
+ val localDep = new ShuffleDependency(localRdd, new HashPartitioner(1))
+ val reduceRdd = new MyRDD(sc, 1, List(reliableDep, localDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0))
+
+ // Two independent map stages, one per shuffle; complete both on hostA /
hostB.
+ completeShuffleMapStageSuccessfully(0, 0, 1)
+ completeShuffleMapStageSuccessfully(1, 0, 1)
+
+ runEvent(ExecutorLost("hostA-exec", ExecutorKilled))
+ verify(mapOutputTracker, times(1)).removeOutputsOnExecutor("hostA-exec",
true)
+
+ // Reliable shuffle keeps hostA's output; local-disk shuffle loses it.
+ assert(mapOutputTracker.getMapSizesByExecutorId(reliableDep.shuffleId,
0).map(_._1).toSet ===
+ HashSet(makeBlockManagerId("hostA"), makeBlockManagerId("hostB")))
+ intercept[MetadataFetchFailedException] {
+ mapOutputTracker.getMapSizesByExecutorId(localDep.shuffleId, 0)
+ }
+ }
+
+ test("SPARK-59138: per-shuffle reliablyStored=false overrides a global
supportsReliableStorage") {
+ // Global flag true, but one shuffle reports Some(false); the per-shuffle
value must win.
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+ conf.set(config.SHUFFLE_IO_PLUGIN_CLASS.key,
+ classOf[TestShuffleDataIOWithMockedComponents].getName)
+ when(sc.shuffleDriverComponents.supportsReliableStorage()).thenReturn(true)
+
+ val reliableRdd = new MyRDD(sc, 2, Nil)
+ val reliableDep = new ReliablyStoredShuffleDependency(reliableRdd, new
HashPartitioner(1))
+ val fallbackRdd = new MyRDD(sc, 2, Nil)
+ val fallbackDep =
+ new ReliablyStoredShuffleDependency(fallbackRdd, new HashPartitioner(1),
Some(false))
+ val reduceRdd = new MyRDD(sc, 1, List(reliableDep, fallbackDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0))
+
+ completeShuffleMapStageSuccessfully(0, 0, 1)
+ completeShuffleMapStageSuccessfully(1, 0, 1)
+
+ runEvent(ExecutorLost("hostA-exec", ExecutorKilled))
+
+ // Some(true) keeps hostA's output despite the global flag; Some(false)
loses it despite it.
+ assert(mapOutputTracker.getMapSizesByExecutorId(reliableDep.shuffleId,
0).map(_._1).toSet ===
+ HashSet(makeBlockManagerId("hostA"), makeBlockManagerId("hostB")))
+ intercept[MetadataFetchFailedException] {
+ mapOutputTracker.getMapSizesByExecutorId(fallbackDep.shuffleId, 0)
+ }
+ }
+
+ test("SPARK-59138: a duplicate same-epoch FetchFailed for a reliable shuffle
is fenced by the " +
+ "per-shuffle bypass") {
+ // Executor loss preserves the reliable shuffle but stamps the executor
fence. The first
+ // same-epoch reliable FetchFailed takes the per-shuffle bypass, cleans
the failed shuffle, and
+ // records its reliableShuffleFileLostEpoch entry. A duplicate at the same
epoch must be fenced
+ // by that entry, or repeated failures would re-clean and sweep freshly
recomputed output.
+ val shuffleDep = submitReliableShuffleJob(numMaps = 2, numReduces = 2)._2
+ val shuffleId = shuffleDep.shuffleId
+
+ // Executor loss preserves the reliable shuffle and stamps the executor
fence.
+ runEvent(ExecutorLost("hostA-exec", ExecutorKilled))
+
+ // First same-epoch reliable FetchFailed: fence rejects it, per-shuffle
bypass cleans.
+ runEvent(makeCompletionEvent(taskSets(1).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), shuffleId, 0L, 0, 0,
"ignored"), null))
+
+ // Duplicate at the same epoch: fenced by the per-shuffle entry, no
re-clean.
+ runEvent(makeCompletionEvent(taskSets(1).tasks(1),
+ FetchFailed(makeBlockManagerId("hostA"), shuffleId, 0L, 0, 1,
"ignored"), null))
+
+ verify(mapOutputTracker, times(1))
+ .removeOutputsOnExecutor("hostA-exec", true, Some(shuffleId), true)
+ }
+
+ test("SPARK-59138: map-output FetchFailed clears the failed shuffle's
co-located maps in one " +
+ "pass while an unrelated reliable shuffle on the same executor survives") {
+ // A FetchFailed against a reliably-stored map output is evidence that
shuffle's output on the
+ // host is actually gone, so the failed shuffle is exempted from reliable
preservation and all
+ // its maps on hostA clear together. A different reliable shuffle on hostA
has no such evidence
+ // and stays registered.
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+
+ val failedRdd = new MyRDD(sc, 2, Nil)
+ val failedDep = new ReliablyStoredShuffleDependency(failedRdd, new
HashPartitioner(1))
+ val otherRdd = new MyRDD(sc, 1, Nil)
+ val otherDep = new ReliablyStoredShuffleDependency(otherRdd, new
HashPartitioner(1))
+ val reduceRdd = new MyRDD(sc, 1, List(failedDep, otherDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0))
+
+ // Both shuffles' maps land on hostA; the failed shuffle's two maps must
clear, the other's not.
+ completeShuffleMapStageSuccessfully(0, 0, 1, hostNames = Seq("hostA",
"hostA"))
+ completeShuffleMapStageSuccessfully(1, 0, 1, hostNames = Seq("hostA",
"hostA"))
+
+ complete(taskSets(2), Seq(
+ (FetchFailed(makeBlockManagerId("hostA"), failedDep.shuffleId, 0L, 0, 0,
"ignored"), null)))
+
+ // The failed shuffle loses both hostA maps in one pass (it is exempted
from preservation).
+ // getNumAvailableOutputs proves both are gone: the old per-map behavior
would leave one.
+ assert(mapOutputTracker.getNumAvailableOutputs(failedDep.shuffleId) === 0)
+ intercept[MetadataFetchFailedException] {
+ mapOutputTracker.getMapSizesByExecutorId(failedDep.shuffleId, 0)
+ }
+ // The unrelated reliable shuffle keeps hostA's output.
+ assert(mapOutputTracker.getMapSizesByExecutorId(otherDep.shuffleId,
0).map(_._1).toSet ===
+ HashSet(makeBlockManagerId("hostA")))
+ }
+
+ test("SPARK-59138: a delayed same-epoch FetchFailed is fenced after a local
shuffle's retry " +
+ "re-registers output") {
+ // After a local shuffle's retry re-registers map 0, a delayed same-epoch
FetchFailed for the
+ // still-missing map 1 must be fenced by the executor fence, or it
bulk-deletes the recomputed
+ // map 0.
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+
+ val localRdd = new MyRDD(sc, 2, Nil)
+ val localDep = new ShuffleDependency(localRdd, new HashPartitioner(2))
+ val localShuffleId = localDep.shuffleId
+ val reduceRdd = new MyRDD(sc, 2, List(localDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0, 1))
+
+ val localStageId = scheduler.shuffleIdToMapStage(localShuffleId).id
+ completeShuffleMapStageSuccessfully(localStageId, 0, 2, hostNames =
Seq("hostA", "hostA"))
+
+ // First FetchFailed for L clears both hostA maps and stamps the executor
fence; L resubmits.
+ runEvent(makeCompletionEvent(taskSets(0).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), localShuffleId, 0L, 0, 0,
"ignored"), null))
+ assert(mapOutputTracker.getNumAvailableOutputs(localShuffleId) === 0)
+ scheduler.resubmitFailedStages()
+
+ // Retry re-registers L's map 0 on the still-live hostA; map 1 stays
pending.
+ val retry = taskSets.last
+ assert(retry.stageId === localStageId)
+ runEvent(makeCompletionEvent(retry.tasks(0), Success,
+ makeMapStatus("hostA", reduceRdd.partitions.length)))
+ assert(mapOutputTracker.getNumAvailableOutputs(localShuffleId) === 1)
+
+ // Delayed same-epoch duplicate FetchFailed for L's still-missing map 1
must be fenced: no
+ // second cleanup, and map 0 survives.
+ runEvent(makeCompletionEvent(taskSets(0).tasks(1),
+ FetchFailed(makeBlockManagerId("hostA"), localShuffleId, 1L, 1, 1,
"ignored"), null))
+
+ verify(mapOutputTracker, times(1))
+ .removeOutputsOnExecutor("hostA-exec", true, Some(localShuffleId), false)
+ assert(mapOutputTracker.getNumAvailableOutputs(localShuffleId) === 1)
+ }
+
+ test("SPARK-59138: a reliable-shuffle FetchFailed bypass cleans only the
failed shuffle, " +
+ "leaving a co-located shuffle's recomputed output intact") {
+ // A delayed original FetchFailed for reliable R bypasses the executor
fence but must stay
+ // restricted to R: it clears R's maps while a co-located local shuffle's
recomputed output
+ // lives.
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+
+ val reliableRdd = new MyRDD(sc, 2, Nil)
+ val reliableDep = new ReliablyStoredShuffleDependency(reliableRdd, new
HashPartitioner(2))
+ val localRdd = new MyRDD(sc, 2, Nil)
+ val localDep = new ShuffleDependency(localRdd, new HashPartitioner(2))
+ val reduceRdd = new MyRDD(sc, 2, List(reliableDep, localDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0, 1))
+
+ val reliableStageId =
scheduler.shuffleIdToMapStage(reliableDep.shuffleId).id
+ val localStageId = scheduler.shuffleIdToMapStage(localDep.shuffleId).id
+ completeShuffleMapStageSuccessfully(reliableStageId, 0, 2, hostNames =
Seq("hostA", "hostA"))
+ completeShuffleMapStageSuccessfully(localStageId, 0, 2, hostNames =
Seq("hostA", "hostA"))
+ assert(mapOutputTracker.getNumAvailableOutputs(reliableDep.shuffleId) ===
2)
+
+ // FetchFailed for L's map 0 clears both its hostA maps and stamps the
executor fence; L's map
+ // stage resubmits both maps.
+ runEvent(makeCompletionEvent(taskSets(2).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), localDep.shuffleId, 0L, 0, 0,
"ignored"), null))
+ assert(mapOutputTracker.getNumAvailableOutputs(localDep.shuffleId) === 0)
+ scheduler.resubmitFailedStages()
+
+ // A real retry task re-registers L's map 0 on the still-live hostA; map 1
stays pending, so the
+ // map stage is incomplete and the reducer attempt has not restarted.
+ val retry = taskSets.last
+ assert(retry.stageId === localStageId)
+ runEvent(makeCompletionEvent(retry.tasks(0), Success,
+ makeMapStatus("hostA", reduceRdd.partitions.length)))
+ assert(mapOutputTracker.getNumAvailableOutputs(localDep.shuffleId) === 1)
+
+ // Delayed original-attempt FetchFailed for R bypasses the executor fence,
restricted to R.
+ taskSets(2).tasks(1).epoch = 0
+ runEvent(makeCompletionEvent(taskSets(2).tasks(1),
+ FetchFailed(makeBlockManagerId("hostA"), reliableDep.shuffleId, 0L, 0,
1, "ignored"), null))
+
+ // Both R maps on hostA are cleared; L's recomputed map survives.
+ assert(mapOutputTracker.getNumAvailableOutputs(reliableDep.shuffleId) ===
0)
+ assert(mapOutputTracker.getNumAvailableOutputs(localDep.shuffleId) === 1)
+ }
+
+ test("SPARK-59138: an older reliable-shuffle FetchFailed bypass does not
lower the executor " +
+ "fence, so a later same-epoch duplicate stays fenced") {
+ // A genuine executor-wide cleanup for local L stamps the executor fence
at a high epoch E2. A
+ // later but older (epoch E1 < E2) reliable-shuffle FetchFailed bypasses
the fence, yet must not
+ // move it backward to E1. Otherwise a duplicate L failure at E2 would
pass the bulk gate again.
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+
+ val reliableRdd = new MyRDD(sc, 2, Nil)
+ val reliableDep = new ReliablyStoredShuffleDependency(reliableRdd, new
HashPartitioner(2))
+ val localRdd = new MyRDD(sc, 2, Nil)
+ val localDep = new ShuffleDependency(localRdd, new HashPartitioner(2))
+ val localShuffleId = localDep.shuffleId
+ val reduceRdd = new MyRDD(sc, 2, List(reliableDep, localDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0, 1))
+
+ completeShuffleMapStageSuccessfully(0, 0, 2)
+ completeShuffleMapStageSuccessfully(1, 0, 2)
+
+ // Genuine executor-wide failure for L at epoch E2 stamps the fence at E2.
+ taskSets(2).tasks(0).epoch = 100
+ runEvent(makeCompletionEvent(taskSets(2).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), localShuffleId, 0L, 0, 0,
"ignored"), null))
+
+ // Older reliable failure for R at epoch E1 < E2 bypasses the fence but
must not lower it.
+ taskSets(2).tasks(1).epoch = 50
+ runEvent(makeCompletionEvent(taskSets(2).tasks(1),
+ FetchFailed(makeBlockManagerId("hostA"), reliableDep.shuffleId, 0L, 0,
1, "ignored"), null))
+
+ // Duplicate L failure at E2: the fence is still E2, so it stays fenced
(no second cleanup).
+ taskSets(2).tasks(0).epoch = 100
+ runEvent(makeCompletionEvent(taskSets(2).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), localShuffleId, 0L, 0, 0,
"ignored"), null))
+
+ verify(mapOutputTracker, times(1))
+ .removeOutputsOnExecutor("hostA-exec", true, Some(localShuffleId), false)
+ verify(mapOutputTracker, times(1))
+ .removeOutputsOnExecutor("hostA-exec", true,
Some(reliableDep.shuffleId), true)
+ }
+
+ test("SPARK-59138: reliable-loss fence entries are retired when their
shuffle is cleaned up") {
+ // A reliable FetchFailed records a (executor, shuffleId) fence entry.
These must be bounded by
+ // live shuffles: cleaning up the shuffle's map stage must drop its
entries, otherwise replaced
+ // executors (new ids) leave them to accumulate for the life of the
application.
+ val (jobId, reliableDep) =
+ submitReliableShuffleJob(numMaps = 2, numReduces = 2, hostNames =
Seq("hostA", "hostA"))
+
+ // Reliable FetchFailed bypasses the executor fence and records a
per-shuffle fence entry.
+ runEvent(makeCompletionEvent(taskSets(1).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), reliableDep.shuffleId, 0L, 0,
0, "ignored"), null))
+ assert(scheduler.reliableShuffleFileLostEpochSize === 1)
+
+ // Cancelling the job tears down its stages; the shuffle's fence entries
must be retired.
+ cancel(jobId)
+ assert(scheduler.reliableShuffleFileLostEpochSize === 0)
+ }
+
+ for (reliable <- Seq(true, false)) {
+ test(s"SPARK-59138: a FetchFailed that aborts the job leaves no fence
entry " +
+ s"(reliable=$reliable)") {
+ // The abort tears the map stage down (retiring its fences) before the
FetchFailed handler
+ // unregisters outputs, so the handler must not re-create a fence for
the retired shuffle.
+ conf.set(config.STAGE_MAX_CONSECUTIVE_ATTEMPTS, 1)
+ conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "false")
+ val shuffleMapRdd = new MyRDD(sc, 2, Nil)
+ val partitioner = new HashPartitioner(2)
+ val shuffleDep = if (reliable) {
+ new ReliablyStoredShuffleDependency(shuffleMapRdd, partitioner)
+ } else {
+ new ShuffleDependency(shuffleMapRdd, partitioner)
+ }
+ val reduceRdd = new MyRDD(sc, 2, List(shuffleDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0, 1))
+ completeShuffleMapStageSuccessfully(0, 0, 2)
+
+ runEvent(makeCompletionEvent(taskSets(1).tasks(0),
+ FetchFailed(makeBlockManagerId("hostA"), shuffleDep.shuffleId, 0L, 0,
0, "ignored"),
+ null))
+
+ assert(failure != null && failure.getMessage.contains("maximum
allowable"))
+ assert(!scheduler.shuffleIdToMapStage.contains(shuffleDep.shuffleId))
+ assert(scheduler.reliableShuffleFileLostEpochSize === 0)
+ }
+ }
+
+ test("SPARK-59138: a merged-chunk FetchFailed for a reliable shuffle keeps
its reliable map " +
+ "output") {
+ // A merged-chunk failure (mapIndex == -1) says nothing about the reliable
original map output,
+ // so it must not take the reliable bypass (failedShuffleId stays None).
The stale merge result
+ // is dropped, but the reliable map output survives as valid fallback.
+ initPushBasedShuffleConfs(conf)
+ DAGSchedulerSuite.clearMergerLocs()
+ DAGSchedulerSuite.addMergerLocs(Seq("host1", "host2", "host3", "host4",
"host5"))
+ scheduler = new MyDAGScheduler(
+ sc, taskScheduler, sc.listenerBus, mapOutputTracker, blockManagerMaster,
sc.env,
+ shuffleMergeFinalize = false, shuffleMergeRegister = false)
+ dagEventProcessLoopTester = new
DAGSchedulerEventProcessLoopTester(scheduler)
+
+ val shuffleMapRdd = new MyRDD(sc, 2, Nil)
+ val shuffleDep = new ReliablyStoredShuffleDependency(shuffleMapRdd, new
HashPartitioner(2))
+ val shuffleId = shuffleDep.shuffleId
+ val reduceRdd = new MyRDD(sc, 2, List(shuffleDep), tracker =
mapOutputTracker)
+ submit(reduceRdd, Array(0, 1))
+
+ completeShuffleMapStageSuccessfully(0, 0, 2)
+ val shuffleMapStage =
scheduler.stageIdToStage(0).asInstanceOf[ShuffleMapStage]
+ scheduler.handleRegisterMergeStatuses(shuffleMapStage,
+ Seq((0, makeMergeStatus("hostA", shuffleDep.shuffleMergeId,
isShufflePushMerger = true))))
+ scheduler.handleShuffleMergeFinalized(shuffleMapStage,
shuffleDep.shuffleMergeId)
+ assert(mapOutputTracker.getNumAvailableMergeResults(shuffleId) == 1)
+ assert(mapOutputTracker.getNumAvailableOutputs(shuffleId) === 2)
+
+ // Merged-chunk FetchFailed (mapIndex == -1) against the merger id: drops
the merge result but
+ // the reliable map output is preserved (no reliable bypass on a
merged-chunk failure).
+ val mergerId = Some(BlockManagerId.SHUFFLE_MERGER_IDENTIFIER)
+ runEvent(makeCompletionEvent(taskSets(1).tasks(0),
Review Comment:
Fixed in 6012875: the test now sets `unRegisterOutputOnHost=true`, so it
fails if the merged-chunk path passes the shuffle id.
##########
core/src/test/scala/org/apache/spark/MapOutputTrackerSuite.scala:
##########
@@ -136,6 +136,172 @@ class MapOutputTrackerSuite extends SparkFunSuite with
LocalSparkContext {
rpcEnv.shutdown()
}
+ test("SPARK-59138: executor loss skips reliably-stored shuffles but not
local-disk ones") {
+ val rpcEnv = createRpcEnv("test")
+ val tracker = newTrackerMaster()
+ tracker.trackerEndpoint =
rpcEnv.setupEndpoint(MapOutputTracker.ENDPOINT_NAME,
+ new MapOutputTrackerMasterEndpoint(rpcEnv, tracker, conf))
+
+ val size = MapStatus.compressSize(1000L)
+ // Shuffle 0: local-disk (not reliably stored). Shuffle 1: reliably stored
off-executor.
+ tracker.registerShuffle(0, 1, MergeStatus.SHUFFLE_PUSH_DUMMY_NUM_REDUCES)
+ tracker.registerShuffle(1, 1, MergeStatus.SHUFFLE_PUSH_DUMMY_NUM_REDUCES,
+ isReliablyStored = true)
+ tracker.registerMapOutput(0, 0, MapStatus(BlockManagerId("a", "hostA",
1000), Array(size), 5))
+ tracker.registerMapOutput(1, 0, MapStatus(BlockManagerId("a", "hostA",
1000), Array(size), 6))
+
+ assert(tracker.isReliablyStored(0) === false)
+ assert(tracker.isReliablyStored(1) === true)
+
+ // Executor loss: skip reliably-stored shuffles. Shuffle 0 drops, shuffle
1 stays.
+ tracker.removeOutputsOnExecutor("a", respectReliablyStored = true)
+ assert(tracker.getNumAvailableOutputs(0) === 0)
+ assert(tracker.getNumAvailableOutputs(1) === 1)
+
+ // Losing an executor when only reliably-stored shuffles remain removes
nothing, so the
+ // epoch must not bump (a bump would needlessly invalidate every
executor's cached statuses).
+ tracker.unregisterShuffle(0)
+ val epochBeforeNoOp = tracker.getEpoch
+ tracker.removeOutputsOnExecutor("a", respectReliablyStored = true)
+ assert(tracker.getEpoch === epochBeforeNoOp)
+
+ // Fetch failure (skip = false): even the reliably-stored shuffle's output
is removed, and
+ // because something was removed the epoch bumps.
+ val epochBeforeRemoval = tracker.getEpoch
+ tracker.removeOutputsOnExecutor("a", respectReliablyStored = false)
+ assert(tracker.getNumAvailableOutputs(1) === 0)
+ assert(tracker.getEpoch > epochBeforeRemoval)
+
+ tracker.stop()
+ rpcEnv.shutdown()
+ }
+
+ test("SPARK-59138: hasUnreliablyStoredShuffle reflects active shuffle
reliability") {
+ val rpcEnv = createRpcEnv("test")
+ val tracker = newTrackerMaster()
+ tracker.trackerEndpoint =
rpcEnv.setupEndpoint(MapOutputTracker.ENDPOINT_NAME,
+ new MapOutputTrackerMasterEndpoint(rpcEnv, tracker, conf))
+
+ assert(!tracker.hasUnreliablyStoredShuffle)
+ tracker.registerShuffle(0, 1, MergeStatus.SHUFFLE_PUSH_DUMMY_NUM_REDUCES,
+ isReliablyStored = true)
+ assert(!tracker.hasUnreliablyStoredShuffle)
+ tracker.registerShuffle(1, 1, MergeStatus.SHUFFLE_PUSH_DUMMY_NUM_REDUCES)
+ assert(tracker.hasUnreliablyStoredShuffle)
+ tracker.unregisterShuffle(1)
+ assert(!tracker.hasUnreliablyStoredShuffle)
+
+ tracker.stop()
+ rpcEnv.shutdown()
+ }
+
+ test("SPARK-59138: host loss drops merge results but keeps reliably-stored
map output") {
+ val pushConf = new SparkConf()
+ pushConf.set(PUSH_BASED_SHUFFLE_ENABLED, true)
+ pushConf.set(IS_TESTING, true)
+ pushConf.set(SERIALIZER, "org.apache.spark.serializer.KryoSerializer")
+ val rpcEnv = createRpcEnv("test")
+ val tracker = newTrackerMaster(pushConf)
+ tracker.trackerEndpoint =
rpcEnv.setupEndpoint(MapOutputTracker.ENDPOINT_NAME,
+ new MapOutputTrackerMasterEndpoint(rpcEnv, tracker, pushConf))
+
+ val size = MapStatus.compressSize(1000L)
+ // Reliably-stored shuffle whose map output lives off-executor, but which
also has a host-local
+ // push-merge result on the same host. Losing the host must keep the
reliable map output while
+ // still dropping the merge result, whose merged chunks physically lived
on that host.
+ tracker.registerShuffle(0, 1, MergeStatus.SHUFFLE_PUSH_DUMMY_NUM_REDUCES,
+ isReliablyStored = true)
+ tracker.registerMapOutput(0, 0, MapStatus(BlockManagerId("a", "hostA",
1000), Array(size), 5))
+ val bitmap = new RoaringBitmap()
+ bitmap.add(0)
+ tracker.registerMergeResult(0, 0, MergeStatus(BlockManagerId(
+ BlockManagerId.SHUFFLE_MERGER_IDENTIFIER, "hostA", 1000), 0, bitmap,
1000L))
+ assert(tracker.getNumAvailableOutputs(0) === 1)
+ assert(tracker.getNumAvailableMergeResults(0) === 1)
+
+ tracker.removeOutputsOnHost("hostA", respectReliablyStored = true)
Review Comment:
Added the epoch assertion in 6012875.
##########
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala:
##########
@@ -7057,11 +7399,10 @@ class DAGSchedulerSuite extends SparkFunSuite with
TempLocalSparkContext with Ti
test("pipelined shuffle: an all-pipelined group with no regular prefix
classifies identically " +
"under the materialized-prefix relaxation (a previously-valid shape is
unchanged)") {
- // The prefix relaxation (classifyJobShuffleShape) keys purely off
dependency TYPE, so it is
- // open to any PipelinedShuffleDependency. But the materialized-prefix
mixed shape it newly
- // admits is produced only by adaptive execution; an all-pipelined job (no
regular boundary)
- // never hits the relaxed path, so it classifies identically before and
after the relaxation
- // -- the relaxation is a strict superset that leaves every
previously-valid shape unchanged.
+ // The materialized-prefix mixed shape is admitted only by adaptive
execution; an all-pipelined
Review Comment:
Restored "produced" in 6012875.
##########
core/src/main/scala/org/apache/spark/MapOutputTracker.scala:
##########
@@ -1043,21 +1096,66 @@ 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).
+ * outputs which are served by an external shuffle server (if one exists).
Unconditional cleanup:
+ * every shuffle's output on the host is dropped. See the two-argument
overload for the selective
+ * (reliable-storage-preserving) variant.
*/
- def removeOutputsOnHost(host: String): Unit = {
- shuffleStatuses.valuesIterator.foreach { _.removeOutputsOnHost(host) }
- incrementEpoch()
+ def removeOutputsOnHost(host: String): Unit =
+ removeOutputsOnHost(host, respectReliablyStored = false)
+
+ /**
+ * Removes shuffle outputs associated with this host, returning the
aggregate cleanup outcome.
+ *
+ * When `respectReliablyStored` is true (executor/worker loss rather than a
fetch failure),
Review Comment:
Fixed in 6012875: removed the fetch-failure contrast at the executor-loss
call site and in the `respectReliablyStored` doc, and corrected the three test
comments (`respectReliablyStored = false` overload, executor "a", and the
retirement test now says the FetchFailed is a genuine cleanup).
##########
core/src/main/scala/org/apache/spark/shuffle/ShuffleHandle.scala:
##########
@@ -25,4 +25,15 @@ 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 is stored reliably, off the executor that
produced it (e.g. a
+ * remote shuffle service or distributed filesystem). When true, losing the
executor or its host
+ * does not lose the output, so its map outputs are not unregistered on
executor/worker loss.
+ *
+ * Per-shuffle override of the app-global
`ShuffleDriverComponents.supportsReliableStorage()`:
Review Comment:
Thanks. I'll rebase #58687 and #59083 onto this head and aim to land all
three in the same release.
--
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]