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(storage): Splitting table change log from HummockVersion on CN side #20050

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Li0k
Copy link
Contributor

@Li0k Li0k commented Jan 7, 2025

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

What's changed and what's your intention?

This PR optimize clone behavior on the CN side. Split the table change log from the hummock version to avoid copying all table change logs at each version delta.

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • My PR contains critical fixes that are necessary to be merged into the latest release.

Documentation

  • My PR needs documentation updates.
Release note

@Li0k Li0k changed the title feat(storage): Splitting table change log from HummockVersion on CN side WIP: feat(storage): Splitting table change log from HummockVersion on CN side Jan 7, 2025
@Li0k Li0k changed the title WIP: feat(storage): Splitting table change log from HummockVersion on CN side feat(storage): Splitting table change log from HummockVersion on CN side Jan 7, 2025
@Li0k Li0k requested review from wenym1, hzxa21 and zwang28 and removed request for wenym1 and hzxa21 January 7, 2025 08:45
@Li0k Li0k requested a review from hzxa21 January 7, 2025 08:45
guard: Arc::new(PinnedVersionGuard::new(
version_id,
self.guard.pinned_version_manager_tx.clone(),
)),
table_change_log: Arc::new(RwLock::new(t)),
version: Arc::new(LocalHummockVersion::from(version)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I just want to leave a note here.

This LocalHummockVersion::from is an addtional HummockVersion conversion introduced by this PR. However I don't think it will have significant performance implications, as it primarily involves move semantics.

let change_log = {
let table_change_logs = version.table_change_log().read();
if let Some(change_log) = table_change_logs.get(&options.table_id) {
change_log.filter_epoch(epoch_range).cloned().collect_vec()
Copy link
Contributor

@zwang28 zwang28 Jan 8, 2025

Choose a reason for hiding this comment

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

This cloned() is an additional cost introduced in this PR.

If multiple iter_log are running simultaneously, will the memory usage be substantial?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @wenym1 , suggests that iter_log is executed less frequently and that this clone is acceptable.

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.

2 participants