From a701b3c5ce552ebe91a09d8a8a790a3b12d77620 Mon Sep 17 00:00:00 2001 From: Xin Liao Date: Wed, 11 Dec 2024 16:04:57 +0800 Subject: [PATCH] [Opt](load) only MoW table need table commit lock when commit transaction for cloud mode (#45220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit table commit lock only used for MoW tableļ¼Œ other table modes do not need this lock. --- .../transaction/CloudGlobalTransactionMgr.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java index 46ec6989416b2e5..f718e4b66aa081c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java @@ -1105,19 +1105,23 @@ public boolean commitAndPublishTransaction(DatabaseIf db, List tableList, entry.getValue().get()); } } - increaseWaitingLockCount(tableList); - if (!MetaLockUtils.tryCommitLockTables(tableList, timeoutMillis, TimeUnit.MILLISECONDS)) { - decreaseWaitingLockCount(tableList); + + List
mowTableList = tableList.stream() + .filter(table -> table instanceof OlapTable && ((OlapTable) table).getEnableUniqueKeyMergeOnWrite()) + .collect(Collectors.toList()); + increaseWaitingLockCount(mowTableList); + if (!MetaLockUtils.tryCommitLockTables(mowTableList, timeoutMillis, TimeUnit.MILLISECONDS)) { + decreaseWaitingLockCount(mowTableList); // DELETE_BITMAP_LOCK_ERR will be retried on be throw new UserException(InternalErrorCode.DELETE_BITMAP_LOCK_ERR, "get table cloud commit lock timeout, tableList=(" - + StringUtils.join(tableList, ",") + ")"); + + StringUtils.join(mowTableList, ",") + ")"); } try { commitTransaction(db.getId(), tableList, transactionId, tabletCommitInfos, txnCommitAttachment); } finally { - decreaseWaitingLockCount(tableList); - MetaLockUtils.commitUnlockTables(tableList); + decreaseWaitingLockCount(mowTabletList); + MetaLockUtils.commitUnlockTables(mowTableList); } return true; }