wyxxxcat commented on code in PR #54527:
URL: https://github.com/apache/doris/pull/54527#discussion_r2284210950


##########
cloud/src/recycler/meta_checker.cpp:
##########
@@ -356,6 +355,186 @@ bool MetaChecker::do_meta_schema_key_check(MYSQL* conn) {
     return check_res;
 }
 
+bool MetaChecker::do_version_partition_key_check(MYSQL* conn) {
+    std::vector<PartitionInfo> partitions_info;
+    bool check_res = true;
+
+    // scan and collect tablet_idx
+    std::string start_key;
+    std::string end_key;
+    partition_version_key({instance_id_, 0, 0, 0}, &start_key);
+    partition_version_key({instance_id_, INT64_MAX, 0, 0}, &end_key);
+    scan_and_handle_kv(
+            start_key, end_key,
+            [&partitions_info](std::string_view key, std::string_view value) 
-> int {
+                VersionPB partition_version;
+                if (!partition_version.ParseFromArray(value.data(), 
value.size())) {
+                    LOG(WARNING) << "malformed tablet index value";
+                    return -1;
+                }
+                auto k1 = key;
+                k1.remove_prefix(1);
+                // 0x01 "version" ${instance_id} "partition" ${db_id} 
${tbl_id} ${partition_id}
+                std::vector<std::tuple<std::variant<int64_t, std::string>, 
int, int>> out;
+                decode_key(&k1, &out);
+                DCHECK_EQ(out.size(), 6) << key;
+                auto db_id = std::get<int64_t>(std::get<0>(out[3]));
+                auto table_id = std::get<int64_t>(std::get<0>(out[4]));
+                auto partition_id = std::get<int64_t>(std::get<0>(out[5]));
+                partitions_info.emplace_back(PartitionInfo {
+                        .db_id = db_id, .table_id = table_id, .partition_id = 
partition_id});
+                return 0;
+            });
+
+    for (const auto& partition_info : partitions_info) {
+        if (!db_meta_.contains(partition_info.db_id)) {
+            LOG(WARNING) << "partition_info.db_id not found in fe meta, db_id 
= "
+                         << partition_info.db_id
+                         << "partition_info meta: " << 
partition_info.debug_string();
+            continue;

Review Comment:
   should check for failure



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