diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /storage/spider/mysql-test/spider/t | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/spider/mysql-test/spider/t')
68 files changed, 15894 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/t/auto_increment.test b/storage/spider/mysql-test/spider/t/auto_increment.test new file mode 100644 index 00000000..c5f272f5 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/auto_increment.test @@ -0,0 +1,187 @@ +--source auto_increment_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + col_a INT NOT NULL AUTO_INCREMENT, + col_b VARCHAR(20) DEFAULT 'defg', + col_c INT NOT NULL DEFAULT 100, + PRIMARY KEY(col_a) +) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + col_a INT NOT NULL AUTO_INCREMENT, + col_b VARCHAR(20) DEFAULT 'defg', + col_c INT NOT NULL DEFAULT 100, + PRIMARY KEY(col_a) +) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1; +--enable_query_log +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +ALTER TABLE tbl_a MODIFY col_c MEDIUMINT NOT NULL DEFAULT 100; +SHOW CREATE TABLE tbl_a; +RENAME TABLE tbl_a TO tbl_x; +SHOW CREATE TABLE tbl_x; +RENAME TABLE tbl_x TO tbl_a; +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT1; +eval $MASTER_1_AUTO_INCREMENT1; +--enable_query_log +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT2; +eval $MASTER_1_AUTO_INCREMENT2; +--enable_query_log +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT * FROM tbl_a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source auto_increment_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc new file mode 100644 index 00000000..52be67a1 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc @@ -0,0 +1,13 @@ +--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 +--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP +--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_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/t/auto_increment_init.inc b/storage/spider/mysql-test/spider/t/auto_increment_init.inc new file mode 100644 index 00000000..52245bdd --- /dev/null +++ b/storage/spider/mysql-test/spider/t/auto_increment_init.inc @@ -0,0 +1,38 @@ +--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='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'; +let $MASTER_1_AUTO_INCREMENT_2_1= + AUTO_INCREMENT=20; +let $MASTER_1_AUTO_INCREMENT1= + ALTER TABLE tbl_a AUTO_INCREMENT=30; +let $MASTER_1_AUTO_INCREMENT2= + ALTER TABLE tbl_a AUTO_INCREMENT=10; +let $CHILD2_1_CHARSET_AUTO_INCREMENT= + AUTO_INCREMENT=20; +--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 ( + col_a INT NOT NULL AUTO_INCREMENT, + col_b VARCHAR(20) DEFAULT 'def', + col_c INT NOT NULL DEFAULT 10, + PRIMARY KEY(col_a) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET_AUTO_INCREMENT $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2 +--let $OUTPUT_CHILD_GROUP2= 1 +--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG +--let $USE_GENERAL_LOG= 1 diff --git a/storage/spider/mysql-test/spider/t/basic_sql.test b/storage/spider/mysql-test/spider/t/basic_sql.test new file mode 100644 index 00000000..b5a9b2f4 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/basic_sql.test @@ -0,0 +1,2714 @@ +# This test tests by executing basic SQL +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tb_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2; +eval CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +--enable_query_log +INSERT INTO tb_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +SELECT a, b, c FROM tb_l; +if ($MASTER_1_MERGE) +{ + --error ER_WRONG_OBJECT + eval CREATE TABLE ta_l ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 + SELECT a, b, c FROM tb_l; + eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; + INSERT INTO ta_l SELECT a, b, c FROM tb_l; +} +if (!$MASTER_1_MERGE) +{ + eval CREATE TABLE ta_l ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 + SELECT a, b, c FROM tb_l; +} +--enable_query_log +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo create table ignore select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +DROP TABLE IF EXISTS tb_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2; +eval CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +--enable_query_log +INSERT INTO tb_l (a, b, c) VALUES + (1, 'f', '2008-07-01 10:21:39'), + (2, 'g', '2000-02-01 00:00:00'), + (3, 'j', '2007-05-04 20:03:11'), + (4, 'i', '2003-10-30 05:01:03'), + (5, 'h', '2001-10-31 23:59:59'); +--disable_query_log +echo CREATE TABLE ta_l ( + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +IGNORE SELECT a, b, c FROM tb_l; +if ($MASTER_1_MERGE) +{ + --error ER_WRONG_OBJECT + eval CREATE TABLE ta_l ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 + IGNORE SELECT a, b, c FROM tb_l; + eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; + INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l; +} +if (!$MASTER_1_MERGE) +{ + eval CREATE TABLE ta_l ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 + IGNORE SELECT a, b, c FROM tb_l; +} +--enable_query_log +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo create table ignore select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +REPLACE SELECT a, b, c FROM tb_l; +if ($MASTER_1_MERGE) +{ + --error ER_WRONG_OBJECT + eval CREATE TABLE ta_l ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 + REPLACE SELECT a, b, c FROM tb_l; + eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; + REPLACE INTO ta_l SELECT a, b, c FROM tb_l; +} +if (!$MASTER_1_MERGE) +{ + eval CREATE TABLE ta_l ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 + REPLACE SELECT a, b, c FROM tb_l; +} +--enable_query_log +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo create no index table +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l_no_idx; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l_no_idx +MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 +SELECT a, b, c FROM tb_l; +if ($MASTER_1_NEEDPK) +{ + --error ER_REQUIRES_PRIMARY_KEY + eval CREATE TABLE ta_l_no_idx + $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 + SELECT a, b, c FROM tb_l; + eval CREATE TABLE ta_l_no_idx ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; + INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; +} +if (!$MASTER_1_NEEDPK) +{ + if ($MASTER_1_MERGE) + { + --error ER_WRONG_OBJECT + eval CREATE TABLE ta_l_no_idx + $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 + SELECT a, b, c FROM tb_l; + eval CREATE TABLE ta_l_no_idx ( + a INT, + b CHAR(1), + c DATETIME + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; + INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; + } + if (!$MASTER_1_MERGE) + { + eval CREATE TABLE ta_l_no_idx + $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 + SELECT a, b, c FROM tb_l; + } +} +--enable_query_log +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES3; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; + +--echo +--echo select table +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select table shared mode +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a +LOCK IN SHARE MODE; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select table for update +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a +FOR UPDATE; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select table join +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b +WHERE a.a = b.a ORDER BY a.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select table straight_join +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') +FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select sql_small_result +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select sql_big_result +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select sql_buffer_result +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select sql_cache +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select sql_no_cache +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select sql_calc_found_rows +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a LIMIT 4; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT found_rows(); +--enable_ps2_protocol + +--echo +--echo select high_priority +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select distinct +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select count +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT count(*) FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select table join not use index +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE +EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select using pushdown +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE +a.b = 'g' ORDER BY a.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select using index and pushdown +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE +a.a > 0 AND a.b = 'g' ORDER BY a.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo insert +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert select +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert select a +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), +'e', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert low_priority +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert high_priority +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', +'2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert ignore +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert update (insert) +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE +KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo insert update (update) +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE +KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo replace +--connection master_1 +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo replace select +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo replace select a +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), +'e', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo replace low_priority +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', +'2009-03-03 03:03:03'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update select +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM +tb_l); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update select a +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM +tb_l ORDER BY a LIMIT 1); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update join +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update join a +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE +a.a = b.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update low_priority +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update ignore +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update pushdown +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo update index pushdown +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM ta_l WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete all +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete select +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete select a +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete join +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete low_priority +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete ignore +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE IGNORE FROM ta_l WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete quick +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE QUICK FROM ta_l WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete pushdown +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM ta_l WHERE b = 'e'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo delete index pushdown +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), +(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), +(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), +(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), +(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), +(10, 'j', '2008-01-01 23:59:59'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM ta_l WHERE a > 0 AND b = 'e'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo truncate +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--connection master_1 +create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER + COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"'; +drop table t2345678911234567892123456789312345678941234567895123234234; + +--echo # +--echo # MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes +--echo # +create table mdev_26139 (id int) ENGINE=SPIDER + COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'"; +drop table mdev_26139; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/basic_sql_part.test b/storage/spider/mysql-test/spider/t/basic_sql_part.test new file mode 100644 index 00000000..1bb18358 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/basic_sql_part.test @@ -0,0 +1,571 @@ +# This test tests by executing basic SQL +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +if (!$HAVE_PARTITION) +{ + --disable_query_log + --disable_result_log + --source test_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tb_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2; +eval CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +--enable_query_log +INSERT INTO tb_l (a, b, c) VALUES + (1, 'f', '2008-07-01 10:21:39'), + (2, 'g', '2000-02-01 00:00:00'), + (3, 'j', '2007-05-04 20:03:11'), + (4, 'i', '2003-10-30 05:01:03'), + (5, 'h', '2001-10-31 23:59:59'); + +--echo +--echo create table with partition and select test +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l2 ( + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 + SELECT a, b, c FROM tb_l; + if ($MASTER_1_MERGE) + { + --error ER_WRONG_OBJECT + eval CREATE TABLE ta_l2 ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 + SELECT a, b, c FROM tb_l; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; + INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; + } + if (!$MASTER_1_MERGE) + { + eval CREATE TABLE ta_l2 ( + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 + SELECT a, b, c FROM tb_l; + } + --enable_query_log + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +} + +--echo +--echo select partition using pushdown +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE + a.b = 'g' ORDER BY a.a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo select partition using index pushdown +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE + a.a > 0 AND a.b = 'g' ORDER BY a.a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo update partition pushdown +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +} + +--echo +--echo update partition index pushdown +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +} + +--echo +--echo delete partition pushdown +if ($HAVE_PARTITION) +{ + TRUNCATE TABLE ta_l2; + INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + DELETE FROM ta_l2 WHERE b = 'g'; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +} + +--echo +--echo delete partition index pushdown +if ($HAVE_PARTITION) +{ + TRUNCATE TABLE ta_l2; + INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test new file mode 100644 index 00000000..e0fa7a84 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test @@ -0,0 +1,128 @@ +--source ../include/checksum_table_with_quick_mode_3_init.inc +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + 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 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_CREATE_TABLES; + } + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +FLUSH TABLES; + +--echo +--echo select test 1 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +CHECKSUM TABLE tbl_a EXTENDED; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --disable_ps2_protocol + eval $CHILD2_1_SELECT_ARGUMENT1; + --enable_ps2_protocol + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/checksum_table_with_quick_mode_3_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/t/connect_child2_1.inc new file mode 100644 index 00000000..15e26031 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_child2_1.inc @@ -0,0 +1,2 @@ +--connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) +--connect (child2_1_2, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/t/connect_child2_2.inc new file mode 100644 index 00000000..75a50821 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_child2_2.inc @@ -0,0 +1,2 @@ +--connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) +--connect (child2_2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/t/connect_child2_3.inc new file mode 100644 index 00000000..d356348d --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_child2_3.inc @@ -0,0 +1 @@ +--connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/t/connect_child3_1.inc new file mode 100644 index 00000000..03e5c188 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_child3_1.inc @@ -0,0 +1 @@ +--connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/t/connect_child3_2.inc new file mode 100644 index 00000000..d62a7ada --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_child3_2.inc @@ -0,0 +1 @@ +--connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/t/connect_child3_3.inc new file mode 100644 index 00000000..fb49f5bf --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_child3_3.inc @@ -0,0 +1 @@ +--connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_master_1.inc b/storage/spider/mysql-test/spider/t/connect_master_1.inc new file mode 100644 index 00000000..0c129ce5 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_master_1.inc @@ -0,0 +1 @@ +--connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/t/connect_slave1_1.inc new file mode 100644 index 00000000..45a82274 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/connect_slave1_1.inc @@ -0,0 +1 @@ +--connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate.test b/storage/spider/mysql-test/spider/t/direct_aggregate.test new file mode 100644 index 00000000..0acff3f6 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_aggregate.test @@ -0,0 +1,191 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + +--echo +--echo direct_aggregating test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SELECT COUNT(*) FROM ta_l; +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SELECT MAX(a) FROM ta_l; +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SELECT MIN(a) FROM ta_l; +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SELECT MAX(a) FROM ta_l WHERE a < 5; +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SELECT MIN(a) FROM ta_l WHERE a > 1; +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +--enable_ps2_protocol + +SET spider_direct_aggregate=0; +SELECT COUNT(*) FROM ta_l; +SELECT MAX(a) FROM ta_l; +SELECT MIN(a) FROM ta_l; +SELECT MAX(a) FROM ta_l WHERE a < 5; +SELECT MIN(a) FROM ta_l WHERE a > 1; +eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SET spider_direct_aggregate=1; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test new file mode 100644 index 00000000..8f4c72dc --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test @@ -0,0 +1,211 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +if (!$HAVE_PARTITION) +{ + --disable_query_log + --disable_result_log + --source test_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo with partition test +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; + INSERT INTO ta_l2 (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + --enable_query_log + --disable_ps2_protocol + set @old_spider_direct_aggregate=@@session.spider_direct_aggregate; + set spider_direct_aggregate=1; + + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + SELECT COUNT(*) FROM ta_l2; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + SELECT SUM(a) FROM ta_l2; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + SELECT MAX(a) FROM ta_l2; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + SELECT MIN(a) FROM ta_l2; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + SELECT MAX(a) FROM ta_l2 WHERE a < 5; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + SELECT MIN(a) FROM ta_l2 WHERE a > 1; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + --enable_ps2_protocol + + SET spider_direct_aggregate=0; + SELECT COUNT(*) FROM ta_l2; + SELECT SUM(a) FROM ta_l2; + SELECT MAX(a) FROM ta_l2; + SELECT MIN(a) FROM ta_l2; + SELECT MAX(a) FROM ta_l2 WHERE a < 5; + SELECT MIN(a) FROM ta_l2 WHERE a > 1; + eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; + + set spider_direct_aggregate=@old_spider_direct_aggregate; + + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_join.test b/storage/spider/mysql-test/spider/t/direct_join.test new file mode 100644 index 00000000..634b958f --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_join.test @@ -0,0 +1,347 @@ +--source ../include/direct_join_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES5; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c FROM tbl_a a, tbl_b b, tbl_c c WHERE a.a = b.a and a.a = c.a ORDER BY a.b DESC LIMIT 1,2; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo Test JOIN on a constant table. +--echo Spider should NOT push down the join because the tbl_person table +--echo is optimized as a constant table. +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_CONST_TABLE_JOIN; + echo CHILD2_1_DROP_CONST_TABLE2_JOIN; + echo CHILD2_1_CREATE_CONST_TABLE_JOIN; + echo CHILD2_1_CREATE_CONST_TABLE2_JOIN; + } + --disable_warnings + eval $CHILD2_1_DROP_CONST_TABLE_JOIN; + eval $CHILD2_1_DROP_CONST_TABLE2_JOIN; + --enable_warnings + eval $CHILD2_1_CREATE_CONST_TABLE_JOIN; + eval $CHILD2_1_CREATE_CONST_TABLE2_JOIN; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_person; +DROP TABLE IF EXISTS tbl_ncd_cm_person; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_person ( + id VARCHAR(50) NOT NULL, + hr_status VARCHAR(50) NULL DEFAULT NULL, + region_code VARCHAR(50) NULL DEFAULT NULL, + region INT(11) NOT NULL, + PRIMARY KEY (id, region) USING BTREE + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE_JOIN + MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE_JOIN; +eval CREATE TABLE tbl_person ( + id VARCHAR(50) NOT NULL, + hr_status VARCHAR(50) NULL DEFAULT NULL, + region_code VARCHAR(50) NULL DEFAULT NULL, + region INT(11) NOT NULL, + PRIMARY KEY (id, region) USING BTREE + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_CONST_TABLE_JOIN + $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN $MASTER_1_PART_CONST_TABLE_JOIN; +echo SHOW CREATE TABLE tbl_person; +SHOW CREATE TABLE tbl_person; +echo CREATE TABLE tbl_ncd_cm_person ( + id VARCHAR(50) NOT NULL, + person_id VARCHAR(50) NULL DEFAULT '', + diseaseKind_id VARCHAR(50) NULL DEFAULT NULL, + region INT(11) NOT NULL, + PRIMARY KEY (id, region) USING BTREE + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE2_JOIN + MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE2_JOIN; +eval CREATE TABLE tbl_ncd_cm_person ( + id VARCHAR(50) NOT NULL, + person_id VARCHAR(50) NULL DEFAULT '', + diseaseKind_id VARCHAR(50) NULL DEFAULT NULL, + region INT(11) NOT NULL, + PRIMARY KEY (id, region) USING BTREE + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_CONST_TABLE2_JOIN + $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN $MASTER_1_PART_CONST_TABLE2_JOIN; +echo SHOW CREATE TABLE tbl_ncd_cm_person; +SHOW CREATE TABLE tbl_ncd_cm_person; +--enable_query_log +INSERT INTO tbl_person VALUES ('24FC3F0A5119432BAE13DD65AABAA39C', + '1', '123-51041110620301-321', 510411); +INSERT INTO tbl_person VALUES ('123456789012345678901234567890AB', + '1', '123-51041110620301-321', 510411); +INSERT INTO tbl_ncd_cm_person VALUES ('123456789', + '24FC3F0A5119432BAE13DD65AABAA39C', + '52A0328740914BCE86ED10A4D2521816', + 510411); +INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB', + '123456789012345678901234567890AB', + '52A0328740914BCE86ED10A4D2521816', + 510411); +DELETE FROM tbl_ncd_cm_person; +INSERT INTO tbl_ncd_cm_person VALUES ('123456789', + '24FC3F0A5119432BAE13DD65AABAA39C', + '52A0328740914BCE86ED10A4D2521816', + 510411); +INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB', + '123456789012345678901234567890AB', + '52A0328740914BCE86ED10A4D2521816', + 510411); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT count(0) FROM tbl_person tp INNER JOIN tbl_ncd_cm_person tncp ON tp.id = tncp.person_id WHERE 1 = 1 AND tp.hr_status != "99" AND tp.hr_status != "2" AND tp.region_code LIKE CONCAT(CONCAT('%', '51041110620301', '%')) AND tp.id = '24FC3F0A5119432BAE13DD65AABAA39C' AND tncp.diseaseKind_id = '52A0328740914BCE86ED10A4D2521816' AND tp.region = 510411; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_CONST_TABLE_JOIN; + eval $CHILD2_1_SELECT_CONST_TABLE2_JOIN; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_join_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_join_using.test b/storage/spider/mysql-test/spider/t/direct_join_using.test new file mode 100644 index 00000000..3ecfb292 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_join_using.test @@ -0,0 +1,199 @@ +--source ../include/direct_join_using_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES5; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_join_using_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_left_join.test b/storage/spider/mysql-test/spider/t/direct_left_join.test new file mode 100644 index 00000000..c9784b04 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_left_join.test @@ -0,0 +1,199 @@ +--source ../include/direct_left_join_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES5; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_left_join_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test new file mode 100644 index 00000000..7c69d73d --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test @@ -0,0 +1,214 @@ +--source ../include/direct_left_join_nullable_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES4; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES4; + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES4; + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +echo CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; +eval CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); +insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'); +insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_left_join_nullable_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test new file mode 100644 index 00000000..dd407482 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test @@ -0,0 +1,214 @@ +--source ../include/direct_left_right_join_nullable_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES4; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES4; + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES4; + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +echo CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; +eval CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); +insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'); +insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_left_right_join_nullable_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test new file mode 100644 index 00000000..3de0c310 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test @@ -0,0 +1,214 @@ +--source ../include/direct_left_right_left_join_nullable_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES4; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES4; + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES4; + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +echo CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; +eval CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); +insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'); +insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_left_right_left_join_nullable_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_right_join.test b/storage/spider/mysql-test/spider/t/direct_right_join.test new file mode 100644 index 00000000..d124f75a --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_right_join.test @@ -0,0 +1,199 @@ +--source ../include/direct_right_join_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES5; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); +insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_right_join_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test new file mode 100644 index 00000000..cdb2d4e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test @@ -0,0 +1,214 @@ +--source ../include/direct_right_join_nullable_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES4; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES4; + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES4; + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +echo CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; +eval CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); +insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'); +insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_right_join_nullable_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test new file mode 100644 index 00000000..cff40bfd --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test @@ -0,0 +1,214 @@ +--source ../include/direct_right_left_join_nullable_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES4; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES4; + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES4; + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +echo CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; +eval CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); +insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'); +insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_right_left_join_nullable_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test new file mode 100644 index 00000000..cd677a4b --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test @@ -0,0 +1,214 @@ +--source ../include/direct_right_left_right_join_nullable_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_DROP_TABLES3; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES6; + echo CHILD2_1_CREATE_TABLES4; + echo CHILD2_1_CREATE_TABLES3; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES6; + eval $CHILD2_1_DROP_TABLES4; + eval $CHILD2_1_DROP_TABLES3; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES6; + eval $CHILD2_1_CREATE_TABLES4; + eval $CHILD2_1_CREATE_TABLES3; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE tbl_b ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +echo CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; +eval CREATE TABLE tbl_c ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + KEY idx0(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +echo CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; +eval CREATE TABLE tbl_d ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10' +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +--enable_query_log +insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); +insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); +insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'); +insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC; + +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/direct_right_left_right_join_nullable_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_update.test b/storage/spider/mysql-test/spider/t/direct_update.test new file mode 100644 index 00000000..94f27e28 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_update.test @@ -0,0 +1,198 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + +--echo +--echo direct_updating test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo update all rows with function +UPDATE ta_l SET c = ADDDATE(c, 1); +eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo update by primary key +UPDATE ta_l SET b = 'x' WHERE a = 3; +eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo update by a column without index +UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; +eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo update by primary key with order and limit +UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; +eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo delete by primary key with order and limit +DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; +eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo delete by a column without index +DELETE FROM ta_l WHERE b = 'c'; +eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +--echo delete by primary key +DELETE FROM ta_l WHERE a = 3; +eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/direct_update_part.test b/storage/spider/mysql-test/spider/t/direct_update_part.test new file mode 100644 index 00000000..e8f18825 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/direct_update_part.test @@ -0,0 +1,211 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +if (!$HAVE_PARTITION) +{ + --disable_query_log + --disable_result_log + --source test_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo with partition test +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; + INSERT INTO ta_l2 (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + --enable_query_log + eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo update all rows with function + UPDATE ta_l2 SET c = ADDDATE(c, 1); + eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo update by primary key + UPDATE ta_l2 SET b = 'x' WHERE a = 3; + eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo update by a column without index + UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; + eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo update by primary key with order and limit + UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; + eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo delete by primary key with order and limit + DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; + eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo delete by a column without index + DELETE FROM ta_l2 WHERE b = 'c'; + eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + --echo delete by primary key + DELETE FROM ta_l2 WHERE a = 3; + eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/error_row_number.test b/storage/spider/mysql-test/spider/t/error_row_number.test new file mode 100644 index 00000000..408e7396 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/error_row_number.test @@ -0,0 +1,37 @@ +--echo # +--echo # MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table +--echo # + +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--connection child2_1 +create database auto_test_remote; +use auto_test_remote; +create table ta_r (id int primary key); + +--connection master_1 +evalp create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; + +--error ER_DUP_ENTRY +insert into spd values (1),(2),(1); +get diagnostics condition 1 @n = row_number; +select @n; + +delete from spd; +insert into spd values (1),(2),(3),(13); +--error ER_DUP_ENTRY +update spd set id = id + 10; +get diagnostics condition 1 @n = row_number; +select @n; + +drop table spd; +--connection child2_1 +drop database auto_test_remote; +--connection master_1 +--disable_query_log +--disable_result_log +--source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/function.test b/storage/spider/mysql-test/spider/t/function.test new file mode 100644 index 00000000..2472e774 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/function.test @@ -0,0 +1,253 @@ +# This test tests for using functions +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo in() +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TEXT_PK_TABLES1; + echo CHILD2_1_CREATE_TEXT_PK_TABLES1; + } + --disable_warnings + eval $CHILD2_1_DROP_TEXT_PK_TABLES1; + --enable_warnings + eval $CHILD2_1_CREATE_TEXT_PK_TABLES1; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE t1 ( + a VARCHAR(255), + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1; +eval CREATE TABLE t1 ( + a VARCHAR(255), + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1; +--enable_query_log +insert into t1 values ('1'); +insert into t1 select a + 1 from t1; +insert into t1 select a + 2 from t1; +insert into t1 select a + 4 from t1; +insert into t1 select a + 8 from t1; +insert into t1 select a + 16 from t1; +insert into t1 select a + 32 from t1; +insert into t1 select a + 64 from t1; +insert into t1 select a + 128 from t1; +insert into t1 select a + 256 from t1; +insert into t1 select a + 512 from t1; +flush tables; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +select a from t1 where a in ('15', '120'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo date_sub() +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/ha.test b/storage/spider/mysql-test/spider/t/ha.test new file mode 100644 index 00000000..1924b908 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/ha.test @@ -0,0 +1,882 @@ +# This test tests for ha features +if ($USE_HA_TEST) +{ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--source ha_test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; + CREATE DATABASE auto_test_remote3; + USE auto_test_remote3; +} +if ($USE_CHILD_GROUP3) +{ + --connection child3_1 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; + --connection child3_2 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; + --connection child3_3 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + --connection child2_3 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + SELECT 1; + --connection child3_2 + SELECT 1; + --connection child3_3 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_2_1; + --enable_warnings + eval $CHILD3_1_CREATE_TABLES_HA_2_1; + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_2_1; + --enable_warnings + eval $CHILD3_2_CREATE_TABLES_HA_2_1; + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_2_1; + --enable_warnings + eval $CHILD3_3_CREATE_TABLES_HA_2_1; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo fail-over test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_HA_DROP_TABLES; + } + --disable_warnings + eval $CHILD2_2_HA_DROP_TABLES; + --enable_warnings + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +eval $MASTER_1_CHECK_HA_STATUS; +--error 12511 +INSERT INTO ta_l (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); +eval $MASTER_1_CHECK_LINK_STATUS; +eval $MASTER_1_CHECK_LINK_FAILED_LOG; +eval $MASTER_1_CHECK_HA_STATUS; +INSERT INTO ta_l (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_CHECK_LINK_STATUS; + eval $CHILD3_1_CHECK_LINK_FAILED_LOG; + --connection child3_2 + eval $CHILD3_2_CHECK_LINK_STATUS; + eval $CHILD3_2_CHECK_LINK_FAILED_LOG; + --connection child3_3 + eval $CHILD3_3_CHECK_LINK_STATUS; + eval $CHILD3_3_CHECK_LINK_FAILED_LOG; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo recovery test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_HA_CREATE_TABLES; + } + eval $CHILD2_2_HA_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_SET_RECOVERY_STATUS_2_1; + eval $CHILD3_1_CHECK_LINK_STATUS; + --connection child3_2 + eval $CHILD3_2_SET_RECOVERY_STATUS_2_1; + eval $CHILD3_2_CHECK_LINK_STATUS; + --connection child3_3 + eval $CHILD3_3_SET_RECOVERY_STATUS_2_1; + eval $CHILD3_3_CHECK_LINK_STATUS; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +eval $MASTER_1_SET_RECOVERY_STATUS_2_1; +eval $MASTER_1_CHECK_LINK_STATUS; +eval $MASTER_1_COPY_TABLES_2_1; +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_SET_OK_STATUS_2_1; + eval $CHILD3_1_CHECK_LINK_STATUS; + --connection child3_2 + eval $CHILD3_2_SET_OK_STATUS_2_1; + eval $CHILD3_2_CHECK_LINK_STATUS; + --connection child3_3 + eval $CHILD3_3_SET_OK_STATUS_2_1; + eval $CHILD3_3_CHECK_LINK_STATUS; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +eval $MASTER_1_SET_OK_STATUS_2_1; +eval $MASTER_1_CHECK_LINK_STATUS; +INSERT INTO ta_l (a, b, c) VALUES + (8, 'g', '2011-05-05 21:33:30'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +DROP TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_2_1; + --enable_warnings + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_2_1; + --enable_warnings + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_2_1; + --enable_warnings + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +eval $MASTER_1_CHANGE_HA_MON; +--enable_ps2_protocol + +--echo +--echo active standby test +--echo create table test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_2_1; + --enable_warnings + eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1; + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_2_1; + --enable_warnings + eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1; + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_2_1; + --enable_warnings + eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo fail-over test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_HA_AS_DROP_TABLES; + } + --disable_warnings + eval $CHILD2_1_HA_AS_DROP_TABLES; + --enable_warnings + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +eval $MASTER_1_CHECK_HA_STATUS; +--error 12511 +INSERT INTO ta_l (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); +eval $MASTER_1_CHECK_LINK_STATUS; +eval $MASTER_1_CHECK_LINK_FAILED_LOG; +eval $MASTER_1_CHECK_HA_STATUS; +INSERT INTO ta_l (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_CHECK_LINK_STATUS; + eval $CHILD3_1_CHECK_LINK_FAILED_LOG; + --connection child3_2 + eval $CHILD3_2_CHECK_LINK_STATUS; + eval $CHILD3_2_CHECK_LINK_FAILED_LOG; + --connection child3_3 + eval $CHILD3_3_CHECK_LINK_STATUS; + eval $CHILD3_3_CHECK_LINK_FAILED_LOG; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo recovery test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_HA_AS_CREATE_TABLES; + } + eval $CHILD2_1_HA_AS_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_SET_OK_STATUS_AS_2_1; + eval $CHILD3_1_CHECK_LINK_STATUS; + --connection child3_2 + eval $CHILD3_2_SET_OK_STATUS_AS_2_1; + eval $CHILD3_2_CHECK_LINK_STATUS; + --connection child3_3 + eval $CHILD3_3_SET_OK_STATUS_AS_2_1; + eval $CHILD3_3_CHECK_LINK_STATUS; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +eval $MASTER_1_SET_OK_STATUS_AS_2_1; +eval $MASTER_1_CHECK_LINK_STATUS; +INSERT INTO ta_l (a, b, c) VALUES + (8, 'g', '2011-05-05 21:33:30'); +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +DROP TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_2_1; + --enable_warnings + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_2_1; + --enable_warnings + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_2_1; + --enable_warnings + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +eval $MASTER_1_CHANGE_HA_MON; +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; +} +if ($USE_CHILD_GROUP3) +{ + --connection child3_1 + DROP DATABASE IF EXISTS auto_test_local; + --connection child3_2 + DROP DATABASE IF EXISTS auto_test_local; + --connection child3_3 + DROP DATABASE IF EXISTS auto_test_local; +} +--disable_query_log +--disable_result_log +--source ha_test_deinit.inc +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +} +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/ha_part.test b/storage/spider/mysql-test/spider/t/ha_part.test new file mode 100644 index 00000000..21b5837c --- /dev/null +++ b/storage/spider/mysql-test/spider/t/ha_part.test @@ -0,0 +1,1024 @@ +# This test tests for ha features +if ($USE_HA_TEST) +{ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--source ha_test_init.inc +--enable_result_log +--enable_query_log +if (!$HAVE_PARTITION) +{ + --disable_query_log + --disable_result_log + --source ha_test_deinit.inc + --source test_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; + CREATE DATABASE auto_test_remote3; + USE auto_test_remote3; +} +if ($USE_CHILD_GROUP3) +{ + --connection child3_1 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; + --connection child3_2 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; + --connection child3_3 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + --connection child2_3 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_CHILD_GROUP3) +{ + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + SELECT 1; + --connection child3_2 + SELECT 1; + --connection child3_3 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } +} + +if ($HAVE_PARTITION) +{ + --echo + --echo create table with partition test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_DROP_TABLES; + echo CHILD2_3_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_3_DROP_TABLES; + --enable_warnings + eval $CHILD2_3_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_P_2_1; + --enable_warnings + eval $CHILD3_1_CREATE_TABLES_HA_P_2_1; + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_P_2_1; + --enable_warnings + eval $CHILD3_2_CREATE_TABLES_HA_P_2_1; + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_P_2_1; + --enable_warnings + eval $CHILD3_3_CREATE_TABLES_HA_P_2_1; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_warnings + DROP TABLE IF EXISTS ta_l2; + --enable_warnings + --disable_query_log + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1; + --enable_query_log + INSERT INTO ta_l2 (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + + --echo + --echo select test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + + --echo + --echo fail-over test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_HA_DROP_TABLES; + } + --disable_warnings + eval $CHILD2_3_HA_DROP_TABLES; + --enable_warnings + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + eval $MASTER_1_CHECK_HA_STATUS; + --error 12511 + INSERT INTO ta_l2 (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); + eval $MASTER_1_CHECK_LINK_STATUS; + eval $MASTER_1_CHECK_LINK_FAILED_LOG; + eval $MASTER_1_CHECK_HA_STATUS; + INSERT INTO ta_l2 (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_CHECK_LINK_STATUS; + eval $CHILD3_1_CHECK_LINK_FAILED_LOG; + --connection child3_2 + eval $CHILD3_2_CHECK_LINK_STATUS; + eval $CHILD3_2_CHECK_LINK_FAILED_LOG; + --connection child3_3 + eval $CHILD3_3_CHECK_LINK_STATUS; + eval $CHILD3_3_CHECK_LINK_FAILED_LOG; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + + --echo + --echo recovery test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_HA_CREATE_TABLES; + } + eval $CHILD2_3_HA_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1; + eval $CHILD3_1_CHECK_LINK_STATUS; + --connection child3_2 + eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1; + eval $CHILD3_2_CHECK_LINK_STATUS; + --connection child3_3 + eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1; + eval $CHILD3_3_CHECK_LINK_STATUS; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1; + eval $MASTER_1_CHECK_LINK_STATUS; + eval $MASTER_1_COPY_TABLES_P_2_1; + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_SET_OK_STATUS_P_2_1; + eval $CHILD3_1_CHECK_LINK_STATUS; + --connection child3_2 + eval $CHILD3_2_SET_OK_STATUS_P_2_1; + eval $CHILD3_2_CHECK_LINK_STATUS; + --connection child3_3 + eval $CHILD3_3_SET_OK_STATUS_P_2_1; + eval $CHILD3_3_CHECK_LINK_STATUS; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + eval $MASTER_1_SET_OK_STATUS_P_2_1; + eval $MASTER_1_CHECK_LINK_STATUS; + INSERT INTO ta_l2 (a, b, c) VALUES + (8, 'g', '2011-05-05 21:33:30'), + (9, 'h', '2011-05-05 22:32:10'); + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + DROP TABLE ta_l2; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_P_2_1; + --enable_warnings + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_P_2_1; + --enable_warnings + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_P_2_1; + --enable_warnings + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } +} + +if ($HAVE_PARTITION) +{ + --echo + --echo create table with partition test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_DROP_TABLES; + echo CHILD2_3_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_3_DROP_TABLES; + --enable_warnings + eval $CHILD2_3_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_P_2_1; + --enable_warnings + eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1; + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_P_2_1; + --enable_warnings + eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1; + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_P_2_1; + --enable_warnings + eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_warnings + DROP TABLE IF EXISTS ta_l2; + --enable_warnings + --disable_query_log + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1; + --enable_query_log + INSERT INTO ta_l2 (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + + --echo + --echo select test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + + --echo + --echo fail-over test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_HA_AS_DROP_TABLES2; + } + --disable_warnings + eval $CHILD2_1_HA_AS_DROP_TABLES2; + --enable_warnings + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + eval $MASTER_1_CHECK_HA_STATUS; + --error 12511 + INSERT INTO ta_l2 (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); + eval $MASTER_1_CHECK_LINK_STATUS; + eval $MASTER_1_CHECK_LINK_FAILED_LOG; + eval $MASTER_1_CHECK_HA_STATUS; + INSERT INTO ta_l2 (a, b, c) VALUES + (6, 'e', '2011-05-05 20:04:05'); + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_CHECK_LINK_STATUS; + eval $CHILD3_1_CHECK_LINK_FAILED_LOG; + --connection child3_2 + eval $CHILD3_2_CHECK_LINK_STATUS; + eval $CHILD3_2_CHECK_LINK_FAILED_LOG; + --connection child3_3 + eval $CHILD3_3_CHECK_LINK_STATUS; + eval $CHILD3_3_CHECK_LINK_FAILED_LOG; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + + --echo + --echo recovery test + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_HA_AS_CREATE_TABLES2; + } + eval $CHILD2_1_HA_AS_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1; + eval $CHILD3_1_CHECK_LINK_STATUS; + --connection child3_2 + eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1; + eval $CHILD3_2_CHECK_LINK_STATUS; + --connection child3_3 + eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1; + eval $CHILD3_3_CHECK_LINK_STATUS; + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + eval $MASTER_1_SET_OK_STATUS_AS_P_2_1; + eval $MASTER_1_CHECK_LINK_STATUS; + INSERT INTO ta_l2 (a, b, c) VALUES + (8, 'g', '2011-05-05 21:33:30'), + (9, 'h', '2011-05-05 22:32:10'); + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; + DROP TABLE ta_l2; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + if ($USE_CHILD_GROUP3) + { + if (!$OUTPUT_CHILD_GROUP3) + { + --disable_query_log + --disable_result_log + } + --connection child3_1 + --disable_warnings + eval $CHILD3_1_DROP_TABLES_HA_P_2_1; + --enable_warnings + --connection child3_2 + --disable_warnings + eval $CHILD3_2_DROP_TABLES_HA_P_2_1; + --enable_warnings + --connection child3_3 + --disable_warnings + eval $CHILD3_3_DROP_TABLES_HA_P_2_1; + --enable_warnings + if (!$OUTPUT_CHILD_GROUP3) + { + --enable_query_log + --enable_result_log + } + } +} + +--connection master_1 + +CREATE TABLE t (c INT) PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER); +SHOW FIELDS FROM t; +SHOW FIELDS FROM t; +DROP TABLE t; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; +} +if ($USE_CHILD_GROUP3) +{ + --connection child3_1 + DROP DATABASE IF EXISTS auto_test_local; + --connection child3_2 + DROP DATABASE IF EXISTS auto_test_local; + --connection child3_3 + DROP DATABASE IF EXISTS auto_test_local; +} +--disable_query_log +--disable_result_log +--source ha_test_deinit.inc +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +} +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/t/ha_test_deinit.inc new file mode 100644 index 00000000..53d0409d --- /dev/null +++ b/storage/spider/mysql-test/spider/t/ha_test_deinit.inc @@ -0,0 +1,30 @@ +# get connection and exist engine test +--echo for master_1 +--connection master_1 +--source ../include/ha_deinit_master_1.inc +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --connection child2_1 + --source ../include/ha_deinit_child2_1.inc + --echo child2_2 + --connection child2_2 + --source ../include/ha_deinit_child2_2.inc + --echo child2_3 + --connection child2_3 + --source ../include/ha_deinit_child2_3.inc +} +--echo for child3 +if ($USE_CHILD_GROUP3) +{ + --echo child3_1 + --connection child3_1 + --source ../include/ha_deinit_child3_1.inc + --echo child3_2 + --connection child3_2 + --source ../include/ha_deinit_child3_2.inc + --echo child3_3 + --connection child3_3 + --source ../include/ha_deinit_child3_3.inc +} diff --git a/storage/spider/mysql-test/spider/t/ha_test_init.inc b/storage/spider/mysql-test/spider/t/ha_test_init.inc new file mode 100644 index 00000000..70576ab1 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/ha_test_init.inc @@ -0,0 +1,30 @@ +# get connection and exist engine test +--echo for master_1 +--connection master_1 +--source ../include/ha_init_master_1.inc +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --connection child2_1 + --source ../include/ha_init_child2_1.inc + --echo child2_2 + --connection child2_2 + --source ../include/ha_init_child2_2.inc + --echo child2_3 + --connection child2_3 + --source ../include/ha_init_child2_3.inc +} +--echo for child3 +if ($USE_CHILD_GROUP3) +{ + --echo child3_1 + --connection child3_1 + --source ../include/ha_init_child3_1.inc + --echo child3_2 + --connection child3_2 + --source ../include/ha_init_child3_2.inc + --echo child3_3 + --connection child3_3 + --source ../include/ha_init_child3_3.inc +} diff --git a/storage/spider/mysql-test/spider/t/have_engine.inc b/storage/spider/mysql-test/spider/t/have_engine.inc new file mode 100644 index 00000000..64bef749 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/have_engine.inc @@ -0,0 +1,7 @@ +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = '$TEST_ENGINE_TYPE'`) +{ + SELECT engine, support FROM information_schema.engines; + --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" +} diff --git a/storage/spider/mysql-test/spider/t/have_func.inc b/storage/spider/mysql-test/spider/t/have_func.inc new file mode 100644 index 00000000..e0823e73 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/have_func.inc @@ -0,0 +1,5 @@ +if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) +{ + SELECT name FROM mysql.func; + --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" +} diff --git a/storage/spider/mysql-test/spider/t/have_partition.inc b/storage/spider/mysql-test/spider/t/have_partition.inc new file mode 100644 index 00000000..b6e69947 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/have_partition.inc @@ -0,0 +1,7 @@ +let $HAVE_PARTITION= 0; +if (`SELECT count(*) FROM information_schema.plugins WHERE + plugin_status = 'ACTIVE' AND + plugin_name = 'partition'`) +{ + let $HAVE_PARTITION= 1; +} diff --git a/storage/spider/mysql-test/spider/t/have_plugin.inc b/storage/spider/mysql-test/spider/t/have_plugin.inc new file mode 100644 index 00000000..316ede9e --- /dev/null +++ b/storage/spider/mysql-test/spider/t/have_plugin.inc @@ -0,0 +1,5 @@ +if (!`SELECT count(*) FROM information_schema.plugins WHERE plugin_name = '$TEST_PLUGIN_NAME'`) +{ + SELECT plugin_name FROM information_schema.plugins; + --let $SKIP_REASON= "Need $TEST_PLUGIN_NAME plugin" +} diff --git a/storage/spider/mysql-test/spider/t/have_trigger.inc b/storage/spider/mysql-test/spider/t/have_trigger.inc new file mode 100644 index 00000000..32de484b --- /dev/null +++ b/storage/spider/mysql-test/spider/t/have_trigger.inc @@ -0,0 +1,2 @@ +let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables + WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; diff --git a/storage/spider/mysql-test/spider/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/t/hs_test_deinit.inc new file mode 100644 index 00000000..7ec2e981 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/hs_test_deinit.inc @@ -0,0 +1,17 @@ +# get connection and exist engine test +--echo for master_1 +--connection master_1 +--source ../include/hs_deinit_master_1.inc +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --connection child2_1 + --source ../include/hs_deinit_child2_1.inc + --echo child2_2 + --connection child2_2 + --source ../include/hs_deinit_child2_2.inc + --echo child2_3 + --connection child2_3 + --source ../include/hs_deinit_child2_3.inc +} diff --git a/storage/spider/mysql-test/spider/t/hs_test_init.inc b/storage/spider/mysql-test/spider/t/hs_test_init.inc new file mode 100644 index 00000000..831bf479 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/hs_test_init.inc @@ -0,0 +1,17 @@ +# get connection and exist engine test +--echo for master_1 +--connection master_1 +--source ../include/hs_init_master_1.inc +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --connection child2_1 + --source ../include/hs_init_child2_1.inc + --echo child2_2 + --connection child2_2 + --source ../include/hs_init_child2_2.inc + --echo child2_3 + --connection child2_3 + --source ../include/hs_init_child2_3.inc +} diff --git a/storage/spider/mysql-test/spider/t/partition_cond_push.test b/storage/spider/mysql-test/spider/t/partition_cond_push.test new file mode 100644 index 00000000..e47209ef --- /dev/null +++ b/storage/spider/mysql-test/spider/t/partition_cond_push.test @@ -0,0 +1,221 @@ +--source ../include/partition_cond_push_init.inc +if (!$HAVE_PARTITION) +{ + --source ../include/partition_cond_push_deinit.inc + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote3; + CREATE DATABASE auto_test_remote3; + USE auto_test_remote3; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_DROP_TABLES; + echo CHILD2_3_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_3_DROP_TABLES; + --enable_warnings + eval $CHILD2_3_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + value int NOT NULL +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + value int NOT NULL +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (value) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (value) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (value) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT value FROM tbl_a WHERE value < 100; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_3_SELECT_ARGUMENT1; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/partition_cond_push_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/partition_fulltext.test b/storage/spider/mysql-test/spider/t/partition_fulltext.test new file mode 100644 index 00000000..1b31fa05 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/partition_fulltext.test @@ -0,0 +1,225 @@ +--source ../include/partition_fulltext_init.inc +if (!$HAVE_PARTITION) +{ + --source ../include/partition_fulltext_deinit.inc + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote3; + CREATE DATABASE auto_test_remote3; + USE auto_test_remote3; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_DROP_TABLES; + echo CHILD2_3_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_3_DROP_TABLES; + --enable_warnings + eval $CHILD2_3_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + words text NOT NULL, + PRIMARY KEY (pkey), + FULLTEXT (words) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + words text NOT NULL, + PRIMARY KEY (pkey), + FULLTEXT (words) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey, words) VALUES (0, 'abc'),(1, 'def'),(2, 'ghi'),(3, 'jkl'),(4, 'mno'),(5, 'pqr'),(6, 'stu'),(7, 'vwx'); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT pkey, words FROM tbl_a WHERE match(words) against('+ghi' in boolean mode); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_3_SELECT_ARGUMENT1; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/partition_fulltext_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test b/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test new file mode 100644 index 00000000..753014d5 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test @@ -0,0 +1,224 @@ +--source ../include/partition_join_pushdown_for_single_partition_init.inc +if (!$HAVE_PARTITION) +{ + --source ../include/partition_join_pushdown_for_single_partition_deinit.inc + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote3; + CREATE DATABASE auto_test_remote3; + USE auto_test_remote3; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_DROP_TABLES2; + echo CHILD2_2_CREATE_TABLES; + echo CHILD2_2_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + eval $CHILD2_2_DROP_TABLES2; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + eval $CHILD2_2_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_DROP_TABLES; + echo CHILD2_3_DROP_TABLES2; + echo CHILD2_3_CREATE_TABLES; + echo CHILD2_3_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_3_DROP_TABLES; + eval $CHILD2_3_DROP_TABLES2; + --enable_warnings + eval $CHILD2_3_CREATE_TABLES; + eval $CHILD2_3_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + value int NOT NULL, + PRIMARY KEY(value) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + value int NOT NULL, + PRIMARY KEY(value) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + value2 int NOT NULL, + PRIMARY KEY(value2) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; +eval CREATE TABLE tbl_b ( + value2 int NOT NULL, + PRIMARY KEY(value2) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +--enable_query_log + +insert into tbl_a values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +insert into tbl_b values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +--connection master_1 +--disable_ps2_protocol +SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = b.value2 AND a.value = 5; +SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = 5 and b.value2 = 5; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_3_SELECT_ARGUMENT1; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/partition_join_pushdown_for_single_partition_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/partition_mrr.test b/storage/spider/mysql-test/spider/t/partition_mrr.test new file mode 100644 index 00000000..840c19d2 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/partition_mrr.test @@ -0,0 +1,239 @@ +--source include/no_protocol.inc +--source ../include/partition_mrr_init.inc +if (!$HAVE_PARTITION) +{ + --source ../include/partition_mrr_deinit.inc + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; + --connection child2_3 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote3; + CREATE DATABASE auto_test_remote3; + USE auto_test_remote3; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_3 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_3_DROP_TABLES; + echo CHILD2_3_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_3_DROP_TABLES; + --enable_warnings + eval $CHILD2_3_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey+0 = b.pkey+0 ORDER BY a.pkey; # MDEV-29947 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { +--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { +--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_3 + if ($USE_GENERAL_LOG) + { +--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_3_SELECT_ARGUMENT1; + } + eval $CHILD2_3_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_3 + DROP DATABASE IF EXISTS auto_test_remote3; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/partition_mrr_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/pushdown_not_like.test b/storage/spider/mysql-test/spider/t/pushdown_not_like.test new file mode 100644 index 00000000..45b88e52 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/pushdown_not_like.test @@ -0,0 +1,139 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + TRUNCATE TABLE mysql.general_log; + set global log_output = 'TABLE'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2018-11-01 10:21:39'), + (2, 'b', '2015-06-30 23:59:59'), + (3, 'c', '2013-11-01 01:01:01'); + +--echo +--echo spider not like bug fix test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_ps2_protocol +select * from ta_l where b not like 'a%'; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select%'; + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + SET GLOBAL log_output = @old_log_output; +} + + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/quick_mode_0.test b/storage/spider/mysql-test/spider/t/quick_mode_0.test new file mode 100644 index 00000000..070d9e40 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/quick_mode_0.test @@ -0,0 +1,300 @@ +--source ../include/quick_mode_0_init.inc +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_CREATE_TABLES; + } + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_CREATE_TABLES; + } + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test 1 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; + +--echo +--echo select test 2 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; + +--echo +--echo select test 3 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/quick_mode_0_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/quick_mode_1.test b/storage/spider/mysql-test/spider/t/quick_mode_1.test new file mode 100644 index 00000000..a2c2bf87 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/quick_mode_1.test @@ -0,0 +1,300 @@ +--source ../include/quick_mode_1_init.inc +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_CREATE_TABLES; + } + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_CREATE_TABLES; + } + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test 1 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; + +--echo +--echo select test 2 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; + +--echo +--echo select test 3 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/quick_mode_1_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/quick_mode_2.test b/storage/spider/mysql-test/spider/t/quick_mode_2.test new file mode 100644 index 00000000..12a48a90 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/quick_mode_2.test @@ -0,0 +1,300 @@ +--source ../include/quick_mode_2_init.inc +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_CREATE_TABLES; + } + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_CREATE_TABLES; + } + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test 1 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; + +--echo +--echo select test 2 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; + +--echo +--echo select test 3 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/quick_mode_2_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/quick_mode_3.test b/storage/spider/mysql-test/spider/t/quick_mode_3.test new file mode 100644 index 00000000..65851a5b --- /dev/null +++ b/storage/spider/mysql-test/spider/t/quick_mode_3.test @@ -0,0 +1,300 @@ +--source ../include/quick_mode_3_init.inc +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_CREATE_TABLES; + } + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_CREATE_TABLES; + } + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_b ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); + +--echo +--echo select test 1 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; + +--echo +--echo select test 2 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--connection master_1 +eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; + +--echo +--echo select test 3 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + --connection child2_2 + if ($USE_GENERAL_LOG) + { + --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ + eval $CHILD2_2_SELECT_ARGUMENT1; + } + eval $CHILD2_2_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/quick_mode_3_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/show_system_tables.test b/storage/spider/mysql-test/spider/t/show_system_tables.test new file mode 100644 index 00000000..ae8259b0 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/show_system_tables.test @@ -0,0 +1,26 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings + +--echo +--echo Show system tables on the Spider node +--connection master_1 +--sorted_result +SELECT table_name, engine FROM information_schema.tables + WHERE table_schema = 'mysql' AND table_name like '%spider_%'; + +--echo +--echo deinit +--disable_warnings +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/t/slave_test_deinit.inc new file mode 100644 index 00000000..e9d99b7a --- /dev/null +++ b/storage/spider/mysql-test/spider/t/slave_test_deinit.inc @@ -0,0 +1,6 @@ +# get connection and exist engine test +--echo for slave1_1 +--connection slave1_1 +STOP SLAVE; +--source ../include/deinit_slave1_1.inc +--disconnect slave1_1 diff --git a/storage/spider/mysql-test/spider/t/slave_test_init.inc b/storage/spider/mysql-test/spider/t/slave_test_init.inc new file mode 100644 index 00000000..739d8897 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/slave_test_init.inc @@ -0,0 +1,44 @@ +# get connection and exist engine test +--echo for slave1_1 +--source connect_slave1_1.inc +--connection slave1_1 +SET SESSION sql_log_bin= 0; +--let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` +--let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE +--source have_partition.inc +--source have_trigger.inc +--source ../include/init_slave1_1.inc +--source have_engine.inc +--let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` +if (!$SLAVE1_1_SLAVE_STATUS) +{ + eval CHANGE MASTER TO + MASTER_HOST = '127.0.0.1', + MASTER_USER = 'root', + MASTER_PASSWORD = '', + MASTER_PORT = $MASTER_1_MYPORT + ; +} +START SLAVE; +--connection master_1 +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--connection slave1_1 +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + --connection child2_2 + call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + --connection child2_3 + call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +} +if ($USE_CHILD_GROUP3) +{ + --connection child3_1 + call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + --connection child3_2 + call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + --connection child3_3 + call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +} diff --git a/storage/spider/mysql-test/spider/t/slave_trx_isolation.test b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test new file mode 100644 index 00000000..a3a3fad8 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test @@ -0,0 +1,151 @@ +--source ../include/slave_trx_isolation_init.inc +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + 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 +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_CREATE_TABLES; + } + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +if ($USE_REPLICATION) +{ + save_master_pos; + --connection slave1_1 + sync_with_master; + --connection master_1 + SET SESSION sql_log_bin= 0; +} +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +if ($USE_REPLICATION) +{ + SET SESSION sql_log_bin= 1; + --connection slave1_1 + --disable_query_log + echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; + eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; + --enable_query_log + --connection master_1 +} +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +if ($USE_REPLICATION) +{ + save_master_pos; + --connection slave1_1 + sync_with_master; + --connection master_1 + SET SESSION sql_log_bin= 0; +} +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + --disable_ps2_protocol + if ($USE_GENERAL_LOG) + { + --replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/ + eval $CHILD2_1_SELECT_ARGUMENT1; + } + --enable_ps2_protocol + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +if ($USE_REPLICATION) +{ + --connection slave1_1 + SELECT pkey FROM tbl_a ORDER BY pkey; +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source ../include/slave_trx_isolation_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes.test b/storage/spider/mysql-test/spider/t/spider3_fixes.test new file mode 100644 index 00000000..eb48b0c8 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/spider3_fixes.test @@ -0,0 +1,304 @@ +# This test tests for Spider 3.0's bug fixes +source include/have_log_bin.inc; +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--source slave_test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + + +--echo +--echo 3.1 +--echo auto_increment +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_INCREMENT_TABLES1; + echo CHILD2_1_CREATE_INCREMENT_TABLES1; + echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; + echo CHILD2_1_AUTO_INCREMENT_OFFSET2; + } + --disable_warnings + eval $CHILD2_1_DROP_INCREMENT_TABLES1; + --enable_warnings + eval $CHILD2_1_CREATE_INCREMENT_TABLES1; + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +if ($USE_REPLICATION) +{ + save_master_pos; + --connection slave1_1 + sync_with_master; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log +} +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +--disable_query_log +echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; +echo CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; +echo MASTER_1_AUTO_INCREMENT_INCREMENT2; +echo MASTER_1_AUTO_INCREMENT_OFFSET2; +eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +eval CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +--disable_ps_protocol +eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; +eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +--enable_ps_protocol +if ($USE_REPLICATION) +{ + SET SESSION sql_log_bin= 1; + --connection slave1_1 + --disable_warnings + DROP TABLE IF EXISTS t1, t2; + --enable_warnings + echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; + echo CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; + eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; + eval CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; + --connection master_1 +} +--enable_query_log +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t2; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT_OFFSET3; +eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +--enable_query_log +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT_OFFSET4; +eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +--enable_query_log +INSERT INTO t2 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t2; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT_OFFSET3; +eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +--enable_query_log +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +SELECT id FROM t1 ORDER BY id; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT_OFFSET4; +eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +--enable_query_log +INSERT INTO t2 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +SELECT id FROM t2 ORDER BY id; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +SELECT id FROM t1 ORDER BY id; +INSERT INTO t2 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +SELECT id FROM t2 ORDER BY id; +SET INSERT_ID=5000; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT_OFFSET3; +eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +--enable_query_log +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT_OFFSET4; +eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +--enable_query_log +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t2; +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t2 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t2; +if ($USE_REPLICATION) +{ + save_master_pos; + --connection slave1_1 + sync_with_master; + SELECT id FROM t1 ORDER BY id; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log +} +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_INCREMENT_TABLES1; + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; + echo CHILD2_1_AUTO_INCREMENT_OFFSET1; + } + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + + +--echo # +--echo # MDEV-28225 Disallow user to create Spider temporary table +--echo # +--connection master_1 +--error ER_ILLEGAL_HA_CREATE_OPTION +CREATE TEMPORARY TABLE t1 ( + a INT +) ENGINE=Spider; + + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source slave_test_deinit.inc +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test new file mode 100644 index 00000000..bcd85f42 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test @@ -0,0 +1,347 @@ +# This test tests for Spider 3.0's bug fixes +source include/have_log_bin.inc; +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--source slave_test_init.inc +--enable_result_log +--enable_query_log +if (!$HAVE_PARTITION) +{ + --disable_query_log + --disable_result_log + --source slave_test_deinit.inc + --source test_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + + +--echo auto_increment with partition +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_INCREMENT_TABLES1; + echo CHILD2_1_CREATE_INCREMENT_TABLES1; + echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; + echo CHILD2_1_AUTO_INCREMENT_OFFSET2; + } + --disable_warnings + eval $CHILD2_1_DROP_INCREMENT_TABLES1; + --enable_warnings + eval $CHILD2_1_CREATE_INCREMENT_TABLES1; + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_INCREMENT_TABLES1; + echo CHILD2_2_CREATE_INCREMENT_TABLES1; + echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; + echo CHILD2_2_AUTO_INCREMENT_OFFSET2; + } + --disable_warnings + eval $CHILD2_2_DROP_INCREMENT_TABLES1; + --enable_warnings + eval $CHILD2_2_CREATE_INCREMENT_TABLES1; + eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; + eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + if ($USE_REPLICATION) + { + save_master_pos; + --connection slave1_1 + sync_with_master; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log + } + --disable_warnings + DROP TABLE IF EXISTS t1, t2; + --enable_warnings + --disable_query_log + echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; + echo CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; + echo MASTER_1_AUTO_INCREMENT_INCREMENT2; + echo MASTER_1_AUTO_INCREMENT_OFFSET2; + eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; + eval CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; + --disable_ps_protocol + eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; + eval $MASTER_1_AUTO_INCREMENT_OFFSET2; + --enable_ps_protocol + if ($USE_REPLICATION) + { + SET SESSION sql_log_bin= 1; + --connection slave1_1 + --disable_warnings + DROP TABLE IF EXISTS t1, t2; + --enable_warnings + echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; + echo CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; + eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; + eval CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; + --connection master_1 + } + --enable_query_log + INSERT INTO t1 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t2 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t2; + --disable_query_log + echo MASTER_1_AUTO_INCREMENT_OFFSET3; + eval $MASTER_1_AUTO_INCREMENT_OFFSET3; + --enable_query_log + INSERT INTO t1 (id) VALUES (null); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + --disable_query_log + echo MASTER_1_AUTO_INCREMENT_OFFSET4; + eval $MASTER_1_AUTO_INCREMENT_OFFSET4; + --enable_query_log + INSERT INTO t2 (id) VALUES (null); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t2; + --disable_query_log + echo MASTER_1_AUTO_INCREMENT_OFFSET3; + eval $MASTER_1_AUTO_INCREMENT_OFFSET3; + --enable_query_log + INSERT INTO t1 () VALUES (),(),(),(); + SELECT LAST_INSERT_ID(); + SELECT id FROM t1 ORDER BY id; + --disable_query_log + echo MASTER_1_AUTO_INCREMENT_OFFSET4; + eval $MASTER_1_AUTO_INCREMENT_OFFSET4; + --enable_query_log + INSERT INTO t2 () VALUES (),(),(),(); + SELECT LAST_INSERT_ID(); + SELECT id FROM t2 ORDER BY id; + TRUNCATE TABLE t1; + TRUNCATE TABLE t2; + INSERT INTO t1 () VALUES (),(),(),(); + SELECT LAST_INSERT_ID(); + SELECT id FROM t1 ORDER BY id; + INSERT INTO t2 () VALUES (),(),(),(); + SELECT LAST_INSERT_ID(); + SELECT id FROM t2 ORDER BY id; + SET INSERT_ID=5000; + --disable_query_log + echo MASTER_1_AUTO_INCREMENT_OFFSET3; + eval $MASTER_1_AUTO_INCREMENT_OFFSET3; + --enable_query_log + INSERT INTO t1 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + --disable_query_log + echo MASTER_1_AUTO_INCREMENT_OFFSET4; + eval $MASTER_1_AUTO_INCREMENT_OFFSET4; + --enable_query_log + INSERT INTO t2 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t2; + INSERT INTO t1 (id) VALUES (10000); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t2 (id) VALUES (1000); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t2; + if ($USE_REPLICATION) + { + save_master_pos; + --connection slave1_1 + sync_with_master; + SELECT id FROM t1 ORDER BY id; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log + } + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_INCREMENT_TABLES1; + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; + echo CHILD2_1_AUTO_INCREMENT_OFFSET1; + } + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_2_SELECT_INCREMENT_TABLES1; + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; + echo CHILD2_2_AUTO_INCREMENT_OFFSET1; + } + eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; + eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source slave_test_deinit.inc +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/spider_fixes.test b/storage/spider/mysql-test/spider/t/spider_fixes.test new file mode 100644 index 00000000..a5a8f228 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/spider_fixes.test @@ -0,0 +1,1442 @@ +# This test tests for Spider's bug fixes +source include/have_log_bin.inc; +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--source slave_test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tb_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2; +eval CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +--enable_query_log +INSERT INTO tb_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l SELECT a, b, c FROM tb_l; + +--echo +--echo 2.13 +--echo select table with "order by desc" and "<" +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a < 5 ORDER BY a DESC LIMIT 3; +--enable_ps2_protocol +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo select table with "order by desc" and "<=" +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a <= 5 ORDER BY a DESC LIMIT 3; +--enable_ps2_protocol +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo 2.14 +--echo update table with range scan and split_read +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo 2.15 +--echo select table with range scan +TRUNCATE TABLE ta_l; +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES6; + echo CHILD2_1_CREATE_TABLES6; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES6; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES6; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE ta_l ( + a int(11) NOT NULL DEFAULT '0', + b char(1) DEFAULT NULL, + c datetime DEFAULT NULL, + PRIMARY KEY (a, b, c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; +eval CREATE TABLE ta_l ( + a int(11) NOT NULL DEFAULT '0', + b char(1) DEFAULT NULL, + c datetime DEFAULT NULL, + PRIMARY KEY (a, b, c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +--enable_query_log +INSERT INTO ta_l SELECT a, b, c FROM tb_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' +AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' +AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' +AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' +AND c = '2001-12-31 23:59:59'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' +AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' +AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' +AND c = '2000-01-01 00:00:00'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' +AND c = '2000-01-01 00:00:00'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' +AND b <= 'd' AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' +AND b < 'e' AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 +AND b >= 'b' AND c = '2003-11-30 05:01:03'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 +AND b >= 'b' AND c = '2000-01-01 00:00:00'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo 2.16 +--echo auto_increment insert with trigger +if ($HAVE_TRIGGER) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TABLES4; + echo CHILD2_1_CREATE_TABLES4; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES4; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES4; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l_auto_inc ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; + eval CREATE TABLE ta_l_auto_inc ( + a INT AUTO_INCREMENT, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; + echo CREATE TABLE tc_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; + eval CREATE TABLE tc_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; + --enable_query_log + --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + INSERT INTO ta_l_auto_inc (a, b, c) VALUES + (NULL, 's', '2008-12-31 20:59:59'); + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES4; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; +} + +--echo +--echo 2.17 +--echo engine-condition-pushdown with "or" and joining +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo 2.23 +--echo index merge +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES5; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE ta_l_int ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE ta_l_int ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); +INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; +INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) +WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo 2.24 +--echo index scan update without PK +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l_int; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l_int ( + a INT NOT NULL, + b INT DEFAULT 10, + c INT DEFAULT 11, + KEY idx1(b), + KEY idx2(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +if ($MASTER_1_NEEDPK) +{ + --error ER_REQUIRES_PRIMARY_KEY + eval CREATE TABLE ta_l_int ( + a INT NOT NULL, + b INT DEFAULT 10, + c INT DEFAULT 11, + KEY idx1(b), + KEY idx2(c) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; + eval CREATE TABLE ta_l_int ( + a INT NOT NULL, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +} +if (!$MASTER_1_NEEDPK) +{ + eval CREATE TABLE ta_l_int ( + a INT NOT NULL, + b INT DEFAULT 10, + c INT DEFAULT 11, + KEY idx1(b), + KEY idx2(c) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +} +--enable_query_log +SELECT a, b, c FROM ta_l_int ORDER BY a; +INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); +INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE ta_l_int SET c = 4 WHERE b = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT a, b, c FROM ta_l_int ORDER BY a; + + +--echo +--echo 2.25 +--echo direct order limit +--connection master_1 +eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; +--disable_ps2_protocol +SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; +--enable_ps2_protocol +eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; + + +--echo +--echo 2.26 +--echo lock tables +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_LOCK_TABLES1; + echo CHILD2_1_DROP_LOCK_TABLES2; + echo CHILD2_1_CREATE_LOCK_TABLES1; + echo CHILD2_1_CREATE_LOCK_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_LOCK_TABLES1; + eval $CHILD2_1_DROP_LOCK_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_LOCK_TABLES1; + eval $CHILD2_1_CREATE_LOCK_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_LOCK_TABLES1; + echo CHILD2_2_DROP_LOCK_TABLES2; + echo CHILD2_2_CREATE_LOCK_TABLES1; + echo CHILD2_2_CREATE_LOCK_TABLES2; + } + --disable_warnings + eval $CHILD2_2_DROP_LOCK_TABLES1; + eval $CHILD2_2_DROP_LOCK_TABLES2; + --enable_warnings + eval $CHILD2_2_CREATE_LOCK_TABLES1; + eval $CHILD2_2_CREATE_LOCK_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings +--disable_query_log +echo CREATE TABLE t1 ( + id int(11) NOT NULL, + PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1; +eval CREATE TABLE t1 ( + id int(11) NOT NULL, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1; +echo CREATE TABLE t2 ( + id int(11) NOT NULL, + PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2; +eval CREATE TABLE t2 ( + id int(11) NOT NULL, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2; +--enable_query_log +LOCK TABLES t1 READ, t2 READ; +UNLOCK TABLES; + + +--echo +--echo auto_increment +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_INCREMENT_TABLES1; + echo CHILD2_1_CREATE_INCREMENT_TABLES1; + echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; + echo CHILD2_1_AUTO_INCREMENT_OFFSET2; + } + --disable_warnings + eval $CHILD2_1_DROP_INCREMENT_TABLES1; + --enable_warnings + eval $CHILD2_1_CREATE_INCREMENT_TABLES1; + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +if ($USE_REPLICATION) +{ + save_master_pos; + --connection slave1_1 + sync_with_master; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log +} +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +--disable_query_log +echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; +echo MASTER_1_AUTO_INCREMENT_INCREMENT2; +echo MASTER_1_AUTO_INCREMENT_OFFSET2; +eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +--disable_ps_protocol +eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; +eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +--enable_ps_protocol +if ($USE_REPLICATION) +{ + SET SESSION sql_log_bin= 1; + --connection slave1_1 + --disable_warnings + DROP TABLE IF EXISTS t1; + --enable_warnings + echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; + eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; + --connection master_1 +} +--enable_query_log +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +SELECT id FROM t1 ORDER BY id; +SET INSERT_ID=5000; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +INSERT INTO t1 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +SELECT MAX(id) FROM t1; +if ($USE_REPLICATION) +{ + save_master_pos; + --connection slave1_1 + sync_with_master; + SELECT id FROM t1 ORDER BY id; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log +} +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_INCREMENT_TABLES1; + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; + echo CHILD2_1_AUTO_INCREMENT_OFFSET1; + } + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + + +--echo +--echo read only +let $MASTER_1_ENGINE_IS_SPIDER= + `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR + '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`; +if ($MASTER_1_ENGINE_IS_SPIDER) +{ + --connection master_1 + --disable_warnings + DROP TABLE IF EXISTS t1; + --enable_warnings + --disable_query_log + echo CREATE TABLE t1 ( + id int(11) NOT NULL, + PRIMARY KEY (id) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1; + eval CREATE TABLE t1 ( + id int(11) NOT NULL, + PRIMARY KEY (id) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1; + --let $MIN_VAL= `SELECT MIN(id) FROM t1` + --enable_query_log + SELECT id FROM t1 ORDER BY id; + --error 12518 + INSERT INTO t1 (id) VALUES (1); + --error 12518 + eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL; + --error 12518 + eval DELETE FROM t1 WHERE id = $MIN_VAL; + --error 12518 + DELETE FROM t1; + --error 12518 + TRUNCATE t1; +} +if (!$MASTER_1_ENGINE_IS_SPIDER) +{ + --echo skipped +} + + +--echo +--echo 2.27 +--echo error mode +if ($MASTER_1_ENGINE_IS_SPIDER) +{ + --connection master_1 + --disable_warnings + DROP TABLE IF EXISTS t1; + --enable_warnings + --disable_query_log + echo CREATE TABLE t1 ( + id int(11) NOT NULL, + PRIMARY KEY (id) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1; + eval CREATE TABLE t1 ( + id int(11) NOT NULL, + PRIMARY KEY (id) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1; + --enable_query_log + SELECT id FROM t1 ORDER BY id; + INSERT INTO t1 (id) VALUES (1); + DELETE FROM t1; + TRUNCATE t1; +} +if (!$MASTER_1_ENGINE_IS_SPIDER) +{ + --echo skipped +} + + +--echo +--echo 3.0 +--echo is null +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TEXT_KEY_TABLES1; + echo CHILD2_1_CREATE_TEXT_KEY_TABLES1; + } + --disable_warnings + eval $CHILD2_1_DROP_TEXT_KEY_TABLES1; + --enable_warnings + eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +--disable_query_log +echo CREATE TABLE t1 ( + a VARCHAR(255), + b VARCHAR(255), + c VARCHAR(255), + KEY idx1(a,b), + KEY idx2(b), + PRIMARY KEY(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1; +eval CREATE TABLE t1 ( + a VARCHAR(255), + b VARCHAR(255), + c VARCHAR(255), + KEY idx1(a,b), + KEY idx2(b), + PRIMARY KEY(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1; +--enable_query_log +insert into t1 values (null, null, '2048'); +insert into t1 values ('1', '1', '1'); +insert into t1 select a + 1, b + 1, c + 1 from t1; +insert into t1 select a + 2, b + 2, c + 2 from t1; +insert into t1 select a + 4, b + 4, c + 4 from t1; +insert into t1 select a + 8, b + 8, c + 8 from t1; +insert into t1 select a + 16, b + 16, c + 16 from t1; +insert into t1 select a + 32, b + 32, c + 32 from t1; +insert into t1 select a + 64, b + 64, c + 64 from t1; +insert into t1 select a + 128, b + 128, c + 128 from t1; +insert into t1 select a + 256, b + 256, c + 256 from t1; +insert into t1 select a + 512, b + 512, c + 512 from t1; +flush tables; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +select a from t1 where a is null order by a limit 30; +select b from t1 where b is null order by b limit 30; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + + +--echo +--echo direct_order_limit +--connection master_1 +TRUNCATE TABLE t1; +insert into t1 values ('1', '1', '1'); +insert into t1 select a + 1, b + 1, c + 1 from t1; +insert into t1 select a + 2, b + 2, c + 2 from t1; +insert into t1 select a + 4, b + 4, c + 4 from t1; +insert into t1 select a + 8, b + 8, c + 8 from t1; +insert into t1 select a + 16, b + 16, c + 16 from t1; +insert into t1 select a, b + 32, c + 32 from t1; +insert into t1 select a, b + 64, c + 64 from t1; +insert into t1 select a, b + 128, c + 128 from t1; +flush tables; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; +select a, c from t1 where a = '10' order by b desc limit 5; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} + + +# MDEV-27039 LOCK_global_system_variables attempted to re-acquire +# The test proves no assert anymore. +--connection master_1 +--let $binlog_checksum=`SELECT @@global.binlog_checksum` +--let $expire_logs_days=`SELECT @@global.expire_logs_days` +SET @@global.expire_logs_days=11; + +--connect (master_purge, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) +SET @@global.binlog_checksum=NONE; +--evalp SET @@global.binlog_checksum=$binlog_checksum +--evalp SET @@global.expire_logs_days=$expire_logs_days +--disconnect master_purge + +--disable_query_log +--disable_result_log +--source slave_test_deinit.inc +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/t/spider_fixes_part.test new file mode 100644 index 00000000..bff2e574 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/spider_fixes_part.test @@ -0,0 +1,901 @@ +# This test tests for Spider's bug fixes +source include/have_log_bin.inc; +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--source slave_test_init.inc +--enable_result_log +--enable_query_log +if (!$HAVE_PARTITION) +{ + --disable_query_log + --disable_result_log + --source slave_test_deinit.inc + --source test_deinit.inc + --enable_result_log + --enable_query_log + --enable_warnings + skip Test requires partitioning; +} + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; + CREATE DATABASE auto_test_local; + USE auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tb_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2; +eval CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +--enable_query_log +INSERT INTO tb_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); + +--echo +--echo 2.17 +--echo partition with sort +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; + --enable_query_log + INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 + ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo 2.23 +--echo partition update with moving partition +if ($HAVE_PARTITION) +{ + --connection master_1 + --disable_warnings + DROP TABLE IF EXISTS ta_l2; + --enable_warnings + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; + --enable_query_log + INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); + UPDATE ta_l2 SET a = 4 WHERE a = 3; + SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo index merge with partition +if ($HAVE_PARTITION) +{ + --connection master_1 + --disable_warnings + DROP TABLE IF EXISTS ta_l_int; + --enable_warnings + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_2_DROP_TABLES5; + echo CHILD2_2_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES5; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES5; + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES5; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } + } + --connection master_1 + --disable_query_log + echo CREATE TABLE ta_l_int ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1; + eval CREATE TABLE ta_l_int ( + a INT AUTO_INCREMENT, + b INT DEFAULT 10, + c INT DEFAULT 11, + PRIMARY KEY(a), + KEY idx1(b), + KEY idx2(c) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1; + --enable_query_log + INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); + INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; + INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; + INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; + INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) + WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + + +--echo +--echo 2.26 +--echo auto_increment with partition +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_INCREMENT_TABLES1; + echo CHILD2_1_CREATE_INCREMENT_TABLES1; + echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; + echo CHILD2_1_AUTO_INCREMENT_OFFSET2; + } + --disable_warnings + eval $CHILD2_1_DROP_INCREMENT_TABLES1; + --enable_warnings + eval $CHILD2_1_CREATE_INCREMENT_TABLES1; + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_INCREMENT_TABLES1; + echo CHILD2_2_CREATE_INCREMENT_TABLES1; + echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; + echo CHILD2_2_AUTO_INCREMENT_OFFSET2; + } + --disable_warnings + eval $CHILD2_2_DROP_INCREMENT_TABLES1; + --enable_warnings + eval $CHILD2_2_CREATE_INCREMENT_TABLES1; + eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; + eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + if ($USE_REPLICATION) + { + save_master_pos; + --connection slave1_1 + sync_with_master; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log + } + --disable_warnings + DROP TABLE IF EXISTS t1; + --enable_warnings + --disable_query_log + echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; + echo MASTER_1_AUTO_INCREMENT_INCREMENT2; + echo MASTER_1_AUTO_INCREMENT_OFFSET2; + eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; + --disable_ps_protocol + eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; + eval $MASTER_1_AUTO_INCREMENT_OFFSET2; + --enable_ps_protocol + if ($USE_REPLICATION) + { + SET SESSION sql_log_bin= 1; + --connection slave1_1 + --disable_warnings + DROP TABLE IF EXISTS t1; + --enable_warnings + echo CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; + eval CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) + ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; + --connection master_1 + } + --enable_query_log + INSERT INTO t1 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t1 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t1 (id) VALUES (null); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t1 (id) VALUES (null); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t1 () VALUES (),(),(),(); + SELECT LAST_INSERT_ID(); + SELECT id FROM t1 ORDER BY id; + SET INSERT_ID=5000; + INSERT INTO t1 () VALUES (); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t1 (id) VALUES (10000); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + INSERT INTO t1 (id) VALUES (1000); + SELECT LAST_INSERT_ID(); + SELECT MAX(id) FROM t1; + if ($USE_REPLICATION) + { + save_master_pos; + --connection slave1_1 + sync_with_master; + SELECT id FROM t1 ORDER BY id; + --connection master_1 + --disable_query_log + SET SESSION sql_log_bin= 0; + --enable_query_log + } + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_INCREMENT_TABLES1; + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; + echo CHILD2_1_AUTO_INCREMENT_OFFSET1; + } + eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; + eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_2_SELECT_INCREMENT_TABLES1; + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; + echo CHILD2_2_AUTO_INCREMENT_OFFSET1; + } + eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; + eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo Test ORDER BY with LIMIT and OFFSET +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES7; + echo CHILD2_1_CREATE_TABLES7; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES7; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES7; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + --disable_warnings + DROP TABLE IF EXISTS ta_ob; + --enable_warnings + echo CREATE TABLE ta_ob ( + a VARCHAR(50) NOT NULL, + b VARCHAR(50) NULL DEFAULT NULL, + c VARCHAR(100) NULL DEFAULT NULL, + d DATETIME(0) NULL DEFAULT NULL, + e INT(11) NOT NULL, + f INT(10) NULL DEFAULT NULL, + PRIMARY KEY (a, e) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1; + eval CREATE TABLE ta_ob ( + a VARCHAR(50) NOT NULL, + b VARCHAR(50) NULL DEFAULT NULL, + c VARCHAR(100) NULL DEFAULT NULL, + d DATETIME(0) NULL DEFAULT NULL, + e INT(11) NOT NULL, + f INT(10) NULL DEFAULT NULL, + PRIMARY KEY (a, e) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1; + --enable_query_log + INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733', + '6CFED89FF6A84C7AA55C3C432663D094', + '51041110620304', '2018-08-02 13:41:13', + 510411, 1); + INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD', + '879DC2A0B6AC46D9A62E8EA47E2970F2', + '51041110620301', NULL, + 510411, 0); + INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0', + '017B8A460DBC444682B791305EF75356', + '51041110620308', '2018-08-02 13:48:29', + 510411, 0); + INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674', + '996C7F14989D480589A553717D735E3E', + '51041110620302', '2018-08-02 13:48:30', + 510411, 0); + INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583', + '017B8A460DBC444682B791305EF75356', + '51041110620308', '2018-08-02 13:48:28', + 510411, 0); + INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B', + '821E71E6ABB4404EBAA349BB681089F8', + '51041110620310', '2018-08-02 13:48:27', + 510411, 0); + INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70', + '821E71E6ABB4404EBAA349BB681089F8', + '51041110620310', '2018-08-02 13:48:28', + 510411, 0); + SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES7; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + + +--echo # +--echo # MDEV-25985 Spider handle ">=" as ">" in some cases +--echo # + +--connection child2_1 +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +eval CREATE TABLE t1 ( + a int, + b int, + c int, + PRIMARY KEY (a), + KEY (b,c) +) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 1); + +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +eval CREATE TABLE t1 ( + a int, + b int, + c int, + PRIMARY KEY (a), + KEY (b,c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_MDEV_25985; + +--connection master_1 +SELECT * FROM t1 WHERE c > 0 AND b >= 1 AND b <= 2; +SELECT * FROM t1 WHERE c < 3 AND b <= 2; + +--echo +--echo Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084) +--echo Fixed with 4968049799193394d442f26b4e3a8d95b185be72 +--echo Spider crashed if the first partition was not used first +if ($HAVE_PARTITION) +{ + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_2_DROP_TABLES; + echo CHILD2_2_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_2_DROP_TABLES; + --enable_warnings + eval $CHILD2_2_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES2; + echo CHILD2_1_CREATE_TABLES2; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES2; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES2; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } + --connection master_1 + --disable_query_log + --disable_warnings + DROP TABLE IF EXISTS ta_l2; + --enable_warnings + echo CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; + eval CREATE TABLE ta_l2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) + ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; + --enable_query_log + INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; + --echo Query a Spider table only using the second partition + SELECT a,b,c FROM ta_l2 PARTITION (pt2); + --echo Query a Spider table only using the first partition + SELECT a,b,c FROM ta_l2 PARTITION (pt1); + --echo Query a Spider table by all paritions, then the second partition + SELECT min(a), max(a), min(b), max(b) FROM ta_l2; + SELECT a,b,c FROM ta_l2 PARTITION (pt2); + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_2 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_2_SELECT_TABLES; + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; + } + eval $CHILD2_1_SELECT_TABLES2; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_REPLICATION) +{ + --connection slave1_1 + DROP DATABASE IF EXISTS auto_test_local; +} +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source slave_test_deinit.inc +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test b/storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test new file mode 100644 index 00000000..d0753cf7 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test @@ -0,0 +1,16 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_query_log + +--connection master_1 +SELECT * FROM information_schema.spider_wrapper_protocols; + +--disable_query_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/test_deinit.inc b/storage/spider/mysql-test/spider/t/test_deinit.inc new file mode 100644 index 00000000..5a82b43c --- /dev/null +++ b/storage/spider/mysql-test/spider/t/test_deinit.inc @@ -0,0 +1,39 @@ +# get connection and exist engine test +--echo for master_1 +--connection master_1 +--source ../include/deinit_master_1.inc +--disconnect master_1 +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --connection child2_1 + --source ../include/deinit_child2_1.inc + --disconnect child2_1 + --disconnect child2_1_2 + --echo child2_2 + --connection child2_2 + --source ../include/deinit_child2_2.inc + --disconnect child2_2 + --disconnect child2_2_2 + --echo child2_3 + --connection child2_3 + --source ../include/deinit_child2_3.inc + --disconnect child2_3 +} +--echo for child3 +if ($USE_CHILD_GROUP3) +{ + --echo child3_1 + --connection child3_1 + --source ../include/deinit_child3_1.inc + --disconnect child3_1 + --echo child3_2 + --connection child3_2 + --source ../include/deinit_child3_2.inc + --disconnect child3_2 + --echo child3_3 + --connection child3_3 + --source ../include/deinit_child3_3.inc + --disconnect child3_3 +} diff --git a/storage/spider/mysql-test/spider/t/test_init.inc b/storage/spider/mysql-test/spider/t/test_init.inc new file mode 100644 index 00000000..f2cd6c02 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/test_init.inc @@ -0,0 +1,74 @@ +# get connection and exist engine test +--echo for master_1 +--source connect_master_1.inc +--connection master_1 +CALL mtr.add_suppression("unknown variable"); +SET SESSION sql_log_bin= 0; +--let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` +--let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE +--source have_partition.inc +--source have_trigger.inc +--source ../include/init_master_1.inc +--source have_engine.inc +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --source connect_child2_1.inc + --connection child2_1 + CALL mtr.add_suppression("unknown variable *"); + SET SESSION sql_log_bin= 0; + --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` + --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE + --source ../include/init_child2_1.inc + --source have_engine.inc + --echo child2_2 + --source connect_child2_2.inc + --connection child2_2 + CALL mtr.add_suppression("unknown variable *"); + SET SESSION sql_log_bin= 0; + --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` + --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE + --source ../include/init_child2_2.inc + --source have_engine.inc + --echo child2_3 + --source connect_child2_3.inc + --connection child2_3 + CALL mtr.add_suppression("unknown variable *"); + SET SESSION sql_log_bin= 0; + --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` + --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE + --source ../include/init_child2_3.inc + --source have_engine.inc +} +--echo for child3 +if ($USE_CHILD_GROUP3) +{ + --echo child3_1 + --source connect_child3_1.inc + --connection child3_1 + CALL mtr.add_suppression("unknown variable *"); + SET SESSION sql_log_bin= 0; + --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` + --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE + --source ../include/init_child3_1.inc + --source have_engine.inc + --echo child3_2 + --source connect_child3_2.inc + --connection child3_2 + CALL mtr.add_suppression("unknown variable *"); + SET SESSION sql_log_bin= 0; + --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` + --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE + --source ../include/init_child3_2.inc + --source have_engine.inc + --echo child3_3 + --source connect_child3_3.inc + --connection child3_3 + CALL mtr.add_suppression("unknown variable *"); + SET SESSION sql_log_bin= 0; + --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` + --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE + --source ../include/init_child3_3.inc + --source have_engine.inc +} diff --git a/storage/spider/mysql-test/spider/t/timestamp.test b/storage/spider/mysql-test/spider/t/timestamp.test new file mode 100644 index 00000000..47d637bb --- /dev/null +++ b/storage/spider/mysql-test/spider/t/timestamp.test @@ -0,0 +1,542 @@ +--source timestamp_init.inc + +--echo +--echo Initialize Time Zone +--connection master_1 +SET GLOBAL time_zone='MET'; +SET time_zone='MET'; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + SET GLOBAL time_zone='MET'; + SET time_zone='MET'; +} + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS ts_test_local; +CREATE DATABASE ts_test_local; +USE ts_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS ts_test_remote; + CREATE DATABASE ts_test_remote; + USE ts_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLE; + echo CHILD2_1_DROP_TABLE_F; + echo CHILD2_1_CREATE_TABLE; + echo CHILD2_1_CREATE_TABLE_F; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLE; + eval $CHILD2_1_DROP_TABLE_F; + --enable_warnings + eval $CHILD2_1_CREATE_TABLE; + eval $CHILD2_1_CREATE_TABLE_F; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + col_a INT UNSIGNED NOT NULL AUTO_INCREMENT, + col_dt DATETIME, + col_ts TIMESTAMP NOT NULL + DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY(col_a), + UNIQUE INDEX i_ts (col_ts) +) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + col_a INT UNSIGNED NOT NULL AUTO_INCREMENT, + col_dt DATETIME, + col_ts TIMESTAMP NOT NULL + DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY(col_a), + UNIQUE INDEX i_ts (col_ts) +) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1; +echo CREATE TABLE tbl_f ( + col_d DATE, + col_t TIME +) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F; +eval CREATE TABLE tbl_f ( + col_d DATE, + col_t TIME +) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F; +--enable_query_log +SHOW CREATE TABLE tbl_a; +SHOW CREATE TABLE tbl_f; + +--echo +--echo Set a different time zone that has DST +SET time_zone='+01:00'; + +--echo +--echo Insert Rows +--connection master_1 +--echo Min value +SET @@timestamp=1; +INSERT INTO tbl_a VALUES (1, now(), now()); +SET @@timestamp=0; +--echo Ambiguous DST values for MET time zone that result in the +--echo same UTC timestamp +INSERT INTO tbl_a VALUES (2, '2018-03-25 02:00:00', '2018-03-25 02:00:00'); +INSERT INTO tbl_a VALUES (3, '2018-03-25 02:30:00', '2018-03-25 02:30:00'); +--echo Ambiguous DST values for MET time zone in the 2:00 am to 3:00 am hour +--echo that occur twice when transitioning from DST to standard time +SET @@timestamp=1540686600; +INSERT INTO tbl_a VALUES (4, now(), now()); +SET @@timestamp=1540690200; +INSERT INTO tbl_a VALUES (5, now(), now()); +--echo Max value +SET @@timestamp=2147483647; +INSERT INTO tbl_a VALUES (6, now(), now()); +SET @@timestamp=0; + +--echo +--echo SELECTs +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT *, unix_timestamp(col_ts) FROM tbl_a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo DELETEs +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DELETE FROM tbl_a WHERE col_ts='1970-01-01 01:00:01'; +--disable_ps2_protocol +SELECT *, unix_timestamp(col_ts) FROM tbl_a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SET @@timestamp=1; +INSERT INTO tbl_a VALUES (1, now(), now()); +SET @@timestamp=0; +--disable_ps2_protocol +SELECT *, unix_timestamp(col_ts) FROM tbl_a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo UPDATEs +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +UPDATE tbl_a SET col_ts=col_dt; +--disable_ps2_protocol +SELECT *, unix_timestamp(col_ts) FROM tbl_a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo Lookups +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > '2018-01-01'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts < '2018-10-28 02:30:00'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE '2018-10-28 02:30:00' > col_ts; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts BETWEEN '2018-10-28 01:30:00' AND '2018-10-28 02:30:00'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00' AND col_ts <= '2018-10-28 02:30:00'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo Drop the index on the timestamp column +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + eval $CHILD2_1_DROP_INDEX; + eval $CHILD2_1_SHOW_CREATE_TABLE; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +DROP INDEX i_ts ON tbl_a; +SHOW CREATE TABLE tbl_a; + +--echo +--echo Retry lookups on unindexed timestamp column +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > '2018-01-01'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts < '2018-10-28 02:30:00'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE '2018-10-28 02:30:00' > col_ts; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts BETWEEN '2018-10-28 01:30:00' AND '2018-10-28 02:30:00'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00' AND col_ts <= '2018-10-28 02:30:00'; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000; +SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo Test the TIMESTAMP function +--connection master_1 +INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'), + ('2018-06-24', '01:23:45'), + ('2018-08-01', '12:34:56'); +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_ps2_protocol +SELECT * FROM tbl_f; +SELECT TIMESTAMP(col_d, col_t) FROM tbl_f; +SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f; +SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f; +SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLE_F; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--enable_ps2_protocol + +--echo +--echo Restore Time Zone settings +--connection master_1 +SET GLOBAL time_zone=DEFAULT; +SET time_zone=DEFAULT; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + SET GLOBAL time_zone=DEFAULT; + SET time_zone=DEFAULT; +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS ts_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS ts_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source timestamp_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/timestamp_deinit.inc b/storage/spider/mysql-test/spider/t/timestamp_deinit.inc new file mode 100644 index 00000000..52be67a1 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/timestamp_deinit.inc @@ -0,0 +1,13 @@ +--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 +--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP +--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_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/t/timestamp_init.inc b/storage/spider/mysql-test/spider/t/timestamp_init.inc new file mode 100644 index 00000000..22587bcf --- /dev/null +++ b/storage/spider/mysql-test/spider/t/timestamp_init.inc @@ -0,0 +1,62 @@ +--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_F_BACKUP= $MASTER_1_COMMENT_2_1_F +let $MASTER_1_COMMENT_2_1= + COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'; +let $MASTER_1_COMMENT_2_1_F= + COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'; +let $MASTER_1_AUTO_INCREMENT_2_1= + AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; +let $MASTER_1_AUTO_INCREMENT1= + AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; +let $MASTER_1_AUTO_INCREMENT2= + AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; +let $CHILD2_1_AUTO_INCREMENT= + AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; +--let $CHILD2_1_DROP_TABLE_BACKUP= $CHILD2_1_DROP_TABLE +--let $CHILD2_1_DROP_TABLE_F_BACKUP= $CHILD2_1_DROP_TABLE_F +let $CHILD2_1_DROP_TABLE= + DROP TABLE IF EXISTS tbl_a; +let $CHILD2_1_DROP_TABLE_F= + DROP TABLE IF EXISTS tbl_f; +--let $CHILD2_1_CREATE_TABLE_BACKUP= $CHILD2_1_CREATE_TABLE +--let $CHILD2_1_CREATE_TABLE_F_BACKUP= $CHILD2_1_CREATE_TABLE_F +let $CHILD2_1_CREATE_TABLE= + CREATE TABLE tbl_a ( + col_a INT UNSIGNED NOT NULL AUTO_INCREMENT, + col_dt DATETIME, + col_ts TIMESTAMP NOT NULL + DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY(col_a), + UNIQUE INDEX i_ts (col_ts) + ) $CHILD2_1_ENGINE $CHILD2_1_AUTO_INCREMENT; +let $CHILD2_1_CREATE_TABLE_F= + CREATE TABLE tbl_f ( + col_d DATE, + col_t TIME + ) $CHILD2_1_ENGINE; +--let $CHILD2_1_SELECT_TABLE_BACKUP= $CHILD2_1_SELECT_TABLE +--let $CHILD2_1_SELECT_TABLE_F_BACKUP= $CHILD2_1_SELECT_TABLE_F +let $CHILD2_1_SELECT_TABLE= + SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; +let $CHILD2_1_SELECT_TABLE_F= + SELECT col_d, col_t FROM tbl_f; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +let $CHILD2_1_DROP_INDEX= + DROP INDEX i_ts ON tbl_a; +let $CHILD2_1_SHOW_CREATE_TABLE= + SHOW CREATE TABLE tbl_a; +let $CHILD2_1_SHOW_CREATE_TABLE_F= + SHOW CREATE TABLE tbl_f; +--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2 +--let $OUTPUT_CHILD_GROUP2= 1 +--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG +--let $USE_GENERAL_LOG= 1 diff --git a/storage/spider/mysql-test/spider/t/udf_pushdown.inc b/storage/spider/mysql-test/spider/t/udf_pushdown.inc new file mode 100644 index 00000000..df9742a3 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/udf_pushdown.inc @@ -0,0 +1,50 @@ +--echo +--echo ##### test SELECTs ##### +--connection master_1 +--disable_ps2_protocol +SELECT * FROM ta_l WHERE id = plusone(1); +SELECT * FROM ta_l WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32); +--enable_ps2_protocol + +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + SELECT argument FROM mysql.general_log WHERE argument LIKE "%select%" AND argument NOT LIKE "%argument%"; + --disable_query_log + TRUNCATE TABLE mysql.general_log; + --enable_query_log +} + +--echo +--echo ##### test UPDATEs ##### +--connection master_1 +UPDATE ta_l SET a = plusone(221) WHERE id = plusone(1); +SELECT * FROM ta_l; +UPDATE ta_l SET a = plusone(332) WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32); +SELECT * FROM ta_l; + +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + SELECT argument FROM mysql.general_log WHERE argument LIKE "%update%" AND argument NOT LIKE "%argument%"; + --disable_query_log + TRUNCATE TABLE mysql.general_log; + --enable_query_log +} + +--echo +--echo ##### test DELETEs ##### +--connection master_1 +DELETE FROM ta_l WHERE id = plusone(1); +SELECT * FROM ta_l; +DELETE FROM ta_l WHERE id IN (plusone(1), plusone(2), plusone(3)) AND a = plusone(43); +SELECT * FROM ta_l; + +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + SELECT argument FROM mysql.general_log WHERE (argument LIKE "%delete%" OR argument LIKE "%update%") AND argument NOT LIKE "%argument%"; + --disable_query_log + TRUNCATE TABLE mysql.general_log; + --enable_query_log +} diff --git a/storage/spider/mysql-test/spider/t/udf_pushdown.test b/storage/spider/mysql-test/spider/t/udf_pushdown.test new file mode 100644 index 00000000..2eadbbbb --- /dev/null +++ b/storage/spider/mysql-test/spider/t/udf_pushdown.test @@ -0,0 +1,141 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--echo # +--echo # MDEV-26545 Spider does not correctly handle UDF and stored function in where conds +--echo # + +let $CHILD_CREATE_TABLE= + CREATE TABLE ta_r ( + id INT NOT NULL, + a INT, + PRIMARY KEY(id) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; + +let $MASTER_CREATE_TABLE_OUTPUT= + CREATE TABLE ta_l ( + id INT NOT NULL, + a INT, + PRIMARY KEY(id) + ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; + +let $MASTER_CREATE_TABLE= + CREATE TABLE ta_l ( + id INT NOT NULL, + a INT, + PRIMARY KEY(id) + ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; + +--echo +--echo ##### enable general_log ##### +--connection child2_1 +SET @general_log_backup = @@global.general_log; +SET @log_output_backup = @@global.log_output; +SET @@global.general_log = 1; +SET @@global.log_output = "TABLE"; +TRUNCATE TABLE mysql.general_log; + +--echo +--echo ##### create databases ##### +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} + +--echo +--echo ##### create tables ##### +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + --disable_query_log + echo CHILD_CREATE_TABLE; + eval $CHILD_CREATE_TABLE; + --enable_query_log +} + +--connection master_1 +--disable_query_log +echo MASTER_CREATE_TABLE; +echo $MASTER_CREATE_TABLE_OUTPUT; +eval $MASTER_CREATE_TABLE; +--enable_query_log + +INSERT INTO ta_l VALUES + (1, 11), + (2, 22), + (3, 33), + (4, 44), + (5, 55); + +--echo +--echo ##### create functions ##### +--connection master_1 +DELIMITER //; +CREATE FUNCTION `plusone`( param INT ) RETURNS INT +BEGIN + RETURN param + 1; +END // +DELIMITER ;// + +--connection child2_1 +DELIMITER //; +CREATE FUNCTION `plusone`( param INT ) RETURNS INT +BEGIN + RETURN param + 1; +END // +DELIMITER ;// + +--echo +--echo ########## spider_use_pushdown_udf=0 ########## +--connection master_1 +SET @@spider_use_pushdown_udf = 0; +--source udf_pushdown.inc + +--echo +--echo ##### reset records ##### +--connection master_1 +TRUNCATE TABLE ta_l; +INSERT INTO ta_l VALUES + (1, 11), + (2, 22), + (3, 33), + (4, 44), + (5, 55); + +--echo +--echo ########## spider_use_pushdown_udf=1 ########## +--connection master_1 +SET @@spider_use_pushdown_udf = 1; +--source udf_pushdown.inc + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP FUNCTION `plusone`; +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + SET @@global.general_log = @general_log_backup; + SET @@global.log_output = @log_output_backup; + DROP FUNCTION `plusone`; + DROP DATABASE IF EXISTS auto_test_remote; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test new file mode 100644 index 00000000..3ed8dcf5 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test @@ -0,0 +1,137 @@ +--echo # +--echo # MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak +--echo # + +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--connection master_1 +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--echo # MDEV-28297 Deprecate spider_internal_offset +SET spider_internal_offset = 1; +SHOW VARIABLES LIKE "spider_internal_offset"; + +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ios "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_offset "1"'; +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-27981 Deprecate spider_internal_limit +SET spider_internal_limit = 1; +SHOW VARIABLES LIKE "spider_internal_limit"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ilm "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_limit "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-28244 Deprecate spider_xa_register_mode +SET spider_xa_register_mode = 0; +SHOW VARIABLES LIKE "spider_xa_register_mode"; + +--echo # MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence +SET GLOBAL spider_store_last_sts = 0; +SHOW VARIABLES LIKE "spider_store_last_sts"; + +SET GLOBAL spider_store_last_crd = 0; +SHOW VARIABLES LIKE "spider_store_last_crd"; + +SET GLOBAL spider_load_sts_at_startup = 0; +SHOW VARIABLES LIKE "spider_load_sts_at_startup"; + +SET GLOBAL spider_load_crd_at_startup = 0; +SHOW VARIABLES LIKE "spider_load_crd_at_startup"; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode +SET spider_crd_mode = 1; +SHOW VARIABLES LIKE "spider_crd_mode"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cmd "3"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_mode "3"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +SET spider_sts_mode = 1; +SHOW VARIABLES LIKE "spider_sts_mode"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='smd "3"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='sts_mode "3"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-28010 Deprecate spider_crd_type and spider_crd_weight +SET spider_crd_type = 1; +SHOW VARIABLES LIKE "spider_crd_type"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ctp "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_type "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +SET spider_crd_weight = 1; +SHOW VARIABLES LIKE "spider_crd_weight"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cwg "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_weight "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-28560 Deprecate spider_buffer_size +SET spider_buffer_size = 1; +SHOW VARIABLES LIKE "spider_buffer_size"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='bfz "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='buffer_size "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-27926 Deprecate spider_init_sql_alloc_size +SET spider_init_sql_alloc_size = 1; +SHOW VARIABLES LIKE "spider_init_sql_alloc_size"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='isa "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection +SET spider_semi_table_lock = 1; +SHOW VARIABLES LIKE "spider_semi_table_lock"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stl "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +SET spider_semi_table_lock_connection = 0; +SHOW VARIABLES LIKE "spider_semi_table_lock_connection"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stc "0"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock_connection "0"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +--echo # MDEV-28795 Deprecate spider_bka_table_name_type +SET spider_bka_table_name_type = 1; +SHOW VARIABLES LIKE "spider_bka_table_name_type"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='btt "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='bka_table_name_type "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + +DROP DATABASE auto_test_local; + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/t/vp_fixes.test b/storage/spider/mysql-test/spider/t/vp_fixes.test new file mode 100644 index 00000000..2c3e1523 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/vp_fixes.test @@ -0,0 +1,335 @@ +# This test tests for VP's bug fixes +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; + CREATE DATABASE auto_test_remote2; + USE auto_test_remote2; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + --connection child2_2 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table and insert +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tb_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2; +eval CREATE TABLE tb_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +--enable_query_log +INSERT INTO tb_l (a, b, c) VALUES + (1, 'a', '2008-08-01 10:21:39'), + (2, 'b', '2000-01-01 00:00:00'), + (3, 'e', '2007-06-04 20:03:11'), + (4, 'd', '2003-11-30 05:01:03'), + (5, 'c', '2001-12-31 23:59:59'); +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l SELECT a, b, c FROM tb_l; + +--echo +--echo 0.9 +--echo create different primary key table +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES5; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE ta_l_int ( + a INT DEFAULT 10, + b INT AUTO_INCREMENT, + c INT DEFAULT 11, + PRIMARY KEY(b) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE ta_l_int ( + a INT DEFAULT 10, + b INT AUTO_INCREMENT, + c INT DEFAULT 11, + PRIMARY KEY(b) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)` +if ($MASTER_1_IS_VP) +{ + --error 14514 + INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); +} +if (!$MASTER_1_IS_VP) +{ + INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); + --disable_query_log + --disable_result_log + TRUNCATE TABLE ta_l_int; + --enable_query_log + --enable_result_log +} +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES5; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo create un-correspond primary key table +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l_int; +--enable_warnings +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + echo CHILD2_1_DROP_TABLES5; + echo CHILD2_1_CREATE_TABLES5; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES5; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES5; + --enable_query_log + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_result_log + } +} +--connection master_1 +--disable_query_log +echo CREATE TABLE ta_l_int ( + a INT DEFAULT 10, + b INT DEFAULT 12, + c INT DEFAULT 11, + PRIMARY KEY(c) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; +eval CREATE TABLE ta_l_int ( + a INT DEFAULT 10, + b INT DEFAULT 12, + c INT DEFAULT 11, + PRIMARY KEY(c) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +--enable_query_log +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +if ($MASTER_1_IS_VP) +{ + --error 14514 + INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); +} +if (!$MASTER_1_IS_VP) +{ + INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); + --disable_query_log + --disable_result_log + TRUNCATE TABLE ta_l_int; + --enable_query_log + --enable_result_log +} +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; + } + eval $CHILD2_1_SELECT_TABLES5; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + --connection child2_2 + DROP DATABASE IF EXISTS auto_test_remote2; +} +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test |