1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.3 to 10.4

extra2_read_len resolved by keeping the implementation
in sql/table.cc by exposed it for use by ha_partition.cc

Remove identical implementation in unireg.h
(ref: bfed2c7d57)
This commit is contained in:
Daniel Black
2022-03-16 13:25:56 +11:00
27 changed files with 364 additions and 198 deletions

125
debian/autobake-deb.sh vendored
View File

@@ -6,35 +6,10 @@
# Exit immediately on any error # Exit immediately on any error
set -e set -e
# This file is invocated from Buildbot and Travis-CI to build deb packages. # On Buildbot, don't run the mysql-test-run test suite as part of build.
# As both of those CI systems have many parallel jobs that include different # It takes a lot of time, and we will do a better test anyway in
# parts of the test suite, we don't need to run the mysql-test-run at all when # Buildbot, running the test suite from installed .debs on a clean VM.
# building the deb packages here. export DEB_BUILD_OPTIONS="nocheck"
export DEB_BUILD_OPTIONS="nocheck $DEB_BUILD_OPTIONS"
# Travis-CI optimizations
if [[ $TRAVIS ]]
then
# On Travis-CI, the log must stay under 4MB so make the build less verbose
sed -i -e '/Add support for verbose builds/,/^$/d' debian/rules
# Don't include test suite package on Travis-CI to make the build time shorter
sed '/Package: mariadb-test-data/,/^$/d' -i debian/control
sed '/Package: mariadb-test$/,/^$/d' -i debian/control
# Don't build the test package at all to save time and disk space
sed 's|DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test|DINSTALL_MYSQLTESTDIR=false|' -i debian/rules
# Also skip building RocksDB and TokuDB to save even more time and disk space
sed 's|-DDEB|-DPLUGIN_TOKUDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -DPLUGIN_SPHINX=NO -WITH_EMBEDDED_SERVER=OFF -DDEB|' -i debian/rules
fi
# Convert gcc version to numberical value. Format is Mmmpp where M is Major
# version, mm is minor version and p is patch.
# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7)
GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \
-e 's/\.\([0-9]\)/0\1/g' \
-e 's/^[0-9]\{3,4\}$/&00/')
# Look up distro-version specific stuff # Look up distro-version specific stuff
# #
@@ -50,49 +25,8 @@ case "${CODENAME}" in
;; ;;
esac esac
# If libcrack2 (>= 2.9.0) is not available (before Debian Jessie and Ubuntu Trusty) # Don't build rocksdb package on x86 32 bit.
# clean away the cracklib stanzas so the package can build without them. if [[ $(arch) =~ i[346]86 ]]
if ! apt-cache madison libcrack2-dev | grep 'libcrack2-dev *| *2\.9' >/dev/null 2>&1
then
sed '/libcrack2-dev/d' -i debian/control
sed '/Package: mariadb-plugin-cracklib/,/^$/d' -i debian/control
fi
# If libpcre3-dev (>= 2:8.35-3.2~) is not available (before Debian Jessie or Ubuntu Wily)
# clean away the PCRE3 stanzas so the package can build without them.
# Update check when version 2:8.40 or newer is available.
if ! apt-cache madison libpcre3-dev | grep 'libpcre3-dev *| *2:8\.3[2-9]' >/dev/null 2>&1
then
sed '/libpcre3-dev/d' -i debian/control
fi
# If libsystemd-dev is not available (before Debian Jessie or Ubuntu Wily)
# clean away the systemd stanzas so the package can build without them.
if ! apt-cache madison libsystemd-dev | grep 'libsystemd-dev' >/dev/null 2>&1
then
sed '/dh-systemd/d' -i debian/control
sed '/libsystemd-dev/d' -i debian/control
sed 's/ --with systemd//' -i debian/rules
sed '/systemd/d' -i debian/rules
sed '/\.service/d' -i debian/rules
sed '/galera_new_cluster/d' -i debian/mariadb-server-10.4.install
sed '/galera_recovery/d' -i debian/mariadb-server-10.4.install
sed '/mariadb-service-convert/d' -i debian/mariadb-server-10.4.install
fi
# The binaries should be fully hardened by default. However TokuDB compilation seems to fail on
# Debian Jessie and older and on Ubuntu Xenial and older with the following error message:
# /usr/bin/ld.bfd.real: /tmp/ccOIwjFo.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol
# `toku_product_name_strings' can not be used when making a shared object; recompile with -fPIC
# Therefore we need to disable PIE on those releases using gcc as proxy for detection.
if [[ $GCCVERSION -lt 60000 ]]
then
sed 's/hardening=+all$/hardening=+all,-pie/' -i debian/rules
fi
# Don't build rocksdb package if gcc version is less than 4.8 or we are running on
# x86 32 bit.
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
then then
sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
fi fi
@@ -112,26 +46,6 @@ then
sed '/Package: mariadb-plugin-cassandra/,/^$/d' -i debian/control sed '/Package: mariadb-plugin-cassandra/,/^$/d' -i debian/control
fi fi
# From Debian Stretch/Ubuntu Bionic onwards dh-systemd is just an empty
# transitional metapackage and the functionality was merged into debhelper.
# In Ubuntu Hirsute is was completely removed, so it can't be referenced anymore.
# Keep using it only on Debian Jessie and Ubuntu Xenial.
if apt-cache madison dh-systemd | grep 'dh-systemd' >/dev/null 2>&1
then
sed 's/debhelper (>= 9.20160709~),/debhelper (>= 9), dh-systemd,/' -i debian/control
fi
# Mroonga, TokuDB never built on Travis CI anyway, see build flags above
if [[ $TRAVIS ]]
then
sed -i -e "/Package: mariadb-plugin-tokudb/,/^$/d" debian/control
sed -i -e "/Package: mariadb-plugin-mroonga/,/^$/d" debian/control
sed -i -e "/Package: mariadb-plugin-spider/,/^$/d" debian/control
sed -i -e "/Package: mariadb-plugin-oqgraph/,/^$/d" debian/control
sed -i -e "/usr\/lib\/mysql\/plugin\/ha_sphinx.so/d" debian/mariadb-server-10.4.install
sed -i -e "/Package: libmariadbd-dev/,/^$/d" debian/control
fi
# Adjust changelog, add new version # Adjust changelog, add new version
echo "Incrementing changelog and starting build scripts" echo "Incrementing changelog and starting build scripts"
@@ -146,13 +60,6 @@ dch -b -D ${CODENAME} -v "${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME}" "Automat
echo "Creating package version ${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... " echo "Creating package version ${EPOCH}${UPSTREAM}${PATCHLEVEL}~${CODENAME} ... "
# On Travis CI, use -b to build binary only packages as there is no need to
# waste time on generating the source package.
if [[ $TRAVIS ]]
then
BUILDPACKAGE_FLAGS="-b"
fi
# Build the package # Build the package
# Pass -I so that .git and other unnecessary temporary and source control files # Pass -I so that .git and other unnecessary temporary and source control files
# will be ignored by dpkg-source when creating the tar.gz source package. # will be ignored by dpkg-source when creating the tar.gz source package.
@@ -161,17 +68,13 @@ fakeroot dpkg-buildpackage -us -uc -I $BUILDPACKAGE_FLAGS -j$(nproc)
# If the step above fails due to missing dependencies, you can manually run # If the step above fails due to missing dependencies, you can manually run
# sudo mk-build-deps debian/control -r -i # sudo mk-build-deps debian/control -r -i
# Don't log package contents on Travis-CI to save time and log size echo "List package contents ..."
if [[ ! $TRAVIS ]] cd ..
then for package in `ls *.deb`
echo "List package contents ..." do
cd .. echo $package | cut -d '_' -f 1
for package in `ls *.deb` dpkg-deb -c $package | awk '{print $1 " " $2 " " $6}' | sort -k 3
do echo "------------------------------------------------"
echo $package | cut -d '_' -f 1 done
dpkg-deb -c $package | awk '{print $1 " " $2 " " $6}' | sort -k 3
echo "------------------------------------------------"
done
fi
echo "Build complete" echo "Build complete"

5
debian/control vendored
View File

@@ -5,10 +5,9 @@ Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
Build-Depends: bison, Build-Depends: bison,
chrpath, chrpath,
cmake (>= 2.7), cmake (>= 2.7),
debhelper (>= 9.20160709~), debhelper (>= 10),
dh-apparmor, dh-apparmor,
dh-exec, dh-exec,
dh-systemd,
gdb, gdb,
libaio-dev [linux-any], libaio-dev [linux-any],
libboost-dev, libboost-dev,
@@ -436,7 +435,7 @@ Pre-Depends: adduser (>= 3.40),
mariadb-common (>= ${source:Version}) mariadb-common (>= ${source:Version})
Depends: galera-4 (>=26.4), Depends: galera-4 (>=26.4),
gawk, gawk,
iproute | iproute2, iproute2,
libdbi-perl, libdbi-perl,
lsb-base (>= 3.0-10), lsb-base (>= 3.0-10),
lsof, lsof,

View File

@@ -2890,5 +2890,28 @@ HEX(c1)
0000006100000063 0000006100000063
DROP TABLE t1; 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 # End of 10.2 tests
# #

View File

@@ -1048,6 +1048,25 @@ INSERT INTO t1 (c1) VALUES (1),(2),(3);
SELECT HEX(c1) FROM t1 ORDER BY c1; SELECT HEX(c1) FROM t1 ORDER BY c1;
DROP TABLE t1; 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 #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

@@ -7941,6 +7941,21 @@ EXECUTE s;
DEALLOCATE PREPARE s; DEALLOCATE PREPARE s;
SET NAMES utf8; 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 # End of 10.2 tests
# #
# #

View File

@@ -290,6 +290,19 @@ EXECUTE s;
DEALLOCATE PREPARE s; DEALLOCATE PREPARE s;
SET NAMES utf8; 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 #
--echo # End of 10.2 tests --echo # End of 10.2 tests

View File

@@ -3,34 +3,50 @@ SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive'; install soname 'ha_archive';
create table t1 (a int) engine=archive; create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3); insert t1 values (1),(2),(3);
create table t2 (a int) engine=archive partition by hash(a) partitions 3;
flush tables; flush tables;
uninstall soname 'ha_archive'; uninstall soname 'ha_archive';
select table_schema, table_name from information_schema.tables where table_name like 't1'; select table_schema, table_name from information_schema.tables where table_name like 't_' order by 1,2;
table_schema test table_schema table_name
table_name t1 test t1
select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1'; test t2
table_schema test select table_schema, table_name, engine, version from information_schema.tables where table_name like 't_' order by 1,2;
table_name t1 table_schema table_name engine version
engine ARCHIVE test t1 ARCHIVE NULL
version NULL test t2 NULL NULL
Warnings: Warnings:
Level Warning Warning 1033 Incorrect information in file: './test/t2.frm'
Code 1286 Warning 1286 Unknown storage engine 'ARCHIVE'
Message 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;
select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1'; table_schema table_name engine row_format
table_schema test test t1 ARCHIVE NULL
table_name t1 test t2 NULL NULL
engine ARCHIVE
row_format NULL
Warnings: Warnings:
Level Warning Warning 1033 Incorrect information in file: './test/t2.frm'
Code 1286 Warning 1286 Unknown storage engine 'ARCHIVE'
Message Unknown storage engine 'ARCHIVE'
install soname 'ha_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 db.opt
t1.ARZ t1.ARZ
t1.frm t1.frm
t2#P#p0.ARZ
t2#P#p1.ARZ
t2#P#p2.ARZ
t2.frm
t2.par
drop table t1; drop table t1;
drop table t2;
db.opt db.opt
uninstall soname 'ha_archive'; uninstall soname 'ha_archive';
SET debug_dbug=@saved_dbug; SET debug_dbug=@saved_dbug;

