summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2022-03-18 11:33:07 +1100
committerDaniel Black <daniel@mariadb.org>2022-03-18 12:17:11 +1100
commit065f995e6d7778ef69a8a0a4829b79244fa75ba4 (patch)
tree4b481bbe125ccbd14c1a740876b1309b2df9dcea
parentee80c19633dd5d4e781b3e675d2ece52a5b0f9ff (diff)
parent06e3bc4390ee286fd20b34526510768f1b32ed7f (diff)
downloadmariadb-git-065f995e6d7778ef69a8a0a4829b79244fa75ba4.tar.gz
Merge branch 10.5 into 10.6
-rwxr-xr-xdebian/autobake-deb.sh85
-rw-r--r--debian/control2
-rw-r--r--mysql-test/main/ctype_utf32.result23
-rw-r--r--mysql-test/main/ctype_utf32.test19
-rw-r--r--mysql-test/main/ctype_utf32_uca.result15
-rw-r--r--mysql-test/main/ctype_utf32_uca.test13
-rw-r--r--mysql-test/main/drop_bad_db_type.result54
-rw-r--r--mysql-test/main/drop_bad_db_type.test19
-rw-r--r--mysql-test/main/error_simulation.result10
-rw-r--r--mysql-test/main/error_simulation.test13
-rw-r--r--mysql-test/main/partition_not_blackhole.result2
-rw-r--r--mysql-test/main/partition_not_blackhole.test2
-rw-r--r--mysql-test/suite/galera/r/galera_kill_applier.result4
-rw-r--r--mysql-test/suite/galera/t/galera_kill_applier.test6
-rw-r--r--mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc3
-rw-r--r--sql/ha_partition.cc85
-rw-r--r--sql/ha_partition.h3
-rw-r--r--sql/mysqld.cc7
-rw-r--r--sql/share/errmsg-utf8.txt48
-rw-r--r--sql/sql_class.cc52
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_parse.cc18
-rw-r--r--sql/sql_table.cc20
-rw-r--r--sql/sys_vars.cc2
-rw-r--r--sql/table.cc17
-rw-r--r--sql/temporary_tables.cc8
-rw-r--r--sql/unireg.h16
-rw-r--r--storage/maria/ma_open.c5
28 files changed, 404 insertions, 151 deletions
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 29666d89b0e..4c0ef635da0 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -11,24 +11,15 @@
# Exit immediately on any error
set -e
-CODENAME="$(lsb_release -sc)"
-case "${CODENAME}" in
- stretch)
- # MDEV-28022 libzstd-dev-1.1.3 minimum version
- sed -i -e '/libzstd-dev/d' debian/control
- ;;
-esac
-
-# This file is invoked from Buildbot and Travis-CI to build deb packages.
-# As both of those CI systems have many parallel jobs that include different
-# parts of the test suite, we don't need to run the mysql-test-run at all when
-# building the deb packages here.
+# On Buildbot, don't run the mysql-test-run test suite as part of build.
+# It takes a lot of time, and we will do a better test anyway in
+# Buildbot, running the test suite from installed .debs on a clean VM.
export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
# General CI optimizations to keep build output smaller
-if [[ $TRAVIS ]] || [[ $GITLAB_CI ]]
+if [[ $GITLAB_CI ]]
then
- # On both Travis and Gitlab the output log must stay under 4MB so make the
+ # On Gitlab the output log must stay under 4MB so make the
# build less verbose
sed '/Add support for verbose builds/,/^$/d' -i debian/rules
elif [ -d storage/columnstore/columnstore/debian ]
@@ -43,41 +34,39 @@ then
cat storage/columnstore/columnstore/debian/control >> debian/control
fi
-# Don't build or try to put files in a package for selected plugins and components on Travis-CI
-# in order to keep build small (in both duration and disk space)
-if [[ $TRAVIS ]]
-then
- # Test suite package not relevant on Travis-CI
- sed 's|DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test|DINSTALL_MYSQLTESTDIR=false|' -i debian/rules
- sed '/Package: mariadb-test-data/,/^$/d' -i debian/control
- sed '/Package: mariadb-test$/,/^$/d' -i debian/control
-
- # Extra plugins such as Mroonga, Spider, OQgraph, Sphinx and the embedded build can safely be skipped
- sed 's|-DDEB|-DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO -DWITH_EMBEDDED_SERVER=OFF -DDEB|' -i debian/rules
- sed "/Package: mariadb-plugin-mroonga/,/^$/d" -i debian/control
- sed "/Package: mariadb-plugin-rocksdb/,/^$/d" -i debian/control
- sed "/Package: mariadb-plugin-spider/,/^$/d" -i debian/control
- sed "/Package: mariadb-plugin-oqgraph/,/^$/d" -i debian/control
- sed "/ha_sphinx.so/d" -i debian/mariadb-server-10.6.install
- sed "/Package: libmariadbd19/,/^$/d" -i debian/control
- sed "/Package: libmariadbd-dev/,/^$/d" -i debian/control
-fi
+# Look up distro-version specific stuff
+#
+# Always keep the actual packaging as up-to-date as possible following the latest
+# Debian policy and targeting Debian Sid. Then case-by-case run in autobake-deb.sh
+# tests for backwards compatibility and strip away parts on older builders.
-# If rocksdb-tools is not available (before Debian Buster and Ubuntu Disco)
-# remove the dependency from the RocksDB plugin so it can install properly
-# and instead ship the one built from MariaDB sources
-if ! apt-cache madison rocksdb-tools | grep 'rocksdb-tools' >/dev/null 2>&1
-then
+remove_rocksdb_tools()
+{
sed '/rocksdb-tools/d' -i debian/control
sed '/sst_dump/d' -i debian/not-installed
- echo "usr/bin/sst_dump" >> debian/mariadb-plugin-rocksdb.install
-fi
+ if ! grep -q sst_dump debian/mariadb-plugin-rocksdb.install
+ then
+ echo "usr/bin/sst_dump" >> debian/mariadb-plugin-rocksdb.install
+ fi
+}
+
+
+CODENAME="$(lsb_release -sc)"
+case "${CODENAME}" in
+ stretch)
+ # MDEV-28022 libzstd-dev-1.1.3 minimum version
+ sed -i -e '/libzstd-dev/d' \
+ -e 's/libcurl4/libcurl3/g' -i debian/control
+ remove_rocksdb_tools
+ ;;
+ bionic)
+ remove_rocksdb_tools
+ ;;
+esac
-# If libcurl4 is not available (before Debian Buster and Ubuntu Bionic)
-# use older libcurl3 instead
-if ! apt-cache madison libcurl4 | grep 'libcurl4' >/dev/null 2>&1
+if [[ ! "$(dpkg-architecture -q DEB_BUILD_ARCH)" =~ amd64|arm64|ppc64el|s390x ]]
then
- sed 's/libcurl4/libcurl3/g' -i debian/control
+ remove_rocksdb_tools
fi
# From Debian Bullseye/Ubuntu Groovy, liburing replaces libaio
@@ -111,9 +100,9 @@ dch -b -D "${CODENAME}" -v "${VERSION}" "Automatic build with ${LOGSTRING}." --c
echo "Creating package version ${VERSION} ... "
-# On Travis CI and Gitlab-CI, use -b to build binary only packages as there is
+# On Gitlab-CI, use -b to build binary only packages as there is
# no need to waste time on generating the source package.
-if [[ $TRAVIS ]]
+if [[ $GITLAB_CI ]]
then
BUILDPACKAGE_FLAGS="-b"
fi
@@ -133,8 +122,8 @@ fakeroot $BUILDPACKAGE_PREPEND dpkg-buildpackage -us -uc -I $BUILDPACKAGE_FLAGS
# If the step above fails due to missing dependencies, you can manually run
# sudo mk-build-deps debian/control -r -i
-# Don't log package contents on Travis-CI or Gitlab-CI to save time and log size
-if [[ ! $TRAVIS ]] && [[ ! $GITLAB_CI ]]
+# Don't log package contents on Gitlab-CI to save time and log size
+if [[ ! $GITLAB_CI ]]
then
echo "List package contents ..."
cd ..
diff --git a/debian/control b/debian/control
index e7906cddb89..de5dc51d906 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
Build-Depends: bison,
cmake,
cracklib-runtime <!nocheck>,
- debhelper (>= 9.20160709~),
+ debhelper (>= 10),
dh-exec,
flex [amd64],
gdb <!nocheck>,
diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result
index d7717ece210..cf9db875290 100644
--- a/mysql-test/main/ctype_utf32.result
+++ b/mysql-test/main/ctype_utf32.result
@@ -2890,5 +2890,28 @@ HEX(c1)
0000006100000063
DROP TABLE t1;
#
+# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
+#
+CREATE TABLE t1 (a CHAR(1));
+SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary;
+ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
+ERROR HY000: Column 'a' has duplicated value 'a' in ENUM
+ALTER TABLE t1 CHANGE a a ENUM('aaa') CHARACTER SET utf32;
+ERROR HY000: Invalid utf32 character string: '\x00aaa'
+ALTER TABLE t1 CHANGE a a ENUM('aa') CHARACTER SET utf32;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('慡') CHARACTER SET utf32 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a','b') CHARACTER SET utf32 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET NAMES utf8;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test
index 59cc13015af..6944fdb30be 100644
--- a/mysql-test/main/ctype_utf32.test
+++ b/mysql-test/main/ctype_utf32.test
@@ -1048,6 +1048,25 @@ INSERT INTO t1 (c1) VALUES (1),(2),(3);
SELECT HEX(c1) FROM t1 ORDER BY c1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
+--echo #
+
+CREATE TABLE t1 (a CHAR(1));
+SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary;
+--error ER_DUPLICATED_VALUE_IN_TYPE
+ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
+--error ER_INVALID_CHARACTER_STRING
+ALTER TABLE t1 CHANGE a a ENUM('aaa') CHARACTER SET utf32;
+ALTER TABLE t1 CHANGE a a ENUM('aa') CHARACTER SET utf32;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET NAMES utf8;
+
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result
index 32ecf49dc70..27aa934cf00 100644
--- a/mysql-test/main/ctype_utf32_uca.result
+++ b/mysql-test/main/ctype_utf32_uca.result
@@ -7941,6 +7941,21 @@ EXECUTE s;
DEALLOCATE PREPARE s;
SET NAMES utf8;
#
+# MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
+#
+CREATE TABLE t1 (a CHAR(1));
+SET COLLATION_CONNECTION=utf32_myanmar_ci, CHARACTER_SET_CLIENT=binary;
+ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
+ERROR HY000: Column 'a' has duplicated value 'a' in ENUM
+ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a','b') CHARACTER SET utf32 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET NAMES utf8;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/ctype_utf32_uca.test b/mysql-test/main/ctype_utf32_uca.test
index 0abc6a73fc8..9a6fc3260b0 100644
--- a/mysql-test/main/ctype_utf32_uca.test
+++ b/mysql-test/main/ctype_utf32_uca.test
@@ -290,6 +290,19 @@ EXECUTE s;
DEALLOCATE PREPARE s;
SET NAMES utf8;
+--echo #
+--echo # MDEV-23210 Assertion `(length % 4) == 0' failed in my_lengthsp_utf32 on ALTER TABLE, SELECT and INSERT
+--echo #
+
+CREATE TABLE t1 (a CHAR(1));
+SET COLLATION_CONNECTION=utf32_myanmar_ci, CHARACTER_SET_CLIENT=binary;
+--error ER_DUPLICATED_VALUE_IN_TYPE
+ALTER TABLE t1 CHANGE a a ENUM('a','a') CHARACTER SET utf32;
+ALTER TABLE t1 CHANGE a a ENUM('a','b') CHARACTER SET utf32;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET NAMES utf8;
+
--echo #
--echo # End of 10.2 tests
diff --git a/mysql-test/main/drop_bad_db_type.result b/mysql-test/main/drop_bad_db_type.result
index ae6fe708e60..97869a39aa3 100644
--- a/mysql-test/main/drop_bad_db_type.result
+++ b/mysql-test/main/drop_bad_db_type.result
@@ -3,34 +3,50 @@ SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive';
create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3);
+create table t2 (a int) engine=archive partition by hash(a) partitions 3;
flush tables;
uninstall soname 'ha_archive';
-select table_schema, table_name from information_schema.tables where table_name like 't1';
-table_schema test
-table_name t1
-select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
-table_schema test
-table_name t1
-engine ARCHIVE
-version NULL
+select table_schema, table_name from information_schema.tables where table_name like 't_' order by 1,2;
+table_schema table_name
+test t1
+test t2
+select table_schema, table_name, engine, version from information_schema.tables where table_name like 't_' order by 1,2;
+table_schema table_name engine version
+test t1 ARCHIVE NULL
+test t2 NULL NULL
Warnings:
-Level Warning
-Code 1286
-Message Unknown storage engine 'ARCHIVE'
-select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
-table_schema test
-table_name t1
-engine ARCHIVE
-row_format NULL
+Warning 1033 Incorrect information in file: './test/t2.frm'
+Warning 1286 Unknown storage engine 'ARCHIVE'
+select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't_' order by 1,2;
+table_schema table_name engine row_format
+test t1 ARCHIVE NULL
+test t2 NULL NULL
Warnings:
-Level Warning
-Code 1286
-Message Unknown storage engine 'ARCHIVE'
+Warning 1033 Incorrect information in file: './test/t2.frm'
+Warning 1286 Unknown storage engine 'ARCHIVE'
install soname 'ha_archive';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+ PARTITION BY HASH (`a`)
+PARTITIONS 3
db.opt
t1.ARZ
t1.frm
+t2#P#p0.ARZ
+t2#P#p1.ARZ
+t2#P#p2.ARZ
+t2.frm
+t2.par
drop table t1;
+drop table t2;
db.opt
uninstall soname 'ha_archive';
SET debug_dbug=@saved_dbug;
diff --git a/mysql-test/main/drop_bad_db_type.test b/mysql-test/main/drop_bad_db_type.test
index ebc732104d3..0fb5fe5edf4 100644
--- a/mysql-test/main/drop_bad_db_type.test
+++ b/mysql-test/main/drop_bad_db_type.test
@@ -1,4 +1,4 @@
-
+--source include/have_partition.inc
--source include/have_debug.inc
if (!$HA_ARCHIVE_SO) {
@@ -13,18 +13,25 @@ SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive';
create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3);
+
+create table t2 (a int) engine=archive partition by hash(a) partitions 3;
+
flush tables;
uninstall soname 'ha_archive';
---vertical_results
-select table_schema, table_name from information_schema.tables where table_name like 't1';
-select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
-select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
---horizontal_results
+select table_schema, table_name from information_schema.tables where table_name like 't_' order by 1,2;
+--replace_result $mysqld_datadir ./
+select table_schema, table_name, engine, version from information_schema.tables where table_name like 't_' order by 1,2;
+--replace_result $mysqld_datadir ./
+select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't_' order by 1,2;
install soname 'ha_archive';
+show create table t1;
+show create table t2;
+
--list_files $mysqld_datadir/test
drop table t1;
+drop table t2;
--list_files $mysqld_datadir/test
uninstall soname 'ha_archive';
diff --git a/mysql-test/main/error_simulation.result b/mysql-test/main/error_simulation.result
index 457e5c8ec9c..680937accfd 100644
--- a/mysql-test/main/error_simulation.result
+++ b/mysql-test/main/error_simulation.result
@@ -128,3 +128,13 @@ SELECT f1(1);
Got one of the listed errors
DROP FUNCTION f1;
SET debug_dbug= @saved_dbug;
+#
+# MDEV-27978 wrong option name in error when exceeding max_session_mem_used
+#
+SET SESSION max_session_mem_used = 8192;
+SELECT * FROM information_schema.processlist;
+ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
+SET SESSION max_session_mem_used = DEFAULT;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/error_simulation.test b/mysql-test/main/error_simulation.test
index f713e2da6ba..2c155bc9a22 100644
--- a/mysql-test/main/error_simulation.test
+++ b/mysql-test/main/error_simulation.test
@@ -158,3 +158,16 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
SELECT f1(1);
DROP FUNCTION f1;
SET debug_dbug= @saved_dbug;
+
+--echo #
+--echo # MDEV-27978 wrong option name in error when exceeding max_session_mem_used
+--echo #
+SET SESSION max_session_mem_used = 8192;
+--error ER_OPTION_PREVENTS_STATEMENT
+SELECT * FROM information_schema.processlist;
+SET SESSION max_session_mem_used = DEFAULT;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/partition_not_blackhole.result b/mysql-test/main/partition_not_blackhole.result
index 6cb8dea80c8..9753cd2bae2 100644
--- a/mysql-test/main/partition_not_blackhole.result
+++ b/mysql-test/main/partition_not_blackhole.result
@@ -9,7 +9,7 @@ SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
-ERROR HY000: Failed to read from the .par file
+ERROR HY000: Incorrect information in file: './test/t1.frm'
DROP TABLE t1;
ERROR HY000: Got error 175 "File too short; Expected more data in file" from storage engine partition
t1.frm
diff --git a/mysql-test/main/partition_not_blackhole.test b/mysql-test/main/partition_not_blackhole.test
index d9e653b5252..fe7452432b2 100644
--- a/mysql-test/main/partition_not_blackhole.test
+++ b/mysql-test/main/partition_not_blackhole.test
@@ -17,7 +17,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
--copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par
SHOW TABLES;
--replace_result $MYSQLD_DATADIR ./
---error ER_FAILED_READ_FROM_PAR_FILE
+--error ER_NOT_FORM_FILE
SHOW CREATE TABLE t1;
# The replace is needed for Solaris
diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result
index 78a91d2638f..a47f486b5fb 100644
--- a/mysql-test/suite/galera/r/galera_kill_applier.result
+++ b/mysql-test/suite/galera/r/galera_kill_applier.result
@@ -5,9 +5,13 @@ SELECT @@wsrep_slave_threads;
@@wsrep_slave_threads
1
SET GLOBAL wsrep_slave_threads=2;
+KILL ID;
Got one of the listed errors
+KILL QUERY ID;
Got one of the listed errors
+KILL ID;
Got one of the listed errors
+KILL QUERY ID;
Got one of the listed errors
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test
index 3a285822613..88ec55ed0c1 100644
--- a/mysql-test/suite/galera/t/galera_kill_applier.test
+++ b/mysql-test/suite/galera/t/galera_kill_applier.test
@@ -16,21 +16,23 @@ SET GLOBAL wsrep_slave_threads=2;
--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle' LIMIT 1`
---disable_query_log
+--replace_result $applier_thread ID
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL $applier_thread
+--replace_result $applier_thread ID
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL QUERY $applier_thread
--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1`
+--replace_result $aborter_thread ID
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL $aborter_thread
+--replace_result $aborter_thread ID
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL QUERY $aborter_thread
---enable_query_log
SET GLOBAL wsrep_slave_threads=DEFAULT;
diff --git a/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc
index 88268ddd6c4..3f48f86ce7c 100644
--- a/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc
+++ b/mysql-test/suite/gcol/inc/gcol_supported_sql_funcs_main.inc
@@ -12,6 +12,9 @@
# Change Date: #
# Change: #
################################################################################
+
+--source include/have_des.inc
+
set time_zone="+03:00";
--echo #
--echo # NUMERIC FUNCTIONS
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index ccae9fe2bf6..794036ed758 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3193,11 +3193,12 @@ err1:
@retval true Failure
*/
-bool ha_partition::setup_engine_array(MEM_ROOT *mem_root)
+bool ha_partition::setup_engine_array(MEM_ROOT *mem_root,
+ handlerton* first_engine)
{
uint i;
uchar *buff;
- handlerton **engine_array, *first_engine;
+ handlerton **engine_array;
enum legacy_db_type db_type, first_db_type;
DBUG_ASSERT(!m_file);
@@ -3207,11 +3208,8 @@ bool ha_partition::setup_engine_array(MEM_ROOT *mem_root)
DBUG_RETURN(true);
buff= (uchar *) (m_file_buffer + PAR_ENGINES_OFFSET);
- first_db_type= (enum legacy_db_type) buff[0];
- first_engine= ha_resolve_by_legacy_type(ha_thd(), first_db_type);
- if (!first_engine)
- goto err;
+ first_db_type= (enum legacy_db_type) buff[0];
if (!(m_engine_array= (plugin_ref*)
alloc_root(&m_mem_root, m_tot_parts * sizeof(plugin_ref))))
goto err;
@@ -3252,6 +3250,75 @@ err:
}
+handlerton *ha_partition::get_def_part_engine(const char *name)
+{
+ if (table_share)
+ {
+ if (table_share->default_part_plugin)
+ return plugin_data(table_share->default_part_plugin, handlerton *);
+ }
+ else
+ {
+ // DROP TABLE, for example
+ char buff[FN_REFLEN];
+ File file;
+ MY_STAT state;
+ uchar *frm_image= 0;
+ handlerton *hton= 0;
+ bool use_legacy_type= false;
+
+ fn_format(buff, name, "", reg_ext, MY_APPEND_EXT);
+
+ file= mysql_file_open(key_file_frm, buff, O_RDONLY | O_SHARE, MYF(0));
+ if (file < 0)
+ return NULL;
+
+ if (mysql_file_fstat(file, &state, MYF(MY_WME)))
+ goto err;
+ if (state.st_size <= 64)
+ goto err;
+ if (!(frm_image= (uchar*)my_malloc(key_memory_Partition_share,
+ state.st_size, MYF(MY_WME))))
+ goto err;
+ if (mysql_file_read(file, frm_image, state.st_size, MYF(MY_NABP)))
+ goto err;
+
+ if (frm_image[64] != '/')
+ {
+ const uchar *e2= frm_image + 64;
+ const uchar *e2end = e2 + uint2korr(frm_image + 4);
+ if (e2end > frm_image + state.st_size)
+ goto err;
+ while (e2 + 3 < e2end)
+ {
+ uchar type= *e2++;
+ size_t length= extra2_read_len(&e2, e2end);
+ if (!length)
+ goto err;
+ if (type == EXTRA2_DEFAULT_PART_ENGINE)
+ {
+ LEX_CSTRING name= { (char*)e2, length };
+ plugin_ref plugin= ha_resolve_by_name(ha_thd(), &name, false);
+ if (plugin)
+ hton= plugin_data(plugin, handlerton *);
+ goto err;
+ }
+ e2+= length;
+ }
+ }
+ use_legacy_type= true;
+err:
+ my_free(frm_image);
+ mysql_file_close(file, MYF(0));
+ if (!use_legacy_type)
+ return hton;
+ }
+
+ return ha_resolve_by_legacy_type(ha_thd(),
+ (enum legacy_db_type)m_file_buffer[PAR_ENGINES_OFFSET]);
+}
+
+
/**
Get info about partition engines and their names from the .par file
@@ -3279,7 +3346,11 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root,
if (read_par_file(name))
DBUG_RETURN(true);
- if (!is_clone && setup_engine_array(mem_root))
+ handlerton *default_engine= get_def_part_engine(name);
+ if (!default_engine)
+ DBUG_RETURN(true);
+
+ if (!is_clone && setup_engine_array(mem_root, default_engine))
DBUG_RETURN(true);
DBUG_RETURN(false);
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 14f68b36c0b..dd14cd7a6d4 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -590,8 +590,9 @@ private:
And one method to read it in.
*/
bool create_handler_file(const char *name);
- bool setup_engine_array(MEM_ROOT *mem_root);
+ bool setup_engine_array(MEM_ROOT *mem_root, handlerton *first_engine);
bool read_par_file(const char *name);
+ handlerton *get_def_part_engine(const char *name);
bool get_from_handler_file(const char *name, MEM_ROOT *mem_root,
bool is_clone);
bool new_handlers_from_part_info(MEM_ROOT *mem_root);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b6748170942..c3f745b4aae 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3640,13 +3640,18 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
/* Ensure we don't get called here again */
char buf[50], *buf2;
thd->set_killed(KILL_QUERY);
- my_snprintf(buf, sizeof(buf), "--max-thread-mem-used=%llu",
+ my_snprintf(buf, sizeof(buf), "--max-session-mem-used=%llu",
thd->variables.max_mem_used);
if ((buf2= (char*) thd->alloc(256)))
{
my_snprintf(buf2, 256, ER_THD(thd, ER_OPTION_PREVENTS_STATEMENT), buf);
thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, buf2);
}
+ else
+ {
+ thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT,
+ "--max-session-mem-used");
+ }
}
DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0 ||
!debug_assert_on_not_freed_memory);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index db3917607e2..e25f8474c95 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -2234,30 +2234,30 @@ ER_NO_SUCH_THREAD
swe "Finns ingen tråd med id %lu"
ukr "Невідомий ідентифікатор гілки: %lu"
ER_KILL_DENIED_ERROR
- cze "Nejste vlastníkem threadu %lu"
- dan "Du er ikke ejer af tråden %lu"
- nla "U bent geen bezitter van thread %lu"
- eng "You are not owner of thread %lu"
- est "Ei ole lõime %lu omanik"
- fre "Vous n'êtes pas propriétaire de la tâche no: %lu"
- ger "Sie sind nicht Eigentümer von Thread %lu"
- greek "Δεν είσθε owner του thread %lu"
- hindi "आप थ्रेड %lu के OWNER नहीं हैं"
- hun "A %lu thread-nek mas a tulajdonosa"
- ita "Utente non proprietario del thread %lu"
- jpn "スレッド %lu のオーナーではありません。"
- kor "쓰레드(Thread) %lu의 소유자가 아닙니다."
- nor "Du er ikke eier av tråden %lu"
- norwegian-ny "Du er ikkje eigar av tråd %lu"
- pol "Nie jeste? wła?cicielem w?tku %lu"
- por "Você não é proprietário da 'thread' %lu"
- rum "Nu sinteti proprietarul threadului %lu"
- rus "Вы не являетесь владельцем потока %lu"
- serbian "Vi niste vlasnik thread-a %lu"
- slo "Nie ste vlastníkom vlákna %lu"
- spa "No eres el propietario del hilo (thread) %lu"
- swe "Du är inte ägare till tråd %lu"
- ukr "Ви не володар гілки %lu"
+ cze "Nejste vlastníkem threadu %lld"
+ dan "Du er ikke ejer af tråden %lld"
+ nla "U bent geen bezitter van thread %lld"
+ eng "You are not owner of thread %lld"
+ est "Ei ole lõime %lld omanik"
+ fre "Vous n'êtes pas propriétaire de la tâche no: %lld"
+ ger "Sie sind nicht Eigentümer von Thread %lld"
+ greek "Δεν είσθε owner του thread %lld"
+ hindi "आप थ्रेड %lld के OWNER नहीं हैं"
+ hun "A %lld thread-nek mas a tulajdonosa"
+ ita "Utente non proprietario del thread %lld"
+ jpn "スレッド %lld のオーナーではありません。"
+ kor "쓰레드(Thread) %lld의 소유자가 아닙니다."
+ nor "Du er ikke eier av tråden %lld"
+ norwegian-ny "Du er ikkje eigar av tråd %lld"
+ pol "Nie jeste? wła?cicielem w?tku %lld"
+ por "Você não é proprietário da 'thread' %lld"
+ rum "Nu sinteti proprietarul threadului %lld"
+ rus "Вы не являетесь владельцем потока %lld"
+ serbian "Vi niste vlasnik thread-a %lld"
+ slo "Nie ste vlastníkom vlákna %lld"
+ spa "No eres el propietario del hilo (thread) %lld"
+ swe "Du är inte ägare till tråd %lld"
+ ukr "Ви не володар гілки %lld"
ER_NO_TABLES_USED
cze "Nejsou použity žádné tabulky"
dan "Ingen tabeller i brug"
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index c44d385a3a8..1ce59dc9348 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2367,6 +2367,58 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
/*
+ Reinterpret a binary string to a character string
+
+ @param[OUT] to The result will be written here,
+ either the original string as is,
+ or a newly alloced fixed string with
+ some zero bytes prepended.
+ @param cs The destination character set
+ @param str The binary string
+ @param length The length of the binary string
+
+ @return false on success
+ @return true on error
+*/
+
+bool THD::reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *cs,
+ const char *str, size_t length)
+{
+ /*
+ When reinterpreting from binary to tricky character sets like
+ UCS2, UTF16, UTF32, we may need to prepend some zero bytes.
+ This is possible in scenarios like this:
+ SET COLLATION_CONNECTION=utf32_general_ci, CHARACTER_SET_CLIENT=binary;
+ This code is similar to String::copy_aligned().
+ */
+ size_t incomplete= length % cs->mbminlen; // Bytes in an incomplete character
+ if (incomplete)
+ {
+ size_t zeros= cs->mbminlen - incomplete;
+ size_t aligned_length= zeros + length;
+ char *dst= (char*) alloc(aligned_length + 1);
+ if (!dst)
+ {
+ to->str= NULL; // Safety
+ to->length= 0;
+ return true;
+ }
+ bzero(dst, zeros);
+ memcpy(dst + zeros, str, length);
+ dst[aligned_length]= '\0';
+ to->str= dst;
+ to->length= aligned_length;
+ }
+ else
+ {
+ to->str= str;
+ to->length= length;
+ }
+ return check_string_for_wellformedness(to->str, to->length, cs);
+}
+
+
+/*
Convert a string between two character sets.
dstcs and srccs cannot be &my_charset_bin.
*/
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 37b7db4db1a..79e7194be5b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -4154,6 +4154,8 @@ public:
bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
const char *from, size_t from_length,
CHARSET_INFO *from_cs);
+ bool reinterpret_string_from_binary(LEX_CSTRING *to, CHARSET_INFO *to_cs,
+ const char *from, size_t from_length);
bool convert_string(LEX_CSTRING *to, CHARSET_INFO *to_cs,
const char *from, size_t from_length,
CHARSET_INFO *from_cs)
@@ -4170,6 +4172,8 @@ public:
{
if (!simple_copy_is_possible)
return unlikely(convert_string(to, tocs, from->str, from->length, fromcs));
+ if (fromcs == &my_charset_bin)
+ return reinterpret_string_from_binary(to, tocs, from->str, from->length);
*to= *from;
return false;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index b26320fc098..6e2cfc11ee6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -9393,15 +9393,17 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
{
uint error;
ha_rows rows;
- if (likely(!(error= kill_threads_for_user(thd, user, state, &rows))))
- my_ok(thd, rows);
- else
+ switch (error= kill_threads_for_user(thd, user, state, &rows))
{
- /*
- This is probably ER_OUT_OF_RESOURCES, but in the future we may
- want to write the name of the user we tried to kill
- */
- my_error(error, MYF(0), user->host.str, user->user.str);
+ case 0:
+ my_ok(thd, rows);
+ break;
+ case ER_KILL_DENIED_ERROR:
+ my_error(error, MYF(0), (long long) thd->thread_id);
+ break;
+ case ER_OUT_OF_RESOURCES:
+ default:
+ my_error(error, MYF(0));
}
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index cda8411d1c4..0ae7d7557c6 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1896,17 +1896,13 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
const char *table_path)
{
char path[FN_REFLEN + 1];
+ const size_t pathmax = sizeof(path) - 1 - reg_ext_length;
int error= 0;
DBUG_ENTER("quick_rm_table");
size_t path_length= table_path ?
- (strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) :
- build_table_filename(path, sizeof(path)-1, db->str, table_name->str,
- reg_ext, flags);
- if (!(flags & NO_FRM_RENAME))
- if (mysql_file_delete(key_file_frm, path, MYF(0)))
- error= 1; /* purecov: inspected */
- path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
+ (strxnmov(path, pathmax, table_path, NullS) - path) :
+ build_table_filename(path, pathmax, db->str, table_name->str, "", flags);
if ((flags & (NO_HA_TABLE | NO_PAR_TABLE)) == NO_HA_TABLE)
{
handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
@@ -1916,8 +1912,14 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
delete file;
}
if (!(flags & (FRM_ONLY|NO_HA_TABLE)))
- if (ha_delete_table(thd, base, path, db, table_name, 0) > 0)
- error= 1;
+ error|= ha_delete_table(thd, base, path, db, table_name, 0) > 0;
+
+ if (!(flags & NO_FRM_RENAME))
+ {
+ memcpy(path + path_length, reg_ext, reg_ext_length + 1);
+ if (mysql_file_delete(key_file_frm, path, MYF(0)))
+ error= 1; /* purecov: inspected */
+ }
if (likely(error == 0))
{
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 23d27a03e7b..6869cec75d6 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -6690,7 +6690,7 @@ static Sys_var_ulong Sys_log_tc_size(
DEFAULT(my_getpagesize() * 6), BLOCK_SIZE(my_getpagesize()));
#endif
-static Sys_var_ulonglong Sys_max_thread_mem(
+static Sys_var_ulonglong Sys_max_session_mem_used(
"max_session_mem_used", "Amount of memory a single user session "
"is allowed to allocate. This limits the value of the "
"session variable MEM_USED", SESSION_VAR(max_mem_used),
diff --git a/sql/table.cc b/sql/table.cc
index f043af785d8..872ebf7c86a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1553,21 +1553,6 @@ bool TABLE_SHARE::init_period_from_extra2(period_info_t *period,
}
-static size_t extra2_read_len(const uchar **extra2, const uchar *extra2_end)
-{
- size_t length= *(*extra2)++;
- if (length)
- return length;
-
- if ((*extra2) + 2 >= extra2_end)
- return 0;
- length= uint2korr(*extra2);
- (*extra2)+= 2;
- if (length < 256 || *extra2 + length > extra2_end)
- return 0;
- return length;
-}
-
static
bool read_extra2_section_once(const uchar *extra2, size_t len, LEX_CUSTRING *section)
{
@@ -1867,7 +1852,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (frm_image[61] && !share->default_part_plugin)
{
enum legacy_db_type db_type= (enum legacy_db_type) (uint) frm_image[61];
- share->default_part_plugin= ha_lock_engine(NULL, ha_checktype(thd, db_type));
+ share->default_part_plugin= ha_lock_engine(NULL, ha_checktype(thd, db_type, 1));
if (!share->default_part_plugin)
goto err;
}
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 981958abdb2..f3264a4c809 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -697,9 +697,7 @@ bool THD::rm_temporary_table(handlerton *base, const char *path)
char frm_path[FN_REFLEN + 1];
strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS);
- if (mysql_file_delete(key_file_frm, frm_path,
- MYF(MY_WME | MY_IGNORE_ENOENT)))
- error= true;
+
if (base->drop_table(base, path) > 0)
{
error= true;
@@ -707,6 +705,10 @@ bool THD::rm_temporary_table(handlerton *base, const char *path)
path, my_errno);
}
+ if (mysql_file_delete(key_file_frm, frm_path,
+ MYF(MY_WME | MY_IGNORE_ENOENT)))
+ error= true;
+
DBUG_RETURN(error);
}
diff --git a/sql/unireg.h b/sql/unireg.h
index 0edb0a50ebd..01c1a5a284e 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -192,6 +192,22 @@ enum extra2_index_flags {
EXTRA2_IGNORED_KEY
};
+
+static inline size_t extra2_read_len(const uchar **extra2, const uchar *end)
+{
+ size_t length= *(*extra2)++;
+ if (length)
+ return length;
+
+ if ((*extra2) + 2 >= end)
+ return 0;
+ length= uint2korr(*extra2);
+ (*extra2)+= 2;
+ if (length < 256 || *extra2 + length > end)
+ return 0;
+ return length;
+}
+
LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
HA_CREATE_INFO *create_info,
List<Create_field> &create_fields,
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index f84f0b8e938..3e8ba6e3cda 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
- Copyright (c) 2009, 2021, MariaDB Corporation Ab
+ Copyright (c) 2009, 2022, MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -272,7 +272,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags,
char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN],
data_name[FN_REFLEN];
uchar *UNINIT_VAR(disk_cache), *disk_pos, *end_pos;
- MARIA_HA info, *UNINIT_VAR(m_info), *old_info;
+ MARIA_HA info, *UNINIT_VAR(m_info), *old_info= NULL;
MARIA_SHARE share_buff,*share;
double *rec_per_key_part;
ulong *nulls_per_key_part;
@@ -323,7 +323,6 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags,
}
#endif /* WITH_S3_STORAGE_ENGINE */
- old_info= 0;
if (!internal_table)
mysql_mutex_lock(&THR_LOCK_maria);
if ((open_flags & HA_OPEN_COPY) ||