Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions sync_diff_inspector/tests/sync_diff_inspector/checkpoint/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ for s in ${last_chunk_index_array[@]}; do
done
# chunkIndex should be the last Index
[[ $((${last_chunk_index_array[2]} + 1)) -eq ${last_chunk_index_array[3]} ]] || exit 1
# Save bucketIndexRight, which should be equal to bucketIndexLeft of the chunk first created in the next running.
bucket_index_right=$(($(echo ${last_chunk_index_array[1]} | awk -F '-' '{print $2}') + 1))
echo $bucket_index_right

rm -f $OUT_DIR/sync_diff.log
export GO_FAILPOINTS="github.com/pingcap/tiflow/sync_diff_inspector/splitter/print-chunk-info=return()"
sync_diff_inspector --config=./config.toml >$OUT_DIR/checkpoint_diff.output
Expand All @@ -50,7 +46,9 @@ echo $first_chunk_info | awk -F '=' '{print $3}' >$OUT_DIR/first_chunk_index
cat $OUT_DIR/first_chunk_index
# Notice: when chunk is created paralleling, the least chunk may not appear in the first line. so we sort it as before.
check_contains "${last_chunk_bound}" $OUT_DIR/first_chunk_bound
check_contains_regex ".*:${bucket_index_right}-.*:0:.*" $OUT_DIR/first_chunk_index
IFS=: read -r -a first_chunk_index_array < "$OUT_DIR/first_chunk_index"
# After resuming from the last chunk in a bucket, the next chunk should start a new bucket.
[[ ${first_chunk_index_array[2]} -eq 0 ]] || exit 1

echo "--------2. chunk is in the middle of the bucket--------"
rm -rf $OUT_DIR
Expand Down Expand Up @@ -78,11 +76,6 @@ for s in ${last_chunk_index_array[@]}; do
done
# chunkIndex should be the last Index
[[ $((${last_chunk_index_array[2]} + 2)) -eq ${last_chunk_index_array[3]} ]] || exit 1
# Save bucketIndexRight, which should be equal to bucketIndexLeft of the chunk first created in the next running.
bucket_index_left=$(echo ${last_chunk_index_array[1]} | awk -F '-' '{print $1}')
bucket_index_right=$(echo ${last_chunk_index_array[1]} | awk -F '-' '{print $2}')
echo "${bucket_index_left}-${bucket_index_right}"

rm -f $OUT_DIR/sync_diff.log
export GO_FAILPOINTS="github.com/pingcap/tiflow/sync_diff_inspector/splitter/print-chunk-info=return()"
sync_diff_inspector --config=./config.toml >$OUT_DIR/checkpoint_diff.output
Expand All @@ -93,7 +86,9 @@ echo $first_chunk_info | awk -F '=' '{print $3}' >$OUT_DIR/first_chunk_index
cat $OUT_DIR/first_chunk_index
# Notice: when chunk is created paralleling, the least chunk may not appear in the first line. so we sort it as before.
check_contains "${last_chunk_bound}" $OUT_DIR/first_chunk_bound
check_contains_regex ".:${bucket_index_left}-${bucket_index_right}:$((${last_chunk_index_array[2]} + 1)):${last_chunk_index_array[3]}" $OUT_DIR/first_chunk_index
IFS=: read -r -a first_chunk_index_array < "$OUT_DIR/first_chunk_index"
[[ ${first_chunk_index_array[2]} -eq $((${last_chunk_index_array[2]} + 1)) ]] || exit 1
[[ ${first_chunk_index_array[3]} -eq ${last_chunk_index_array[3]} ]] || exit 1

sed "s/\"127.0.0.1\"#MYSQL_HOST/\"${MYSQL_HOST}\"/g" ./config_base_rand.toml | sed "s/3306#MYSQL_PORT/${MYSQL_PORT}/g" >./config.toml

Expand Down Expand Up @@ -133,8 +128,8 @@ cat $OUT_DIR/first_chunk_bound
echo $first_chunk_info | awk -F '=' '{print $3}' >$OUT_DIR/first_chunk_index
cat $OUT_DIR/first_chunk_index
# Notice: when chunk is created paralleling, the least chunk may not appear in the first line. so we sort it as before.
# The random splitter may re-split the remaining range after resuming, so its indexCode is not stable across runs.
check_contains "${last_chunk_bound}" $OUT_DIR/first_chunk_bound
check_contains_regex ".:0-0:$((${last_chunk_index_array[2]} + 1)):${last_chunk_index_array[3]}" $OUT_DIR/first_chunk_index

sed "s/\"127.0.0.1\"#MYSQL_HOST/\"${MYSQL_HOST}\"/g" ./config_base_continous.toml | sed "s/3306#MYSQL_PORT/${MYSQL_PORT}/g" >./config.toml
echo "================test checkpoint continous================="
Expand Down