Skip to content

Commit

Permalink
tests: fix unstable integration_test gc_safepoint (#2717) (#2737)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Sep 8, 2021
1 parent 5130b25 commit ad02967
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/gc_safepoint/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function check_safepoint_cleared() {
function check_safepoint_forward() {
pd_addr=$1
pd_cluster_id=$2
safe_point1=$(get_safepoint $pd_addr $pd_cluster_id)
safe_point1=$3
sleep 1
safe_point2=$(get_safepoint $pd_addr $pd_cluster_id)
if [[ "$safe_point1" == "$safe_point2" ]]; then
Expand Down Expand Up @@ -101,7 +101,8 @@ function run() {
check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml

pd_cluster_id=$(curl -s $pd_addr/pd/api/v1/cluster|grep -oE "id\":\s[0-9]+"|grep -oE "[0-9]+")
ensure $MAX_RETRIES check_safepoint_forward $pd_addr $pd_cluster_id
start_safepoint=$(get_safepoint $pd_addr $pd_cluster_id)
ensure $MAX_RETRIES check_safepoint_forward $pd_addr $pd_cluster_id $start_safepoint

# after the changefeed is paused, the safe_point will be not updated
cdc cli changefeed pause --changefeed-id=$changefeed_id --pd=$pd_addr
Expand All @@ -111,7 +112,8 @@ function run() {
# resume changefeed will recover the safe_point forward
cdc cli changefeed resume --changefeed-id=$changefeed_id --pd=$pd_addr
ensure $MAX_RETRIES check_changefeed_state $pd_addr $changefeed_id "normal"
ensure $MAX_RETRIES check_safepoint_forward $pd_addr $pd_cluster_id
start_safepoint=$(get_safepoint $pd_addr $pd_cluster_id)
ensure $MAX_RETRIES check_safepoint_forward $pd_addr $pd_cluster_id $start_safepoint

cdc cli changefeed pause --changefeed-id=$changefeed_id --pd=$pd_addr
ensure $MAX_RETRIES check_changefeed_state $pd_addr $changefeed_id "stopped"
Expand All @@ -123,7 +125,8 @@ function run() {

# remove paused changefeed, the safe_point forward will recover
cdc cli changefeed remove --changefeed-id=$changefeed_id --pd=$pd_addr
ensure $MAX_RETRIES check_safepoint_forward $pd_addr $pd_cluster_id
start_safepoint=$(get_safepoint $pd_addr $pd_cluster_id)
ensure $MAX_RETRIES check_safepoint_forward $pd_addr $pd_cluster_id $start_safepoint

# remove all changefeeds, the safe_point will be cleared
cdc cli changefeed remove --changefeed-id=$changefeed_id2 --pd=$pd_addr
Expand Down

0 comments on commit ad02967

Please sign in to comment.