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


##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -2188,4 +2188,238 @@ std::pair<MetaServiceCode, std::string> 
MetaServiceImpl::get_instance_info(
     return {code, std::move(msg)};
 }
 
+MetaServiceResponseStatus MetaServiceImpl::fix_tablet_stats(std::string 
cloud_unique_id_str,
+                                                            std::string 
table_id_str) {
+    MetaServiceCode code;
+    std::string msg;
+    MetaServiceResponseStatus st;
+
+    // parse params
+    int64_t table_id;
+    try {
+        table_id = std::stoll(table_id_str);
+    } catch (...) {
+        st.set_code(MetaServiceCode::INVALID_ARGUMENT);
+        st.set_msg("Invalid table_id, table_id: " + table_id_str);
+        return st;
+    }
+
+    std::string instance_id = get_instance_id(resource_mgr_, 
cloud_unique_id_str);
+    if (instance_id.empty()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty instance_id";
+        LOG(INFO) << msg << ", cloud_unique_id=" << cloud_unique_id_str;
+        st.set_code(code);
+        st.set_msg(msg);
+        return st;
+    }
+
+    std::unique_ptr<Transaction> txn;
+    TxnErrorCode err = txn_kv_->create_txn(&txn);
+    if (err != TxnErrorCode::TXN_OK) {
+        code = cast_as<ErrCategory::CREATE>(err);
+        msg = fmt::format("failed to create txn");
+        st.set_code(code);
+        st.set_msg(msg);
+        return st;
+    }
+
+    // fix tablet stats code
+    std::string key, val;
+    int64_t start = 0;
+    int64_t end = std::numeric_limits<int64_t>::max() - 1;
+    auto begin_key = stats_tablet_key({instance_id, table_id, start, start, 
start});
+    auto end_key = stats_tablet_key({instance_id, table_id, end, end, end});
+    std::vector<std::pair<std::string, std::string>> stats_kvs;
+    int64_t sub_txn_id = 0;

Review Comment:
   sub_txn_id -> tablet_cnt 



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