Permalink
Browse files

Bug fix, and addressed PR comments from @mridulm

Fixed bug: getRddId(blockId) returns an Option[Int], which never equals to rddId: Int.
  • Loading branch information...
1 parent 62c92ac commit 40cdcb2334dc1d66194a1516e7ec998908b7cc78 @liancheng liancheng committed Mar 7, 2014
Showing with 5 additions and 8 deletions.
  1. +5 −8 core/src/main/scala/org/apache/spark/storage/MemoryStore.scala
@@ -244,14 +244,9 @@ private class MemoryStore(blockManager: BlockManager, maxMemory: Long)
// accessed RDD, unless this is the same RDD as the one with the
// new partition. In that case, we keep the old partition in memory
// to prevent cycling partitions from the same RDD in and out.
- //
- // TODO implement LRU eviction
- rddToAdd match {
- case Some(rddId) if rddId == getRddId(blockId) =>
- // no-op
- case _ =>
- selectedBlocks += blockId
- selectedMemory += pair.getValue.size
+ if (rddToAdd.isEmpty || rddToAdd != getRddId(blockId)) {
+ selectedBlocks += blockId
+ selectedMemory += pair.getValue.size
}
}
}
@@ -274,6 +269,8 @@ private class MemoryStore(blockManager: BlockManager, maxMemory: Long)
}
return true
} else {
+ logInfo(s"Will not store $blockIdToAdd as it would require dropping another block " +
+ "from the same RDD")
return false
}
}

0 comments on commit 40cdcb2

Please sign in to comment.