Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class UnsafeShuffleWriter<K, V> extends ShuffleWriter<K, V> {
private final SparkConf sparkConf;
private final boolean transferToEnabled;
private final int initialSortBufferSize;
private final int inputBufferSizeInBytes;
private final int mergeBufferSizeInBytes;

@Nullable private MapStatus mapStatus;
@Nullable private ShuffleExternalSorter sorter;
Expand Down Expand Up @@ -140,8 +140,8 @@ public UnsafeShuffleWriter(
this.transferToEnabled = (boolean) sparkConf.get(package$.MODULE$.SHUFFLE_MERGE_PREFER_NIO());
this.initialSortBufferSize =
(int) (long) sparkConf.get(package$.MODULE$.SHUFFLE_SORT_INIT_BUFFER_SIZE());
this.inputBufferSizeInBytes =
(int) (long) sparkConf.get(package$.MODULE$.SHUFFLE_FILE_BUFFER_SIZE()) * 1024;
this.mergeBufferSizeInBytes =
(int) (long) sparkConf.get(package$.MODULE$.SHUFFLE_FILE_MERGE_BUFFER_SIZE()) * 1024;
open();
}

Expand Down Expand Up @@ -372,7 +372,7 @@ private void mergeSpillsWithFileStream(
for (int i = 0; i < spills.length; i++) {
spillInputStreams[i] = new NioBufferedFileInputStream(
spills[i].file,
inputBufferSizeInBytes);
mergeBufferSizeInBytes);
// Only convert the partitionLengths when debug level is enabled.
if (logger.isDebugEnabled()) {
logger.debug("Partition lengths for mapId {} in Spill {}: {}", mapId, i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,14 @@ package object config {
s" ${ByteArrayMethods.MAX_ROUNDED_ARRAY_LENGTH / 1024}.")
.createWithDefaultString("32k")

private[spark] val SHUFFLE_FILE_MERGE_BUFFER_SIZE =
ConfigBuilder("spark.shuffle.file.merge.buffer")
.doc("Size of the in-memory buffer for each shuffle file input stream, in KiB unless " +
"otherwise specified. These buffers use off-heap buffers and are related to the number " +
"of files in the shuffle file. Too large buffers should be avoided.")
.version("4.0.0")
.fallbackConf(SHUFFLE_FILE_BUFFER_SIZE)

private[spark] val SHUFFLE_UNSAFE_FILE_OUTPUT_BUFFER_SIZE =
ConfigBuilder("spark.shuffle.unsafe.file.output.buffer")
.doc("(Deprecated since Spark 4.0, please use 'spark.shuffle.localDisk.file.output.buffer'.)")
Expand Down
10 changes: 10 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,16 @@ Apart from these, the following properties are also available, and may be useful
</td>
<td>1.4.0</td>
</tr>
<tr>
<td><code>spark.shuffle.file.merge.buffer</code></td>
<td>32k</td>
<td>
Size of the in-memory buffer for each shuffle file input stream, in KiB unless otherwise
specified. These buffers use off-heap buffers and are related to the number of files in
the shuffle file. Too large buffers should be avoided.
</td>
<td>4.0.0</td>
</tr>
<tr>
<td><code>spark.shuffle.unsafe.file.output.buffer</code></td>
<td>32k</td>
Expand Down