-
Notifications
You must be signed in to change notification settings - Fork 597
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: Correctly handle the Parallelism inference under the DefaultParallelism configuration. #15543
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @neverchanje PTAL.
If a users explicitly alter a MV to |
// If it's lower, we'll set it to Fixed. | ||
// If it was previously set to Adaptive, but the default_parallelism in the configuration isn’t Full, | ||
// and it matches the actual fragment parallelism, in this case, it will be handled by downgrading to Fixed. | ||
fn derive_target_parallelism( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this function only called when MV is being created? alter mv and create mv are two different handling paths. Only create mv should evaluate default_parallelism
, alter mv should not.
The logic is pretty simple from my understanding.
// Let's divide the handling into two phases:
fn create_mv() {
// handle `default_parallelism` first.
let mut parallelism = match config.default_parallelism {
Some(n) => Fixed(n)
None => Adaptive
};
// Evaluate the sesssion variable "streaming_parallelism".
if let Some(p) = session_variable.streaming_parallelism {
parallelism = p;
}
}
fn alter_mv(p: TableParallelism) {
// `p` will be the target parallelism, no matter what value `default_parallelism` is.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification is made to handle offline scaling during startup recovery, addressing the situation in version 1.7 where new creations using default parallelism with an adaptive policy might exist. This aims to prevent a mass scale-out occurrence immediately after going live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new creations using default parallelism
It sounds good.
I am not familar with the code so I cannot tell if it's correct. Maybe you can manually test it, and make sure:
alter mv
will apply regardless ofdefault_parallelism
.- Restarting the cluster will not change the parallelism of existing materialized views back to
default_parallelism
.
…llelism configuration. (#15543) Signed-off-by: Shanicky Chen <[email protected]>
…llelism configuration. (#15543) Signed-off-by: Shanicky Chen <[email protected]>
…llelism configuration. (#15543) Signed-off-by: Shanicky Chen <[email protected]>
…llelism configuration. (#15543) (#15568) Signed-off-by: Shanicky Chen <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR correctly handles the compatibility between default parallelism and table parallelism.
And during restarts, it automatically scales the logic to address the impacts that may arise from old versions. For instance, when the default parallelism is set to n, older versions may still be set to Adaptive mode. This PR, upon startup, will determine if the actual parallelism is n and will update it to Fixed(n).
Checklist
./risedev check
(or alias,./risedev c
)Documentation
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.