fleet/tools/percona/test/upgrade.sh
Lucas Manuel Rodriguez 1afb015f6c
Test DB migrations with Percona XtraDB MySQL server 5.7.25 (#16320)
#15881

This PR adds a script to test DB migrations with Percona XtraDB 5.7.25.

PS: To run this test before we merge this PR to `main` you will need to
change step 2 (`Make sure to be on latest main`), instead of `main` use
this branch `15881-test-migrations-with-percona`.
2024-01-29 14:21:37 -03:00

42 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -x
set -e
# Up to `fleet-v4.40.0` there are no migration issues with Percona Server XtraDB's `pxc_strict_mode=ENFORCING` default value.
# We introduced issues with `pxc_strict_mode=ENFORCING` in DB migrations in `fleet-v4.41.0` and in `fleet-v4.42.0`.
# Bring everything down.
docker compose down
docker volume rm fleet_mysql-persistent-volume
# Start dependencies using Percona XtraDB as MySQL server.
# NOTE: To troubleshoot, remove `>/dev/null`.
FLEET_MYSQL_IMAGE=percona/percona-xtradb-cluster:5.7.25 docker compose up >/dev/null 2>&1 &
export MYSQL_PWD=toor
until mysql --host 127.0.0.1 --port 3306 -uroot -e 'SELECT 1=1;' ; do
echo "Waiting for Percona XtraDB MySQL Server..."
sleep 10
done
echo "Percona XtraDB MySQL Server is up and running, continuing..."
# Checkout and build `fleet-4.42.0`.
git checkout fleet-v4.42.0
make generate && make fleet
# Set pxc_strict_mode=PERMISSIVE to run migrations up to fleet-v4.42.0,
# which was the last migration released with `pxc_strict_mode=ENFORCING` issues.
mysql --host 127.0.0.1 --port 3306 -uroot -e 'SET GLOBAL pxc_strict_mode=PERMISSIVE;'
# Run migrations up to fleet-v4.42.0.
make db-reset
# Set `pxc_strict_mode` back to the `ENFORCING` default.
mysql --host 127.0.0.1 --port 3306 -uroot -e 'SET GLOBAL pxc_strict_mode=ENFORCING;'
# Run migrations from fleet-v4.42.0 up to latest to catch any future bugs when running with `pxc_strict_mode=ENFORCING`.
git checkout main
make generate && make fleet
./build/fleet prepare db --dev --logging_debug