Skip to content
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-16827][Shuffle] add disk spill bytes to UnsafeExternalSorter #15616

Closed
wants to merge 1 commit into from
Closed
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 @@ -145,9 +145,7 @@ private UnsafeExternalSorter(
// Use getSizeAsKb (not bytes) to maintain backwards compatibility for units
// this.fileBufferSizeBytes = (int) conf.getSizeAsKb("spark.shuffle.file.buffer", "32k") * 1024
this.fileBufferSizeBytes = 32 * 1024;
// The spill metrics are stored in a new ShuffleWriteMetrics,
// and then discarded (this fixes SPARK-16827).
// TODO: Instead, separate spill metrics should be stored and reported (tracked in SPARK-3577).
// The spill metrics are stored in a new ShuffleWriteMetrics, and then used at the end of the spill methods
this.writeMetrics = new ShuffleWriteMetrics();

if (existingInMemorySorter == null) {
Expand Down Expand Up @@ -232,6 +230,7 @@ public long spill(long size, MemoryConsumer trigger) throws IOException {
// pages, we might not be able to get memory for the pointer array.

taskContext.taskMetrics().incMemoryBytesSpilled(spillSize);
taskContext.taskMetrics().incDiskBytesSpilled(writeMetrics.bytesWritten());
totalSpillBytes += spillSize;
return spillSize;
}
Expand Down Expand Up @@ -546,6 +545,7 @@ public long spill() throws IOException {
inMemSorter.free();
inMemSorter = null;
taskContext.taskMetrics().incMemoryBytesSpilled(released);
taskContext.taskMetrics().incDiskBytesSpilled(writeMetrics.bytesWritten());
totalSpillBytes += released;
return released;
}
Expand Down