imay commented on a change in pull request #2241: Fix some bugs about load label
URL: https://github.com/apache/incubator-doris/pull/2241#discussion_r349166905
##########
File path:
fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
##########
@@ -493,18 +521,29 @@ public boolean commitAndPublishTransaction(Database db,
long transactionId,
public void abortTransaction(Long dbId, String label, String reason)
throws UserException {
Preconditions.checkNotNull(label);
Long transactionId = null;
- writeLock();
+ readLock();
try {
- Map<String, Long> dbTxns = dbIdToTxnLabels.row(dbId);
- if (dbTxns == null) {
+ Set<Long> existingTxns = dbIdToTxnLabels.get(dbId, label);
+ if (existingTxns == null || existingTxns.isEmpty()) {
throw new UserException("transaction not found, label=" +
label);
}
- transactionId = dbTxns.get(label);
- if (transactionId == null) {
+ // find PREPARE txn
Review comment:
Please comment why find an prepare, if transaction state is not PREPARE,
what can it be? Better to add check to the state. Why there can not be multiple
PREPARE transactions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]