Skip to content

Commit e22a759

Browse files
author
Andrew Or
committed
[SPARK-4380] Log more precise number of bytes spilled (1.1)
This is the branch-1.1 version of #3243. Author: Andrew Or <andrew@databricks.com> Closes #3355 from andrewor14/spill-log-bytes-1.1 and squashes the following commits: 36ec152 [Andrew Or] Log more precise representation of bytes in spilling code
1 parent f9739b9 commit e22a759

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ class ExternalAppendOnlyMap[K, V, C](
174174
private def spill(mapSize: Long): Unit = {
175175
spillCount += 1
176176
val threadId = Thread.currentThread().getId
177-
logInfo("Thread %d spilling in-memory map of %d MB to disk (%d time%s so far)"
178-
.format(threadId, mapSize / (1024 * 1024), spillCount, if (spillCount > 1) "s" else ""))
177+
logInfo("Thread %d spilling in-memory batch of %s to disk (%d times%s so far)"
178+
.format(threadId, org.apache.spark.util.Utils.bytesToString(mapSize),
179+
spillCount, if (spillCount > 1) "s" else ""))
179180
val (blockId, file) = diskBlockManager.createTempLocalBlock()
180181
curWriteMetrics = new ShuffleWriteMetrics()
181182
var writer = blockManager.getDiskWriter(blockId, file, serializer, fileBufferSize,

core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,9 @@ private[spark] class ExternalSorter[K, V, C](
268268

269269
spillCount += 1
270270
val threadId = Thread.currentThread().getId
271-
logInfo("Thread %d spilling in-memory batch of %d MB to disk (%d spill%s so far)"
272-
.format(threadId, memorySize / (1024 * 1024), spillCount, if (spillCount > 1) "s" else ""))
271+
logInfo("Thread %d spilling in-memory batch of %s to disk (%d spill%s so far)"
272+
.format(threadId, org.apache.spark.util.Utils.bytesToString(memorySize),
273+
spillCount, if (spillCount > 1) "s" else ""))
273274

274275
if (bypassMergeSort) {
275276
spillToPartitionFiles(collection)

0 commit comments

Comments
 (0)