Skip to content

Commit 2c82745

Browse files
squitogatorsmile
authored andcommitted
[SPARK-24307][CORE] Add conf to revert to old code.
In case there are any issues in converting FileSegmentManagedBuffer to ChunkedByteBuffer, add a conf to go back to old code path. Followup to 7e84764 Author: Imran Rashid <[email protected]> Closes apache#21867 from squito/SPARK-24307-p2.
1 parent e3486e1 commit 2c82745

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/src/main/scala/org/apache/spark/storage/BlockManager.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ private[spark] class BlockManager(
132132
conf.getBoolean("spark.shuffle.service.enabled", false)
133133
private val chunkSize =
134134
conf.getSizeAsBytes("spark.storage.memoryMapLimitForTests", Int.MaxValue.toString).toInt
135+
private val remoteReadNioBufferConversion =
136+
conf.getBoolean("spark.network.remoteReadNioBufferConversion", false)
135137

136138
val diskBlockManager = {
137139
// Only perform cleanup if an external service is not serving our shuffle files.
@@ -731,7 +733,14 @@ private[spark] class BlockManager(
731733
}
732734

733735
if (data != null) {
734-
return Some(ChunkedByteBuffer.fromManagedBuffer(data, chunkSize))
736+
// SPARK-24307 undocumented "escape-hatch" in case there are any issues in converting to
737+
// ChunkedByteBuffer, to go back to old code-path. Can be removed post Spark 2.4 if
738+
// new path is stable.
739+
if (remoteReadNioBufferConversion) {
740+
return Some(new ChunkedByteBuffer(data.nioByteBuffer()))
741+
} else {
742+
return Some(ChunkedByteBuffer.fromManagedBuffer(data, chunkSize))
743+
}
735744
}
736745
logDebug(s"The value of block $blockId is null")
737746
}

0 commit comments

Comments
 (0)