github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/_utils/check_table_not_exists (about)

     1  #!/bin/bash
     2  # parameter 1: schema.table
     3  # parameter 2: database host
     4  # parameter 3: database port
     5  # parameter 4: max check times
     6  
     7  if [ $# -ge 4 ]; then
     8  	check_time=$4
     9  else
    10  	check_time=60
    11  fi
    12  
    13  i=0
    14  while [ $i -lt $check_time ]; do
    15  	mysql -h$2 -P$3 -uroot -e "show create table $1" >/dev/null 2>&1
    16  	ret=$?
    17  	if [ "$ret" != 0 ]; then
    18  		echo "table $1 does not exists"
    19  		break
    20  	fi
    21  	((i++))
    22  	echo "table $1 not exists for $i-th check, retry later"
    23  	sleep 2
    24  done
    25  
    26  if [ $i -ge $check_time ]; then
    27  	echo "table $1 not exists at last check"
    28  	exit 1
    29  fi