Commit 616ced88 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.9 into 10.10

parents a089ebd0 2763f733
#!/bin/bash
set -e
# shellcheck source=/dev/null
. /usr/share/debconf/confmodule
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
......@@ -21,7 +27,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
......@@ -61,21 +69,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...
......@@ -109,17 +122,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
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
......@@ -180,26 +205,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
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
{
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
......@@ -212,8 +241,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
......@@ -225,14 +256,14 @@ 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
......@@ -252,19 +283,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
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
# 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
#!/bin/bash
set -e
# shellcheck source=/dev/null
. /usr/share/debconf/confmodule
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"
......@@ -14,7 +20,10 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
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
if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
then
return
fi
set +e
invoke-rc.d mariadb stop
......@@ -23,7 +32,8 @@ stop_server() {
set -e
# systemctl could emit exit code 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
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
......@@ -35,7 +45,8 @@ stop_server() {
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
......@@ -51,7 +62,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-__MARIADB_MAJOR_VER__.flag" ]; then
if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-__MARIADB_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
......@@ -59,7 +71,8 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-__MARIADB_MAJOR_VER__.flag"
db_input high "mariadb-server/postrm_remove_databases" || true
db_go || true
db_get "mariadb-server/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
......@@ -89,6 +102,7 @@ fi
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]; then
if [ -d /run/systemd/system ]
then
systemctl --system daemon-reload >/dev/null || true
fi
......@@ -7,14 +7,20 @@
# * <old-preinst> abort-upgrade <new-version>
#
# shellcheck source=/dev/null
. /usr/share/debconf/confmodule
# Just kill the invalid insserv.conf.d directory without fallback
if [ -d "/etc/insserv.conf.d/mariadb/" ]; then
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,7 +34,10 @@ 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
if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
then
return
fi
set +e
invoke-rc.d mariadb stop
......@@ -37,7 +46,8 @@ stop_server() {
set -e
# systemctl could emit exit code 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
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
......@@ -56,7 +66,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,
......@@ -91,7 +101,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
......@@ -133,7 +143,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/old_data_directory_saved" || true
db_go
......@@ -154,7 +164,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
......@@ -169,13 +180,15 @@ fi
#
# creating mysql group if he isn't already there
if ! getent group mysql >/dev/null; then
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
if ! getent passwd mysql >/dev/null
then
# Adding system user: mysql.
adduser \
--system \
......@@ -193,7 +206,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.
......@@ -203,7 +217,8 @@ for dir in DATADIR LOGDIR; do
done
# creating mysql home directory
if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]; then
if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]
then
# Use mkdir option 'Z' to create with correct SELinux context.
mkdir -Z $mysql_datadir
fi
......@@ -211,7 +226,8 @@ 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
......@@ -230,7 +246,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#
......@@ -4,9 +4,11 @@ set -e
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]; then
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
# Modified dh_installinit snippet to only run with sysvinit
elif [ -x "/etc/init.d/mariadb" ]
then
invoke-rc.d mariadb stop || exit $?
fi
......@@ -434,7 +434,7 @@ create table t1 as select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'04420435044
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` varchar(8) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL
`x` longtext CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
set names latin1;
......@@ -468,3 +468,26 @@ set names latin1;
#
# End of 10.7 tests
#
#
# Start of 10.8 tests
#
#
# MDEV-29646 sformat('Num [{:20}]', 42) gives incorrect result in view
#
create view v1 as select sformat('Num [{:20}]', 42);
select * from v1;
sformat('Num [{:20}]', 42)
Num [ 42]
drop view v1;
create view v1 as SELECT sformat('Square root of [{:d}] is [{:.20}]', 2, sqrt(2));
select * from v1;
sformat('Square root of [{:d}] is [{:.20}]', 2, sqrt(2))
Square root of [2] is [1.4142135623730951455]
drop view v1;
create table t1 (a text, b int, c text);
insert t1 values ('[{} -> {}]', 10, '{}'), ('[{:20} <- {}]', 1, '{:30}');
select sformat(a,b,c) from t1;
sformat(a,b,c)
[10 -> {}]
[ 1 <- {:30}]
drop table t1;
......@@ -253,3 +253,24 @@ set names latin1;
echo #;
echo # End of 10.7 tests;
echo #;
echo #;
echo # Start of 10.8 tests;
echo #;
echo #;
echo # MDEV-29646 sformat('Num [{:20}]', 42) gives incorrect result in view;
echo #;
create view v1 as select sformat('Num [{:20}]', 42);
select * from v1;
drop view v1;
create view v1 as SELECT sformat('Square root of [{:d}] is [{:.20}]', 2, sqrt(2));
select * from v1;
drop view v1;
create table t1 (a text, b int, c text);
insert t1 values ('[{} -> {}]', 10, '{}'), ('[{:20} <- {}]', 1, '{:30}');
select sformat(a,b,c) from t1;
drop table t1;
......@@ -21,9 +21,9 @@
-test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
+test/t3 DEFAULT 2048 MYSQLD_DATADIR/test/t3.ibd
test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
@@ -51,141 +51,90 @@
@@ -52,141 +52,90 @@
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
......@@ -211,7 +211,7 @@
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
Level Code Message
@@ -217,15 +166,21 @@
@@ -218,15 +167,21 @@
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
......@@ -233,7 +233,7 @@
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
@@ -269,6 +224,7 @@
@@ -270,6 +225,7 @@
ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
......@@ -241,7 +241,7 @@
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
@@ -276,105 +232,11 @@
@@ -277,105 +233,11 @@
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
......@@ -348,7 +348,7 @@
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
@@ -389,10 +251,6 @@
@@ -390,10 +252,6 @@
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
CREATE INDEX t1a ON t1 (a(767));
......@@ -359,7 +359,7 @@
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1f ON t1 (f(767));
@@ -407,37 +265,15 @@
@@ -408,37 +266,15 @@
COMMIT;
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
......@@ -401,7 +401,7 @@
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -463,28 +299,12 @@
@@ -464,28 +300,12 @@
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
......@@ -432,7 +432,7 @@
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC
DROP TABLE t1;
# Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE
@@ -569,27 +389,25 @@
@@ -570,27 +390,25 @@
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
......
......@@ -21,9 +21,9 @@
-test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd
+test/t3 DEFAULT 4096 MYSQLD_DATADIR/test/t3.ibd
test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd
innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
@@ -53,133 +53,97 @@
@@ -54,133 +54,97 @@
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200),
......@@ -199,7 +199,7 @@
SHOW WARNINGS;
Level Code Message
SELECT table_name, row_format, create_options
@@ -217,8 +181,11 @@
@@ -218,8 +182,11 @@
DROP TABLE t1;
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
......@@ -211,7 +211,7 @@
SELECT table_name, row_format, create_options
FROM information_schema.tables WHERE table_name = 't1';
table_name row_format create_options
@@ -276,105 +243,11 @@
@@ -277,105 +244,11 @@
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
......@@ -318,7 +318,7 @@
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
@@ -389,10 +262,6 @@
@@ -390,10 +263,6 @@
UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b,
k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b;
CREATE INDEX t1a ON t1 (a(767));
......@@ -329,7 +329,7 @@
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1f ON t1 (f(767));
@@ -407,30 +276,6 @@
@@ -408,30 +277,6 @@
COMMIT;
CREATE INDEX t1g ON t1 (g(767));
UPDATE t1 SET g=@e;
......@@ -360,7 +360,7 @@
CREATE INDEX t1t ON t1 (t(767));
BEGIN;
UPDATE t1 SET t=@e;
@@ -463,24 +308,8 @@
@@ -464,24 +309,8 @@
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
KEY `t1a` (`a`(767)),
......@@ -385,7 +385,7 @@
KEY `t1t` (`t`(767)),
KEY `t1u` (`u`(767)),
KEY `t1ut` (`u`(767),`t`(767)),
@@ -572,14 +401,14 @@
@@ -573,14 +402,14 @@
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
......@@ -402,7 +402,7 @@
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
@@ -589,7 +418,7 @@
@@ -590,7 +419,7 @@
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
......
......@@ -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
......@@ -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
......@@ -1373,13 +1373,13 @@ bool Item_func_sformat::fix_length_and_dec(THD *thd)
for (uint i=0 ; i < arg_count ; i++)
{
char_length+= args[i]->max_char_length();
if (args[i]->result_type() == STRING_RESULT &&
Type_std_attributes::agg_item_set_converter(c, func_name_cstring(),
args+i, 1, flags, 1))
return TRUE;
}
char_length= MAX_BLOB_WIDTH;
fix_char_length_ulonglong(char_length);
return FALSE;
}
......
......@@ -8646,9 +8646,10 @@ 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.
......@@ -8663,8 +8664,8 @@ best_access_path(JOIN *join,
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);
......@@ -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 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,
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 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode,
!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 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode,
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 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index,
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 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index,
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))
{
......
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