Skip to content

Commit d4b929b

Browse files
[SPARK-4005][CORE] handle message replies in receive instead of in the individual private methods
1 parent d1966f3 commit d4b929b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ class BlockManagerMasterActor(val isLocal: Boolean, conf: SparkConf, listenerBus
7373

7474
case UpdateBlockInfo(
7575
blockManagerId, blockId, storageLevel, deserializedSize, size, tachyonSize) =>
76-
// TODO: Ideally we want to handle all the message replies in receive instead of in the
77-
// individual private methods.
78-
updateBlockInfo(blockManagerId, blockId, storageLevel, deserializedSize, size, tachyonSize)
76+
sender ! updateBlockInfo(
77+
blockManagerId, blockId, storageLevel, deserializedSize, size, tachyonSize)
7978

8079
case GetLocations(blockId) =>
8180
sender ! getLocations(blockId)
@@ -351,23 +350,23 @@ class BlockManagerMasterActor(val isLocal: Boolean, conf: SparkConf, listenerBus
351350
storageLevel: StorageLevel,
352351
memSize: Long,
353352
diskSize: Long,
354-
tachyonSize: Long) {
353+
tachyonSize: Long): Boolean = {
355354

355+
var updated = true
356356
if (!blockManagerInfo.contains(blockManagerId)) {
357357
if (blockManagerId.isDriver && !isLocal) {
358358
// We intentionally do not register the master (except in local mode),
359359
// so we should not indicate failure.
360-
sender ! true
360+
// do nothing here, "updated == true".
361361
} else {
362-
sender ! false
362+
updated = false
363363
}
364-
return
364+
return updated
365365
}
366366

367367
if (blockId == null) {
368368
blockManagerInfo(blockManagerId).updateLastSeenMs()
369-
sender ! true
370-
return
369+
return updated
371370
}
372371

373372
blockManagerInfo(blockManagerId).updateBlockInfo(
@@ -391,7 +390,7 @@ class BlockManagerMasterActor(val isLocal: Boolean, conf: SparkConf, listenerBus
391390
if (locations.size == 0) {
392391
blockLocations.remove(blockId)
393392
}
394-
sender ! true
393+
updated
395394
}
396395

397396
private def getLocations(blockId: BlockId): Seq[BlockManagerId] = {

0 commit comments

Comments
 (0)