summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-05-11 09:00:27 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2023-05-11 09:00:27 +0300
commit1f1eaef0afddb1d7aeb44ad118cfc40a69d059d3 (patch)
treeaf31ad76f857a000e154d9ce3004ff4dab29e0eb
parent7d44e2e7ffc8df4e6936aa56439c569e1dd92edd (diff)
parent7124911a2c08beeb9b6aebb92eb2b6bedfabe413 (diff)
downloadmariadb-git-1f1eaef0afddb1d7aeb44ad118cfc40a69d059d3.tar.gz
Merge 10.6 into 10.810.8
-rw-r--r--debian/mariadb-common.postinst2
-rw-r--r--debian/mariadb-common.postrm2
-rw-r--r--debian/mariadb-server-10.8.postinst139
-rw-r--r--debian/mariadb-server-10.8.postrm72
-rw-r--r--debian/mariadb-server-10.8.preinst107
-rw-r--r--debian/mariadb-server-10.8.prerm12
-rw-r--r--mysql-test/suite/innodb_zip/r/page_size.result21
-rw-r--r--mysql-test/suite/innodb_zip/t/page_size.test24
-rw-r--r--sql/sql_select.cc35
-rw-r--r--storage/innobase/btr/btr0cur.cc27
10 files changed, 281 insertions, 160 deletions
diff --git a/debian/mariadb-common.postinst b/debian/mariadb-common.postinst
index 12f65bd3d92..53d131a3929 100644
--- a/debian/mariadb-common.postinst
+++ b/debian/mariadb-common.postinst
@@ -35,7 +35,7 @@ case "$1" in
then
update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/mariadb.cnf" 500 || true
fi
- ;;
+ ;;
esac
#DEBHELPER#
diff --git a/debian/mariadb-common.postrm b/debian/mariadb-common.postrm
index d0bfa266b7d..2548733a1b9 100644
--- a/debian/mariadb-common.postrm
+++ b/debian/mariadb-common.postrm
@@ -10,7 +10,7 @@ case "$1" in
then
/usr/share/mysql-common/configure-symlinks remove mariadb "/etc/mysql/mariadb.cnf"
fi
- ;;
+ ;;
esac
#DEBHELPER#
diff --git a/debian/mariadb-server-10.8.postinst b/debian/mariadb-server-10.8.postinst
index a259a50ac55..b87ce856313 100644
--- a/debian/mariadb-server-10.8.postinst
+++ b/debian/mariadb-server-10.8.postinst
@@ -1,12 +1,18 @@
#!/bin/bash
set -e
+# shellcheck source=/dev/null
. /usr/share/debconf/confmodule
# Automatically set version to ease maintenance of this file
MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
+if [ -n "$DEBIAN_SCRIPT_DEBUG" ]
+then
+ set -v -x
+ DEBIAN_SCRIPT_TRACE=1
+fi
+
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
@@ -24,7 +30,9 @@ case "$1" in
# and because changed configuration options should take effect immediately.
# In case the server wasn't running at all it should be ok if the stop
# script fails. I can't tell at this point because of the cleaned /run.
- set +e; invoke-rc.d mariadb stop; set -e
+ set +e
+ invoke-rc.d mariadb stop
+ set -e
# An existing /etc/init.d/mysql might be on the system if there was a
# previous MySQL or MariaDB installation, since /etc/init.d files are
@@ -64,21 +72,26 @@ case "$1" in
# If the following symlink exists, it is a preserved copy the old data dir
# created by the preinst script during a upgrade that would have otherwise
# been replaced by an empty mysql dir. This should restore it.
- for dir in DATADIR LOGDIR; do
+ for dir in DATADIR LOGDIR
+ do
- if [ "$dir" = "DATADIR" ]; then
+ if [ "$dir" = "DATADIR" ]
+ then
targetdir=$mysql_datadir
else
targetdir=$mysql_logdir
fi
savelink="$mysql_upgradedir/$dir.link"
- if [ -L "$savelink" ]; then
+ if [ -L "$savelink" ]
+ then
# If the targetdir was a symlink before we upgraded it is supposed
# to be either still be present or not existing anymore now.
- if [ -L "$targetdir" ]; then
+ if [ -L "$targetdir" ]
+ then
rm "$savelink"
- elif [ ! -d "$targetdir" ]; then
+ elif [ ! -d "$targetdir" ]
+ then
mv "$savelink" "$targetdir"
else
# this should never even happen, but just in case...
@@ -100,7 +113,7 @@ this all away.
EOF
fi
fi
- rmdir $mysql_upgradedir 2>/dev/null || true
+ rmdir $mysql_upgradedir 2>/dev/null || true
done
@@ -112,17 +125,29 @@ EOF
# This direct update is needed to enable an authentication mechanism to
# 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.
- if [ -f "$mysql_datadir"/auto.cnf ] && [ -f "$mysql_datadir"/mysql/user.MYD ] &&
- [ ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null ] && [ ! -f "$mysql_datadir"/undo_001 ]; then
- 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
+ if [ -f "$mysql_datadir/auto.cnf" ] &&
+ [ -f "$mysql_datadir/mysql/user.MYD" ] &&
+ ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null &&
+ [ ! -f "$mysql_datadir/undo_001" ]
+ then
+ 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
fi
# Ensure the existence and right permissions for the database and
# log files. Use mkdir option 'Z' to create with correct SELinux context.
- if [ ! -d "$mysql_statedir" ] && [ ! -L "$mysql_statedir" ]; then mkdir -Z "$mysql_statedir"; fi
- if [ ! -d "$mysql_datadir" ] && [ ! -L "$mysql_datadir" ]; then mkdir -Z "$mysql_datadir" ; fi
- if [ ! -d "$mysql_logdir" ] && [ ! -L "$mysql_logdir" ]; then mkdir -Z "$mysql_logdir" ; fi
+ if [ ! -d "$mysql_statedir" ] && [ ! -L "$mysql_statedir" ]
+ then
+ mkdir -Z "$mysql_statedir"
+ fi
+ if [ ! -d "$mysql_datadir" ] && [ ! -L "$mysql_datadir" ]
+ then
+ mkdir -Z "$mysql_datadir"
+ fi
+ if [ ! -d "$mysql_logdir" ] && [ ! -L "$mysql_logdir" ]
+ then
+ mkdir -Z "$mysql_logdir"
+ fi
# When creating an ext3 jounal on an already mounted filesystem like e.g.
# /var/lib/mysql, you get a .journal file that is not modifiable by chown.
# The mysql_statedir must not be writable by the mysql user under any
@@ -171,8 +196,8 @@ EOF
# Debian: can safely run on upgrades with existing databases
set +e
bash /usr/bin/mariadb-install-db --rpm --cross-bootstrap --user=mysql \
- --disable-log-bin --skip-test-db 2>&1 | \
- $ERR_LOGGER
+ --disable-log-bin --skip-test-db 2>&1 | \
+ $ERR_LOGGER
set -e
# On new installations root user can connect via unix_socket.
@@ -183,26 +208,30 @@ EOF
# --defaults-file option for tools (for the sake of upgrades)
# and thus need /etc/mysql/debian.cnf to exist, even if it's empty.
# In the long run the goal is to obsolete this file.
- dc=$mysql_cfgdir/debian.cnf;
- if [ ! -d "$mysql_cfgdir" ]; then
+ dc="$mysql_cfgdir/debian.cnf"
+ if [ ! -d "$mysql_cfgdir" ]
+ then
install -o 0 -g 0 -m 0755 -d $mysql_cfgdir
fi
- if [ ! -e "$dc" ]; then
- cat /dev/null > $dc
- echo "# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE." >>$dc
- echo "# This file exists only for backwards compatibility for" >>$dc
- echo "# tools that run '--defaults-file=/etc/mysql/debian.cnf'" >>$dc
- echo "# and have root level access to the local filesystem." >>$dc
- echo "# With those permissions one can run 'mariadb' directly" >>$dc
- echo "# anyway thanks to unix socket authentication and hence" >>$dc
- echo "# this file is useless. See package README for more info." >>$dc
- echo "[client]" >>$dc
- echo "host = localhost" >>$dc
- echo "user = root" >>$dc
- echo "[mysql_upgrade]" >>$dc
- echo "host = localhost" >>$dc
- echo "user = root" >>$dc
- echo "# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE." >>$dc
+ if [ ! -e "$dc" ]
+ then
+ cat /dev/null > $dc
+ {
+ echo "# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE.";
+ echo "# This file exists only for backwards compatibility for";
+ echo "# tools that run '--defaults-file=/etc/mysql/debian.cnf'";
+ echo "# and have root level access to the local filesystem.";
+ echo "# With those permissions one can run 'mariadb' directly";
+ echo "# anyway thanks to unix socket authentication and hence";
+ echo "# this file is useless. See package README for more info.";
+ echo "[client]";
+ echo "host = localhost";
+ echo "user = root";
+ echo "[mysql_upgrade]";
+ echo "host = localhost";
+ echo "user = root";
+ echo "# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE.";
+ } >> $dc
fi
# Keep it only root-readable, as it always was
chown 0:0 $dc
@@ -215,8 +244,10 @@ EOF
# on by default) to work both to disable a default profile, and to keep
# any profile installed and maintained by users themselves.
profile="/etc/apparmor.d/usr.sbin.mariadbd"
- if [ -f "$profile" ] && aa-status --enabled 2>/dev/null; then
- if grep -q /usr/sbin/mariadbd "$profile" 2>/dev/null ; then
+ if [ -f "$profile" ] && aa-status --enabled 2>/dev/null
+ then
+ if grep -q /usr/sbin/mariadbd "$profile" 2>/dev/null
+ then
apparmor_parser -r "$profile" || true
else
echo "/usr/sbin/mariadbd { }" | apparmor_parser --remove 2>/dev/null || true
@@ -228,24 +259,24 @@ EOF
# Note that file cannot be empty, otherwise systemd version in Ubuntu Bionic
# will think the service is masked
echo "# empty placeholder" > /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
-
- ;;
+ ;;
abort-upgrade|abort-remove|abort-configure)
- ;;
+ ;;
triggered)
- if [ -d /run/systemd/system ]; then
+ if [ -d /run/systemd/system ]
+ then
systemctl --system daemon-reload
else
invoke-rc.d mariadb restart
fi
- ;;
+ ;;
*)
echo "postinst called with unknown argument '$1'" 1>&2
exit 1
- ;;
+ ;;
esac
db_stop # in case invoke fails
@@ -255,19 +286,23 @@ db_stop # in case invoke fails
# systemctl. If we upgrade from MySQL mysql.service may be masked, which also
# means init.d script is disabled. Unmask mysql service explicitly.
# Check first that the command exists, to avoid emitting any warning messages.
-if [ -x "$(command -v deb-systemd-helper)" ]; then
+if [ -x "$(command -v deb-systemd-helper)" ]
+then
deb-systemd-helper unmask mysql.service > /dev/null
fi
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
-if [ -d /run/systemd/system ]; then
- systemctl --system daemon-reload >/dev/null || true
- deb-systemd-invoke start mariadb.service >/dev/null || true
-# Modified dh_installinit snippet to only run with sysvinit
-elif [ -x "/etc/init.d/mariadb" ]; then
- if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
- invoke-rc.d mariadb start || exit $?
- fi
+if [ -d /run/systemd/system ]
+then
+ systemctl --system daemon-reload >/dev/null || true
+ deb-systemd-invoke start mariadb.service >/dev/null || true
+ # Modified dh_installinit snippet to only run with sysvinit
+elif [ -x "/etc/init.d/mariadb" ]
+then
+ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]
+ then
+ invoke-rc.d mariadb start || exit $?
+ fi
fi
diff --git a/debian/mariadb-server-10.8.postrm b/debian/mariadb-server-10.8.postrm
index 94ce91db31d..41ed3ffe979 100644
--- a/debian/mariadb-server-10.8.postrm
+++ b/debian/mariadb-server-10.8.postrm
@@ -1,12 +1,18 @@
#!/bin/bash
set -e
+# shellcheck source=/dev/null
. /usr/share/debconf/confmodule
# Automatically set version to ease maintenance of this file
MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
+if [ -n "$DEBIAN_SCRIPT_DEBUG" ]
+then
+ set -v -x
+ DEBIAN_SCRIPT_TRACE=1
+fi
+
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
@@ -15,38 +21,43 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# 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.
stop_server() {
- # Return immediately if there are no mysqld processes running
- # as there is no point in trying to shutdown in that case.
- if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi
-
- set +e
- invoke-rc.d mariadb stop
- invoke-rc.d mysql stop # Backwards compatibility
- errno=$?
- set -e
-
- # systemctl could emit exit code 100=no init script (fresh install)
- if [ "$errno" != 0 -a "$errno" != 100 ]; then
- echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
- echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
- echo "Stop it yourself and try again!" 1>&2
- db_stop
- exit 1
- fi
+ # Return immediately if there are no mysqld processes running
+ # as there is no point in trying to shutdown in that case.
+ if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
+ then
+ return
+ fi
+
+ set +e
+ invoke-rc.d mariadb stop
+ invoke-rc.d mysql stop # Backwards compatibility
+ errno=$?
+ set -e
+
+ # systemctl could emit exit code 100=no init script (fresh install)
+ if [ "$errno" != 0 ] && [ "$errno" != 100 ]
+ then
+ echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
+ echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
+ echo "Stop it yourself and try again!" 1>&2
+ db_stop
+ exit 1
+ fi
}
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
- if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
+ if [ -n "$($MYADMIN ping 2>/dev/null)" ]
+ then
stop_server
sleep 2
fi
- ;;
+ ;;
*)
echo "postrm called with unknown argument '$1'" 1>&2
exit 1
- ;;
+ ;;
esac
#
@@ -54,7 +65,8 @@ esac
# - Remove the mysql user only after all his owned files are purged.
# - Cleanup the initscripts only if this was the last provider of them
#
-if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then
+if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]
+then
# we remove the mysql user only after all his owned files are purged
rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
rm -rf /var/log/mysql
@@ -62,7 +74,8 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then
db_input high "mariadb-server-$MAJOR_VER/postrm_remove_databases" || true
db_go || true
db_get "mariadb-server-$MAJOR_VER/postrm_remove_databases" || true
- if [ "$RET" = "true" ]; then
+ if [ "$RET" = "true" ]
+ then
# never remove the debian.cnf when the databases are still existing
# else we ran into big trouble on the next install!
rm -f /etc/mysql/debian.cnf
@@ -75,9 +88,9 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then
if [ -d /var/lib/mysql ]
then
find /var/lib/mysql -mindepth 1 \
- -not -path '*/lost+found/*' -not -name 'lost+found' \
- -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \
- -delete
+ -not -path '*/lost+found/*' -not -name 'lost+found' \
+ -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \
+ -delete
# "|| true" still needed as rmdir still exits with non-zero if
# /var/lib/mysql is a mount point
@@ -92,6 +105,7 @@ fi
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
-if [ -d /run/systemd/system ]; then
- systemctl --system daemon-reload >/dev/null || true
+if [ -d /run/systemd/system ]
+then
+ systemctl --system daemon-reload >/dev/null || true
fi
diff --git a/debian/mariadb-server-10.8.preinst b/debian/mariadb-server-10.8.preinst
index c865173e29e..9a31b5c636e 100644
--- a/debian/mariadb-server-10.8.preinst
+++ b/debian/mariadb-server-10.8.preinst
@@ -7,17 +7,23 @@
# * <old-preinst> abort-upgrade <new-version>
#
+# shellcheck source=/dev/null
. /usr/share/debconf/confmodule
# Automatically set version to ease maintenance of this file
MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
# Just kill the invalid insserv.conf.d directory without fallback
-if [ -d "/etc/insserv.conf.d/mariadb/" ]; then
- rm -rf "/etc/insserv.conf.d/mariadb/"
+if [ -d "/etc/insserv.conf.d/mariadb/" ]
+then
+ rm -rf "/etc/insserv.conf.d/mariadb/"
fi
-if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
+if [ -n "$DEBIAN_SCRIPT_DEBUG" ]
+then
+ set -v -x
+ DEBIAN_SCRIPT_TRACE=1
+fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
@@ -28,25 +34,29 @@ mysql_upgradedir=/var/lib/mysql-upgrade
# 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.
stop_server() {
- # Return immediately if there are no mysqld processes running on a host
- # (leave containerized processes with the same name in other namespaces)
- # as there is no point in trying to shutdown in that case.
- if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi
-
- set +e
- invoke-rc.d mariadb stop
- invoke-rc.d mysql stop # Backwards compatibility
- errno=$?
- set -e
-
- # systemctl could emit exit code 100=no init script (fresh install)
- if [ "$errno" != 0 -a "$errno" != 100 ]; then
- echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
- echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
- echo "Stop it yourself and try again!" 1>&2
- db_stop
- exit 1
- fi
+ # Return immediately if there are no mysqld processes running on a host
+ # (leave containerized processes with the same name in other namespaces)
+ # as there is no point in trying to shutdown in that case.
+ if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
+ then
+ return
+ fi
+
+ set +e
+ invoke-rc.d mariadb stop
+ invoke-rc.d mysql stop # Backwards compatibility
+ errno=$?
+ set -e
+
+ # systemctl could emit exit code 100=no init script (fresh install)
+ if [ "$errno" != 0 ] && [ "$errno" != 100 ]
+ then
+ echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
+ echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
+ echo "Stop it yourself and try again!" 1>&2
+ db_stop
+ exit 1
+ fi
}
################################ main() ##########################
@@ -57,7 +67,7 @@ max_upgradeable_version=5.7
# Check if a flag file is found that indicates a previous MariaDB or MySQL
# version was installed. If multiple flags are found, check which one was
# the biggest version number.
-for flag in $mysql_datadir/debian-*.flag
+for flag in "$mysql_datadir"/debian-*.flag
do
# The for loop leaves $flag as the query string if there are no results,
@@ -92,7 +102,7 @@ done
# Downgrade is detected if the flag version is bigger than $this_version
# (e.g. 10.1 > 10.0) or the flag version is smaller than 10.0 but bigger
# than $max_upgradeable_version.
-if [ ! -z "$found_version" ]
+if [ -n "$found_version" ]
then
# MySQL 8.0 in Ubuntu has a bug in packaging and the file is name wrongly
@@ -112,7 +122,7 @@ then
fi
if dpkg --compare-versions "$found_version" '>>' "$max_upgradeable_version" \
- && dpkg --compare-versions "$found_version" '<<' "10.0"
+ && dpkg --compare-versions "$found_version" '<<' "10.0"
then
downgrade_detected=true
fi
@@ -134,7 +144,7 @@ fi
# Don't abort dpkg if downgrade is detected (as was done previously).
# Instead simply move the old datadir and create a new for this_version.
-if [ ! -z "$downgrade_detected" ]
+if [ -n "$downgrade_detected" ]
then
db_input critical "mariadb-server-$MAJOR_VER/old_data_directory_saved" || true
db_go
@@ -155,7 +165,8 @@ stop_server
# If we use NIS then errors should be tolerated. It's up to the
# user to ensure that the mysql user is correctly setup.
# 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 "$(which ypwhich 2>/dev/null)" && ypwhich >/dev/null 2>&1
+then
set +e
fi
@@ -170,23 +181,25 @@ fi
#
# creating mysql group if he isn't already there
-if ! getent group mysql >/dev/null; then
- # Adding system group: mysql.
- addgroup --system mysql >/dev/null
+if ! getent group mysql >/dev/null
+then
+ # Adding system group: mysql.
+ addgroup --system mysql >/dev/null
fi
# creating mysql user if he isn't already there
-if ! getent passwd mysql >/dev/null; then
- # Adding system user: mysql.
- adduser \
- --system \
- --disabled-login \
- --ingroup mysql \
- --no-create-home \
- --home /nonexistent \
- --gecos "MySQL Server" \
- --shell /bin/false \
- mysql >/dev/null
+if ! getent passwd mysql >/dev/null
+then
+ # Adding system user: mysql.
+ adduser \
+ --system \
+ --disabled-login \
+ --ingroup mysql \
+ --no-create-home \
+ --home /nonexistent \
+ --gecos "MySQL Server" \
+ --shell /bin/false \
+ mysql >/dev/null
fi
# end of NIS tolerance zone
@@ -194,7 +207,8 @@ set -e
# if there's a symlink, let's store where it's pointing, because otherwise
# it's going to be lost in some situations
-for dir in DATADIR LOGDIR; do
+for dir in DATADIR LOGDIR
+do
checkdir=$(eval echo "$"$dir)
if [ -L "$checkdir" ]; then
# Use mkdir option 'Z' to create with correct SELinux context.
@@ -204,15 +218,17 @@ for dir in DATADIR LOGDIR; do
done
# creating mysql home directory
-if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]; then
- # Use mkdir option 'Z' to create with correct SELinux context.
+if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]
+then
+ # Use mkdir option 'Z' to create with correct SELinux context.
mkdir -Z $mysql_datadir
fi
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
# 4096 blocks is then lower than 4 MB
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
echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2
db_stop
exit 1
@@ -231,7 +247,6 @@ find $mysql_datadir -follow -not -group mysql -print0 2>/dev/null \
| xargs -0 --no-run-if-empty chgrp mysql
set -e
-
db_stop
#DEBHELPER#
diff --git a/debian/mariadb-server-10.8.prerm b/debian/mariadb-server-10.8.prerm
index 8fd172da9d2..2701fa5fc36 100644
--- a/debian/mariadb-server-10.8.prerm
+++ b/debian/mariadb-server-10.8.prerm
@@ -4,9 +4,11 @@ set -e
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
-if [ -d /run/systemd/system ]; then
- deb-systemd-invoke stop mariadb.service >/dev/null
-# Modified dh_installinit snippet to only run with sysvinit
-elif [ -x "/etc/init.d/mariadb" ]; then
- invoke-rc.d mariadb stop || exit $?
+if [ -d /run/systemd/system ]
+then
+ deb-systemd-invoke stop mariadb.service >/dev/null
+ # Modified dh_installinit snippet to only run with sysvinit
+elif [ -x "/etc/init.d/mariadb" ]
+then
+ invoke-rc.d mariadb stop || exit $?
fi
diff --git a/mysql-test/suite/innodb_zip/r/page_size.result b/mysql-test/suite/innodb_zip/r/page_size.result
index 47effe06884..48b954c945b 100644
--- a/mysql-test/suite/innodb_zip/r/page_size.result
+++ b/mysql-test/suite/innodb_zip/r/page_size.result
@@ -608,4 +608,25 @@ SET GLOBAL innodb_compression_level=0;
INSERT INTO t1 VALUES ('');
SET GLOBAL innodb_compression_level= @save_innodb_compression_level;
DROP TABLE t1;
+#
+# MDEV-31158 Assertion ...MTR_MEMO_X_LOCKED in btr_attach_half_pages()
+#
+SET @save_compression_level=@@GLOBAL.innodb_compression_level;
+SET GLOBAL innodb_compression_level=0;
+CREATE TEMPORARY TABLE t(a SERIAL, prefix VARBINARY(4), pad INT);
+INSERT INTO t(prefix, pad) VALUES
+(_binary 0xff,160),('',19),(_binary 0x0001,253),(_binary 0x0b11,169),
+(_binary 0x0b010001,23),(_binary 0x0b100001,251),(_binary 0x0d,163),
+(_binary 0xb3,254),(_binary 0x96,254),(_binary 0xeb,61),
+(_binary 0xf231,253),(_binary 0x1db0,253),(_binary 0x0005,101),
+(_binary 0x6370,253),(_binary 0x0b12,112),(_binary 0x0b010002,23),
+(_binary 0x0b100002,80),(_binary 0x181984,163),(_binary 0x181926,168),
+(_binary 0xe1,176),(_binary 0xe2,187),(_binary 0xe6,254),(_binary 0xbb,51),
+(_binary 0x1c,248),(_binary 0x8a,94),(_binary 0x14,254);
+CREATE TABLE u(a SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+b VARBINARY(255), KEY(b)) ENGINE=InnoDB
+KEY_BLOCK_SIZE=1 ROW_FORMAT=COMPRESSED;
+INSERT INTO u SELECT a,CONCAT(prefix,REPEAT(chr(0),pad)) FROM t;
+DROP TABLE u, t;
+SET GLOBAL innodb_compression_level=@save_compression_level;
# End of 10.6 tests
diff --git a/mysql-test/suite/innodb_zip/t/page_size.test b/mysql-test/suite/innodb_zip/t/page_size.test
index 16d65a139cf..3455ef8ed94 100644
--- a/mysql-test/suite/innodb_zip/t/page_size.test
+++ b/mysql-test/suite/innodb_zip/t/page_size.test
@@ -888,4 +888,28 @@ INSERT INTO t1 VALUES ('');
SET GLOBAL innodb_compression_level= @save_innodb_compression_level;
DROP TABLE t1;
+--echo #
+--echo # MDEV-31158 Assertion ...MTR_MEMO_X_LOCKED in btr_attach_half_pages()
+--echo #
+--source include/have_innodb.inc
+
+SET @save_compression_level=@@GLOBAL.innodb_compression_level;
+SET GLOBAL innodb_compression_level=0;
+CREATE TEMPORARY TABLE t(a SERIAL, prefix VARBINARY(4), pad INT);
+INSERT INTO t(prefix, pad) VALUES
+(_binary 0xff,160),('',19),(_binary 0x0001,253),(_binary 0x0b11,169),
+(_binary 0x0b010001,23),(_binary 0x0b100001,251),(_binary 0x0d,163),
+(_binary 0xb3,254),(_binary 0x96,254),(_binary 0xeb,61),
+(_binary 0xf231,253),(_binary 0x1db0,253),(_binary 0x0005,101),
+(_binary 0x6370,253),(_binary 0x0b12,112),(_binary 0x0b010002,23),
+(_binary 0x0b100002,80),(_binary 0x181984,163),(_binary 0x181926,168),
+(_binary 0xe1,176),(_binary 0xe2,187),(_binary 0xe6,254),(_binary 0xbb,51),
+(_binary 0x1c,248),(_binary 0x8a,94),(_binary 0x14,254);
+CREATE TABLE u(a SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
+ b VARBINARY(255), KEY(b)) ENGINE=InnoDB
+ KEY_BLOCK_SIZE=1 ROW_FORMAT=COMPRESSED;
+INSERT INTO u SELECT a,CONCAT(prefix,REPEAT(chr(0),pad)) FROM t;
+DROP TABLE u, t;
+SET GLOBAL innodb_compression_level=@save_compression_level;
+
--echo # End of 10.6 tests
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8bc0b0dff59..bf1732ade6b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8526,25 +8526,26 @@ best_access_path(JOIN *join,
fanout= hash_join_fanout(join, s, remaining_tables, rnd_records,
hj_start_key, &stats_found);
join_sel= 1.0; // Don't do the "10% heuristic"
+ if (stats_found)
+ goto fanout_computed;
}
- if (!stats_found)
- {
- /*
- No OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY or no field statistics
- found.
-
- Take into account if there is non constant constraints used with
- earlier tables in the where expression.
- If yes, this will set fanout to rnd_records/4.
- We estimate that there will be HASH_FANOUT (10%)
- hash matches / row.
- */
- if (found_constraint && !force_estimate)
- rnd_records= use_found_constraint(rnd_records);
- fanout= rnd_records;
- join_sel= 0.1;
- }
+ /*
+ No OPTIMIZER_SWITCH_HASH_JOIN_CARDINALITY or no field statistics
+ found.
+
+ Take into account if there is non constant constraints used with
+ earlier tables in the where expression.
+ If yes, this will set fanout to rnd_records/4.
+ We estimate that there will be HASH_FANOUT (10%)
+ hash matches / row.
+ */
+ if (found_constraint && !force_estimate)
+ rnd_records= use_found_constraint(rnd_records);
+ fanout= rnd_records;
+ join_sel= 0.1;
+
+ fanout_computed:
tmp= s->quick ? s->quick->read_time : s->scan_time();
double cmp_time= (s->records - rnd_records)/TIME_FOR_COMPARE;
tmp= COST_ADD(tmp, cmp_time);
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index a33f8f0ee43..59ba6eaa2b4 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -748,18 +748,24 @@ btr_cur_will_modify_tree(
/** Detects whether the modifying record might need a opposite modification
to the intention.
-@param page page
-@param lock_intention lock intention for the tree operation
+@param bpage buffer pool page
+@param is_clust whether this is a clustered index
+@param lock_intention lock intention for the tree operation
@param node_ptr_max_size the maximum size of a node pointer
@param compress_limit BTR_CUR_PAGE_COMPRESS_LIMIT(index)
-@param rec record (current node_ptr)
-@return true if tree modification is needed */
-static bool btr_cur_need_opposite_intention(const page_t *page,
+@param rec record (current node_ptr)
+@return true if tree modification is needed */
+static bool btr_cur_need_opposite_intention(const buf_page_t &bpage,
+ bool is_clust,
btr_intention_t lock_intention,
ulint node_ptr_max_size,
ulint compress_limit,
const rec_t *rec)
{
+ if (UNIV_LIKELY_NULL(bpage.zip.data) &&
+ !page_zip_available(&bpage.zip, is_clust, node_ptr_max_size, 1))
+ return true;
+ const page_t *const page= bpage.frame;
if (lock_intention != BTR_INTENTION_INSERT)
{
/* We compensate also for btr_cur_compress_recommendation() */
@@ -1343,7 +1349,8 @@ release_tree:
!btr_block_get(*index(), btr_page_get_next(block->page.frame),
RW_X_LATCH, false, mtr, &err))
goto func_exit;
- if (btr_cur_need_opposite_intention(block->page.frame, lock_intention,
+ if (btr_cur_need_opposite_intention(block->page, index()->is_clust(),
+ lock_intention,
node_ptr_max_size, compress_limit,
page_cur.rec))
goto need_opposite_intention;
@@ -1399,7 +1406,8 @@ release_tree:
default:
break;
case BTR_MODIFY_TREE:
- if (btr_cur_need_opposite_intention(block->page.frame, lock_intention,
+ if (btr_cur_need_opposite_intention(block->page, index()->is_clust(),
+ lock_intention,
node_ptr_max_size, compress_limit,
page_cur.rec))
/* If the rec is the first or last in the page for pessimistic
@@ -1949,7 +1957,7 @@ index_locked:
break;
if (!index->lock.have_x() &&
- btr_cur_need_opposite_intention(block->page.frame,
+ btr_cur_need_opposite_intention(block->page, index->is_clust(),
lock_intention,
node_ptr_max_size,
compress_limit, page_cur.rec))
@@ -1996,7 +2004,8 @@ index_locked:
ut_ad(latch_mode != BTR_MODIFY_TREE || upper_rw_latch == RW_X_LATCH);
if (latch_mode != BTR_MODIFY_TREE);
- else if (btr_cur_need_opposite_intention(block->page.frame, lock_intention,
+ else if (btr_cur_need_opposite_intention(block->page, index->is_clust(),
+ lock_intention,
node_ptr_max_size, compress_limit,
page_cur.rec))
{