Skip to content

Commit

Permalink
[BugFix] Fix commit transaction not in write lock in replication job
Browse files Browse the repository at this point in the history
Signed-off-by: xiangguangyxg <[email protected]>
  • Loading branch information
xiangguangyxg committed Dec 19, 2024
1 parent 367311b commit b4a1a62
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,14 @@ private void commitTransaction() throws StarRocksException {
ReplicationTxnCommitAttachment attachment = new ReplicationTxnCommitAttachment(
partitionVersions, partitionVersionEpochs);

GlobalStateMgr.getServingState().getGlobalTransactionMgr().commitTransaction(databaseId,
transactionId, tabletsCommitInfo.first, tabletsCommitInfo.second, attachment);
Locker locker = new Locker();
locker.lockTableWithIntensiveDbLock(databaseId, tableId, LockType.WRITE);
try {
GlobalStateMgr.getServingState().getGlobalTransactionMgr().commitTransaction(databaseId,
transactionId, tabletsCommitInfo.first, tabletsCommitInfo.second, attachment);
} finally {
locker.unLockTableWithIntensiveDbLock(databaseId, tableId, LockType.WRITE);
}
}

private void abortTransaction(String reason) {
Expand Down

0 comments on commit b4a1a62

Please sign in to comment.