-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-32921][SHUFFLE] MapOutputTracker extensions to support push-based shuffle #30480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
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 81e6a5b
LIHADOOP-53321 Magnet: Merge client shuffle block fetcher related cha…
otterc e1cc409
LIHADOOP-54115 Unregister map and merge outputs on the host when DAG …
otterc bfd3a73
LIHADOOP-52494 Magnet fallback to origin shuffle blocks when fetch of…
otterc 2bf9502
Magnet: Serialization of merge status shoud use the reentrant readwri…
otterc 23975c4
Fixed the compilation error in MOT
otterc f51a806
Prepare for PR
Victsm 9fee2ef
Fix Scala 2.13 compatibility issue
Victsm 10f3079
Fix build issues
Victsm b37efa4
Fix javadoc issue
Victsm a188649
Fix more javadoc issue
Victsm 3c5fc12
Address review comments
Victsm 384de48
Address Mridul's review comments
venkata91 694c8e7
Addressed review comments of ngone51 and mridulm
venkata91 a10eba1
Merge branch 'upstream-master' into SPARK-32921
venkata91 cf82f2f
Merge branch 'upstream-master' into SPARK-32921
venkata91 3c91ed0
fix test
venkata91 4940b57
Make one rpc for both MapStatus and MergeStatus
venkata91 cd6a82c
getStatuses master changes
venkata91 04e0e27
Combine MapStatus and MergeStatus fetch into a single RPC
venkata91 0e36f80
Added TODO comment wrt AQE improvements
venkata91 336765f
Address otterc comment
venkata91 e2ed11a
Merge branch 'upstream-master' into SPARK-32921
venkata91 351ae53
MapOutputTrackerSuite test
venkata91 9614a0c
Additional tests to test protocol changes
venkata91 7dd24bc
Address ngone51 comments
venkata91 d1422bd
Address other comments
venkata91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
670 changes: 570 additions & 100 deletions
670
core/src/main/scala/org/apache/spark/MapOutputTracker.scala
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
core/src/main/scala/org/apache/spark/scheduler/MergeStatus.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.