Skip to content

Commit

Permalink
Add a retry to remove the vttablet directory during upgrade/downgrade…
Browse files Browse the repository at this point in the history
… backup tests (vitessio#14753)
  • Loading branch information
frouioui authored and ejortegau committed Dec 13, 2023
1 parent 8dc7600 commit a0239ea
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 @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
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"
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

0 comments on commit a0239ea

Please sign in to comment.