View File

@@ -1,4 +1,4 @@
--source include/have_partition.inc
--source include/have_debug.inc --source include/have_debug.inc
if (!$HA_ARCHIVE_SO) { if (!$HA_ARCHIVE_SO) {
@@ -13,18 +13,25 @@ SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive'; install soname 'ha_archive';
create table t1 (a int) engine=archive; create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3); insert t1 values (1),(2),(3);
create table t2 (a int) engine=archive partition by hash(a) partitions 3;
flush tables; flush tables;
uninstall soname 'ha_archive'; uninstall soname 'ha_archive';
--vertical_results select table_schema, table_name from information_schema.tables where table_name like 't_' order by 1,2;
select table_schema, table_name from information_schema.tables where table_name like 't1'; --replace_result $mysqld_datadir ./
select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1'; select table_schema, table_name, engine, version from information_schema.tables where table_name like 't_' order by 1,2;
select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1'; --replace_result $mysqld_datadir ./
--horizontal_results 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'; install soname 'ha_archive';
show create table t1;
show create table t2;
--list_files $mysqld_datadir/test --list_files $mysqld_datadir/test
drop table t1; drop table t1;
drop table t2;
--list_files $mysqld_datadir/test --list_files $mysqld_datadir/test
uninstall soname 'ha_archive'; uninstall soname 'ha_archive';

View File

@@ -128,3 +128,13 @@ SELECT f1(1);
Got one of the listed errors Got one of the listed errors
DROP FUNCTION f1; DROP FUNCTION f1;
SET debug_dbug= @saved_dbug; 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
#

View File

@@ -158,3 +158,16 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
SELECT f1(1); SELECT f1(1);
DROP FUNCTION f1; DROP FUNCTION f1;
SET debug_dbug= @saved_dbug; 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 #

View File

@@ -9,7 +9,7 @@ SHOW TABLES;
Tables_in_test Tables_in_test
t1 t1
SHOW CREATE TABLE 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; DROP TABLE t1;
ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition
t1.frm t1.frm

View File

@@ -17,7 +17,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
--copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par --copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par
SHOW TABLES; SHOW TABLES;
--replace_result $MYSQLD_DATADIR ./ --replace_result $MYSQLD_DATADIR ./
--error ER_FAILED_READ_FROM_PAR_FILE --error ER_NOT_FORM_FILE
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
# The replace is needed for Solaris # The replace is needed for Solaris

View File

@@ -5,9 +5,13 @@ SELECT @@wsrep_slave_threads;
@@wsrep_slave_threads @@wsrep_slave_threads
1 1
SET GLOBAL wsrep_slave_threads=2; SET GLOBAL wsrep_slave_threads=2;
KILL ID;
Got one of the listed errors Got one of the listed errors
KILL QUERY ID;
Got one of the listed errors Got one of the listed errors
KILL ID;
Got one of the listed errors Got one of the listed errors
KILL QUERY ID;
Got one of the listed errors Got one of the listed errors
SET GLOBAL wsrep_slave_threads=DEFAULT; SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1; connection node_1;

View File

@@ -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` --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 --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL $applier_thread --eval KILL $applier_thread
--replace_result $applier_thread ID
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL QUERY $applier_thread --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` --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 --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL $aborter_thread --eval KILL $aborter_thread
--replace_result $aborter_thread ID
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
--eval KILL QUERY $aborter_thread --eval KILL QUERY $aborter_thread
--enable_query_log
SET GLOBAL wsrep_slave_threads=DEFAULT; SET GLOBAL wsrep_slave_threads=DEFAULT;

View File

@@ -12,6 +12,9 @@
# Change Date: # # Change Date: #
# Change: # # Change: #
################################################################################ ################################################################################
--source include/have_des.inc
set time_zone="+03:00"; set time_zone="+03:00";
--echo # --echo #
--echo # NUMERIC FUNCTIONS --echo # NUMERIC FUNCTIONS

View File

@@ -3061,11 +3061,12 @@ err1:
@retval true Failure @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; uint i;
uchar *buff; uchar *buff;
handlerton **engine_array, *first_engine; handlerton **engine_array;
enum legacy_db_type db_type, first_db_type; enum legacy_db_type db_type, first_db_type;
DBUG_ASSERT(!m_file); DBUG_ASSERT(!m_file);
@@ -3075,11 +3076,8 @@ bool ha_partition::setup_engine_array(MEM_ROOT *mem_root)
DBUG_RETURN(true); DBUG_RETURN(true);
buff= (uchar *) (m_file_buffer + PAR_ENGINES_OFFSET); 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*) if (!(m_engine_array= (plugin_ref*)
alloc_root(&m_mem_root, m_tot_parts * sizeof(plugin_ref)))) alloc_root(&m_mem_root, m_tot_parts * sizeof(plugin_ref))))
goto err; goto err;
@@ -3120,6 +3118,74 @@ 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(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 Get info about partition engines and their names from the .par file
@@ -3147,7 +3213,11 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root,
if (read_par_file(name)) if (read_par_file(name))
DBUG_RETURN(true); 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(true);
DBUG_RETURN(false); DBUG_RETURN(false);

View File

@@ -582,8 +582,9 @@ private:
And one method to read it in. And one method to read it in.
*/ */
bool create_handler_file(const char *name); 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); 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 get_from_handler_file(const char *name, MEM_ROOT *mem_root,
bool is_clone); bool is_clone);
bool new_handlers_from_part_info(MEM_ROOT *mem_root); bool new_handlers_from_part_info(MEM_ROOT *mem_root);

