Skip to content

Commit

Permalink
make the code concise
Browse files Browse the repository at this point in the history
  • Loading branch information
liyezhang556520 committed Oct 17, 2014
1 parent 0380a32 commit 3d487cc
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,21 +455,20 @@ private[spark] class BlockManagerInfo(

updateLastSeenMs()

if (storageLevel.isValid) {
// isValid means it is either stored in-memory, on-disk or on-Tachyon.

if (_blocks.containsKey(blockId)) {
// The block exists on the slave already.
val blockStatus: BlockStatus = _blocks.get(blockId)
val originalLevel: StorageLevel = blockStatus.storageLevel
val originalMemSize: Long = blockStatus.memSize

if (originalLevel.useMemory) {
_remainingMem += originalMemSize
}
if (_blocks.containsKey(blockId)) {
// The block exists on the slave already.
val blockStatus: BlockStatus = _blocks.get(blockId)
val originalLevel: StorageLevel = blockStatus.storageLevel
val originalMemSize: Long = blockStatus.memSize

if (originalLevel.useMemory) {
_remainingMem += originalMemSize
}

/* The memSize here indicates the data size in or dropped from memory,
}

if (storageLevel.isValid) {
/* isValid means it is either stored in-memory, on-disk or on-Tachyon.
* The memSize here indicates the data size in or dropped from memory,
* tachyonSize here indicates the data size in or dropped from Tachyon,
* and the diskSize here indicates the data size in or dropped to disk.
* They can be both larger than 0, when a block is dropped from memory to disk.
Expand All @@ -496,7 +495,6 @@ private[spark] class BlockManagerInfo(
val blockStatus: BlockStatus = _blocks.get(blockId)
_blocks.remove(blockId)
if (blockStatus.storageLevel.useMemory) {
_remainingMem += blockStatus.memSize
logInfo("Removed %s on %s in memory (size: %s, free: %s)".format(
blockId, blockManagerId.hostPort, Utils.bytesToString(blockStatus.memSize),
Utils.bytesToString(_remainingMem)))
Expand Down

0 comments on commit 3d487cc

Please sign in to comment.