From 87b67e16ce2d0151773867cacebe8c828fab5b81 Mon Sep 17 00:00:00 2001 From: Jianjun Liao <36503113+Leavrth@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:48:53 +0800 Subject: [PATCH] This is an automated cherry-pick of #56799 Signed-off-by: ti-chi-bot --- br/tests/br_pitr/run.sh | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/br/tests/br_pitr/run.sh b/br/tests/br_pitr/run.sh index b9eb63f8eda4e..0145761df59ec 100644 --- a/br/tests/br_pitr/run.sh +++ b/br/tests/br_pitr/run.sh @@ -96,6 +96,7 @@ done echo "restart a services" restart_services +<<<<<<< HEAD # PITR restore echo "run pitr" run_br --pd $PD_ADDR restore point -s "local://$TEST_DIR/$PREFIX/log" --full-backup-storage "local://$TEST_DIR/$PREFIX/full" > $res_file 2>&1 @@ -114,3 +115,51 @@ expect_delete_range=$(($incremental_delete_range_count-$prepare_delete_range_cou check_contains "DELETE_RANGE_CNT: $expect_delete_range" ## check feature compatibility between PITR and accelerate indexing bash $CUR/check/check_ingest_repair.sh +======= +file_corruption() { + echo "corrupt the whole log files" + for filename in $(find $TEST_DIR/$PREFIX/log -regex ".*\.log" | grep -v "schema-meta"); do + echo "corrupt the log file $filename" + filename_temp=$filename"_temp" + echo "corruption" > $filename_temp + cat $filename >> $filename_temp + mv $filename_temp $filename + truncate -s -11 $filename + done +} + +# file corruption +file_corruption +export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/utils/set-import-attempt-to-one=return(true)" +restore_fail=0 +run_br --pd $PD_ADDR restore point -s "local://$TEST_DIR/$PREFIX/log" --full-backup-storage "local://$TEST_DIR/$PREFIX/full" || restore_fail=1 +export GO_FAILPOINTS="" +if [ $restore_fail -ne 1 ]; then + echo 'pitr success on file corruption' + exit 1 +fi + +# start a new cluster for corruption +echo "restart a services" +restart_services + +file_lost() { + echo "lost the whole log files" + for filename in $(find $TEST_DIR/$PREFIX/log -regex ".*\.log" | grep -v "schema-meta"); do + echo "lost the log file $filename" + filename_temp=$filename"_temp" + mv $filename $filename_temp + done +} + +# file lost +file_lost +export GO_FAILPOINTS="github.com/pingcap/tidb/br/pkg/utils/set-import-attempt-to-one=return(true)" +restore_fail=0 +run_br --pd $PD_ADDR restore point -s "local://$TEST_DIR/$PREFIX/log" --full-backup-storage "local://$TEST_DIR/$PREFIX/full" || restore_fail=1 +export GO_FAILPOINTS="" +if [ $restore_fail -ne 1 ]; then + echo 'pitr success on file lost' + exit 1 +fi +>>>>>>> c7d09e6fa1e (br: fix br integration test file corruption (#56799))