gavinchou commented on code in PR #54620:
URL: https://github.com/apache/doris/pull/54620#discussion_r2288882632


##########
cloud/src/recycler/checker.cpp:
##########
@@ -1746,4 +1754,250 @@ int InstanceChecker::do_mow_job_key_check() {
     return 0;
 }
 
+int InstanceChecker::check_txn_info_key(std::string& start_key, const 
std::string& end_key) {
+    return scan_and_handle_kv(
+            start_key, end_key, [&](std::string_view key, std::string_view 
value) -> int {
+                TxnLabelPB txn_label_pb;
+                std::string_view k1 = key;
+                k1.remove_prefix(1);
+                std::vector<std::tuple<std::variant<int64_t, std::string>, 
int, int>> out;
+                decode_key(&k1, &out);
+                // 0x01 "txn" ${instance_id} "txn_label" ${db_id} ${label}
+                if (!txn_label_pb.ParseFromArray(value.data(), value.size() - 
VERSION_STAMP_LEN)) {
+                    LOG(WARNING) << "failed to parse TxnLabelPB";
+                    return -1;
+                }
+                auto db_id = std::get<int64_t>(std::get<0>(out[3]));
+                auto label = std::get<std::string>(std::get<0>(out[4]));
+                // txn_id -> txn_label
+                std::unordered_map<int64_t, std::string> txn_info_;
+                for (const auto& txn_id : txn_label_pb.txn_ids()) {
+                    txn_info_.insert({txn_id, label});
+                }
+                std::string txn_info_key_begin = txn_info_key({instance_id_, 
db_id, 0});
+                std::string txn_info_key_end = txn_info_key({instance_id_, 
db_id, INT64_MAX});
+                // clang-format off
+                return scan_and_handle_kv(txn_info_key_begin, txn_info_key_end,

Review Comment:
   do not nest large lambda, hard to read and understand



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