Skip to content

Commit

Permalink
[Opt](load) only MoW table need table commit lock when commit transac…
Browse files Browse the repository at this point in the history
…tion for cloud mode (#45220)

table commit lock only used for MoW table, other table modes do not need
this lock.
  • Loading branch information
liaoxin01 committed Dec 26, 2024
1 parent 9a49926 commit a47c875
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1105,19 +1105,23 @@ public boolean commitAndPublishTransaction(DatabaseIf db, List<Table> tableList,
entry.getValue().get());
}
}
increaseWaitingLockCount(tableList);
if (!MetaLockUtils.tryCommitLockTables(tableList, timeoutMillis, TimeUnit.MILLISECONDS)) {
decreaseWaitingLockCount(tableList);

List<Table> 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(mowTableList);
MetaLockUtils.commitUnlockTables(mowTableList);
}
return true;
}
Expand Down

0 comments on commit a47c875

Please sign in to comment.