github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/tests/binlog_parse/run.sh (about) 1 #!/bin/bash 2 3 set -eu 4 5 cur=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 6 source $cur/../_utils/test_prepare 7 WORK_DIR=$TEST_DIR/$TEST_NAME 8 9 # skip one tale, sync another table 10 # mariadb10.0 timestamp(3) will panic before dm v6.4.0 11 function run() { 12 run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml 13 check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT 14 run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $cur/conf/dm-worker1.toml 15 check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT 16 17 # operate mysql config to worker 18 cp $cur/conf/source1.yaml $WORK_DIR/source1.yaml 19 dmctl_operate_source create $WORK_DIR/source1.yaml $SOURCE_ID1 20 21 echo "prepare data" 22 run_sql_file $cur/data/db1.prepare.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 23 24 echo "start task" 25 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 26 "start-task $cur/conf/dm-task.yaml --remove-meta" 27 28 echo "check full phase" 29 check_sync_diff $WORK_DIR $cur/conf/diff_config.toml 30 30 31 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 32 "validation start test" \ 33 "\"result\": true" 1 34 35 echo "prepare incremental data" 36 run_sql_file $cur/data/db1.increment.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 37 38 echo "check incremental phase" 39 check_sync_diff $WORK_DIR $cur/conf/diff_config.toml 30 40 41 run_sql_tidb_with_retry "select count(1) from binlog_parse.t1;" "count(1): 4" 42 43 # relay error in mariadb:10.0, success in mysql 44 run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 45 "start-relay -s $SOURCE_ID1 worker1" \ 46 "\"result\": true" 2 \ 47 "\"source\": \"$SOURCE_ID1\"" 1 \ 48 "\"worker\": \"worker1\"" 1 49 # "TCPReader get relay event with error" 1 50 51 echo "prepare incremental data 2" 52 run_sql_file $cur/data/db1.increment1.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 53 run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ 54 "validation start test" \ 55 "\"result\": true" 1 56 57 echo "check incremental phase 2" 58 check_sync_diff $WORK_DIR $cur/conf/diff_config.toml 30 59 } 60 61 cleanup_data $TEST_NAME 62 # also cleanup dm processes in case of last run failed 63 cleanup_process $* 64 run $* 65 cleanup_process $* 66 67 echo "[$(date)] <<<<<< test case $TEST_NAME success! >>>>>>"