diff options
Diffstat (limited to 'mysql-test')
46 files changed, 972 insertions, 78 deletions
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 15b67b51f45..55ace91507e 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -142,3 +142,37 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DERIVED t2 index NULL PRIMARY 4 NULL 3 drop view v1; drop table t1,t2; +# +# MDEV-23723: Crash when test_if_skip_sort_order() is checked for derived table subject to split +# +CREATE TABLE t1 (a INT, b INT, KEY (a), KEY (a,b)) ENGINE=InnoDB; +CREATE TABLE t2 (c INT, KEY (c)) ENGINE=InnoDB; +SELECT * FROM t1 t1a JOIN t1 t1b; +a b a b +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t1 VALUES (1,2),(3,4),(5,6),(7,8),(9,10),(11,12); +set statement optimizer_switch='split_materialized=off' for EXPLAIN +SELECT * +FROM +t1 JOIN +(SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt +WHERE +t1.a = dt.a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index a,a_2 a_2 10 NULL 6 Using where; Using index +1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 +3 DERIVED t1 index NULL a_2 10 NULL 6 Using where; Using index +3 DERIVED t2 ref c c 5 test.t1.b 1 Using index +set statement optimizer_switch='split_materialized=on' for EXPLAIN +SELECT * +FROM +t1 JOIN +(SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt +WHERE +t1.a = dt.a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index a,a_2 a_2 10 NULL 6 Using where; Using index +1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 +3 LATERAL DERIVED t1 ref a,a_2 a 5 test.t1.a 1 Using where; Using temporary; Using filesort +3 LATERAL DERIVED t2 ref c c 5 test.t1.b 1 Using index +DROP TABLE t1, t2; diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test index d4d7fde1fcd..10fc3f93190 100644 --- a/mysql-test/main/derived_split_innodb.test +++ b/mysql-test/main/derived_split_innodb.test @@ -126,3 +126,29 @@ eval set statement optimizer_switch='split_materialized=off' for explain $q; drop view v1; drop table t1,t2; + +--echo # +--echo # MDEV-23723: Crash when test_if_skip_sort_order() is checked for derived table subject to split +--echo # +CREATE TABLE t1 (a INT, b INT, KEY (a), KEY (a,b)) ENGINE=InnoDB; +CREATE TABLE t2 (c INT, KEY (c)) ENGINE=InnoDB; + +SELECT * FROM t1 t1a JOIN t1 t1b; + +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t1 VALUES (1,2),(3,4),(5,6),(7,8),(9,10),(11,12); + +let $query= +EXPLAIN +SELECT * +FROM + t1 JOIN + (SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt +WHERE + t1.a = dt.a; + +eval set statement optimizer_switch='split_materialized=off' for $query; +eval set statement optimizer_switch='split_materialized=on' for $query; + +DROP TABLE t1, t2; + diff --git a/mysql-test/main/lowercase_table.result b/mysql-test/main/lowercase_table.result index 823ffa7696f..3d840445bf2 100644 --- a/mysql-test/main/lowercase_table.result +++ b/mysql-test/main/lowercase_table.result @@ -1,7 +1,3 @@ -drop table if exists t1,t2,t3,t4; -drop table if exists t0,t5,t6,t7,t8,t9; -drop database if exists mysqltest; -drop view if exists v0, v1, v2, v3, v4; create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); @@ -79,13 +75,21 @@ ERROR 42000: Not unique table/alias: 'C' select C.a, c.a from t1 c, t2 C; ERROR 42000: Not unique table/alias: 'C' drop table t1, t2; +# +# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when lower_case_table_names is set +# create table t1 (a int); create table t2 like T1; drop table t1, t2; show tables; Tables_in_test +# +# End of 4.1 tests +# +# +# Bug#20404: SHOW CREATE TABLE fails with Turkish I +# set names utf8; -drop table if exists İ,İİ; create table İ (s1 int); show create table İ; Table Create Table @@ -107,7 +111,12 @@ Tables_in_test ii drop table İİ; set names latin1; -End of 5.0 tests +# +# End of 5.0 tests +# +# +# Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names +# create database mysql_TEST character set latin2; create table mysql_TEST.T1 (a int); show create database mysql_TEST; @@ -126,8 +135,32 @@ show databases like "mysql_TE%"; Database (mysql_TE%) mysql_test drop database mysql_TEST; -End of 10.0 tests +# +# End of 10.0 tests +# +# +# MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names. +# create database db1; create table t1 (a int); drop database db1; drop table t1; +# +# End of 10.2 tests +# +# +# MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc +# +call mtr.add_suppression("Stored routine ''.'': invalid value in column"); +insert ignore into mysql.proc () values (); +Warnings: +Warning 1364 Field 'param_list' doesn't have a default value +Warning 1364 Field 'returns' doesn't have a default value +Warning 1364 Field 'body' doesn't have a default value +Warning 1364 Field 'comment' doesn't have a default value +show function status; +ERROR 42000: Incorrect routine name '' +delete from mysql.proc where name = ''; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test index e0dcb6c36dd..4f92e43f5f7 100644 --- a/mysql-test/main/lowercase_table.test +++ b/mysql-test/main/lowercase_table.test @@ -2,14 +2,6 @@ # Test of --lower-case-table-names # ---disable_warnings -drop table if exists t1,t2,t3,t4; -# Clear up from other tests (to ensure that SHOW TABLES below is right) -drop table if exists t0,t5,t6,t7,t8,t9; -drop database if exists mysqltest; -drop view if exists v0, v1, v2, v3, v4; ---enable_warnings - create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); @@ -68,32 +60,29 @@ drop table t1,t2; # create table t1 (a int); create table t2 (a int); --- error 1066 +--error ER_NONUNIQ_TABLE select * from t1 c, t2 C; --- error 1066 +--error ER_NONUNIQ_TABLE select C.a, c.a from t1 c, t2 C; drop table t1, t2; -# -# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when -# lower_case_table_names is set +--echo # +--echo # Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when lower_case_table_names is set +--echo # create table t1 (a int); create table t2 like T1; drop table t1, t2; show tables; +--echo # +--echo # End of 4.1 tests +--echo # -# End of 4.1 tests - - -# -# Bug#20404: SHOW CREATE TABLE fails with Turkish I -# +--echo # +--echo # Bug#20404: SHOW CREATE TABLE fails with Turkish I +--echo # set names utf8; ---disable_warnings -drop table if exists İ,İİ; ---enable_warnings create table İ (s1 int); show create table İ; show tables; @@ -104,11 +93,13 @@ show tables; drop table İİ; set names latin1; ---echo End of 5.0 tests +--echo # +--echo # End of 5.0 tests +--echo # -# -# Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names -# +--echo # +--echo # Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names +--echo # create database mysql_TEST character set latin2; create table mysql_TEST.T1 (a int); show create database mysql_TEST; @@ -117,11 +108,13 @@ show databases like "mysql%"; show databases like "mysql_TE%"; drop database mysql_TEST; ---echo End of 10.0 tests +--echo # +--echo # End of 10.0 tests +--echo # -# -# MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names. -# +--echo # +--echo # MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names. +--echo # let $datadir=`select @@datadir`; create database db1; @@ -130,3 +123,19 @@ copy_file $datadir/test/t1.frm $datadir/db1/T1.frm; drop database db1; drop table t1; +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc +--echo # +call mtr.add_suppression("Stored routine ''.'': invalid value in column"); +insert ignore into mysql.proc () values (); +--error ER_SP_WRONG_NAME +show function status; +delete from mysql.proc where name = ''; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/mdev19198.result b/mysql-test/main/mdev19198.result new file mode 100644 index 00000000000..77c08ca0fb7 --- /dev/null +++ b/mysql-test/main/mdev19198.result @@ -0,0 +1,15 @@ +CREATE TABLE t1 (c INT); +CREATE TABLE t2 (c INT); +LOCK TABLES t1 WRITE, t2 READ; +CREATE TABLE IF NOT EXISTS t1 LIKE t2; +Warnings: +Note 1050 Table 't1' already exists +UNLOCK TABLES; +LOCK TABLES t1 READ , t2 READ; +CREATE TABLE IF NOT EXISTS t1 LIKE t2; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +UNLOCK TABLES; +CREATE TABLE IF NOT EXISTS t1 LIKE t2; +Warnings: +Note 1050 Table 't1' already exists +DROP TABLES t1,t2; diff --git a/mysql-test/main/mdev19198.test b/mysql-test/main/mdev19198.test new file mode 100644 index 00000000000..19b45ed7510 --- /dev/null +++ b/mysql-test/main/mdev19198.test @@ -0,0 +1,15 @@ +CREATE TABLE t1 (c INT); +CREATE TABLE t2 (c INT); + +LOCK TABLES t1 WRITE, t2 READ; +CREATE TABLE IF NOT EXISTS t1 LIKE t2; +UNLOCK TABLES; + +LOCK TABLES t1 READ , t2 READ; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +CREATE TABLE IF NOT EXISTS t1 LIKE t2; +UNLOCK TABLES; + +CREATE TABLE IF NOT EXISTS t1 LIKE t2; + +DROP TABLES t1,t2; diff --git a/mysql-test/main/plugin_vars.result b/mysql-test/main/plugin_vars.result index 0e382427b1d..3fadd5e74fd 100644 --- a/mysql-test/main/plugin_vars.result +++ b/mysql-test/main/plugin_vars.result @@ -30,3 +30,38 @@ disconnect con2; USE test; DROP PROCEDURE p_install; DROP PROCEDURE p_show_vars; +# +# Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERY +# +## prepared SET with a plugin variable prevents uninstall +install plugin query_response_time soname 'query_response_time'; +prepare s from 'set global query_response_time_range_base=16'; +select plugin_status from information_schema.plugins where plugin_name='query_response_time'; +plugin_status +ACTIVE +uninstall plugin query_response_time; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +execute s; +execute s; +select plugin_status from information_schema.plugins where plugin_name='query_response_time'; +plugin_status +DELETED +deallocate prepare s; +select plugin_status from information_schema.plugins where plugin_name='query_response_time'; +plugin_status +## prepared SET mentioning a plugin otherwise does not prevent uninstall +install plugin archive soname 'ha_archive'; +create table t1 (a int) engine=archive; +insert t1 values (1),(2),(3); +prepare s from 'set session auto_increment_increment=(select count(*) from t1)'; +flush tables; +select plugin_status from information_schema.plugins where plugin_name='archive'; +plugin_status +ACTIVE +uninstall plugin archive; +select plugin_status from information_schema.plugins where plugin_name='archive'; +plugin_status +execute s; +ERROR 42000: Unknown storage engine 'ARCHIVE' +drop table t1; diff --git a/mysql-test/main/plugin_vars.test b/mysql-test/main/plugin_vars.test index 8ba8fe2ec0e..797dcbea727 100644 --- a/mysql-test/main/plugin_vars.test +++ b/mysql-test/main/plugin_vars.test @@ -1,3 +1,10 @@ +if (!$QUERY_RESPONSE_TIME_SO) { + skip Needs query_response_time loadable plugin; +} +if (!$HA_ARCHIVE_SO) { + skip Needs Archive loadable plugin; +} + --echo # --echo # MDEV-5345 - Deadlock between mysql_change_user(), SHOW VARIABLES and --echo # INSTALL PLUGIN @@ -54,3 +61,31 @@ disconnect con2; USE test; DROP PROCEDURE p_install; DROP PROCEDURE p_show_vars; + +--echo # +--echo # Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERY +--echo # + +--echo ## prepared SET with a plugin variable prevents uninstall +install plugin query_response_time soname 'query_response_time'; +prepare s from 'set global query_response_time_range_base=16'; +select plugin_status from information_schema.plugins where plugin_name='query_response_time'; +uninstall plugin query_response_time; +execute s; +execute s; +select plugin_status from information_schema.plugins where plugin_name='query_response_time'; +deallocate prepare s; +select plugin_status from information_schema.plugins where plugin_name='query_response_time'; + +--echo ## prepared SET mentioning a plugin otherwise does not prevent uninstall +install plugin archive soname 'ha_archive'; +create table t1 (a int) engine=archive; +insert t1 values (1),(2),(3); +prepare s from 'set session auto_increment_increment=(select count(*) from t1)'; +flush tables; +select plugin_status from information_schema.plugins where plugin_name='archive'; +uninstall plugin archive; +select plugin_status from information_schema.plugins where plugin_name='archive'; +--error ER_UNKNOWN_STORAGE_ENGINE +execute s; +drop table t1; diff --git a/mysql-test/main/show.result b/mysql-test/main/show.result index 3dd7af5de05..d1b373d8969 100644 --- a/mysql-test/main/show.result +++ b/mysql-test/main/show.result @@ -1,3 +1,8 @@ +# +# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS +# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS +# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings +# show statistics; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'statistics' at line 1 show spatial_ref_sys @@ -10,3 +15,30 @@ show geometry_columns; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'geometry_columns' at line 1 show nonexistent; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nonexistent' at line 1 +# +# MDEV-21603 Crashing SHOW TABLES with derived table in WHERE condition +# +create table t1 (nm varchar(32), a int); +insert t1 values ('1',1),('2',2),('3',3); +show tables +where tables_in_test in (select * +from (select nm from test.t1 group by nm) dt); +Tables_in_test +show fields from test.t1 +where field in (select * from (select nm from test.t1 group by nm) dt); +Field Type Null Key Default Extra +insert t1 values ('nm',0); +show fields from test.t1 +where field in (select * from (select nm from test.t1 group by nm) dt); +Field Type Null Key Default Extra +nm varchar(32) YES NULL +show fields from test.t1 where field in +(select * from (select column_name from information_schema.columns +where table_name='t1' group by column_name) dt); +Field Type Null Key Default Extra +nm varchar(32) YES NULL +a int(11) YES NULL +drop table t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/main/show.test b/mysql-test/main/show.test index 3101f443264..f2f6efc4e45 100644 --- a/mysql-test/main/show.test +++ b/mysql-test/main/show.test @@ -1,8 +1,8 @@ -# -# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS -# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS -# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings -# +--echo # +--echo # MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS +--echo # MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS +--echo # MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings +--echo # --error ER_PARSE_ERROR show statistics; --error ER_PARSE_ERROR @@ -13,3 +13,27 @@ show system_variables; show geometry_columns; --error ER_PARSE_ERROR show nonexistent; + +--echo # +--echo # MDEV-21603 Crashing SHOW TABLES with derived table in WHERE condition +--echo # +create table t1 (nm varchar(32), a int); +insert t1 values ('1',1),('2',2),('3',3); + +show tables + where tables_in_test in (select * + from (select nm from test.t1 group by nm) dt); +show fields from test.t1 + where field in (select * from (select nm from test.t1 group by nm) dt); +insert t1 values ('nm',0); +show fields from test.t1 + where field in (select * from (select nm from test.t1 group by nm) dt); + +show fields from test.t1 where field in + (select * from (select column_name from information_schema.columns + where table_name='t1' group by column_name) dt); +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/mysql-test/main/show_explain.opt b/mysql-test/main/show_explain.opt new file mode 100644 index 00000000000..3a3bab51225 --- /dev/null +++ b/mysql-test/main/show_explain.opt @@ -0,0 +1 @@ +--enable-plugin-innodb-lock-waits --enable-plugin-innodb-trx diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test index 6f49b9cd301..515eb9efa47 100644 --- a/mysql-test/main/show_explain.test +++ b/mysql-test/main/show_explain.test @@ -863,7 +863,14 @@ select * from t1 where pk between 10 and 20 for update; # run SHOW EXPLAIN on a frozen thread connection default; let $save_wait_condition= $wait_condition; -let $wait_condition= select State='Sending data' from information_schema.processlist where id=$thr2; +let $wait_condition= +select 1 +from information_schema.INNODB_LOCK_WAITS +where + requesting_trx_id=(select trx_id + from information_schema.INNODB_TRX + where trx_mysql_thread_id=$thr2); + let $thr_default=`select connection_id()`; --source include/wait_condition.inc --echo # do: send_eval show explain for thr2; diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result index 0aa9033f477..665e787442d 100644 --- a/mysql-test/main/sp-bugs.result +++ b/mysql-test/main/sp-bugs.result @@ -116,7 +116,9 @@ Warnings: Note 1050 Table 't2' already exists DROP DATABASE testdb; USE test; -End of 5.1 tests +# +# End of 5.1 tests +# # # BUG#13489996 valgrind:conditional jump or move depends on # uninitialised values-field_blob @@ -328,3 +330,26 @@ FOR i IN 1..10 DO RETURN 1; END FOR DROP FUNCTION f1; +# +# End of 10.2 tests +# +# +# MDEV-25501 routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked +# +create table _t1 (a int); +create procedure p1() select * from _t1; +show create procedure p1; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +select * from _t1 latin1 latin1_swedish_ci latin1_swedish_ci +select routine_definition from information_schema.routines where routine_schema=database() and specific_name='p1'; +routine_definition +select * from _t1 +select body, body_utf8 from mysql.proc where name='p1'; +body body_utf8 +select * from _t1 select * from _t1 +drop procedure p1; +drop table _t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/sp-bugs.test b/mysql-test/main/sp-bugs.test index f06e9eca690..9b81fd1af61 100644 --- a/mysql-test/main/sp-bugs.test +++ b/mysql-test/main/sp-bugs.test @@ -143,7 +143,9 @@ CALL p1(); DROP DATABASE testdb; USE test; ---echo End of 5.1 tests +--echo # +--echo # End of 5.1 tests +--echo # --echo # --echo # BUG#13489996 valgrind:conditional jump or move depends on @@ -350,3 +352,22 @@ DELIMITER ;$$ SELECT f1(); SELECT body FROM mysql.proc WHERE db='test' AND specific_name='f1'; DROP FUNCTION f1; + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-25501 routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked +--echo # +create table _t1 (a int); +create procedure p1() select * from _t1; +show create procedure p1; +select routine_definition from information_schema.routines where routine_schema=database() and specific_name='p1'; +select body, body_utf8 from mysql.proc where name='p1'; +drop procedure p1; +drop table _t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 17b0af92a40..6c0dd6d4c8a 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -8466,6 +8466,21 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; +# +# BUG#30366310: USING A FUNCTION TO ASSIGN DEFAULT VALUES TO +# 2 OR MORE VARIABLES CRASHES SERVER +# +create function f1() returns bigint return now()-1| +create procedure p1() +begin +declare b, c bigint default f1(); +select b-c; +end| +call p1()| +b-c +0 +drop procedure p1| +drop function f1| #End of 10.2 tests # # MDEV-12007 Allow ROW variables as a cursor FETCH target diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index bf3a70b6283..c9528c1ccb9 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -10013,6 +10013,25 @@ DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; + +--echo # +--echo # BUG#30366310: USING A FUNCTION TO ASSIGN DEFAULT VALUES TO +--echo # 2 OR MORE VARIABLES CRASHES SERVER +--echo # + +delimiter |; +create function f1() returns bigint return now()-1| +create procedure p1() +begin + declare b, c bigint default f1(); + select b-c; +end| +call p1()| +drop procedure p1| +drop function f1| +delimiter ;| + + --echo #End of 10.2 tests --echo # diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index a6fabf7f137..27bd17e7e31 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -492,8 +492,17 @@ select * from mysql.plugin WHERE name='unexisting_udf'; name dl DROP FUNCTION unexisting_udf; ERROR 42000: FUNCTION test.unexisting_udf does not exist +# +# Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH +# +call mtr.add_suppression('Invalid row in mysql.func table'); +insert mysql.func () values (); +# restart +delete from mysql.func where name = ''; +# # End of 10.2 tests # +# # MDEV-15073: Generic UDAF parser code in server for window functions # CREATE AGGREGATE FUNCTION avgcost diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index 2e2272b2157..058f131273d 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -562,7 +562,17 @@ select * from mysql.plugin WHERE name='unexisting_udf'; --error ER_SP_DOES_NOT_EXIST DROP FUNCTION unexisting_udf; +--echo # +--echo # Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH +--echo # +call mtr.add_suppression('Invalid row in mysql.func table'); +insert mysql.func () values (); +source include/restart_mysqld.inc; +delete from mysql.func where name = ''; + +--echo # --echo # End of 10.2 tests +--echo # --echo # --echo # MDEV-15073: Generic UDAF parser code in server for window functions diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index 4005240aa49..30cbdb2c32a 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -7110,7 +7110,7 @@ CALL sp1(); x y z 000 000 000 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7148,7 +7148,7 @@ CALL sp1(); x y z 00000 00000 00000 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7186,7 +7186,7 @@ CALL sp1(); x y z 00000000 00000000 00000000 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7224,7 +7224,7 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7262,7 +7262,7 @@ CALL sp1(); x y z 00000000000000000000 00000000000000000000 00000000000000000000 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7282,7 +7282,7 @@ CALL sp1(); x y z -9999999999 -9999999999 -9999999999 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7293,7 +7293,7 @@ CALL sp1(); x y z 0 0 0 Warnings: -Note 1265 Data truncated for column 'z' at row 1 +Note 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7304,7 +7304,7 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Warning 1264 Out of range value for column 'z' at row 1 +Warning 1264 Out of range value for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7315,7 +7315,7 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Note 1265 Data truncated for column 'z' at row 1 +Note 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7326,7 +7326,7 @@ CALL sp1(); x y z 0 0 0 Warnings: -Note 1265 Data truncated for column 'z' at row 1 +Note 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7337,7 +7337,7 @@ CALL sp1(); x y z 0 0 0 Warnings: -Note 1265 Data truncated for column 'z' at row 1 +Note 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7348,7 +7348,7 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Note 1265 Data truncated for column 'z' at row 1 +Note 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN @@ -7359,7 +7359,7 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Note 1265 Data truncated for column 'z' at row 1 +Note 1265 Data truncated for column 'x' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) BEGIN diff --git a/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result new file mode 100644 index 00000000000..e9eab5401c4 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result @@ -0,0 +1,22 @@ +CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3); +BEGIN; +UPDATE t1 set b = 100 where id between 1 and 2;; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1b; +SET @save_dbug = @@SESSION.debug_dbug; +SET @@SESSION.innodb_lock_wait_timeout=2; +SET @@SESSION.debug_dbug = '+d,wsrep_instrument_BF_lock_wait'; +UPDATE t1 set b = 200 WHERE id = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET @@SESSION.debug_dbug = @save_dbug; +connection node_1; +COMMIT; +SELECT * FROM t1; +id b +0 0 +1 100 +2 100 +3 3 +disconnect node_1b; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_password.result b/mysql-test/suite/galera/r/galera_password.result new file mode 100644 index 00000000000..00ffc1df8f9 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_password.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +SHOW VARIABLES LIKE '%password%'; +Variable_name Value +default_password_lifetime 0 +disconnect_on_expired_password OFF +max_password_errors 4294967295 +old_passwords OFF +report_password +strict_password_validation ON +CREATE USER 'user123456'@'localhost'; +GRANT SELECT, INSERT, UPDATE ON test.* TO 'user123456'@'localhost'; +SET PASSWORD FOR 'user123456'@'localhost' = PASSWORD('A$10abcdDCBA123456%7'); +SHOW GRANTS FOR 'user123456'@'localhost'; +Grants for user123456@localhost +GRANT USAGE ON *.* TO `user123456`@`localhost` IDENTIFIED BY PASSWORD '*5846CF4D641598B360B3562E581586155C59F65A' +GRANT SELECT, INSERT, UPDATE ON `test`.* TO `user123456`@`localhost` +connection node_2; +SHOW GRANTS FOR 'user123456'@'localhost'; +Grants for user123456@localhost +GRANT USAGE ON *.* TO `user123456`@`localhost` IDENTIFIED BY PASSWORD '*5846CF4D641598B360B3562E581586155C59F65A' +GRANT SELECT, INSERT, UPDATE ON `test`.* TO `user123456`@`localhost` +connection node_1; +DROP USER 'user123456'@'localhost'; diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result index 05390338160..988b63e314a 100644 --- a/mysql-test/suite/galera/r/galera_wan_restart_sst.result +++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result @@ -1,8 +1,8 @@ connection node_2; connection node_1; -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 4 -1 +SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +EXPECT_4 +4 connection node_1; CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1); @@ -52,23 +52,23 @@ SELECT COUNT(*) AS EXPECT_19 FROM t1; EXPECT_19 19 connection node_2; -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 4 -1 +SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +EXPECT_4 +4 SELECT COUNT(*) AS EXPECT_19 FROM t1; EXPECT_19 19 connection node_3; -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 4 -1 +SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +EXPECT_4 +4 SELECT COUNT(*) AS EXPECT_19 FROM t1; EXPECT_19 19 connection node_4; -SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE = 4 -1 +SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +EXPECT_4 +4 SELECT COUNT(*) AS EXPECT_19 FROM t1; EXPECT_19 19 diff --git a/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test b/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test new file mode 100644 index 00000000000..f4aac7fd795 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test @@ -0,0 +1,25 @@ +--source include/galera_cluster.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB; +INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3); + +BEGIN; +--send UPDATE t1 set b = 100 where id between 1 and 2; + +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1b +SET @save_dbug = @@SESSION.debug_dbug; +SET @@SESSION.innodb_lock_wait_timeout=2; +SET @@SESSION.debug_dbug = '+d,wsrep_instrument_BF_lock_wait'; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 set b = 200 WHERE id = 1; +SET @@SESSION.debug_dbug = @save_dbug; + +--connection node_1 +--reap +COMMIT; +SELECT * FROM t1; +--disconnect node_1b +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_password.test b/mysql-test/suite/galera/t/galera_password.test new file mode 100644 index 00000000000..7843097c67e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_password.test @@ -0,0 +1,14 @@ +--source include/galera_cluster.inc + +SHOW VARIABLES LIKE '%password%'; + +CREATE USER 'user123456'@'localhost'; +GRANT SELECT, INSERT, UPDATE ON test.* TO 'user123456'@'localhost'; +SET PASSWORD FOR 'user123456'@'localhost' = PASSWORD('A$10abcdDCBA123456%7'); +SHOW GRANTS FOR 'user123456'@'localhost'; + +--connection node_2 +SHOW GRANTS FOR 'user123456'@'localhost'; + +--connection node_1 +DROP USER 'user123456'@'localhost'; diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc index 475ab96e56f..e5f7f976120 100644 --- a/mysql-test/suite/gcol/inc/gcol_keys.inc +++ b/mysql-test/suite/gcol/inc/gcol_keys.inc @@ -809,4 +809,12 @@ eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/load.data' REPLACE INTO TABLE t1 (p --remove_file $MYSQLTEST_VARDIR/tmp/load.data DROP TABLE t1; + +--echo # MDEV-19011 Assertion `file->s->base.reclength < file->s->vreclength' +--echo # failed in ha_myisam::setup_vcols_for_repair +CREATE TABLE t1 (a INT GENERATED ALWAYS AS (1) VIRTUAL) ENGINE=MyISAM; +ALTER TABLE t1 ADD KEY (a); + +DROP TABLE t1; + } diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result index 71c8ab4b190..6d93c63fc2f 100644 --- a/mysql-test/suite/gcol/r/gcol_bugfixes.result +++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result @@ -670,3 +670,77 @@ PRIMARY KEY (number) REPLACE t2(number) VALUES('1'); REPLACE t2(number) VALUES('1'); DROP TABLE t2; +# MDEV-24583 SELECT aborts after failed REPLACE into table with vcol +CREATE TABLE t1 (pk INT, a VARCHAR(3), v VARCHAR(3) AS (CONCAT('x-',a)), +PRIMARY KEY(pk)) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 (pk, a) VALUES (1,'foo'); +SET sql_mode=CONCAT(@@sql_mode,',STRICT_ALL_TABLES'); +REPLACE INTO t1 (pk,a) VALUES (1,'qux'); +SELECT * FROM v1; +pk a v +1 foo x-f +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 ( +pk INT, +a VARCHAR(1), +v VARCHAR(1) AS (CONCAT('virt-',a)) VIRTUAL, +PRIMARY KEY (pk) +) ENGINE=InnoDB; +INSERT INTO t1 (pk,a) VALUES +(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'); +REPLACE INTO t1 (pk) VALUES (1); +ERROR 22001: Data too long for column 'v' at row 1 +SELECT * FROM t1 ORDER BY a; +pk a v +1 a v +2 b v +3 c v +4 d v +5 e v +6 f v +SET SQL_MODE=DEFAULT; +DROP TABLE t1; +# (duplicate) MDEV-24656 +# [FATAL] InnoDB: Data field type 0, len 0, ASAN heap-buffer-overflow +# upon LOAD DATA with virtual columns +CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(2333), +va VARCHAR(171) AS (a)) ENGINE=InnoDB; +INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +SELECT id, va INTO OUTFILE 'load_t1' FROM t1; +LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); +ERROR 22001: Data too long for column 'va' at row 1 +SELECT * FROM t1; +id a va +1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +LOAD DATA INFILE 'load_t1' IGNORE INTO TABLE t1 (id,va); +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +DROP TABLE t1; +CREATE TABLE t1 (id BIGINT PRIMARY KEY, a VARCHAR(2333), +va VARCHAR(171) AS (a)) ENGINE=InnoDB; +INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +SELECT id, va INTO OUTFILE 'load_t1' FROM t1; +LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); +ERROR 22001: Data too long for column 'va' at row 1 +SELECT * FROM t1; +id a va +1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +LOAD DATA INFILE 'load_t1' IGNORE INTO TABLE t1 (id,va); +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +DROP TABLE t1; +# (duplicate) MDEV-24665 +# ASAN errors, assertion failures, corrupt values after failed +# LOAD DATA into table with virtual/stored column +CREATE TABLE t1 (id INT PRIMARY KEY, +ts TIMESTAMP DEFAULT '1971-01-01 00:00:00', +c VARBINARY(8) DEFAULT '', vc VARCHAR(3) AS (c) STORED); +INSERT IGNORE INTO t1 (id,c) VALUES (1,'foobar'); +Warnings: +Warning 1265 Data truncated for column 'vc' at row 1 +SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1; +LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc); +INSERT IGNORE INTO t1 (id) VALUES (2); +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result index 4f7d654ac4e..0ee6654f3a7 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result @@ -883,6 +883,11 @@ Warning 1264 Out of range value for column 'vi' at row 1 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/load.data' REPLACE INTO TABLE t1 (pk,i,ts); ERROR 22003: Out of range value for column 'vi' at row 1 DROP TABLE t1; +# MDEV-19011 Assertion `file->s->base.reclength < file->s->vreclength' +# failed in ha_myisam::setup_vcols_for_repair +CREATE TABLE t1 (a INT GENERATED ALWAYS AS (1) VIRTUAL) ENGINE=MyISAM; +ALTER TABLE t1 ADD KEY (a); +DROP TABLE t1; # # BUG#21365158 WL8149:ASSERTION `!TABLE || (!TABLE->WRITE_SET # diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result index 3f00d344901..48e11cbe222 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result @@ -883,6 +883,11 @@ Warning 1264 Out of range value for column 'vi' at row 1 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/load.data' REPLACE INTO TABLE t1 (pk,i,ts); ERROR 22003: Out of range value for column 'vi' at row 1 DROP TABLE t1; +# MDEV-19011 Assertion `file->s->base.reclength < file->s->vreclength' +# failed in ha_myisam::setup_vcols_for_repair +CREATE TABLE t1 (a INT GENERATED ALWAYS AS (1) VIRTUAL) ENGINE=MyISAM; +ALTER TABLE t1 ADD KEY (a); +DROP TABLE t1; DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2,t3; DROP PROCEDURE IF EXISTS p1; diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test index 033c430853d..a1f277199eb 100644 --- a/mysql-test/suite/gcol/t/gcol_bugfixes.test +++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test @@ -634,3 +634,87 @@ REPLACE t2(number) VALUES('1'); REPLACE t2(number) VALUES('1'); DROP TABLE t2; + +--echo # MDEV-24583 SELECT aborts after failed REPLACE into table with vcol + +CREATE TABLE t1 (pk INT, a VARCHAR(3), v VARCHAR(3) AS (CONCAT('x-',a)), + PRIMARY KEY(pk)) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 (pk, a) VALUES (1,'foo'); +SET sql_mode=CONCAT(@@sql_mode,',STRICT_ALL_TABLES'); +--error 0,ER_DATA_TOO_LONG +REPLACE INTO t1 (pk,a) VALUES (1,'qux'); +SELECT * FROM v1; + +# Cleanup +DROP VIEW v1; +DROP TABLE t1; + +CREATE TABLE t1 ( + pk INT, + a VARCHAR(1), + v VARCHAR(1) AS (CONCAT('virt-',a)) VIRTUAL, + PRIMARY KEY (pk) +) ENGINE=InnoDB; + +INSERT INTO t1 (pk,a) VALUES +(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'); + + --error ER_DATA_TOO_LONG +REPLACE INTO t1 (pk) VALUES (1); +SELECT * FROM t1 ORDER BY a; + +SET SQL_MODE=DEFAULT; +DROP TABLE t1; + +--echo # (duplicate) MDEV-24656 +--echo # [FATAL] InnoDB: Data field type 0, len 0, ASAN heap-buffer-overflow +--echo # upon LOAD DATA with virtual columns + +CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(2333), + va VARCHAR(171) AS (a)) ENGINE=InnoDB; +INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +SELECT id, va INTO OUTFILE 'load_t1' FROM t1; +--error ER_DATA_TOO_LONG +LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); +SELECT * FROM t1; +LOAD DATA INFILE 'load_t1' IGNORE INTO TABLE t1 (id,va); + +DROP TABLE t1; +--let $datadir= `select @@datadir` +--remove_file $datadir/test/load_t1 + +CREATE TABLE t1 (id BIGINT PRIMARY KEY, a VARCHAR(2333), + va VARCHAR(171) AS (a)) ENGINE=InnoDB; +INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +SELECT id, va INTO OUTFILE 'load_t1' FROM t1; +--error ER_DATA_TOO_LONG +LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); +SELECT * FROM t1; +LOAD DATA INFILE 'load_t1' IGNORE INTO TABLE t1 (id,va); + +# Cleanup +DROP TABLE t1; +--let $datadir= `select @@datadir` +--remove_file $datadir/test/load_t1 + + +--echo # (duplicate) MDEV-24665 +--echo # ASAN errors, assertion failures, corrupt values after failed +--echo # LOAD DATA into table with virtual/stored column + +CREATE TABLE t1 (id INT PRIMARY KEY, + ts TIMESTAMP DEFAULT '1971-01-01 00:00:00', + c VARBINARY(8) DEFAULT '', vc VARCHAR(3) AS (c) STORED); +INSERT IGNORE INTO t1 (id,c) VALUES (1,'foobar'); +SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1; +--error 0,ER_DATA_TOO_LONG +LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc); +INSERT IGNORE INTO t1 (id) VALUES (2); + +# Cleanup +DROP TABLE t1; +--let $datadir= `select @@datadir` +--remove_file $datadir/test/load_t1 + + diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 50fd7e3ddb5..cdec8107095 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -261,4 +261,5 @@ DROP TABLE t1, t2; --source include/wait_until_count_sessions.inc set debug_sync=reset; + SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result index cfc99650db6..0716f3da23c 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result +++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result @@ -1,3 +1,7 @@ +call mtr.add_suppression("Cannot find index f2 in InnoDB index dictionary."); +call mtr.add_suppression("InnoDB indexes are inconsistent with what defined in .frm for table .*"); +call mtr.add_suppression("Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB .*"); +call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict cache for table .*"); # # Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS # @@ -25,3 +29,43 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f2`,`f1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; +# +# MDEV-22928 InnoDB fails to fetch index type +# when index mismatch +# +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +index(f1), index(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1), (2, 2); +connect con1,localhost,root,,test; +SET DEBUG_SYNC="alter_table_inplace_after_commit SIGNAL default_signal WAIT_FOR default_done"; +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +connection default; +set DEBUG_SYNC="now WAIT_FOR default_signal"; +# restart +disconnect con1; +SHOW KEYS FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 1 f1 1 f1 A 2 NULL NULL BTREE +t1 1 f2 1 f2 A NULL NULL NULL Corrupted +Warnings: +Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +DROP TABLE t1; +# +# MDEV-25503 InnoDB hangs on startup during recovery +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1; +connect con1,localhost,root,,; +BEGIN; +DELETE FROM mysql.innodb_table_stats; +connect con2,localhost,root,,; +SET DEBUG_SYNC='inplace_after_index_build SIGNAL blocked WAIT_FOR ever'; +ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +# restart +SELECT * FROM t1; +a +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result index f183cb44ebe..42b988ed3ca 100644 --- a/mysql-test/suite/innodb/r/log_file_name.result +++ b/mysql-test/suite/innodb/r/log_file_name.result @@ -23,7 +23,6 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND 1 /InnoDB: Ignoring data file '.*t1.ibd' with space ID/ in mysqld.1.err FOUND 1 /InnoDB: Tablespace \d+ was not found at.*t3.ibd/ in mysqld.1.err # Fault 3: Wrong space_id in a dirty file, and no missing file. # restart diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test index f7635e96d50..cbf8ff9e87f 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test +++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test @@ -12,6 +12,14 @@ --source include/innodb_page_size.inc +--source include/have_debug_sync.inc + +call mtr.add_suppression("Cannot find index f2 in InnoDB index dictionary."); +call mtr.add_suppression("InnoDB indexes are inconsistent with what defined in .frm for table .*"); +call mtr.add_suppression("Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB .*"); +call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict cache for table .*"); + + --echo # --echo # Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS --echo # @@ -41,3 +49,44 @@ show create table t1; ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); show create table t1; drop table t1; + +--echo # +--echo # MDEV-22928 InnoDB fails to fetch index type +--echo # when index mismatch +--echo # +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + index(f1), index(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1), (2, 2); + +connect (con1,localhost,root,,test); +SET DEBUG_SYNC="alter_table_inplace_after_commit SIGNAL default_signal WAIT_FOR default_done"; +--send +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +connection default; +set DEBUG_SYNC="now WAIT_FOR default_signal"; +--let $shutdown_timeout=0 +--source include/restart_mysqld.inc +disconnect con1; +SHOW KEYS FROM t1; +DROP TABLE t1; +remove_files_wildcard $datadir/test #sql-*.frm; + +--echo # +--echo # MDEV-25503 InnoDB hangs on startup during recovery +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1; +connect (con1,localhost,root,,); +BEGIN; +DELETE FROM mysql.innodb_table_stats; + +connect (con2,localhost,root,,); +SET DEBUG_SYNC='inplace_after_index_build SIGNAL blocked WAIT_FOR ever'; +send ALTER TABLE t1 FORCE; + +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +--let $shutdown_timeout=0 +--source include/restart_mysqld.inc +SELECT * FROM t1; +DROP TABLE t1; +remove_files_wildcard $datadir/test #sql-*.frm; diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index 2be3f8e7c50..3abd2d65a96 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -55,9 +55,6 @@ let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Ano --source include/start_mysqld.inc eval $check_no_innodb; -let SEARCH_PATTERN= InnoDB: Ignoring data file '.*t1.ibd' with space ID; ---source include/search_pattern_in_file.inc - let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at.*t3.ibd; --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result index c192fced34e..2e22e2e5a2f 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result @@ -962,3 +962,13 @@ UPDATE t1 SET f6='cascade'; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL) DROP TABLE t1; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +# +# MDEV-25536 sym_node->table != NULL in pars_retrieve_table_def +# +CREATE TABLE t1 (f1 TEXT,FULLTEXT (f1)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SET GLOBAL innodb_ft_aux_table='test/t1'; +SELECT * FROM information_schema.innodb_ft_deleted; +DOC_ID +DROP TABLE t1; +SET GLOBAL innodb_ft_aux_table=DEFAULT; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.opt b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.opt new file mode 100644 index 00000000000..b38416a0349 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.opt @@ -0,0 +1 @@ +--innodb-ft-deleted diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test index 46b65590298..adc10886d66 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test @@ -932,3 +932,13 @@ UPDATE t1 SET f6='cascade'; DROP TABLE t1; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; + +--echo # +--echo # MDEV-25536 sym_node->table != NULL in pars_retrieve_table_def +--echo # +CREATE TABLE t1 (f1 TEXT,FULLTEXT (f1)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SET GLOBAL innodb_ft_aux_table='test/t1'; +SELECT * FROM information_schema.innodb_ft_deleted; +DROP TABLE t1; +SET GLOBAL innodb_ft_aux_table=DEFAULT; diff --git a/mysql-test/suite/rpl/r/rpl_incompatible_heartbeat.result b/mysql-test/suite/rpl/r/rpl_incompatible_heartbeat.result new file mode 100644 index 00000000000..51da761c50d --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_incompatible_heartbeat.result @@ -0,0 +1,17 @@ +include/master-slave.inc +[connection master] +connection master; +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET @@global.debug_dbug= 'd,simulate_pos_4G'; +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.001; +include/start_slave.inc +connection master; +SET @@GLOBAL.debug_dbug = @saved_dbug; +connection slave; +connection master; +CREATE TABLE t (f INT) ENGINE=INNODB; +INSERT INTO t VALUES (10); +DROP TABLE t; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_incompatible_heartbeat.test b/mysql-test/suite/rpl/t/rpl_incompatible_heartbeat.test new file mode 100644 index 00000000000..104debe707f --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_incompatible_heartbeat.test @@ -0,0 +1,44 @@ +# ==== Purpose ==== +# +# Test verifies that slave IO thread can process heartbeat events with log_pos +# values higher than UINT32_MAX. +# +# ==== Implementation ==== +# +# Steps: +# 0 - Stop slave threads. Configure a small master_heartbeat_period. +# 1 - Using debug points, simulate a huge binlog offset higher than +# UINT32_MAX on master. +# 2 - Start the slave and observe that slave IO thread is able to process +# the offset received through heartbeat event. +# +# ==== References ==== +# +# MDEV-16146: MariaDB slave stops with incompatible heartbeat +# +--source include/have_debug.inc +--source include/have_innodb.inc +--source include/have_binlog_format_mixed.inc +# Test simulates binarylog offsets higher than UINT32_MAX +--source include/have_64bit.inc +--source include/master-slave.inc + +--connection master +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET @@global.debug_dbug= 'd,simulate_pos_4G'; + +--connection slave +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.001; +--source include/start_slave.inc + +--connection master +sleep 1; +SET @@GLOBAL.debug_dbug = @saved_dbug; +--sync_slave_with_master + +--connection master +CREATE TABLE t (f INT) ENGINE=INNODB; +INSERT INTO t VALUES (10); +DROP TABLE t; +--source include/rpl_end.inc diff --git a/mysql-test/suite/vcol/r/binlog.result b/mysql-test/suite/vcol/r/binlog.result index 83382d47511..d4893b7ed3c 100644 --- a/mysql-test/suite/vcol/r/binlog.result +++ b/mysql-test/suite/vcol/r/binlog.result @@ -67,4 +67,17 @@ connection master; DROP VIEW v1; set @@binlog_row_image=default; DROP TABLE t1; +SET SQL_MODE=default; +CREATE TABLE t1 (pk INT, a VARCHAR(3), b VARCHAR(1) AS (a) VIRTUAL, PRIMARY KEY (pk)); +INSERT IGNORE INTO t1 (pk, a) VALUES (1,'foo'),(2,'bar'); +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Warning 1265 Data truncated for column 'b' at row 2 +REPLACE INTO t1 (pk) VALUES (2); +ERROR 22001: Data too long for column 'b' at row 1 +UPDATE IGNORE t1 SET a = NULL; +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Warning 1265 Data truncated for column 'b' at row 2 +DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/vcol/t/binlog.test b/mysql-test/suite/vcol/t/binlog.test index 95bb4df4cc5..aa939086f12 100644 --- a/mysql-test/suite/vcol/t/binlog.test +++ b/mysql-test/suite/vcol/t/binlog.test @@ -51,5 +51,19 @@ DROP VIEW v1; set @@binlog_row_image=default; DROP TABLE t1; +SET SQL_MODE=default; + +# MDEV-24782 +# ASAN use-after-poison in Field::pack_int / THD::binlog_update_row + +CREATE TABLE t1 (pk INT, a VARCHAR(3), b VARCHAR(1) AS (a) VIRTUAL, PRIMARY KEY (pk)); +INSERT IGNORE INTO t1 (pk, a) VALUES (1,'foo'),(2,'bar'); +--error ER_DATA_TOO_LONG +REPLACE INTO t1 (pk) VALUES (2); +UPDATE IGNORE t1 SET a = NULL; + +# Cleanup +DROP TABLE t1; + --source include/rpl_end.inc diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result index cb865a835b3..a5a6de19bc6 100644 --- a/mysql-test/suite/versioning/r/delete_history.result +++ b/mysql-test/suite/versioning/r/delete_history.result @@ -154,3 +154,36 @@ select * from t1; a 1 drop table t1; +# +# MDEV-25468 DELETE HISTORY may delete current data on system-versioned table +# +create or replace table t1 (x int) with system versioning; +insert into t1 values (1); +delete history from t1 before system_time '2039-01-01 23:00'; +select * from t1; +x +1 +explain extended delete history from t1 before system_time '2039-01-01 23:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 100.00 Using where +create or replace procedure p() delete history from t1 before system_time '2039-01-01 23:00'; +call p; +select * from t1; +x +1 +call p; +select * from t1; +x +1 +drop procedure p; +prepare stmt from "delete history from t1 before system_time '2039-01-01 23:00'"; +execute stmt; +select * from t1; +x +1 +execute stmt; +select * from t1; +x +1 +drop prepare stmt; +drop table t1; diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result index b2bb59a4150..f09284a61ae 100644 --- a/mysql-test/suite/versioning/r/trx_id.result +++ b/mysql-test/suite/versioning/r/trx_id.result @@ -498,4 +498,10 @@ add `row_end` bigint unsigned as row end, add period for system_time(`row_start`,`row_end`), modify x int after row_start, with system versioning; -create or replace database test; +drop table t; +# +# MDEV-20842 Crash using versioning plugin functions after plugin was removed from server +# +uninstall plugin test_versioning; +select trt_begin_ts(0); +ERROR 42000: FUNCTION test.trt_begin_ts does not exist diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test index fb5c8520bcb..e3b60011644 100644 --- a/mysql-test/suite/versioning/t/delete_history.test +++ b/mysql-test/suite/versioning/t/delete_history.test @@ -169,4 +169,26 @@ insert into t1 values (1); select * from t1; drop table t1; +--echo # +--echo # MDEV-25468 DELETE HISTORY may delete current data on system-versioned table +--echo # +create or replace table t1 (x int) with system versioning; +insert into t1 values (1); +delete history from t1 before system_time '2039-01-01 23:00'; +select * from t1; +explain extended delete history from t1 before system_time '2039-01-01 23:00'; +create or replace procedure p() delete history from t1 before system_time '2039-01-01 23:00'; +call p; +select * from t1; +call p; +select * from t1; +drop procedure p; +prepare stmt from "delete history from t1 before system_time '2039-01-01 23:00'"; +execute stmt; +select * from t1; +execute stmt; +select * from t1; +drop prepare stmt; +drop table t1; + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/trx_id.opt b/mysql-test/suite/versioning/t/trx_id.opt deleted file mode 100644 index b55a187cb13..00000000000 --- a/mysql-test/suite/versioning/t/trx_id.opt +++ /dev/null @@ -1 +0,0 @@ ---plugin-load-add=$TEST_VERSIONING_SO diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index db691a7ec19..7c22aa2a8be 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -5,6 +5,10 @@ if (!$TEST_VERSIONING_SO) --source include/have_innodb.inc --source include/default_charset.inc +--disable_query_log +--eval install plugin test_versioning soname '$TEST_VERSIONING_SO' +--enable_query_log + set default_storage_engine= innodb; create or replace table t1 ( @@ -495,6 +499,11 @@ alter table t add `row_start` bigint unsigned as row start, add period for system_time(`row_start`,`row_end`), modify x int after row_start, with system versioning; +drop table t; - -create or replace database test; +--echo # +--echo # MDEV-20842 Crash using versioning plugin functions after plugin was removed from server +--echo # +uninstall plugin test_versioning; +--error ER_SP_DOES_NOT_EXIST +select trt_begin_ts(0); |