From ef7de3e840101abdd83f2773367a2d9d6636d8a2 Mon Sep 17 00:00:00 2001 From: Kentoku Date: Thu, 11 Apr 2019 18:03:22 +0900 Subject: MDEV-19003 ignore send to remote It's just added regression tests. --- .../regression/e1121/include/item_cache_deinit.inc | 11 +++ .../regression/e1121/include/item_cache_init.inc | 26 ++++++ .../mysql-test/spider/regression/e1121/my.cnf | 3 + .../mysql-test/spider/regression/e1121/my_1_1.cnf | 44 +++++++++ .../mysql-test/spider/regression/e1121/my_2_1.cnf | 56 +++++++++++ .../spider/regression/e1121/r/item_cache.result | 104 +++++++++++++++++++++ .../mysql-test/spider/regression/e1121/suite.opt | 1 + .../mysql-test/spider/regression/e1121/suite.pm | 12 +++ .../spider/regression/e1121/t/item_cache.test | 76 +++++++++++++++ 9 files changed, 333 insertions(+) create mode 100644 storage/spider/mysql-test/spider/regression/e1121/include/item_cache_deinit.inc create mode 100644 storage/spider/mysql-test/spider/regression/e1121/include/item_cache_init.inc create mode 100644 storage/spider/mysql-test/spider/regression/e1121/my.cnf create mode 100644 storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf create mode 100644 storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf create mode 100644 storage/spider/mysql-test/spider/regression/e1121/r/item_cache.result create mode 100644 storage/spider/mysql-test/spider/regression/e1121/suite.opt create mode 100644 storage/spider/mysql-test/spider/regression/e1121/suite.pm create mode 100644 storage/spider/mysql-test/spider/regression/e1121/t/item_cache.test diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/item_cache_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/item_cache_deinit.inc new file mode 100644 index 00000000000..f8405973768 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/item_cache_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/item_cache_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/item_cache_init.inc new file mode 100644 index 00000000000..a86382232af --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/include/item_cache_init.inc @@ -0,0 +1,26 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + dt datetime NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (dt) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey, dt FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/regression/e1121/my.cnf b/storage/spider/mysql-test/spider/regression/e1121/my.cnf new file mode 100644 index 00000000000..47558d85fc6 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/my.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/regression/e1121/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf new file mode 100644 index 00000000000..5f17295d895 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf @@ -0,0 +1,44 @@ +[mysqld.1.1] +log-bin= master-bin +loose_handlersocket_port= 20000 +loose_handlersocket_port_wr= 20001 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 +loose_partition= 1 + +[ENV] +USE_GEOMETRY_TEST= 1 +USE_FULLTEXT_TEST= 1 +USE_HA_TEST= 1 +USE_GENERAL_LOG= 1 +USE_REPLICATION= 1 +MASTER_1_MYPORT= @mysqld.1.1.port +MASTER_1_HSRPORT= 20000 +MASTER_1_HSWPORT= 20001 +MASTER_1_MYSOCK= @mysqld.1.1.socket +MASTER_1_ENGINE_TYPE= Spider +#MASTER_1_ENGINE_TYPE= MyISAM +MASTER_1_ENGINE= ENGINE=Spider +MASTER_1_CHARSET= DEFAULT CHARSET=utf8 +MASTER_1_ENGINE2= ENGINE=MyISAM +MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 +MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +STR_SEMICOLON= ; + +#The followings are set in include/init_xxx.inc files +# MASTER_1_COMMENT_2_1 +# MASTER_1_COMMENT2_2_1 +# MASTER_1_COMMENT3_2_1 +# MASTER_1_COMMENT4_2_1 +# MASTER_1_COMMENT5_2_1 +# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf new file mode 100644 index 00000000000..24161645607 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf @@ -0,0 +1,56 @@ +[mysqld.2.1] +loose_handlersocket_port= 20002 +loose_handlersocket_port_wr= 20003 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +USE_CHILD_GROUP2= 1 +OUTPUT_CHILD_GROUP2= 0 +CHILD2_1_MYPORT= @mysqld.2.1.port +CHILD2_1_HSRPORT= 20002 +CHILD2_1_HSWPORT= 20003 +CHILD2_1_MYSOCK= @mysqld.2.1.socket +CHILD2_1_ENGINE_TYPE= InnoDB +CHILD2_1_ENGINE= ENGINE=InnoDB +CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +CHILD2_1_FT_MYPORT= @mysqld.2.1.port +CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket +CHILD2_1_FT_ENGINE_TYPE= MyISAM +CHILD2_1_FT_ENGINE= ENGINE=MyISAM +CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_GM_MYPORT= @mysqld.2.1.port +CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket +CHILD2_1_GM_ENGINE_TYPE= MyISAM +CHILD2_1_GM_ENGINE= ENGINE=MyISAM +CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_1_DROP_TABLES +# CHILD2_1_CREATE_TABLES +# CHILD2_1_SELECT_TABLES +# CHILD2_1_DROP_TABLES2 +# CHILD2_1_CREATE_TABLES2 +# CHILD2_1_SELECT_TABLES2 +# CHILD2_1_DROP_TABLES3 +# CHILD2_1_CREATE_TABLES3 +# CHILD2_1_SELECT_TABLES3 +# CHILD2_1_DROP_TABLES4 +# CHILD2_1_CREATE_TABLES4 +# CHILD2_1_SELECT_TABLES4 +# CHILD2_1_DROP_TABLES5 +# CHILD2_1_CREATE_TABLES5 +# CHILD2_1_SELECT_TABLES5 +# CHILD2_1_DROP_TABLES6 +# CHILD2_1_CREATE_TABLES6 +# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/item_cache.result b/storage/spider/mysql-test/spider/regression/e1121/r/item_cache.result new file mode 100644 index 00000000000..fda178f21e5 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/r/item_cache.result @@ -0,0 +1,104 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-16279 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +dt datetime NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (dt) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey, dt) VALUES (0, '2012-01-01'),(1, '2012-02-01'),(2, '2012-03-01'),(3, '2012-04-01'),(4, '2012-05-01'),(5, '2012-06-01'),(6, '2012-07-01'),(7, '2012-08-01'),(8, '2012-09-01'),(9, '2012-10-01'); +INSERT INTO tbl_a (pkey, dt) VALUES (10, '2013-01-01'),(11, '2013-02-01'),(12, '2013-03-01'),(13, '2013-04-01'),(14, '2013-05-01'),(15, '2013-06-01'),(16, '2013-07-01'),(17, '2013-08-01'),(18, '2013-09-01'),(19, '2013-10-01'); +INSERT INTO tbl_a (pkey, dt) VALUES (20, '2012-11-01'),(21, '2012-12-01'),(22, '2012-11-30'),(23, '2012-11-29'),(24, '2012-11-28'),(25, '2012-11-27'),(26, '2012-11-26'),(27, '2012-11-25'),(28, '2012-11-24'),(29, '2012-11-23'); +FLUSH TABLES; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT pkey, dt FROM tbl_a WHERE dt > SUBDATE('2012-12-31 23:59:59', 31); +pkey dt +21 2012-12-01 00:00:00 +10 2013-01-01 00:00:00 +11 2013-02-01 00:00:00 +12 2013-03-01 00:00:00 +13 2013-04-01 00:00:00 +14 2013-05-01 00:00:00 +15 2013-06-01 00:00:00 +16 2013-07-01 00:00:00 +17 2013-08-01 00:00:00 +18 2013-09-01 00:00:00 +19 2013-10-01 00:00:00 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select t0.`pkey` `pkey`,t0.`dt` `dt` from `auto_test_remote`.`tbl_a` t0 where (t0.`dt` > '2012-11-30 23:59:59') +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey, dt FROM tbl_a ORDER BY pkey; +pkey dt +0 2012-01-01 00:00:00 +1 2012-02-01 00:00:00 +2 2012-03-01 00:00:00 +3 2012-04-01 00:00:00 +4 2012-05-01 00:00:00 +5 2012-06-01 00:00:00 +6 2012-07-01 00:00:00 +7 2012-08-01 00:00:00 +8 2012-09-01 00:00:00 +9 2012-10-01 00:00:00 +10 2013-01-01 00:00:00 +11 2013-02-01 00:00:00 +12 2013-03-01 00:00:00 +13 2013-04-01 00:00:00 +14 2013-05-01 00:00:00 +15 2013-06-01 00:00:00 +16 2013-07-01 00:00:00 +17 2013-08-01 00:00:00 +18 2013-09-01 00:00:00 +19 2013-10-01 00:00:00 +20 2012-11-01 00:00:00 +21 2012-12-01 00:00:00 +22 2012-11-30 00:00:00 +23 2012-11-29 00:00:00 +24 2012-11-28 00:00:00 +25 2012-11-27 00:00:00 +26 2012-11-26 00:00:00 +27 2012-11-25 00:00:00 +28 2012-11-24 00:00:00 +29 2012-11-23 00:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/regression/e1121/suite.opt b/storage/spider/mysql-test/spider/regression/e1121/suite.opt new file mode 100644 index 00000000000..672a3b37d4f --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/suite.opt @@ -0,0 +1 @@ +--loose-innodb --loose-skip-performance-schema diff --git a/storage/spider/mysql-test/spider/regression/e1121/suite.pm b/storage/spider/mysql-test/spider/regression/e1121/suite.pm new file mode 100644 index 00000000000..f106147deb6 --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/suite.pm @@ -0,0 +1,12 @@ +package My::Suite::Spider; + +@ISA = qw(My::Suite); + +return "No Spider engine" unless $ENV{HA_SPIDER_SO}; +return "Not run for embedded server" if $::opt_embedded_server; +return "Test needs --big-test" unless $::opt_big_test; + +sub is_default { 1 } + +bless { }; + diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/item_cache.test b/storage/spider/mysql-test/spider/regression/e1121/t/item_cache.test new file mode 100644 index 00000000000..c4c13ce79ab --- /dev/null +++ b/storage/spider/mysql-test/spider/regression/e1121/t/item_cache.test @@ -0,0 +1,76 @@ +--source ../include/item_cache_init.inc +--echo +--echo this test is for MDEV-16279 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + dt datetime NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (dt) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + dt datetime NOT NULL, + PRIMARY KEY (pkey), + KEY idx1 (dt) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey, dt) VALUES (0, '2012-01-01'),(1, '2012-02-01'),(2, '2012-03-01'),(3, '2012-04-01'),(4, '2012-05-01'),(5, '2012-06-01'),(6, '2012-07-01'),(7, '2012-08-01'),(8, '2012-09-01'),(9, '2012-10-01'); +INSERT INTO tbl_a (pkey, dt) VALUES (10, '2013-01-01'),(11, '2013-02-01'),(12, '2013-03-01'),(13, '2013-04-01'),(14, '2013-05-01'),(15, '2013-06-01'),(16, '2013-07-01'),(17, '2013-08-01'),(18, '2013-09-01'),(19, '2013-10-01'); +INSERT INTO tbl_a (pkey, dt) VALUES (20, '2012-11-01'),(21, '2012-12-01'),(22, '2012-11-30'),(23, '2012-11-29'),(24, '2012-11-28'),(25, '2012-11-27'),(26, '2012-11-26'),(27, '2012-11-25'),(28, '2012-11-24'),(29, '2012-11-23'); +FLUSH TABLES; + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT pkey, dt FROM tbl_a WHERE dt > SUBDATE('2012-12-31 23:59:59', 31); + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/item_cache_deinit.inc +--echo +--echo end of test -- cgit v1.2.1