-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-25341][Core] Support rolling back a shuffle map stage and re-generate the shuffle files #24892
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
[SPARK-25341][Core] Support rolling back a shuffle map stage and re-generate the shuffle files #24892
Changes from all commits
18b1a12
e7365e3
99c2b4a
122a8fe
eb5c58b
67f70a4
0e8ff21
4f9606c
8873f11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,6 +164,18 @@ public void registerExecutor( | |
| executors.put(fullId, executorInfo); | ||
| } | ||
|
|
||
| /** | ||
| * Overload getBlockData with setting shuffleGenerationId to an invalid value of -1. | ||
| */ | ||
| public ManagedBuffer getBlockData( | ||
| String appId, | ||
| String execId, | ||
| int shuffleId, | ||
| int mapId, | ||
| int reduceId) { | ||
| return getBlockData(appId, execId, shuffleId, -1, mapId, reduceId); | ||
| } | ||
|
|
||
| /** | ||
| * Obtains a FileSegmentManagedBuffer from (shuffleId, mapId, reduceId). We make assumptions | ||
| * about how the hash and sort based shuffles store their data. | ||
|
|
@@ -172,14 +184,16 @@ public ManagedBuffer getBlockData( | |
| String appId, | ||
| String execId, | ||
| int shuffleId, | ||
| int shuffleGenerationId, | ||
| int mapId, | ||
| int reduceId) { | ||
| ExecutorShuffleInfo executor = executors.get(new AppExecId(appId, execId)); | ||
| if (executor == null) { | ||
| throw new RuntimeException( | ||
| String.format("Executor is not registered (appId=%s, execId=%s)", appId, execId)); | ||
| } | ||
| return getSortBasedShuffleBlockData(executor, shuffleId, mapId, reduceId); | ||
| return getSortBasedShuffleBlockData( | ||
| executor, shuffleId, shuffleGenerationId, mapId, reduceId); | ||
| } | ||
|
|
||
| public ManagedBuffer getRddBlockData( | ||
|
|
@@ -291,22 +305,29 @@ private void deleteNonShuffleServiceServedFiles(String[] dirs) { | |
| } | ||
|
|
||
| /** | ||
| * Sort-based shuffle data uses an index called "shuffle_ShuffleId_MapId_0.index" into a data file | ||
| * called "shuffle_ShuffleId_MapId_0.data". This logic is from IndexShuffleBlockResolver, | ||
| * Sort-based shuffle data uses an index called "shuffle_ShuffleId_MapId_0.index" into a data | ||
xuanyuanking marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * file called "shuffle_ShuffleId_MapId_0.data". This logic is from IndexShuffleBlockResolver, | ||
| * and the block id format is from ShuffleDataBlockId and ShuffleIndexBlockId. | ||
| * While the shuffle data and index file generated from the indeterminate stage, | ||
| * the ShuffleDataBlockId and ShuffleIndexBlockId will be extended by the shuffle generation id. | ||
| */ | ||
| private ManagedBuffer getSortBasedShuffleBlockData( | ||
| ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) { | ||
| ExecutorShuffleInfo executor, int shuffleId, int shuffleGenerationId, | ||
| int mapId, int reduceId) { | ||
| String baseFileName = "shuffle_" + shuffleId + "_" + mapId + "_0"; | ||
|
||
| if (shuffleGenerationId != -1) { | ||
| baseFileName = baseFileName + "_" + shuffleGenerationId; | ||
| } | ||
| File indexFile = ExecutorDiskUtils.getFile(executor.localDirs, executor.subDirsPerLocalDir, | ||
| "shuffle_" + shuffleId + "_" + mapId + "_0.index"); | ||
| baseFileName + ".index"); | ||
|
|
||
| try { | ||
| ShuffleIndexInformation shuffleIndexInformation = shuffleIndexCache.get(indexFile); | ||
| ShuffleIndexRecord shuffleIndexRecord = shuffleIndexInformation.getIndex(reduceId); | ||
| return new FileSegmentManagedBuffer( | ||
| conf, | ||
| ExecutorDiskUtils.getFile(executor.localDirs, executor.subDirsPerLocalDir, | ||
| "shuffle_" + shuffleId + "_" + mapId + "_0.data"), | ||
| ExecutorDiskUtils.getFile( | ||
| executor.localDirs, executor.subDirsPerLocalDir, baseFileName + ".data"), | ||
| shuffleIndexRecord.getOffset(), | ||
| shuffleIndexRecord.getLength()); | ||
| } catch (ExecutionException e) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it mean this method can only fetch shuffle blocks? Shall we rename the method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, after the refactor e7365e3, finally, we can rename the method and split shuffle fetch and data fetch into 2 separated function, thanks for your guidance and advice!
Done in 67f70a4.