diff --git a/dm/tests/_utils/wait_process_exit b/dm/tests/_utils/wait_process_exit index 42e3f048d4b..bc0ec81fc0d 100755 --- a/dm/tests/_utils/wait_process_exit +++ b/dm/tests/_utils/wait_process_exit @@ -5,7 +5,7 @@ process=$1 WAIT_COUNT=0 while [ $WAIT_COUNT -lt 120 ]; do - pgrep $process >/dev/null 2>&1 + ps aux | grep $process | grep -v 'grep' | grep -v 'wait_process_exit' >/dev/null 2>&1 ret=$? if [ "$ret" != "0" ]; then echo "process $process already exit" @@ -16,5 +16,5 @@ while [ $WAIT_COUNT -lt 120 ]; do ((WAIT_COUNT++)) done -echo "process $process didn't exit after 120 seconds, current processlist: $(ps aux | grep $process | grep -v 'grep')" +echo "process $process didn't exit after 120 seconds, current processlist: $(ps aux | grep $process | grep -v 'grep' | grep -v 'wait_process_exit')" exit 1 diff --git a/dm/tests/compatibility/start.sh b/dm/tests/compatibility/start.sh index d93fc4250ba..1c25d0cb806 100755 --- a/dm/tests/compatibility/start.sh +++ b/dm/tests/compatibility/start.sh @@ -31,8 +31,7 @@ function run() { # upgrading should firstly upgrade master echo "use current dm-master" - pkill -hup dm-master.test.previous 2>/dev/null || true - wait_process_exit dm-master.test.previous + kill_process dm-master.test.previous run_dm_master $WORK_DIR/master $MASTER_PORT $cur/conf/dm-master.toml current check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT run_sql_file $cur/data/db1.increment.1.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 @@ -42,8 +41,7 @@ function run() { check_sync_diff $WORK_DIR $cur/conf/diff_config.toml echo "restart dm-worker, one use the current version, and the other one use the previous version" - pkill -hup dm-worker.test.previous 2>/dev/null || true - wait_process_exit dm-worker.test.previous + kill_process dm-worker.test.previous run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $cur/conf/dm-worker1.toml current check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT run_dm_worker $WORK_DIR/worker2 $WORKER2_PORT $cur/conf/dm-worker2.toml previous @@ -74,8 +72,7 @@ function run() { check_sync_diff $WORK_DIR $cur/conf/diff_config.toml echo "all dm-worker use current version" - pkill -hup dm-worker.test.previous 2>/dev/null || true - wait_process_exit dm-worker.test.previous + kill_process dm-worker.test.previous run_dm_worker $WORK_DIR/worker2 $WORKER2_PORT $cur/conf/dm-worker2.toml current run_sql_file $cur/data/db1.increment.3.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1 diff --git a/dm/tests/duplicate_event/run.sh b/dm/tests/duplicate_event/run.sh index 85561e9f559..4274df9bc87 100644 --- a/dm/tests/duplicate_event/run.sh +++ b/dm/tests/duplicate_event/run.sh @@ -73,11 +73,22 @@ function run_with_prepared_source_config() { run_sql_source2 "show master status;" binlog_file=$(grep "File" $TEST_DIR/sql_res.$TEST_NAME.txt | awk -F: '{print $2}' | xargs) binlog_pos=$(grep "Position" $TEST_DIR/sql_res.$TEST_NAME.txt | awk -F: '{print $2}' | xargs) - server_uuid=$(tail -n 1 $WORK_DIR/worker2/relay-dir/server-uuid.index) - relay_log_size=$(ls -al $WORK_DIR/worker2/relay-dir/$server_uuid/$binlog_file | awk '{print $5}') - echo "binlog_pos: $binlog_pos relay_log_size: $relay_log_size" - [ "$binlog_pos" -eq "$relay_log_size" ] + + succ=0 + for ((k = 1; k < 6; k++)); do + relay_log_size=$(ls -al $WORK_DIR/worker2/relay-dir/$server_uuid/$binlog_file | awk '{print $5}') + echo "binlog_pos: $binlog_pos relay_log_size: $relay_log_size" + if [[ "$binlog_pos" -eq "$relay_log_size" ]]; then + succ=1 + break + fi + sleep 1 + done + if [[ $succ -eq 0 ]]; then + echo "binlog_pos is not equal to relay_log_size" + exit 1 + fi echo "============== run_with_prepared_source_config success ===================" } diff --git a/dm/tests/shardddl1/run.sh b/dm/tests/shardddl1/run.sh index 03516e92fde..3b608f4b416 100644 --- a/dm/tests/shardddl1/run.sh +++ b/dm/tests/shardddl1/run.sh @@ -243,6 +243,14 @@ function DM_RestartMaster_CASE() { check_sync_diff $WORK_DIR $cur/conf/diff_config.toml run_sql_source1 "alter table ${shardddl1}.${tb1} add column c double;" + if [[ "$1" = "pessimistic" ]]; then + check_log_contain_with_retry 'putted shard DDL info.*ADD COLUMN' \ + $WORK_DIR/worker1/log/dm-worker.log $WORK_DIR/worker2/log/dm-worker.log + else + check_log_contain_with_retry 'finish to handle ddls in optimistic shard mode.*add column' \ + $WORK_DIR/worker1/log/dm-worker.log $WORK_DIR/worker2/log/dm-worker.log + fi + run_sql_source2 "alter table ${shardddl1}.${tb1} add column c text;" if [[ "$1" = "pessimistic" ]]; then diff --git a/dm/tests/shardddl2/run.sh b/dm/tests/shardddl2/run.sh index 76bb2fe7f96..30aa8c326c8 100644 --- a/dm/tests/shardddl2/run.sh +++ b/dm/tests/shardddl2/run.sh @@ -127,7 +127,7 @@ function DM_040_CASE() { run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-status test" \ 'ALTER TABLE `shardddl`.`tb` ADD COLUMN `col1` VARCHAR(10) CHARACTER SET UTF8' 1 \ - "\"${SOURCE_ID2}-\`${shardddl1}\`.\`${tb1}\`\"" 1 + "\`${shardddl1}\`.\`${tb1}\`\"" 1 fi }