diff options
author | Andrew Hutchings <andrew@linuxjedi.co.uk> | 2022-12-16 15:51:38 +0000 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2022-12-21 15:37:51 +1100 |
commit | 18a906f49a25fdfcbf4b07fb86e12bc945c202a8 (patch) | |
tree | 3a3ce3c8748710fefd30ddaaeaeb1944e84436c5 | |
parent | 5b67d286d5ea690e043359cbd741fcc2e5a570f7 (diff) | |
download | mariadb-git-bb-11.0-danielblack-MDEV-30203-pkgtest-symlink-packages-salsa.tar.gz |
MDEV-30275: mariadb names rather than mysql names should be usedbb-11.0-danielblack-MDEV-30203-pkgtest-symlink-packages-salsa
Fix bug in mariadb-service-convert
If mariadb-service-convert is run and the user variable is unset then
this sets `User=` in `[Service]`, which then tries to run mariadb as
root, which in-turn fails. This only happens when mysqld_safe is missing
which is all the time now. So...
1. Don't set `User=` if there is no user variable.
2. User mariadbd-safe instead.
Also
* galera_recovery to use mariadbd
* mtr - wsrep use mariadb executables
* debian/mariadb-server.mariadb.init use mariadbd-safe
* debian/tests/smoke uses mariadb instead of mysql as client.
Co-Author: Daniel Black <daniel@mariadb.org>
-rw-r--r-- | debian/mariadb-server.mariadb.init | 8 | ||||
-rw-r--r-- | debian/tests/smoke | 12 | ||||
-rw-r--r-- | mysql-test/suite/wsrep/common.pm | 8 | ||||
-rw-r--r-- | scripts/galera_recovery.sh | 2 | ||||
-rwxr-xr-x | scripts/mariadb-service-convert | 4 |
5 files changed, 20 insertions, 14 deletions
diff --git a/debian/mariadb-server.mariadb.init b/debian/mariadb-server.mariadb.init index 8417ea74852..cc004179894 100644 --- a/debian/mariadb-server.mariadb.init +++ b/debian/mariadb-server.mariadb.init @@ -34,6 +34,12 @@ else exit -1 fi +if [ ! -x /usr/bin/mariadbd-safe ] +then + log_failure_msg "/usr/bin/mariadbd-safe not found or executable! This SysV init script depends on it." + exit -1 +fi + # priority can be overridden and "-s" adds output to stderr ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i" @@ -127,7 +133,7 @@ case "${1:-''}" in test -e /run/mysqld || install -m 755 -o mysql -g root -d /run/mysqld # Start MariaDB! - /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER & + /usr/bin/mariadbd-safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER & for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do sleep 1 diff --git a/debian/tests/smoke b/debian/tests/smoke index 8b384c80c2f..b3e09acc8ae 100644 --- a/debian/tests/smoke +++ b/debian/tests/smoke @@ -45,28 +45,28 @@ else systemctl restart mariadb fi -mysql <<EOT +mariadb <<EOT CREATE DATABASE testdatabase; CREATE USER 'testuser'@'localhost' identified by 'testpassword'; GRANT ALL ON testdatabase.* TO 'testuser'@'localhost'; EOT -mysql testdatabase <<EOT +mariadb testdatabase <<EOT CREATE TABLE foo (bar INTEGER); INSERT INTO foo (bar) VALUES (41); EOT -result=$(echo 'SELECT bar+1 FROM foo;'|mysql --batch --skip-column-names --user=testuser --password=testpassword testdatabase) +result=$(echo 'SELECT bar+1 FROM foo;'|mariadb --batch --skip-column-names --user=testuser --password=testpassword testdatabase) if [ "$result" != "42" ]; then echo "Unexpected result" >&2 exit 1 fi -mysql --user=testuser --password=testpassword testdatabase <<EOT +mariadb --user=testuser --password=testpassword testdatabase <<EOT DROP TABLE foo; EOT -mysql <<EOT +mariadb <<EOT DROP DATABASE testdatabase; DROP USER 'testuser'@'localhost'; EOT @@ -94,7 +94,7 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] && LOG=/var/lib/mysql/#rocksdb/LOG # XXX: The server may only be started during the install of # mariadb-server, which happens before that of the plugin. - [ -e $LOG ] || mysql -e "INSTALL PLUGIN RocksDB SONAME 'ha_rocksdb';" + [ -e $LOG ] || mariadb -e "INSTALL PLUGIN RocksDB SONAME 'ha_rocksdb';" # XXX: rocksdb_supported_compression_types variable does not report ZSTD. # Print RocksDB supported items so test log is easier to debug diff --git a/mysql-test/suite/wsrep/common.pm b/mysql-test/suite/wsrep/common.pm index 8ac3b3ea94c..54ce8826563 100644 --- a/mysql-test/suite/wsrep/common.pm +++ b/mysql-test/suite/wsrep/common.pm @@ -43,10 +43,10 @@ sub check_wsrep_support() { mtr_error("No SST scripts") unless $spath; $ENV{PATH}="$spath:$ENV{PATH}"; - # ADD mysql client library path to path so that wsrep_notify_cmd can find mysql - # client for loading the tables. (Don't assume each machine has mysql install) - my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir; - mtr_error("No scritps") unless $cpath; + # ADD mariadb client to path so that wsrep_notify_cmd can find mariadb + # client for loading the tables. (Don't assume each machine has mariadb installed) + my ($cpath) = grep { -f "$_/mariadb"; } "$::bindir/scripts", $::path_client_bindir; + mtr_error("No mariadb client found") unless $cpath; $ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath; # ADD my_print_defaults script path to path so that SST scripts can find it diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index 8df2abc3fd5..9ff5e4e5f50 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -68,7 +68,7 @@ parse_arguments() { wsrep_recover_position() { # Redirect server's error log to the log file. - eval @sbindir@/mysqld $cmdline_args --user=$user --wsrep_recover \ + eval @sbindir@/mariadbd $cmdline_args --user=$user --wsrep_recover \ --disable-log-error 2> "$log_file" ret=$? if [ $ret -ne 0 ]; then diff --git a/scripts/mariadb-service-convert b/scripts/mariadb-service-convert index 38043733554..ee7af1b323f 100755 --- a/scripts/mariadb-service-convert +++ b/scripts/mariadb-service-convert @@ -25,7 +25,7 @@ tz_old=$TZ -. /usr/bin/mysqld_safe --dry-run +. /usr/bin/mariadbd-safe --dry-run echo "# converted using $0" echo "#" @@ -36,7 +36,7 @@ echo '[Service]' echo -if [[ ( "$user" != "root" && "$user" != "mysql" ) || "${SET_USER}" == 1 ]]; then +if [[ ( ! -z "$user" && "$user" != "root" && "$user" != "mysql" ) || "${SET_USER}" == 1 ]]; then echo User=$user fi |