-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cdc): auto schema change for mysql cdc (#17876)
- Loading branch information
Showing
71 changed files
with
1,086 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
control substitution on | ||
|
||
system ok | ||
mysql -e "DROP DATABASE IF EXISTS mytest; CREATE DATABASE mytest;" | ||
|
||
system ok | ||
mysql -e " | ||
USE mytest; | ||
DROP TABLE IF EXISTS customers; | ||
CREATE TABLE customers( | ||
id BIGINT PRIMARY KEY, | ||
modified DATETIME, | ||
custinfo JSON | ||
); | ||
ALTER TABLE customers ADD INDEX zipsa( (CAST(custinfo->'zipcode' AS UNSIGNED ARRAY)) ); | ||
" | ||
|
||
statement ok | ||
create source mysql_source with ( | ||
connector = 'mysql-cdc', | ||
hostname = '${MYSQL_HOST:localhost}', | ||
port = '${MYSQL_TCP_PORT:8306}', | ||
username = 'root', | ||
password = '${MYSQL_PWD:}', | ||
database.name = 'mytest', | ||
server.id = '5701', | ||
auto.schema.change = 'true' | ||
); | ||
|
||
statement ok | ||
create table rw_customers (id bigint, modified timestamp, custinfo jsonb, primary key (id)) from mysql_source table 'mytest.customers'; | ||
|
||
# Name, Type, Is Hidden, Description | ||
query TTTT | ||
describe rw_customers; | ||
---- | ||
id bigint false NULL | ||
modified timestamp without time zone false NULL | ||
custinfo jsonb false NULL | ||
primary key id NULL NULL | ||
distribution key id NULL NULL | ||
table description rw_customers NULL NULL | ||
|
||
|
||
system ok | ||
mysql -e " | ||
USE mytest; | ||
ALTER TABLE customers ADD COLUMN v1 VARCHAR(255); | ||
ALTER TABLE customers ADD COLUMN v2 double(5,2); | ||
" | ||
|
||
sleep 3s | ||
|
||
# Name, Type, Is Hidden, Description | ||
query TTTT | ||
describe rw_customers; | ||
---- | ||
id bigint false NULL | ||
modified timestamp without time zone false NULL | ||
custinfo jsonb false NULL | ||
v1 character varying false NULL | ||
v2 double precision false NULL | ||
primary key id NULL NULL | ||
distribution key id NULL NULL | ||
table description rw_customers NULL NULL | ||
|
||
|
||
statement ok | ||
drop source mysql_source cascade; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
syntax = "proto3"; | ||
|
||
package frontend_service; | ||
|
||
import "ddl_service.proto"; | ||
|
||
option java_package = "com.risingwave.proto"; | ||
option optimize_for = SPEED; | ||
|
||
message GetTableReplacePlanRequest { | ||
uint32 database_id = 1; | ||
uint32 owner = 2; | ||
string table_name = 3; | ||
ddl_service.TableSchemaChange table_change = 4; | ||
} | ||
|
||
message GetTableReplacePlanResponse { | ||
ddl_service.ReplaceTablePlan replace_plan = 1; | ||
} | ||
|
||
service FrontendService { | ||
rpc GetTableReplacePlan(GetTableReplacePlanRequest) returns (GetTableReplacePlanResponse); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.