Skip to content

Commit

Permalink
Avoid long lines
Browse files Browse the repository at this point in the history
Long lines makes it complex to track changes in git, avoid when
possible.
  • Loading branch information
fauust authored and RazvanLiviuVarzaru committed Nov 20, 2024
1 parent 08c5f88 commit a1bf6ee
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 25 deletions.
44 changes: 32 additions & 12 deletions scripts/deb-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,27 @@ set -x

# Due to MDEV-14622 and its effect on Spider installation,
# Spider has to be installed separately after the server
package_list=$(grep "^Package:" Packages | grep -vE 'galera|spider|columnstore' | awk '{print $2}' | xargs)
package_list=$(grep "^Package:" Packages |
grep -vE 'galera|spider|columnstore' |
awk '{print $2}' | xargs)
if grep -qi spider Packages; then
spider_package_list=$(grep "^Package:" Packages | grep 'spider' | awk '{print $2}' | xargs)
spider_package_list=$(grep "^Package:" Packages |
grep 'spider' | awk '{print $2}' | xargs)
fi
if grep -qi columnstore Packages; then
if [[ $arch != "amd64" ]] && [[ $arch != "arm64" ]]; then
bb_log_warn "Due to MCOL-4123, Columnstore won't be installed on $arch"
else
columnstore_package_list=$(grep "^Package:" Packages | grep 'columnstore' | awk '{print $2}' | xargs)
columnstore_package_list=$(grep "^Package:" Packages |
grep 'columnstore' | awk '{print $2}' | xargs)
fi
fi

# apt get update may be running in the background (Ubuntu start).
apt_get_update

sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get install -y $package_list $columnstore_package_list"
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get install -y $package_list $columnstore_package_list"

# MDEV-14622: Wait for mysql_upgrade running in the background to finish
wait_for_mariadb_upgrade
Expand All @@ -77,7 +82,8 @@ if [[ $systemdCapability == "yes" ]]; then
sudo journalctl -xe --no-pager
bb_log_warn "mariadb service isn't running properly after installation"
if echo "$package_list" | grep -q columnstore; then
bb_log_info "It is likely to be caused by ColumnStore problems upon installation, getting the logs"
bb_log_info "It is likely to be caused by ColumnStore"
bb_log_info "problems upon installation, getting the logs"
set +e
# It is done in such a weird way, because Columnstore currently makes its
# logs hard to read
Expand All @@ -99,10 +105,19 @@ fi
# Due to MDEV-14622 and its effect on Spider installation,
# Spider has to be installed separately after the server
if [[ -n $spider_package_list ]]; then
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get install -y $spider_package_list"
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get install -y $spider_package_list"
fi

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 --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 @@ -124,13 +139,18 @@ set +e
# sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get install -y mariadb-test"
if dpkg -l | grep -i spider >/dev/null; then
bb_log_warn "Workaround for MDEV-22979, otherwise server hangs further in SST steps"
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get remove --allow-unauthenticated -y mariadb-plugin-spider" || true
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get purge --allow-unauthenticated -y mariadb-plugin-spider" || true
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get remove --allow-unauthenticated -y mariadb-plugin-spider" || true
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get purge --allow-unauthenticated -y mariadb-plugin-spider" || true
fi
if dpkg -l | grep -i columnstore >/dev/null; then
bb_log_warn "Workaround for a bunch of Columnstore bugs, otherwise mysqldump in SST steps fails when Columnstore returns errors"
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get remove --allow-unauthenticated -y mariadb-plugin-columnstore" || true
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get purge --allow-unauthenticated -y mariadb-plugin-columnstore" || true
bb_log_warn "Workaround for a bunch of Columnstore bugs"
bb_log_warn "otherwise mysqldump in SST steps fails when Columnstore returns errors"
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get remove --allow-unauthenticated -y mariadb-plugin-columnstore" || true
sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get purge --allow-unauthenticated -y mariadb-plugin-columnstore" || true
fi

