hust-hhb commented on code in PR #40562: URL: https://github.com/apache/doris/pull/40562#discussion_r1766138305
########## fe/fe-core/src/main/java/org/apache/doris/load/loadv2/SparkLoadJob.java: ########## @@ -656,21 +658,50 @@ public void updateLoadingStatus() throws UserException { } private void tryCommitJob() throws UserException { - LOG.info(new LogBuilder(LogKey.LOAD_JOB, id).add("txn_id", transactionId) - .add("msg", "Load job try to commit txn").build()); - Database db = getDb(); - List<Table> tableList = db.getTablesOnIdOrderOrThrowException( - Lists.newArrayList(tableToLoadPartitions.keySet())); - MetaLockUtils.writeLockTablesOrMetaException(tableList); - try { - Env.getCurrentGlobalTransactionMgr().commitTransaction( - dbId, tableList, transactionId, commitInfos, - new LoadJobFinalOperation(id, loadingStatus, progress, loadStartTimestamp, - finishTimestamp, state, failMsg)); - } catch (TabletQuorumFailedException e) { - // retry in next loop - } finally { - MetaLockUtils.writeUnlockTables(tableList); + int retryTimes = 0; + while (true) { + Database db = getDb(); + List<Table> tableList = db.getTablesOnIdOrderOrThrowException( + Lists.newArrayList(tableToLoadPartitions.keySet())); + if (Config.isCloudMode()) { + MetaLockUtils.commitLockTables(tableList); + } else { + MetaLockUtils.writeLockTablesOrMetaException(tableList); + } + try { + LOG.info(new LogBuilder(LogKey.LOAD_JOB, id).add("txn_id", transactionId) + .add("msg", "Load job try to commit txn").build()); + Env.getCurrentGlobalTransactionMgr().commitTransaction( + dbId, tableList, transactionId, commitInfos, + new LoadJobFinalOperation(id, loadingStatus, progress, loadStartTimestamp, + finishTimestamp, state, failMsg)); + return; + } catch (UserException e) { + LOG.warn(new LogBuilder(LogKey.LOAD_JOB, id) + .add("txn_id", transactionId) + .add("database_id", dbId) + .add("retry_times", retryTimes) + .add("error_msg", "Failed to commit txn with error:" + e.getMessage()) + .build(), e); + if (e.getErrorCode() == InternalErrorCode.DELETE_BITMAP_LOCK_ERR) { + retryTimes++; + if (retryTimes >= Config.mow_calculate_delete_bitmap_retry_times) { + LOG.warn("cancelJob {} because up to max retry time", id); Review Comment: done -- 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