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: alter column for table with connector #12164

Merged
merged 7 commits into from Sep 12, 2023
Merged

Conversation

wugouzi
Copy link
Contributor

@wugouzi wugouzi commented Sep 8, 2023

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

What's changed and what's your intention?

Support alter add column for table with non-schema-registry source. Syntax is

alter table (table name) add column (column name) (column type);

Idea is simply rebuilding the source executor with latest split info from source manager.

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 Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

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.

@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #12164 (268c55b) into main (53611bf) will decrease coverage by 0.04%.
The diff coverage is 16.04%.

@@            Coverage Diff             @@
##             main   #12164      +/-   ##
==========================================
- Coverage   69.78%   69.75%   -0.04%     
==========================================
  Files        1409     1409              
  Lines      235804   235916     +112     
==========================================
  Hits       164553   164553              
- Misses      71251    71363     +112     
Flag Coverage Δ
rust 69.75% <16.04%> (-0.04%) ⬇️

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

Files Changed Coverage Δ
src/frontend/src/catalog/catalog_service.rs 3.65% <0.00%> (-0.02%) ⬇️
src/frontend/src/handler/alter_source_column.rs 85.38% <0.00%> (-3.42%) ⬇️
src/frontend/src/handler/util.rs 87.95% <ø> (ø)
src/meta/src/barrier/command.rs 33.89% <0.00%> (-0.59%) ⬇️
src/meta/src/manager/catalog/mod.rs 27.91% <0.00%> (-0.55%) ⬇️
src/meta/src/rpc/ddl_controller.rs 0.00% <0.00%> (ø)
src/meta/src/rpc/service/ddl_service.rs 0.00% <0.00%> (ø)
src/meta/src/stream/stream_manager.rs 73.52% <0.00%> (-0.50%) ⬇️
src/rpc_client/src/meta_client.rs 4.15% <0.00%> (-0.01%) ⬇️
src/frontend/src/handler/alter_table_column.rs 69.29% <48.97%> (-5.95%) ⬇️
... and 2 more

... and 3 files with indirect coverage changes

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

@@ -483,13 +483,19 @@ impl GlobalStreamManager {

let dummy_table_id = table_fragments.table_id();

let init_split_assignment = self
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of these code? Would you mind adding some comments here?

Copy link
Member

Choose a reason for hiding this comment

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

+1. Do we have to do this during Replace? Should the splits be already allocated when creating the altered (dummy) table?

Need help from source experts! cc @tabVersion @shanicky

Copy link
Contributor Author

@wugouzi wugouzi Sep 12, 2023

Choose a reason for hiding this comment

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

Yes we need to do this since for source executors, the split info is only fetched via barriers. And for Replace, the barrier is the Update mutation from ReplaceTable, which means it needs the split info to make source executors start to read. pre_allocate_splits does two things: fetch latest discovered splits and allocate.

Splits are not allocated until this line IIUC.

I think this line is just like what we do in creating table👀

Copy link
Contributor

Choose a reason for hiding this comment

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

since we change the fragment and it seems to be a new entry for source info, we need to call this func to persist meta data into etcd.

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.

Rest LGTM

src/meta/src/manager/catalog/mod.rs Outdated Show resolved Hide resolved
src/meta/src/rpc/service/ddl_service.rs Outdated Show resolved Hide resolved
@@ -483,13 +483,19 @@ impl GlobalStreamManager {

let dummy_table_id = table_fragments.table_id();

let init_split_assignment = self
Copy link
Member

Choose a reason for hiding this comment

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

+1. Do we have to do this during Replace? Should the splits be already allocated when creating the altered (dummy) table?

Need help from source experts! cc @tabVersion @shanicky

Copy link
Contributor

@tabVersion tabVersion left a comment

Choose a reason for hiding this comment

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

I think the pr is good enough. lets merge

@wugouzi wugouzi added this pull request to the merge queue Sep 12, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 12, 2023
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.

None yet

4 participants