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

feat(meta): initiate static compaction groups #2952

Merged
merged 15 commits into from
Jun 7, 2022

Conversation

zwang28
Copy link
Contributor

@zwang28 zwang28 commented Jun 1, 2022

What's changed and what's your intention?

Changes:

  • Create 2 static compaction groups in meta node. Compaction group is maintained via 2 mappings in HummockManager and CompactionGroupManager:

    • compaction_group_id -> CompactStatus. It tells which SSTs are being compacted. It will be updated per compaction, which is relatively frequent.
    • compaction_group_id -> CompactionGroup. It stores registered prefixes, SSTs configuration and compaction strategy configuration. It is updated less frequently than the former mapping.
  • Add a prost CompactionConfig to persist config.

  • Move prost code in compaction module to prost_type.rs.

Checklist

  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

#2065

@zwang28 zwang28 marked this pull request as ready for review June 1, 2022 11:49
@codecov
Copy link

codecov bot commented Jun 2, 2022

Codecov Report

Merging #2952 (b5a835a) into main (db33967) will decrease coverage by 0.00%.
The diff coverage is 79.39%.

@@            Coverage Diff             @@
##             main    #2952      +/-   ##
==========================================
- Coverage   73.21%   73.20%   -0.01%     
==========================================
  Files         726      730       +4     
  Lines       97999    98176     +177     
==========================================
+ Hits        71748    71872     +124     
- Misses      26251    26304      +53     
Flag Coverage Δ
rust 73.20% <79.39%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
src/meta/src/hummock/compaction_scheduler.rs 0.00% <0.00%> (ø)
src/meta/src/hummock/error.rs 0.00% <0.00%> (ø)
src/meta/src/hummock/mock_hummock_meta_client.rs 43.82% <0.00%> (ø)
src/meta/src/hummock/mod.rs 20.83% <ø> (ø)
src/meta/src/rpc/server.rs 0.00% <0.00%> (ø)
src/storage/hummock_sdk/src/lib.rs 70.00% <ø> (ø)
src/meta/src/hummock/compaction_group/mod.rs 55.55% <55.55%> (ø)
...rc/storage/hummock_sdk/src/compaction_group/mod.rs 64.70% <60.00%> (-13.87%) ⬇️
src/meta/src/hummock/hummock_manager_tests.rs 90.08% <78.94%> (-0.08%) ⬇️
src/meta/src/hummock/hummock_manager.rs 86.96% <79.41%> (-0.05%) ⬇️
... and 23 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@zwang28 zwang28 mentioned this pull request Jun 2, 2022
9 tasks
Copy link
Contributor

@soundOfDestiny soundOfDestiny left a comment

Choose a reason for hiding this comment

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

lgtm after discussion with @zwang28

@@ -69,10 +67,7 @@ pub struct DynamicLevelSelector {
impl Default for DynamicLevelSelector {
fn default() -> Self {
let config = Arc::new(CompactionConfig::default());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not store ProstCompactionConfig directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not convenient to add new methods for ProstCompactionConfig, so I'd like to keep CompactionConfig.

Copy link
Contributor

Choose a reason for hiding this comment

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

No.... Config is a lightweight structure, we do no need add too many methods for it

Copy link
Contributor Author

@zwang28 zwang28 Jun 7, 2022

Choose a reason for hiding this comment

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

Fixed. Removed the wrapper type CompactionConfig.

let current_version = self.versioning.read().await.current_version();
let compact_task = compact_status
.get_compact_task(&current_version.levels, task_id as HummockCompactionTaskId);
let compact_task = compact_status.get_compact_task(
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought the levels of each group would be split and independent....
So how could we filter the files by group_id?

Copy link
Contributor Author

@zwang28 zwang28 Jun 6, 2022

Choose a reason for hiding this comment

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

I thought the levels of each group would be split and independent....

Yes logically they are.

So how could we filter the files by group_id?

I was thinking about identifying a file's group_id by

  • either its key range. It requires both the key range's left and right are valid key from this file.
  • or a group_id field in its meta.

Let me consider splitting them physically as you mentioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need a way to identify a file's group anyway. For example, even if we physically split groups' levels, we need to know each new files' groups in commit_epoch.
Therefore, I prefer to not split groups' levels physically. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's split levels by compaction group id in HummockVersion in following PR.

zwang28 added 3 commits June 6, 2022 15:35
# Conflicts:
#	src/meta/src/hummock/compaction/mod.rs
#	src/meta/src/hummock/compaction/tier_compaction_picker.rs
#	src/meta/src/hummock/hummock_manager.rs
Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

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

LGTM.

@zwang28 zwang28 merged commit 2e4924c into main Jun 7, 2022
@zwang28 zwang28 deleted the wangzheng/feat_compaction_group_meta branch June 7, 2022 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants