Skip to content

Commit

Permalink
More comments to try to explain metrics code
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed May 12, 2015
1 parent df07699 commit de40b9d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@ private long[] mergeSpills(SpillInfo[] spills) throws IOException {
logger.debug("Using slow merge");
partitionLengths = mergeSpillsWithFileStream(spills, outputFile, compressionCodec);
}
// The final shuffle spill's write would have directly updated shuffleBytesWritten, so
// we need to decrement to avoid double-counting this write.
// When closing an UnsafeShuffleExternalSorter that has already spilled once but also has
// in-memory records, we write out the in-memory records to a file but do not count that
// final write as bytes spilled (instead, it's accounted as shuffle write). The merge needs
// to be counted as shuffle write, but this will lead to double-counting of the final
// SpillInfo's bytes.
writeMetrics.decShuffleBytesWritten(spills[spills.length - 1].file.length());
writeMetrics.incShuffleBytesWritten(outputFile.length());
return partitionLengths;
Expand Down

0 comments on commit de40b9d

Please sign in to comment.