-
Notifications
You must be signed in to change notification settings - Fork 288
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
syncer(dm): fix log error caused by "COMMIT" in QueryEvent #7726
Changes from all commits
eeb011f
0a2e079
ec7bc24
2b37d88
14d4062
f25cec6
526b2f8
2b9f844
17baa88
5de629a
6adb942
b61a7be
2b963ed
6e37b68
e4ae452
030d73c
025e0f1
000ab9a
f2a89e0
fc7999b
76bfc4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -240,6 +240,69 @@ function run() { | |||||
|
||||||
cleanup_process | ||||||
done | ||||||
|
||||||
test_COMMIT_in_QueryEvent | ||||||
} | ||||||
|
||||||
function prepare_data_MyISAM() { | ||||||
run_sql 'DROP DATABASE if exists start_task;' $TIDB_PORT $TIDB_PASSWORD | ||||||
run_sql 'DROP DATABASE if exists start_task;' $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
run_sql 'CREATE DATABASE start_task;' $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
run_sql "CREATE TABLE start_task.t1(i TINYINT, j INT UNIQUE KEY) engine=MyISAM;" $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
for j in $(seq 10); do | ||||||
run_sql "INSERT INTO start_task.t1 VALUES ($j,${j}000$j);" $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
done | ||||||
} | ||||||
|
||||||
function test_COMMIT_in_QueryEvent() { | ||||||
echo "[$(date)] <<<<<< start test_COMMIT_in_QueryEvent >>>>>>" | ||||||
cleanup_process | ||||||
cleanup_data start_task | ||||||
prepare_data_MyISAM | ||||||
|
||||||
cp $cur/conf/source1.yaml $WORK_DIR/source1.yaml | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to copy them if you won't change the file content |
||||||
cp $cur/conf/dm-master.toml $WORK_DIR/ | ||||||
cp $cur/conf/dm-worker1.toml $WORK_DIR/ | ||||||
cp $cur/conf/dm-task.yaml $WORK_DIR/ | ||||||
|
||||||
# start DM worker and master | ||||||
run_dm_master $WORK_DIR/master $MASTER_PORT $WORK_DIR/dm-master.toml | ||||||
check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT | ||||||
run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $WORK_DIR/dm-worker1.toml | ||||||
check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT | ||||||
|
||||||
# operate mysql config to worker | ||||||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||||||
"operate-source create $WORK_DIR/source1.yaml" \ | ||||||
"\"result\": true" 2 \ | ||||||
"\"source\": \"$SOURCE_ID1\"" 1 | ||||||
|
||||||
echo "check master alive" | ||||||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||||||
"list-member" \ | ||||||
"\"alive\": true" 1 | ||||||
|
||||||
echo "start task and check stage" | ||||||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||||||
"start-task $WORK_DIR/dm-task.yaml --remove-meta=true" \ | ||||||
"\"result\": true" 2 | ||||||
|
||||||
run_sql "CREATE TABLE start_task.t2(i TINYINT, j INT UNIQUE KEY) engine=MyISAM;" $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
run_sql 'INSERT INTO start_task.t1 VALUES (99,9999);' $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
run_sql 'INSERT INTO start_task.t2 VALUES (99,9999);' $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||||||
|
||||||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||||||
"query-status test" \ | ||||||
"\"result\": true" 2 \ | ||||||
"\"unit\": \"Sync\"" 1 \ | ||||||
"\"stage\": \"Running\"" 2 | ||||||
|
||||||
echo "check data" | ||||||
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml | ||||||
|
||||||
check_log_not_contains $WORK_DIR/worker1/log/dm-worker.log "originSQL: COMMIT" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where does this log printed previously? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in Line 2797 in 3f4a8a7
Line 934 in 3f4a8a7
[2022/11/28 14:48:30.512 +08:00] [INFO] [ddl.go:934] ["parse ddl"] [task=test] [unit="binlog replication"] [event=query] ["query event context"="{schema: , originSQL: COMMIT, startLocation: position: (mysql-bin|000001.000001, 4407), gtid-set: e266a895-6e51-11ed-b110-0242ac110002:1-16, endLocation: position: (mysql-bin|000001.000001, 4476), gtid-set: e266a895-6e51-11ed-b110-0242ac110002:1-16, lastLocation: position: (mysql-bin|000001.000001, 4476), gtid-set: e266a895-6e51-11ed-b110-0242ac110002:1-16, re-sync: , needHandleDDLs: , trackInfos: }"] |
||||||
|
||||||
echo "<<<<<< test_COMMIT_in_QueryEvent success! >>>>>>" | ||||||
} | ||||||
|
||||||
cleanup_data start_task | ||||||
|
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.
maybe use a
fallthrough
to run into thecase *replication.XIDEvent:
branch