Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cloud/src/common/bvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ bvar::Adder<int64_t> g_bvar_recycler_instance_recycle_task_concurrency;
// recycler's mbvars
bvar::Adder<int64_t> g_bvar_recycler_instance_running_counter("recycler_instance_running_counter");
// cost time of the last whole recycle process
mBvarStatus<int64_t> g_bvar_recycler_instance_last_recycle_duration("recycler_instance_last_recycle_duration",{"instance_id"});
mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_recycle_duration("recycler_instance_last_round_recycle_duration",{"instance_id"});
mBvarStatus<int64_t> g_bvar_recycler_instance_next_ts("recycler_instance_next_ts",{"instance_id"});
// start and end timestamps of the recycle process
mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_st_ts("recycler_instance_recycle_st_ts",{"instance_id"});
mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_ed_ts("recycler_instance_recycle_ed_ts",{"instance_id"});
mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_start_ts("recycler_instance_recycle_start_ts",{"instance_id"});
mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_end_ts("recycler_instance_recycle_end_ts",{"instance_id"});
mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_last_success_ts("recycler_instance_recycle_last_success_ts",{"instance_id"});

// recycler's mbvars
Expand Down
6 changes: 3 additions & 3 deletions cloud/src/common/bvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_expired_txn_label_earl
extern bvar::Status<int64_t> g_bvar_recycler_task_max_concurrency;
extern bvar::Adder<int64_t> g_bvar_recycler_instance_recycle_task_concurrency;
extern bvar::Adder<int64_t> g_bvar_recycler_instance_running_counter;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_recycle_duration;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_recycle_duration;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_next_ts;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_st_ts;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_ed_ts;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_start_ts;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_end_ts;
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_last_success_ts;

extern mBvarIntAdder g_bvar_recycler_vault_recycle_status;
Expand Down
4 changes: 3 additions & 1 deletion cloud/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ CONF_Strings(recycle_whitelist, ""); // Comma seprated list
CONF_Strings(recycle_blacklist, ""); // Comma seprated list
// IO worker thread pool concurrency: object list, delete
CONF_mInt32(instance_recycler_worker_pool_size, "32");
// The worker pool size for http api `statistics_recycle` worker pool
CONF_mInt32(instance_recycler_statistics_recycle_worker_pool_size, "5");
CONF_Bool(enable_checker, "false");
// The parallelism for parallel recycle operation
// s3_producer_pool recycle_tablet_pool, delete single object in this pool
Expand All @@ -105,7 +107,7 @@ CONF_mInt32(scan_instances_interval_seconds, "60"); // 1min
// interval for check object
CONF_mInt32(check_object_interval_seconds, "43200"); // 12hours
// enable recycler metrics statistics
CONF_Bool(enable_recycler_metrics, "false");
CONF_Bool(enable_recycler_stats_metrics, "false");

CONF_mInt64(check_recycle_task_interval_seconds, "600"); // 10min
CONF_mInt64(recycler_sleep_before_scheduling_seconds, "60");
Expand Down
1,532 changes: 859 additions & 673 deletions cloud/src/recycler/recycler.cpp

Large diffs are not rendered by default.

55 changes: 36 additions & 19 deletions cloud/src/recycler/recycler.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ class InstanceRecycler {

bool check_recycle_tasks();

int scan_and_statistics_indexes();

int scan_and_statistics_partitions();

int scan_and_statistics_rowsets();

int scan_and_statistics_tmp_rowsets();

int scan_and_statistics_abort_timeout_txn();

int scan_and_statistics_expired_txn_label();

int scan_and_statistics_copy_jobs();

int scan_and_statistics_stage();

int scan_and_statistics_expired_stage_objects();

int scan_and_statistics_versions();

private:
// returns 0 for success otherwise error
int init_obj_store_accessors();
Expand All @@ -222,13 +242,6 @@ class InstanceRecycler {
std::function<int(std::string_view k, std::string_view v)> recycle_func,
std::function<int()> loop_done = nullptr);

int scan_for_recycle_and_statistics(
std::string begin, std::string_view end, std::string task_name,
RecyclerMetricsContext& metrics_context,
std::function<int(std::string_view k, std::string_view v)> statistics_func,
std::function<int(std::string_view k, std::string_view v)> recycle_func,
std::function<int()> loop_done = nullptr);

// return 0 for success otherwise error
int delete_rowset_data(const doris::RowsetMetaCloudPB& rs_meta_pb);

Expand Down Expand Up @@ -363,30 +376,34 @@ class RecyclerMetricsContext {
// `is_begin` is used to initialize total num of items need to be recycled
void report(bool is_begin = false) {
if (!operation_type.empty()) {
if (total_need_recycle_data_size > 0) {
// is init
if (is_begin) {
// is init
if (is_begin) {
if (total_need_recycle_data_size) {
g_bvar_recycler_instance_last_round_to_recycle_bytes.put(
{instance_id, operation_type}, total_need_recycle_data_size);
} else {
}
} else {
if (total_recycled_data_size.load()) {
g_bvar_recycler_instance_last_round_recycled_bytes.put(
{instance_id, operation_type}, total_recycled_data_size.load());
g_bvar_recycler_instance_recycle_total_bytes_since_started.put(
{instance_id, operation_type}, total_recycled_data_size.load());
}
g_bvar_recycler_instance_recycle_total_bytes_since_started.put(
{instance_id, operation_type}, total_recycled_data_size.load());
}

if (total_need_recycle_num > 0) {
// is init
if (is_begin) {
// is init
if (is_begin) {
if (total_need_recycle_num) {
g_bvar_recycler_instance_last_round_to_recycle_num.put(
{instance_id, operation_type}, total_need_recycle_num);
} else {
}
} else {
if (total_recycled_num.load()) {
g_bvar_recycler_instance_last_round_recycled_num.put(
{instance_id, operation_type}, total_recycled_num.load());
g_bvar_recycler_instance_recycle_total_num_since_started.put(
{instance_id, operation_type}, total_recycled_num.load());
}
g_bvar_recycler_instance_recycle_total_num_since_started.put(
{instance_id, operation_type}, total_recycled_num.load());
}
}
}
Expand Down
Loading
Loading