gavinchou commented on code in PR #41782:
URL: https://github.com/apache/doris/pull/41782#discussion_r1803020349
##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -2188,4 +2188,93 @@ std::pair<MetaServiceCode, std::string>
MetaServiceImpl::get_instance_info(
return {code, std::move(msg)};
}
+void MetaServiceImpl::fix_tablet_stats(::google::protobuf::RpcController*
controller,
+ const FixTabletStatsRequest* request,
+ FixTabletStatsResponse* response,
+ ::google::protobuf::Closure* done) {
+ RPC_PREPROCESS(fix_tablet_stats);
+ instance_id = get_instance_id(resource_mgr_, request->cloud_unique_id());
+ if (instance_id.empty()) {
+ code = MetaServiceCode::INVALID_ARGUMENT;
+ msg = "empty instance_id";
+ LOG(INFO) << msg << ", cloud_unique_id=" << request->cloud_unique_id();
+ return;
+ }
+ RPC_RATE_LIMIT(fix_tablet_stats)
+
+ 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");
+ return;
+ }
+ for (const auto& i : request->table_id()) {
+ int64_t table_id = i;
+ 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;
+
+ std::unique_ptr<RangeGetIterator> it;
+ do {
Review Comment:
this loop may be too large to execute, it may lead to extream large txn
which may last more than 5 seconds and more than 10MB
--
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]