-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-28570][CORE][SHUFFLE] Make UnsafeShuffleWriter use the new API. #25304
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
Changes from all commits
ca58a99
0ee9311
1d08d80
a02448c
86b2c4f
91d7062
fc798b7
48335fa
cf046df
97cd3e7
37a72bc
0cb1a44
320cafe
41ceaea
c125a14
f8f95f3
94a3653
85a101d
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 |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| package org.apache.spark.shuffle.api; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Optional; | ||
|
|
||
| import org.apache.spark.annotation.Private; | ||
|
|
||
|
|
@@ -39,17 +40,39 @@ public interface ShuffleExecutorComponents { | |
| /** | ||
| * Called once per map task to create a writer that will be responsible for persisting all the | ||
| * partitioned bytes written by that map task. | ||
| * @param shuffleId Unique identifier for the shuffle the map task is a part of | ||
| * | ||
| * @param shuffleId Unique identifier for the shuffle the map task is a part of | ||
| * @param mapId Within the shuffle, the identifier of the map task | ||
| * @param mapTaskAttemptId Identifier of the task attempt. Multiple attempts of the same map task | ||
| * with the same (shuffleId, mapId) pair can be distinguished by the | ||
| * different values of mapTaskAttemptId. | ||
| * with the same (shuffleId, mapId) pair can be distinguished by the | ||
| * different values of mapTaskAttemptId. | ||
| * @param numPartitions The number of partitions that will be written by the map task. Some of | ||
| * these partitions may be empty. | ||
| * these partitions may be empty. | ||
| */ | ||
| ShuffleMapOutputWriter createMapOutputWriter( | ||
| int shuffleId, | ||
| int mapId, | ||
| long mapTaskAttemptId, | ||
| int numPartitions) throws IOException; | ||
|
|
||
| /** | ||
| * An optional extension for creating a map output writer that can optimize the transfer of a | ||
| * single partition file, as the entire result of a map task, to the backing store. | ||
| * <p> | ||
| * Most implementations should return the default {@link Optional#empty()} to indicate that | ||
| * they do not support this optimization. This primarily is for backwards-compatibility in | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably it's better to indicate what kinds of implementations may support this optimization? Otherwise it's confusing. I think the storage that has API like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Truth be told, even plugins that support remote FS move would unlikely be able to support this well - one would still have to transfer the whole file up to the remote storage layer, but that could just as easily be done by writing the data from the file through an output stream. I think only implementations that stage the files locally could support this in any meaningful way at all.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm ok with leaving out the docs if only because very very few implementations should even care about this API.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I don't think its necessary to go into more details. I would say the "casual" plugin developer wouldn't bother with this, and if they're really serious, they can look at what the existing implementation does. The comment is sufficient for that. |
||
| * preserving an optimization in the local disk shuffle storage implementation. | ||
| * | ||
| * @param shuffleId Unique identifier for the shuffle the map task is a part of | ||
| * @param mapId Within the shuffle, the identifier of the map task | ||
| * @param mapTaskAttemptId Identifier of the task attempt. Multiple attempts of the same map task | ||
| * with the same (shuffleId, mapId) pair can be distinguished by the | ||
| * different values of mapTaskAttemptId. | ||
| */ | ||
| default Optional<SingleSpillShuffleMapOutputWriter> createSingleFileMapOutputWriter( | ||
| int shuffleId, | ||
| int mapId, | ||
| long mapTaskAttemptId) throws IOException { | ||
| return Optional.empty(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * 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.shuffle.api; | ||
|
|
||
| import java.io.File; | ||
| import java.io.IOException; | ||
|
|
||
| import org.apache.spark.annotation.Private; | ||
|
|
||
| /** | ||
| * Optional extension for partition writing that is optimized for transferring a single | ||
| * file to the backing store. | ||
| */ | ||
| @Private | ||
| public interface SingleSpillShuffleMapOutputWriter { | ||
|
|
||
| /** | ||
| * Transfer a file that contains the bytes of all the partitions written by this map task. | ||
| */ | ||
| void transferMapSpillFile(File mapOutputFile, long[] partitionLengths) throws IOException; | ||
| } |
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.
nit: import grouping