Skip to content

Commit d2f8b97

Browse files
committed
Removed duplicate unpersistRDD.
1 parent a007307 commit d2f8b97

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

core/src/main/scala/org/apache/spark/ContextCleaner.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ private[spark] class ContextCleaner(sc: SparkContext) extends Logging {
9898
listeners += listener
9999
}
100100

101-
/** Unpersists RDD and remove all blocks for it from memory and disk. */
102-
def unpersistRDD(rddId: Int, blocking: Boolean) {
103-
logDebug("Unpersisted RDD " + rddId)
104-
sc.env.blockManager.master.removeRdd(rddId, blocking)
105-
sc.persistentRdds.remove(rddId)
106-
}
107-
108101
/** Register an object for cleanup. */
109102
private def registerForCleanup(objectForCleanup: AnyRef, task: CleanupTask) {
110103
referenceBuffer += new WeakReferenceWithCleanupTask(objectForCleanup, task)
@@ -136,7 +129,7 @@ private[spark] class ContextCleaner(sc: SparkContext) extends Logging {
136129
private def doCleanupRDD(rddId: Int) {
137130
try {
138131
logDebug("Cleaning RDD " + rddId)
139-
unpersistRDD(rddId, false)
132+
sc.unpersistRDD(rddId, false)
140133
listeners.foreach(_.rddCleaned(rddId))
141134
logInfo("Cleaned RDD " + rddId)
142135
} catch {

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,7 @@ class SparkContext(
756756
/**
757757
* Unpersist an RDD from memory and/or disk storage
758758
*/
759-
private[spark] def unpersistRDD(rdd: RDD[_], blocking: Boolean = true) {
760-
val rddId = rdd.id
759+
private[spark] def unpersistRDD(rddId: Int, blocking: Boolean = true) {
761760
env.blockManager.master.removeRdd(rddId, blocking)
762761
persistentRdds.remove(rddId)
763762
listenerBus.post(SparkListenerUnpersistRDD(rddId))

core/src/main/scala/org/apache/spark/rdd/RDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ abstract class RDD[T: ClassTag](
158158
*/
159159
def unpersist(blocking: Boolean = true): RDD[T] = {
160160
logInfo("Removing RDD " + id + " from persistence list")
161-
sc.unpersistRDD(this, blocking)
161+
sc.unpersistRDD(this.id, blocking)
162162
storageLevel = StorageLevel.NONE
163163
this
164164
}

0 commit comments

Comments
 (0)