View File

@@ -3753,13 +3753,18 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
/* Ensure we don't get called here again */ /* Ensure we don't get called here again */
char buf[50], *buf2; char buf[50], *buf2;
thd->set_killed(KILL_QUERY); 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); thd->variables.max_mem_used);
if ((buf2= (char*) thd->alloc(256))) if ((buf2= (char*) thd->alloc(256)))
{ {
my_snprintf(buf2, 256, ER_THD(thd, ER_OPTION_PREVENTS_STATEMENT), buf); my_snprintf(buf2, 256, ER_THD(thd, ER_OPTION_PREVENTS_STATEMENT), buf);
thd->set_killed(KILL_QUERY, ER_OPTION_PREVENTS_STATEMENT, buf2); 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 || DBUG_ASSERT((longlong) thd->status_var.local_memory_used >= 0 ||
!debug_assert_on_not_freed_memory); !debug_assert_on_not_freed_memory);

View File

@@ -2231,30 +2231,30 @@ ER_NO_SUCH_THREAD
swe "Finns ingen tråd med id %lu" swe "Finns ingen tråd med id %lu"
ukr "Невідомий ідентифікатор гілки: %lu" ukr "Невідомий ідентифікатор гілки: %lu"
ER_KILL_DENIED_ERROR ER_KILL_DENIED_ERROR
cze "Nejste vlastníkem threadu %lu" cze "Nejste vlastníkem threadu %lld"
dan "Du er ikke ejer af tråden %lu" dan "Du er ikke ejer af tråden %lld"
nla "U bent geen bezitter van thread %lu" nla "U bent geen bezitter van thread %lld"
eng "You are not owner of thread %lu" eng "You are not owner of thread %lld"
est "Ei ole lõime %lu omanik" est "Ei ole lõime %lld omanik"
fre "Vous n'êtes pas propriétaire de la tâche no: %lu" fre "Vous n'êtes pas propriétaire de la tâche no: %lld"
ger "Sie sind nicht Eigentümer von Thread %lu" ger "Sie sind nicht Eigentümer von Thread %lld"
greek "Δεν είσθε owner του thread %lu" greek "Δεν είσθε owner του thread %lld"
hindi "आप थ्रेड %lu के OWNER नहीं हैं" hindi "आप थ्रेड %lld के OWNER नहीं हैं"
hun "A %lu thread-nek mas a tulajdonosa" hun "A %lld thread-nek mas a tulajdonosa"
ita "Utente non proprietario del thread %lu" ita "Utente non proprietario del thread %lld"
jpn "スレッド %lu のオーナーではありません。" jpn "スレッド %lld のオーナーではありません。"
kor "쓰레드(Thread) %lu의 소유자가 아닙니다." kor "쓰레드(Thread) %lld의 소유자가 아닙니다."
nor "Du er ikke eier av tråden %lu" nor "Du er ikke eier av tråden %lld"
norwegian-ny "Du er ikkje eigar av tråd %lu" norwegian-ny "Du er ikkje eigar av tråd %lld"
pol "Nie jeste? wła?cicielem w?tku %lu" pol "Nie jeste? wła?cicielem w?tku %lld"
por "Você não é proprietário da 'thread' %lu" por "Você não é proprietário da 'thread' %lld"
rum "Nu sinteti proprietarul threadului %lu" rum "Nu sinteti proprietarul threadului %lld"
rus "Вы не являетесь владельцем потока %lu" rus "Вы не являетесь владельцем потока %lld"
serbian "Vi niste vlasnik thread-a %lu" serbian "Vi niste vlasnik thread-a %lld"
slo "Nie ste vlastníkom vlákna %lu" slo "Nie ste vlastníkom vlákna %lld"
spa "Tu no eres el propietario del thread%lu" spa "Tu no eres el propietario del thread%lld"
swe "Du är inte ägare till tråd %lu" swe "Du är inte ägare till tråd %lld"
ukr "Ви не володар гілки %lu" ukr "Ви не володар гілки %lld"
ER_NO_TABLES_USED ER_NO_TABLES_USED
cze "Nejsou použity žádné tabulky" cze "Nejsou použity žádné tabulky"
dan "Ingen tabeller i brug" dan "Ingen tabeller i brug"

View File

@@ -2356,6 +2356,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. Convert a string between two character sets.
dstcs and srccs cannot be &my_charset_bin. dstcs and srccs cannot be &my_charset_bin.

View File

@@ -3740,6 +3740,8 @@ public:
bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
const char *from, size_t from_length, const char *from, size_t from_length,
CHARSET_INFO *from_cs); 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, bool convert_string(LEX_CSTRING *to, CHARSET_INFO *to_cs,
const char *from, size_t from_length, const char *from, size_t from_length,
CHARSET_INFO *from_cs) CHARSET_INFO *from_cs)
@@ -3756,6 +3758,8 @@ public:
{ {
if (!simple_copy_is_possible) if (!simple_copy_is_possible)
return unlikely(convert_string(to, tocs, from->str, from->length, fromcs)); 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; *to= *from;
return false; return false;
} }

