Skip to content

Commit 55b5918

Browse files
committed
address matei's comment on the replication of offHeap storagelevel
1 parent 7cd4600 commit 55b5918

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ private[spark] class BlockManager(
717717

718718
// Either we're storing bytes and we asynchronously started replication, or we're storing
719719
// values and need to serialize and replicate them now:
720-
if (level.replication > 1 && !level.useOffHeap) {
720+
if (level.replication > 1) {
721721
data match {
722722
case ByteBufferValues(bytes) => Await.ready(replicationFuture, Duration.Inf)
723723
case _ => {
@@ -739,7 +739,7 @@ private[spark] class BlockManager(
739739

740740
BlockManager.dispose(bytesAfterPut)
741741

742-
if (level.replication > 1 && !level.useOffHeap) {
742+
if (level.replication > 1) {
743743
logDebug("Put for block " + blockId + " with replication took " +
744744
Utils.getUsedTimeMs(startTimeMs))
745745
} else {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class StorageLevel private(
5050
def replication = replication_
5151

5252
assert(replication < 40, "Replication restricted to be less than 40 for calculating hashcodes")
53+
54+
assert(!(useOffHeap && (replication > 1)),
55+
"The replication of useOffHeap mode can not set more than 1")
5356

5457
override def clone(): StorageLevel = new StorageLevel(
5558
this.useDisk, this.useMemory, this.useOffHeap, this.deserialized, this.replication)

0 commit comments

Comments
 (0)