Lchangliang commented on code in PR #37669: URL: https://github.com/apache/doris/pull/37669#discussion_r1686217659
########## fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java: ########## @@ -792,10 +796,20 @@ private void cancelInternal() { jobState = JobState.CANCELLED; } - // Check whether transactions of the given database which txnId is less than 'watershedTxnId' are finished. - protected boolean isPreviousLoadFinished() throws AnalysisException { - return Env.getCurrentGlobalTransactionMgr().isPreviousTransactionsFinished( + // Check whether transactions of the given database which txnId is less than 'watershedTxnId' are finished + // and abort it if it is failed. + // If return true, all previous load is finish + protected boolean checkFailedPreviousLoadAndAbort() throws UserException { + List<TransactionState> unFinishedTxns = Env.getCurrentGlobalTransactionMgr().getUnFinishedPreviousLoad( watershedTxnId, dbId, Lists.newArrayList(tableId)); + if (Config.enable_abort_txn_by_checking_conflict_txn) { + List<TransactionState> failedTxns = GlobalTransactionMgr.checkFailedTxns(unFinishedTxns); + for (TransactionState txn : failedTxns) { + Env.getCurrentGlobalTransactionMgr() + .abortTransaction(txn.getDbId(), txn.getTransactionId(), "Cancel by schema change"); + } + } + return unFinishedTxns.isEmpty(); Review Comment: No, if unFinishedTxns is not empty, it need to abort the txns in current term and doublc check in next term. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org