bb_log_ok "all done"
23 changes: 16 additions & 7 deletions scripts/deb-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ case $test_mode in
all)
get_packages_file_mirror
if grep -qi columnstore Packages; then
bb_log_warn "due to MCOL-4120 (Columnstore leaves the server shut down) and other bugs Columnstore upgrade is tested separately"
bb_log_warn "due to MCOL-4120 (Columnstore leaves the server shut down)"
bb_log_warn "and other bugs Columnstore upgrade is tested separately"
fi
package_list=$(grep "^Package:" Packages | grep -vE 'galera|spider|columnstore' | awk '{print $2}' | sort -u | xargs)
package_list=$(grep "^Package:" Packages |
grep -vE 'galera|spider|columnstore' |
awk '{print $2}' | sort -u | xargs)
if grep -qi spider Packages; then
bb_log_warn "due to MDEV-14622 Spider will be installed separately after the server"
spider_package_list=$(grep "^Package:" Packages | grep 'spider' | awk '{print $2}' | sort -u | xargs)
spider_package_list=$(grep "^Package:" Packages |
grep 'spider' | awk '{print $2}' |
sort -u | xargs)
fi
if grep -si tokudb Packages; then
# For the sake of installing TokuDB, disable hugepages
Expand Down Expand Up @@ -105,15 +110,17 @@ apt_get_update
# We will wait till they finish, to avoid any clashes with SQL we are going to execute
wait_for_mariadb_upgrade

if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"; then
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"; then
bb_log_err "Installation of a previous release failed, see the output above"
exit 1
fi

wait_for_mariadb_upgrade

if [[ -n $spider_package_list ]]; then
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"; then
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"; then
bb_log_err "Installation of Spider from the previous release failed, see the output above"
exit 1
fi
Expand Down Expand Up @@ -158,14 +165,16 @@ deb_setup_bb_artifacts_mirror
apt_get_update

# Install the new packages
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"; then
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $package_list"; then
bb_log_err "installation of the new packages failed, see the output above"
exit 1
fi
wait_for_mariadb_upgrade

if [[ -n $spider_package_list ]]; then
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"; then
if ! sudo sh -c "DEBIAN_FRONTEND=noninteractive MYSQLD_STARTUP_TIMEOUT=180 \
apt-get -o Dpkg::Options::=--force-confnew install --allow-unauthenticated -y $spider_package_list"; then
bb_log_err "Installation of the new Spider packages failed, see the output above"
exit 1
fi
Expand Down
26 changes: 20 additions & 6 deletions scripts/rpm-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ else
fi
set -u

sh -c 'g=/usr/lib*/galera*/libgalera_smm.so; echo -e "[galera]\nwsrep_provider=$g"' | sudo tee /etc/my.cnf.d/galera.cnf
sh -c 'g=/usr/lib*/galera*/libgalera_smm.so; echo -e "[galera]\nwsrep_provider=$g"' |
sudo tee /etc/my.cnf.d/galera.cnf
case "$systemdCapability" in
yes)
if ! sudo systemctl start mariadb; then
Expand All @@ -69,17 +70,30 @@ case "$systemdCapability" in
sudo /etc/init.d/mysql restart
;;
*)
bb_log_warn "should never happen, check your configuration (systemdCapability property is not set or is set to a wrong value)"
bb_log_warn "should never happen, check your configuration:"
bb_log_warn "(systemdCapability property is not set or is set to a wrong value)"
;;
esac

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;'
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 echo "$pkg_list" | grep -qi columnstore; then
sudo mariadb --verbose -e "create database cs; use cs; create table cs.t_columnstore (a int, b char(8)) engine=Columnstore; 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)) engine=Columnstore; \
insert into cs.t_columnstore select seq, concat('val',seq) from seq_1_to_10; \
select * from cs.t_columnstore"
sudo systemctl restart mariadb
sudo mariadb --verbose -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
sudo mariadb --verbose -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
sudo mariadb -e 'show global status like "wsrep%%"'
bb_log_info "test for MDEV-18563, MDEV-18526"
Expand Down

0 comments on commit a1bf6ee

Please sign in to comment.