gavinchou commented on code in PR #51448:
URL: https://github.com/apache/doris/pull/51448#discussion_r2139389540
##########
cloud/src/recycler/recycler.cpp:
##########
@@ -1651,17 +1845,91 @@ int InstanceRecycler::delete_rowset_data(const
std::vector<doris::RowsetMetaClou
return -1;
}
auto& accessor = accessor_map_[*rid];
- return accessor->delete_files(*paths);
+ int ret = accessor->delete_files(*paths);
+ if (!ret) {
+ std::for_each(
+ paths->begin(), paths->end(),
+ [&total_recycled_rs_size, &total_recycled_rs_num,
+ &rowsets](const std::string& path) {
+ LOG(INFO) << "recycle rowset file, path=" << path;
+ std::vector<std::string> str;
+ butil::SplitString(path, '/', &str);
+ std::string rowset_id;
+ if (auto pos = str.back().find('_'); pos !=
std::string::npos) {
+ rowset_id = str.back().substr(0, pos);
+ } else {
+ LOG(WARNING) << "failed to parse rowset_id,
path=" << path;
+ }
+ if (auto rs_meta = rowsets.find(rowset_id);
rs_meta != rowsets.end()) {
+ if (path.ends_with(".idx") &&
+ rs_meta->second.has_index_disk_size()) {
+ total_recycled_rs_size +=
rs_meta->second.index_disk_size();
+ } else if (path.ends_with(".dat") &&
+
rs_meta->second.has_data_disk_size()) {
+ total_recycled_rs_size +=
rs_meta->second.data_disk_size();
+ }
+ total_recycled_rs_num++;
+ }
+ });
+
+ if (is_formal_rowset) {
+ g_bvar_recycler_instance_recycle_bytes.put(
+ {instance_id_, "rowsets"},
+ std::make_pair(total_recycled_rs_size.load(),
+ total_need_recycle_data_size));
+ g_bvar_recycler_instance_recycle_num.put(
+ {instance_id_, "rowsets"},
+ std::make_pair(total_recycled_rs_num.load(),
+ total_need_recycle_rowset_num));
+ } else {
+ g_bvar_recycler_instance_recycle_bytes.put(
+ {instance_id_, "tmp_rowsets"},
Review Comment:
for all labels
use CONSTANTS instead plain string like "tmp_rowsets"
--
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]