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: Introduce scale-in in recovery. #13270

Merged
merged 10 commits into from
Nov 8, 2023
Merged

feat: Introduce scale-in in recovery. #13270

merged 10 commits into from
Nov 8, 2023

Conversation

shanicky
Copy link
Contributor

@shanicky shanicky commented Nov 6, 2023

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

What's changed and what's your intention?

This PR attempts to replace the original migration scheme by generating an offline scale-in scheme during recovery. This is just a preliminary version, and will be optimized later.

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)

@shanicky shanicky force-pushed the peng/try-gen-scale-in branch 3 times, most recently from 651346d to 52c82c0 Compare November 6, 2023 10:21
Copy link
Member

@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.

Rest LGTM.

src/meta/src/barrier/recovery.rs Outdated Show resolved Hide resolved
src/meta/src/barrier/recovery.rs Outdated Show resolved Hide resolved
src/meta/src/barrier/recovery.rs Outdated Show resolved Hide resolved
let mut cluster = Cluster::start(config.clone()).await?;
let mut session = cluster.start_session();

session.run("CREATE TABLE t1 (v1 int);").await?;
Copy link
Member

Choose a reason for hiding this comment

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

Can we create one more complicated materialized view here, so that we can test no shuffle dispatcher as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a slightly more complex mv, which will also detect single fragment migration.

@shanicky shanicky force-pushed the peng/try-gen-scale-in branch from 3074a7a to 5cf5bb6 Compare November 6, 2023 16:26
@BugenZhao
Copy link
Member

The diff is really hard to review as it does not link scale.rs to scale_controller.rs. 🥵 Is there any way to fix this?

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #13270 (93048da) into main (7b3f8fc) will decrease coverage by 0.03%.
Report is 2 commits behind head on main.
The diff coverage is 9.94%.

@@            Coverage Diff             @@
##             main   #13270      +/-   ##
==========================================
- Coverage   67.76%   67.73%   -0.03%     
==========================================
  Files        1525     1525              
  Lines      259263   259415     +152     
==========================================
+ Hits       175693   175719      +26     
- Misses      83570    83696     +126     
Flag Coverage Δ
rust 67.73% <9.94%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/common/src/config.rs 84.40% <ø> (ø)
src/meta/src/barrier/mod.rs 82.47% <100.00%> (+0.19%) ⬆️
src/meta/src/manager/env.rs 61.97% <100.00%> (+0.19%) ⬆️
src/meta/node/src/lib.rs 1.32% <0.00%> (-0.01%) ⬇️
src/meta/src/barrier/command.rs 34.29% <33.33%> (+3.06%) ⬆️
src/meta/service/src/scale_service.rs 0.00% <0.00%> (ø)
src/meta/src/stream/stream_manager.rs 65.80% <13.72%> (-3.34%) ⬇️
src/meta/src/barrier/recovery.rs 44.42% <6.25%> (-7.61%) ⬇️
src/meta/src/stream/scale.rs 10.50% <6.28%> (+0.53%) ⬆️

... and 5 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@shanicky
Copy link
Contributor Author

shanicky commented Nov 7, 2023

The diff is really hard to review as it does not link scale.rs to scale_controller.rs. 🥵 Is there any way to fix this?

Maybe we can move the code from scale.rs to StreamManager and delete scale.rs, let me try this

Copy link
Member

@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, wait for some review comments from @BugenZhao .

@BugenZhao
Copy link
Member

generating an offline scale-in scheme during recovery

Can we elaborate more on this? Do you mean we won't get stuck if there's no enough parallel units, but a auto scaling-in will be triggered after timeout?

impl GlobalStreamManager {
#[derive(Debug, Clone, Copy)]
pub struct RescheduleOptions {
pub resolve_no_shuffle_upstream: bool,
Copy link
Member

Choose a reason for hiding this comment

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

When will it be false? Could you please leave some documentation here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the previous reschedule implementation, it would throw an error if the provided fragment list had a no shuffle downstream. After PR #10985 , we added this parameter which will automatically resolve to the root of the no shuffle dependency relationship. During recovery, we need this parameter to prevent errors.

Copy link
Member

Choose a reason for hiding this comment

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

Cool.

@shanicky
Copy link
Contributor Author

shanicky commented Nov 8, 2023

generating an offline scale-in scheme during recovery

Can we elaborate more on this? Do you mean we won't get stuck if there's no enough parallel units, but a auto scaling-in will be triggered after timeout?

Indeed, the previous implementation would trigger migration when a machine had been offline for a certain period of time. If there were no available parallel unit clusters, it would get stuck in the recovery state. This PR offers an alternative through offline scaling, which scales in the parallel units on the corresponding machine.

@shanicky shanicky requested a review from BugenZhao November 8, 2023 07:46
Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

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

Great

@shanicky shanicky added this pull request to the merge queue Nov 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2023
@shanicky shanicky added this pull request to the merge queue Nov 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2023
@shanicky shanicky force-pushed the peng/try-gen-scale-in branch from 7edadcc to 93048da Compare November 8, 2023 14:46
@shanicky shanicky enabled auto-merge November 8, 2023 14:47
@shanicky shanicky added this pull request to the merge queue Nov 8, 2023
Merged via the queue into main with commit 306801b Nov 8, 2023
7 checks passed
@shanicky shanicky deleted the peng/try-gen-scale-in branch November 8, 2023 15:31
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.

Recovery supports generating reschedule plans offline and executing them.
3 participants