Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cf102cb
LIHADOOP-48527 Driver side changes supporting Pushbased shuffle:
Victsm Aug 6, 2020
81e6a5b
LIHADOOP-53321 Magnet: Merge client shuffle block fetcher related cha…
otterc Nov 18, 2020
e1cc409
LIHADOOP-54115 Unregister map and merge outputs on the host when DAG …
otterc Jun 13, 2020
bfd3a73
LIHADOOP-52494 Magnet fallback to origin shuffle blocks when fetch of…
otterc Nov 18, 2020
2bf9502
Magnet: Serialization of merge status shoud use the reentrant readwri…
otterc Aug 20, 2020
23975c4
Fixed the compilation error in MOT
otterc Nov 20, 2020
f51a806
Prepare for PR
Victsm Nov 23, 2020
9fee2ef
Fix Scala 2.13 compatibility issue
Victsm Nov 24, 2020
10f3079
Fix build issues
Victsm Nov 25, 2020
b37efa4
Fix javadoc issue
Victsm Nov 25, 2020
a188649
Fix more javadoc issue
Victsm Nov 25, 2020
3c5fc12
Address review comments
Victsm Dec 2, 2020
384de48
Address Mridul's review comments
venkata91 Mar 18, 2021
694c8e7
Addressed review comments of ngone51 and mridulm
venkata91 Mar 28, 2021
a10eba1
Merge branch 'upstream-master' into SPARK-32921
venkata91 Apr 2, 2021
cf82f2f
Merge branch 'upstream-master' into SPARK-32921
venkata91 Apr 4, 2021
3c91ed0
fix test
venkata91 Apr 4, 2021
4940b57
Make one rpc for both MapStatus and MergeStatus
venkata91 Apr 6, 2021
cd6a82c
getStatuses master changes
venkata91 Apr 6, 2021
04e0e27
Combine MapStatus and MergeStatus fetch into a single RPC
venkata91 Apr 12, 2021
0e36f80
Added TODO comment wrt AQE improvements
venkata91 Apr 12, 2021
336765f
Address otterc comment
venkata91 Apr 12, 2021
e2ed11a
Merge branch 'upstream-master' into SPARK-32921
venkata91 Apr 12, 2021
351ae53
MapOutputTrackerSuite test
venkata91 Apr 13, 2021
9614a0c
Additional tests to test protocol changes
venkata91 Apr 13, 2021
7dd24bc
Address ngone51 comments
venkata91 Apr 18, 2021
d1422bd
Address other comments
venkata91 Apr 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
670 changes: 570 additions & 100 deletions core/src/main/scala/org/apache/spark/MapOutputTracker.scala

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ private[spark] class DAGScheduler(
// since we can't do it in the RDD constructor because # of partitions is unknown
logInfo(s"Registering RDD ${rdd.id} (${rdd.getCreationSite}) as input to " +
s"shuffle ${shuffleDep.shuffleId}")
mapOutputTracker.registerShuffle(shuffleDep.shuffleId, rdd.partitions.length)
mapOutputTracker.registerShuffle(shuffleDep.shuffleId, rdd.partitions.length,
shuffleDep.partitioner.numPartitions)
}
stage
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ import org.apache.spark.internal.config
import org.apache.spark.storage.BlockManagerId
import org.apache.spark.util.Utils

/**
* A common trait between [[MapStatus]] and [[MergeStatus]]. This allows us to reuse existing
* code to handle MergeStatus inside MapOutputTracker.
*/
private[spark] trait ShuffleOutputStatus

/**
* Result returned by a ShuffleMapTask to a scheduler. Includes the block manager address that the
* task has shuffle files stored on as well as the sizes of outputs for each reducer, for passing
* on to the reduce tasks.
*/
private[spark] sealed trait MapStatus {
private[spark] sealed trait MapStatus extends ShuffleOutputStatus {
/** Location where this task output is. */
def location: BlockManagerId

Expand Down
113 changes: 113 additions & 0 deletions core/src/main/scala/org/apache/spark/scheduler/MergeStatus.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* 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.
*/

package org.apache.spark.scheduler

import java.io.{Externalizable, ObjectInput, ObjectOutput}

import org.roaringbitmap.RoaringBitmap

import org.apache.spark.network.shuffle.protocol.MergeStatuses
import org.apache.spark.storage.BlockManagerId
import org.apache.spark.util.Utils

/**
* The status for the result of merging shuffle partition blocks per individual shuffle partition
* maintained by the scheduler. The scheduler would separate the
* [[org.apache.spark.network.shuffle.protocol.MergeStatuses]] received from
* ExternalShuffleService into individual [[MergeStatus]] which is maintained inside
* MapOutputTracker to be served to the reducers when they start fetching shuffle partition
* blocks. Note that, the reducers are ultimately fetching individual chunks inside a merged
* shuffle file, as explained in [[org.apache.spark.network.shuffle.RemoteBlockPushResolver]].
* Between the scheduler maintained MergeStatus and the shuffle service maintained per shuffle
* partition meta file, we are effectively dividing the metadata for a push-based shuffle into
* 2 layers. The scheduler would track the top-level metadata at the shuffle partition level
* with MergeStatus, and the shuffle service would maintain the partition level metadata about
* how to further divide a merged shuffle partition into multiple chunks with the per-partition
* meta file. This helps to reduce the amount of data the scheduler needs to maintain for
* push-based shuffle.
*/
private[spark] class MergeStatus(
private[this] var loc: BlockManagerId,
private[this] var mapTracker: RoaringBitmap,
private[this] var size: Long)
extends Externalizable with ShuffleOutputStatus {

protected def this() = this(null, null, -1) // For deserialization only

def location: BlockManagerId = loc

def totalSize: Long = size

def tracker: RoaringBitmap = mapTracker

/**
* Get the list of mapper IDs for missing mapper partition blocks that are not merged.
* The reducer will use this information to decide which shuffle partition blocks to
* fetch in the original way.
*/
def getMissingMaps(numMaps: Int): Seq[Int] = {
(0 until numMaps).filter(i => !mapTracker.contains(i))
}

/**
* Get the number of missing map outputs for missing mapper partition blocks that are not merged.
*/
def getNumMissingMapOutputs(numMaps: Int): Int = {
(0 until numMaps).count(i => !mapTracker.contains(i))
}

override def writeExternal(out: ObjectOutput): Unit = Utils.tryOrIOException {
loc.writeExternal(out)
mapTracker.writeExternal(out)
out.writeLong(size)
}

override def readExternal(in: ObjectInput): Unit = Utils.tryOrIOException {
loc = BlockManagerId(in)
mapTracker = new RoaringBitmap()
mapTracker.readExternal(in)
size = in.readLong()
}
}

private[spark] object MergeStatus {
// Dummy number of reduces for the tests where push based shuffle is not enabled
val SHUFFLE_PUSH_DUMMY_NUM_REDUCES = 1

/**
* Separate a MergeStatuses received from an ExternalShuffleService into individual
* MergeStatus. The scheduler is responsible for providing the location information
* for the given ExternalShuffleService.
*/
def convertMergeStatusesToMergeStatusArr(
mergeStatuses: MergeStatuses,
loc: BlockManagerId): Seq[(Int, MergeStatus)] = {
assert(mergeStatuses.bitmaps.length == mergeStatuses.reduceIds.length &&
mergeStatuses.bitmaps.length == mergeStatuses.sizes.length)
val mergerLoc = BlockManagerId(BlockManagerId.SHUFFLE_MERGER_IDENTIFIER, loc.host, loc.port)
mergeStatuses.bitmaps.zipWithIndex.map {
case (bitmap, index) =>
val mergeStatus = new MergeStatus(mergerLoc, bitmap, mergeStatuses.sizes(index))
(mergeStatuses.reduceIds(index), mergeStatus)
}
}

def apply(loc: BlockManagerId, bitmap: RoaringBitmap, size: Long): MergeStatus = {
new MergeStatus(loc, bitmap, size)
}
}
Loading