SourabhBadhya commented on code in PR #3457:
URL: https://github.com/apache/hive/pull/3457#discussion_r935201293
##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2.java:
##########
@@ -3080,6 +3084,83 @@ public void testAcidOrcWritePreservesFieldNames() throws
Exception {
hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED, true);
}
+ @Test
+ public void testFailureScenariosCleanupCTAS() throws Exception {
+ boolean[] booleans = {true, false};
+ for (boolean var1 : booleans) {
+ for (boolean var2 : booleans) {
+ for (boolean var3 : booleans) {
+ for (boolean var4 : booleans) {
+ failureScenarioCleanupCTAS(var1, var2, var3, var4);
+ }
+ }
+ }
+ }
+ }
+
+ public void failureScenarioCleanupCTAS(boolean isPartitioned,
+ boolean isDirectInsertEnabled,
+ boolean isLocklessReadsEnabled,
+ boolean isLocationUsed) throws
Exception {
+ String tableName = "atable";
+
+ //Set configurations
+ hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_ACID_DIRECT_INSERT_ENABLED,
isDirectInsertEnabled);
+ hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED,
isLocklessReadsEnabled);
+ hiveConf.setBoolVar(HiveConf.ConfVars.TXN_CTAS_X_LOCK, true);
+ hiveConf.setIntVar(HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD,
0);
+
+ // Add a '1' at the end of table name for custom location.
+ String querylocation = (isLocationUsed) ? " location '" +
getWarehouseDir() + "/" + tableName + "1'" : "";
+ String queryPartitions = (isPartitioned) ? " partitioned by (a)" : "";
+
+ d.run("insert into " + Table.ACIDTBL + "(a,b) values (3,4)");
+ d.run("drop table if exists " + tableName);
+ d.compileAndRespond("create table " + tableName + queryPartitions + "
stored as orc" + querylocation +
+ " tblproperties ('transactional'='true') as select * from " +
Table.ACIDTBL);
+ long txnId = d.getQueryState().getTxnManager().getCurrentTxnId();
+ DriverContext driverContext = d.getDriverContext();
+ traverseTasksRecursively(driverContext.getPlan().getRootTasks());
Review Comment:
Assigning a task like this wont help us in simulating the error because the
write will not happen. However, I have replaced the failure in DDLTask my
mocking in a similar way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]