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

storage: improve SST builder with FullKey struct #6391

Closed
3 tasks done
hzxa21 opened this issue Nov 16, 2022 · 0 comments · Fixed by #8512
Closed
3 tasks done

storage: improve SST builder with FullKey struct #6391

hzxa21 opened this issue Nov 16, 2022 · 0 comments · Fixed by #8512
Assignees
Milestone

Comments

@hzxa21
Copy link
Collaborator

hzxa21 commented Nov 16, 2022

#6130 introduced a struct for FullKey (#5960):

pub struct TableKey<T: AsRef<[u8]>>(pub T);

pub struct UserKey<T: AsRef<[u8]>> {
    pub table_id: TableId,
    pub table_key: TableKey<T>,
}

pub struct FullKey<T: AsRef<[u8]>> {
    pub user_key: UserKey<T>,
    pub epoch: HummockEpoch,
}

This makes the storage interface clearer to avoid misusage and saves some space by delaying storing shared part (e.g. table_id, epoch) repeatedly in the immutable memory buffer.

However, several improvements can also be done inside SST builder:

  • Let filter key extractor be aware of UserKey struct to avoid unnecessary key copy. We can further maintain per table bloom filter inside a SST to improve efficiency of the bloom filter potentially.
  • Let prefix compression be aware of FullKey struct to avoid unneccessary key copy and allow better compression potentially.
  • minor: let block builder be aware of FullKey struct and append different parts of the key into the block builder buffer sequentially to save unneccessary memory allocation for encoding full key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants