Skip to content

feat(meta): support ddl progress - #7914

Merged
mergify[bot] merged 7 commits into
mainfrom
dylan/support_ddl_progress
Feb 16, 2023
Merged

mergify[bot] merged 7 commits into
mainfrom
dylan/support_ddl_progress

Conversation

@chenzl25

@chenzl25 chenzl25 commented Feb 14, 2023 •

Copy link
Copy Markdown
Contributor

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

What's changed and what's your intention?

  • Support rw_catalog.rw_ddl_progress to show ddl progress.
  • Calculate creating mv progress based on the sum of consumed records and upstream total key count.
  • Each query of rw_ddl_progress will fetch active ddl progress from meta by the rpc method get_ddl_progress.

Example

dev=> select * from rw_catalog.rw_ddl_progress;
 ddl_id |         ddl_statement         | progress
--------+-------------------------------+----------
   1026 | CREATE INDEX idx ON sbtest1(c) | 69.02%
(1 row)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features).
  • I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • SQL commands, functions, and operators

Release note

  • Support rw_catalog.rw_ddl_progress to show ddl progress.

closes #7418

@chenzl25 chenzl25 added the user-facing-changes Contains changes that are visible to users label Feb 14, 2023
@chenzl25 chenzl25 changed the title support ddl progress feat(meta): support ddl progress Feb 14, 2023
@github-actions github-actions Bot added type/feature Type: New feature. and removed Invalid PR Title labels Feb 14, 2023
@chenzl25
chenzl25 requested a review from hzxa21 February 14, 2023 08:05
@codecov

codecov Bot commented Feb 14, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #7914 (b29f3bf) into main (94f56e5) will decrease coverage by 0.06%.
The diff coverage is 15.84%.

@@            Coverage Diff             @@
##             main    #7914      +/-   ##
==========================================
- Coverage   71.61%   71.56%   -0.06%     
==========================================
  Files        1116     1116              
  Lines      179648   179819     +171     
==========================================
+ Hits       128660   128686      +26     
- Misses      50988    51133     +145     
Flag Coverage Δ
rust 71.56% <15.84%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
...ntend/src/catalog/system_catalog/pg_catalog/mod.rs 0.00% <0.00%> (ø)
src/frontend/src/meta_client.rs 0.00% <0.00%> (ø)
src/frontend/src/test_utils.rs 82.36% <0.00%> (-0.44%) ⬇️
src/meta/src/manager/streaming_job.rs 22.47% <0.00%> (-0.26%) ⬇️
src/meta/src/rpc/service/ddl_service.rs 0.00% <0.00%> (ø)
src/rpc_client/src/meta_client.rs 6.99% <0.00%> (-0.04%) ⬇️
src/stream/src/executor/backfill.rs 0.00% <ø> (ø)
src/stream/src/executor/rearranged_chain.rs 0.00% <ø> (ø)
...c/stream/src/task/barrier_manager/managed_state.rs 85.01% <0.00%> (-0.75%) ⬇️
src/stream/src/task/barrier_manager/progress.rs 53.52% <0.00%> (-7.77%) ⬇️
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@yezizp2012 yezizp2012 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!!!

@BugenZhao

Copy link
Copy Markdown
Contributor

Will review it later. 🥰

@tabVersion

Copy link
Copy Markdown
Contributor

sink executor also relies on the chain executor, can it help to see the progress of creating sink?

@chenzl25

Copy link
Copy Markdown
Contributor Author

sink executor also relies on the chain executor, can it help to see the progress of creating sink?

Yes, it can show progress of creating table, mv, index and sink.

@BugenZhao BugenZhao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rest LGTM. Good work!

Comment thread src/stream/src/task/barrier_manager/progress.rs Outdated
let consumed_rows = match self.state {
Some(ChainState::ConsumingUpstream(last, consumed_row)) => {
assert!(last < consumed_epoch);
consumed_row + rows

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems the rows is an accumulated value, and there's no need to sum them up here? 👀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For backfill executor, it is not an accumulated value, but make it an accumulated value seems clearer. Let's change it.

}
ChainState::Done => panic!("should not report done multiple times"),
}
self.calculate_progress();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about only calculating in-place when gen_ddl_progress, so that we don't need to maintain one more field?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually I use it as a state to ensure the progress value will never go down, because the calculation itself doesn't guarantee the monotonicity.

Comment on lines 36 to 38
ConsumingSnapshot,
ConsumingUpstream(Epoch),
ConsumingUpstream(Epoch, ConsumedRows),
Done,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is originally designed for the rearranged-chain, and it seems not much consistent with the current backfill logic. For example, ConsumingSnapshot is never used. We can clean it up in the future if unnecessary. 😄

Comment on lines +63 to +64
/// DDL definition.
pub definition: String,

@BugenZhao BugenZhao Feb 15, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest we directly put the stream_job in the context, so that definition and table_properties can be covered. Let's refactor this in the future.

* version_stats
.table_stats
.get(&upstream_mv.table_id)
.map_or(0, |stat| stat.total_key_count as u64)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hummock's stats are for the total keys, including the historical ones. Assuming that there're a lot of Updates in the upstream mview, if the rows come from the "upstream", we'll count them correctly, but for those from "snapshot", a single consumed row may correspond to multiple historical rows in the stats. Not sure whether this impacts a lot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, our progress calculation is an approximate value instead of accurate value. It is hard to calculate the accurate value based on what we have currently. From the user perspective, I think they will care about the DDL will take a long time that is the snapshot contains a large amount of data. In this case, I hope with the help of compaction, we can guarantee the total key count will not exceed (for example) 30% of the actual key count. BTW, if total key count is larger than the actual key count, our calculated progress number is smaller than the actual progress and this is acceptable as long as we provide a lower bound value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/feature Type: New feature. user-facing-changes Contains changes that are visible to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discussion: allow users be aware of the progress of consuming upstream data

4 participants