github.com/pingcap/ticdc@v0.0.0-20220526033649-485a10ef2652/tests/_utils/check_sync_diff (about)

     1  #!/bin/bash
     2  # parameter 1: work directory
     3  # parameter 2: config file for sync_diff_inspector
     4  # parameter 3: max check times
     5  
     6  workdir=$1
     7  conf=$2
     8  if [ $# -ge 3 ]; then
     9      check_time=$3
    10  else
    11      check_time=30
    12  fi
    13  binary=sync_diff_inspector
    14  
    15  PWD=$(pwd)
    16  LOG=$workdir/sync_diff_inspector.log
    17  
    18  cd $workdir
    19  i=0
    20  while [ $i -lt $check_time ]
    21  do
    22      $binary --config=$conf >> $LOG 2>&1
    23      ret=$?
    24      if [ "$ret" == 0 ]; then
    25          echo "check diff successfully"
    26          break
    27      fi
    28      ((i++))
    29      echo "check diff failed $i-th time, retry later"
    30      sleep 2
    31  done
    32  
    33  if [ $i -ge $check_time ]; then
    34      echo "check diff failed at last"
    35      # show \n and other blanks
    36      printf "$(cat $LOG)\n"
    37      exit 1
    38  fi
    39  cd $PWD