github-actions[bot] commented on code in PR #63900:
URL: https://github.com/apache/doris/pull/63900#discussion_r3465299209
##########
be/src/storage/olap_server.cpp:
##########
@@ -915,38 +920,59 @@ std::vector<TabletCompactionContext>
StorageEngine::_generate_compaction_tasks(
// Even if need_pick_tablet is false, we still need to call
find_best_tablet_to_compaction(),
// So that we can update the max_compaction_score metric.
- if (!data_dir->reach_capacity_limit(0)) {
- uint32_t disk_max_score = 0;
- auto tablet_contexts =
compaction_registry_snapshot.pick_topn_tablets_for_compaction(
- _tablet_manager.get(), data_dir, compaction_type,
- cumulative_compaction_policies, &disk_max_score);
- int concurrent_num = get_concurrent_per_disk(
- disk_max_score, disk_compaction_slot_num(*data_dir,
compaction_type));
- need_pick_tablet = need_generate_compaction_tasks(
- executing_task_num, concurrent_num, compaction_type,
- !compaction_registry_snapshot.has_compaction_task(
- data_dir, CompactionType::CUMULATIVE_COMPACTION));
- for (const auto& context : tablet_contexts) {
- if (context.tablet != nullptr) {
- if (need_pick_tablet) {
- tablet_compaction_contexts.emplace_back(context);
- }
- max_compaction_score = std::max(max_compaction_score,
disk_max_score);
+ if (data_dir->reach_capacity_limit(0)) {
+ skipped_capacity_limited_dir = true;
+ continue;
+ }
+
+ CompactionScoreStats disk_score_stats;
+ auto tablet_contexts =
compaction_registry_snapshot.pick_topn_tablets_for_compaction(
+ _tablet_manager.get(), data_dir, compaction_type,
cumulative_compaction_policies,
+ &disk_score_stats);
+ max_score_stats.scanned = max_score_stats.scanned ||
disk_score_stats.scanned;
+ max_score_stats.max_score = std::max(max_score_stats.max_score,
disk_score_stats.max_score);
+ max_score_stats.size_based_max_score =
std::max(max_score_stats.size_based_max_score,
+
disk_score_stats.size_based_max_score);
+ max_score_stats.time_series_max_score =
std::max(max_score_stats.time_series_max_score,
+
disk_score_stats.time_series_max_score);
+ int concurrent_num = get_concurrent_per_disk(
+ disk_score_stats.max_score,
disk_compaction_slot_num(*data_dir, compaction_type));
+ need_pick_tablet = need_generate_compaction_tasks(
+ executing_task_num, concurrent_num, compaction_type,
+ !compaction_registry_snapshot.has_compaction_task(
+ data_dir, CompactionType::CUMULATIVE_COMPACTION));
+ for (const auto& context : tablet_contexts) {
+ if (context.tablet != nullptr) {
+ if (need_pick_tablet) {
+ tablet_compaction_contexts.emplace_back(context);
}
}
}
}
- if (max_compaction_score > 0) {
- if (compaction_type == CompactionType::BASE_COMPACTION) {
+ if (max_score_stats.scanned) {
+ if (compaction_type == CompactionType::BASE_COMPACTION &&
max_score_stats.max_score > 0) {
DorisMetrics::instance()->tablet_base_max_compaction_score->set_value(
- max_compaction_score);
+ max_score_stats.max_score);
} else if (compaction_type == CompactionType::CUMULATIVE_COMPACTION) {
-
DorisMetrics::instance()->tablet_cumulative_max_compaction_score->set_value(
- max_compaction_score);
- } else if (compaction_type == CompactionType::BINLOG_COMPACTION) {
+ auto update_policy_score = [skipped_capacity_limited_dir,
check_score](IntGauge* metric,
+
int64_t score) {
+ if (skipped_capacity_limited_dir) {
+ if (score > metric->value()) {
+ metric->set_value(score);
+ }
+ } else if (check_score || score > 0) {
+ metric->set_value(score);
Review Comment:
`tablet_cumulative_max_compaction_score` is an existing exported BE metric,
but after this change it no longer means "max cumulative compaction score"; it
only tracks size-based cumulative scores while time-series backlog moves to
`tablet_time_series_max_compaction_score`. In the base code this same metric
was fed from the single aggregate cumulative `max_compaction_score`, so
existing dashboards/alerts will silently miss time-series tablets after upgrade
unless they know to query both metrics. Please either keep the old metric as
the aggregate for compatibility and add a new size-based-specific metric, or
document/release-note this as a metric semantic break.
--
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]