Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#6572
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
lance6716 authored and ti-chi-bot committed Aug 3, 2022
1 parent b536d0e commit d3e4a22
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
4 changes: 2 additions & 2 deletions dm/tests/_utils/wait_process_exit
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
9 changes: 3 additions & 6 deletions dm/tests/compatibility/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 18 additions & 1 deletion dm/tests/duplicate_event/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,27 @@ 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)
<<<<<<< HEAD
relay_log_size=$(ls -al $WORK_DIR/worker2/relay-dir/$server_uuid/$binlog_file | awk '{print $5}')
[ "$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
>>>>>>> b2da15fff (test(dm): fix using pgrep to check argument pattern (#6572))

echo "============== run_with_prepared_source_config success ==================="
}
Expand Down
8 changes: 8 additions & 0 deletions dm/tests/shardddl1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,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
Expand Down
5 changes: 5 additions & 0 deletions dm/tests/shardddl2/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ function DM_040_CASE() {
else
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status test" \
<<<<<<< HEAD
"because schema conflict detected" 1
=======
'ALTER TABLE `shardddl`.`tb` ADD COLUMN `col1` VARCHAR(10) CHARACTER SET UTF8' 1 \
"\`${shardddl1}\`.\`${tb1}\`\"" 1
>>>>>>> b2da15fff (test(dm): fix using pgrep to check argument pattern (#6572))
fi
}

Expand Down

0 comments on commit d3e4a22

Please sign in to comment.