Return-Path: X-Original-To: apmail-spark-dev-archive@minotaur.apache.org Delivered-To: apmail-spark-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E6151CFA1 for ; Fri, 7 Mar 2014 17:02:46 +0000 (UTC) Received: (qmail 23950 invoked by uid 500); 7 Mar 2014 17:02:46 -0000 Delivered-To: apmail-spark-dev-archive@spark.apache.org Received: (qmail 23600 invoked by uid 500); 7 Mar 2014 17:02:45 -0000 Mailing-List: contact dev-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@spark.apache.org Delivered-To: mailing list dev@spark.apache.org Received: (qmail 23591 invoked by uid 99); 7 Mar 2014 17:02:44 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Mar 2014 17:02:44 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D4BC593FF22; Fri, 7 Mar 2014 17:02:43 +0000 (UTC) From: liancheng To: dev@spark.apache.org Reply-To: dev@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request: [SPARK-1194] Fix the same-RDD rule for cache r... Content-Type: text/plain Message-Id: <20140307170243.D4BC593FF22@tyr.zones.apache.org> Date: Fri, 7 Mar 2014 17:02:43 +0000 (UTC) Github user liancheng commented on a diff in the pull request: https://github.com/apache/spark/pull/96#discussion_r10390021 --- Diff: core/src/main/scala/org/apache/spark/storage/MemoryStore.scala --- @@ -236,13 +236,23 @@ private class MemoryStore(blockManager: BlockManager, maxMemory: Long) while (maxMemory - (currentMemory - selectedMemory) < space && iterator.hasNext) { val pair = iterator.next() val blockId = pair.getKey - if (rddToAdd.isDefined && rddToAdd == getRddId(blockId)) { - logInfo("Will not store " + blockIdToAdd + " as it would require dropping another " + - "block from the same RDD") - return false + // Apply the same-RDD rule for cache replacement. Quoted from the + // original RDD paper: + // + // When a new RDD partition is computed but there is not enough + // space to store it, we evict a partition from the least recently + // 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) => --- End diff -- Made a mistake here, `rddId: Int == getRddId(blockId): Option[Int]` never holds... --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---