Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/11241#discussion_r55604211
--- Diff:
core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala ---
@@ -1331,6 +1336,72 @@ class BlockManagerSuite extends SparkFunSuite with
Matchers with BeforeAndAfterE
assert(store.getSingle("a1").isDefined, "a1 was not in store")
assert(store.getSingle("a3").isDefined, "a3 was not in store")
}
+
+ test("SPARK-13328: refresh block locations (fetch should fail after
hitting a threshold)") {
+ val mockBlockTransferService = new
MockBlockTransferService(maxFailuresBeforeLocationRefresh)
+ store = makeBlockManager(8000, "executor1")
+
+ store.putSingle("item", 999L, StorageLevel.MEMORY_ONLY, tellMaster =
true)
+
+ intercept[BlockFetchException] {
+ store.doGetRemote("item", mockBlockTransferService, asBlockResult =
false)
+ .asInstanceOf[Option[ByteBuffer]]
+ }
+ }
+
+ test("SPARK-13328: refresh block locations (fetch should succeed after
location refresh)") {
+ val mockBlockManagerMaster = mock(classOf[BlockManagerMaster])
+ val mockBlockTransferService = new
MockBlockTransferService(maxFailuresBeforeLocationRefresh)
+
+ // make sure we have more than maxFailuresBeforeLocationRefresh
locations
+ // so that we have a chance to do location refresh
+ val blockManagerIds = new ArrayBuffer[BlockManagerId]()
+ for (i <- 0 to maxFailuresBeforeLocationRefresh) {
+ blockManagerIds += BlockManagerId(s"id-$i", s"host-$i", i + 1)
+ }
--- End diff --
nit:
```
val blockManagerIds = (0 to maxFailuresBeforeLocationRefresh).map { i =>
BlockManagerId(s"id-$i", s"host-$i", i + 1) }
```
also I think you won't need `toSeq` on the next line then.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]