diff --git a/configure.cmake b/configure.cmake index 93b87f3a5dd3e..e4aee5448b4eb 100644 --- a/configure.cmake +++ b/configure.cmake @@ -590,6 +590,8 @@ CHECK_C_SOURCE_COMPILES(" #include #include #include +/* macOS declares select() here and nowhere else that this test includes */ +#include #endif int main() { diff --git a/mysql-test/include/have_sparse_files.inc b/mysql-test/include/have_sparse_files.inc new file mode 100644 index 0000000000000..a6233c8ccf701 --- /dev/null +++ b/mysql-test/include/have_sparse_files.inc @@ -0,0 +1,39 @@ +# Skip the test unless the vardir filesystem stores files with holes. +# +# A test that builds a large file by seeking past its end and writing a +# single byte relies on the skipped range staying unallocated. HFS on +# macOS allocates every block of that range, so the file consumes its full +# apparent size and the write fails with ENOSPC once the range exceeds the +# free space on the volume. +# +# The probe writes one byte 64MB past the start of an empty file and compares +# the allocated block count against that offset. A filesystem that leaves a +# hole allocates only the block holding the byte. The offset has to stay well +# above 16MB, since APFS fills the range of a file smaller than that rather +# than recording a hole. + +--error 0,1 +perl; +use strict; +use warnings; + +my $probe= "$ENV{MYSQLTEST_VARDIR}/tmp/sparse_probe"; +my $offset= 64 * 1024 * 1024; +my $sparse= 0; + +if (open(my $fh, '>', $probe)) +{ + binmode $fh; + if (seek($fh, $offset, 0) and print($fh chr(0)) and close($fh)) + { + my $blocks= (stat $probe)[12]; + $sparse= 1 if defined($blocks) and $blocks * 512 < $offset; + } +} +unlink $probe; +exit($sparse ? 0 : 1); +EOF +if ($errno) +{ + --skip Requires a vardir filesystem that stores files with holes +} diff --git a/mysql-test/include/not_mac.inc b/mysql-test/include/not_mac.inc new file mode 100644 index 0000000000000..3c4f2fbb03758 --- /dev/null +++ b/mysql-test/include/not_mac.inc @@ -0,0 +1,4 @@ +# +# suite.pm will make sure that all tests including this file +# will be skipped if run under macOS +# diff --git a/mysql-test/main/lowercase_routines.opt b/mysql-test/main/lowercase_routines.opt new file mode 100644 index 0000000000000..ac4d3211e8914 --- /dev/null +++ b/mysql-test/main/lowercase_routines.opt @@ -0,0 +1 @@ +--lower-case-table-names=2 diff --git a/mysql-test/main/lowercase_routines.result b/mysql-test/main/lowercase_routines.result new file mode 100644 index 0000000000000..761b98613d7a6 --- /dev/null +++ b/mysql-test/main/lowercase_routines.result @@ -0,0 +1,46 @@ +# +# MDEV-33616 Routines of a mixed case database are not listed when +# lower_case_table_names is 2 +# +CREATE DATABASE Db1; +USE Db1; +CREATE FUNCTION f1(a INT) RETURNS INT RETURN a; +CREATE PROCEDURE p1(b INT) BEGIN END; +SELECT SCHEMA_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME='Db1'; +SCHEMA_NAME +Db1 +SELECT db, name FROM mysql.proc WHERE name IN ('f1','p1'); +db name +db1 f1 +db1 p1 +SELECT ROUTINE_NAME FROM information_schema.ROUTINES +WHERE ROUTINE_SCHEMA='Db1'; +ROUTINE_NAME +f1 +p1 +SELECT SPECIFIC_NAME, ORDINAL_POSITION, PARAMETER_NAME +FROM information_schema.PARAMETERS WHERE SPECIFIC_SCHEMA='Db1'; +SPECIFIC_NAME ORDINAL_POSITION PARAMETER_NAME +f1 0 NULL +f1 1 a +p1 1 b +SHOW FUNCTION STATUS WHERE Db='Db1'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +db1 f1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +SHOW PROCEDURE STATUS WHERE Db='Db1'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +db1 p1 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +SELECT ROUTINE_NAME FROM information_schema.ROUTINES +WHERE ROUTINE_SCHEMA='Db1' ORDER BY ROUTINE_NAME; +ROUTINE_NAME +f1 +p1 +SELECT SPECIFIC_NAME, ORDINAL_POSITION, PARAMETER_NAME +FROM information_schema.PARAMETERS WHERE SPECIFIC_SCHEMA='Db1' + ORDER BY SPECIFIC_NAME, ORDINAL_POSITION; +SPECIFIC_NAME ORDINAL_POSITION PARAMETER_NAME +f1 0 NULL +f1 1 a +p1 1 b +USE test; +DROP DATABASE Db1; diff --git a/mysql-test/main/lowercase_routines.test b/mysql-test/main/lowercase_routines.test new file mode 100644 index 0000000000000..4489d530ba732 --- /dev/null +++ b/mysql-test/main/lowercase_routines.test @@ -0,0 +1,47 @@ +# +# Tests that require lower_case_table_names to be 2 +# (the default when the data directory is on a case insensitive file system) +# +--source include/have_lowercase2.inc + +--echo # +--echo # MDEV-33616 Routines of a mixed case database are not listed when +--echo # lower_case_table_names is 2 +--echo # + +CREATE DATABASE Db1; +USE Db1; +CREATE FUNCTION f1(a INT) RETURNS INT RETURN a; +CREATE PROCEDURE p1(b INT) BEGIN END; + +# The database keeps the case it was created with, mysql.proc does not. +SELECT SCHEMA_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME='Db1'; +--sorted_result +SELECT db, name FROM mysql.proc WHERE name IN ('f1','p1'); + +# The name from the WHERE clause becomes the key of an index read on +# mysql.proc. mysql.proc.db is utf8mb3_bin and holds the folded name, so +# an unfolded key finds nothing. +--sorted_result +SELECT ROUTINE_NAME FROM information_schema.ROUTINES + WHERE ROUTINE_SCHEMA='Db1'; +--sorted_result +SELECT SPECIFIC_NAME, ORDINAL_POSITION, PARAMETER_NAME + FROM information_schema.PARAMETERS WHERE SPECIFIC_SCHEMA='Db1'; +--replace_column 5 # 6 # +SHOW FUNCTION STATUS WHERE Db='Db1'; +--replace_column 5 # 6 # +SHOW PROCEDURE STATUS WHERE Db='Db1'; + +# ORDER BY keeps the condition from reaching the routine that fills the +# table, so mysql.proc is read in full and the WHERE is applied afterwards +# over a utf8mb3_general_ci column. That shape returned the rows even +# while the queries above returned none. +SELECT ROUTINE_NAME FROM information_schema.ROUTINES + WHERE ROUTINE_SCHEMA='Db1' ORDER BY ROUTINE_NAME; +SELECT SPECIFIC_NAME, ORDINAL_POSITION, PARAMETER_NAME + FROM information_schema.PARAMETERS WHERE SPECIFIC_SCHEMA='Db1' + ORDER BY SPECIFIC_NAME, ORDINAL_POSITION; + +USE test; +DROP DATABASE Db1; diff --git a/mysql-test/main/lowercase_routines0.result b/mysql-test/main/lowercase_routines0.result new file mode 100644 index 0000000000000..cafb7b25d3ee1 --- /dev/null +++ b/mysql-test/main/lowercase_routines0.result @@ -0,0 +1,46 @@ +# +# MDEV-33616 A statement cannot reference two routines whose databases +# differ only in case +# +CREATE DATABASE Db1; +CREATE DATABASE db1; +CREATE FUNCTION Db1.f1() RETURNS INT RETURN 1; +CREATE FUNCTION db1.f1() RETURNS INT RETURN 2; +CREATE PROCEDURE test.p1() SELECT Db1.f1(), db1.f1(); +SELECT Db1.f1(); +Db1.f1() +1 +SELECT db1.f1(); +db1.f1() +2 +connect con1,localhost,root,,test; +SELECT Db1.f1(), db1.f1(); +Db1.f1() db1.f1() +1 2 +disconnect con1; +connect con2,localhost,root,,test; +SELECT db1.f1(), Db1.f1(); +db1.f1() Db1.f1() +2 1 +disconnect con2; +connect con3,localhost,root,,test; +CALL test.p1(); +Db1.f1() db1.f1() +1 2 +disconnect con3; +connect con4,localhost,root,,test; +SELECT db1.f1(); +db1.f1() +2 +connection default; +DROP FUNCTION db1.f1; +CREATE FUNCTION db1.f1() RETURNS INT RETURN 99; +connection con4; +SELECT Db1.f1(), db1.f1(); +Db1.f1() db1.f1() +1 99 +disconnect con4; +connection default; +DROP PROCEDURE test.p1; +DROP DATABASE Db1; +DROP DATABASE db1; diff --git a/mysql-test/main/lowercase_routines0.test b/mysql-test/main/lowercase_routines0.test new file mode 100644 index 0000000000000..178f17dee279e --- /dev/null +++ b/mysql-test/main/lowercase_routines0.test @@ -0,0 +1,65 @@ +# +# Tests that require lower_case_table_names to be 0 +# (the default when the data directory is on a case sensitive file system) +# +--source include/have_lowercase0.inc +--source include/have_case_sensitive_file_system.inc + +--echo # +--echo # MDEV-33616 A statement cannot reference two routines whose databases +--echo # differ only in case +--echo # + +CREATE DATABASE Db1; +CREATE DATABASE db1; +CREATE FUNCTION Db1.f1() RETURNS INT RETURN 1; +CREATE FUNCTION db1.f1() RETURNS INT RETURN 2; +CREATE PROCEDURE test.p1() SELECT Db1.f1(), db1.f1(); + +SELECT Db1.f1(); +SELECT db1.f1(); + +# Every routine a statement names joins one set, keyed by the database and +# the routine name. The database name is case sensitive here, so the two +# routines have to stay apart and each reference has to reach its own. A +# connection that already holds one of them in its routine cache resolves +# both either way, so every check below starts from a connection that holds +# neither. +connect (con1,localhost,root,,test); +# A view compares its column names without regard to case, so under the +# view protocol the second column of a query like this one is given a +# generated name. +--disable_view_protocol +SELECT Db1.f1(), db1.f1(); +--enable_view_protocol +disconnect con1; + +connect (con2,localhost,root,,test); +--disable_view_protocol +SELECT db1.f1(), Db1.f1(); +--enable_view_protocol +disconnect con2; + +# A statement inside a routine body builds the same set. +connect (con3,localhost,root,,test); +CALL test.p1(); +disconnect con3; + +# A routine missing from the set is neither locked nor checked against the +# version of the routine cache, so it could execute a definition that +# another connection had already replaced. +connect (con4,localhost,root,,test); +SELECT db1.f1(); +connection default; +DROP FUNCTION db1.f1; +CREATE FUNCTION db1.f1() RETURNS INT RETURN 99; +connection con4; +--disable_view_protocol +SELECT Db1.f1(), db1.f1(); +--enable_view_protocol +disconnect con4; +connection default; + +DROP PROCEDURE test.p1; +DROP DATABASE Db1; +DROP DATABASE db1; diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index 97d406b2fc4e1..e2a1aa5550a19 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -49,6 +49,7 @@ sub skip_combinations { $skip{'include/not_windows.inc'} = 'Requires not Windows' if IS_WINDOWS; $skip{'include/not_aix.inc'} = 'Requires not AIX' if IS_AIX; + $skip{'include/not_mac.inc'} = 'Requires not macOS' if IS_MAC; $skip{'include/not_ssl.inc'} = 'Skipped if --ssl' if $::opt_ssl; $skip{'main/plugin_loaderr.test'} = 'needs compiled-in innodb' diff --git a/mysql-test/suite/atomic/drop_db_long_names.result b/mysql-test/suite/atomic/drop_db_long_names.result index e1d177ab44730..ec1cc598260de 100644 --- a/mysql-test/suite/atomic/drop_db_long_names.result +++ b/mysql-test/suite/atomic/drop_db_long_names.result @@ -1,11 +1,11 @@ RESET MASTER; "engine: aria crash point: ddl_log_drop_after_drop_tables position: 1" -master-bin.000002 # Query # # use `test2`; DROP TABLE IF EXISTS `tABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB`,`tACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC`,`tADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD`,`tAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE`,`tAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF`,`tAGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG`,`tAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH`,`tAIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII`,`tAJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ`,`tAKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK`,`tALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL` /* generated by ddl recovery */ -master-bin.000002 # Query # # use `test2`; DROP VIEW IF EXISTS `tABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBv`,`tACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCv`,`tADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDv`,`tAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEv`,`tAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFv`,`tAGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGv`,`tAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHv`,`tAIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIv`,`tAJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJv`,`tAKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKv` /* generated by ddl recovery */ -master-bin.000002 # Query # # use `test2`; DROP TABLE IF EXISTS `tAMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM`,`tANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN`,`tAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO`,`tAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP`,`tAQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ`,`tARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR`,`tASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS`,`tATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT`,`tAUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU`,`tAVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV`,`tAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW` /* generated by ddl recovery */ -master-bin.000002 # Query # # use `test2`; DROP VIEW IF EXISTS `tALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLv`,`tAMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMv`,`tANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNv`,`tAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOv`,`tAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPv`,`tAQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQv`,`tARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRv`,`tASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSv`,`tATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTv`,`tAUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUv`,`tAVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVv` /* generated by ddl recovery */ -master-bin.000002 # Query # # use `test2`; DROP TABLE IF EXISTS `tAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`,`tAYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY`,`tAZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ`,`tBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA`,`tBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB`,`tBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC`,`tBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD`,`tBEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE` /* generated by ddl recovery */ -master-bin.000002 # Query # # use `test2`; DROP VIEW IF EXISTS `tAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWv`,`tAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXv`,`tAYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYv`,`tAZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZv`,`tBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv`,`tBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBv`,`tBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCv`,`tBDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDv`,`tBEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEv` /* generated by ddl recovery */ +master-bin.000002 # Query # # use `test2`; DROP TABLE IF EXISTS `tabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb`,`tacccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc`,`tadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd`,`taeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,`taffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`,`tagggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg`,`tahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh`,`taiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii`,`tajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj`,`takkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk`,`tallllllllllllllllllllllllllllllllllllllllllllllllllllllllllll` /* generated by ddl recovery */ +master-bin.000002 # Query # # use `test2`; DROP VIEW IF EXISTS `tabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbv`,`taccccccccccccccccccccccccccccccv`,`taddddddddddddddddddddddddddddddv`,`taeeeeeeeeeeeeeeeeeeeeeeeeeeeeeev`,`taffffffffffffffffffffffffffffffv`,`taggggggggggggggggggggggggggggggv`,`tahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhv`,`taiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiv`,`tajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjv`,`takkkkkkkkkkkkkkkkkkkkkkkkkkkkkkv` /* generated by ddl recovery */ +master-bin.000002 # Query # # use `test2`; DROP TABLE IF EXISTS `tammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm`,`tannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`,`taoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo`,`tapppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp`,`taqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq`,`tarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr`,`tassssssssssssssssssssssssssssssssssssssssssssssssssssssssssss`,`tatttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt`,`tauuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu`,`tavvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv`,`tawwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww` /* generated by ddl recovery */ +master-bin.000002 # Query # # use `test2`; DROP VIEW IF EXISTS `tallllllllllllllllllllllllllllllv`,`tammmmmmmmmmmmmmmmmmmmmmmmmmmmmmv`,`tannnnnnnnnnnnnnnnnnnnnnnnnnnnnnv`,`taoooooooooooooooooooooooooooooov`,`tappppppppppppppppppppppppppppppv`,`taqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv`,`tarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrv`,`tassssssssssssssssssssssssssssssv`,`tattttttttttttttttttttttttttttttv`,`tauuuuuuuuuuuuuuuuuuuuuuuuuuuuuuv`,`tavvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv`,`tawwwwwwwwwwwwwwwwwwwwwwwwwwwwwwv` /* generated by ddl recovery */ +master-bin.000002 # Query # # use `test2`; DROP TABLE IF EXISTS `taxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,`tayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy`,`tazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz`,`tbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`,`tbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb`,`tbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc`,`tbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd`,`tbeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` /* generated by ddl recovery */ +master-bin.000002 # Query # # use `test2`; DROP VIEW IF EXISTS `taxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxv`,`tayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyv`,`tazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzv`,`tbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaav`,`tbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbv`,`tbccccccccccccccccccccccccccccccv`,`tbddddddddddddddddddddddddddddddv`,`tbeeeeeeeeeeeeeeeeeeeeeeeeeeeeeev` /* generated by ddl recovery */ "engine: aria crash point: ddl_log_drop_before_binlog position: 1" master-bin.000002 # Query # # DROP DATABASE IF EXISTS `test2` /* generated by ddl recovery */ Warnings: diff --git a/mysql-test/suite/atomic/drop_db_long_names.test b/mysql-test/suite/atomic/drop_db_long_names.test index 1256a9dc92f61..0686d0ca54d2d 100644 --- a/mysql-test/suite/atomic/drop_db_long_names.test +++ b/mysql-test/suite/atomic/drop_db_long_names.test @@ -58,8 +58,10 @@ while ($e < $engine_count) while ($t < $max_tables) { inc $t; - let $name=`select concat("t",char(floor(65+$t/26)),repeat(char(65+mod($t,26)),60))`; - let $view=`select concat("t",char(floor(65+$t/26)),repeat(char(65+mod($t,26)),30),'v')`; + # Generate the names in lower case so that they are unchanged by a + # lower_case_table_names setting of 1 or 2. + let $name=`select concat("t",char(floor(97+$t/26)),repeat(char(97+mod($t,26)),60))`; + let $view=`select concat("t",char(floor(97+$t/26)),repeat(char(97+mod($t,26)),30),'v')`; --eval create table $name (a int not null) $extra_option --eval create view $view as select * from $name } diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test index f96f89c39d566..9d8e66e242642 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test @@ -36,7 +36,7 @@ send SET GLOBAL innodb_buffer_pool_size=8388608; connection default; SET DEBUG_SYNC='now WAIT_FOR blocked'; # adjust for 32-bit and SUX_LOCK_GENERIC ---replace_regex /(5..)\/\1/505\/505/ +--replace_regex /([45]..)\/\1/505\/505/ SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; SET DEBUG_SYNC='now SIGNAL go'; connection con1; diff --git a/mysql-test/suite/innodb/t/log_upgrade.test b/mysql-test/suite/innodb/t/log_upgrade.test index a3d237875feac..0287bf0743123 100644 --- a/mysql-test/suite/innodb/t/log_upgrade.test +++ b/mysql-test/suite/innodb/t/log_upgrade.test @@ -1,11 +1,14 @@ --source include/have_innodb.inc --source include/have_innodb_16k.inc -# Some operating systems or file systems do not support sparse files. -# For example, tmpfs on FreeBSD does not support them. -# On Microsoft Windows, sparse files have to be created in a special way. --source include/big_test.inc # include/shutdown_mysqld.inc does not work in ./mtr --embedded --source include/not_embedded.inc +# Some operating systems or file systems do not support sparse files. +# For example, tmpfs on FreeBSD does not support them. +# On macOS, HFS allocates every block of the skipped range. APFS allocates +# the whole range for a file smaller than 16MB, and records a hole above that. +# On Microsoft Windows, sparse files have to be created in a special way. +--source include/have_sparse_files.inc call mtr.add_suppression("InnoDB: The change buffer is corrupted"); diff --git a/mysql-test/suite/innodb/t/log_upgrade_101_flags.test b/mysql-test/suite/innodb/t/log_upgrade_101_flags.test index 7b19986f73e8e..8ad4083040660 100644 --- a/mysql-test/suite/innodb/t/log_upgrade_101_flags.test +++ b/mysql-test/suite/innodb/t/log_upgrade_101_flags.test @@ -1,6 +1,7 @@ --source include/have_innodb.inc --source include/big_test.inc --source include/not_embedded.inc +--source include/have_sparse_files.inc call mtr.add_suppression("InnoDB: The change buffer is corrupted"); call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages"); call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file"); diff --git a/mysql-test/suite/innodb_fts/t/index_table.test b/mysql-test/suite/innodb_fts/t/index_table.test index 89c0905323083..3ad193fd04a85 100644 --- a/mysql-test/suite/innodb_fts/t/index_table.test +++ b/mysql-test/suite/innodb_fts/t/index_table.test @@ -17,6 +17,9 @@ CREATE TABLE articles ( content TEXT ) ENGINE= InnoDB; +# The error number is reported through my_strerror(), whose text for 11 +# differs between systems, so normalize it +--replace_regex /".*" from/"Resource temporarily unavailable" from/ --error ER_GET_ERRNO SET STATEMENT debug_dbug='+d,innodb_report_deadlock' FOR CREATE FULLTEXT INDEX idx ON articles (title, content); diff --git a/mysql-test/suite/period/r/i_s_case_sensitive.result b/mysql-test/suite/period/r/i_s_case_sensitive.result new file mode 100644 index 0000000000000..db678aec4d24b --- /dev/null +++ b/mysql-test/suite/period/r/i_s_case_sensitive.result @@ -0,0 +1,14 @@ +# MDEV-32503 Queries from KEY_PERIOD_USAGE don't obey case-sensitivity +create table t (a int, b date, c date, period for app(b,c), +unique idx(a, app without overlaps)); +set names latin1 collate latin1_general_cs; +select table_name from information_schema.periods where table_schema = 'TEST'; +table_name +select table_name from information_schema.key_period_usage where table_schema = 'TEST'; +table_name +set names latin1 collate latin1_general_ci; +select table_name from information_schema.periods where table_schema = 'TEST'; +table_name +select table_name from information_schema.key_period_usage where table_schema = 'TEST'; +table_name +drop table t; diff --git a/mysql-test/suite/period/r/i_s_notembedded,win.rdiff b/mysql-test/suite/period/r/i_s_notembedded,win.rdiff deleted file mode 100644 index eee35182c728c..0000000000000 --- a/mysql-test/suite/period/r/i_s_notembedded,win.rdiff +++ /dev/null @@ -1,20 +0,0 @@ ---- suite/period/r/i_s_notembedded.result 2024-01-01 19:50:37.000000000 +0100 -+++ suite/period/r/i_s_notembedded,win.reject 2024-01-01 19:57:18.888306500 +0100 -@@ -69,13 +69,17 @@ - set names latin1 collate latin1_general_cs; - select table_name from information_schema.periods where table_schema = 'TEST'; - table_name -+t - select table_name from information_schema.key_period_usage where table_schema = 'TEST'; - table_name -+t - set names latin1 collate latin1_general_ci; - select table_name from information_schema.periods where table_schema = 'TEST'; - table_name -+t - select table_name from information_schema.key_period_usage where table_schema = 'TEST'; - table_name -+t - # [DUPLICATE] MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME - # does not work - select constraint_name from information_schema.key_period_usage where table_name = 't'; diff --git a/mysql-test/suite/period/r/i_s_notembedded.result b/mysql-test/suite/period/r/i_s_notembedded.result index 80070ef61161e..8e92cf9fd60e1 100644 --- a/mysql-test/suite/period/r/i_s_notembedded.result +++ b/mysql-test/suite/period/r/i_s_notembedded.result @@ -63,19 +63,8 @@ def test t2 SYSTEM_TIME vs ve def test t2 mytime s e connection default; drop tables t1, t2; -# MDEV-32503 Queries from KEY_PERIOD_USAGE don't obey case-sensitivity create table t (a int, b date, c date, period for app(b,c), unique idx(a, app without overlaps)); -set names latin1 collate latin1_general_cs; -select table_name from information_schema.periods where table_schema = 'TEST'; -table_name -select table_name from information_schema.key_period_usage where table_schema = 'TEST'; -table_name -set names latin1 collate latin1_general_ci; -select table_name from information_schema.periods where table_schema = 'TEST'; -table_name -select table_name from information_schema.key_period_usage where table_schema = 'TEST'; -table_name # [DUPLICATE] MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME # does not work select constraint_name from information_schema.key_period_usage where table_name = 't'; diff --git a/mysql-test/suite/period/t/i_s_case_sensitive.test b/mysql-test/suite/period/t/i_s_case_sensitive.test new file mode 100644 index 0000000000000..639454b05a30e --- /dev/null +++ b/mysql-test/suite/period/t/i_s_case_sensitive.test @@ -0,0 +1,22 @@ +# +# Looking up I_S.PERIODS and I_S.KEY_PERIOD_USAGE by schema name compares the +# name the same way table names are compared, so the answer depends on +# lower_case_table_names. These cases record the case sensitive answer. +# +--source include/have_lowercase0.inc + +--echo # MDEV-32503 Queries from KEY_PERIOD_USAGE don't obey case-sensitivity + +create table t (a int, b date, c date, period for app(b,c), + unique idx(a, app without overlaps)); + +set names latin1 collate latin1_general_cs; + +select table_name from information_schema.periods where table_schema = 'TEST'; +select table_name from information_schema.key_period_usage where table_schema = 'TEST'; +set names latin1 collate latin1_general_ci; + +select table_name from information_schema.periods where table_schema = 'TEST'; +select table_name from information_schema.key_period_usage where table_schema = 'TEST'; + +drop table t; diff --git a/mysql-test/suite/period/t/i_s_notembedded.test b/mysql-test/suite/period/t/i_s_notembedded.test index 5bfb4e14e8bde..065d334292600 100644 --- a/mysql-test/suite/period/t/i_s_notembedded.test +++ b/mysql-test/suite/period/t/i_s_notembedded.test @@ -1,5 +1,4 @@ --source include/not_embedded.inc ---source include/platform.inc select * from information_schema.periods; @@ -56,21 +55,12 @@ select * from information_schema.periods where table_schema = 'test'; --connection default drop tables t1, t2; ---echo # MDEV-32503 Queries from KEY_PERIOD_USAGE don't obey case-sensitivity +# The case sensitive lookups of MDEV-32503 need lower_case_table_names=0 and +# live in period.i_s_case_sensitive create table t (a int, b date, c date, period for app(b,c), unique idx(a, app without overlaps)); - -set names latin1 collate latin1_general_cs; - -select table_name from information_schema.periods where table_schema = 'TEST'; -select table_name from information_schema.key_period_usage where table_schema = 'TEST'; -set names latin1 collate latin1_general_ci; - -select table_name from information_schema.periods where table_schema = 'TEST'; -select table_name from information_schema.key_period_usage where table_schema = 'TEST'; - --echo # [DUPLICATE] MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME --echo # does not work disable_warnings; # storage engine 'Innodb' is not found diff --git a/mysql-test/suite/plugins/t/multiauth.test b/mysql-test/suite/plugins/t/multiauth.test index fa902ab3b2cec..feccece1b3ba1 100644 --- a/mysql-test/suite/plugins/t/multiauth.test +++ b/mysql-test/suite/plugins/t/multiauth.test @@ -206,8 +206,15 @@ create user mysqltest1 identified via ed25519 as password("good"); grant select on test.* to mysqltest1; show create user mysqltest1; --echo # no plugin = failure -# covers Linux (1st re), FreeBSD (2nd), AIX (3rd and 4th) ---replace_regex /loaded: .*client_ed25519.so: cannot open shared object file: No such file or directory/loaded: no such file/ /loaded: Cannot open.*client_ed25519.so./loaded: no such file/ /loaded: .*Could not load module.*client_ed25519.so.\n/loaded: no such file/ /System error: No such file or directory// +# covers Linux (1st re), FreeBSD (2nd), AIX (3rd and 4th), macOS (5th and 6th). +# The macOS text names every path that dlopen() tried. Its length depends on +# the vardir, so it either fits in the 512 byte buffer that --exec output is +# read in or reaches the replacement as several chunks, each matched on its +# own. The 5th expression rewrites the chunk holding the start of the +# message, the 6th drops the chunks that continue it. Both stop at a newline +# because the expressions are compiled with REG_DOTALL, where an unrestricted +# .* would swallow the line terminator and join this line to the next one. +--replace_regex /loaded: .*client_ed25519.so: cannot open shared object file: No such file or directory/loaded: no such file/ /loaded: Cannot open.*client_ed25519.so./loaded: no such file/ /loaded: .*Could not load module.*client_ed25519.so.\n/loaded: no such file/ /System error: No such file or directory// /loaded: dlopen\([^\n]*/loaded: no such file/ /^[^\n]*client_ed25519\.so[^\n]*// --error 1 --exec $try_auth -u mysqltest1 -pgood --plugin-dir=$plugindir/no alter user mysqltest1 identified via ed25519 as password("good") OR mysql_native_password as password("works"); diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 513bc5e90e29c..f0dcefe80371e 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -1,6 +1,6 @@ --- sysvars_innodb.result +++ sysvars_innodb.result,32bit -@@ -47,7 +47,7 @@ +@@ -48,7 +48,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -9,7 +9,7 @@ VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -83,7 +83,7 @@ +@@ -84,7 +84,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -18,7 +18,7 @@ VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility); 1 => New style AUTOINC locking; 2 => No AUTOINC locking (unsafe for SBR) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -95,10 +95,10 @@ +@@ -96,10 +96,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -31,7 +31,7 @@ NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -131,7 +131,7 @@ +@@ -132,7 +132,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 25 VARIABLE_SCOPE GLOBAL @@ -40,7 +40,7 @@ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -203,10 +203,10 @@ +@@ -204,10 +204,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 134217728 VARIABLE_SCOPE GLOBAL @@ -53,7 +53,7 @@ NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -215,11 +215,11 @@ +@@ -216,11 +216,11 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -68,7 +68,7 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED -@@ -239,7 +239,7 @@ +@@ -240,7 +240,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -77,7 +77,7 @@ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed). NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -359,7 +359,7 @@ +@@ -360,7 +360,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 5 VARIABLE_SCOPE GLOBAL @@ -86,7 +86,7 @@ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -383,7 +383,7 @@ +@@ -384,7 +384,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -95,7 +95,7 @@ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 75 -@@ -671,7 +671,7 @@ +@@ -672,7 +672,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 600 VARIABLE_SCOPE GLOBAL @@ -104,7 +104,7 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -719,7 +719,7 @@ +@@ -720,7 +720,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL @@ -113,7 +113,7 @@ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 -@@ -743,7 +743,7 @@ +@@ -744,7 +744,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -122,7 +122,7 @@ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3 -@@ -767,7 +767,7 @@ +@@ -768,7 +768,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -131,7 +131,7 @@ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -803,7 +803,7 @@ +@@ -804,7 +804,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -140,7 +140,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -827,10 +827,10 @@ +@@ -828,10 +828,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -153,7 +153,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -863,7 +863,7 @@ +@@ -864,7 +864,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -162,7 +162,7 @@ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -875,7 +875,7 @@ +@@ -876,7 +876,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL @@ -171,7 +171,7 @@ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16 -@@ -887,7 +887,7 @@ +@@ -888,7 +888,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -180,7 +180,7 @@ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call NUMERIC_MIN_VALUE 1000 NUMERIC_MAX_VALUE 10000 -@@ -899,10 +899,10 @@ +@@ -900,10 +900,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000000000 VARIABLE_SCOPE GLOBAL @@ -193,7 +193,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -923,7 +923,7 @@ +@@ -924,7 +924,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -202,7 +202,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -935,10 +935,10 @@ +@@ -936,10 +936,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -215,7 +215,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -983,7 +983,7 @@ +@@ -972,7 +972,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -224,7 +224,7 @@ VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 NUMERIC_MAX_VALUE 4294967295 -@@ -995,7 +995,7 @@ +@@ -984,7 +984,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -233,7 +233,7 @@ VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated. NUMERIC_MIN_VALUE 100 NUMERIC_MAX_VALUE 4294967295 -@@ -1115,10 +1115,10 @@ +@@ -1104,10 +1104,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 32 VARIABLE_SCOPE GLOBAL @@ -246,7 +246,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1127,10 +1127,10 @@ +@@ -1116,10 +1116,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 1536 VARIABLE_SCOPE GLOBAL @@ -259,7 +259,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1163,10 +1163,10 @@ +@@ -1152,10 +1152,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -272,7 +272,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1175,7 +1175,7 @@ +@@ -1164,7 +1164,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -281,7 +281,7 @@ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 10000000 -@@ -1307,10 +1307,10 @@ +@@ -1296,10 +1296,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -294,7 +294,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -1331,7 +1331,7 @@ +@@ -1320,7 +1320,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 16384 VARIABLE_SCOPE GLOBAL @@ -303,7 +303,7 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1367,7 +1367,7 @@ +@@ -1356,7 +1356,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 127 VARIABLE_SCOPE GLOBAL @@ -312,7 +312,7 @@ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5000 -@@ -1379,7 +1379,7 @@ +@@ -1368,7 +1368,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -321,7 +321,7 @@ VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -1415,7 +1415,7 @@ +@@ -1404,7 +1404,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 56 VARIABLE_SCOPE GLOBAL @@ -330,7 +330,7 @@ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 64 -@@ -1499,7 +1499,7 @@ +@@ -1488,7 +1488,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -339,7 +339,7 @@ VARIABLE_COMMENT Memory buffer size for index creation NUMERIC_MIN_VALUE 65536 NUMERIC_MAX_VALUE 67108864 -@@ -1667,10 +1667,10 @@ +@@ -1656,10 +1656,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index cad0893798fc2..0b5b7eab05872 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -7,6 +7,7 @@ variable_name not in ( 'innodb_buffer_pool_size_max', # default value depends on OS 'innodb_buffer_pool_in_core_dump', # only available on Linux and FreeBSD 'innodb_log_file_buffering', # only available on Linux and Windows +'innodb_log_file_mmap', # default value depends on OS 'innodb_linux_aio', # existence depends on OS 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; @@ -946,18 +947,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL -VARIABLE_NAME INNODB_LOG_FILE_MMAP -SESSION_VALUE NULL -DEFAULT_VALUE ON -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Whether ib_logfile0 resides in persistent memory (when supported) or should initially be memory-mapped -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST OFF,ON -READ_ONLY YES -COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_LOG_FILE_SIZE SESSION_VALUE NULL DEFAULT_VALUE 100663296 diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 7cda33d9fb612..219d39be91516 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -18,6 +18,7 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP 'innodb_buffer_pool_size_max', # default value depends on OS 'innodb_buffer_pool_in_core_dump', # only available on Linux and FreeBSD 'innodb_log_file_buffering', # only available on Linux and Windows + 'innodb_log_file_mmap', # default value depends on OS 'innodb_linux_aio', # existence depends on OS 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysql-test/suite/sys_vars/t/sysvars_readonly_debug.test b/mysql-test/suite/sys_vars/t/sysvars_readonly_debug.test index 192c481b4cef3..3f71ed9b2ce31 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_readonly_debug.test +++ b/mysql-test/suite/sys_vars/t/sysvars_readonly_debug.test @@ -2,6 +2,11 @@ --source include/not_asan.inc --source include/not_embedded.inc --source include/not_valgrind.inc +# The read only segment is placed by a linker script and ld64 has no option to +# take one, so HAVE_RO_AFTER_INIT stays undefined on macOS. Without it no +# variable is moved into the read only root either, so neither assignment +# below is refused by the memory protection. +--source include/not_mac.inc --echo # --echo # MDEV-40341 store read-only sysvars in a read-only root and a read-only segment diff --git a/sql/sp.cc b/sql/sp.cc index b5069603ed615..4d9c9e924c54f 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -2346,7 +2346,15 @@ bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, const Sp_handler *handler, TABLE_LIST *belong_to_view) { - my_hash_init_opt(PSI_INSTRUMENT_ME, &prelocking_ctx->sroutines, system_charset_info, + /* + Compare keys byte for byte. The key carries the database name as the + statement spelled it, and with lower_case_table_names 0 two databases + can differ only in case. A case insensitive comparison would collapse + the routines of both into one entry, so only one of them would be + loaded and locked, and a reference to the other would not find it. + */ + my_hash_init_opt(PSI_INSTRUMENT_ME, &prelocking_ctx->sroutines, + &my_charset_bin, Query_tables_list::START_SROUTINES_HASH_SIZE, 0, 0, sp_sroutine_key, 0, 0); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 98f302e2aa3e3..9dc02125dfee2 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -604,7 +604,8 @@ sp_head::sp_head(MEM_ROOT *mem_root_arg, sp_package *parent, sizeof(sp_instr *), 16, 8, MYF(0)); my_hash_init(key_memory_sp_head_main_root, &m_sptabs, table_alias_charset, 0, 0, 0, sp_table_key, 0, 0); - my_hash_init(key_memory_sp_head_main_root, &m_sroutines, system_charset_info, + /* Keys are compared byte for byte, the database name is case sensitive. */ + my_hash_init(key_memory_sp_head_main_root, &m_sroutines, &my_charset_bin, 0, 0, 0, sp_sroutine_key, 0, 0); DBUG_VOID_RETURN; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 66999c555a522..8ab4588ec461e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7115,6 +7115,21 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) DBUG_RETURN(0); } + /* + A routine records its database in mysql.proc in lower case whenever + lower_case_table_names is set, see sp_name::sp_name(). The lookup value + is the name as the query spelled it, and get_lookup_field_values folds it + to lower case only for lower_case_table_names 1. Fold it here for the + remaining setting so that the index read below, and the comparison in + check_proc_record, both see the form that was stored. mysql.proc.db is + utf8mb3_bin, so neither of them can absorb the difference in case. + The value is a buffer allocated by get_lookup_field_values, so it can be + changed in place. + */ + if (lower_case_table_names && lookup.db_value.length) + lookup.db_value.length= my_casedn_str(files_charset_info, + (char*) lookup.db_value.str); + start_new_trans new_trans(thd); if (!(proc_table= open_proc_table_for_read(thd))) diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index f6cca36238ec9..b0e445cdc31a3 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -260,12 +260,15 @@ struct recv_sys_t /** iterator to pages, used by parse() */ map::iterator pages_it; - /** The allocated size of tmp_buf. The 1+8 extra bytes are - needed for FORMAT_ENC_11 in parse(). */ + /** The size of tmp_buf that the parser requires. The 1+8 extra bytes + are needed for FORMAT_ENC_11 in parse(). */ static constexpr size_t tmp_buf_size{MTR_SIZE_MAX + 9}; /** buffer for decrypting mini-transactions or handling non-contiguous mini-transactions */ byte *tmp_buf; + /** the number of bytes allocated for tmp_buf, which is tmp_buf_size + rounded up to a multiple of the large page size */ + size_t tmp_buf_alloc_size; /** Process a record that indicates that a tablespace size is being shrunk. @param page_id first page that is not in the file diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index 398dd0dcc9ecd..30a726f2db3ab 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -1087,6 +1087,27 @@ static inline void *ut_malloc_dontdump(size_t n_bytes, ...) #endif /* UNIV_PFS_MEMORY */ +/** Allocate memory that is excluded from core dumps, reporting back the +size that was actually allocated. + +my_large_malloc() rounds the request up to a multiple of the large page +size and charges the rounded figure to the memory accounting, so a caller +whose request is not already such a multiple must release the rounded +figure rather than the one it asked for. + +@param[in,out] n_bytes bytes to allocate on entry, bytes allocated on exit +@return the allocated memory, or NULL */ +static inline void *ut_malloc_dontdump_size(size_t *n_bytes) +{ + void *ptr = my_large_malloc(n_bytes, MYF(0)); + + if (ptr) { + ut_dontdump(ptr, *n_bytes, true); + os_total_large_mem_allocated += *n_bytes; + } + return ptr; +} + static inline void ut_free_dodump(void *ptr, size_t size) { ut_dodump(ptr, size); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 28e2763d7fe4a..f46ded9cfbfd7 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1480,7 +1480,7 @@ void recv_sys_t::tmp_free() noexcept { if (tmp_buf) { - ut_free_dodump(tmp_buf, tmp_buf_size); + ut_free_dodump(tmp_buf, tmp_buf_alloc_size); tmp_buf= nullptr; } } @@ -1869,8 +1869,9 @@ dberr_t recv_sys_t::find_checkpoint() if (!tmp_buf) { + tmp_buf_alloc_size= tmp_buf_size; tmp_buf= static_cast - (ut_malloc_dontdump(tmp_buf_size, PSI_INSTRUMENT_ME)); + (ut_malloc_dontdump_size(&tmp_buf_alloc_size)); if (!tmp_buf) return DB_OUT_OF_MEMORY; }