Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage): fix condition of compaction task validator #12473

Merged
merged 7 commits into from
Sep 25, 2023

Conversation

Li0k
Copy link
Contributor

@Li0k Li0k commented Sep 21, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

When the number of files or levels in a compact task is too large, no other limitations are considered. Data flow on lsm will be smoother.

Otherwise, with some small ssts, it may not be possible to select a sufficient sst size to guarantee to base compaction execution. (The strategy is to ensure that the number of files selected does not exceed the limit, and at the same time the size is larger than the target.)

After the move state table, the sub level is directly inserted into the new cg. Thereafter, the base compaction picker selects a task that does not satisfy the select_level_size > base_level target level size limit based on the max_size limit (write-amp).

The reason for this is that the max_size of the picker is exactly equal to the max_base_level_size, and the size of the selected task will be smaller than the max_base_level_size, so it will not be able to satisfy the write-amp limit. This pr fixes this problem.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@github-actions github-actions bot added the type/fix Bug fix label Sep 21, 2023
@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Merging #12473 (87ec187) into main (d842cfa) will decrease coverage by 0.02%.
The diff coverage is 95.45%.

@@            Coverage Diff             @@
##             main   #12473      +/-   ##
==========================================
- Coverage   69.42%   69.41%   -0.02%     
==========================================
  Files        1429     1429              
  Lines      238628   238640      +12     
==========================================
- Hits       165666   165642      -24     
- Misses      72962    72998      +36     
Flag Coverage Δ
rust 69.41% <95.45%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...ock/compaction/picker/compaction_task_validator.rs 88.61% <95.00%> (+0.22%) ⬆️
.../compaction/picker/base_level_compaction_picker.rs 98.20% <100.00%> (+<0.01%) ⬆️

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hzxa21 hzxa21 changed the title fix(storage): fix condiction of compaction task validator fix(storage): fix condition of compaction task validator Sep 22, 2023
std::cmp::min(
self.config.max_bytes_for_level_base,
std::cmp::max(
(self.config.max_bytes_for_level_base as f64 * 1.2) as u64,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max_compaction_bytes/2 will be larger than self.config.max_bytes_for_level_base. So this change makes no difference

input.total_file_count <= overlapping_max_compact_file_numer
}
};
let waiting_enough_files = input.select_input_size < max_compaction_bytes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be merge with line 117

Copy link
Contributor

@Little-Wallace Little-Wallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

@Li0k Li0k enabled auto-merge September 25, 2023 09:20
@Li0k Li0k added this pull request to the merge queue Sep 25, 2023
Merged via the queue into main with commit 79b5c4c Sep 25, 2023
@Li0k Li0k deleted the li0k/storage_fix_validator branch September 25, 2023 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants