zhannngchen commented on code in PR #40333:
URL: https://github.com/apache/doris/pull/40333#discussion_r1742930518


##########
be/src/cloud/cloud_txn_delete_bitmap_cache.cpp:
##########
@@ -184,26 +184,34 @@ void 
CloudTxnDeleteBitmapCache::update_tablet_txn_info(TTransactionId transactio
     LOG_INFO("update txn related delete bitmap")
             .tag("txn_id", transaction_id)
             .tag("tablt_id", tablet_id)
-            .tag("delete_bitmap_size", charge);
+            .tag("delete_bitmap_size", charge)
+            .tag("publish_status", static_cast<int>(publish_status));
 }
 
 void CloudTxnDeleteBitmapCache::remove_expired_tablet_txn_info() {
     
TEST_SYNC_POINT_RETURN_WITH_VOID("CloudTxnDeleteBitmapCache::remove_expired_tablet_txn_info");
     std::unique_lock<std::shared_mutex> wlock(_rwlock);
-    while (!_expiration_txn.empty()) {
-        auto iter = _expiration_txn.begin();
-        if (_txn_map.find(iter->second) == _txn_map.end()) {
-            _expiration_txn.erase(iter);
+    for (auto it = _expiration_txn.begin(); it != _expiration_txn.end();) {
+        if (_txn_map.find(it->second) == _txn_map.end()) {
+            it = _expiration_txn.erase(it);
             continue;
         }
         int64_t current_time = duration_cast<std::chrono::seconds>(
                                        
std::chrono::system_clock::now().time_since_epoch())
                                        .count();
-        if (iter->first > current_time) {
+        if (it->first > current_time) {
             break;
         }
-        auto txn_iter = _txn_map.find(iter->second);
-        if ((txn_iter != _txn_map.end()) && (iter->first == 
txn_iter->second.txn_expiration)) {
+        if (*(_txn_map.find(it->second)->second.publish_status) != 
PublishStatus::SUCCEED) {

Review Comment:
   If you don't clear the txn_info if it's not in SUCCEED status, the 
expiration time is use less
   And if the txn failed, when would it be cleared?



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