You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2014/10/13 22:42:08 UTC
git commit: [SPARK-3529] [SQL] Delete the temp files after test exit
Repository: spark
Updated Branches:
refs/heads/master 56102dc2d -> d3cdf9128
[SPARK-3529] [SQL] Delete the temp files after test exit
There are lots of temporal files created by TestHive under the /tmp by default, which may cause potential performance issue for testing. This PR will automatically delete them after test exit.
Author: Cheng Hao <ha...@intel.com>
Closes #2393 from chenghao-intel/delete_temp_on_exit and squashes the following commits:
3a6511f [Cheng Hao] Remove the temp dir after text exit
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d3cdf912
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d3cdf912
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d3cdf912
Branch: refs/heads/master
Commit: d3cdf9128ae828dc7f1893439f66a0de68c6e527
Parents: 56102dc
Author: Cheng Hao <ha...@intel.com>
Authored: Mon Oct 13 13:40:20 2014 -0700
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Mon Oct 13 13:40:20 2014 -0700
----------------------------------------------------------------------
.../src/main/scala/org/apache/spark/sql/hive/TestHive.scala | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/d3cdf912/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala
index a4354c1..9a9e2ed 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala
@@ -31,6 +31,7 @@ import org.apache.hadoop.hive.serde2.`lazy`.LazySimpleSerDe
import org.apache.hadoop.hive.serde2.avro.AvroSerDe
import org.apache.spark.{SparkConf, SparkContext}
+import org.apache.spark.util.Utils
import org.apache.spark.sql.catalyst.analysis._
import org.apache.spark.sql.catalyst.plans.logical.{CacheTableCommand, LogicalPlan, NativeCommand}
import org.apache.spark.sql.catalyst.util._
@@ -71,11 +72,14 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
setConf("javax.jdo.option.ConnectionURL",
s"jdbc:derby:;databaseName=$metastorePath;create=true")
setConf("hive.metastore.warehouse.dir", warehousePath)
+ Utils.registerShutdownDeleteDir(new File(warehousePath))
+ Utils.registerShutdownDeleteDir(new File(metastorePath))
}
val testTempDir = File.createTempFile("testTempFiles", "spark.hive.tmp")
testTempDir.delete()
testTempDir.mkdir()
+ Utils.registerShutdownDeleteDir(testTempDir)
// For some hive test case which contain ${system:test.tmp.dir}
System.setProperty("test.tmp.dir", testTempDir.getCanonicalPath)
@@ -121,8 +125,7 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
val hiveFilesTemp = File.createTempFile("catalystHiveFiles", "")
hiveFilesTemp.delete()
hiveFilesTemp.mkdir()
- hiveFilesTemp.deleteOnExit()
-
+ Utils.registerShutdownDeleteDir(hiveFilesTemp)
val inRepoTests = if (System.getProperty("user.dir").endsWith("sql" + File.separator + "hive")) {
new File("src" + File.separator + "test" + File.separator + "resources" + File.separator)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org