Index: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
===================================================================
--- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (revision 1156493)
+++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (working copy)
@@ -458,6 +458,7 @@
HIVE_MAPPER_CANNOT_SPAN_MULTIPLE_PARTITIONS("hive.mapper.cannot.span.multiple.partitions", false),
HIVE_REWORK_MAPREDWORK("hive.rework.mapredwork", false),
HIVE_CONCATENATE_CHECK_INDEX ("hive.exec.concatenate.check.index", true),
+ HIVE_START_CLEANUP_SCRACHDIR("hive.start.cleanup.scrachdir", false)
;
public final String varname;
Index: conf/hive-default.xml
===================================================================
--- conf/hive-default.xml (revision 1156493)
+++ conf/hive-default.xml (working copy)
@@ -1144,4 +1144,10 @@
by record readers
+
+ hive.start.cleanup.scrachdir
+ false
+ To cleanup the hive scrachdir while starting the hive server
+
+
Index: data/conf/hive-site.xml
===================================================================
--- data/conf/hive-site.xml (revision 1156493)
+++ data/conf/hive-site.xml (working copy)
@@ -176,4 +176,10 @@
The default input format, if it is not specified, the system assigns it. It is set to HiveInputFormat for hadoop versions 17, 18 and 19, whereas it is set to CombineHiveInputFormat for hadoop 20. The user can always overwrite it - if there is a bug in CombineHiveInputFormat, it can always be manually set to HiveInputFormat.
+
+ hive.start.cleanup.scrachdir
+ true
+ 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 1156493)
+++ 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