diff --git a/core/src/main/scala/org/apache/spark/storage/BlockManager.scala b/core/src/main/scala/org/apache/spark/storage/BlockManager.scala index c02c0327ac6ec21e65ac88a23458404fa6dd7404..dbe573dc64301ccbabc77028b311f079e8da18d0 100644 --- a/core/src/main/scala/org/apache/spark/storage/BlockManager.scala +++ b/core/src/main/scala/org/apache/spark/storage/BlockManager.scala @@ -523,8 +523,7 @@ private[spark] class BlockManager( val file = diskBlockManager.createBlockFile(blockId, filename, allowAppending = true) val writer = new DiskBlockObjectWriter(blockId, file, serializer, bufferSize, compressStream) writer.registerCloseEventHandler(() => { - if (blockId.name != filename) { - // Avoid producing mappings if we're using unique filenames for blocks. + if (shuffleBlockManager.consolidateShuffleFiles) { diskBlockManager.mapBlockToFileSegment(blockId, writer.fileSegment()) } val myInfo = new BlockInfo(StorageLevel.DISK_ONLY, false)