Skip to content

Commit

Permalink
feat!: reduce sorted runs during compaction (GreptimeTeam#3702)
Browse files Browse the repository at this point in the history
* feat: add functions to find and merge sorted runs

* chore: refactor code

* chore: remove some duplicates

* chore: remove one clone

* refactor: change max_active_window_files to max_active_window_runs

* feat: integrate with sorted runs

* fix: unit tests

* feat: limit num of sorted runs during compaction

* fix: some test

* fix: some cr comments

* feat: use smallvec

* chore: rebase main

* feat/reduce-sorted-runs:
 Refactor compaction logic and update test configurations

 - Refactored `merge_all_runs` function to use `sort_ranged_items` for sorting.
 - Improved item merging logic by iterating with `into_iter` and handling overlaps.
 - Updated test configurations to use `max_active_window_runs` instead of `max_active_window_files` for consistency.

---------

Co-authored-by: tison <[email protected]>
  • Loading branch information
2 people authored and zyy17 committed Jun 28, 2024
1 parent 74243a3 commit 0ca97d1
Show file tree
Hide file tree
Showing 12 changed files with 797 additions and 84 deletions.
1 change: 1 addition & 0 deletions src/mito2/src/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
mod buckets;
pub mod compactor;
pub mod picker;
mod run;
mod task;
#[cfg(test)]
mod test_util;
Expand Down
4 changes: 2 additions & 2 deletions src/mito2/src/compaction/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ pub fn new_picker(
} else {
match compaction_options {
CompactionOptions::Twcs(twcs_opts) => Arc::new(TwcsPicker::new(
twcs_opts.max_active_window_files,
twcs_opts.max_inactive_window_files,
twcs_opts.max_active_window_runs,
twcs_opts.max_inactive_window_runs,
twcs_opts.time_window_seconds(),
)) as Arc<_>,
}
Expand Down
Loading

0 comments on commit 0ca97d1

Please sign in to comment.