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

refactor: ensure update vnode bitmap after yield barrier #20218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wenym1
Copy link
Contributor

@wenym1 wenym1 commented Jan 20, 2025

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

What's changed and what's your intention?

Part of #18312.

As described in #18312, we should ensure a correct handling order as state_table.commit() -> yield barrier -> state_table.update_vnode_bitmap() in streaming executors while update vnode bitmap.

In this PR, for state_table.commit(), we change to return a StateTablePostCommit<'_>, which captures the mutable reference to the original state_table and will be used as a callback after yielding the barrier. The StateTablePostCommit has a method async fn post_yield_barrier(mut self, new_vnodes: Option<Arc<Bitmap>>) to be called after the we yield the barrier.

The StateTablePostCommit is marked with #[must_use]. The method name post_yield_barrier indicates that it should be called after we have yielded the barrier. In state table, we add a flag on_post_commit, to indicate that whether the StateTablePostCommit is handled properly. On state_table.commit(), we will mark the on_post_commit as true, and in StateTablePostCommit::post_yield_barrier, we will remark the flag as false, and on state_table.commit(), we will assert that the on_post_commit must be false. Note that, the post_yield_barrier should be called for all barriers rather than only for the barrier with update vnode bitmap. In this way, though we don't have scale test for all streaming executor, we can ensure that all executor covered by normal e2e test have properly handled the StateTablePostCommit.

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

Copy link

gru-agent bot commented Jan 20, 2025

This pull request has been modified. If you want me to regenerate unit test for any of the files related, please find the file in "Files Changed" tab and add a comment @gru-agent. (The github "Comment on this file" feature is in the upper right corner of each file in "Files Changed" tab.)

@wenym1 wenym1 force-pushed the yiming/state-table-post-yield-update-vnode branch from 7ebc0d1 to 4083a47 Compare February 6, 2025 05:29
@wenym1 wenym1 changed the title refactor: (wip) ensure update vnode bitmap after yield barrier refactor: ensure update vnode bitmap after yield barrier Feb 6, 2025
Copy link
Contributor Author

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

Added some comments for code with logic changed and need more careful review.

.as_mut()
.unwrap()
.commit(barrier.epoch)
.await?;
yield Message::Barrier(barrier);
post_commit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Newly added logic. Previously the vnode bitmap of memo table is not updated, not sure if this is correct or not.

if previous_vnode_bitmap != vnode_bitmap {
need_update_global_max_watermark = true;
}
}

if is_checkpoint && last_checkpoint_watermark != current_watermark {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logic is changed here. Previously write the watermark on the new vnode bitmap. After this PR will write on the original vnode bitmap.


Message::Barrier(b)
continue;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The barrier has been yielded, so we change to continue here.

@wenym1 wenym1 force-pushed the yiming/state-table-post-yield-update-vnode branch from 0d278ab to 9965471 Compare February 7, 2025 05:47
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.

1 participant