Skip to content

Commit

Permalink
Make sure to use mariadb* commands
Browse files Browse the repository at this point in the history
  • Loading branch information
fauust committed Mar 1, 2024
1 parent 8937ff0 commit 01de9db
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 56 deletions.
48 changes: 24 additions & 24 deletions scripts/bash_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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() {
Expand Down
12 changes: 6 additions & 6 deletions scripts/deb-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions scripts/deb-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 9 additions & 17 deletions scripts/rpm-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,37 +66,29 @@ 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

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"
12 changes: 5 additions & 7 deletions scripts/rpm-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 01de9db

Please sign in to comment.