You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by td...@apache.org on 2015/04/23 07:18:58 UTC

spark git commit: [HOTFIX][SQL] Fix broken cached test

Repository: spark
Updated Branches:
  refs/heads/master 03e85b4a1 -> d9e70f331


[HOTFIX][SQL] Fix broken cached test

Added in #5475. Pointed as broken in #5639.
/cc marmbrus

Author: Liang-Chi Hsieh <vi...@gmail.com>

Closes #5640 from viirya/fix_cached_test and squashes the following commits:

c0cf69a [Liang-Chi Hsieh] Fix broken cached test.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d9e70f33
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d9e70f33
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d9e70f33

Branch: refs/heads/master
Commit: d9e70f331fc3999d615ede49fc69a993dc65f272
Parents: 03e85b4
Author: Liang-Chi Hsieh <vi...@gmail.com>
Authored: Wed Apr 22 22:18:56 2015 -0700
Committer: Tathagata Das <ta...@gmail.com>
Committed: Wed Apr 22 22:18:56 2015 -0700

----------------------------------------------------------------------
 .../org/apache/spark/sql/CachedTableSuite.scala | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/d9e70f33/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
index 01e3b86..0772e5e 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
@@ -300,19 +300,26 @@ class CachedTableSuite extends QueryTest {
   }
 
   test("Clear accumulators when uncacheTable to prevent memory leaking") {
-    val accsSize = Accumulators.originals.size
-
     sql("SELECT key FROM testData LIMIT 10").registerTempTable("t1")
     sql("SELECT key FROM testData LIMIT 5").registerTempTable("t2")
-    cacheTable("t1")
-    cacheTable("t2")
+
+    Accumulators.synchronized {
+      val accsSize = Accumulators.originals.size
+      cacheTable("t1")
+      cacheTable("t2")
+      assert((accsSize + 2) == Accumulators.originals.size)
+    }
+
     sql("SELECT * FROM t1").count()
     sql("SELECT * FROM t2").count()
     sql("SELECT * FROM t1").count()
     sql("SELECT * FROM t2").count()
-    uncacheTable("t1")
-    uncacheTable("t2")
 
-    assert(accsSize >= Accumulators.originals.size)
+    Accumulators.synchronized {
+      val accsSize = Accumulators.originals.size
+      uncacheTable("t1")
+      uncacheTable("t2")
+      assert((accsSize - 2) == Accumulators.originals.size)
+    }
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org