aasha commented on a change in pull request #1232:
URL: https://github.com/apache/hive/pull/1232#discussion_r455490260
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
##########
@@ -999,20 +1033,27 @@ String getValidTxnListForReplDump(Hive hiveDb, long
waitUntilTime) throws HiveEx
} catch (InterruptedException e) {
LOG.info("REPL DUMP thread sleep interrupted", e);
}
- validTxnList = getTxnMgr().getValidTxns();
+ validTxnList = getTxnMgr().getValidTxns(Arrays.asList(TxnType.READ_ONLY,
TxnType.REPL_CREATED));
}
// After the timeout just force abort the open txns
- List<Long> openTxns = getOpenTxns(validTxnList);
- if (!openTxns.isEmpty()) {
- hiveDb.abortTransactions(openTxns);
- validTxnList = getTxnMgr().getValidTxns();
- if (validTxnList.getMinOpenTxn() != null) {
- openTxns = getOpenTxns(validTxnList);
- LOG.warn("REPL DUMP unable to force abort all the open txns: {} after
timeout due to unknown reasons. " +
- "However, this is rare case that shouldn't happen.", openTxns);
- throw new IllegalStateException("REPL DUMP triggered abort txns failed
for unknown reasons.");
+ if (conf.getBoolVar(REPL_BOOTSTRAP_DUMP_ABORT_WRITE_TXN_AFTER_TIMEOUT)) {
+ List<Long> openTxns = getOpenTxns(validTxnList, work.dbNameOrPattern);
+ if (!openTxns.isEmpty()) {
+ //abort only write transactions for the db under replication if abort
transactions is enabled.
+ hiveDb.abortTransactions(openTxns);
+ validTxnList =
getTxnMgr().getValidTxns(Arrays.asList(TxnType.READ_ONLY,
TxnType.REPL_CREATED));
Review comment:
If we use the already obtained validTxnList we won't know if there are
still open txns. This is to check all open txns that were previously open, are
aborted and not part of invalid txn list again.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]