Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ private void commitTransaction(long dbId, List<Table> tableList, long transactio
"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);
}

Expand All @@ -482,12 +482,8 @@ private void commitTransaction(long dbId, List<Table> tableList, long transactio
.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) {
Expand Down Expand Up @@ -601,14 +597,27 @@ private TransactionState commitTxn(CommitTxnRequest commitTxnRequest, long trans
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;
Expand Down