Index: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
===================================================================
--- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (revision 1158629)
+++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (working copy)
@@ -469,6 +469,8 @@
// The class responsible for logging client side performance metrics
// Must be a subclass of org.apache.hadoop.hive.ql.log.PerfLogger
HIVE_PERF_LOGGER("hive.exec.perf.logger", "org.apache.hadoop.hive.ql.log.PerfLogger"),
+ // Whether to delete the scrachdir while startup
+ HIVE_START_CLEANUP_SCRACHDIR("hive.start.cleanup.scrachdir", false),
;
public final String varname;
Index: conf/hive-default.xml
===================================================================
--- conf/hive-default.xml (revision 1158629)
+++ conf/hive-default.xml (working copy)
@@ -1163,4 +1163,10 @@
The class responsible logging client side performance metrics. Must be a subclass of org.apache.hadoop.hive.ql.log.PerfLogger
+
+ hive.start.cleanup.scrachdir
+ false
+ To cleanup the hive scrachdir while starting the hive server
+
+
Index: service/src/java/org/apache/hadoop/hive/service/HiveServer.java
===================================================================
--- service/src/java/org/apache/hadoop/hive/service/HiveServer.java (revision 1158629)
+++ service/src/java/org/apache/hadoop/hive/service/HiveServer.java (working copy)
@@ -60,6 +60,8 @@
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportFactory;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
import com.facebook.fb303.fb_status;
@@ -660,10 +662,13 @@
HiveServerHandler.LOG.warn(e.getMessage());
}
+ HiveConf conf = new HiveConf(HiveServerHandler.class);
+ if (conf.getBoolVar(HiveConf.ConfVars.HIVE_START_CLEANUP_SCRACHDIR)) {
+ cleanUpScratchDir(conf);
+ }
+
TServerTransport serverTransport = new TServerSocket(cli.port);
- HiveConf conf = new HiveConf(HiveServerHandler.class);
-
// set all properties specified on the command line
for (Map.Entry