starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

[Enhancement] Support size-tiered compaction for pk

Open sevev opened this issue 1 year ago • 2 comments

Why I'm doing:

This PR supports size-tiered compaction for primary key table to reduce the IO amplification of compaction

What I'm doing:

  1. Add config enable_pk_size_tiered_compaction_strategy to control new policy.
  2. When pick rowsets to do compaction, we separate rowsets into different rowset levels by data size. And merge the rowsets in the same level to reduce IO amplification.

Test

Test Steps:

  1. Initial import of a large rowset.
  2. Import a rowset of 1/1000 size every 1 second, continuously importing 1000 versions.
  3. Calculate the total write volume of compaction.
  • Without Size Tiered Compaction Policy
  Ingestion size total write size Write amplification
1G + insert + 1/1000 747278172 7846420807 10.5
1G + upsert + 1/1000 747278172 9465076121 12.6
  • With Size Tiered Compaction Policy
  Ingestion size total write size Write amplification
1G + insert + 1/1000 747278172 1846699622 2.47
1G + upsert + 1/1000 747278172 1952721141 2.61

What type of PR is this:

  • [ ] BugFix
  • [ ] Feature
  • [x] Enhancement
  • [ ] Refactor
  • [ ] UT
  • [ ] Doc
  • [ ] Tool

Does this PR entail a change in behavior?

  • [x] Yes, this PR will result in a change in behavior.
  • [ ] No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • [ ] Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • [ ] Parameter changes: default values, similar parameters but with different default values
  • [x] Policy changes: use new policy to replace old one, functionality automatically enabled
  • [ ] Feature removed
  • [ ] Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • [x] I have added test cases for my bug fix or my new feature
  • [ ] This pr needs user documentation (for new or modified features or behaviors)
    • [ ] I have added documentation for my new feature or new function
  • [ ] This is a backport pr

Bugfix cherry-pick branch check:

  • [x] I have checked the version labels which the pr will be auto-backported to the target branch
    • [x] 3.2
    • [x] 3.1
    • [ ] 3.0
    • [ ] 2.5

sevev avatar Feb 19 '24 08:02 sevev

[FE Incremental Coverage Report]

:white_check_mark: pass : 0 / 0 (0%)

github-actions[bot] avatar Mar 06 '24 08:03 github-actions[bot]

[BE Incremental Coverage Report]

:white_check_mark: pass : 129 / 144 (89.58%)

file detail

path covered_line new_line coverage not_covered_line_detail
:large_blue_circle: be/src/storage/tablet_updates.cpp 129 144 89.58% [2643, 2644, 2648, 2655, 2656, 2657, 2674, 2675, 2676, 2677, 2767, 2770, 2801, 2802, 3112]

github-actions[bot] avatar Mar 06 '24 08:03 github-actions[bot]

@Mergifyio backport branch-3.2

github-actions[bot] avatar Mar 07 '24 10:03 github-actions[bot]

@Mergifyio backport branch-3.1

github-actions[bot] avatar Mar 07 '24 10:03 github-actions[bot]

backport branch-3.2

✅ Backports have been created

mergify[bot] avatar Mar 07 '24 10:03 mergify[bot]

backport branch-3.1

✅ Backports have been created

mergify[bot] avatar Mar 07 '24 10:03 mergify[bot]