-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into yiming/remote-log-sinker-refactor
- Loading branch information
Showing
132 changed files
with
3,909 additions
and
910 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,80 @@ | ||
control substitution on | ||
|
||
# create database and tables in mysql | ||
system ok | ||
mysql --protocol=tcp -u root -e "DROP DATABASE IF EXISTS mytest; CREATE DATABASE mytest;" | ||
|
||
system ok | ||
mysql --protocol=tcp -u root mytest < e2e_test/source/cdc/mysql_create.sql | ||
|
||
# enable cdc backfill in ci | ||
statement ok | ||
set cdc_backfill='true'; | ||
|
||
# create a cdc source job, which format fixed to `FORMAT PLAIN ENCODE JSON` | ||
statement ok | ||
create source mysql_mytest with ( | ||
connector = 'mysql-cdc', | ||
hostname = '${MYSQL_HOST:localhost}', | ||
port = '${MYSQL_TCP_PORT:8306}', | ||
username = 'dbz', | ||
password = '${MYSQL_PWD:}', | ||
database.name = 'mytest', | ||
server.id = '5601' | ||
); | ||
|
||
statement ok | ||
create table products_test ( id INT, | ||
name STRING, | ||
description STRING, | ||
PRIMARY KEY (id) | ||
) from mysql_mytest table 'mytest.products'; | ||
|
||
statement ok | ||
create table orders_test ( | ||
order_id int, | ||
order_date timestamp, | ||
customer_name string, | ||
price decimal, | ||
product_id int, | ||
order_status smallint, | ||
PRIMARY KEY (order_id) | ||
) from mysql_mytest table 'mytest.orders'; | ||
|
||
statement ok | ||
create materialized view products_test_cnt as select count(*) as cnt from products_test; | ||
|
||
statement ok | ||
create materialized view orders_test_cnt as select count(*) as cnt from orders_test; | ||
|
||
|
||
# generate data to mysql | ||
system ok | ||
mysql --protocol=tcp -u root mytest < e2e_test/source/cdc/mysql_init_data.sql | ||
|
||
sleep 5s | ||
|
||
# check ingestion results | ||
query I | ||
SELECT * from products_test_cnt | ||
---- | ||
9 | ||
|
||
query I | ||
SELECT * from orders_test_cnt | ||
---- | ||
3 | ||
|
||
query ITT | ||
SELECT * FROM products_test order by id limit 3 | ||
---- | ||
101 scooter Small 2-wheel scooter | ||
102 car battery 12V car battery | ||
103 12-pack drill bits 12-pack of drill bits with sizes ranging from #40 to #3 | ||
|
||
query ITTT | ||
SELECT order_id,order_date,customer_name,product_id FROM orders_test order by order_id limit 3 | ||
---- | ||
10001 2020-07-30 10:08:22 Jark 102 | ||
10002 2020-07-30 10:11:09 Sally 105 | ||
10003 2020-07-30 12:00:30 Edward 106 |
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,26 @@ | ||
CREATE TABLE products ( | ||
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
name VARCHAR(255) NOT NULL, | ||
description VARCHAR(512) | ||
) AUTO_INCREMENT = 101; | ||
|
||
CREATE TABLE orders ( | ||
order_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
order_date DATETIME NOT NULL, | ||
customer_name VARCHAR(255) NOT NULL, | ||
price DECIMAL(10, 5) NOT NULL, | ||
product_id INTEGER NOT NULL, | ||
order_status BOOLEAN NOT NULL -- Whether order has been placed | ||
) AUTO_INCREMENT = 10001; | ||
|
||
CREATE TABLE mytable ( | ||
v1 INTEGER NOT NULL PRIMARY KEY, | ||
v2 INTEGER NOT NULL, | ||
v3 VARCHAR(255) NOT NULL | ||
); | ||
|
||
DROP USER IF EXISTS 'dbz'@'%'; | ||
CREATE USER 'dbz'@'%' IDENTIFIED BY '123456'; | ||
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'dbz'@'%'; | ||
|
||
CREATE TABLE tt3 (v1 int primary key, v2 timestamp); |
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,28 @@ | ||
-- USE `my@db`; | ||
|
||
INSERT INTO products | ||
VALUES (default,"scooter","Small 2-wheel scooter"), | ||
(default,"car battery","12V car battery"), | ||
(default,"12-pack drill bits","12-pack of drill bits with sizes ranging from #40 to #3"), | ||
(default,"hammer","12oz carpenter's hammer"), | ||
(default,"hammer","14oz carpenter's hammer"), | ||
(default,"hammer","16oz carpenter's hammer"), | ||
(default,"rocks","box of assorted rocks"), | ||
(default,"jacket","water resistent black wind breaker"), | ||
(default,"spare tire","24 inch spare tire"); | ||
|
||
|
||
INSERT INTO orders | ||
VALUES (default, '2020-07-30 10:08:22', 'Jark', 50.50, 102, false), | ||
(default, '2020-07-30 10:11:09', 'Sally', 15.00, 105, false), | ||
(default, '2020-07-30 12:00:30', 'Edward', 25.25, 106, false); | ||
|
||
|
||
INSERT INTO mytable | ||
VALUES (1,1,'no'), | ||
(2,2,'no'), | ||
(3,3,'no'), | ||
(4,4,'no'); | ||
|
||
INSERT INTO tt3 VALUES (1, '2020-07-30 10:08:22'); | ||
INSERT INTO tt3 VALUES (2, '2020-07-31 10:09:22'); |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.