Skip to content

Commit

Permalink
[release-18.0] Add a retry to remove the vttablet directory during up…
Browse files Browse the repository at this point in the history
…grade/downgrade backup tests (vitessio#14753) (vitessio#14758)

Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
  • Loading branch information
vitess-bot[bot] authored Dec 12, 2023
1 parent 70846ec commit 9c2d6cf
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 9c2d6cf

Please sign in to comment.