From 01de9db73734b546a582cd3cf7574787502f23e1 Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Wed, 28 Feb 2024 15:43:49 +0100 Subject: [PATCH] Make sure to use mariadb* commands --- scripts/bash_lib.sh | 48 +++++++++++++++++++++--------------------- scripts/deb-install.sh | 12 +++++------ scripts/deb-upgrade.sh | 4 ++-- scripts/rpm-install.sh | 26 ++++++++--------------- scripts/rpm-upgrade.sh | 12 +++++------ 5 files changed, 46 insertions(+), 56 deletions(-) diff --git a/scripts/bash_lib.sh b/scripts/bash_lib.sh index 3a672012..dd0a33a6 100644 --- a/scripts/bash_lib.sh +++ b/scripts/bash_lib.sh @@ -390,15 +390,15 @@ upgrade_test_type() { check_mariadb_server_and_create_structures() { # All the commands below should succeed set -e - sudo mysql -e "CREATE DATABASE db" - sudo mysql -e "CREATE TABLE db.t_innodb(a1 SERIAL, c1 CHAR(8)) ENGINE=InnoDB; INSERT INTO db.t_innodb VALUES (1,'foo'),(2,'bar')" - sudo mysql -e "CREATE TABLE db.t_myisam(a2 SERIAL, c2 CHAR(8)) ENGINE=MyISAM; INSERT INTO db.t_myisam VALUES (1,'foo'),(2,'bar')" - sudo mysql -e "CREATE TABLE db.t_aria(a3 SERIAL, c3 CHAR(8)) ENGINE=Aria; INSERT INTO db.t_aria VALUES (1,'foo'),(2,'bar')" - sudo mysql -e "CREATE TABLE db.t_memory(a4 SERIAL, c4 CHAR(8)) ENGINE=MEMORY; INSERT INTO db.t_memory VALUES (1,'foo'),(2,'bar')" - sudo mysql -e "CREATE ALGORITHM=MERGE VIEW db.v_merge AS SELECT * FROM db.t_innodb, db.t_myisam, db.t_aria" - sudo mysql -e "CREATE ALGORITHM=TEMPTABLE VIEW db.v_temptable AS SELECT * FROM db.t_innodb, db.t_myisam, db.t_aria" - sudo mysql -e "CREATE PROCEDURE db.p() SELECT * FROM db.v_merge" - sudo mysql -e "CREATE FUNCTION db.f() RETURNS INT DETERMINISTIC RETURN 1" + sudo mariadb -e "CREATE DATABASE db" + sudo mariadb -e "CREATE TABLE db.t_innodb(a1 SERIAL, c1 CHAR(8)) ENGINE=InnoDB; INSERT INTO db.t_innodb VALUES (1,'foo'),(2,'bar')" + sudo mariadb -e "CREATE TABLE db.t_myisam(a2 SERIAL, c2 CHAR(8)) ENGINE=MyISAM; INSERT INTO db.t_myisam VALUES (1,'foo'),(2,'bar')" + sudo mariadb -e "CREATE TABLE db.t_aria(a3 SERIAL, c3 CHAR(8)) ENGINE=Aria; INSERT INTO db.t_aria VALUES (1,'foo'),(2,'bar')" + sudo mariadb -e "CREATE TABLE db.t_memory(a4 SERIAL, c4 CHAR(8)) ENGINE=MEMORY; INSERT INTO db.t_memory VALUES (1,'foo'),(2,'bar')" + sudo mariadb -e "CREATE ALGORITHM=MERGE VIEW db.v_merge AS SELECT * FROM db.t_innodb, db.t_myisam, db.t_aria" + sudo mariadb -e "CREATE ALGORITHM=TEMPTABLE VIEW db.v_temptable AS SELECT * FROM db.t_innodb, db.t_myisam, db.t_aria" + sudo mariadb -e "CREATE PROCEDURE db.p() SELECT * FROM db.v_merge" + sudo mariadb -e "CREATE FUNCTION db.f() RETURNS INT DETERMINISTIC RETURN 1" if [[ $test_mode == "columnstore" ]]; then if ! mysql -e "CREATE TABLE db.t_columnstore(a INT, c VARCHAR(8)) ENGINE=ColumnStore; SHOW CREATE TABLE db.t_columnstore; INSERT INTO db.t_columnstore VALUES (1,'foo'),(2,'bar')"; then get_columnstore_logs @@ -410,24 +410,24 @@ check_mariadb_server_and_create_structures() { check_mariadb_server_and_verify_structures() { # Print "have_xx" capabilitites for the new server - mysql -e "select 'Stat' t, variable_name name, variable_value val from information_schema.global_status where variable_name like '%have%' union select 'Vars' t, variable_name name, variable_value val from information_schema.global_variables where variable_name like '%have%' order by t, name" + sudo mariadb -e "select 'Stat' t, variable_name name, variable_value val from information_schema.global_status where variable_name like '%have%' union select 'Vars' t, variable_name name, variable_value val from information_schema.global_variables where variable_name like '%have%' order by t, name" # All the commands below should succeed set -e - sudo mysql -e "select @@version, @@version_comment" - sudo mysql -e "SHOW TABLES IN db" - sudo mysql -e "SELECT * FROM db.t_innodb; INSERT INTO db.t_innodb VALUES (3,'foo'),(4,'bar')" - sudo mysql -e "SELECT * FROM db.t_myisam; INSERT INTO db.t_myisam VALUES (3,'foo'),(4,'bar')" - sudo mysql -e "SELECT * FROM db.t_aria; INSERT INTO db.t_aria VALUES (3,'foo'),(4,'bar')" + sudo mariadb -e "select @@version, @@version_comment" + sudo mariadb -e "SHOW TABLES IN db" + sudo mariadb -e "SELECT * FROM db.t_innodb; INSERT INTO db.t_innodb VALUES (3,'foo'),(4,'bar')" + sudo mariadb -e "SELECT * FROM db.t_myisam; INSERT INTO db.t_myisam VALUES (3,'foo'),(4,'bar')" + sudo mariadb -e "SELECT * FROM db.t_aria; INSERT INTO db.t_aria VALUES (3,'foo'),(4,'bar')" bb_log_info "If the next INSERT fails with a duplicate key error," bb_log_info "it is likely because the server was not upgraded or restarted after upgrade" - sudo mysql -e "SELECT * FROM db.t_memory; INSERT INTO db.t_memory VALUES (1,'foo'),(2,'bar')" - sudo mysql -e "SELECT COUNT(*) FROM db.v_merge" - sudo mysql -e "SELECT COUNT(*) FROM db.v_temptable" - sudo mysql -e "CALL db.p()" - sudo mysql -e "SELECT db.f()" + sudo mariadb -e "SELECT * FROM db.t_memory; INSERT INTO db.t_memory VALUES (1,'foo'),(2,'bar')" + sudo mariadb -e "SELECT COUNT(*) FROM db.v_merge" + sudo mariadb -e "SELECT COUNT(*) FROM db.v_temptable" + sudo mariadb -e "CALL db.p()" + sudo mariadb -e "SELECT db.f()" if [[ $test_mode == "columnstore" ]]; then - if ! mysql -e "SELECT * FROM db.t_columnstore; INSERT INTO db.t_columnstore VALUES (3,'foo'),(4,'bar')"; then + if ! sudo mariadb -e "SELECT * FROM db.t_columnstore; INSERT INTO db.t_columnstore VALUES (3,'foo'),(4,'bar')"; then get_columnstore_logs exit 1 fi @@ -448,9 +448,9 @@ control_mariadb_server() { } store_mariadb_server_info() { - sudo mysql --skip-column-names -e "select @@version" | awk -F'-' '{ print $1 }' >"/tmp/version.$1" - sudo mysql --skip-column-names -e "select engine, support, transactions, savepoints from information_schema.engines" | sort >"/tmp/engines.$1" - sudo mysql --skip-column-names -e "select plugin_name, plugin_status, plugin_type, plugin_library, plugin_license from information_schema.all_plugins" | sort >"/tmp/plugins.$1" + sudo mariadb --skip-column-names -e "select @@version" | awk -F'-' '{ print $1 }' >"/tmp/version.$1" + sudo mariadb --skip-column-names -e "select engine, support, transactions, savepoints from information_schema.engines" | sort >"/tmp/engines.$1" + sudo mariadb --skip-column-names -e "select plugin_name, plugin_status, plugin_type, plugin_library, plugin_license from information_schema.all_plugins" | sort >"/tmp/plugins.$1" } check_upgraded_versions() { diff --git a/scripts/deb-install.sh b/scripts/deb-install.sh index 7e3eeef7..3e74bd48 100755 --- a/scripts/deb-install.sh +++ b/scripts/deb-install.sh @@ -102,8 +102,8 @@ if [[ -n $spider_package_list ]]; then sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get install -y $spider_package_list" fi -sudo mysql --verbose -e "create database test; use test; create table t(a int primary key) engine=innodb; insert into t values (1); select * from t; drop table t; drop database test; create user galera identified by 'gal3ra123'; grant all on *.* to galera;" -sudo mysql -e "select @@version" +sudo mariadb --verbose -e "create database test; use test; create table t(a int primary key) engine=innodb; insert into t values (1); select * from t; drop table t; drop database test; create user galera identified by 'gal3ra123'; grant all on *.* to galera;" +sudo mariadb -e "select @@version" bb_log_info "test for MDEV-18563, MDEV-18526" set +e @@ -112,13 +112,13 @@ control_mariadb_server stop sleep 1 sudo pkill -9 mysqld for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; do - if test -x $p/mysql_install_db; then - sudo $p/mysql_install_db --no-defaults --user=mysql --plugin-maturity=unknown + if test -x $p/mariadb-install-db; then + sudo $p/mariadb-install-db --no-defaults --user=mysql --plugin-maturity=unknown else - bb_log_info "$p/mysql_install_db does not exist" + bb_log_info "$p/mariadb-install-db does not exist" fi done -sudo mysql_install_db --no-defaults --user=mysql --plugin-maturity=unknown +sudo mariadb-install-db --no-defaults --user=mysql --plugin-maturity=unknown set +e ## Install mariadb-test for further use # sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get install -y mariadb-test" diff --git a/scripts/deb-upgrade.sh b/scripts/deb-upgrade.sh index bc1ca3b5..a1cf8335 100755 --- a/scripts/deb-upgrade.sh +++ b/scripts/deb-upgrade.sh @@ -226,11 +226,11 @@ wait_for_mariadb_upgrade # run mysql_upgrade for non GA branches if [[ $major_version == "$development_branch" ]]; then - sudo mysql_upgrade + sudo mariadb-upgrade fi # Make sure that the new server is running -if sudo mysql -e "select @@version" | grep "$(cat /tmp/version.old)"; then +if sudo mariadb -e "select @@version" | grep "$(cat /tmp/version.old)"; then bb_log_err "the server was not upgraded or was not restarted after upgrade" exit 1 fi diff --git a/scripts/rpm-install.sh b/scripts/rpm-install.sh index 7de715cc..0f6446ee 100755 --- a/scripts/rpm-install.sh +++ b/scripts/rpm-install.sh @@ -66,23 +66,15 @@ case "$systemdCapability" in ;; esac -if [ "${master_branch}" != "10.3" ]; then - bb_log_info "uninstallation of Cracklib plugin may fail if it wasn't installed, it's quite all right" - if sudo mysql -e "uninstall soname 'cracklib_password_check.so'"; then - # shellcheck disable=SC2034 - reinstall_cracklib_plugin="YES" - fi - sudo mysql -e "set password=''" -fi -mysql -uroot -e 'drop database if exists test; create database test; use test; create table t(a int primary key) engine=innodb; insert into t values (1); select * from t; drop table t;' +sudo mariadb -e 'drop database if exists test; create database test; use test; create table t(a int primary key) engine=innodb; insert into t values (1); select * from t; drop table t;' if find rpms/*.rpm | grep -qi columnstore; then - mysql --verbose -uroot -e "create database cs; use cs; create table cs.t_columnstore (a int, b char(8)); insert into cs.t_columnstore select seq, concat('val',seq) from seq_1_to_10; select * from cs.t_columnstore" + sudo mariadb --verbose -e "create database cs; use cs; create table cs.t_columnstore (a int, b char(8)); insert into cs.t_columnstore select seq, concat('val',seq) from seq_1_to_10; select * from cs.t_columnstore" sudo systemctl restart mariadb - mysql --verbose -uroot -e "select * from cs.t_columnstore; update cs.t_columnstore set b = 'updated'" + sudo mariadb --verbose -e "select * from cs.t_columnstore; update cs.t_columnstore set b = 'updated'" sudo systemctl restart mariadb-columnstore - mysql --verbose -uroot -e "update cs.t_columnstore set a = a + 10; select * from cs.t_columnstore" + sudo mariadb --verbose -e "update cs.t_columnstore set a = a + 10; select * from cs.t_columnstore" fi -mysql -uroot -e 'show global status like "wsrep%%"' +sudo mariadb -e 'show global status like "wsrep%%"' bb_log_info "test for MDEV-18563, MDEV-18526" set +e control_mariadb_server stop @@ -90,13 +82,13 @@ control_mariadb_server stop sleep 1 sudo pkill -9 mysqld for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; do - if test -x $p/mysql_install_db; then - sudo $p/mysql_install_db --no-defaults --user=mysql --plugin-maturity=unknown + if test -x $p/mariadb-install-db; then + sudo $p/mariadb-install-db --no-defaults --user=mysql --plugin-maturity=unknown else - bb_log_warn "$p/mysql_install_db does not exist" + bb_log_warn "$p/mariadb-install-db does not exist" fi done -sudo mysql_install_db --no-defaults --user=mysql --plugin-maturity=unknown +sudo mariadb-install-db --no-defaults --user=mysql --plugin-maturity=unknown set +e bb_log_ok "all done" diff --git a/scripts/rpm-upgrade.sh b/scripts/rpm-upgrade.sh index 5b93e587..532f1dbc 100755 --- a/scripts/rpm-upgrade.sh +++ b/scripts/rpm-upgrade.sh @@ -11,10 +11,6 @@ set -e # shellcheck disable=SC1091 . ./bash_lib.sh -# yum/dnf switch -# //TEMP implement zipper (SLES) -pkg_cmd=$(rpm_pkg) - # function to be able to run the script manually (see bash_lib.sh) manual_run_switch "$1" @@ -44,6 +40,7 @@ rpm_pkg_makecache rpm_setup_mariadb_mirror "$prev_major_version" +# Define the list of packages to install/upgrade case $test_mode in all) # retrieve full package list from repo @@ -269,14 +266,15 @@ if [[ $test_type == "major" ]]; then fi # Make sure that the new server is running -if sudo mysql -e "select @@version" | grep "$old_version"; then +if sudo mariadb -e "select @@version" | grep "$old_version"; then bb_log_err "the server was not upgraded or was not restarted after upgrade" exit 1 fi -# Run mysql_upgrade for non-GA branches (minor upgrades in GA branches shouldn't need it) +# Run mariadb-upgrade for non-GA branches (minor upgrades in GA branches +# shouldn't need it) if [[ $major_version == "$development_branch" ]] || [[ $test_type == "major" ]]; then - sudo mysql_upgrade + sudo mariadb-upgrade fi set +e