diff --git a/data/conf/llap/hive-site.xml b/data/conf/llap/hive-site.xml
index 44ca6c9daf..dad3823c46 100644
--- a/data/conf/llap/hive-site.xml
+++ b/data/conf/llap/hive-site.xml
@@ -358,4 +358,9 @@
1024
+
+ tez.am.task.max.failed.attempts
+ 2
+
+
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
index 2106fec7af..a93ba209a4 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
@@ -1019,6 +1019,16 @@ public void clearTestSideEffects() throws Exception {
NotificationEventPoll.shutdown();
QueryResultsCache.cleanupInstance();
+ // allocate and initialize a new conf since a test can modify conf by using 'set' commands
+ resetConf();
+
+ clearTablesCreatedDuringTests();
+ clearUDFsCreatedDuringTests();
+ clearKeysCreatedInTests();
+ StatsSources.clearGlobalStats();
+ }
+
+ private void resetConf() throws Exception {
// allocate and initialize a new conf since a test can
// modify conf by using 'set' commands
conf = new HiveConf(IDriver.class);
@@ -1027,11 +1037,6 @@ public void clearTestSideEffects() throws Exception {
// renew the metastore since the cluster type is unencrypted
db = Hive.get(conf); // propagate new conf to meta store
-
- clearTablesCreatedDuringTests();
- clearUDFsCreatedDuringTests();
- clearKeysCreatedInTests();
- StatsSources.clearGlobalStats();
}
protected void clearSettingsCreatedInTests() throws IOException {
@@ -1229,6 +1234,13 @@ public void cliInit(File file) throws Exception {
cliInit(file, true);
}
+ private CliSessionState newSSAndCliDriver(boolean canReuseSession) throws Exception {
+ resetConf();
+ CliSessionState ss = startSessionState(canReuseSession);
+ cliDriver = new CliDriver();
+ return ss;
+ }
+
public String cliInit(File file, boolean recreate) throws Exception {
String fileName = file.getName();
@@ -1237,15 +1249,13 @@ public String cliInit(File file, boolean recreate) throws Exception {
createSources(fileName);
}
+ // Init data sets, using a separate SessionState/Driver from both the previous and next tests.
+ CliSessionState ss = newSSAndCliDriver(true);
+ setSessionOutputs(fileName, ss, System.out);
clearSettingsCreatedInTests();
initDataSetForTest(file);
- HiveConf.setVar(conf, HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER,
- "org.apache.hadoop.hive.ql.security.DummyAuthenticator");
- Utilities.clearWorkMap(conf);
- CliSessionState ss = new CliSessionState(conf);
- assert ss != null;
- ss.in = System.in;
+ boolean canReuseSession = !qNoSessionReuseQuerySet.contains(fileName);
String outFileExtension = getOutFileExtension(fileName);
String stdoutName = null;
@@ -1256,21 +1266,12 @@ public String cliInit(File file, boolean recreate) throws Exception {
} else {
stdoutName = fileName + outFileExtension;
}
-
File outf = new File(logDir, stdoutName);
- setSessionOutputs(fileName, ss, outf);
-
- SessionState oldSs = SessionState.get();
-
- boolean canReuseSession = !qNoSessionReuseQuerySet.contains(fileName);
- restartSessions(canReuseSession, ss, oldSs);
-
- closeSession(oldSs);
-
- SessionState.start(ss);
-
- cliDriver = new CliDriver();
+ // New SessionState/Driver for the next test.
+ ss = newSSAndCliDriver(canReuseSession);
+ setSessionOutputs(fileName, ss, new FileOutputStream(outf));
+ clearSettingsCreatedInTests();
if (fileName.equals("init_file.q")) {
ss.initFiles.add(AbstractCliConfig.HIVE_ROOT + "/data/scripts/test_init_file.sql");
@@ -1280,9 +1281,16 @@ public String cliInit(File file, boolean recreate) throws Exception {
return outf.getAbsolutePath();
}
- private void setSessionOutputs(String fileName, CliSessionState ss, File outf)
+ private void setSessionOutputs(String fileName, CliSessionState ss, OutputStream outs)
throws FileNotFoundException, Exception, UnsupportedEncodingException {
- OutputStream fo = new BufferedOutputStream(new FileOutputStream(outf));
+ if (ss.out != null) {
+ ss.out.flush();
+ }
+ if (ss.err != null) {
+ ss.out.flush();
+ }
+
+ OutputStream fo = new BufferedOutputStream(outs);
if (qSortQuerySet.contains(fileName)) {
ss.out = new SortPrintStream(fo, "UTF-8");
} else if (qHashQuerySet.contains(fileName)) {