Skip to content

Commit

Permalink
tests: fix unstable integration_test gc_safepoint (#2717) (#2740)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Sep 6, 2021
1 parent f264f84 commit 0ebf717
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/gc_safepoint/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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 @@ -91,7 +91,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 @@ -101,7 +102,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 @@ -113,8 +115,10 @@ function run() {

# remove paused changefeed, the safe_point forward will recover
cdc cli changefeed remove --changefeed-id=$changefeed_id --pd=$pd_addr
# remove this line when new owner is enabled, because `removed` state is deprecated
ensure $MAX_RETRIES check_changefeed_state $pd_addr $changefeed_id "removed"
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 0ebf717

Please sign in to comment.