Skip to content

Commit 7f06280

Browse files
committed
SPARK-54449: ut fix
1 parent 0a79a8d commit 7f06280

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

core/src/test/scala/org/apache/spark/memory/MemoryManagerSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private[memory] trait MemoryManagerSuite extends SparkFunSuite {
320320
test("off-heap execution allocations cannot exceed limit") {
321321
val memoryManager = createMemoryManager(
322322
maxOnHeapExecutionMemory = 2L,
323-
maxOffHeapExecutionMemory = 1000L)
323+
maxOffHeapExecutionMemory = 1000L, isOffHeapEnabled = true)
324324

325325
val tMemManager = new TaskMemoryManager(memoryManager, 1)
326326
val c = new TestMemoryConsumer(tMemManager, MemoryMode.OFF_HEAP)

core/src/test/scala/org/apache/spark/storage/BlockManagerReplicationSuite.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ trait BlockManagerReplicationBehavior extends SparkFunSuite
7575
protected def makeBlockManager(
7676
maxMem: Long,
7777
name: String = SparkContext.DRIVER_IDENTIFIER,
78-
memoryManager: Option[UnifiedMemoryManager] = None): BlockManager = {
78+
memoryManager: Option[UnifiedMemoryManager] = None,
79+
isOffHeapEnabled: Boolean = false ): BlockManager = {
7980
conf.set(TEST_MEMORY, maxMem)
8081
conf.set(MEMORY_OFFHEAP_SIZE, maxMem)
82+
conf.set(MEMORY_OFFHEAP_ENABLED, isOffHeapEnabled)
8183
val serializerManager = new SerializerManager(serializer, conf)
8284
val transfer = new NettyBlockTransferService(
8385
conf, securityMgr, serializerManager, "localhost", "localhost", 0, 1)
@@ -98,6 +100,7 @@ trait BlockManagerReplicationBehavior extends SparkFunSuite
98100
conf.set(MEMORY_FRACTION, 1.0)
99101
conf.set(MEMORY_STORAGE_FRACTION, 0.999)
100102
conf.set(STORAGE_UNROLL_MEMORY_THRESHOLD, 512L)
103+
conf.set(MEMORY_OFFHEAP_ENABLED, false)
101104

102105
// to make cached peers refresh frequently
103106
conf.set(STORAGE_CACHED_PEERS_TTL, 10)
@@ -403,7 +406,7 @@ trait BlockManagerReplicationBehavior extends SparkFunSuite
403406

404407
// As many stores as the replication factor
405408
val stores = (1 to maxReplication).map {
406-
i => makeBlockManager(storeSize, s"store$i")
409+
i => makeBlockManager(storeSize, s"store$i", isOffHeapEnabled = true)
407410
}
408411

409412
storageLevels.foreach { storageLevel =>

core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with PrivateMethodTe
129129
val bmConf = testConf.map(_.setAll(conf.getAll)).getOrElse(conf)
130130
bmConf.set(TEST_MEMORY, maxMem)
131131
bmConf.set(MEMORY_OFFHEAP_SIZE, maxMem)
132+
if(maxMem > 0) {
133+
bmConf.set(MEMORY_OFFHEAP_ENABLED, true)
134+
}
132135
val serializer = new KryoSerializer(bmConf)
133136
val encryptionKey = if (bmConf.get(IO_ENCRYPTION_ENABLED)) {
134137
Some(CryptoStreamUtils.createKey(bmConf))

0 commit comments

Comments
 (0)