Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
hust-hhb committed Sep 14, 2024
1 parent 6880357 commit 4a92ac9
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,9 @@ public boolean commitAndPublishTransaction(DatabaseIf db, List<Table> tableList,
entry.getValue().get());
}
}
increaseCount(tableList);
increaseWaitingLockCount(tableList);
if (!MetaLockUtils.tryCommitLockTables(tableList, timeoutMillis, TimeUnit.MILLISECONDS)) {
decreaseCount(tableList);
decreaseWaitingLockCount(tableList);
// DELETE_BITMAP_LOCK_ERR will be retried on be
throw new UserException(InternalErrorCode.DELETE_BITMAP_LOCK_ERR,
"get table cloud commit lock timeout, tableList=("
Expand All @@ -982,7 +982,7 @@ public boolean commitAndPublishTransaction(DatabaseIf db, List<Table> tableList,
try {
commitTransaction(db.getId(), tableList, transactionId, tabletCommitInfos, txnCommitAttachment);
} finally {
decreaseCount(tableList);
decreaseWaitingLockCount(tableList);
MetaLockUtils.commitUnlockTables(tableList);
}
return true;
Expand Down Expand Up @@ -1737,7 +1737,7 @@ public TransactionState abortSubTxn(long txnId, long subTxnId, long dbId, Set<Lo
return TxnUtil.transactionStateFromPb(response.getTxnInfo());
}

private void increaseCount(List<Table> tableList) {
private void increaseWaitingLockCount(List<Table> tableList) {
for (int i = 0; i < tableList.size(); i++) {
long tableId = tableList.get(i).getId();
if (waitToCommitTxnCountMap.containsKey(tableId)) {
Expand All @@ -1749,7 +1749,7 @@ private void increaseCount(List<Table> tableList) {
}
}

private void decreaseCount(List<Table> tableList) {
private void decreaseWaitingLockCount(List<Table> tableList) {
for (int i = 0; i < tableList.size(); i++) {
long tableId = tableList.get(i).getId();
waitToCommitTxnCountMap.get(tableId).decrementAndGet();
Expand Down

0 comments on commit 4a92ac9

Please sign in to comment.