You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2019/11/15 12:21:28 UTC

[GitHub] [incubator-doris] chaoyli commented on a change in pull request #2215: Optimize tablet report with expired transaction.

chaoyli commented on a change in pull request #2215: Optimize tablet report with expired transaction.
URL: https://github.com/apache/incubator-doris/pull/2215#discussion_r346797325
 
 

 ##########
 File path: be/src/olap/txn_manager.cpp
 ##########
 @@ -487,31 +487,24 @@ bool TxnManager::has_txn(TPartitionId partition_id, TTransactionId transaction_i
     return found;
 }
 
-bool TxnManager::get_expire_txns(TTabletId tablet_id, SchemaHash schema_hash, TabletUid tablet_uid, 
-    std::vector<int64_t>* transaction_ids) {
-    if (transaction_ids == nullptr) {
-        LOG(WARNING) << "parameter is null when get_expire_txns by tablet";
-        return false;
-    }
+void TxnManager::build_expire_txn_map(std::map<TabletInfo, std::set<int64_t>>& expire_txn_map) {
     time_t now = time(nullptr);
-    TabletInfo tablet_info(tablet_id, schema_hash, tablet_uid);
+    int64_t counter = 0;
+    // traverse the txn map, and get all expired txns
     ReadLock txn_rdlock(&_txn_map_lock);
     for (auto& it : _txn_tablet_map) {
-        auto txn_info = it.second.find(tablet_info);
-        if (txn_info != it.second.end()) {
-            double diff = difftime(now, txn_info->second.creation_time);
+        for (auto& ij : it.second) {
+            double diff = difftime(now, ij.second.creation_time);
 
 Review comment:
   ij variable name may be a little casual

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org