Commit 2adaf5c2 authored by Otto Kekäläinen's avatar Otto Kekäläinen Committed by Daniel Black

MDEV-33750: Sync maintainer scripts etc with latest downstream 10.11.5 in Debian

Fix a large amount of minor fixes to maintainer scripts and other done
downstream in the official Debian packaging.

Changes include:

https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/38198d0b9e1c7821ddd074e308b25034bdcdce5b
> Limit check of running mysqld/mariadbd to system users (Closes: #1032047)
>
> If a random user has their own copy of mysqld/mariadbd running, the
> dpkg maintainer script should not care about it.

https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8116354d22e0b8eade6d8f0594c57300d5d5cff5
> Make error more helpful in case server restart fails (Related: #1033234)
>
> Bugs such as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033234
> and https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/2011293
> show that currently dpkg stopping on service stop/start does not have
> a very helpful error message.

https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/8675e97202171812a1afdb438a17cb29a99836fb
> Complement upstream commits with more complete mysql->mariadb conversion
>
> The upstream commit 952af4a1 missed some places where 'mysql' or
> 'MySQL' can and should be converted to use 'mariadb' or 'MariaDB'.

https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/c98361330063e7dccbf8d21aa20e48179ba5c1e4
> Fix indentation in Debian post and pre scripts
>
> There is several misindentation inside Debian post and pre
> installation scripts. False indentation with space as indent space
> should be 2 and indentation with tabs.
>
> Adopt upstream commit 7cbb45d1 in Debian by conserving customizations
> in:
> - debian/mariadb-server.postinst
> - debian/mariadb-server.postrm
> - debian/mariadb-server.preinst

https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/d0bcab443fa6d44084dc674ba29b79516c6239ba
> Ensure spaces are used everywhere instead of tabs for indentation

https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/0300a9157cc69f75e01ac9c0d6e033d8be661492
> Complement previous upstream commits to fix Shellcheck issues
>
> - Unify if/then and while/do on separate lines
> - Fix indentation to be consistent
> - Use "$()" instead of backticks for subshells
> - Exit code cannot be -1, must be 0-255
> - Remove unused variables MYCHECK and MYCHECK_PARAMS
> - Rewrite messy command-line database calls to an easier to read form
>   that does exactly the same
> - Use 'command -v' test instead of 'which'
>
> With this commit, all of debian/* is Shellcheck clean.

Also
* Update mariadb.conf.d template to tell users where to create logdir
  if they are not using journald
* Remove use of work 'slave'
* Add minor workaround for Debian Bug #1022994 if TMPDIR is empty
* Make start/stop in maintainer scripts correctly check mariadbd
  ownership and only start/stop processes owned by root or 'mysql'
* Remove obsolete 'NO_UPDATE_BUILD_VERSION=1' as it did not affect the
  RocksDB build reproducibility as previously assumed
* Run 'wrap-and-sort -av'
parent 5000d1ba
...@@ -6,14 +6,19 @@ ...@@ -6,14 +6,19 @@
# Changes to this file will be preserved when updating the Debian package. # Changes to this file will be preserved when updating the Debian package.
# #
# shellcheck source=debian/additions/debian-start.inc.sh
source /usr/share/mysql/debian-start.inc.sh source /usr/share/mysql/debian-start.inc.sh
# Read default/mysql first and then default/mariadb just like the init.d file does # Read default/mysql first and then default/mariadb just like the init.d file does
if [ -f /etc/default/mysql ]; then if [ -f /etc/default/mysql ]
then
# shellcheck source=/dev/null
. /etc/default/mysql . /etc/default/mysql
fi fi
if [ -f /etc/default/mariadb ]; then if [ -f /etc/default/mariadb ]
then
# shellcheck source=/dev/null
. /etc/default/mariadb . /etc/default/mariadb
fi fi
...@@ -21,9 +26,7 @@ MARIADB="/usr/bin/mariadb --defaults-file=/etc/mysql/debian.cnf" ...@@ -21,9 +26,7 @@ MARIADB="/usr/bin/mariadb --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf" MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf"
# Don't run full mariadb-upgrade on every server restart, use --version-check to do it only once # Don't run full mariadb-upgrade on every server restart, use --version-check to do it only once
MYUPGRADE="/usr/bin/mariadb-upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check --silent" MYUPGRADE="/usr/bin/mariadb-upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check --silent"
MYCHECK="/usr/bin/mariadb-check --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mariadb-check has found corrupt tables" MYCHECK_SUBJECT="WARNING: mariadb-check has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
MYCHECK_RCPT="${MYCHECK_RCPT:-root}" MYCHECK_RCPT="${MYCHECK_RCPT:-root}"
## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables. ## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables.
......
...@@ -21,26 +21,38 @@ function check_for_crashed_tables() { ...@@ -21,26 +21,38 @@ function check_for_crashed_tables() {
# spaces in the thing to be looped over. # spaces in the thing to be looped over.
# If a crashed table is encountered, the "mariadb" command will return with a status different from 0 # If a crashed table is encountered, the "mariadb" command will return with a status different from 0
#
# The first query will generate lines like.
# select count(*) into @discard from 'mysql'.'db'
# The second line will load all tables without printing any actual results,
# but may show warnings and definitely is expected to have some error and
# exit code if crashed tables are encountered.
#
# Note that inside single quotes must be quoted with '\'' (to be outside of single quotes).
set +e set +e
# The $MARIADB is intentionally used to expand into a command and arguments
LC_ALL=C $MARIADB --skip-column-names --batch -e ' # shellcheck disable=SC2086
select concat('\''select count(*) into @discard from `'\'', LC_ALL=C echo '
TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'') SELECT CONCAT("select count(*) into @discard from '\''", TABLE_SCHEMA, "'\''.'\''", TABLE_NAME, "'\''")
from information_schema.TABLES where TABLE_SCHEMA<>'\''INFORMATION_SCHEMA'\'' and TABLE_SCHEMA<>'\''PERFORMANCE_SCHEMA'\'' and ( ENGINE='\''MyISAM'\'' or ENGINE='\''Aria'\'' )' | \ FROM information_schema.TABLES WHERE TABLE_SCHEMA<>"INFORMATION_SCHEMA" AND TABLE_SCHEMA<>"PERFORMANCE_SCHEMA"
xargs -i ${MARIADB} --skip-column-names --silent --batch \ AND (ENGINE="MyISAM" OR ENGINE="Aria")
--force -e "{}" &>"${tempfile}" ' | \
$MARIADB --skip-column-names --batch | \
xargs -i $MARIADB --skip-column-names --silent --batch --force -e "{}" &> "${tempfile}"
set -e set -e
if [ -s "$tempfile" ]; then if [ -s "$tempfile" ]
then
( (
/bin/echo -e "\n" \ /bin/echo -e "\n" \
"Improperly closed tables are also reported if clients are accessing\n" \ "Improperly closed tables are also reported if clients are accessing\n" \
"the tables *now*. A list of current connections is below.\n"; "the tables *now*. A list of current connections is below.\n";
$MYADMIN processlist status $MYADMIN processlist status
) >> "${tempfile}" ) >> "${tempfile}"
# Check for presence as a dependency on mailx would require an MTA. # Check for presence as a dependency on mailx would require an MTA.
if [ -x /usr/bin/mailx ]; then if [ -x /usr/bin/mailx ]
mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < "$tempfile" then
mailx -e -s"$MYCHECK_SUBJECT" "$MYCHECK_RCPT" < "$tempfile"
fi fi
(echo "$MYCHECK_SUBJECT"; cat "${tempfile}") | logger -p daemon.warn -i -t"$0" (echo "$MYCHECK_SUBJECT"; cat "${tempfile}") | logger -p daemon.warn -i -t"$0"
fi fi
...@@ -54,13 +66,13 @@ function upgrade_system_tables_if_necessary() { ...@@ -54,13 +66,13 @@ function upgrade_system_tables_if_necessary() {
set -e set -e
set -u set -u
logger -p daemon.info -i -t"$0" "Upgrading MySQL tables if necessary." logger -p daemon.info -i -t"$0" "Upgrading MariaDB tables if necessary."
# Filter all "duplicate column", "duplicate key" and "unknown column" # Filter all "duplicate column", "duplicate key" and "unknown column"
# errors as the script is designed to be idempotent. # errors as the script is designed to be idempotent.
LC_ALL=C $MYUPGRADE \ LC_ALL=C $MYUPGRADE \
2>&1 \ 2>&1 \
| egrep -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \ | grep -E -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \
| logger -p daemon.warn -i -t"$0" | logger -p daemon.warn -i -t"$0"
} }
...@@ -72,8 +84,9 @@ function check_root_accounts() { ...@@ -72,8 +84,9 @@ function check_root_accounts() {
logger -p daemon.info -i -t"$0" "Checking for insecure root accounts." logger -p daemon.info -i -t"$0" "Checking for insecure root accounts."
ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='' and plugin in ('', 'mysql_native_password', 'mysql_old_password');" | $MARIADB --skip-column-names ) ret=$(echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='' and password_expired='N' and plugin in ('', 'mysql_native_password', 'mysql_old_password');" | $MARIADB --skip-column-names)
if [ "$ret" -ne "0" ]; then if [ "$ret" -ne "0" ]
then
logger -p daemon.warn -i -t"$0" "WARNING: mysql.user contains $ret root accounts without password!" logger -p daemon.warn -i -t"$0" "WARNING: mysql.user contains $ret root accounts without password!"
fi fi
} }
...@@ -44,6 +44,11 @@ bind-address = 127.0.0.1 ...@@ -44,6 +44,11 @@ bind-address = 127.0.0.1
# * Logging and Replication # * Logging and Replication
# #
# Note: The configured log file or its directory need to be created
# and be writable by the mysql user, e.g.:
# $ sudo mkdir -m 2750 /var/log/mysql
# $ sudo chown mysql /var/log/mysql
# Both location gets rotated by the cronjob. # Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer. # Be aware that this log type is a performance killer.
# Recommend only changing this at runtime for short testing periods if needed! # Recommend only changing this at runtime for short testing periods if needed!
...@@ -63,8 +68,8 @@ bind-address = 127.0.0.1 ...@@ -63,8 +68,8 @@ bind-address = 127.0.0.1
#log_slow_min_examined_row_limit = 1000 #log_slow_min_examined_row_limit = 1000
# The following can be used as easy to replay backup logs or for replication. # The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about # note: if you are setting up a replica, see README.Debian about other
# other settings you may need to change. # settings you may need to change.
#server-id = 1 #server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log #log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10 expire_logs_days = 10
......
...@@ -183,7 +183,7 @@ fi ...@@ -183,7 +183,7 @@ fi
# Use eatmydata is available to build faster with less I/O, skipping fsync() # Use eatmydata is available to build faster with less I/O, skipping fsync()
# during the entire build process (safe because a build can always be restarted) # during the entire build process (safe because a build can always be restarted)
if which eatmydata > /dev/null if command -v eatmydata > /dev/null
then then
BUILDPACKAGE_DPKGCMD+=("eatmydata") BUILDPACKAGE_DPKGCMD+=("eatmydata")
fi fi
......
== MariaDB == == MariaDB ==
The Debian package of MySQL was first debianzed on 1997-04-12 by Christian The Debian package of MySQL was first debianzed on 1997-04-12 by Christian
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
set -e set -e
# Install Mroonga # Install Mroonga
mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/install.sql || true mariadb --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/install.sql || true
# Always exit with success instead of leaving dpkg in a broken state # Always exit with success instead of leaving dpkg in a broken state
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
set -e set -e
# Uninstall Mroonga # Uninstall Mroonga
mysql --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/uninstall.sql || true mariadb --defaults-file=/etc/mysql/debian.cnf < /usr/share/mysql/mroonga/uninstall.sql || true
# Always exit with success instead of leaving dpkg in a broken state # Always exit with success instead of leaving dpkg in a broken state
......
...@@ -24,8 +24,8 @@ usr/share/mysql/english ...@@ -24,8 +24,8 @@ usr/share/mysql/english
usr/share/mysql/estonian usr/share/mysql/estonian
usr/share/mysql/fill_help_tables.sql usr/share/mysql/fill_help_tables.sql
usr/share/mysql/french usr/share/mysql/french
usr/share/mysql/german
usr/share/mysql/georgian usr/share/mysql/georgian
usr/share/mysql/german
usr/share/mysql/greek usr/share/mysql/greek
usr/share/mysql/hindi usr/share/mysql/hindi
usr/share/mysql/hungarian usr/share/mysql/hungarian
......
...@@ -2,13 +2,19 @@ ...@@ -2,13 +2,19 @@
set -e set -e
# shellcheck source=/dev/null
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi if [ -n "$DEBIAN_SCRIPT_DEBUG" ]
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } then
set -v -x; DEBIAN_SCRIPT_TRACE=1
fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2}
# Beware that there are two ypwhich one of them needs the 2>/dev/null! # Beware that there are two ypwhich one of them needs the 2>/dev/null!
if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then if test -n "$(command -v ypwhich 2>/dev/null)" && ypwhich > /dev/null 2>&1
then
db_input high mariadb-server/nis_warning || true db_input high mariadb-server/nis_warning || true
db_go db_go
fi fi
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# Should-Stop: $network $named $time # Should-Stop: $network $named $time
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database server daemon # Short-Description: Start and stop the MariaDB database server daemon
# Description: Controls the main MariaDB database server daemon "mariadbd" # Description: Controls the main MariaDB database server daemon "mariadbd"
# and its wrapper script "mysqld_safe". # and its wrapper script "mysqld_safe".
### END INIT INFO ### END INIT INFO
...@@ -19,9 +19,10 @@ ${DEBIAN_SCRIPT_DEBUG:+ set -v -x} ...@@ -19,9 +19,10 @@ ${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
test -x /usr/sbin/mariadbd || exit 0 test -x /usr/sbin/mariadbd || exit 0
# shellcheck source=/dev/null
. /lib/lsb/init-functions . /lib/lsb/init-functions
SELF=$(cd "$(dirname $0)"; pwd -P)/$(basename $0) SELF="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")"
if [ -f /usr/bin/mariadb-admin ] if [ -f /usr/bin/mariadb-admin ]
then then
...@@ -31,26 +32,30 @@ then ...@@ -31,26 +32,30 @@ then
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
else else
log_failure_msg "Command mariadb-admin/mysqladmin not found! This SysV init script depends on it." log_failure_msg "Command mariadb-admin/mysqladmin not found! This SysV init script depends on it."
exit -1 exit 1
fi fi
if [ ! -x /usr/bin/mariadbd-safe ] if [ ! -x /usr/bin/mariadbd-safe ]
then then
log_failure_msg "/usr/bin/mariadbd-safe not found or executable! This SysV init script depends on it." log_failure_msg "/usr/bin/mariadbd-safe not found or executable! This SysV init script depends on it."
exit -1 exit 1
fi fi
# priority can be overridden and "-s" adds output to stderr # priority can be overridden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i" ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i"
if [ -f /etc/default/mysql ]; then if [ -f /etc/default/mysql ]
then
# shellcheck source=/dev/null
. /etc/default/mysql . /etc/default/mysql
fi fi
# Also source default/mariadb in case the installation was upgraded from # Also source default/mariadb in case the installation was upgraded from
# packages originally installed from MariaDB.org repositories, which have # packages originally installed from MariaDB.org repositories, which have
# had support for reading /etc/default/mariadb since March 2016. # had support for reading /etc/default/mariadb since March 2016.
if [ -f /etc/default/mariadb ]; then if [ -f /etc/default/mariadb ]
then
# shellcheck source=/dev/null
. /etc/default/mariadb . /etc/default/mariadb
fi fi
...@@ -77,13 +82,14 @@ mariadbd_get_param() { ...@@ -77,13 +82,14 @@ mariadbd_get_param() {
## Do some sanity checks before even trying to start mariadbd. ## Do some sanity checks before even trying to start mariadbd.
sanity_checks() { sanity_checks() {
# check for config file # check for config file
if [ ! -r /etc/mysql/my.cnf ]; then if [ ! -r /etc/mysql/my.cnf ]
then
log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
fi fi
# check for diskspace shortage # check for diskspace shortage
datadir=`mariadbd_get_param datadir` datadir="$(mariadbd_get_param datadir)"
# If datadir location is not changed int configuration # If datadir location is not changed int configuration
# then it's not printed with /usr/sbin/mariadbd --print-defaults # then it's not printed with /usr/sbin/mariadbd --print-defaults
...@@ -105,7 +111,8 @@ sanity_checks() { ...@@ -105,7 +111,8 @@ sanity_checks() {
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 # As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
# 4096 blocks is then lower than 4 MB # 4096 blocks is then lower than 4 MB
df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$datadir" | tail -n 1)" df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$datadir" | tail -n 1)"
if [ "$df_available_blocks" -lt "4096" ]; then if [ "$df_available_blocks" -lt "4096" ]
then
log_failure_msg "$0: ERROR: The partition with $datadir is too full!" log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
exit 1 exit 1
...@@ -119,17 +126,30 @@ sanity_checks() { ...@@ -119,17 +126,30 @@ sanity_checks() {
# #
# Usage: boolean mariadbd_status [check_alive|check_dead] [warn|nowarn] # Usage: boolean mariadbd_status [check_alive|check_dead] [warn|nowarn]
mariadbd_status () { mariadbd_status () {
ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? )) ping_output="$($MYADMIN ping 2>&1)"
# The whole mariadbd_status function should be rewritten in clean shell script,
# so ignore minor Shellcheck nag for now as fixing it would be half of the
# rewrite
# shellcheck disable=SC2181
ping_alive="$(( ! $? ))"
ps_alive=0 ps_alive=0
pidfile=`mariadbd_get_param pid-file` pidfile="$(mariadbd_get_param pid-file)"
if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi if [ -f "$pidfile" ] && ps "$(cat "$pidfile")" >/dev/null 2>&1
then
ps_alive=1
fi
# Using '-a' is unstandard, but it works and might be needed for the grouping
# of the if-else, so keep it and just ignore in Shellcheck
# shellcheck disable=SC2166
if [ "$1" = "check_alive" -a $ping_alive = 1 ] || if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then [ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]
then
return 0 # EXIT_SUCCESS return 0 # EXIT_SUCCESS
else else
if [ "$2" = "warn" ]; then if [ "$2" = "warn" ]
then
echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
fi fi
return 1 # EXIT_FAILURE return 1 # EXIT_FAILURE
...@@ -146,7 +166,8 @@ case "${1:-''}" in ...@@ -146,7 +166,8 @@ case "${1:-''}" in
sanity_checks; sanity_checks;
# Start daemon # Start daemon
log_daemon_msg "Starting MariaDB database server" "mariadbd" log_daemon_msg "Starting MariaDB database server" "mariadbd"
if mariadbd_status check_alive nowarn; then if mariadbd_status check_alive nowarn
then
log_progress_msg "already running" log_progress_msg "already running"
log_end_msg 0 log_end_msg 0
else else
...@@ -156,16 +177,22 @@ case "${1:-''}" in ...@@ -156,16 +177,22 @@ case "${1:-''}" in
# Start MariaDB! # Start MariaDB!
/usr/bin/mariadbd-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 for _ in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}")
do
sleep 1 sleep 1
if mariadbd_status check_alive nowarn ; then break; fi if mariadbd_status check_alive nowarn
then
break
fi
log_progress_msg "." log_progress_msg "."
done done
if mariadbd_status check_alive warn; then if mariadbd_status check_alive warn
then
log_end_msg 0 log_end_msg 0
# Now start mysqlcheck or whatever the admin wants. # Now start mysqlcheck or whatever the admin wants.
output=$(/etc/mysql/debian-start) output=$(/etc/mysql/debian-start)
if [ -n "$output" ]; then if [ -n "$output" ]
then
log_action_msg "$output" log_action_msg "$output"
fi fi
else else
...@@ -181,28 +208,40 @@ case "${1:-''}" in ...@@ -181,28 +208,40 @@ case "${1:-''}" in
# to specify it explicit as e.g. sudo environments points to the normal # to specify it explicit as e.g. sudo environments points to the normal
# users home and not /root) # users home and not /root)
log_daemon_msg "Stopping MariaDB database server" "mariadbd" log_daemon_msg "Stopping MariaDB database server" "mariadbd"
if ! mariadbd_status check_dead nowarn; then if ! mariadbd_status check_dead nowarn
then
set +e set +e
shutdown_out=`$MYADMIN shutdown 2>&1`; r=$? shutdown_out="$($MYADMIN shutdown 2>&1)"
r=$?
set -e set -e
if [ "$r" -ne 0 ]; then if [ "$r" -ne 0 ]
then
log_end_msg 1 log_end_msg 1
[ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out" [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
log_daemon_msg "Killing MariaDB database server by signal" "mariadbd" log_daemon_msg "Killing MariaDB database server by signal" "mariadbd"
killall -15 mariadbd killall -15 mariadbd
server_down= server_down=
for i in `seq 1 600`; do for _ in {1..600}
do
sleep 1 sleep 1
if mariadbd_status check_dead nowarn; then server_down=1; break; fi if mariadbd_status check_dead nowarn
then
server_down=1
break
fi
done done
if test -z "$server_down"; then killall -9 mariadbd; fi if test -z "$server_down"
then
killall -9 mariadbd
fi
fi fi
fi fi
if ! mariadbd_status check_dead warn; then if ! mariadbd_status check_dead warn
then
log_end_msg 1 log_end_msg 1
log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server/README.Debian.gz!" log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server/README.Debian.gz!"
exit -1 exit 1
else else
log_end_msg 0 log_end_msg 0
fi fi
...@@ -221,7 +260,8 @@ case "${1:-''}" in ...@@ -221,7 +260,8 @@ case "${1:-''}" in
;; ;;
'status') 'status')
if mariadbd_status check_alive nowarn; then if mariadbd_status check_alive nowarn
then
log_action_msg "$($MYADMIN version)" log_action_msg "$($MYADMIN version)"
else else
log_action_msg "MariaDB is stopped." log_action_msg "MariaDB is stopped."
...@@ -230,11 +270,11 @@ case "${1:-''}" in ...@@ -230,11 +270,11 @@ case "${1:-''}" in
;; ;;
'bootstrap') 'bootstrap')
# Bootstrap the cluster, start the first node # Bootstrap the cluster, start the first node
# that initiates the cluster # that initiates the cluster
log_daemon_msg "Bootstrapping the cluster" "mariadbd" log_daemon_msg "Bootstrapping the cluster" "mariadbd"
$SELF start "${@:2}" --wsrep-new-cluster $SELF start "${@:2}" --wsrep-new-cluster
;; ;;
*) *)
echo "Usage: $SELF start|stop|restart|reload|force-reload|status" echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
......
...@@ -10,7 +10,7 @@ then ...@@ -10,7 +10,7 @@ then
DEBIAN_SCRIPT_TRACE=1 DEBIAN_SCRIPT_TRACE=1
fi fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2}
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
...@@ -112,7 +112,7 @@ EOF ...@@ -112,7 +112,7 @@ EOF
fi fi
rmdir $mysql_upgradedir 2>/dev/null || true rmdir $mysql_upgradedir 2>/dev/null || true
done done # end 'for dir' loop
# Upgrading from mysql.com needs might have the root user as auth_socket. # Upgrading from mysql.com needs might have the root user as auth_socket.
# auto.cnf is a sign of a mysql install, that doesn't exist in mariadb. # auto.cnf is a sign of a mysql install, that doesn't exist in mariadb.
...@@ -123,12 +123,12 @@ EOF ...@@ -123,12 +123,12 @@ EOF
# perform mariadb-upgrade, (MDEV-22678). To keep the impact minimal, we # perform mariadb-upgrade, (MDEV-22678). To keep the impact minimal, we
# skip innodb and set key-buffer-size to 0 as it isn't reused. # skip innodb and set key-buffer-size to 0 as it isn't reused.
if [ -f "$mysql_datadir/auto.cnf" ] && if [ -f "$mysql_datadir/auto.cnf" ] &&
[ -f "$mysql_datadir/mysql/user.MYD" ] && [ -f "$mysql_datadir/mysql/user.MYD" ] &&
! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null && ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null &&
[ ! -f "$mysql_datadir/undo_001" ] [ ! -f "$mysql_datadir/undo_001" ]
then then
echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" | echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" | \
mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null
fi fi
# Ensure the existence and right permissions for the database and # Ensure the existence and right permissions for the database and
...@@ -183,6 +183,8 @@ EOF ...@@ -183,6 +183,8 @@ EOF
# Clean up old flags before setting new one # Clean up old flags before setting new one
rm -f $mysql_datadir/debian-*.flag rm -f $mysql_datadir/debian-*.flag
# Flag data dir to avoid downgrades # Flag data dir to avoid downgrades
# @TODO: Rewrite this to use the new upstream /var/lib/mysql_upgrade_info file
# instead of the legacy /var/lib/debian-XX.X.flag file
touch "$mysql_datadir/debian-__MARIADB_MAJOR_VER__.flag" touch "$mysql_datadir/debian-__MARIADB_MAJOR_VER__.flag"
# initiate databases. Output is not allowed by debconf :-( # initiate databases. Output is not allowed by debconf :-(
...@@ -191,9 +193,13 @@ EOF ...@@ -191,9 +193,13 @@ EOF
# handle things. # handle things.
# Debian: beware of the bashisms... # Debian: beware of the bashisms...
# Debian: can safely run on upgrades with existing databases # Debian: can safely run on upgrades with existing databases
# Workaround for Debian Bug #1022994: failure to create database when
# working with libpam-tmpdir (by setting TMPDIR to empty value).
set +e set +e
bash /usr/bin/mariadb-install-db --rpm --cross-bootstrap --user=mysql \ TMPDIR='' bash /usr/bin/mariadb-install-db \
--disable-log-bin --skip-test-db 2>&1 | \ --rpm --cross-bootstrap \
--user=mysql --disable-log-bin \
--skip-test-db 2>&1 | \
$ERR_LOGGER $ERR_LOGGER
set -e set -e
...@@ -210,6 +216,7 @@ EOF ...@@ -210,6 +216,7 @@ EOF
then then
install -o 0 -g 0 -m 0755 -d $mysql_cfgdir install -o 0 -g 0 -m 0755 -d $mysql_cfgdir
fi fi
if [ ! -e "$dc" ] if [ ! -e "$dc" ]
then then
cat /dev/null > $dc cat /dev/null > $dc
...@@ -241,13 +248,13 @@ EOF ...@@ -241,13 +248,13 @@ EOF
# on by default) to work both to disable a default profile, and to keep # on by default) to work both to disable a default profile, and to keep
# any profile installed and maintained by users themselves. # any profile installed and maintained by users themselves.
profile="/etc/apparmor.d/usr.sbin.mariadbd" profile="/etc/apparmor.d/usr.sbin.mariadbd"
if [ -f "$profile" ] && aa-status --enabled 2>/dev/null if [ -f "$profile" ] && aa-status --enabled 2> /dev/null
then then
if grep -q /usr/sbin/mariadbd "$profile" 2>/dev/null if grep -q /usr/sbin/mariadbd "$profile" 2> /dev/null
then then
apparmor_parser -r "$profile" || true apparmor_parser -r "$profile" || true
else else
echo "/usr/sbin/mariadbd { }" | apparmor_parser --remove 2>/dev/null || true echo "/usr/sbin/mariadbd { }" | apparmor_parser --remove 2> /dev/null || true
fi fi
fi fi
...@@ -272,7 +279,8 @@ EOF ...@@ -272,7 +279,8 @@ EOF
if [ -d /run/systemd/system ] if [ -d /run/systemd/system ]
then then
systemctl --system daemon-reload systemctl --system daemon-reload
else elif [ -x /etc/init.d/mariadb ]
then
invoke-rc.d mariadb restart invoke-rc.d mariadb restart
fi fi
;; ;;
......
...@@ -27,6 +27,15 @@ export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin ...@@ -27,6 +27,15 @@ export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
mysql_datadir=/var/lib/mysql mysql_datadir=/var/lib/mysql
mysql_upgradedir=/var/lib/mysql-upgrade mysql_upgradedir=/var/lib/mysql-upgrade
MARIADBD_USERS="root"
# Check if user 'mysql' exists before referring to it in pgrep
# to avoid pgrep erroring on 'invalid user name'
if id mysql >/dev/null 2>&1
then
MARIADBD_USERS="$MARIADBD_USERS,mysql"
fi
# Try to stop the server in a sane way. If it does not success let the admin # Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server # do it himself. No database directories should be removed while the server
# is running! Another mariadbd in e.g. a different chroot is fine for us. # is running! Another mariadbd in e.g. a different chroot is fine for us.
...@@ -34,7 +43,7 @@ stop_server() { ...@@ -34,7 +43,7 @@ stop_server() {
# Return immediately if there are no mysqld processes running on a host # Return immediately if there are no mysqld processes running on a host
# (leave containerized processes with the same name in other namespaces) # (leave containerized processes with the same name in other namespaces)
# as there is no point in trying to shutdown in that case. # as there is no point in trying to shutdown in that case.
if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null if ! pgrep -x -u "$MARIADBD_USERS" --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
then then
return return
fi fi
...@@ -77,6 +86,9 @@ do ...@@ -77,6 +86,9 @@ do
break break
fi fi
# The whole flag_version thing should be rewritten, so ignore minor Shellcheck
# nag for now
# shellcheck disable=SC2001
flag_version=$(echo "$flag" | sed 's/.*debian-\([0-9\.]\+\).flag/\1/') flag_version=$(echo "$flag" | sed 's/.*debian-\([0-9\.]\+\).flag/\1/')
# Initialize value if empty # Initialize value if empty
...@@ -164,14 +176,14 @@ stop_server ...@@ -164,14 +176,14 @@ stop_server
# If we use NIS then errors should be tolerated. It's up to the # If we use NIS then errors should be tolerated. It's up to the
# user to ensure that the mysql user is correctly setup. # user to ensure that the mysql user is correctly setup.
# Beware that there are two ypwhich one of them needs the 2>/dev/null! # Beware that there are two ypwhich one of them needs the 2>/dev/null!
if test -n "$(which ypwhich 2>/dev/null)" && ypwhich >/dev/null 2>&1 if test -n "$(command -v ypwhich 2>/dev/null)" && ypwhich > /dev/null 2>&1
then then
set +e set +e
fi fi
# #
# Now we have to ensure the following state: # Now we have to ensure the following state:
# /etc/passwd: mysql:x:100:101:MySQL Server:/nonexistent:/bin/false # /etc/passwd: mysql:x:100:101:MariaDB Server:/nonexistent:/bin/false
# /etc/group: mysql:x:101: # /etc/group: mysql:x:101:
# #
# Sadly there could any state be present on the system so we have to # Sadly there could any state be present on the system so we have to
...@@ -196,9 +208,9 @@ then ...@@ -196,9 +208,9 @@ then
--ingroup mysql \ --ingroup mysql \
--no-create-home \ --no-create-home \
--home /nonexistent \ --home /nonexistent \
--gecos "MySQL Server" \ --gecos "MariaDB Server" \
--shell /bin/false \ --shell /bin/false \
mysql >/dev/null mysql >/dev/null 2>&1
fi fi
# end of NIS tolerance zone # end of NIS tolerance zone
...@@ -209,7 +221,8 @@ set -e ...@@ -209,7 +221,8 @@ set -e
for dir in DATADIR LOGDIR for dir in DATADIR LOGDIR
do do
checkdir=$(eval echo "$"$dir) checkdir=$(eval echo "$"$dir)
if [ -L "$checkdir" ]; then if [ -L "$checkdir" ]
then
# Use mkdir option 'Z' to create with correct SELinux context. # Use mkdir option 'Z' to create with correct SELinux context.
mkdir -pZ "$mysql_upgradedir" mkdir -pZ "$mysql_upgradedir"
cp -dT "$checkdir" "$mysql_upgradedir/$dir.link" cp -dT "$checkdir" "$mysql_upgradedir/$dir.link"
...@@ -223,23 +236,14 @@ then ...@@ -223,23 +236,14 @@ then
mkdir -Z $mysql_datadir mkdir -Z $mysql_datadir
fi fi
# Check if MariaDB datadir is available if not fails. # As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
# There should be symlink or directory available or something will fail. # 4096 blocks is then lower than 4 MB
if [ -d "$mysql_datadir" ] || [ -L "$mysql_datadir" ] df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$mysql_datadir" | tail -n 1)"
if [ "$df_available_blocks" -lt "4096" ]
then then
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2
# 4096 blocks is then lower than 4 MB db_stop
df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$mysql_datadir" | tail -n 1)" exit 1
if [ "$df_available_blocks" -lt "4096" ]
then
echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2
db_stop
exit 1
fi
else
echo "ERROR: There's no directory or symlink available: $mysql_datadir/" 1>&2
db_stop
exit 1
fi fi
# Since the home directory was created before putting the user into # Since the home directory was created before putting the user into
......
...@@ -30,7 +30,8 @@ DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/.*[~-]\(.*\)/\1/ ...@@ -30,7 +30,8 @@ DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/.*[~-]\(.*\)/\1/
DEB_VERSION_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/') DEB_VERSION_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/')
DEB_VERSION_MAJOR := $(shell echo $(DEB_VERSION_VERSION) | sed -e 's/^\(.*\)\..*$$/\1/') DEB_VERSION_MAJOR := $(shell echo $(DEB_VERSION_VERSION) | sed -e 's/^\(.*\)\..*$$/\1/')
RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead? RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead?
TMP:=$(CURDIR)/debian/tmp TMP := $(CURDIR)/debian/tmp
MTR_SKIP_TEST_LIST := $(shell mktemp)
# According to Debian Policy version 4.2.0 builds should be as verbose as # According to Debian Policy version 4.2.0 builds should be as verbose as
# possible unless 'terse' is specifically passed. # possible unless 'terse' is specifically passed.
...@@ -68,14 +69,17 @@ override_dh_auto_configure: ...@@ -68,14 +69,17 @@ override_dh_auto_configure:
dh_testdir dh_testdir
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_configure --builddirectory=builddir-native dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_configure --builddirectory=builddir-native --reload-all-buildenv-variables
dh_auto_build --builddirectory=builddir-native -- import_executables dh_auto_build --builddirectory=builddir-native -- import_executables
endif endif
echo "server:Version=$(DEB_VERSION)" >> debian/substvars echo "server:Version=$(DEB_VERSION)" >> debian/substvars
# As packages does not have major version any more on package name there is no way as it not set by dpkg # As packages does not have major version any more in package name there is no
# to use this on postinst script. Use sed to determine major version # way as it not set by dpkg to use this on postinst script. Use sed to
# determine major version instead.
# @TODO: Rewrite this to use the new upstream /var/lib/mysql_upgrade_info file
# instead of the legacy /var/lib/debian-XX.X.flag file
sed -i 's/__MARIADB_MAJOR_VER__/$(DEB_VERSION_MAJOR)/g' debian/mariadb-server.post* debian/mariadb-server.preinst sed -i 's/__MARIADB_MAJOR_VER__/$(DEB_VERSION_MAJOR)/g' debian/mariadb-server.post* debian/mariadb-server.preinst
# Don't build ColumnStore as part of the native build as it does not meet the # Don't build ColumnStore as part of the native build as it does not meet the
...@@ -86,7 +90,6 @@ endif ...@@ -86,7 +90,6 @@ endif
# Note: Don't use '-DWITH_URING=ON' as some Buildbot builders are missing it # Note: Don't use '-DWITH_URING=ON' as some Buildbot builders are missing it
# and would fail permanently. # and would fail permanently.
PATH=$${MYSQL_BUILD_PATH:-"/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin"} \ PATH=$${MYSQL_BUILD_PATH:-"/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin"} \
NO_UPDATE_BUILD_VERSION=1 \
dh_auto_configure --builddirectory=$(BUILDDIR) -- \ dh_auto_configure --builddirectory=$(BUILDDIR) -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
$(CMAKEFLAGS) \ $(CMAKEFLAGS) \
...@@ -123,9 +126,9 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) ...@@ -123,9 +126,9 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
cd $(BUILDDIR)/mysql-test && \ cd $(BUILDDIR)/mysql-test && \
export MTR_PRINT_CORE=detailed && \ export MTR_PRINT_CORE=detailed && \
./mtr --force --testcase-timeout=120 --suite-timeout=540 --retry=3 \ ./mtr --force --testcase-timeout=120 --suite-timeout=540 --retry=3 \
--verbose-restart --max-save-core=1 --max-save-datadir=1 \ --verbose-restart --max-save-core=1 --max-save-datadir=1 \
--parallel=$(NUMJOBS) --skip-rpl --suite=main \ --parallel=$(NUMJOBS) --skip-rpl --suite=main \
--skip-test-list=$(MTR_SKIP_TEST_LIST) --skip-test-list=$(MTR_SKIP_TEST_LIST)
# Don't use --mem here as official Debian builders and most Docker systems don't have a large mem device available and # Don't use --mem here as official Debian builders and most Docker systems don't have a large mem device available and
# would fail with errors on lack of disk space. # would fail with errors on lack of disk space.
endif endif
...@@ -180,7 +183,7 @@ override_dh_auto_install: ...@@ -180,7 +183,7 @@ override_dh_auto_install:
override_dh_installsystemd: override_dh_installsystemd:
dh_installsystemd -pmariadb-server mariadb.service dh_installsystemd -pmariadb-server mariadb.service
# Start MariaDB at sequence number 19 before 20 where apache, proftpd etc gets # Start mariadbd at sequence number 19 before 20 where apache, proftpd etc gets
# started which might depend on a running database server. # started which might depend on a running database server.
override_dh_installinit-arch: override_dh_installinit-arch:
dh_installinit --name=mariadb -- defaults 19 21 dh_installinit --name=mariadb -- defaults 19 21
......
...@@ -12,5 +12,6 @@ Depends: mariadb-plugin-rocksdb | mariadb-server, ...@@ -12,5 +12,6 @@ Depends: mariadb-plugin-rocksdb | mariadb-server,
Restrictions: allow-stderr needs-root isolation-container Restrictions: allow-stderr needs-root isolation-container
Tests: upstream Tests: upstream
Depends: mariadb-test, eatmydata Depends: eatmydata,
mariadb-test
Restrictions: allow-stderr breaks-testbed Restrictions: allow-stderr breaks-testbed
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
# #
# This test should be declared in debian/tests/control with the # This test should be declared in debian/tests/control with the
# following restrictions: # following restrictions:
# # - allow-stderr (set -x always outputs to stderr)
# needs-root (to be able to log into the database) # - needs-root (to be able to log into the database)
# allow-stderr # - isolation-container (to be able to start service)
# #
# This test: # This test:
# #
...@@ -27,7 +27,7 @@ set -ex ...@@ -27,7 +27,7 @@ set -ex
# Start the daemon if it was not running. For example in Docker testing # Start the daemon if it was not running. For example in Docker testing
# environments there might not be any systemd et al and the service needs to # environments there might not be any systemd et al and the service needs to
# be started manually. # be started manually.
if ! which systemctl if ! command -v systemctl
then then
if ! /etc/init.d/mariadb status if ! /etc/init.d/mariadb status
then then
...@@ -71,9 +71,12 @@ DROP DATABASE testdatabase; ...@@ -71,9 +71,12 @@ DROP DATABASE testdatabase;
DROP USER 'testuser'@'localhost'; DROP USER 'testuser'@'localhost';
EOT EOT
# List based on what is advertised at # This will never fail but exists purely for debugging purposes in case a later
# https://mariadb.com/kb/en/innodb-page-compression/#configuring-the-innodb-page-compression-algorithm # step would fail
# but disabled with '#' the options that are not available in this binary build mariadb <<EOT
SHOW GLOBAL STATUS WHERE Variable_name LIKE 'Innodb_have_%';
EOT
mariadb <<EOT mariadb <<EOT
SET GLOBAL innodb_compression_algorithm=lz4; SET GLOBAL innodb_compression_algorithm=lz4;
SET GLOBAL innodb_compression_algorithm=lzo; SET GLOBAL innodb_compression_algorithm=lzo;
...@@ -88,7 +91,7 @@ EOT ...@@ -88,7 +91,7 @@ EOT
plugin=mariadb-plugin-rocksdb plugin=mariadb-plugin-rocksdb
if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] && if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] &&
[ "$(dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)" = little ] [ "$(dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)" = little ]
then then
dpkg-query -W $plugin dpkg-query -W $plugin
LOG=/var/lib/mysql/#rocksdb/LOG LOG=/var/lib/mysql/#rocksdb/LOG
...@@ -101,7 +104,8 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] && ...@@ -101,7 +104,8 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] &&
grep -F " supported:" $LOG grep -F " supported:" $LOG
# Check that the expected compression methods are supported # Check that the expected compression methods are supported
for a in LZ4 Snappy Zlib ZSTD; do for a in LZ4 Snappy Zlib ZSTD
do
if ! grep -qE "k$a(Compression)? supported: 1" $LOG if ! grep -qE "k$a(Compression)? supported: 1" $LOG
then then
# Fail with explicit error message # Fail with explicit error message
...@@ -110,5 +114,5 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] && ...@@ -110,5 +114,5 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] &&
fi fi
done done
else else
! dpkg-query -W $plugin dpkg-query -W $plugin && exit 1
fi fi
...@@ -25,37 +25,37 @@ echo "using tmpdir: $WORKDIR/tmp" ...@@ -25,37 +25,37 @@ echo "using tmpdir: $WORKDIR/tmp"
echo "Setting up skip-tests-list" echo "Setting up skip-tests-list"
# Use the arch specific skiplists if exist, otherwise list is empty # Use the arch specific skiplists if exist, otherwise list is empty
if [ -f /usr/share/mysql/mysql-test/unstable-tests.$ARCH ] if [ -f "/usr/share/mysql/mysql-test/unstable-tests.$ARCH" ]
then then
cat /usr/share/mysql/mysql-test/unstable-tests.$ARCH >> $MTR_SKIP_TEST_LIST cat "/usr/share/mysql/mysql-test/unstable-tests.$ARCH" >> "$MTR_SKIP_TEST_LIST"
fi fi
# Skip tests that cannot run properly on ci.debian.net / autopkgtests.ubuntu.com # Skip tests that cannot run properly on ci.debian.net / autopkgtests.ubuntu.com
cat >> $MTR_SKIP_TEST_LIST << EOF cat >> "$MTR_SKIP_TEST_LIST" << EOF
binlog.binlog_server_start_options : Requires writable /usr binlog.binlog_server_start_options : Requires writable /usr
main.ctype_uca : Requires writable /usr main.ctype_uca : Requires writable /usr
rpl.rpl_gtid_mode : Requires starting server as root ref http://bugs.mysql.com/bug.php?id=70517 rpl.rpl_gtid_mode : Requires starting server as root ref http://bugs.mysql.com/bug.php?id=70517
EOF EOF
# Skip tests that cannot run properly on Gitlab-CI # Skip tests that cannot run properly on Gitlab-CI
if [ ! -z "$GITLAB_CI" ] if [ -n "$GITLAB_CI" ]
then then
cat >> $MTR_SKIP_TEST_LIST << EOF cat >> "$MTR_SKIP_TEST_LIST" << EOF
main.mysqld--help : For unknown reason table-cache is 4000 instead of default 421 main.mysqld--help : For unknown reason table-cache is 4000 instead of default 421
EOF EOF
fi fi
if [ "$ARCH" = "s390x" ] if [ "$ARCH" = "s390x" ]
then then
echo "main.func_regexp_pcre : recursion fails on s390x https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1723947" >> $MTR_SKIP_TEST_LIST echo "main.func_regexp_pcre : recursion fails on s390x https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1723947" >> "$MTR_SKIP_TEST_LIST"
elif [ "$ARCH" = "armhf" ] || [ "$ARCH" = "i386" ] elif [ "$ARCH" = "armhf" ] || [ "$ARCH" = "i386" ]
then then
echo "main.failed_auth_unixsocket : Test returns wrong exit code on armhf and i386 (but only in debci) https://jira.mariadb.org/browse/MDEV-23933" >> $MTR_SKIP_TEST_LIST echo "main.failed_auth_unixsocket : Test returns wrong exit code on armhf and i386 (but only in debci) https://jira.mariadb.org/browse/MDEV-23933" >> "$MTR_SKIP_TEST_LIST"
fi fi
# Store skipped test list in artifacts so it can be viewed while debugging # Store skipped test list in artifacts so it can be viewed while debugging
# failed autopkgtest runs # failed autopkgtest runs
cp -v $MTR_SKIP_TEST_LIST $AUTOPKGTEST_ARTIFACTS cp -v "$MTR_SKIP_TEST_LIST" "$AUTOPKGTEST_ARTIFACTS"
cd /usr/share/mysql/mysql-test cd /usr/share/mysql/mysql-test
echo "starting mysql-test-tun.pl..." echo "starting mysql-test-tun.pl..."
...@@ -64,7 +64,8 @@ eatmydata perl -I. ./mysql-test-run.pl \ ...@@ -64,7 +64,8 @@ eatmydata perl -I. ./mysql-test-run.pl \
--force --testcase-timeout=120 --suite-timeout=540 --retry=3 \ --force --testcase-timeout=120 --suite-timeout=540 --retry=3 \
--verbose-restart --max-save-core=1 --max-save-datadir=1 \ --verbose-restart --max-save-core=1 --max-save-datadir=1 \
--parallel=auto --skip-rpl --suite=main \ --parallel=auto --skip-rpl --suite=main \
--skip-test-list=$MTR_SKIP_TEST_LIST \ --skip-test-list="$MTR_SKIP_TEST_LIST" \
--vardir="$WORKDIR/var" --tmpdir="$WORKDIR/tmp" \ --vardir="$WORKDIR/var" --tmpdir="$WORKDIR/tmp" \
--xml-report=$AUTOPKGTEST_ARTIFACTS/mysql-test-run-junit.xml $@ 2>&1 --xml-report="$AUTOPKGTEST_ARTIFACTS/mysql-test-run-junit.xml"
"$@" 2>&1
echo "run: OK" echo "run: OK"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment