diff options
Diffstat (limited to 'storage/spider/mysql-test')
15 files changed, 259 insertions, 9 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/disabled.def b/storage/spider/mysql-test/spider/bugfix/disabled.def index e19ea07b76b..2314e88ea0c 100644 --- a/storage/spider/mysql-test/spider/bugfix/disabled.def +++ b/storage/spider/mysql-test/spider/bugfix/disabled.def @@ -1 +1,2 @@ wait_timeout : MDEV-26045 +mdev_29676 : MDEV-31138 diff --git a/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc b/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc deleted file mode 100644 index a5446a6188d..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/include/restart_spider.inc +++ /dev/null @@ -1,8 +0,0 @@ ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect - ---exec echo "wait" > $_expect_file_name ---shutdown_server ---source include/wait_until_disconnected.inc ---exec echo "restart" > $_expect_file_name ---enable_reconnect ---source include/wait_until_connected_again.inc diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result index 5715edf2bd6..975d3834d42 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result @@ -9,4 +9,5 @@ CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so'; ERROR HY000: Can't execute the query because you have a conflicting read lock SELECT * FROM t; c +# restart DROP TABLE t; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result new file mode 100644 index 00000000000..b52cecc5bb7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result @@ -0,0 +1,41 @@ +# +# MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings() +# +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +connection child2_1; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +CREATE TABLE tbl_a ( +a CHAR(5) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL sql_mode=''; +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +CREATE TABLE tbl_a ( +a CHAR(255) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +SET sql_mode=''; +INSERT INTO tbl_a VALUES ("this will be truncated"); +NOT FOUND /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err +SET GLOBAL spider_log_result_errors=4; +INSERT INTO tbl_a VALUES ("this will be truncated"); +FOUND 1 /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err +connection master_1; +SET GLOBAL spider_log_result_errors=DEFAULT; +SET sql_mode=DEFAULT; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +SET GLOBAL sql_mode=DEFAULT; +DROP DATABASE IF EXISTS auto_test_remote; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29676.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29676.result new file mode 100644 index 00000000000..72c624c926b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29676.result @@ -0,0 +1,47 @@ +# +# MDEV-29676 Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE +# +for master_1 +for child2 +for child3 +CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +# length-0 self-reference + +CREATE TABLE t (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t"'; +CREATE OR REPLACE TABLE t (c INT); +Warnings: +Error 1205 Lock wait timeout exceeded; try restarting transaction +Error 12722 Table test.t open lock wait timeout. Please check for self-reference. +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t; + +# length-2 self-reference + +CREATE TABLE t2 (c int); +CREATE TABLE t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +CREATE TABLE t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"'; +ALTER TABLE t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"'; +CREATE OR REPLACE TABLE t0 (c int); +Warnings: +Error 1205 Lock wait timeout exceeded; try restarting transaction +Error 12722 Table test.t1 open lock wait timeout. Please check for self-reference. +SHOW CREATE TABLE t0; +Table Create Table +t0 CREATE TABLE `t0` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CREATE OR REPLACE TABLE t1 (c int); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop TABLE t0, t1, t2; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result new file mode 100644 index 00000000000..c89309a514d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result @@ -0,0 +1,4 @@ +# +# MDEV-29904 SPIDER plugin initialization fails upon startup +# +# restart: --plugin-load-add=ha_spider diff --git a/storage/spider/mysql-test/spider/bugfix/r/self_reference_multi.result b/storage/spider/mysql-test/spider/bugfix/r/self_reference_multi.result new file mode 100644 index 00000000000..c4399ddf9d2 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/self_reference_multi.result @@ -0,0 +1,21 @@ +for master_1 +for child2 +for child3 + +MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait forever + +CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +create table t2 (c int); +create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +create table t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"'; +alter table t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"'; +select * from t0; +ERROR HY000: An infinite loop is detected when opening table test.t0 +select * from t1; +ERROR HY000: An infinite loop is detected when opening table test.t0 +select * from t2; +ERROR HY000: An infinite loop is detected when opening table test.t0 +drop table t0, t1, t2; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result index e84d42bbc8a..ffccf2d5ef1 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result +++ b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result @@ -50,6 +50,10 @@ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argum argument set session time_zone = '+00:00';set @`spider_lc_./auto_test_remote/tbl_a` = '-xxxxxxxxxxxx-xxxxx-./auto_test_local/tbl_a-' SET NAMES utf8mb3 +set @old_lock_wait_timeout=@@session.lock_wait_timeout;set session lock_wait_timeout=1 +set session lock_wait_timeout=@old_lock_wait_timeout +set @old_lock_wait_timeout=@@session.lock_wait_timeout;set session lock_wait_timeout=1 +set session lock_wait_timeout=@old_lock_wait_timeout set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%set %' SELECT pkey FROM tbl_a ORDER BY pkey; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test index 00d8ee73ebc..626364efb99 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test @@ -6,6 +6,6 @@ FLUSH TABLES WITH READ LOCK; CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so'; SELECT * FROM t; ---source include/restart_spider.inc +--source include/restart_mysqld.inc DROP TABLE t; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test new file mode 100644 index 00000000000..3a8fbb251e1 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test @@ -0,0 +1,56 @@ +--echo # +--echo # MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings() +--echo # + +# The test case below does not cause the potential null pointer dereference. +# It is just for checking spider_db_mbase::fetch_and_print_warnings() works. + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +--connection child2_1 +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +eval CREATE TABLE tbl_a ( + a CHAR(5) +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +SET GLOBAL sql_mode=''; + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; +eval CREATE TABLE tbl_a ( + a CHAR(255) +) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; + +SET sql_mode=''; + +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.1.err; +let SEARCH_PATTERN= \[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*; + +INSERT INTO tbl_a VALUES ("this will be truncated"); +--source include/search_pattern_in_file.inc # should not find + +SET GLOBAL spider_log_result_errors=4; + +INSERT INTO tbl_a VALUES ("this will be truncated"); +--source include/search_pattern_in_file.inc # should find + +--connection master_1 +SET GLOBAL spider_log_result_errors=DEFAULT; +SET sql_mode=DEFAULT; +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +SET GLOBAL sql_mode=DEFAULT; +DROP DATABASE IF EXISTS auto_test_remote; + +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_query_log +--enable_result_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29676.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29676.test new file mode 100644 index 00000000000..565d95dfaac --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29676.test @@ -0,0 +1,41 @@ +--echo # +--echo # MDEV-29676 Dual thread hang in 'closing tables' and 'Waiting for table metadata lock' on Spider CREATE OR REPLACE TABLE +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +--replace_regex /SOCKET ".*"/SOCKET "$MASTER_1_MYSOCK"/ +eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +--echo +--echo # length-0 self-reference +--echo +CREATE TABLE t (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t"'; +CREATE OR REPLACE TABLE t (c INT); +SHOW CREATE TABLE t; +DROP TABLE t; + +--echo +--echo # length-2 self-reference +--echo +CREATE TABLE t2 (c int); +CREATE TABLE t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +CREATE TABLE t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"'; +ALTER TABLE t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"'; +# warnings +CREATE OR REPLACE TABLE t0 (c int); +SHOW CREATE TABLE t0; +# no warnings +CREATE OR REPLACE TABLE t1 (c int); +SHOW CREATE TABLE t1; +drop TABLE t0, t1, t2; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test new file mode 100644 index 00000000000..d3dcb363890 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test @@ -0,0 +1,6 @@ +--echo # +--echo # MDEV-29904 SPIDER plugin initialization fails upon startup +--echo # + +--let $restart_parameters=--plugin-load-add=ha_spider +--source include/restart_mysqld.inc diff --git a/storage/spider/mysql-test/spider/bugfix/t/self_reference_multi.test b/storage/spider/mysql-test/spider/bugfix/t/self_reference_multi.test new file mode 100644 index 00000000000..8b6f070d167 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/self_reference_multi.test @@ -0,0 +1,29 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait forever +--echo + +--replace_regex /SOCKET ".*"/SOCKET "$MASTER_1_MYSOCK"/ +eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +create table t2 (c int); +create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +create table t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"'; +alter table t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"'; +--error 12719 +select * from t0; +--error 12719 +select * from t1; +--error 12719 +select * from t2; +drop table t0, t1, t2; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result index 28aaf74fa3d..c48d68758bf 100644 --- a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result +++ b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result @@ -53,6 +53,10 @@ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argum argument set session time_zone = '+00:00';set @`spider_lc_./auto_test_remote/tbl_a` = '-xxxxxxxxxxxx-xxxxx-./auto_test_local/tbl_a-' SET NAMES utf8mb3 +set @old_lock_wait_timeout=@@session.lock_wait_timeout;set session lock_wait_timeout=1 +set session lock_wait_timeout=@old_lock_wait_timeout +set @old_lock_wait_timeout=@@session.lock_wait_timeout;set session lock_wait_timeout=1 +set session lock_wait_timeout=@old_lock_wait_timeout set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%set %' SELECT pkey FROM tbl_a ORDER BY pkey; |