-
Notifications
You must be signed in to change notification settings - Fork 289
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
owner: fix a bug about wrong timing sequence of DDL when add a table to processor #450
Merged
Merged
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2162365
close tests
6699e42
close tests
506de8b
close tests
ab3fc71
update case
6531d9c
update case
13dcc25
update case
5c0f463
update case
0c3db29
update case
1ebed37
update case
2e47cac
update case
e5f0af7
update case
e74c7c5
use ctx
cec8df5
use ctx
6df3db9
update
3318738
Merge remote-tracking branch 'pingcap/master' into fix_ddl_2
164ebc9
update
5ae5f04
update
876153c
update
5533a4d
update
f454685
Merge branch 'fix_ddl' into fix_ddl_2
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,27 @@ | ||
# diff Configuration. | ||
|
||
log-level = "info" | ||
chunk-size = 10 | ||
check-thread-count = 4 | ||
sample-percent = 100 | ||
use-rowid = false | ||
use-checksum = true | ||
fix-sql-file = "fix.sql" | ||
|
||
# tables need to check. | ||
[[check-tables]] | ||
schema = "ddl_sequence" | ||
tables = ["~.*"] | ||
|
||
[[source-db]] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "root" | ||
password = "" | ||
instance-id = "source-1" | ||
|
||
[target-db] | ||
host = "127.0.0.1" | ||
port = 3306 | ||
user = "root" | ||
password = "" |
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,45 @@ | ||
drop database if exists `ddl_sequence`; | ||
create database `ddl_sequence`; | ||
use `ddl_sequence`; | ||
|
||
CREATE TABLE many_cols1 ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
val INT DEFAULT 0, | ||
col0 INT NOT NULL | ||
); | ||
ALTER TABLE many_cols1 DROP COLUMN col0; | ||
INSERT INTO many_cols1 (val) VALUES (1); | ||
|
||
CREATE TABLE many_cols2 ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
val INT DEFAULT 0, | ||
col0 INT NOT NULL | ||
); | ||
ALTER TABLE many_cols2 DROP COLUMN col0; | ||
INSERT INTO many_cols2 (val) VALUES (1); | ||
|
||
CREATE TABLE many_cols3 ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
val INT DEFAULT 0, | ||
col0 INT NOT NULL | ||
); | ||
ALTER TABLE many_cols3 DROP COLUMN col0; | ||
INSERT INTO many_cols3 (val) VALUES (1); | ||
|
||
CREATE TABLE many_cols4 ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
val INT DEFAULT 0, | ||
col0 INT NOT NULL | ||
); | ||
ALTER TABLE many_cols4 DROP COLUMN col0; | ||
INSERT INTO many_cols4 (val) VALUES (1); | ||
|
||
CREATE TABLE many_cols5 ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
val INT DEFAULT 0, | ||
col0 INT NOT NULL | ||
); | ||
ALTER TABLE many_cols5 DROP COLUMN col0; | ||
INSERT INTO many_cols5 (val) VALUES (1); | ||
|
||
CREATE TABLE finish_mark(a int primary key) |
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,43 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
CUR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
source $CUR/../_utils/test_prepare | ||
WORK_DIR=$OUT_DIR/$TEST_NAME | ||
CDC_BINARY=cdc.test | ||
SINK_TYPE=$1 | ||
|
||
function run() { | ||
rm -rf $WORK_DIR && mkdir -p $WORK_DIR | ||
|
||
start_tidb_cluster $WORK_DIR | ||
|
||
cd $WORK_DIR | ||
|
||
# record tso before we create tables to skip the system table DDLs | ||
start_ts=$(cdc cli tso query --pd=http://$UP_PD_HOST:$UP_PD_PORT) | ||
|
||
run_cdc_server $WORK_DIR $CDC_BINARY | ||
|
||
TOPIC_NAME="ticdc-ddl-sequence-test-$RANDOM" | ||
case $SINK_TYPE in | ||
kafka) SINK_URI="kafka://127.0.0.1:9092/$TOPIC_NAME?partition-num=4";; | ||
mysql) ;& | ||
*) SINK_URI="mysql://root@127.0.0.1:3306/";; | ||
esac | ||
cdc cli changefeed create --start-ts=$start_ts --sink-uri="$SINK_URI" | ||
if [ "$SINK_TYPE" == "kafka" ]; then | ||
run_kafka_consumer $WORK_DIR "kafka://127.0.0.1:9092/$TOPIC_NAME?partition-num=4" | ||
fi | ||
run_sql_file $CUR/data/prepare.sql ${UP_TIDB_HOST} ${UP_TIDB_PORT} | ||
# sync_diff can't check non-exist table, so we check expected tables are created in downstream first | ||
check_table_exists ddl_sequence.finish_mark ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT} | ||
check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml | ||
|
||
cleanup_process $CDC_BINARY | ||
} | ||
|
||
trap stop_tidb_cluster EXIT | ||
run $* | ||
echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines have conflict with L541 and L545.
c.sink.EmitCheckpointEvent
will be never called?