Skip to content

Commit

Permalink
[latest-17.0](vitessio#3938): CherryPick(vitessio#14753): Add a retry…
Browse files Browse the repository at this point in the history
… to remove the vttablet directory during upgrade/downgrade backup tests (vitessio#3941)

Co-authored-by: Florent Poinsard <[email protected]>
  • Loading branch information
planetscale-actions-bot and frouioui authored Dec 12, 2023
1 parent 2ad9a87 commit a2c4499
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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'
Expand Down
20 changes: 19 additions & 1 deletion examples/backups/stop_tablets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
vtctlclient DeleteTablet -- --allow_primary=true 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

0 comments on commit a2c4499

Please sign in to comment.