@@ -200,10 +200,24 @@ blhc:
200200 - dpkg -l | grep -iE 'maria|mysql|galera'
201201 # library tests don't have the mariadb client nor server, so don't check them
202202
203+ .test-verify-using-legacy-data-directory : &test-verify-using-legacy-data-directory
204+ # Verify that /var/lib/mysql is still in use as the data directory, and /var/lib/mariadb does not exist.
205+ - |
206+ test -d /var/lib/mysql || { echo "ERROR: Expected legacy data directory /var/lib/mysql does not exist"; exit 1; }
207+ test -d /var/lib/mariadb && { echo "ERROR: Legacy install has new data directory /var/lib/mariadb that should not exist"; exit 1; } || true
208+ mariadbd --help --verbose 2>/dev/null | grep --only-matching --perl-regex "datadir[ ]+\K(.*)" | grep /var/lib/mysql/ 1>/dev/null || { echo "ERROR: Legacy install is not using /var/lib/mysql as data directory"; exit 1; }
209+
210+ .test-verify-using-new-data-directory : &test-verify-using-new-data-directory
211+ # Verify that /var/lib/mariadb is in use as the data directory.
212+ - |
213+ test -d /var/lib/mariadb || { echo "ERROR: Expected new data directory /var/lib/mariadb does not exist"; exit 1; }
214+ mariadbd --help --verbose 2>/dev/null | grep --only-matching --perl-regex "datadir[ ]+\K(.*)" | grep /var/lib/mariadb/ 1>/dev/null || { echo "ERROR: New install is not using /var/lib/mariadb as data directory"; exit 1; }
215+
203216.test-verify-final : &test-verify-final |
204217 dpkg -l | grep -e "mariadb-server.*10\.11"
205218 mkdir -p debug # Ensure dir exists before using it
206219 find /var/lib/mysql -ls > debug/var-lib-mysql.list || true # Ignore errors about "no such file or directory"
220+ find /var/lib/mariadb -ls > debug/var-lib-mariadb.list || true # Ignore errors about "no such file or directory"
207221 cp -ra /etc/mysql debug/etc-mysql
208222 mariadb --skip-column-names -e "select @@version, @@version_comment" # Show version
209223 mariadb --table -e "SHOW DATABASES;" # List databases
@@ -346,6 +360,7 @@ fresh install:
346360 - *test-prepare-container
347361 - *test-install-all
348362 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
363+ - *test-verify-using-new-data-directory
349364 - *test-verify-final
350365
351366simple upgrade :
@@ -356,6 +371,7 @@ simple upgrade:
356371 - apt-get install -qq --yes 'default-mysql*' ${BUILT_PACKAGES}
357372 - *test-full-upgrade
358373 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
374+ - *test-verify-using-legacy-data-directory
359375 - *test-verify-final
360376
361377mariadb and Bookworm upgrade :
@@ -374,6 +390,7 @@ mariadb and Bookworm upgrade:
374390 - service mariadb restart
375391 - *test-full-upgrade
376392 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
393+ - *test-verify-using-legacy-data-directory
377394 - *test-verify-final
378395
379396mariadb-10.6 and Bookworm-20230208 upgrade :
@@ -397,6 +414,7 @@ mariadb-10.6 and Bookworm-20230208 upgrade:
397414 - *test-full-upgrade
398415 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
399416 - apt-get purge --yes mariadb*10.?
417+ - *test-verify-using-legacy-data-directory
400418 - *test-verify-final
401419
402420mariadb-10.6 and Jammy upgrade :
@@ -423,6 +441,7 @@ mariadb-10.6 and Jammy upgrade:
423441 # Due to usrmerge, full-upgrade from Jammy to Trixie or newer cannot work
424442 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
425443 - apt-get purge --yes mariadb*10.?
444+ - *test-verify-using-legacy-data-directory
426445 - *test-verify-final
427446
428447mariadb-10.5 and Bullseye upgrade :
@@ -445,6 +464,7 @@ mariadb-10.5 and Bullseye upgrade:
445464 # Due to usrmerge, full-upgrade from Bullseye to Trixie or newer cannot work
446465 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
447466 - apt-get purge --yes mariadb*10.?
467+ - *test-verify-using-legacy-data-directory
448468 - *test-verify-final
449469
450470mariadb-10.3 and Buster upgrade :
@@ -504,6 +524,7 @@ mariadb-10.3 and Focal upgrade:
504524 # Give the mariadb-upgrade plenty of time to complete, otherwise next commands
505525 # fail on non-existing mariadb.sys user
506526 - sleep 15
527+ - *test-verify-using-legacy-data-directory
507528 - *test-verify-final
508529
509530# Similar to the Cacti install test, check that MariaDB consumer Zoph upgrades
@@ -524,6 +545,7 @@ default-mysql-server and Bookworm upgrade:
524545 - apt-get install -qq --yes default-mysql-server
525546 - *test-full-upgrade
526547 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
548+ - *test-verify-using-legacy-data-directory
527549 - *test-verify-final
528550
529551# Similar to the Cacti install test, check that MariaDB consumer Zoph upgrades
@@ -544,6 +566,7 @@ default-mysql-server and Bullseye upgrade:
544566 - apt-get install -qq --yes default-mysql-server
545567 # Due to usrmerge, full-upgrade from Bullseye to Trixie or newer cannot work
546568 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
569+ - *test-verify-using-legacy-data-directory
547570 - *test-verify-final
548571
549572test basic features :
@@ -552,6 +575,7 @@ test basic features:
552575 - *test-prepare-container
553576 - *test-install-all
554577 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
578+ - *test-verify-using-new-data-directory
555579 - *test-verify-final
556580 - |
557581 # Print info about server
@@ -730,6 +754,7 @@ mysql-8.0 in Sid upgrade:
730754 # the service name 'mariadb' instead, and the fallback is always used.
731755 - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
732756 - service mysql status || service mariadb status
757+ - *test-verify-using-new-data-directory
733758 - *test-verify-final
734759
735760# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
@@ -759,6 +784,7 @@ mysql-8.0 in Ubuntu 23.10 upgrade:
759784 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
760785 # Remove everything MySQL except mysql-common which also MariaDB depends on
761786 - apt-get purge --yes mysql-s* mysql-cl* libmysql*
787+ - *test-verify-using-new-data-directory
762788 - *test-verify-final
763789
764790# Upgrading from MySQL 8.0 with datadir in place is not possible. Users need to do a data dump.
@@ -789,6 +815,7 @@ mysql-community-cluster-8.0 from MySQL.com with Bookworm upgrade:
789815 - systemctl status mysql || true
790816 - mysql -e 'SELECT VERSION()' || true
791817 - sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
818+ - *test-verify-using-new-data-directory
792819 - *test-verify-final
793820
794821mariadb.org-10.11 upgrade :
@@ -856,6 +883,7 @@ mariadb.org-10.7 upgrade:
856883 - *test-verify-initial
857884 - *test-install-all
858885 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
886+ - *test-verify-using-legacy-data-directory
859887 - *test-verify-final
860888
861889mariadb.org-10.6 upgrade :
@@ -871,6 +899,7 @@ mariadb.org-10.6 upgrade:
871899 - *test-verify-initial
872900 - *test-install-all
873901 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
902+ - *test-verify-using-legacy-data-directory
874903 - *test-verify-final
875904
876905# archive.mariadb.org for Debian Sid latest is 10.5.13
@@ -885,6 +914,7 @@ mariadb.org-10.5 upgrade:
885914 - *test-verify-initial
886915 - *test-install-all
887916 - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
917+ - *test-verify-using-legacy-data-directory
888918 - *test-verify-final
889919
890920# archive.mariadb.org for Debian Sid latest is 10.4.17
@@ -1013,4 +1043,5 @@ percona-xtradb-5.7 with Bookworm upgrade:
10131043 # Percona package owned /etc/init.d/mysql, so on removal and upgrade to MariaDB old service name can't be referenced anymore
10141044 - service mariadb status
10151045 - sleep 15 # Give the mysql_upgrade a bit of extra time to complete with MySQL 5.7 before querying the server
1046+ - *test-verify-using-new-data-directory
10161047 - *test-verify-final
0 commit comments