-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
binlog: do not decode rows for block table (#7622)
ref #4287
- Loading branch information
Showing
19 changed files
with
234 additions
and
75 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
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,29 @@ | ||
# diff Configuration. | ||
|
||
check-thread-count = 4 | ||
|
||
export-fix-sql = true | ||
|
||
check-struct-only = false | ||
|
||
[task] | ||
output-dir = "/tmp/ticdc_dm_test/output" | ||
|
||
source-instances = ["mysql1"] | ||
|
||
target-instance = "tidb0" | ||
|
||
target-check-tables = ["binlog_parse.t1"] | ||
|
||
[data-sources] | ||
[data-sources.mysql1] | ||
host = "127.0.0.1" | ||
port = 3306 | ||
user = "root" | ||
password = "123456" | ||
|
||
[data-sources.tidb0] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "test" | ||
password = "123456" |
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,4 @@ | ||
# Master Configuration. | ||
master-addr = ":8261" | ||
advertise-addr = "127.0.0.1:8261" | ||
auto-compaction-retention = "3s" |
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,42 @@ | ||
--- | ||
name: test | ||
task-mode: all | ||
is-sharding: false | ||
meta-schema: "dm_meta" | ||
|
||
target-database: | ||
host: "127.0.0.1" | ||
port: 4000 | ||
user: "test" | ||
password: "/Q7B9DizNLLTTfiZHv9WoEAKamfpIUs=" | ||
|
||
mysql-instances: | ||
- source-id: "mysql-replica-01" | ||
block-allow-list: "instance" | ||
mydumper-config-name: "global" | ||
loader-config-name: "global" | ||
syncer-config-name: "global" | ||
|
||
block-allow-list: | ||
instance: | ||
do-dbs: ["binlog_parse"] | ||
do-tables: | ||
- db-name: "binlog_parse" | ||
tbl-name: "t1" | ||
|
||
mydumpers: | ||
global: | ||
threads: 4 | ||
chunk-filesize: 64 | ||
skip-tz-utc: true | ||
extra-args: "" | ||
|
||
loaders: | ||
global: | ||
pool-size: 16 | ||
dir: "./dumped_data" | ||
|
||
syncers: | ||
global: | ||
worker-count: 16 | ||
batch: 100 |
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,2 @@ | ||
name = "worker1" | ||
join = "127.0.0.1:8261" |
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,12 @@ | ||
source-id: mysql-replica-01 | ||
enable-gtid: true | ||
relay-binlog-name: '' | ||
relay-binlog-gtid: '' | ||
enable-relay: false | ||
from: | ||
host: 127.0.0.1 | ||
user: root | ||
password: /Q7B9DizNLLTTfiZHv9WoEAKamfpIUs= | ||
port: 3306 | ||
checker: | ||
check-enable: false |
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,3 @@ | ||
use binlog_parse; | ||
insert into t1 (id, created_time) values (3, '2022-01-03 00:00:01'), (4, '2022-01-04 00:00:01'); | ||
insert into t2 (id, created_time) values (3, '2022-01-03 00:00:01'), (4, '2022-01-04 00:00:01'); |
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,3 @@ | ||
use binlog_parse; | ||
insert into t1 (id, created_time) values (5, '2022-01-05 00:00:01'), (6, '2022-01-06 00:00:01'); | ||
insert into t2 (id, created_time) values (5, '2022-01-05 00:00:01'), (6, '2022-01-06 00:00:01'); |
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,7 @@ | ||
drop database if exists `binlog_parse`; | ||
create database `binlog_parse` character set utf8; | ||
use `binlog_parse`; | ||
create table t1 (id int, created_time timestamp, primary key(`id`)) character set utf8; | ||
create table t2 (id int, created_time timestamp(3), primary key(`id`)) character set utf8; | ||
insert into t1 (id, created_time) values (1, '2022-01-01 00:00:01'), (2, '2022-01-02 00:00:01'); | ||
insert into t2 (id, created_time) values (1, '2022-01-01 00:00:01'), (2, '2022-01-02 00:00:01'); |
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,67 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
cur=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
source $cur/../_utils/test_prepare | ||
WORK_DIR=$TEST_DIR/$TEST_NAME | ||
|
||
# skip one tale, sync another table | ||
# mariadb10.0 timestamp(3) will panic before dm v6.4.0 | ||
function run() { | ||
run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/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 $cur/conf/dm-worker1.toml | ||
check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT | ||
|
||
# operate mysql config to worker | ||
cp $cur/conf/source1.yaml $WORK_DIR/source1.yaml | ||
dmctl_operate_source create $WORK_DIR/source1.yaml $SOURCE_ID1 | ||
|
||
echo "prepare data" | ||
run_sql_file $cur/data/db1.prepare.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||
|
||
echo "start task" | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"start-task $cur/conf/dm-task.yaml --remove-meta" | ||
|
||
echo "check full phase" | ||
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml 30 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"validation start test" \ | ||
"\"result\": true" 1 | ||
|
||
echo "prepare incremental data" | ||
run_sql_file $cur/data/db1.increment.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||
|
||
echo "check incremental phase" | ||
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml 30 | ||
|
||
run_sql_tidb_with_retry "select count(1) from binlog_parse.t1;" "count(1): 4" | ||
|
||
# relay error in mariadb:10.0, success in mysql | ||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"start-relay -s $SOURCE_ID1 worker1" \ | ||
"\"result\": true" 2 \ | ||
"\"source\": \"$SOURCE_ID1\"" 1 \ | ||
"\"worker\": \"worker1\"" 1 | ||
# "TCPReader get relay event with error" 1 | ||
|
||
echo "prepare incremental data 2" | ||
run_sql_file $cur/data/db1.increment1.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"validation start test" \ | ||
"\"result\": true" 1 | ||
|
||
echo "check incremental phase 2" | ||
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml 30 | ||
} | ||
|
||
cleanup_data $TEST_NAME | ||
# also cleanup dm processes in case of last run failed | ||
cleanup_process $* | ||
run $* | ||
cleanup_process $* | ||
|
||
echo "[$(date)] <<<<<< test case $TEST_NAME success! >>>>>>" |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ sql_mode | |
http_proxies | ||
openapi | ||
duplicate_event | ||
binlog_parse |
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.