From c5e855aa6de11126c28978f5f7b4241b728c0ff1 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 11 Dec 2023 18:57:36 -0600 Subject: [PATCH 1/3] Add timeout to remove the vttablet directory during backup tests Signed-off-by: Florent Poinsard --- examples/backups/stop_tablets.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/examples/backups/stop_tablets.sh b/examples/backups/stop_tablets.sh index 6a3ced6ab74..5037fdab98d 100755 --- a/examples/backups/stop_tablets.sh +++ b/examples/backups/stop_tablets.sh @@ -30,7 +30,25 @@ for tablet in 100 200 300; do CELL=zone1 TABLET_UID=$uid ../common/scripts/mysqlctl-down.sh echo "Removing tablet directory zone1-$uid" vtctldclient DeleteTablets --allow-primary zone1-$uid - rm -Rf $VTDATAROOT/vt_0000000$uid + + for ((i=0; i<30; i++)); do + # Redirect stderr to a temporary file + temp_file=$(mktemp) + rm -Rf $VTDATAROOT/vt_0000000$uid 2>$temp_file + + if grep -q 'Directory not empty' $temp_file; then + echo "Directory not empty, retrying..." + elif [ ! -s $temp_file ]; then + echo "Deletion succeeded." + rm -f $temp_file + break + else + echo "An error occurred." + cat $temp_file + fi + rm -f $temp_file + sleep 1 + done done fi done From 120a63bb1c14a83a1a093e819a1c6cf4dace5795 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 11 Dec 2023 19:20:49 -0600 Subject: [PATCH 2/3] don't skip tests if examples folder changed Signed-off-by: Florent Poinsard --- .github/workflows/upgrade_downgrade_test_backups_manual.yml | 1 + .../upgrade_downgrade_test_backups_manual_next_release.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual.yml b/.github/workflows/upgrade_downgrade_test_backups_manual.yml index 039e416cb1c..82d243066e4 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual.yml @@ -82,6 +82,7 @@ jobs: - 'config/**' - 'bootstrap.sh' - '.github/workflows/upgrade_downgrade_test_backups_manual.yml' + - 'examples/**' - name: Set up Go if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml index e4a9bd11fb3..f00b53c9313 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml @@ -85,6 +85,7 @@ jobs: - 'config/**' - 'bootstrap.sh' - '.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml' + - 'examples/**' - name: Set up Go if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' From 884106715630f014665c2d574aa0ff5ae27eeafd Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 11 Dec 2023 19:33:48 -0600 Subject: [PATCH 3/3] double quote temp_file to avoid whitespaces Signed-off-by: Florent Poinsard --- examples/backups/stop_tablets.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/backups/stop_tablets.sh b/examples/backups/stop_tablets.sh index 5037fdab98d..d387128309c 100755 --- a/examples/backups/stop_tablets.sh +++ b/examples/backups/stop_tablets.sh @@ -34,19 +34,19 @@ for tablet in 100 200 300; do for ((i=0; i<30; i++)); do # Redirect stderr to a temporary file temp_file=$(mktemp) - rm -Rf $VTDATAROOT/vt_0000000$uid 2>$temp_file + rm -Rf $VTDATAROOT/vt_0000000$uid 2>"$temp_file" - if grep -q 'Directory not empty' $temp_file; then + if grep -q 'Directory not empty' "$temp_file"; then echo "Directory not empty, retrying..." - elif [ ! -s $temp_file ]; then + elif [ ! -s "$temp_file" ]; then echo "Deletion succeeded." - rm -f $temp_file + rm -f "$temp_file" break else echo "An error occurred." - cat $temp_file + cat "$temp_file" fi - rm -f $temp_file + rm -f "$temp_file" sleep 1 done done