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(meta): persist job-level max parallelism & check when ALTER .. SET PARALLELISM #18740

Merged
merged 6 commits into from
Sep 29, 2024

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Sep 26, 2024

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

What's changed and what's your intention?

This is a progress towards #15900.

Persist the max parallelism (vnode count) specified through session variable when a streaming job was created. Use that to check if a future parallelism change (with ALTER .. SET PARALLELISM) is valid, ensuring the behavior is consistent with setting session variable streaming_parallelism when the job was created.

Note that in some cases when there are no-shuffle exchanges between subgraphs, the vnode_count adopted by some fragment may not follow the job's max_parallelism at all. The subtle difference will be addressed when generating the resizing (rescheduling) plans, but it does not affect whether a parallelism change issued by the user should be accepted or rejected, just like how we handle it when creating a new job.

Added e2e tests to reflect the behavior.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

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.

@BugenZhao BugenZhao changed the base branch from main to bz/var-vnode-query-fix September 27, 2024 06:46
Base automatically changed from bz/var-vnode-query-fix to main September 27, 2024 08:25
@BugenZhao BugenZhao changed the title refactor(meta): persist max parallelism of streaming job refactor(meta): persist job-level max parallelism & check when ALTER .. SET PARALLELISM Sep 27, 2024
@BugenZhao BugenZhao marked this pull request as ready for review September 27, 2024 09:12
Comment on lines 686 to 690
// TODO(var-vnode): get correct max parallelism from catalogs.
let max_parallelism = VirtualNode::COUNT_FOR_COMPAT;
let max_parallelism = self
.metadata_manager
.get_table_max_parallelism(table_id)
.await?;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is what's addressed.

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
// The scheduler on the meta service will use this as a hint to decide the vnode count
// for each fragment.
//
// Note that the actual vnode count may be different from this value.
// For example, a no-shuffle exchange between current fragment graph and an existing
// upstream fragment graph requires two fragments to be in the same distribution,
// thus the same vnode count.
uint32 expected_vnode_count = 7;
uint32 max_parallelism = 7;
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I'd like to use vnode_count for all internal occurrences, and only use "max_parallelism" for the user-facing part. Because we (RW developers) are familiar with vnode, so vnode_count sounds like the most straight-forward naming.

Copy link
Member Author

Choose a reason for hiding this comment

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

My major concern is that, vnode_count of a streaming job may not be a physical concept at all. But it's true that prefixing with expected makes it doesn't sounds that confusing. Will change.

Copy link
Member Author

@BugenZhao BugenZhao Sep 29, 2024

Choose a reason for hiding this comment

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

Upon further consideration, I still think max_parallelism is more understandable because it aligns better with existing job attributes like parallelism (or assigned_parallelism). When the scope goes to fragment, it'll still be named as vnode_count.

src/meta/src/stream/stream_graph/fragment.rs Show resolved Hide resolved
src/meta/src/model/stream.rs Show resolved Hide resolved
Copy link
Contributor

@yezizp2012 yezizp2012 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -892,6 +892,24 @@ impl MetadataManager {
}
}

pub async fn get_table_max_parallelism(&self, table_id: TableId) -> MetaResult<usize> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit.

Suggested change
pub async fn get_table_max_parallelism(&self, table_id: TableId) -> MetaResult<usize> {
pub async fn get_job_max_parallelism(&self, table_id: TableId) -> MetaResult<usize> {

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@BugenZhao BugenZhao added this pull request to the merge queue Sep 29, 2024
Merged via the queue into main with commit 5e20f2d Sep 29, 2024
31 of 34 checks passed
@BugenZhao BugenZhao deleted the bz/persist-max-parallelism branch September 29, 2024 10:16
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