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: support pick ssts in compact #1603

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

baojinri
Copy link
Contributor

@baojinri baojinri commented Dec 6, 2024

Rationale

Implement pick_candidate for compaction

Detailed Changes

Test Plan

UT

@github-actions github-actions bot added the feature New feature or request label Dec 6, 2024
@baojinri baojinri marked this pull request as ready for review December 9, 2024 06:51
for key in all_keys.into_iter().rev() {
if let Some(bucket) = buckets.get(key) {
if bucket.len() >= 2 {
compact_files = bucket.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to limit input compact files, also we should compact smaller files first.

Copy link
Contributor

Choose a reason for hiding this comment

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

We a SST is picked, we should mark it in compacting, so it won't got compacted twice.

Comment on lines 78 to 80
pub fn is_uncompacted(&self) -> bool {
!self.inner.in_compaction.load(Ordering::Relaxed)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn is_uncompacted(&self) -> bool {
!self.inner.in_compaction.load(Ordering::Relaxed)
}
pub fn is_compaction(&self) -> bool {
self.inner.in_compaction.load(Ordering::Relaxed)
}

Negate this bool inside this function is not very readable.


let bucket_files = buckets.entry(left).or_default();

bucket_files.push(f.id());
Copy link
Contributor

Choose a reason for hiding this comment

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

FileId is not suitable here, we need to mutate sst inner state, so a Task should hold SstFile

buckets
}

fn get_window_bounds(&self, ts: Timestamp) -> (i64, i64) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add UT for this function.

@baojinri baojinri force-pushed the feat-support-pick-ssts branch from f579c45 to ef04238 Compare December 11, 2024 12:45
Copy link
Contributor

@jiacai2050 jiacai2050 left a comment

Choose a reason for hiding this comment

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

LGTM

@jiacai2050 jiacai2050 merged commit 4d8571f into apache:main Dec 11, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants