github-actions[bot] commented on code in PR #26323:
URL: https://github.com/apache/doris/pull/26323#discussion_r1381258311


##########
be/src/olap/txn_manager.cpp:
##########
@@ -162,6 +163,29 @@ Status TxnManager::publish_txn(TPartitionId partition_id, 
const TabletSharedPtr&
                        tablet->tablet_id(), tablet->tablet_uid(), version, 
stats);
 }
 
+void TxnManager::abort_txn(TPartitionId partition_id, TTransactionId 
transaction_id,

Review Comment:
   warning: method 'abort_txn' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static void TxnManager::abort_txn(TPartitionId partition_id, TTransactionId 
transaction_id,
   ```
   



##########
be/src/olap/txn_manager.cpp:
##########
@@ -162,6 +163,29 @@
                        tablet->tablet_id(), tablet->tablet_uid(), version, 
stats);
 }
 
+void TxnManager::abort_txn(TPartitionId partition_id, TTransactionId 
transaction_id,
+                           TTabletId tablet_id, TabletUid tablet_uid) {
+    pair<int64_t, int64_t> key(partition_id, transaction_id);
+    TabletInfo tablet_info(tablet_id, tablet_uid);
+
+    std::shared_lock txn_rdlock(_get_txn_map_lock(transaction_id));
+
+    auto& txn_tablet_map = _get_txn_tablet_map(transaction_id);
+    auto it = txn_tablet_map.find(key);
+    if (it == txn_tablet_map.end()) {
+        return;
+    }
+
+    auto& tablet_txn_info_map = it->second;
+    if (auto tablet_txn_info_iter = tablet_txn_info_map.find(tablet_info);
+        tablet_txn_info_iter == tablet_txn_info_map.end()) {
+        return;
+    } else {
+        auto& txn_info = tablet_txn_info_iter->second;
+        txn_info.abort();
+    }

Review Comment:
   warning: do not use 'else' after 'return' [readability-else-after-return]
   
   ```suggestion
       }         auto& txn_info = tablet_txn_info_iter->second;
           txn_info.abort();
      
   ```
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to