This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new cc0b0becb68 [fix](cloud) fix commit txn failed for mow tables (#41793)
(#42142)
cc0b0becb68 is described below
commit cc0b0becb68c0b90ce22f8b5b1227dc1caad50a0
Author: meiyi <[email protected]>
AuthorDate: Mon Oct 21 20:51:41 2024 +0800
[fix](cloud) fix commit txn failed for mow tables (#41793) (#42142)
pick https://github.com/apache/doris/pull/41793
---
.../transaction/CloudGlobalTransactionMgr.java | 37 ++++++++++++++--------
1 file changed, 23 insertions(+), 14 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 952d349714b..81c5a3bfdba 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
@@ -470,8 +470,8 @@ public class CloudGlobalTransactionMgr implements
GlobalTransactionMgrIface {
"disable_load_job is set to true, all load jobs are not
allowed");
}
- List<OlapTable> mowTableList = getMowTableList(tableList);
- if (tabletCommitInfos != null && !tabletCommitInfos.isEmpty() &&
!mowTableList.isEmpty()) {
+ List<OlapTable> mowTableList = getMowTableList(tableList,
tabletCommitInfos);
+ if (!mowTableList.isEmpty()) {
calcDeleteBitmapForMow(dbId, mowTableList, transactionId,
tabletCommitInfos);
}
@@ -482,12 +482,8 @@ public class CloudGlobalTransactionMgr implements
GlobalTransactionMgrIface {
.setCloudUniqueId(Config.cloud_unique_id)
.addAllBaseTabletIds(getBaseTabletsFromTables(tableList,
tabletCommitInfos))
.setEnableTxnLazyCommit(Config.enable_cloud_txn_lazy_commit);
-
- // if tablet commit info is empty, no need to pass mowTableList to
meta service.
- if (tabletCommitInfos != null && !tabletCommitInfos.isEmpty()) {
- for (OlapTable olapTable : mowTableList) {
- builder.addMowTableIds(olapTable.getId());
- }
+ for (OlapTable olapTable : mowTableList) {
+ builder.addMowTableIds(olapTable.getId());
}
if (txnCommitAttachment != null) {
@@ -601,14 +597,27 @@ public class CloudGlobalTransactionMgr implements
GlobalTransactionMgrIface {
return txnState;
}
- private List<OlapTable> getMowTableList(List<Table> tableList) {
+ // return mow tables with contains tablet commit info
+ private List<OlapTable> getMowTableList(List<Table> tableList,
List<TabletCommitInfo> tabletCommitInfos) {
+ if (tabletCommitInfos == null || tabletCommitInfos.isEmpty()) {
+ return Lists.newArrayList();
+ }
List<OlapTable> mowTableList = new ArrayList<>();
+ TabletInvertedIndex tabletInvertedIndex =
Env.getCurrentEnv().getTabletInvertedIndex();
for (Table table : tableList) {
- if ((table instanceof OlapTable)) {
- OlapTable olapTable = (OlapTable) table;
- if (olapTable.getEnableUniqueKeyMergeOnWrite()) {
- mowTableList.add(olapTable);
- }
+ if (!(table instanceof OlapTable)) {
+ continue;
+ }
+ OlapTable olapTable = (OlapTable) table;
+ if (!olapTable.getEnableUniqueKeyMergeOnWrite()) {
+ continue;
+ }
+ boolean hasTabletCommitInfo =
tabletCommitInfos.stream().anyMatch(ci -> {
+ TabletMeta tabletMeta =
tabletInvertedIndex.getTabletMeta(ci.getTabletId());
+ return tabletMeta != null && tabletMeta.getTableId() ==
olapTable.getId();
+ });
+ if (hasTabletCommitInfo) {
+ mowTableList.add(olapTable);
}
}
return mowTableList;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]