You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/05/07 03:10:25 UTC

[GitHub] [spark] squito commented on a change in pull request #24499: [SPARK-25888][Core] Serve local disk persisted blocks by the external service after releasing executor by dynamic allocation

squito commented on a change in pull request #24499: [SPARK-25888][Core] Serve local disk persisted blocks by the external service after releasing executor by dynamic allocation
URL: https://github.com/apache/spark/pull/24499#discussion_r281446489
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/storage/BlockManagerInfoSuite.scala
 ##########
 @@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.storage
+
+import java.util.{HashMap => JHashMap}
+
+import scala.collection.JavaConverters._
+
+import org.apache.spark.SparkFunSuite
+
+class BlockManagerInfoSuite extends SparkFunSuite {
+
+  def testWithShuffleServiceOnOff(testName: String)
+      (f: (Boolean, BlockManagerInfo) => Unit): Unit = {
+    Seq(true, false).foreach { svcEnabled =>
+      val bmInfo = new BlockManagerInfo(
+        BlockManagerId("executor0", "host", 1234, None),
+        timeMs = 300,
+        maxOnHeapMem = 10000,
+        maxOffHeapMem = 20000,
+        slaveEndpoint = null,
+        if (svcEnabled) Some(new JHashMap[BlockId, BlockStatus]) else None)
+      test(s"$testName externalShuffleServiceEnabled=$svcEnabled") {
+        f(svcEnabled, bmInfo)
+      }
+    }
+  }
+
+  testWithShuffleServiceOnOff("broadcast block") { (_, bmInfo) =>
+    val broadcastId: BlockId = BroadcastBlockId(0, "field1")
+    bmInfo.updateBlockInfo(
+      broadcastId, StorageLevel.MEMORY_AND_DISK, memSize = 200, diskSize = 100)
+    assert(bmInfo.blocks.asScala ===
+      Map(broadcastId -> BlockStatus(StorageLevel.MEMORY_AND_DISK, 0, 100)))
+    assert(bmInfo.exclusiveCachedBlocks.isEmpty)
+    assert(bmInfo.remainingMem === 29800)
+  }
+
+  testWithShuffleServiceOnOff("RDD block with MEMORY_ONLY") { (svcEnabled, bmInfo) =>
+    val rddId: BlockId = RDDBlockId(0, 0)
+    bmInfo.updateBlockInfo(rddId, StorageLevel.MEMORY_ONLY, memSize = 200, diskSize = 0)
+    assert(bmInfo.blocks.asScala ===
+      Map(rddId -> BlockStatus(StorageLevel.MEMORY_ONLY, 200, 0)))
+    assert(bmInfo.exclusiveCachedBlocks === Set(rddId))
+    assert(bmInfo.remainingMem === 29800)
+    if (svcEnabled) {
+      assert(bmInfo.externalShuffleServiceBlockStatus.get.isEmpty)
+    }
+  }
+
+  testWithShuffleServiceOnOff("RDD block with MEMORY_AND_DISK") { (svcEnabled, bmInfo) =>
+    val rddId: BlockId = RDDBlockId(0, 0)
+    bmInfo.updateBlockInfo(
+      rddId, StorageLevel.MEMORY_AND_DISK, memSize = 200, diskSize = 400)
 
 Review comment:
   this is the effective storage level, not the requested level, right?  So this is testing that a block actually exists in both memory and disk -- not that the user called `rdd.persist(StorageLevel.MEMORY_AND_DISK)`, which usually only stores the data in one of memory or disk, but not both.
   
   As both marcelo and I asked about it -- are there any tests for when the requested storage level is memory and disk, but you might get either one?  Your walk through of how it works in the code is good, just wondering if there are tests.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org