View File

@@ -9382,15 +9382,17 @@ void sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
if (likely(!(error= kill_threads_for_user(thd, user, state, &rows)))) switch (error= kill_threads_for_user(thd, user, state, &rows))
my_ok(thd, rows);
else
{ {
/* case 0:
This is probably ER_OUT_OF_RESOURCES, but in the future we may my_ok(thd, rows);
want to write the name of the user we tried to kill break;
*/ case ER_KILL_DENIED_ERROR:
my_error(error, MYF(0), user->host.str, user->user.str); my_error(error, MYF(0), (long long) thd->thread_id);
break;
case ER_OUT_OF_RESOURCES:
default:
my_error(error, MYF(0));
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
return; return;

View File

@@ -2779,15 +2779,13 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
const LEX_CSTRING *table_name, uint flags, const char *table_path) const LEX_CSTRING *table_name, uint flags, const char *table_path)
{ {
char path[FN_REFLEN + 1]; char path[FN_REFLEN + 1];
const size_t pathmax = sizeof(path) - 1 - reg_ext_length;
int error= 0; int error= 0;
DBUG_ENTER("quick_rm_table"); DBUG_ENTER("quick_rm_table");
size_t path_length= table_path ? size_t path_length= table_path ?
(strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) : (strxnmov(path, pathmax, table_path, NullS) - path) :
build_table_filename(path, sizeof(path)-1, db->str, table_name->str, reg_ext, flags); build_table_filename(path, pathmax, db->str, table_name->str, "", flags);
if (mysql_file_delete(key_file_frm, path, MYF(0)))
error= 1; /* purecov: inspected */
path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
if (flags & NO_HA_TABLE) if (flags & NO_HA_TABLE)
{ {
handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base); handler *file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base);
@@ -2799,6 +2797,10 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
if (!(flags & (FRM_ONLY|NO_HA_TABLE))) if (!(flags & (FRM_ONLY|NO_HA_TABLE)))
error|= ha_delete_table(current_thd, base, path, db, table_name, 0); error|= ha_delete_table(current_thd, base, path, db, table_name, 0);
memcpy(path + path_length, reg_ext, reg_ext_length + 1);
if (mysql_file_delete(key_file_frm, path, MYF(0)))
error= 1;
if (likely(error == 0)) if (likely(error == 0))
{ {
PSI_CALL_drop_table_share(flags & FN_IS_TMP, db->str, (uint)db->length, PSI_CALL_drop_table_share(flags & FN_IS_TMP, db->str, (uint)db->length,

View File

@@ -6313,7 +6313,7 @@ static Sys_var_ulong Sys_log_tc_size(
BLOCK_SIZE(my_getpagesize())); BLOCK_SIZE(my_getpagesize()));
#endif #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 " "max_session_mem_used", "Amount of memory a single user session "
"is allowed to allocate. This limits the value of the " "is allowed to allocate. This limits the value of the "
"session variable MEM_USED", SESSION_VAR(max_mem_used), "session variable MEM_USED", SESSION_VAR(max_mem_used),

View File

@@ -1477,7 +1477,7 @@ 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 extra2_read_len(const uchar **extra2, const uchar *extra2_end)
{ {
size_t length= *(*extra2)++; size_t length= *(*extra2)++;
if (length) if (length)
@@ -1690,7 +1690,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (frm_image[61] && !share->default_part_plugin) if (frm_image[61] && !share->default_part_plugin)
{ {
enum legacy_db_type db_type= (enum legacy_db_type) (uint) frm_image[61]; 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) if (!share->default_part_plugin)
goto err; goto err;
} }

View File

@@ -693,19 +693,20 @@ bool THD::rm_temporary_table(handlerton *base, const char *path)
char frm_path[FN_REFLEN + 1]; char frm_path[FN_REFLEN + 1];
strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS); strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS);
if (mysql_file_delete(key_file_frm, frm_path, MYF(0)))
{ file= get_new_handler((TABLE_SHARE*) 0, mem_root, base);
error= true;
}
file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base);
if (file && file->ha_delete_table(path)) if (file && file->ha_delete_table(path))
{ {
error= true; error= true;
sql_print_warning("Could not remove temporary table: '%s', error: %d", sql_print_warning("Could not remove temporary table: '%s', error: %d",
path, my_errno); path, my_errno);
} }
delete file; delete file;
if (mysql_file_delete(key_file_frm, frm_path, MYF(0)))
{
error= true;
}
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View File

@@ -184,6 +184,8 @@ enum extra2_field_flags {
VERS_OPTIMIZED_UPDATE= 1 << INVISIBLE_MAX_BITS, VERS_OPTIMIZED_UPDATE= 1 << INVISIBLE_MAX_BITS,
}; };
size_t extra2_read_len(const uchar **extra2, const uchar *end);
LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table, LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
List<Create_field> &create_fields, List<Create_field> &create_fields,