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 correct_commit_ssts with sst table_ids #18414

Merged
merged 9 commits into from
Sep 5, 2024

Conversation

Li0k
Copy link
Contributor

@Li0k Li0k commented Sep 5, 2024

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

What's changed and what's your intention?

The main branch will directly commits the sst directly to both cgs (when match_ids is a subset of group_table_ids) , the sst_id is not changed and something goes wrong when merge is triggered.

) && info.table_ids.binary_search(&table_id.table_id()).is_ok()

Hummock filter_single_sst via binary_search which rely on the ordering of sstable_info.table_ids. I made some mistakes before this PR that broke ordering, so I'm reviewing the code and adding restrictions and doc to ensure ordering of table_ids. Thanks @hzxa21 for help

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • 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.

Copy link
Contributor

@zwang28 zwang28 left a comment

Choose a reason for hiding this comment

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

LGTM

@Li0k Li0k enabled auto-merge September 5, 2024 05:53
@@ -426,15 +426,17 @@ impl HummockManager {
for (mut sst, group_table_ids) in sst_to_cg_vec {
for (group_id, match_ids) in group_table_ids {
let group_members_table_ids = group_members_table_ids.get(&group_id).unwrap();
if match_ids
if sst
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems unnecessary and unclear to put this under the nested for loop. What we want to do here is to avoid SST split if all existing table ids of a sst belong to one and only one compaction group. Therefore, I suggest we put this check before L427 in the outer for loop. IIUC, we only need to check whether group_table_ids.len() == 1.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Btw, do you think we need to modify table_ids and sst_size if group_table_ids.len() == 1 but table_ids in SstableInfo is a super set of group_member_table_ids (i.e. L407 is hit)

@Li0k Li0k added this pull request to the merge queue Sep 5, 2024
@Li0k Li0k removed this pull request from the merge queue due to a manual request Sep 5, 2024
let set1: HashSet<_> = sst_info.table_ids.iter().cloned().collect();
let set2: HashSet<_> = new_sst_table_ids.iter().cloned().collect();
// sst.table_ids = vec[1, 2, 3];
// new.table_ids = vec[2, 3, 4];
Copy link
Collaborator

Choose a reason for hiding this comment

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

nits: new_table_ids

@Li0k Li0k enabled auto-merge September 5, 2024 09:58
@Li0k Li0k added this pull request to the merge queue Sep 5, 2024
Merged via the queue into main with commit 0134191 Sep 5, 2024
30 of 31 checks passed
@Li0k Li0k deleted the li0k/storage_fix_correct_commit_ssts branch September 5, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants