This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 7a1b4267d5c [improve](transaction) lightweight transaction lock logic (#27564) 7a1b4267d5c is described below commit 7a1b4267d5c80627487fb0929235bd3e5202d88a Author: HHoflittlefish777 <77738092+hhoflittlefish...@users.noreply.github.com> AuthorDate: Sat Nov 25 23:24:36 2023 +0800 [improve](transaction) lightweight transaction lock logic (#27564) --- .../doris/transaction/DatabaseTransactionMgr.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java index 4e36891867e..83b4d164115 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java @@ -310,12 +310,13 @@ public class DatabaseTransactionMgr { throws DuplicatedRequestException, LabelAlreadyUsedException, BeginTransactionException, AnalysisException, QuotaExceedException, MetaNotFoundException { checkDatabaseDataQuota(); + Preconditions.checkNotNull(coordinator); + Preconditions.checkNotNull(label); + FeNameFormat.checkLabel(label); + + long tid = 0L; writeLock(); try { - Preconditions.checkNotNull(coordinator); - Preconditions.checkNotNull(label); - FeNameFormat.checkLabel(label); - /* * Check if label already used, by following steps * 1. get all existing transactions @@ -350,9 +351,7 @@ public class DatabaseTransactionMgr { checkRunningTxnExceedLimit(sourceType); - long tid = idGenerator.getNextTransactionId(); - LOG.info("begin transaction: txn id {} with label {} from coordinator {}, listener id: {}", - tid, label, coordinator, listenerId); + tid = idGenerator.getNextTransactionId(); TransactionState transactionState = new TransactionState(dbId, tableIdList, tid, label, requestId, sourceType, coordinator, listenerId, timeoutSecond * 1000); transactionState.setPrepareTime(System.currentTimeMillis()); @@ -361,11 +360,12 @@ public class DatabaseTransactionMgr { if (MetricRepo.isInit) { MetricRepo.COUNTER_TXN_BEGIN.increase(1L); } - - return tid; } finally { writeUnlock(); } + LOG.info("begin transaction: txn id {} with label {} from coordinator {}, listener id: {}", + tid, label, coordinator, listenerId); + return tid; } private void checkDatabaseDataQuota() throws MetaNotFoundException, QuotaExceedException { @@ -1983,15 +1983,15 @@ public class DatabaseTransactionMgr { // set transaction status will call txn state change listener transactionState.replaySetTransactionStatus(); if (transactionState.getTransactionStatus() == TransactionStatus.COMMITTED) { - LOG.info("replay a committed transaction {}", transactionState); updateCatalogAfterCommitted(transactionState, db); } else if (transactionState.getTransactionStatus() == TransactionStatus.VISIBLE) { - LOG.info("replay a visible transaction {}", transactionState); updateCatalogAfterVisible(transactionState, db); } unprotectUpsertTransactionState(transactionState, true); } finally { writeUnlock(); + LOG.info("replay a {} transaction {}", + transactionState.getTransactionStatus(), transactionState); if (shouldAddTableListLock) { MetaLockUtils.writeUnlockTables(tableList); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org