xiaokang commented on code in PR #31488: URL: https://github.com/apache/doris/pull/31488#discussion_r1512076574
########## be/src/olap/cumulative_compaction_time_series_policy.cpp: ########## @@ -70,15 +80,32 @@ uint32_t TimeSeriesCumulativeCompactionPolicy::calc_cumulative_compaction_score( return score; } - // Condition 1: the size of input files for compaction meets the requirement of parameter compaction_goal_size int64_t compaction_goal_size_mbytes = tablet->tablet_meta()->time_series_compaction_goal_size_mbytes(); - if (total_size >= compaction_goal_size_mbytes * 1024 * 1024) { + if (tablet->tablet_meta()->time_series_compaction_level_threshold() == 2) { Review Comment: what about 3? ########## be/src/olap/cumulative_compaction_time_series_policy.cpp: ########## @@ -288,7 +349,40 @@ void TimeSeriesCumulativeCompactionPolicy::update_cumulative_point( return; } + if (tablet->tablet_meta()->time_series_compaction_level_threshold() == 2 && + output_rowset->rowset_meta()->compaction_level() < 2) { + return; + } + tablet->set_cumulative_layer_point(output_rowset->end_version() + 1); } +void TimeSeriesCumulativeCompactionPolicy::update_compaction_level( + Tablet* tablet, const std::vector<RowsetSharedPtr>& input_rowsets, + RowsetSharedPtr output_rowset) { + if (tablet->tablet_state() != TABLET_RUNNING || output_rowset->num_segments() == 0) { + return; + } + + int64_t first_level = 0; + for (size_t i = 0; i < input_rowsets.size(); i++) { + int64_t cur_level = input_rowsets[i]->rowset_meta()->compaction_level(); + if (i == 0) { + first_level = cur_level; + } else { + if (first_level != cur_level) { + LOG(ERROR) << "Failed to check compaction level, first_level: " << first_level + << ", cur_level: " << cur_level; + } + } + } + + if (output_rowset->rowset_meta()->total_disk_size() >= + tablet->tablet_meta()->time_series_compaction_goal_size_mbytes() * 1024 * 1024) { Review Comment: You can use goal_size * percent (eg. 0.6) to avoid compaction for 0.9 + 0.9 ########## be/src/olap/cumulative_compaction_time_series_policy.cpp: ########## @@ -163,6 +190,13 @@ void TimeSeriesCumulativeCompactionPolicy::calculate_cumulative_point( break; } + // upgrade: [0 0 2 1 1 0 0] + if (!is_delete && tablet->tablet_meta()->time_series_compaction_level_threshold() == 2 && + rs->compaction_level() == 1) { Review Comment: what about [2, 2, 0, 0, 0] ########## be/src/agent/task_worker_pool.cpp: ########## @@ -746,6 +746,16 @@ void update_tablet_meta_callback(StorageEngine& engine, const TAgentTaskRequest& tablet_meta_info.time_series_compaction_empty_rowsets_threshold); need_to_save = true; } + if (tablet_meta_info.__isset.time_series_compaction_level_threshold) { + if (tablet->tablet_meta()->compaction_policy() != "time_series") { Review Comment: change "time_series" literal to a const ########## be/src/olap/cumulative_compaction_time_series_policy.cpp: ########## @@ -288,7 +349,40 @@ void TimeSeriesCumulativeCompactionPolicy::update_cumulative_point( return; } + if (tablet->tablet_meta()->time_series_compaction_level_threshold() == 2 && + output_rowset->rowset_meta()->compaction_level() < 2) { + return; + } + tablet->set_cumulative_layer_point(output_rowset->end_version() + 1); } +void TimeSeriesCumulativeCompactionPolicy::update_compaction_level( + Tablet* tablet, const std::vector<RowsetSharedPtr>& input_rowsets, + RowsetSharedPtr output_rowset) { + if (tablet->tablet_state() != TABLET_RUNNING || output_rowset->num_segments() == 0) { + return; + } + + int64_t first_level = 0; + for (size_t i = 0; i < input_rowsets.size(); i++) { + int64_t cur_level = input_rowsets[i]->rowset_meta()->compaction_level(); + if (i == 0) { + first_level = cur_level; + } else { + if (first_level != cur_level) { + LOG(ERROR) << "Failed to check compaction level, first_level: " << first_level Review Comment: What's the effect of LOG(ERROR)? If it just add a log and continue, it's not enough. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org