Skip to content

Commit 3d487cc

Browse files
make the code concise
1 parent 0380a32 commit 3d487cc

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -455,21 +455,20 @@ private[spark] class BlockManagerInfo(
455455

456456
updateLastSeenMs()
457457

458-
if (storageLevel.isValid) {
459-
// isValid means it is either stored in-memory, on-disk or on-Tachyon.
460-
461-
if (_blocks.containsKey(blockId)) {
462-
// The block exists on the slave already.
463-
val blockStatus: BlockStatus = _blocks.get(blockId)
464-
val originalLevel: StorageLevel = blockStatus.storageLevel
465-
val originalMemSize: Long = blockStatus.memSize
466-
467-
if (originalLevel.useMemory) {
468-
_remainingMem += originalMemSize
469-
}
458+
if (_blocks.containsKey(blockId)) {
459+
// The block exists on the slave already.
460+
val blockStatus: BlockStatus = _blocks.get(blockId)
461+
val originalLevel: StorageLevel = blockStatus.storageLevel
462+
val originalMemSize: Long = blockStatus.memSize
463+
464+
if (originalLevel.useMemory) {
465+
_remainingMem += originalMemSize
470466
}
471-
472-
/* The memSize here indicates the data size in or dropped from memory,
467+
}
468+
469+
if (storageLevel.isValid) {
470+
/* isValid means it is either stored in-memory, on-disk or on-Tachyon.
471+
* The memSize here indicates the data size in or dropped from memory,
473472
* tachyonSize here indicates the data size in or dropped from Tachyon,
474473
* and the diskSize here indicates the data size in or dropped to disk.
475474
* They can be both larger than 0, when a block is dropped from memory to disk.
@@ -496,7 +495,6 @@ private[spark] class BlockManagerInfo(
496495
val blockStatus: BlockStatus = _blocks.get(blockId)
497496
_blocks.remove(blockId)
498497
if (blockStatus.storageLevel.useMemory) {
499-
_remainingMem += blockStatus.memSize
500498
logInfo("Removed %s on %s in memory (size: %s, free: %s)".format(
501499
blockId, blockManagerId.hostPort, Utils.bytesToString(blockStatus.memSize),
502500
Utils.bytesToString(_remainingMem)))

0 commit comments

Comments
 (0)