diff options
author | Kentoku SHIBA <kentokushiba@gmail.com> | 2020-03-22 10:51:41 +0900 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-09-03 10:19:25 +0200 |
commit | b4ffe6eabfffea04896b7c69fb8d3af55c4a2f53 (patch) | |
tree | 5c2b8ce55cb11ad76c4c26325c8e57d2a40af78f /storage | |
parent | e4680d0de35717563f18de4d084ae7bc0d685d78 (diff) | |
download | mariadb-git-b4ffe6eabfffea04896b7c69fb8d3af55c4a2f53.tar.gz |
MENT-30 Spider to support ODBC data sources
add odbc_mariadb feature
Diffstat (limited to 'storage')
137 files changed, 13127 insertions, 422 deletions
diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt index eb10b7c259e..da83a730a1e 100644 --- a/storage/spider/CMakeLists.txt +++ b/storage/spider/CMakeLists.txt @@ -17,7 +17,8 @@ SET(SPIDER_SOURCES spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def - spd_db_mysql.cc spd_db_handlersocket.cc spd_db_oracle.cc spd_db_odbc.cc + spd_db_mysql.cc spd_db_handlersocket.cc spd_db_oracle.cc + spd_db_odbc.cc spd_db_odbc_mariadb.cc spd_group_by_handler.cc spd_db_include.cc hs_client/config.cpp hs_client/escape.cpp hs_client/fatal.cpp hs_client/hstcpcli.cpp hs_client/socket.cpp hs_client/string_util.cpp diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_1.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_1.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_2.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_2.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_3.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child2_3.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_1.inc new file mode 100644 index 00000000000..daab363c580 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_1.inc @@ -0,0 +1,3 @@ +--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE +--let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE +--source ../../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_2.inc new file mode 100644 index 00000000000..7a95260fca2 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_2.inc @@ -0,0 +1,3 @@ +--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE +--let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE +--source ../../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_3.inc new file mode 100644 index 00000000000..df4aef94185 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_child3_3.inc @@ -0,0 +1,3 @@ +--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE +--let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE +--source ../../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_master_1.inc new file mode 100644 index 00000000000..f7d8678de60 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_master_1.inc @@ -0,0 +1,2 @@ +DROP SERVER IF EXISTS s_2; +--source ../../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_slave1_1.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/deinit_slave1_1.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_1.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_1.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_2.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_2.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_3.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child2_3.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_1.inc new file mode 100644 index 00000000000..c19e376d10a --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_1.inc @@ -0,0 +1 @@ +--source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_2.inc new file mode 100644 index 00000000000..c19e376d10a --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_2.inc @@ -0,0 +1 @@ +--source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_3.inc new file mode 100644 index 00000000000..c19e376d10a --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_child3_3.inc @@ -0,0 +1 @@ +--source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_master_1.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_deinit_master_1.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_1.inc new file mode 100644 index 00000000000..2684829408d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_1.inc @@ -0,0 +1,8 @@ +let $CHILD2_1_HA_AS_DROP_TABLES= + $CHILD2_1_DROP_TABLES; +let $CHILD2_1_HA_AS_CREATE_TABLES= + $CHILD2_1_CREATE_TABLES; +let $CHILD2_1_HA_AS_DROP_TABLES2= + $CHILD2_1_DROP_TABLES2; +let $CHILD2_1_HA_AS_CREATE_TABLES2= + $CHILD2_1_CREATE_TABLES2; diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_2.inc new file mode 100644 index 00000000000..205eaa6fe35 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_2.inc @@ -0,0 +1,4 @@ +let $CHILD2_2_HA_DROP_TABLES= + $CHILD2_2_DROP_TABLES; +let $CHILD2_2_HA_CREATE_TABLES= + $CHILD2_2_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_3.inc new file mode 100644 index 00000000000..55cb858372c --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child2_3.inc @@ -0,0 +1,4 @@ +let $CHILD2_3_HA_DROP_TABLES= + $CHILD2_3_DROP_TABLES; +let $CHILD2_3_HA_CREATE_TABLES= + $CHILD2_3_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_1.inc new file mode 100644 index 00000000000..75655afcb1d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_1.inc @@ -0,0 +1,133 @@ +--let $CHILD3_1_ENGINE_TYPE=Spider +--let $CHILD3_1_ENGINE=ENGINE=Spider +--source ../include/init_spider.inc +eval INSERT INTO mysql.spider_link_mon_servers +(db_name, table_name, link_id, sid, server, scheme, host, port, socket, + username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, + ssl_verify_server_cert, default_file, default_group) VALUES +('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); +let $CHILD3_1_CHECK_LINK_STATUS= + SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables + ORDER BY db_name, table_name, link_id; +let $CHILD3_1_CHECK_LINK_FAILED_LOG= + SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +let $CHILD3_1_SET_RECOVERY_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "0 2"'; +let $CHILD3_1_SET_OK_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "0 1"'; +let $CHILD3_1_SET_OK_STATUS_AS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "1 0"'; + +let $CHILD3_1_DROP_TABLES_HA_2_1= + DROP TABLE IF EXISTS ta_l; +if ($VERSION_COMPILE_OS_WIN) +{ + let $CHILD3_1_CREATE_TABLES_HA_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; + let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +} +if (!$VERSION_COMPILE_OS_WIN) +{ + let $CHILD3_1_CREATE_TABLES_HA_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; + let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +} +let $CHILD3_1_DROP_TABLES_HA_P_2_1= + DROP TABLE IF EXISTS ta_l2; +let $CHILD3_1_CREATE_TABLES_HA_P_2_1= + CREATE TABLE ta_l2 ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= + CREATE TABLE ta_l2 ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +let $CHILD3_1_SET_OK_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +let $CHILD3_1_SET_OK_STATUS_AS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_2.inc new file mode 100644 index 00000000000..306c966378d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_2.inc @@ -0,0 +1,133 @@ +--let $CHILD3_2_ENGINE_TYPE=Spider +--let $CHILD3_2_ENGINE=ENGINE=Spider +--source ../include/init_spider.inc +eval INSERT INTO mysql.spider_link_mon_servers +(db_name, table_name, link_id, sid, server, scheme, host, port, socket, + username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, + ssl_verify_server_cert, default_file, default_group) VALUES +('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); +let $CHILD3_2_CHECK_LINK_STATUS= + SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables + ORDER BY db_name, table_name, link_id; +let $CHILD3_2_CHECK_LINK_FAILED_LOG= + SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +let $CHILD3_2_SET_RECOVERY_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "0 2"'; +let $CHILD3_2_SET_OK_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "0 1"'; +let $CHILD3_2_SET_OK_STATUS_AS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "1 0"'; + +let $CHILD3_2_DROP_TABLES_HA_2_1= + DROP TABLE IF EXISTS ta_l; +if ($VERSION_COMPILE_OS_WIN) +{ + let $CHILD3_2_CREATE_TABLES_HA_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; + let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +} +if (!$VERSION_COMPILE_OS_WIN) +{ + let $CHILD3_2_CREATE_TABLES_HA_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; + let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +} +let $CHILD3_2_DROP_TABLES_HA_P_2_1= + DROP TABLE IF EXISTS ta_l2; +let $CHILD3_2_CREATE_TABLES_HA_P_2_1= + CREATE TABLE ta_l2 ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= + CREATE TABLE ta_l2 ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +let $CHILD3_2_SET_OK_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +let $CHILD3_2_SET_OK_STATUS_AS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_3.inc new file mode 100644 index 00000000000..838c9c1cd64 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_child3_3.inc @@ -0,0 +1,133 @@ +--let $CHILD3_3_ENGINE_TYPE=Spider +--let $CHILD3_3_ENGINE=ENGINE=Spider +--source ../include/init_spider.inc +eval INSERT INTO mysql.spider_link_mon_servers +(db_name, table_name, link_id, sid, server, scheme, host, port, socket, + username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, + ssl_verify_server_cert, default_file, default_group) VALUES +('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); +let $CHILD3_3_CHECK_LINK_STATUS= + SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables + ORDER BY db_name, table_name, link_id; +let $CHILD3_3_CHECK_LINK_FAILED_LOG= + SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +let $CHILD3_3_SET_RECOVERY_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "0 2"'; +let $CHILD3_3_SET_OK_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "0 1"'; +let $CHILD3_3_SET_OK_STATUS_AS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", lst "1 0"'; + +let $CHILD3_3_DROP_TABLES_HA_2_1= + DROP TABLE IF EXISTS ta_l; +if ($VERSION_COMPILE_OS_WIN) +{ + let $CHILD3_3_CREATE_TABLES_HA_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; + let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +} +if (!$VERSION_COMPILE_OS_WIN) +{ + let $CHILD3_3_CREATE_TABLES_HA_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; + let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= + CREATE TABLE ta_l ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET + COMMENT='table "ta_r ta_r3"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +} +let $CHILD3_3_DROP_TABLES_HA_P_2_1= + DROP TABLE IF EXISTS ta_l2; +let $CHILD3_3_CREATE_TABLES_HA_P_2_1= + CREATE TABLE ta_l2 ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= + CREATE TABLE ta_l2 ( + a INT DEFAULT 10, + b CHAR(1) DEFAULT 'c', + c DATETIME DEFAULT '1999-10-10 10:10:10', + PRIMARY KEY(a) + ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +let $CHILD3_3_SET_OK_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +let $CHILD3_3_SET_OK_STATUS_AS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_master_1.inc new file mode 100644 index 00000000000..32b502e428e --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/ha_init_master_1.inc @@ -0,0 +1,81 @@ +eval INSERT INTO mysql.spider_link_mon_servers +(db_name, table_name, link_id, sid, server, scheme, host, port, socket, + username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, + ssl_verify_server_cert, default_file, default_group) VALUES +('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), +('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); +let $MASTER_1_CHECK_LINK_STATUS= + SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables + ORDER BY db_name, table_name, link_id; +let $MASTER_1_CHECK_LINK_FAILED_LOG= + SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +let $MASTER_1_SET_RECOVERY_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", lst "0 2"'; +let $MASTER_1_SET_OK_STATUS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", lst "0 1"'; +let $MASTER_1_SET_OK_STATUS_AS_2_1= + ALTER TABLE ta_l + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", lst "1 0"'; +let $MASTER_1_COPY_TABLES_2_1= + SELECT spider_copy_tables('ta_l', '0', '1'); + +let $MASTER_1_COMMENT_HA_2_1= + COMMENT='database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r ta_r3", + wrapper "odbc_mariadb"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2"'; +let $MASTER_1_COMMENT_HA_AS_2_1= + COMMENT='database "auto_test_remote auto_test_remote2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r ta_r3", + wrapper "odbc_mariadb"' + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'; +let $MASTER_1_COMMENT_HA_P_2_1= + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $MASTER_1_COMMENT_HA_AS_P_2_1= + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001"' + ); +let $MASTER_1_SET_RECOVERY_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +let $MASTER_1_SET_OK_STATUS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +let $MASTER_1_SET_OK_STATUS_AS_P_2_1= + ALTER TABLE ta_l2 + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r ta_r3", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +let $MASTER_1_COPY_TABLES_P_2_1= + SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); +let $MASTER_1_CHECK_HA_STATUS= + SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +let $MASTER_1_CHANGE_HA_MON= + SELECT spider_flush_table_mon_cache(); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_1.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_1.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_2.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_2.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_3.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_child2_3.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_master_1.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_deinit_master_1.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_1.inc new file mode 100644 index 00000000000..521cc34f311 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_1.inc @@ -0,0 +1,24 @@ +let $CHILD2_1_HS_DROP_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r"', '', 'srv "s_2_1"'); +let $CHILD2_1_HS_CREATE_TABLES= + SELECT spider_direct_sql('CREATE TABLE "hs_r" ( + "a" INT DEFAULT 10, + "b" CHAR(1) DEFAULT \'c\', + "c" DATE DEFAULT \'1999-10-10\', + "d" INT DEFAULT 11, + PRIMARY KEY("a") + )', '', 'srv "s_2_1"'); +let $CHILD2_1_HS_SELECT_TABLES= + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"'); +let $CHILD2_1_HS_DROP_TABLES2= + SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r2"', '', 'srv "s_2_1"'); +let $CHILD2_1_HS_CREATE_TABLES2= + SELECT spider_direct_sql('CREATE TABLE "hs_r2" ( + "a" INT DEFAULT 10, + "b" CHAR(1) DEFAULT \'c\', + "c" DATE DEFAULT \'1999-10-10\', + "d" INT DEFAULT 11, + PRIMARY KEY("a") + )', '', 'srv "s_2_1"'); +let $CHILD2_1_HS_SELECT_TABLES2= + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"'); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_2.inc new file mode 100644 index 00000000000..4cac8a953d0 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_2.inc @@ -0,0 +1,12 @@ +let $CHILD2_2_HS_DROP_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r3"', '', 'srv "s_2_2"'); +let $CHILD2_2_HS_CREATE_TABLES= + SELECT spider_direct_sql('CREATE TABLE "hs_r3" ( + "a" INT DEFAULT 10, + "b" CHAR(1) DEFAULT \'c\', + "c" DATE DEFAULT \'1999-10-10\', + "d" INT DEFAULT 11, + PRIMARY KEY("a") + )', '', 'srv "s_2_2"'); +let $CHILD2_2_HS_SELECT_TABLES= + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"'); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_3.inc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_child2_3.inc diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_master_1.inc new file mode 100644 index 00000000000..0ff5e2a10d9 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/hs_init_master_1.inc @@ -0,0 +1,12 @@ +let $MASTER_1_HS_COMMENT_TMP= + COMMENT=''; +let $MASTER_1_HS_COMMENT_2_1= + COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; +let $MASTER_1_HS_COMMENT_P_2_1= + COMMENT='uhr "1", uhw "1"' + PARTITION BY RANGE(a) ( + PARTITION pt1 VALUES LESS THAN (4) + COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', + PARTITION pt2 VALUES LESS THAN MAXVALUE + COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' + ); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_1.inc new file mode 100644 index 00000000000..b2c1faf20e5 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_1.inc @@ -0,0 +1,191 @@ +let $CHILD2_1_DATEFORMAT= + SELECT 1; +let $CHILD2_1_DROP_DATABASE= + SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_DATABASE_IFEXISTS= + SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_DATABASE= + SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') $STR_SEMICOLON + SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT1= + SELECT spider_direct_sql('SELECT 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TABLES= + SELECT spider_direct_sql('CREATE TABLE `ta_r` ( + `a` INT DEFAULT 10, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\', + PRIMARY KEY(`a`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx1` ON `ta_r`(`b`)', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TABLES2= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r2`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TABLES2= + SELECT spider_direct_sql('CREATE TABLE `ta_r2` ( + `a` INT DEFAULT 10, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\', + PRIMARY KEY(`a`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TABLES2= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r2` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TABLES3= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r_no_idx`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TABLES3= + SELECT spider_direct_sql('CREATE TABLE `ta_r_no_idx` ( + `a` INT DEFAULT 10, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\' + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TABLES3= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r_no_idx` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TABLES4= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r_auto_inc`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TABLES4= + SELECT spider_direct_sql('CREATE TABLE `ta_r_auto_inc` ( + `a` INT AUTO_INCREMENT, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\', + PRIMARY KEY(`a`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TABLES4= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r_auto_inc` + ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TABLES5= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `s_2_1_ta_r_int`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TABLES5= + SELECT spider_direct_sql('CREATE TABLE `s_2_1_ta_r_int` ( + `a` INT AUTO_INCREMENT, + `b` INT DEFAULT 10, + `c` INT DEFAULT 11, + PRIMARY KEY(`a`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx1_s_2_1_ta_r_int` ON `s_2_1_ta_r_int`(`b`)', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx2_s_2_1_ta_r_int` ON `s_2_1_ta_r_int`(`c`)', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TABLES5= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `s_2_1_ta_r_int` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TABLES6= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r_3`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TABLES6= + SELECT spider_direct_sql('CREATE TABLE `ta_r_3` ( + `a` INT DEFAULT 10, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\' + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TABLES6= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r_3` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_FT_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ft_r`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_FT_TABLES= + SELECT spider_direct_sql('CREATE TABLE `ft_r` ( + `a` INT DEFAULT 0, + `b` TEXT, + `c` TEXT, + "d" TEXT, + PRIMARY KEY(`a`), + FULLTEXT INDEX "ft_idx1"(`b`), + FULLTEXT INDEX "ft_idx2"(`c`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_FT_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c`, `d` FROM `ft_r` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_FT_TABLES2= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ft_r2`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_FT_TABLES2= + SELECT spider_direct_sql('CREATE TABLE `ft_r2` ( + `a` INT DEFAULT 0, + `b` TEXT, + `c` TEXT, + `d` TEXT, + PRIMARY KEY(`a`), + FULLTEXT INDEX "ft_idx1"(`b`), + FULLTEXT INDEX "ft_idx2"(`c`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_FT_TABLES2= + SELECT spider_direct_sql('SELECT `a`, `b`, `c`, `d` FROM `ft_r2` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_GM_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `gm_r`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_GM_TABLES= + SELECT spider_direct_sql('CREATE TABLE `gm_r` ( + `a` INT DEFAULT 0, + `b` GEOMETRY NOT NULL, + `c` GEOMETRY NOT NULL, + PRIMARY KEY(`a`), + SPATIAL INDEX "sp_idx1"(`b`), + SPATIAL INDEX "sp_idx2"(`c`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_GM_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `gm_r` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_GM_TABLES2= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `gm_r2`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_GM_TABLES2= + SELECT spider_direct_sql('CREATE TABLE `gm_r2` ( + `a` INT DEFAULT 0, + `b` GEOMETRY NOT NULL, + `c` GEOMETRY NOT NULL, + PRIMARY KEY(`a`), + SPATIAL INDEX "sp_idx1"(`b`), + SPATIAL INDEX "sp_idx2"(`c`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_GM_TABLES2= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `gm_r2` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_LOCK_TABLES1= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t1_1`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_LOCK_TABLES1= + SELECT spider_direct_sql('CREATE TABLE `t1_1` ( + `id` INT NOT NULL, + PRIMARY KEY (`id`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_LOCK_TABLES2= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t2_2`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_LOCK_TABLES2= + SELECT spider_direct_sql('CREATE TABLE `t2_2` ( + `id` INT NOT NULL, + PRIMARY KEY (`id`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_INCREMENT_TABLES1= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t1_1`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_INCREMENT_TABLES1= + SELECT spider_direct_sql('CREATE TABLE `t1_1` ( + `id` INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_INCREMENT_TABLES1= + SELECT spider_direct_sql('SELECT `id` FROM `t1_1` ORDER BY `id`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TEXT_PK_TABLES1= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t1`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TEXT_PK_TABLES1= + SELECT spider_direct_sql('CREATE TABLE `t1` ( + `a` VARCHAR(255), + PRIMARY KEY (`a`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TEXT_PK_TABLES1= + SELECT spider_direct_sql('SELECT `a` FROM `t1` ORDER BY `a`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_DROP_TEXT_KEY_TABLES1= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t1`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_CREATE_TEXT_KEY_TABLES1= + SELECT spider_direct_sql('CREATE TABLE `t1` ( + `a` VARCHAR(255), + `b` VARCHAR(255), + `c` VARCHAR(255), + PRIMARY KEY (`c`) + )', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx1_t1` ON `t1`(`a`,`b`)', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx2_t1` ON `t1`(`b`)', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_SELECT_TEXT_KEY_TABLES1= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `t1` ORDER BY `c`', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_AUTO_INCREMENT_INCREMENT1= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_INCREMENT = 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_AUTO_INCREMENT_INCREMENT2= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_AUTO_INCREMENT_OFFSET1= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_OFFSET = 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_1_AUTO_INCREMENT_OFFSET2= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_2.inc new file mode 100644 index 00000000000..fe5f9bcccaf --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_2.inc @@ -0,0 +1,93 @@ +let $CHILD2_2_DATEFORMAT= + SELECT 1; +let $CHILD2_2_DROP_DATABASE= + SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_DATABASE_IFEXISTS= + SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_DATABASE= + SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') $STR_SEMICOLON + SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_SELECT1= + SELECT spider_direct_sql('SELECT 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r3`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_TABLES= + SELECT spider_direct_sql('CREATE TABLE `ta_r3` ( + `a` INT DEFAULT 10, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\', + PRIMARY KEY(`a`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_TABLES5= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `s_2_2_ta_r_int`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_TABLES5= + SELECT spider_direct_sql('CREATE TABLE `s_2_2_ta_r_int` ( + `a` INT AUTO_INCREMENT, + `b` INT DEFAULT 10, + `c` INT DEFAULT 11, + PRIMARY KEY(`a`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx1_s_2_2_ta_r_int` ON `s_2_2_ta_r_int`(`b`)', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('CREATE INDEX `idx2_s_2_2_ta_r_int` ON `s_2_2_ta_r_int`(`c`)', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_SELECT_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r3` ORDER BY `a`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_FT_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ft_r3`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_FT_TABLES= + SELECT spider_direct_sql('CREATE TABLE `ft_r3` ( + `a` INT DEFAULT 0, + `b` TEXT, + `c` TEXT, + `d` TEXT, + PRIMARY KEY(`a`), + FULLTEXT INDEX "ft_idx1"(`b`), + FULLTEXT INDEX "ft_idx2"(`c`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_SELECT_FT_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c`, `d` FROM `ft_r3` ORDER BY `a`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_GM_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `gm_r3`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_GM_TABLES= + SELECT spider_direct_sql('CREATE TABLE `gm_r3` ( + `a` INT DEFAULT 0, + `b` GEOMETRY NOT NULL, + `c` GEOMETRY NOT NULL, + PRIMARY KEY(`a`), + SPATIAL INDEX "sp_idx1"(`b`), + SPATIAL INDEX "sp_idx2"(`c`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_SELECT_GM_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `gm_r3` ORDER BY `a`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_LOCK_TABLES1= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t1_2`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_LOCK_TABLES1= + SELECT spider_direct_sql('CREATE TABLE `t1_2` ( + `id` INT NOT NULL, + PRIMARY KEY (`id`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_LOCK_TABLES2= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t2_1`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_LOCK_TABLES2= + SELECT spider_direct_sql('CREATE TABLE `t2_1` ( + `id` INT NOT NULL, + PRIMARY KEY (`id`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_DROP_INCREMENT_TABLES1= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `t1_2`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_CREATE_INCREMENT_TABLES1= + SELECT spider_direct_sql('CREATE TABLE `t1_2` ( + `id` INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) + )', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_SELECT_INCREMENT_TABLES1= + SELECT spider_direct_sql('SELECT `id` FROM `t1_2` ORDER BY `id`', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_INCREMENT = 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_AUTO_INCREMENT_OFFSET1= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_OFFSET = 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_2_AUTO_INCREMENT_OFFSET2= + SELECT spider_direct_sql('SET GLOBAL AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_3.inc new file mode 100644 index 00000000000..40d1d42303b --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child2_3.inc @@ -0,0 +1,22 @@ +let $CHILD2_3_DATEFORMAT= + SELECT 1; +let $CHILD2_3_DROP_DATABASE= + SELECT spider_direct_sql('DROP DATABASE auto_test_remote3', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_3_DROP_DATABASE_IFEXISTS= + SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_3_CREATE_DATABASE= + SELECT spider_direct_sql('CREATE DATABASE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') $STR_SEMICOLON + SELECT spider_direct_sql('USE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_3_SELECT1= + SELECT spider_direct_sql('SELECT 1', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_3_DROP_TABLES= + SELECT spider_direct_sql('DROP TABLE IF EXISTS `ta_r4`', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_3_CREATE_TABLES= + SELECT spider_direct_sql('CREATE TABLE `ta_r4` ( + `a` INT DEFAULT 10, + `b` CHAR(1) DEFAULT \'c\', + `c` DATE DEFAULT \'1999-10-10\', + PRIMARY KEY(`a`) + )', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); +let $CHILD2_3_SELECT_TABLES= + SELECT spider_direct_sql('SELECT `a`, `b`, `c` FROM `ta_r4` ORDER BY `a`', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_1.inc new file mode 100644 index 00000000000..25b149dd7e7 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_1.inc @@ -0,0 +1,3 @@ +--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE +--source ../../../include/init_engine.inc +--let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_2.inc new file mode 100644 index 00000000000..6d920fc0c99 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_2.inc @@ -0,0 +1,3 @@ +--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE +--source ../../../include/init_engine.inc +--let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_3.inc new file mode 100644 index 00000000000..f0593a05362 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_child3_3.inc @@ -0,0 +1,3 @@ +--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE +--source ../../../include/init_engine.inc +--let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_master_1.inc new file mode 100644 index 00000000000..c1bd40d0390 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_master_1.inc @@ -0,0 +1,131 @@ +--source ../include/init_spider.inc +SET spider_direct_order_limit= 10000; +SET spider_init_sql_alloc_size= 1; +SET spider_conn_recycle_mode= 0; +let $MASTER_1_COMMENT_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r", wrapper "odbc_mariadb"'; +let $MASTER_1_COMMENT2_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r_no_idx", wrapper "odbc_mariadb"' + CONNECTION='prt "2000000"'; +let $MASTER_1_COMMENT_P_2_1= + COMMENT='table "ta_r3"' + PARTITION BY KEY(a) ( + PARTITION pt1 COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r2", + priority "1000"', + PARTITION pt2 COMMENT='srv "s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", priority "1000001"' + ); +let $MASTER_1_COMMENT2_P_2_1= + COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( + PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", + table "ta_r2", priority "1000"', + PARTITION pt2 VALUES LESS THAN MAXVALUE + COMMENT='srv "s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", priority "1000001"' + ); +let $MASTER_1_COMMENT3_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r_auto_inc", + wrapper "odbc_mariadb"'; +let $MASTER_1_COMMENT3_P_2_1= + COMMENT='table "s_2_1_ta_r_int"' + PARTITION BY LIST(MOD(a, 2)) ( + PARTITION pt1 VALUES IN (0) + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", priority "1000"', + PARTITION pt2 VALUES IN (1) + COMMENT='srv "s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", priority "1000001", + table "s_2_2_ta_r_int"' + ); +let $MASTER_1_COMMENT4_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "s_2_1_ta_r_int", + wrapper "odbc_mariadb"'; +let $MASTER_1_COMMENT5_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ta_r_3", wrapper "odbc_mariadb"'; +let $MASTER_1_COMMENT_FT_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "ft_r", wrapper "odbc_mariadb"'; +let $MASTER_1_COMMENT2_FT_P_2_1= + COMMENT='table "ft_r3"' + PARTITION BY RANGE(a) ( + PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", + table "ft_r2", priority "1000"', + PARTITION pt2 VALUES LESS THAN MAXVALUE + COMMENT='srv "s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", priority "1000001"' + ); +let $MASTER_1_COMMENT_GM_2_1= + COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", table "gm_r"'; +let $MASTER_1_COMMENT2_GM_P_2_1= + COMMENT='table "gm_r3"' + PARTITION BY RANGE(a) ( + PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", + table "gm_r2", priority "1000"', + PARTITION pt2 VALUES LESS THAN MAXVALUE + COMMENT='srv "s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver", priority "1000001"' + ); +let $MASTER_1_COMMENT_LOCK1= + COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_COMMENT_LOCK2= + COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_COMMENT_INCREMENT1_1= + COMMENT 'aim "0", tbl "t1_1", srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_COMMENT_INCREMENT1_P_1= + COMMENT 'aim "0"' + PARTITION BY LIST(MOD(id, 2)) ( + PARTITION pt1 VALUES IN (0) + COMMENT='tbl "t1_1", srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"', + PARTITION pt2 VALUES IN (1) + COMMENT='tbl "t1_2", srv "s_2_2", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"' + ); +let $MASTER_1_COMMENT_READONLY1_1= + COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_COMMENT_ERROR_MODE1_1= + COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_COMMENT_TEXT_PK1_1= + COMMENT 'tbl "t1", srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_COMMENT_TEXT_KEY1_1= + COMMENT 'tbl "t1", srv "s_2_1", default_group "MariaDB\\\\ ODBC\\\\ 3.0\\\\ Driver"'; +let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS= + SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +let $MASTER_1_CHECK_DIRECT_DELETE_STATUS= + SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS= + SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; +let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS= + SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +let $MASTER_1_AUTO_INCREMENT_INCREMENT1= + SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $MASTER_1_AUTO_INCREMENT_INCREMENT2= + SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $MASTER_1_AUTO_INCREMENT_OFFSET1= + SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $MASTER_1_AUTO_INCREMENT_OFFSET2= + SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') + $STR_SEMICOLON + SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +let $MASTER_1_AUTO_INCREMENT_OFFSET3= + SET SESSION AUTO_INCREMENT_OFFSET = 1; +let $MASTER_1_AUTO_INCREMENT_OFFSET4= + SET SESSION AUTO_INCREMENT_OFFSET = 777; diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_slave1_1.inc new file mode 100644 index 00000000000..73c3c6b9ef2 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_slave1_1.inc @@ -0,0 +1,10 @@ +let $SLAVE1_1_COMMENT_INCREMENT1_1= + COMMENT ''; +let $SLAVE1_1_COMMENT_INCREMENT1_P_1= + COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( + PARTITION pt1 VALUES IN (0) + COMMENT='', + PARTITION pt2 VALUES IN (1) + COMMENT='' + ); diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/include/init_spider.inc b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_spider.inc new file mode 100644 index 00000000000..9f983898700 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/include/init_spider.inc @@ -0,0 +1,153 @@ +--source ../../../include/init_spider.inc +let $VERSION_COMPILE_OS_WIN= + `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; +if ($VERSION_COMPILE_OS_WIN) +{ + eval DROP SERVER IF EXISTS s_2_1_test; + eval CREATE SERVER s_2_1_test FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'test', + USER 'root', + PASSWORD '', + PORT $CHILD2_1_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_2_test; + eval CREATE SERVER s_2_2_test FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'test', + USER 'root', + PASSWORD '', + PORT $CHILD2_2_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_3_test; + eval CREATE SERVER s_2_3_test FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'test', + USER 'root', + PASSWORD '', + PORT $CHILD2_3_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_1; + eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'auto_test_remote', + USER 'root', + PASSWORD '', + PORT $CHILD2_1_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_2; + eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'auto_test_remote2', + USER 'root', + PASSWORD '', + PORT $CHILD2_2_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_3; + eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'auto_test_remote3', + USER 'root', + PASSWORD '', + PORT $CHILD2_3_MYPORT + ); + eval DROP SERVER IF EXISTS s_3_1; + eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + PORT $CHILD3_1_MYPORT + ); + eval DROP SERVER IF EXISTS s_3_2; + eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + PORT $CHILD3_2_MYPORT + ); + eval DROP SERVER IF EXISTS s_3_3; + eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + PORT $CHILD3_3_MYPORT + ); +} +if (!$VERSION_COMPILE_OS_WIN) +{ + eval DROP SERVER IF EXISTS s_2_1_test; + eval CREATE SERVER s_2_1_test FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'test', + USER 'root', + PASSWORD '', + PORT $CHILD2_1_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_2_test; + eval CREATE SERVER s_2_2_test FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'test', + USER 'root', + PASSWORD '', + PORT $CHILD2_2_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_3_test; + eval CREATE SERVER s_2_3_test FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'test', + USER 'root', + PASSWORD '', + PORT $CHILD2_3_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_1; + eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'auto_test_remote', + USER 'root', + PASSWORD '', + PORT $CHILD2_1_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_2; + eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'auto_test_remote2', + USER 'root', + PASSWORD '', + PORT $CHILD2_2_MYPORT + ); + eval DROP SERVER IF EXISTS s_2_3; + eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER odbc_mariadb OPTIONS ( + HOST '127.0.0.1', + DATABASE 'auto_test_remote3', + USER 'root', + PASSWORD '', + PORT $CHILD2_3_MYPORT + ); + eval DROP SERVER IF EXISTS s_3_1; + eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + SOCKET '$CHILD3_1_MYSOCK' + ); + eval DROP SERVER IF EXISTS s_3_2; + eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + SOCKET '$CHILD3_2_MYSOCK' + ); + eval DROP SERVER IF EXISTS s_3_3; + eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + HOST 'localhost', + DATABASE 'auto_test_local', + USER 'root', + PASSWORD '', + SOCKET '$CHILD3_3_MYSOCK' + ); +} diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my.cnf new file mode 100644 index 00000000000..b7f76a630cc --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my.cnf @@ -0,0 +1,2 @@ +!include include/default_mysqld.cnf +!include my_1_1.cnf diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_1_1.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_1_1.cnf new file mode 100644 index 00000000000..84f1992e841 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_1_1.cnf @@ -0,0 +1,49 @@ +[mysqld.1.1] +log-bin= master-bin +loose_handlersocket_port= 20000 +loose_handlersocket_port_wr= 20001 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 +loose_partition= 1 +loose_spider_general_log= 1 + +[ENV] +USE_GEOMETRY_TEST= 1 +USE_FULLTEXT_TEST= 1 +USE_HA_TEST= 1 +USE_GENERAL_LOG= 1 +USE_REPLICATION= 0 +MASTER_1_MYPORT= @mysqld.1.1.port +MASTER_1_HSRPORT= 20000 +MASTER_1_HSWPORT= 20001 +MASTER_1_MYSOCK= @mysqld.1.1.socket +MASTER_1_ENGINE_TYPE= Spider +#MASTER_1_ENGINE_TYPE= MyISAM +MASTER_1_ENGINE= ENGINE=Spider +MASTER_1_CHARSET= DEFAULT CHARSET=utf8 +MASTER_1_ENGINE2= ENGINE=MyISAM +MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 +MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +ODBC_DSN= postgres_mysql +ODBC_DSN_HA1= postgres_auto_test_remote +ODBC_DSN_HA2= postgres_auto_test_remote2 +ODBC_DSN_HA3= postgres_auto_test_remote3 + +STR_SEMICOLON= ; + +#The followings are set in include/init_xxx.inc files +# MASTER_1_COMMENT_2_1 +# MASTER_1_COMMENT2_2_1 +# MASTER_1_COMMENT3_2_1 +# MASTER_1_COMMENT4_2_1 +# MASTER_1_COMMENT5_2_1 +# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_2_1.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_2_1.cnf new file mode 100644 index 00000000000..24161645607 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_2_1.cnf @@ -0,0 +1,56 @@ +[mysqld.2.1] +loose_handlersocket_port= 20002 +loose_handlersocket_port_wr= 20003 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +USE_CHILD_GROUP2= 1 +OUTPUT_CHILD_GROUP2= 0 +CHILD2_1_MYPORT= @mysqld.2.1.port +CHILD2_1_HSRPORT= 20002 +CHILD2_1_HSWPORT= 20003 +CHILD2_1_MYSOCK= @mysqld.2.1.socket +CHILD2_1_ENGINE_TYPE= InnoDB +CHILD2_1_ENGINE= ENGINE=InnoDB +CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci +CHILD2_1_FT_MYPORT= @mysqld.2.1.port +CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket +CHILD2_1_FT_ENGINE_TYPE= MyISAM +CHILD2_1_FT_ENGINE= ENGINE=MyISAM +CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_1_GM_MYPORT= @mysqld.2.1.port +CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket +CHILD2_1_GM_ENGINE_TYPE= MyISAM +CHILD2_1_GM_ENGINE= ENGINE=MyISAM +CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_1_DROP_TABLES +# CHILD2_1_CREATE_TABLES +# CHILD2_1_SELECT_TABLES +# CHILD2_1_DROP_TABLES2 +# CHILD2_1_CREATE_TABLES2 +# CHILD2_1_SELECT_TABLES2 +# CHILD2_1_DROP_TABLES3 +# CHILD2_1_CREATE_TABLES3 +# CHILD2_1_SELECT_TABLES3 +# CHILD2_1_DROP_TABLES4 +# CHILD2_1_CREATE_TABLES4 +# CHILD2_1_SELECT_TABLES4 +# CHILD2_1_DROP_TABLES5 +# CHILD2_1_CREATE_TABLES5 +# CHILD2_1_SELECT_TABLES5 +# CHILD2_1_DROP_TABLES6 +# CHILD2_1_CREATE_TABLES6 +# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_2_2.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_2_2.cnf new file mode 100644 index 00000000000..2d3c2a89a7d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_2_2.cnf @@ -0,0 +1,38 @@ +[mysqld.2.2] +loose_handlersocket_port= 20004 +loose_handlersocket_port_wr= 20005 +loose_handlersocket_threads= 2 +loose_handlersocket_threads_wr= 1 +loose_handlersocket_support_merge_table= 0 +loose_handlersocket_direct_update_mode= 2 +loose_handlersocket_unlimited_boundary= 65536 +loose_handlersocket_bulk_insert= 0 +loose_handlersocket_bulk_insert_timeout= 0 +loose_handlersocket_general_log= 1 +loose_handlersocket_timeout= 30 +loose_handlersocket_close_table_interval=2 +open_files_limit= 4096 + +[ENV] +CHILD2_2_MYPORT= @mysqld.2.2.port +CHILD2_2_HSRPORT= 20004 +CHILD2_2_HSWPORT= 20005 +CHILD2_2_MYSOCK= @mysqld.2.2.socket +CHILD2_2_ENGINE_TYPE= InnoDB +CHILD2_2_ENGINE= ENGINE=InnoDB +CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_FT_MYPORT= @mysqld.2.2.port +CHILD2_2_FT_MYSOCK= @mysqld.2.2.socket +CHILD2_2_FT_ENGINE_TYPE= MyISAM +CHILD2_2_FT_ENGINE= ENGINE=MyISAM +CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 +CHILD2_2_GM_MYPORT= @mysqld.2.2.port +CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket +CHILD2_2_GM_ENGINE_TYPE= MyISAM +CHILD2_2_GM_ENGINE= ENGINE=MyISAM +CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 + +#The followings are set in include/init_xxx.inc files +# CHILD2_2_DROP_TABLES +# CHILD2_2_CREATE_TABLES +# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_2_3.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_2_3.cnf new file mode 100644 index 00000000000..444f669fa80 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_2_3.cnf @@ -0,0 +1,9 @@ +[mysqld.2.3] +open_files_limit= 4096 + +[ENV] +CHILD2_3_MYPORT= @mysqld.2.3.port +CHILD2_3_MYSOCK= @mysqld.2.3.socket +CHILD2_3_ENGINE_TYPE= InnoDB +CHILD2_3_ENGINE= ENGINE=InnoDB +CHILD2_3_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_3_1.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_3_1.cnf new file mode 100644 index 00000000000..fad21607789 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_3_1.cnf @@ -0,0 +1,11 @@ +[mysqld.3.1] +loose_partition= 1 + +[ENV] +USE_CHILD_GROUP3= 1 +OUTPUT_CHILD_GROUP3= 0 +CHILD3_1_MYPORT= @mysqld.3.1.port +CHILD3_1_MYSOCK= @mysqld.3.1.socket +CHILD3_1_ENGINE_TYPE= InnoDB +CHILD3_1_ENGINE= ENGINE=InnoDB +CHILD3_1_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_3_2.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_3_2.cnf new file mode 100644 index 00000000000..6f027b6f525 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_3_2.cnf @@ -0,0 +1,9 @@ +[mysqld.3.2] +loose_partition= 1 + +[ENV] +CHILD3_2_MYPORT= @mysqld.3.2.port +CHILD3_2_MYSOCK= @mysqld.3.2.socket +CHILD3_2_ENGINE_TYPE= InnoDB +CHILD3_2_ENGINE= ENGINE=InnoDB +CHILD3_2_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_3_3.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_3_3.cnf new file mode 100644 index 00000000000..fbb33694738 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_3_3.cnf @@ -0,0 +1,9 @@ +[mysqld.3.3] +loose_partition= 1 + +[ENV] +CHILD3_3_MYPORT= @mysqld.3.3.port +CHILD3_3_MYSOCK= @mysqld.3.3.socket +CHILD3_3_ENGINE_TYPE= InnoDB +CHILD3_3_ENGINE= ENGINE=InnoDB +CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/my_4_1.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/my_4_1.cnf new file mode 100644 index 00000000000..d1812a48b68 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/my_4_1.cnf @@ -0,0 +1,9 @@ +[mysqld.4.1] +loose_partition= 1 + +[ENV] +SLAVE1_1_MYPORT= @mysqld.4.1.port +SLAVE1_1_MYSOCK= @mysqld.4.1.socket +SLAVE1_1_ENGINE_TYPE= MyISAM +SLAVE1_1_ENGINE= ENGINE=MyISAM +SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/basic_sql.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/basic_sql.result new file mode 100644 index 00000000000..3b1b8ebf679 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/basic_sql.result @@ -0,0 +1,744 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table select test +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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'); +DROP TABLE IF EXISTS ta_l; +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 +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +create table ignore select test +connection master_1; +DROP TABLE IF EXISTS ta_l; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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'); +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 +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +Warning 1062 Duplicate entry '3' for key 'PRIMARY' +Warning 1062 Duplicate entry '4' for key 'PRIMARY' +Warning 1062 Duplicate entry '5' for key 'PRIMARY' +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +create table ignore select test +connection master_1; +DROP TABLE IF EXISTS ta_l; +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 +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +create no index table +connection master_1; +DROP TABLE IF EXISTS ta_l_no_idx; +CREATE TABLE ta_l_no_idx +MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 +SELECT a, b, c FROM tb_l +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select table +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select table shared mode +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select table for update +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a +FOR UPDATE; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select table join +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; +a b date_format(b.c, '%Y-%m-%d %H:%i:%s') +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 + +select table straight_join +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; +a b date_format(b.c, '%Y-%m-%d %H:%i:%s') +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 + +select sql_small_result +connection master_1; +SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select sql_big_result +connection master_1; +SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select sql_buffer_result +connection master_1; +SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select sql_cache +connection master_1; +SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select sql_no_cache +connection master_1; +SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select sql_calc_found_rows +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +connection master_1; +SELECT found_rows(); +found_rows() +5 + +select high_priority +connection master_1; +SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select distinct +connection master_1; +SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select count +connection master_1; +SELECT count(*) FROM ta_l; +count(*) +5 + +select table join not use index +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; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +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 + +select using pushdown +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; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +select using index and pushdown +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; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +insert +connection master_1; +TRUNCATE TABLE ta_l; +connection master_1; +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 00:00:00 + +insert select +connection master_1; +TRUNCATE TABLE ta_l; +connection master_1; +INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +insert select a +connection master_1; +TRUNCATE TABLE ta_l; +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'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 + +insert low_priority +connection master_1; +TRUNCATE TABLE ta_l; +connection master_1; +INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 00:00:00 + +insert high_priority +connection master_1; +TRUNCATE TABLE ta_l; +connection master_1; +INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', +'2008-01-01 23:59:59'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 00:00:00 + +insert ignore +connection master_1; +INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); +Warnings: +Warning 1062 Duplicate entry '2' for key 'PRIMARY' +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 00:00:00 + +insert update (insert) +connection master_1; +TRUNCATE TABLE ta_l; +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'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 00:00:00 + +insert update (update) +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'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 f 2005-08-08 00:00:00 + +replace +connection master_1; +TRUNCATE TABLE ta_l; +INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); +connection master_1; +REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 f 2008-02-02 00:00:00 + +replace select +connection master_1; +REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +replace select a +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'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +replace low_priority +connection master_1; +REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', +'2009-03-03 03:03:03'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 g 2009-03-03 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +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'); +connection master_1; +UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +2 f 2008-02-02 00:00:00 + +update select +connection master_1; +UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM +tb_l); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 00:00:00 +2 g 2009-03-03 00:00:00 + +update select a +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); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 h 2010-04-04 00:00:00 +2 g 2009-03-03 00:00:00 + +update join +connection master_1; +UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 + +update join a +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; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 00:00:00 +2 g 2009-03-03 00:00:00 + +update low_priority +connection master_1; +UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 00:00:00 +2 f 2008-02-02 00:00:00 + +update ignore +connection master_1; +UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 00:00:00 +2 f 2008-02-02 00:00:00 + +update pushdown +connection master_1; +update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 00:00:00 +2 j 2009-03-03 00:00:00 + +update index pushdown +connection master_1; +UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 g 2009-03-03 00:00:00 +2 g 2009-03-03 00:00:00 + +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'); +connection master_1; +DELETE FROM ta_l WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +3 e 2008-01-01 00:00:00 +4 e 2008-01-01 00:00:00 +5 e 2008-01-01 00:00:00 +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +delete all +connection master_1; +DELETE FROM ta_l; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') + +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'); +connection master_1; +DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 e 2008-01-01 00:00:00 +3 e 2008-01-01 00:00:00 +4 e 2008-01-01 00:00:00 +5 e 2008-01-01 00:00:00 +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +3 e 2008-01-01 00:00:00 +4 e 2008-01-01 00:00:00 +5 e 2008-01-01 00:00:00 +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE IGNORE FROM ta_l WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +3 e 2008-01-01 00:00:00 +4 e 2008-01-01 00:00:00 +5 e 2008-01-01 00:00:00 +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE QUICK FROM ta_l WHERE a = 2; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 e 2008-01-01 00:00:00 +3 e 2008-01-01 00:00:00 +4 e 2008-01-01 00:00:00 +5 e 2008-01-01 00:00:00 +6 e 2008-01-01 00:00:00 +7 e 2008-01-01 00:00:00 +8 e 2008-01-01 00:00:00 +9 e 2008-01-01 00:00:00 +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE FROM ta_l WHERE b = 'e'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +10 j 2008-01-01 00:00:00 + +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'); +connection master_1; +DELETE FROM ta_l WHERE a > 0 AND b = 'e'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +10 j 2008-01-01 00:00:00 + +truncate +connection master_1; +TRUNCATE TABLE ta_l; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/basic_sql_part.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/basic_sql_part.result new file mode 100644 index 00000000000..43683423662 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/basic_sql_part.result @@ -0,0 +1,147 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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'); + +create table with partition and select test +connection master_1; +CREATE TABLE ta_l2 ( +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 +SELECT a, b, c FROM tb_l +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +select partition using pushdown +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; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +select partition using index pushdown +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; +a b date_format(a.c, '%Y-%m-%d %H:%i:%s') +2 g 2000-02-01 00:00:00 + +update partition pushdown +connection master_1; +UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 e 2009-03-03 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +update partition index pushdown +connection master_1; +UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +2 g 2000-02-01 00:00:00 +3 j 2009-03-03 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +delete partition pushdown +TRUNCATE TABLE ta_l2; +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +connection master_1; +DELETE FROM ta_l2 WHERE b = 'g'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +delete partition index pushdown +TRUNCATE TABLE ta_l2; +INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; +connection master_1; +DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 f 2008-07-01 00:00:00 +3 j 2007-05-04 00:00:00 +4 i 2003-10-30 00:00:00 +5 h 2001-10-31 00:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_aggregate.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_aggregate.result new file mode 100644 index 00000000000..b4ce8f4c5c5 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_aggregate.result @@ -0,0 +1,106 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table select test +connection master_1; +DROP TABLE IF EXISTS ta_l; +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 (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'); + +direct_aggregating test +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT COUNT(*) FROM ta_l; +COUNT(*) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 1 +SELECT MAX(a) FROM ta_l; +MAX(a) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 +SELECT MIN(a) FROM ta_l; +MIN(a) +1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 3 +SELECT MAX(a) FROM ta_l WHERE a < 5; +MAX(a) +4 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 4 +SELECT MIN(a) FROM ta_l WHERE a > 1; +MIN(a) +2 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 5 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_aggregate_part.result new file mode 100644 index 00000000000..088a3e6c850 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_aggregate_part.result @@ -0,0 +1,96 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +with partition test +connection master_1; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 0 +SELECT COUNT(*) FROM ta_l2; +COUNT(*) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 2 +SELECT MAX(a) FROM ta_l2; +MAX(a) +5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 4 +SELECT MIN(a) FROM ta_l2; +MIN(a) +1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 6 +SELECT MAX(a) FROM ta_l2 WHERE a < 5; +MAX(a) +4 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 8 +SELECT MIN(a) FROM ta_l2 WHERE a > 1; +MIN(a) +2 +SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; +Variable_name Value +Spider_direct_aggregate 10 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_update.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_update.result new file mode 100644 index 00000000000..b072fb8bbd8 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_update.result @@ -0,0 +1,161 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table select test +connection master_1; +DROP TABLE IF EXISTS ta_l; +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 (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'); + +direct_updating test +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 0 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +update all rows with function +UPDATE ta_l SET c = ADDDATE(c, 1); +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 0 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 e 2007-06-05 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +update by primary key +UPDATE ta_l SET b = 'x' WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 x 2007-06-05 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +update by a column without index +UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 2 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 x 2011-10-17 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +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; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 2 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +delete by primary key with order and limit +DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +Spider_direct_delete 0 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +delete by a column without index +DELETE FROM ta_l WHERE b = 'c'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +Spider_direct_delete 1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 00:00:00 +delete by primary key +DELETE FROM ta_l WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +Spider_direct_delete 2 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +4 d 2003-12-01 00:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_update_part.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_update_part.result new file mode 100644 index 00000000000..520af7497b1 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/direct_update_part.result @@ -0,0 +1,151 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +with partition test +connection master_1; +CREATE TABLE ta_l2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 0 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +update all rows with function +UPDATE ta_l2 SET c = ADDDATE(c, 1); +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 0 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 e 2007-06-05 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +update by primary key +UPDATE ta_l2 SET b = 'x' WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 x 2007-06-05 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +update by a column without index +UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 3 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 x 2011-10-17 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +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; +SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; +Variable_name Value +Spider_direct_update 3 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +2 b 2000-01-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +delete by primary key with order and limit +DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +Spider_direct_delete 0 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 00:00:00 +5 c 2002-01-01 00:00:00 +delete by a column without index +DELETE FROM ta_l2 WHERE b = 'c'; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +Spider_direct_delete 2 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +3 x 2011-10-18 00:00:00 +4 d 2003-12-01 00:00:00 +delete by primary key +DELETE FROM ta_l2 WHERE a = 3; +SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; +Variable_name Value +Spider_direct_delete 3 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-02 00:00:00 +4 d 2003-12-01 00:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/function.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/function.result new file mode 100644 index 00000000000..c619140625e --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/function.result @@ -0,0 +1,166 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +in() +connection master_1; +CREATE TABLE t1 ( +a VARCHAR(255), +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1 +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; +connection master_1; +select a from t1 where a in ('15', '120'); +a +120 +15 + +date_sub() +connection master_1; +DROP TABLE IF EXISTS ta_l; +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 (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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-08-01 00:00:00 +2 b 1999-01-01 00:00:00 +3 e 2006-06-04 00:00:00 +4 d 2002-11-30 00:00:00 +5 c 2000-12-31 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-11-01 00:00:00 +2 b 1999-04-01 00:00:00 +3 e 2006-09-04 00:00:00 +4 d 2003-02-28 00:00:00 +5 c 2001-03-31 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-01 00:00:00 +2 b 1999-03-01 00:00:00 +3 e 2006-08-04 00:00:00 +4 d 2003-01-28 00:00:00 +5 c 2001-02-28 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-08 00:00:00 +2 b 1999-03-08 00:00:00 +3 e 2006-08-11 00:00:00 +4 d 2003-02-04 00:00:00 +5 c 2001-03-07 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-07 00:00:00 +2 b 1999-03-07 00:00:00 +3 e 2006-08-10 00:00:00 +4 d 2003-02-03 00:00:00 +5 c 2001-03-06 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-07 00:00:00 +2 b 1999-03-07 00:00:00 +3 e 2006-08-10 00:00:00 +4 d 2003-02-03 00:00:00 +5 c 2001-03-06 00:00:00 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-06 00:00:00 +2 b 1999-03-06 00:00:00 +3 e 2006-08-09 00:00:00 +4 d 2003-02-02 00:00:00 +5 c 2001-03-05 00:00:00 +UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2007-10-06 00:00:00 +2 b 1999-03-06 00:00:00 +3 e 2006-08-09 00:00:00 +4 d 2003-02-02 00:00:00 +5 c 2001-03-05 00:00:00 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/ha.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/ha.result new file mode 100644 index 00000000000..10bc18a8a68 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/ha.result @@ -0,0 +1,316 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +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; + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table test +connection master_1; +DROP TABLE IF EXISTS ta_l; +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 +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 test +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +fail-over test +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 0 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'auto_test_remote2.ta_r3' get a problem +DELETE FROM ta_l WHERE a = 6; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 3 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l 1 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +6 e 2011-05-05 00:00:00 + +recovery test +connection master_1; +ALTER TABLE ta_l +CONNECTION='msi "5", mkd "2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 2 +show create table mysql.spider_tables; +Table Create Table +spider_tables CREATE TABLE `spider_tables` ( + `db_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `table_name` char(199) COLLATE utf8_bin NOT NULL DEFAULT '', + `link_id` int(11) NOT NULL DEFAULT 0, + `priority` bigint(20) NOT NULL DEFAULT 0, + `server` char(64) COLLATE utf8_bin DEFAULT NULL, + `scheme` char(64) COLLATE utf8_bin DEFAULT NULL, + `host` char(64) COLLATE utf8_bin DEFAULT NULL, + `port` char(5) COLLATE utf8_bin DEFAULT NULL, + `socket` text COLLATE utf8_bin DEFAULT NULL, + `username` char(64) COLLATE utf8_bin DEFAULT NULL, + `password` char(64) COLLATE utf8_bin DEFAULT NULL, + `ssl_ca` text COLLATE utf8_bin DEFAULT NULL, + `ssl_capath` text COLLATE utf8_bin DEFAULT NULL, + `ssl_cert` text COLLATE utf8_bin DEFAULT NULL, + `ssl_cipher` char(64) COLLATE utf8_bin DEFAULT NULL, + `ssl_key` text COLLATE utf8_bin DEFAULT NULL, + `ssl_verify_server_cert` tinyint(4) NOT NULL DEFAULT 0, + `monitoring_binlog_pos_at_failing` tinyint(4) NOT NULL DEFAULT 0, + `default_file` text COLLATE utf8_bin DEFAULT NULL, + `default_group` char(64) COLLATE utf8_bin DEFAULT NULL, + `dsn` char(64) COLLATE utf8_bin DEFAULT NULL, + `tgt_db_name` char(64) COLLATE utf8_bin DEFAULT NULL, + `tgt_table_name` char(64) COLLATE utf8_bin DEFAULT NULL, + `link_status` tinyint(4) NOT NULL DEFAULT 1, + `block_status` tinyint(4) NOT NULL DEFAULT 0, + `static_link_id` char(64) COLLATE utf8_bin DEFAULT NULL, + PRIMARY KEY (`db_name`,`table_name`,`link_id`), + UNIQUE KEY `uidx1` (`db_name`,`table_name`,`static_link_id`), + KEY `idx1` (`priority`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 +select * from mysql.spider_tables; +db_name table_name link_id priority server scheme host port socket username password ssl_ca ssl_capath ssl_cert ssl_cipher ssl_key ssl_verify_server_cert monitoring_binlog_pos_at_failing default_file default_group dsn tgt_db_name tgt_table_name link_status block_status static_link_id +auto_test_local ta_l 0 1000000 s_2_1 odbc_mariadb NULL 0 0 MariaDB ODBC 3.0 Driver auto_test_remote ta_r 1 0 NULL +auto_test_local ta_l 1 1000000 s_2_2 odbc_mariadb NULL 0 0 MariaDB ODBC 3.0 Driver auto_test_remote2 ta_r3 2 0 NULL +SELECT spider_copy_tables('ta_l', '0', '1'); +spider_copy_tables('ta_l', '0', '1') +1 +connection master_1; +ALTER TABLE ta_l +CONNECTION='msi "5", mkd "2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +6 e 2011-05-05 00:00:00 +8 g 2011-05-05 00:00:00 +DROP TABLE ta_l; +connection master_1; +SELECT spider_flush_table_mon_cache(); +spider_flush_table_mon_cache() +1 + +active standby test +create table test +connection master_1; +DROP TABLE IF EXISTS ta_l; +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 +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 test +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +fail-over test +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 2 +INSERT INTO ta_l (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'auto_test_remote.ta_r' get a problem +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 3 +auto_test_local ta_l 1 1 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l 1 +auto_test_local ta_l 0 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 2 +Spider_mon_table_cache_version_req 2 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +6 e 2011-05-05 00:00:00 + +recovery test +connection master_1; +ALTER TABLE ta_l +CONNECTION='msi "5", mkd "2", alc "1", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l 0 1 +auto_test_local ta_l 1 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +8 g 2011-05-05 00:00:00 +DROP TABLE ta_l; +connection master_1; +SELECT spider_flush_table_mon_cache(); +spider_flush_table_mon_cache() +1 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote3', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote3', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"') +1 +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; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for child3 +child3_3 +child3_2 +child3_1 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/ha_part.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/ha_part.result new file mode 100644 index 00000000000..17b6ab7b3df --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/ha_part.result @@ -0,0 +1,306 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote3', '', 'srv "s_2_3_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +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; + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table with partition test +connection master_1; +DROP TABLE IF EXISTS ta_l2; +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 +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'); + +select test +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +fail-over test +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 0 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'auto_test_remote3.ta_r4' get a problem +DELETE FROM ta_l2 WHERE a = 6; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 3 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l2#P#pt2 1 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +6 e 2011-05-05 00:00:00 + +recovery test +connection master_1; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\ ODBC\\ 3.0\\ Driver", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\ ODBC\\ 3.0\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 2 +SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); +spider_copy_tables('ta_l2#P#pt2', '0', '1') +1 +connection master_1; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\ ODBC\\ 3.0\\ Driver", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\ ODBC\\ 3.0\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 +6 e 2011-05-05 00:00:00 +8 g 2011-05-05 00:00:00 +9 h 2011-05-05 00:00:00 +DROP TABLE ta_l2; + +create table with partition test +connection master_1; +DROP TABLE IF EXISTS ta_l2; +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 +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'); + +select test +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +fail-over test +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +INSERT INTO ta_l2 (a, b, c) VALUES +(6, 'e', '2011-05-05 20:04:05'); +ERROR HY000: Table 'auto_test_remote.ta_r2' get a problem +DELETE FROM ta_l2 WHERE a = 6; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 3 +auto_test_local ta_l2#P#pt2 1 1 +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +db_name table_name link_id +auto_test_local ta_l2#P#pt2 1 +auto_test_local ta_l2#P#pt2 0 +SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; +Variable_name Value +Spider_mon_table_cache_version 1 +Spider_mon_table_cache_version_req 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +3 e 2007-06-04 00:00:00 +5 c 2001-12-31 00:00:00 +6 e 2011-05-05 00:00:00 + +recovery test +connection master_1; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", default_group "MariaDB\\ ODBC\\ 3.0\\ Driver", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", default_group "MariaDB\\ ODBC\\ 3.0\\ Driver", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +db_name table_name link_id link_status +auto_test_local ta_l2#P#pt1 0 1 +auto_test_local ta_l2#P#pt1 1 1 +auto_test_local ta_l2#P#pt2 0 1 +auto_test_local ta_l2#P#pt2 1 1 +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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +3 e 2007-06-04 00:00:00 +5 c 2001-12-31 00:00:00 +8 g 2011-05-05 00:00:00 +9 h 2011-05-05 00:00:00 +DROP TABLE ta_l2; + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote3', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote3', '', 'srv "s_2_3", default_group "MariaDB ODBC 3.0 Driver"') +1 +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; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 +for child3 +child3_3 +child3_2 +child3_1 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/spider3_fixes.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider3_fixes.result new file mode 100644 index 00000000000..c10d18deba3 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider3_fixes.result @@ -0,0 +1,208 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +3.1 +auto_increment +connection master_1; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +777 +SELECT MAX(id) FROM t1; +MAX(id) +777 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1554 +SELECT MAX(id) FROM t2; +MAX(id) +1554 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1555 +SELECT MAX(id) FROM t1; +MAX(id) +1555 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2331 +SELECT MAX(id) FROM t2; +MAX(id) +2331 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2332 +SELECT id FROM t1 ORDER BY id; +id +777 +1554 +1555 +2331 +2332 +3109 +3886 +4663 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5439 +SELECT id FROM t2 ORDER BY id; +id +777 +1554 +1555 +2331 +2332 +3109 +3886 +4663 +5439 +6216 +6993 +7770 +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +777 +SELECT id FROM t1 ORDER BY id; +id +777 +1554 +2331 +3108 +INSERT INTO t2 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3885 +SELECT id FROM t2 ORDER BY id; +id +777 +1554 +2331 +3108 +3885 +4662 +5439 +6216 +SET INSERT_ID=5000; +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +6216 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6993 +SELECT MAX(id) FROM t2; +MAX(id) +6993 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6993 +SELECT MAX(id) FROM t1; +MAX(id) +10000 +INSERT INTO t2 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6993 +SELECT MAX(id) FROM t2; +MAX(id) +10000 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for slave1_1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider3_fixes_part.result new file mode 100644 index 00000000000..c6fb7369ab8 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider3_fixes_part.result @@ -0,0 +1,206 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 +auto_increment with partition +connection master_1; +DROP TABLE IF EXISTS t1, t2; +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 +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 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +777 +SELECT MAX(id) FROM t1; +MAX(id) +777 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1554 +SELECT MAX(id) FROM t2; +MAX(id) +1554 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1555 +SELECT MAX(id) FROM t1; +MAX(id) +1555 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2331 +SELECT MAX(id) FROM t2; +MAX(id) +2331 +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2332 +SELECT id FROM t1 ORDER BY id; +id +777 +1554 +1555 +2331 +2332 +3109 +3886 +4663 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5439 +SELECT id FROM t2 ORDER BY id; +id +777 +1554 +1555 +2331 +2332 +3109 +3886 +4663 +5439 +6216 +6993 +7770 +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +777 +SELECT id FROM t1 ORDER BY id; +id +777 +1554 +2331 +3108 +INSERT INTO t2 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3885 +SELECT id FROM t2 ORDER BY id; +id +777 +1554 +2331 +3108 +3885 +4662 +5439 +6216 +SET INSERT_ID=5000; +MASTER_1_AUTO_INCREMENT_OFFSET3 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +6216 +MASTER_1_AUTO_INCREMENT_OFFSET4 +INSERT INTO t2 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6993 +SELECT MAX(id) FROM t2; +MAX(id) +6993 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6993 +SELECT MAX(id) FROM t1; +MAX(id) +10000 +INSERT INTO t2 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +6993 +SELECT MAX(id) FROM t2; +MAX(id) +10000 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for slave1_1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/spider_fixes.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider_fixes.result new file mode 100644 index 00000000000..29d8b8fc795 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider_fixes.result @@ -0,0 +1,563 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table and insert +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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'); +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +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; + +2.13 +select table with "order by desc" and "<" +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a < 5 ORDER BY a DESC LIMIT 3; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +4 d 2003-11-30 00:00:00 +3 e 2007-06-04 00:00:00 +2 b 2000-01-01 00:00:00 + +select table with "order by desc" and "<=" +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a <= 5 ORDER BY a DESC LIMIT 3; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +5 c 2001-12-31 00:00:00 +4 d 2003-11-30 00:00:00 +3 e 2007-06-04 00:00:00 + +2.14 +update table with range scan and split_read +connection master_1; +UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-02-02 00:00:00 +3 e 2000-02-02 00:00:00 +4 d 2000-02-02 00:00:00 +5 c 2000-02-02 00:00:00 + +2.15 +select table with range scan +TRUNCATE TABLE ta_l; +DROP TABLE IF EXISTS ta_l; +connection master_1; +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 +INSERT INTO ta_l SELECT a, b, c FROM tb_l; +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'; +a b c +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'; +a b c +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'; +a b c +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'; +a b c +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'; +a b c +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'; +a b c +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'; +a b c +2 b 2000-01-01 00:00:00 +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'; +a b c +2 b 2000-01-01 00:00:00 +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'; +a b c +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'; +a b c +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'; +a b c +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'; +a b c +2 b 2000-01-01 00:00:00 + +2.16 +auto_increment insert with trigger +connection master_1; +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 +CREATE TABLE tc_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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;; +connection master_1; +INSERT INTO ta_l_auto_inc (a, b, c) VALUES +(NULL, 's', '2008-12-31 20:59:59'); +connection master_1; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 s 2008-12-31 20:59:59 + +2.17 +engine-condition-pushdown with "or" and joining +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); +a b date_format(c, '%Y-%m-%d %H:%i:%s') +1 a 2008-08-01 00:00:00 +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +2.23 +index merge +connection master_1; +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 +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; +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; +a b c +3 4 5 +4 5 6 +5 6 7 + +2.24 +index scan update without PK +connection master_1; +DROP TABLE IF EXISTS ta_l_int; +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 +SELECT a, b, c FROM ta_l_int ORDER BY a; +a b c +1 2 3 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +8 9 10 +9 10 11 +10 11 12 +11 12 13 +12 13 14 +13 14 15 +14 15 16 +15 16 17 +16 17 18 +INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); +INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); +connection master_1; +UPDATE ta_l_int SET c = 4 WHERE b = 2; +connection master_1; +SELECT a, b, c FROM ta_l_int ORDER BY a; +a b c +1 2 4 +2 3 4 +3 4 5 +4 5 6 +5 6 7 +6 7 8 +7 8 9 +8 9 10 +9 10 11 +10 11 12 +11 12 13 +12 13 14 +13 14 15 +14 15 16 +15 16 17 +16 17 18 +17 2 4 +18 2 4 + +2.25 +direct order limit +connection master_1; +SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; +Variable_name Value +Spider_direct_order_limit 2 +SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; +a b c +1 2 4 +2 3 4 +3 4 5 +SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; +Variable_name Value +Spider_direct_order_limit 3 + +2.26 +lock tables +connection master_1; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 +CREATE TABLE t2 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 +LOCK TABLES t1 READ, t2 READ; +UNLOCK TABLES; + +auto_increment +connection master_1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +777 +SELECT MAX(id) FROM t1; +MAX(id) +777 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1554 +SELECT MAX(id) FROM t1; +MAX(id) +1554 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2331 +SELECT MAX(id) FROM t1; +MAX(id) +2331 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3108 +SELECT MAX(id) FROM t1; +MAX(id) +3108 +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3885 +SELECT id FROM t1 ORDER BY id; +id +777 +1554 +2331 +3108 +3885 +4662 +5439 +6216 +SET INSERT_ID=5000; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +6216 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +10000 +INSERT INTO t1 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +10000 + +read only +connection master_1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1 +SELECT id FROM t1 ORDER BY id; +id +777 +1000 +1554 +2331 +3108 +3885 +4662 +5000 +5439 +6216 +10000 +INSERT INTO t1 (id) VALUES (1); +ERROR HY000: Table 'auto_test_local.t1' is read only +UPDATE t1 SET id = 4 WHERE id = 777; +ERROR HY000: Table 'auto_test_local.t1' is read only +DELETE FROM t1 WHERE id = 777; +ERROR HY000: Table 'auto_test_local.t1' is read only +DELETE FROM t1; +ERROR HY000: Table 'auto_test_local.t1' is read only +TRUNCATE t1; +ERROR HY000: Table 'auto_test_local.t1' is read only + +2.27 +error mode +skipped + +3.0 +is null +connection master_1; +DROP TABLE IF EXISTS t1; +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 +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; +connection master_1; +select a from t1 where a is null order by a limit 30; +a +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +select b from t1 where b is null order by b limit 30; +b +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL + +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; +connection master_1; +select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; +a b c +10 74 74 +10 42 42 +10 234 234 +10 202 202 +10 170 170 +select a, c from t1 where a = '10' order by b desc limit 5; +a c +10 74 +10 42 +10 234 +10 202 +10 170 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for slave1_1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider_fixes_part.result new file mode 100644 index 00000000000..b4f96494565 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/spider_fixes_part.result @@ -0,0 +1,220 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +for slave1_1 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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'); + +2.17 +partition with sort +connection master_1; +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 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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +2 b 2000-01-01 00:00:00 +3 e 2007-06-04 00:00:00 +4 d 2003-11-30 00:00:00 +5 c 2001-12-31 00:00:00 + +2.23 +partition update with moving partition +connection master_1; +DROP TABLE IF EXISTS ta_l2; +connection master_1; +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 (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; +a b date_format(c, '%Y-%m-%d %H:%i:%s') +4 B 2010-09-26 00:00:00 +index merge with partition +connection master_1; +DROP TABLE IF EXISTS ta_l_int; +connection master_1; +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 +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; +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; +a b c +3 4 5 +4 5 6 +5 6 7 + +2.26 +auto_increment with partition +connection master_1; +DROP TABLE IF EXISTS t1; +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 +MASTER_1_AUTO_INCREMENT_INCREMENT2 +MASTER_1_AUTO_INCREMENT_OFFSET2 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +777 +SELECT MAX(id) FROM t1; +MAX(id) +777 +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1554 +SELECT MAX(id) FROM t1; +MAX(id) +1554 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2331 +SELECT MAX(id) FROM t1; +MAX(id) +2331 +INSERT INTO t1 (id) VALUES (null); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3108 +SELECT MAX(id) FROM t1; +MAX(id) +3108 +INSERT INTO t1 () VALUES (),(),(),(); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3885 +SELECT id FROM t1 ORDER BY id; +id +777 +1554 +2331 +3108 +3885 +4662 +5439 +6216 +SET INSERT_ID=5000; +INSERT INTO t1 () VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +6216 +INSERT INTO t1 (id) VALUES (10000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +10000 +INSERT INTO t1 (id) VALUES (1000); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5000 +SELECT MAX(id) FROM t1; +MAX(id) +10000 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for slave1_1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/r/vp_fixes.result b/storage/spider/mysql-test/spider/odbc/mariadb/r/vp_fixes.result new file mode 100644 index 00000000000..e38ca7bba17 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/r/vp_fixes.result @@ -0,0 +1,99 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote', '', 'srv "s_2_1_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE IF EXISTS auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') ; +SELECT spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('CREATE DATABASE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 +spider_direct_sql('USE auto_test_remote2', '', 'srv "s_2_2_test", default_group "MariaDB ODBC 3.0 Driver"') +1 + +test select 1 +connection master_1; +SELECT 1; +1 +1 + +create table and insert +connection master_1; +DROP TABLE IF EXISTS tb_l; +CREATE TABLE tb_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE2 MASTER_1_CHARSET2 +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'); +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +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; + +0.9 +create different primary key table +connection master_1; +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 +connection master_1; +INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); +create un-correspond primary key table +connection master_1; +DROP TABLE IF EXISTS ta_l_int; +connection master_1; +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 +connection master_1; +INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +SELECT spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote', '', 'srv "s_2_1", default_group "MariaDB ODBC 3.0 Driver"') +1 +SELECT spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"'); +spider_direct_sql('DROP DATABASE auto_test_remote2', '', 'srv "s_2_2", default_group "MariaDB ODBC 3.0 Driver"') +1 +for child3 +for child2 +child2_3 +child2_2 +child2_1 +for master_1 + +end of test diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql.test new file mode 100644 index 00000000000..f5d7e2bcd9e --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql.test @@ -0,0 +1,1242 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 (!$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 + } + 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 +--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 + } + 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 +--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 + } + 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 + } + 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 (!$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 + } + 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 +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; + +--echo +--echo select table shared mode +--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; + +--echo +--echo select table for update +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a +FOR UPDATE; + +--echo +--echo select table join +--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; + +--echo +--echo select table straight_join +--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; + +--echo +--echo select sql_small_result +--connection master_1 +SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select sql_big_result +--connection master_1 +SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select sql_buffer_result +--connection master_1 +SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select sql_cache +--connection master_1 +SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select sql_no_cache +--connection master_1 +SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select sql_calc_found_rows +--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; +--connection master_1 +SELECT found_rows(); + +--echo +--echo select high_priority +--connection master_1 +SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select distinct +--connection master_1 +SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +ORDER BY a; + +--echo +--echo select count +--connection master_1 +SELECT count(*) FROM ta_l; + +--echo +--echo select table join not use index +--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; + +--echo +--echo select using pushdown +--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; + +--echo +--echo select using index and pushdown +--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; + +--echo +--echo insert +--connection master_1 +TRUNCATE TABLE ta_l; +--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 + } + 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; +--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 + } + 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; +--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 + } + 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; +--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 + } + 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; +--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 + } + 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 +--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 + } + 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; +--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 + } + 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) +--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 + } + 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'); +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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'); +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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 +--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 + } + 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'); +--connection master_1 +DELETE FROM ta_l WHERE a = 2; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + 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 +--connection master_1 +DELETE FROM ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + 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'); +--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 + } + 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'); +--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 + } + 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'); +--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 + } + 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'); +--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 + } + 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'); +--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 + } + 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'); +--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 + } + 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'); +--connection master_1 +DELETE FROM ta_l WHERE b = 'e'; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + 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'); +--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 + } + 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 +--connection master_1 +TRUNCATE TABLE ta_l; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/basic_sql_part.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql_part.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql_part.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql_part.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql_part.test new file mode 100644 index 00000000000..44ee250229c --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/basic_sql_part.test @@ -0,0 +1,313 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 ($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 (!$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 + } + eval $CHILD2_2_SELECT_TABLES; + 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) +{ + --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; +} + +--echo +--echo select partition using index pushdown +if ($HAVE_PARTITION) +{ + --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; +} + +--echo +--echo update partition pushdown +if ($HAVE_PARTITION) +{ + --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 + } + eval $CHILD2_2_SELECT_TABLES; + 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) +{ + --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 + } + eval $CHILD2_2_SELECT_TABLES; + 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; + --connection master_1 + DELETE FROM ta_l2 WHERE b = 'g'; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + eval $CHILD2_2_SELECT_TABLES; + 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; + --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 + } + eval $CHILD2_2_SELECT_TABLES; + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_1.inc new file mode 100644 index 00000000000..cd9b0c9ca9b --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_1.inc @@ -0,0 +1 @@ +--connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_2.inc new file mode 100644 index 00000000000..e145f66b630 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_2.inc @@ -0,0 +1 @@ +--connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child2_3.inc new file mode 100644 index 00000000000..d356348d8ea --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child3_1.inc new file mode 100644 index 00000000000..03e5c188c89 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child3_2.inc new file mode 100644 index 00000000000..d62a7ada824 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_child3_3.inc new file mode 100644 index 00000000000..fb49f5bfdac --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/connect_master_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_master_1.inc new file mode 100644 index 00000000000..0c129ce5775 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/connect_slave1_1.inc new file mode 100644 index 00000000000..45a822743e0 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/direct_aggregate.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate.test new file mode 100644 index 00000000000..e8e4cc0c4bf --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate.test @@ -0,0 +1,145 @@ +--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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 (!$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 +--connection master_1 +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; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/direct_aggregate_part.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate_part.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate_part.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate_part.test new file mode 100644 index 00000000000..cf74918a81c --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_aggregate_part.test @@ -0,0 +1,166 @@ +--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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 ($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 (!$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_AGGREGATE_STATUS; + SELECT COUNT(*) 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; + if ($USE_CHILD_GROUP2) + { + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + eval $CHILD2_2_SELECT_TABLES; + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/direct_update.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update.test new file mode 100644 index 00000000000..4d74532536e --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update.test @@ -0,0 +1,164 @@ +--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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 (!$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 +--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 + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/direct_update_part.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update_part.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update_part.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update_part.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update_part.test new file mode 100644 index 00000000000..a6462958c48 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/direct_update_part.test @@ -0,0 +1,185 @@ +--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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 ($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 (!$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 + } + eval $CHILD2_2_SELECT_TABLES; + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/function.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/function.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/function.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/function.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/function.test new file mode 100644 index 00000000000..be64d5410d1 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/function.test @@ -0,0 +1,213 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + 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; +--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 + } + 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 + } + 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 (!$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 + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/ha.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha.cnf new file mode 100644 index 00000000000..acaf1c3420b --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha.cnf @@ -0,0 +1,11 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +!include ../my_3_1.cnf +!include ../my_3_2.cnf +!include ../my_3_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 +USE_CHILD_GROUP3= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/ha.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha.test new file mode 100644 index 00000000000..ce2883b8a01 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha.test @@ -0,0 +1,724 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; + eval $CHILD2_3_DROP_DATABASE_IFEXISTS; + eval $CHILD2_3_CREATE_DATABASE; +} +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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + eval $CHILD2_3_DATEFORMAT; + eval $CHILD2_3_SELECT1; + 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 + } + 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 ($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 (!$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 +--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 + } + eval $CHILD2_1_SELECT_TABLES; + 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 + } + 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'); +DELETE FROM ta_l WHERE a = 6; +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 + } + 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 + } + 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 (!$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; +show create table mysql.spider_tables; +select * from mysql.spider_tables; +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 + } + eval $CHILD2_1_SELECT_TABLES; + 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 +eval $MASTER_1_CHANGE_HA_MON; + +--echo +--echo active standby test +--echo create table test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + 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 ($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 (!$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 +--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 + } + eval $CHILD2_1_SELECT_TABLES; + 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 + } + 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 + } + 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 + } + 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 (!$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 + } + eval $CHILD2_1_SELECT_TABLES; + 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 +eval $MASTER_1_CHANGE_HA_MON; + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; + eval $CHILD2_3_DROP_DATABASE; +} +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/odbc/mariadb/t/ha_part.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_part.cnf new file mode 100644 index 00000000000..acaf1c3420b --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_part.cnf @@ -0,0 +1,11 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +!include ../my_3_1.cnf +!include ../my_3_2.cnf +!include ../my_3_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 +USE_CHILD_GROUP3= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_part.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_part.test new file mode 100644 index 00000000000..e66d3e38ca3 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_part.test @@ -0,0 +1,783 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; + eval $CHILD2_3_DROP_DATABASE_IFEXISTS; + eval $CHILD2_3_CREATE_DATABASE; +} +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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + eval $CHILD2_3_DATEFORMAT; + eval $CHILD2_3_SELECT1; + 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 + } + 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 ($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 ($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 (!$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 + --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 + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + eval $CHILD2_2_SELECT_TABLES; + 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 + } + 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'); + DELETE FROM ta_l2 WHERE a = 6; + 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 + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + 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 + } + 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 (!$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 + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + eval $CHILD2_2_SELECT_TABLES; + 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 + } + 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 ($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 ($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 (!$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 + --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 + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + eval $CHILD2_2_SELECT_TABLES; + 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 + } + 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 (!$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'); + DELETE FROM ta_l2 WHERE a = 6; + 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 + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_2_SELECT_TABLES; + 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 + } + 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 (!$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 + } + eval $CHILD2_1_SELECT_TABLES; + eval $CHILD2_1_SELECT_TABLES2; + eval $CHILD2_2_SELECT_TABLES; + 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 + } + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; + eval $CHILD2_3_DROP_DATABASE; +} +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/odbc/mariadb/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_test_deinit.inc new file mode 100644 index 00000000000..ae56679f788 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_test_deinit.inc @@ -0,0 +1,27 @@ +# 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 + --source ../include/ha_deinit_child2_1.inc + --echo child2_2 + --source ../include/ha_deinit_child2_2.inc + --echo 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/odbc/mariadb/t/ha_test_init.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_test_init.inc new file mode 100644 index 00000000000..6f2c5eba273 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/ha_test_init.inc @@ -0,0 +1,27 @@ +# 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 + --source ../include/ha_init_child2_1.inc + --echo child2_2 + --source ../include/ha_init_child2_2.inc + --echo 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/odbc/mariadb/t/have_engine.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/have_engine.inc new file mode 100644 index 00000000000..64bef7499cb --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/have_func.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/have_func.inc new file mode 100644 index 00000000000..e0823e73fc8 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/have_odbc.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/have_odbc.inc new file mode 100644 index 00000000000..ff91838961e --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/have_odbc.inc @@ -0,0 +1,13 @@ +--disable_abort_on_error +CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "test", port "$CHILD2_1_MYPORT", host "localhost", user "root", password "", default_group "MariaDB ODBC 3.0 Driver", table "ta_r", wrapper "odbc_mariadb"'; +if ($mysql_errno) +{ + --skip Test requires to build with ODBC driver +} +--enable_abort_on_error +DROP TABLE ta_l; diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/have_partition.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/have_partition.inc new file mode 100644 index 00000000000..b6e699475db --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/have_trigger.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/have_trigger.inc new file mode 100644 index 00000000000..32de484b388 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/hs_test_deinit.inc new file mode 100644 index 00000000000..7ec2e981fd2 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/hs_test_init.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/hs_test_init.inc new file mode 100644 index 00000000000..831bf479524 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/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/odbc/mariadb/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/slave_test_deinit.inc new file mode 100644 index 00000000000..08fa8196a0d --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/slave_test_deinit.inc @@ -0,0 +1,9 @@ +# get connection and exist engine test +--echo for slave1_1 +if ($USE_REPLICATION) +{ + --connection slave1_1 + STOP SLAVE; + --source ../include/deinit_slave1_1.inc + --disconnect slave1_1 +} diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/slave_test_init.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/slave_test_init.inc new file mode 100644 index 00000000000..fb67bc20249 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/slave_test_init.inc @@ -0,0 +1,47 @@ +# get connection and exist engine test +--echo for slave1_1 +if ($USE_REPLICATION) +{ + --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/odbc/mariadb/t/spider3_fixes.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes.test new file mode 100644 index 00000000000..da5c2f98ccf --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes.test @@ -0,0 +1,280 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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; +eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; +eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +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 + } + 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 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/spider3_fixes_part.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes_part.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes_part.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes_part.test new file mode 100644 index 00000000000..472b808a27f --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider3_fixes_part.test @@ -0,0 +1,319 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 ($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 (!$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; + eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; + eval $MASTER_1_AUTO_INCREMENT_OFFSET2; + 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 + } + 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 + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/spider_fixes.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes.test new file mode 100644 index 00000000000..2031bf0331a --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes.test @@ -0,0 +1,842 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 (!$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 "<" +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a < 5 ORDER BY a DESC LIMIT 3; + +--echo +--echo select table with "order by desc" and "<=" +--connection master_1 +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l +WHERE a <= 5 ORDER BY a DESC LIMIT 3; + +--echo +--echo 2.14 +--echo update table with range scan and split_read +--connection master_1 +UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; +--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 + } + 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; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; +--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'; + +--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 + 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 + } + 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 + } + 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 +--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); + +--echo +--echo 2.23 +--echo index merge +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + 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; +--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; + +--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); +--connection master_1 +UPDATE ta_l_int SET c = 4 WHERE b = 2; +--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; +SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; +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 + } + 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 ($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 (!$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 + } + 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 (!$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; +eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; +eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +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 + } + 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 +--echo skipped + + +--echo +--echo 3.0 +--echo is null +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_result_log + } + --disable_query_log + 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; +--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 + } + 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; +--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 + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/spider_fixes_part.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes_part.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes_part.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes_part.test new file mode 100644 index 00000000000..256fcc1d34a --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/spider_fixes_part.test @@ -0,0 +1,525 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 ($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 (!$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 + } + eval $CHILD2_2_SELECT_TABLES; + 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 + } + 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 ($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 (!$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 + } + eval $CHILD2_2_SELECT_TABLES; + 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 + 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; + 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; + --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; +} + + +--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 + } + 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 ($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 (!$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; + eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; + eval $MASTER_1_AUTO_INCREMENT_OFFSET2; + 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 + } + 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 + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/mariadb/t/test_deinit.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/test_deinit.inc new file mode 100644 index 00000000000..1fc8670b17a --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/test_deinit.inc @@ -0,0 +1,31 @@ +# get connection and exist engine test +--echo for child3 +if ($USE_CHILD_GROUP3) +{ + --echo child3_3 + --connection child3_3 + --source ../include/deinit_child3_3.inc + --disconnect child3_3 + --echo child3_2 + --connection child3_2 + --source ../include/deinit_child3_2.inc + --disconnect child3_2 + --echo child3_1 + --connection child3_1 + --source ../include/deinit_child3_1.inc + --disconnect child3_1 +} +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_3 + --source ../include/deinit_child2_3.inc + --echo child2_2 + --source ../include/deinit_child2_2.inc + --echo child2_1 + --source ../include/deinit_child2_1.inc +} +--echo for master_1 +--connection master_1 +--source ../include/deinit_master_1.inc +--disconnect master_1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/test_init.inc b/storage/spider/mysql-test/spider/odbc/mariadb/t/test_init.inc new file mode 100644 index 00000000000..fbeaa8862fa --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/test_init.inc @@ -0,0 +1,54 @@ +# 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 +--source have_odbc.inc +--echo for child2 +if ($USE_CHILD_GROUP2) +{ + --echo child2_1 + --source ../include/init_child2_1.inc + --echo child2_2 + --source ../include/init_child2_2.inc + --echo child2_3 + --source ../include/init_child2_3.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/odbc/mariadb/t/vp_fixes.cnf b/storage/spider/mysql-test/spider/odbc/mariadb/t/vp_fixes.cnf new file mode 100644 index 00000000000..a5f020b06e6 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/vp_fixes.cnf @@ -0,0 +1,7 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf +!include ../my_2_2.cnf +!include ../my_2_3.cnf +[ENV] +USE_CHILD_GROUP2= 1 diff --git a/storage/spider/mysql-test/spider/odbc/mariadb/t/vp_fixes.test b/storage/spider/mysql-test/spider/odbc/mariadb/t/vp_fixes.test new file mode 100644 index 00000000000..8b6865fb170 --- /dev/null +++ b/storage/spider/mysql-test/spider/odbc/mariadb/t/vp_fixes.test @@ -0,0 +1,289 @@ +# 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) +{ + eval $CHILD2_1_DROP_DATABASE_IFEXISTS; + eval $CHILD2_1_CREATE_DATABASE; + eval $CHILD2_2_DROP_DATABASE_IFEXISTS; + eval $CHILD2_2_CREATE_DATABASE; +} +--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 + } + eval $CHILD2_1_DATEFORMAT; + eval $CHILD2_1_SELECT1; + eval $CHILD2_2_DATEFORMAT; + eval $CHILD2_2_SELECT1; + 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 + } + 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 (!$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 + 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 +--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 + } + 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 + 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 + } + 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 + } + 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) +{ + eval $CHILD2_1_DROP_DATABASE; + eval $CHILD2_2_DROP_DATABASE; +} +--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/odbc/pg/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_1.inc index ac724359545..e0a62cd339b 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_1.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_1.inc @@ -4,13 +4,13 @@ eval INSERT INTO mysql.spider_link_mon_servers (db_name, table_name, link_id, sid, server, scheme, host, port, socket, username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES + ssl_verify_server_cert, default_file, default_group, dsn) VALUES ('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); let $CHILD3_1_CHECK_LINK_STATUS= SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; @@ -18,16 +18,16 @@ let $CHILD3_1_CHECK_LINK_FAILED_LOG= SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; let $CHILD3_1_SET_RECOVERY_STATUS_2_1= ALTER TABLE ta_l - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 2"'; let $CHILD3_1_SET_OK_STATUS_2_1= ALTER TABLE ta_l - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 1"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 1"'; let $CHILD3_1_SET_OK_STATUS_AS_2_1= ALTER TABLE ta_l - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "1 0"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "1 0"'; let $CHILD3_1_DROP_TABLES_HA_2_1= DROP TABLE IF EXISTS ta_l; @@ -41,8 +41,8 @@ if ($VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= CREATE TABLE ta_l ( a INT DEFAULT 10, @@ -51,8 +51,8 @@ if ($VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; } if (!$VERSION_COMPILE_OS_WIN) { @@ -64,8 +64,8 @@ if (!$VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= CREATE TABLE ta_l ( a INT DEFAULT 10, @@ -74,8 +74,8 @@ if (!$VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; } let $CHILD3_1_DROP_TABLES_HA_P_2_1= DROP TABLE IF EXISTS ta_l2; @@ -86,11 +86,11 @@ let $CHILD3_1_CREATE_TABLES_HA_P_2_1= c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= @@ -100,34 +100,34 @@ let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); let $CHILD3_1_SET_OK_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); let $CHILD3_1_SET_OK_STATUS_AS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_2.inc index fab6525e503..0c4d03577b0 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_2.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_2.inc @@ -4,13 +4,13 @@ eval INSERT INTO mysql.spider_link_mon_servers (db_name, table_name, link_id, sid, server, scheme, host, port, socket, username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES + ssl_verify_server_cert, default_file, default_group, dsn) VALUES ('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); let $CHILD3_2_CHECK_LINK_STATUS= SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; @@ -18,16 +18,16 @@ let $CHILD3_2_CHECK_LINK_FAILED_LOG= SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; let $CHILD3_2_SET_RECOVERY_STATUS_2_1= ALTER TABLE ta_l - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 2"'; let $CHILD3_2_SET_OK_STATUS_2_1= ALTER TABLE ta_l - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 1"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 1"'; let $CHILD3_2_SET_OK_STATUS_AS_2_1= ALTER TABLE ta_l - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "1 0"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "1 0"'; let $CHILD3_2_DROP_TABLES_HA_2_1= DROP TABLE IF EXISTS ta_l; @@ -41,8 +41,8 @@ if ($VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= CREATE TABLE ta_l ( a INT DEFAULT 10, @@ -51,8 +51,8 @@ if ($VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; } if (!$VERSION_COMPILE_OS_WIN) { @@ -64,8 +64,8 @@ if (!$VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= CREATE TABLE ta_l ( a INT DEFAULT 10, @@ -74,8 +74,8 @@ if (!$VERSION_COMPILE_OS_WIN) PRIMARY KEY(a) ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET COMMENT='table "ta_r ta_r3"' - CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc", + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; } let $CHILD3_2_DROP_TABLES_HA_P_2_1= DROP TABLE IF EXISTS ta_l2; @@ -86,11 +86,11 @@ let $CHILD3_2_CREATE_TABLES_HA_P_2_1= c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= @@ -100,34 +100,34 @@ let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); let $CHILD3_2_SET_OK_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); let $CHILD3_2_SET_OK_STATUS_AS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_3.inc index 58bec867919..0492883873b 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_3.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_child3_3.inc @@ -4,13 +4,13 @@ eval INSERT INTO mysql.spider_link_mon_servers (db_name, table_name, link_id, sid, server, scheme, host, port, socket, username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES + ssl_verify_server_cert, default_file, default_group, dsn) VALUES ('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); let $CHILD3_3_CHECK_LINK_STATUS= SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; @@ -19,15 +19,15 @@ let $CHILD3_3_CHECK_LINK_FAILED_LOG= let $CHILD3_3_SET_RECOVERY_STATUS_2_1= ALTER TABLE ta_l CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 2"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 2"'; let $CHILD3_3_SET_OK_STATUS_2_1= ALTER TABLE ta_l CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 1"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "0 1"'; let $CHILD3_3_SET_OK_STATUS_AS_2_1= ALTER TABLE ta_l CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "1 0"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", lst "1 0"'; let $CHILD3_3_DROP_TABLES_HA_2_1= DROP TABLE IF EXISTS ta_l; @@ -40,9 +40,9 @@ if ($VERSION_COMPILE_OS_WIN) c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='table "ta_r ta_r3"' + COMMENT='table "ta_r ta_r3", wrapper "odbc"' CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= CREATE TABLE ta_l ( a INT DEFAULT 10, @@ -50,9 +50,9 @@ if ($VERSION_COMPILE_OS_WIN) c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='table "ta_r ta_r3"' + COMMENT='table "ta_r ta_r3", wrapper "odbc"' CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; } if (!$VERSION_COMPILE_OS_WIN) { @@ -63,9 +63,9 @@ if (!$VERSION_COMPILE_OS_WIN) c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='table "ta_r ta_r3"' + COMMENT='table "ta_r ta_r3", wrapper "odbc"' CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= CREATE TABLE ta_l ( a INT DEFAULT 10, @@ -73,9 +73,9 @@ if (!$VERSION_COMPILE_OS_WIN) c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='table "ta_r ta_r3"' + COMMENT='table "ta_r ta_r3", wrapper "odbc"' CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; + dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2"'; } let $CHILD3_3_DROP_TABLES_HA_P_2_1= DROP TABLE IF EXISTS ta_l2; @@ -86,11 +86,11 @@ let $CHILD3_3_CREATE_TABLES_HA_P_2_1= c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= @@ -100,34 +100,34 @@ let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); let $CHILD3_3_SET_OK_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); let $CHILD3_3_SET_OK_STATUS_AS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_master_1.inc index b7d369e6d62..232775caabc 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_master_1.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/ha_init_master_1.inc @@ -1,13 +1,13 @@ eval INSERT INTO mysql.spider_link_mon_servers (db_name, table_name, link_id, sid, server, scheme, host, port, socket, username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES + ssl_verify_server_cert, default_file, default_group, dsn) VALUES ('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL); let $MASTER_1_CHECK_LINK_STATUS= SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables ORDER BY db_name, table_name, link_id; @@ -26,51 +26,51 @@ let $MASTER_1_COPY_TABLES_2_1= SELECT spider_copy_tables('ta_l', '0', '1'); let $MASTER_1_COMMENT_HA_2_1= - COMMENT='socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", table "ta_r ta_r3", + COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", table "ta_r ta_r3", wrapper "odbc"' CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2"'; let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='socket "$ODBC_DSN_HA1 $ODBC_DSN_HA2", table "ta_r ta_r3", + COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", table "ta_r ta_r3", wrapper "odbc"' CONNECTION='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'; let $MASTER_1_COMMENT_HA_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $MASTER_1_COMMENT_HA_AS_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' + COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001"' ); let $MASTER_1_SET_RECOVERY_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); let $MASTER_1_SET_OK_STATUS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); let $MASTER_1_SET_OK_STATUS_AS_P_2_1= ALTER TABLE ta_l2 PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", tbl "ta_r ta_r3", priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); let $MASTER_1_COPY_TABLES_P_2_1= diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_1.inc index 16ce81304cd..88948dd39ab 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_1.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_1.inc @@ -1,5 +1,5 @@ let $CHILD2_1_HS_DROP_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_HS_CREATE_TABLES= SELECT spider_direct_sql('CREATE TABLE "hs_r" ( "a" INT DEFAULT 10, @@ -7,11 +7,11 @@ let $CHILD2_1_HS_CREATE_TABLES= "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), "d" INT DEFAULT 11, CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_HS_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_HS_DROP_TABLES2= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r2"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r2"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_HS_CREATE_TABLES2= SELECT spider_direct_sql('CREATE TABLE "hs_r2" ( "a" INT DEFAULT 10, @@ -19,6 +19,6 @@ let $CHILD2_1_HS_CREATE_TABLES2= "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), "d" INT DEFAULT 11, CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_HS_SELECT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r2" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_2.inc index 6f5ac6e5dae..e949094ca75 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_2.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_child2_2.inc @@ -1,5 +1,5 @@ let $CHILD2_2_HS_DROP_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r3"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "hs_r3"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_HS_CREATE_TABLES= SELECT spider_direct_sql('CREATE TABLE "hs_r3" ( "a" INT DEFAULT 10, @@ -7,6 +7,6 @@ let $CHILD2_2_HS_CREATE_TABLES= "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), "d" INT DEFAULT 11, CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_HS_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "hs_r3" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_master_1.inc index 0ff5e2a10d9..a304ff96050 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_master_1.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/hs_init_master_1.inc @@ -1,12 +1,12 @@ let $MASTER_1_HS_COMMENT_TMP= COMMENT=''; let $MASTER_1_HS_COMMENT_2_1= - COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; + COMMENT='dsn "$ODBC_DSN_HA1", wrapper "odbc", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; let $MASTER_1_HS_COMMENT_P_2_1= COMMENT='uhr "1", uhw "1"' PARTITION BY RANGE(a) ( PARTITION pt1 VALUES LESS THAN (4) - COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', + COMMENT='dsn "$ODBC_DSN_HA1", wrapper "odbc", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' + COMMENT='dsn "$ODBC_DSN_HA2", wrapper "odbc", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' ); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_1.inc b/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_1.inc index dbff0c73057..f656665d96e 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_1.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_1.inc @@ -1,5 +1,5 @@ let $CHILD2_1_DATEFORMAT= - SELECT spider_direct_sql('set datestyle=\'ISO, YMD\'', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('set datestyle=\'ISO, YMD\'', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_DATABASE= SELECT 1; let $CHILD2_1_DROP_DATABASE_IFEXISTS= @@ -7,80 +7,80 @@ let $CHILD2_1_DROP_DATABASE_IFEXISTS= let $CHILD2_1_CREATE_DATABASE= SELECT 1; let $CHILD2_1_SELECT1= - SELECT spider_direct_sql('SELECT 1', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT 1', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TABLES= SELECT spider_direct_sql('CREATE TABLE "ta_r" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a") - )', '', 'srv "s_2_1"') + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TABLES2= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r2"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r2"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TABLES2= SELECT spider_direct_sql('CREATE TABLE "ta_r2" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r2" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TABLES3= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r_no_idx"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r_no_idx"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TABLES3= SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\') - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TABLES3= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r_no_idx" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TABLES4= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r_auto_inc"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r_auto_inc"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TABLES4= SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TABLES4= SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r_auto_inc" - ORDER BY "a"', '', 'srv "s_2_1"'); + ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TABLES5= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "s_2_1_ta_r_int"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "s_2_1_ta_r_int"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TABLES5= SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" ( "a" INT DEFAULT 3, "b" INT DEFAULT 10, "c" INT DEFAULT 11, CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a") - )', '', 'srv "s_2_1"') + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"') + SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TABLES5= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TABLES6= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r_3"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r_3"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TABLES6= SELECT spider_direct_sql('CREATE TABLE "ta_r_3" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\') - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TABLES6= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r_3" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_FT_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ft_r"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ft_r"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_FT_TABLES= SELECT spider_direct_sql('CREATE TABLE "ft_r" ( "a" INT DEFAULT 0, @@ -90,11 +90,11 @@ let $CHILD2_1_CREATE_FT_TABLES= CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"), FULLTEXT INDEX "ft_idx1"("b"), FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_FT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_FT_TABLES2= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ft_r2"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ft_r2"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_FT_TABLES2= SELECT spider_direct_sql('CREATE TABLE "ft_r2" ( "a" INT DEFAULT 0, @@ -104,11 +104,11 @@ let $CHILD2_1_CREATE_FT_TABLES2= CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"), FULLTEXT INDEX "ft_idx1"("b"), FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_FT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_GM_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "gm_r"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "gm_r"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_GM_TABLES= SELECT spider_direct_sql('CREATE TABLE "gm_r" ( "a" INT DEFAULT 0, @@ -117,11 +117,11 @@ let $CHILD2_1_CREATE_GM_TABLES= CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"), SPATIAL INDEX "sp_idx1"("b"), SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_GM_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_GM_TABLES2= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "gm_r2"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "gm_r2"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_GM_TABLES2= SELECT spider_direct_sql('CREATE TABLE "gm_r2" ( "a" INT DEFAULT 0, @@ -130,69 +130,69 @@ let $CHILD2_1_CREATE_GM_TABLES2= CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"), SPATIAL INDEX "sp_idx1"("b"), SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_GM_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_LOCK_TABLES1= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_1"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_LOCK_TABLES1= SELECT spider_direct_sql('CREATE TABLE "t1_1" ( "id" INT NOT NULL, CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_LOCK_TABLES2= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t2_2"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t2_2"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_LOCK_TABLES2= SELECT spider_direct_sql('CREATE TABLE "t2_2" ( "id" INT NOT NULL, CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_INCREMENT_TABLES1= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_1"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_INCREMENT_TABLES1= SELECT spider_direct_sql('CREATE TABLE "t1_1" ( "id" INT NOT NULL, CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_INCREMENT_TABLES1= - SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TEXT_PK_TABLES1= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TEXT_PK_TABLES1= SELECT spider_direct_sql('CREATE TABLE "t1" ( "a" VARCHAR(255), CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a") - )', '', 'srv "s_2_1"'); + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TEXT_PK_TABLES1= - SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_DROP_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_CREATE_TEXT_KEY_TABLES1= SELECT spider_direct_sql('CREATE TABLE "t1" ( "a" VARCHAR(255), "b" VARCHAR(255), "c" VARCHAR(255), CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c") - )', '', 'srv "s_2_1"') + )', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"') + SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_SELECT_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_AUTO_INCREMENT_INCREMENT1= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_AUTO_INCREMENT_INCREMENT2= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_AUTO_INCREMENT_OFFSET1= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); let $CHILD2_1_AUTO_INCREMENT_OFFSET2= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"'); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_2.inc b/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_2.inc index 574cd18d38e..186e8a90ebb 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_2.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_2.inc @@ -1,5 +1,5 @@ let $CHILD2_2_DATEFORMAT= - SELECT spider_direct_sql('set datestyle=\'ISO, YMD\'', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('set datestyle=\'ISO, YMD\'', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_DATABASE= SELECT 1; let $CHILD2_2_DROP_DATABASE_IFEXISTS= @@ -7,33 +7,33 @@ let $CHILD2_2_DROP_DATABASE_IFEXISTS= let $CHILD2_2_CREATE_DATABASE= SELECT 1; let $CHILD2_2_SELECT1= - SELECT spider_direct_sql('SELECT 1', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('SELECT 1', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r3"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r3"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_TABLES= SELECT spider_direct_sql('CREATE TABLE "ta_r3" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_TABLES5= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "s_2_2_ta_r_int"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "s_2_2_ta_r_int"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_TABLES5= SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" ( "a" INT DEFAULT 3, "b" INT DEFAULT 10, "c" INT DEFAULT 11, CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a") - )', '', 'srv "s_2_2"') + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"') + SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r3" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_FT_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ft_r3"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ft_r3"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_FT_TABLES= SELECT spider_direct_sql('CREATE TABLE "ft_r3" ( "a" INT DEFAULT 0, @@ -43,11 +43,11 @@ let $CHILD2_2_CREATE_FT_TABLES= CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"), FULLTEXT INDEX "ft_idx1"("b"), FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_SELECT_FT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_GM_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "gm_r3"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "gm_r3"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_GM_TABLES= SELECT spider_direct_sql('CREATE TABLE "gm_r3" ( "a" INT DEFAULT 0, @@ -56,45 +56,45 @@ let $CHILD2_2_CREATE_GM_TABLES= CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"), SPATIAL INDEX "sp_idx1"("b"), SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_SELECT_GM_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_LOCK_TABLES1= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_2"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_LOCK_TABLES1= SELECT spider_direct_sql('CREATE TABLE "t1_2" ( "id" INT NOT NULL, CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_LOCK_TABLES2= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t2_1"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t2_1"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_LOCK_TABLES2= SELECT spider_direct_sql('CREATE TABLE "t2_1" ( "id" INT NOT NULL, CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_DROP_INCREMENT_TABLES1= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_2"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_CREATE_INCREMENT_TABLES1= SELECT spider_direct_sql('CREATE TABLE "t1_2" ( "id" INT NOT NULL, CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); + )', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_SELECT_INCREMENT_TABLES1= - SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_AUTO_INCREMENT_OFFSET1= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $CHILD2_2_AUTO_INCREMENT_OFFSET2= - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_3.inc b/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_3.inc index 6ad6b20ac45..70eb4e7fa29 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_3.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/init_child2_3.inc @@ -1,5 +1,5 @@ let $CHILD2_3_DATEFORMAT= - SELECT spider_direct_sql('set datestyle=\'ISO, YMD\'', '', 'srv "s_2_3"'); + SELECT spider_direct_sql('set datestyle=\'ISO, YMD\'', '', 'dsn "$ODBC_DSN_HA3", wrapper "odbc"'); let $CHILD2_3_DROP_DATABASE= SELECT 1; let $CHILD2_3_DROP_DATABASE_IFEXISTS= @@ -7,15 +7,15 @@ let $CHILD2_3_DROP_DATABASE_IFEXISTS= let $CHILD2_3_CREATE_DATABASE= SELECT 1; let $CHILD2_3_SELECT1= - SELECT spider_direct_sql('SELECT 1', '', 'srv "s_2_3"'); + SELECT spider_direct_sql('SELECT 1', '', 'dsn "$ODBC_DSN_HA3", wrapper "odbc"'); let $CHILD2_3_DROP_TABLES= - SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r4"', '', 'srv "s_2_3"'); + SELECT spider_direct_sql('DROP TABLE IF EXISTS "ta_r4"', '', 'dsn "$ODBC_DSN_HA3", wrapper "odbc"'); let $CHILD2_3_CREATE_TABLES= SELECT spider_direct_sql('CREATE TABLE "ta_r4" ( "a" INT DEFAULT 10, "b" CHAR(1) DEFAULT \'c\', "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a") - )', '', 'srv "s_2_3"'); + )', '', 'dsn "$ODBC_DSN_HA3", wrapper "odbc"'); let $CHILD2_3_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"'); + SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "ta_r4" ORDER BY "a"', '', 'dsn "$ODBC_DSN_HA3", wrapper "odbc"'); diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/init_master_1.inc b/storage/spider/mysql-test/spider/odbc/pg/include/init_master_1.inc index 295c5be52dd..84a2f70c96f 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/init_master_1.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/init_master_1.inc @@ -3,95 +3,95 @@ SET spider_direct_order_limit= 10000; SET spider_init_sql_alloc_size= 1; SET spider_conn_recycle_mode= 0; let $MASTER_1_COMMENT_2_1= - COMMENT='socket "$ODBC_DSN_HA1", table "ta_r", wrapper "odbc", + COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r", wrapper "odbc", pk_name "pk_s_2_1_ta_r"'; let $MASTER_1_COMMENT2_2_1= - COMMENT='socket "$ODBC_DSN_HA1", table "ta_r_no_idx", wrapper "odbc", + COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r_no_idx", wrapper "odbc", pk_name "pk_s_2_1_ta_r_no_idx"' CONNECTION='prt "2000000"'; let $MASTER_1_COMMENT_P_2_1= - COMMENT='table "ta_r3"' + COMMENT='table "ta_r3", wrapper "odbc"' PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", + PARTITION pt1 COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r2", priority "1000", pk_name "pk_s_2_1_ta_r2"', - PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001", + PARTITION pt2 COMMENT='dsn "$ODBC_DSN_HA2", priority "1000001", pk_name "pk_s_2_2_ta_r3"' ); let $MASTER_1_COMMENT2_P_2_1= - COMMENT='table "ta_r3"' + COMMENT='table "ta_r3", wrapper "odbc"' PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + PARTITION pt1 VALUES LESS THAN (4) COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r2", priority "1000", pk_name "pk_s_2_1_ta_r2"', PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r3"' + COMMENT='dsn "$ODBC_DSN_HA2", priority "1000001", pk_name "pk_s_2_2_ta_r3"' ); let $MASTER_1_COMMENT3_2_1= - COMMENT='socket "$ODBC_DSN_HA1", table "ta_r_auto_inc", + COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r_auto_inc", wrapper "odbc"' CONNECTION='pk_name "pk_s_2_1_ta_r_auto_inc"'; let $MASTER_1_COMMENT3_P_2_1= - COMMENT='table "s_2_1_ta_r_int"' + COMMENT='table "s_2_1_ta_r_int", wrapper "odbc"' PARTITION BY LIST(MOD(a, 2)) ( PARTITION pt1 VALUES IN (0) - COMMENT='srv "s_2_1", priority "1000", pk_name "pk_s_2_1_ta_r_int"', + COMMENT='dsn "$ODBC_DSN_HA1", priority "1000", pk_name "pk_s_2_1_ta_r_int"', PARTITION pt2 VALUES IN (1) - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r_int", + COMMENT='dsn "$ODBC_DSN_HA2", priority "1000001", pk_name "pk_s_2_2_ta_r_int", table "s_2_2_ta_r_int"' ); let $MASTER_1_COMMENT4_2_1= - COMMENT='socket "$ODBC_DSN_HA1", table "s_2_1_ta_r_int", + COMMENT='dsn "$ODBC_DSN_HA1", table "s_2_1_ta_r_int", wrapper "odbc"' CONNECTION='pk_name "pk_s_2_1_ta_r_int"'; let $MASTER_1_COMMENT5_2_1= - COMMENT='socket "$ODBC_DSN_HA1", table "ta_r_3", wrapper "odbc"' + COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r_3", wrapper "odbc"' CONNECTION='pk_name "pk_s_2_1_ta_r_3"'; let $MASTER_1_COMMENT_FT_2_1= - COMMENT='socket "$ODBC_DSN_HA1", table "ft_r", wrapper "odbc"' + COMMENT='dsn "$ODBC_DSN_HA1", table "ft_r", wrapper "odbc"' CONNECTION='pk_name "pk_s_2_1_ft_r"'; let $MASTER_1_COMMENT2_FT_P_2_1= - COMMENT='table "ft_r3"' + COMMENT='table "ft_r3", wrapper "odbc"' PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + PARTITION pt1 VALUES LESS THAN (4) COMMENT='dsn "$ODBC_DSN_HA1", table "ft_r2", priority "1000", pk_name "pk_s_2_1_ft_r2"', PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ft_r3"' + COMMENT='dsn "$ODBC_DSN_HA2", priority "1000001", pk_name "pk_s_2_2_ft_r3"' ); let $MASTER_1_COMMENT_GM_2_1= - COMMENT='srv "s_2_1", table "gm_r", pk_name "pk_s_2_1_gm_r"'; + COMMENT='dsn "$ODBC_DSN_HA1", wrapper "odbc", table "gm_r", pk_name "pk_s_2_1_gm_r"'; let $MASTER_1_COMMENT2_GM_P_2_1= - COMMENT='table "gm_r3"' + COMMENT='table "gm_r3", wrapper "odbc"' PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + PARTITION pt1 VALUES LESS THAN (4) COMMENT='dsn "$ODBC_DSN_HA1", table "gm_r2", priority "1000", pk_name "pk_s_2_1_gm_r2"', PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_gm_r3"' + COMMENT='dsn "$ODBC_DSN_HA2", priority "1000001", pk_name "pk_s_2_2_gm_r3"' ); let $MASTER_1_COMMENT_LOCK1= - COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2", + COMMENT 'tbl "t1_1 t1_2", dsn "$ODBC_DSN_HA1 $ODBC_DSN_HA2", wrapper "odbc", pk_name "pk_s_2_1_t1_1 pk_s_2_2_t1_2"'; let $MASTER_1_COMMENT_LOCK2= - COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1", + COMMENT 'tbl "t2_1 t2_2", dsn "$ODBC_DSN_HA2 $ODBC_DSN_HA1", wrapper "odbc", pk_name "pk_s_2_2_t2_1 pk_s_2_1_t2_2"'; let $MASTER_1_COMMENT_INCREMENT1_1= - COMMENT 'aim "0", tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"'; + COMMENT 'aim "0", tbl "t1_1", dsn "$ODBC_DSN_HA1", wrapper "odbc", pk_name "pk_s_2_1_t1_1"'; let $MASTER_1_COMMENT_INCREMENT1_P_1= - COMMENT 'aim "0"' + COMMENT 'aim "0", wrapper "odbc"' PARTITION BY LIST(MOD(id, 2)) ( PARTITION pt1 VALUES IN (0) - COMMENT='tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"', + COMMENT='tbl "t1_1", dsn "$ODBC_DSN_HA1", pk_name "pk_s_2_1_t1_1"', PARTITION pt2 VALUES IN (1) - COMMENT='tbl "t1_2", srv "s_2_2", pk_name "pk_s_2_2_t1_2"' + COMMENT='tbl "t1_2", dsn "$ODBC_DSN_HA2", pk_name "pk_s_2_2_t1_2"' ); let $MASTER_1_COMMENT_READONLY1_1= - COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1", + COMMENT 'read_only_mode "1", tbl "t1_1", dsn "$ODBC_DSN_HA1", wrapper "odbc", pk_name "pk_s_2_1_t1_1"'; let $MASTER_1_COMMENT_ERROR_MODE1_1= - COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1", + COMMENT 'erm "1", ewm "1", tbl "ter1_1", dsn "$ODBC_DSN_HA1", wrapper "odbc", pk_name "pk_s_2_1_ter1_1"'; let $MASTER_1_COMMENT_TEXT_PK1_1= - COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"'; + COMMENT 'tbl "t1", dsn "$ODBC_DSN_HA1", wrapper "odbc", pk_name "pk_s_2_1_t1"'; let $MASTER_1_COMMENT_TEXT_KEY1_1= - COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"'; + COMMENT 'tbl "t1", dsn "$ODBC_DSN_HA1", wrapper "odbc", pk_name "pk_s_2_1_t1"'; let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS= SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; let $MASTER_1_CHECK_DIRECT_DELETE_STATUS= @@ -102,40 +102,40 @@ let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS= SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; let $MASTER_1_AUTO_INCREMENT_INCREMENT1= SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"') + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $MASTER_1_AUTO_INCREMENT_INCREMENT2= SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $MASTER_1_AUTO_INCREMENT_OFFSET1= SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"') + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $MASTER_1_AUTO_INCREMENT_OFFSET2= SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA1", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') + SELECT spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"') $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); + SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "$ODBC_DSN_HA2", wrapper "odbc"'); let $MASTER_1_AUTO_INCREMENT_OFFSET3= SET SESSION AUTO_INCREMENT_OFFSET = 1; let $MASTER_1_AUTO_INCREMENT_OFFSET4= diff --git a/storage/spider/mysql-test/spider/odbc/pg/include/init_spider.inc b/storage/spider/mysql-test/spider/odbc/pg/include/init_spider.inc index 27285967024..1cbcb003905 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/include/init_spider.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/include/init_spider.inc @@ -3,22 +3,6 @@ let $VERSION_COMPILE_OS_WIN= `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; if ($VERSION_COMPILE_OS_WIN) { - eval DROP SERVER IF EXISTS s_2; - eval CREATE SERVER s_2 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN' - ); - eval DROP SERVER IF EXISTS s_2_1; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN_HA1' - ); - eval DROP SERVER IF EXISTS s_2_2; - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN_HA2' - ); - eval DROP SERVER IF EXISTS s_2_3; - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN_HA3' - ); eval DROP SERVER IF EXISTS s_3_1; eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', @@ -46,22 +30,6 @@ if ($VERSION_COMPILE_OS_WIN) } if (!$VERSION_COMPILE_OS_WIN) { - eval DROP SERVER IF EXISTS s_2; - eval CREATE SERVER s_2 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN' - ); - eval DROP SERVER IF EXISTS s_2_1; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN_HA1' - ); - eval DROP SERVER IF EXISTS s_2_2; - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN_HA2' - ); - eval DROP SERVER IF EXISTS s_2_3; - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER odbc OPTIONS ( - SOCKET '$ODBC_DSN_HA3' - ); eval DROP SERVER IF EXISTS s_3_1; eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', diff --git a/storage/spider/mysql-test/spider/odbc/pg/r/ha_part.result b/storage/spider/mysql-test/spider/odbc/pg/r/ha_part.result index 6e2224632d4..d7571187017 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/r/ha_part.result +++ b/storage/spider/mysql-test/spider/odbc/pg/r/ha_part.result @@ -124,9 +124,9 @@ recovery test connection master_1; ALTER TABLE ta_l2 PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", +PARTITION pt1 COMMENT='dsn "postgres_auto_test_remote postgres_auto_test_remote2", tbl "ta_r ta_r3", priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", +PARTITION pt2 COMMENT='dsn "postgres_auto_test_remote postgres_auto_test_remote3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 2"' ); SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables @@ -142,9 +142,9 @@ spider_copy_tables('ta_l2#P#pt2', '0', '1') connection master_1; ALTER TABLE ta_l2 PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", +PARTITION pt1 COMMENT='dsn "postgres_auto_test_remote postgres_auto_test_remote2", tbl "ta_r ta_r3", priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", +PARTITION pt2 COMMENT='dsn "postgres_auto_test_remote postgres_auto_test_remote3", tbl "ta_r2 ta_r4", priority "1000001", lst "0 1"' ); SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables @@ -233,9 +233,9 @@ recovery test connection master_1; ALTER TABLE ta_l2 PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", +PARTITION pt1 COMMENT='dsn "postgres_auto_test_remote postgres_auto_test_remote2", tbl "ta_r ta_r3", priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", +PARTITION pt2 COMMENT='dsn "postgres_auto_test_remote postgres_auto_test_remote3", tbl "ta_r2 ta_r4", priority "1000001", lst "1 0"' ); SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables diff --git a/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes.result b/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes.result index 75dbf0c0548..bf431a7595e 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes.result +++ b/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes.result @@ -44,21 +44,21 @@ PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 MASTER_1_AUTO_INCREMENT_INCREMENT2 MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); diff --git a/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes_part.result index da6ff87d625..111961a2057 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes_part.result +++ b/storage/spider/mysql-test/spider/odbc/pg/r/spider3_fixes_part.result @@ -42,21 +42,21 @@ PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 MASTER_1_AUTO_INCREMENT_INCREMENT2 MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); diff --git a/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes.result b/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes.result index 98c466a7557..0ca8cb241e0 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes.result @@ -301,21 +301,21 @@ PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 MASTER_1_AUTO_INCREMENT_INCREMENT2 MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); diff --git a/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes_part.result index b90042dc81f..e94f3f30274 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes_part.result +++ b/storage/spider/mysql-test/spider/odbc/pg/r/spider_fixes_part.result @@ -113,21 +113,21 @@ PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 MASTER_1_AUTO_INCREMENT_INCREMENT2 MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'srv "s_2_1"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_1"', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote", wrapper "odbc"') 1 -spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'srv "s_2_2"') +spider_direct_sql('DROP SEQUENCE IF EXISTS "seq_t1_2"', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') +spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'dsn "postgres_auto_test_remote2", wrapper "odbc"') 1 INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); diff --git a/storage/spider/mysql-test/spider/odbc/include/have_odbc.inc b/storage/spider/mysql-test/spider/odbc/pg/t/have_odbc.inc index 57fb056e1d2..6924e61dd75 100644 --- a/storage/spider/mysql-test/spider/odbc/include/have_odbc.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/t/have_odbc.inc @@ -4,7 +4,7 @@ CREATE TABLE ta_l ( b CHAR(1), c DATETIME, PRIMARY KEY(a) -) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='socket "$ODBC_DSN_HA1", table "ta_r", wrapper "odbc", pk_name "pk_s_2_1_ta_r"'; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='dsn "$ODBC_DSN_HA1", table "ta_r", wrapper "odbc", pk_name "pk_s_2_1_ta_r"'; if ($mysql_errno) { --skip Test requires to build with ODBC driver diff --git a/storage/spider/mysql-test/spider/odbc/pg/t/test_init.inc b/storage/spider/mysql-test/spider/odbc/pg/t/test_init.inc index c4d7f414f4e..fbeaa8862fa 100644 --- a/storage/spider/mysql-test/spider/odbc/pg/t/test_init.inc +++ b/storage/spider/mysql-test/spider/odbc/pg/t/test_init.inc @@ -10,7 +10,7 @@ SET SESSION sql_log_bin= 0; --source have_trigger.inc --source ../include/init_master_1.inc --source have_engine.inc ---source ../../include/have_odbc.inc +--source have_odbc.inc --echo for child2 if ($USE_CHILD_GROUP2) { diff --git a/storage/spider/spd_db_odbc.cc b/storage/spider/spd_db_odbc.cc index b63834e7370..9e9529aecaa 100644 --- a/storage/spider/spd_db_odbc.cc +++ b/storage/spider/spd_db_odbc.cc @@ -59,18 +59,7 @@ extern HASH spider_open_connections; extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; extern const char spider_dig_upper[]; -spider_db_odbc_util spider_db_odbc_utility; - -#define SPIDER_DB_DIRECTORY_STR "directory" -#define SPIDER_DB_DIRECTORY_LEN (sizeof(SPIDER_DB_DIRECTORY_STR) - 1) - -#define SPIDER_SQL_UID_STR "uid" -#define SPIDER_SQL_UID_LEN (sizeof(SPIDER_SQL_UID_STR) - 1) -#define SPIDER_SQL_PWD_STR "pwd" -#define SPIDER_SQL_PWD_LEN (sizeof(SPIDER_SQL_PWD_STR) - 1) - -#define SPIDER_SQL_ODBC_EQUAL_STR "=" -#define SPIDER_SQL_ODBC_EQUAL_LEN (sizeof(SPIDER_SQL_ODBC_EQUAL_STR) - 1) +spider_db_odbc_util spider_db_odbc_utility("\"", "'", 1, 1); #define SPIDER_SQL_ODBC_TYPE_BINARY_STR "sql_binary" #define SPIDER_SQL_ODBC_TYPE_BINARY_LEN (sizeof(SPIDER_SQL_ODBC_TYPE_BINARY_STR) - 1) @@ -377,7 +366,7 @@ spider_db_share *spider_odbc_create_share( SPIDER_SHARE *share ) { DBUG_ENTER("spider_odbc_create_share"); - DBUG_RETURN(new spider_odbc_share(share)); + DBUG_RETURN(new spider_odbc_share(share, &spider_db_odbc_utility)); } spider_db_handler *spider_odbc_create_handler( @@ -386,7 +375,7 @@ spider_db_handler *spider_odbc_create_handler( ) { DBUG_ENTER("spider_odbc_create_handler"); DBUG_RETURN(new spider_odbc_handler(spider, - (spider_odbc_share *) db_share)); + (spider_odbc_share *) db_share, &spider_db_odbc_utility)); } spider_db_copy_table *spider_odbc_create_copy_table( @@ -394,18 +383,18 @@ spider_db_copy_table *spider_odbc_create_copy_table( ) { DBUG_ENTER("spider_odbc_create_copy_table"); DBUG_RETURN(new spider_odbc_copy_table( - (spider_odbc_share *) db_share)); + (spider_odbc_share *) db_share, &spider_db_odbc_utility)); } SPIDER_DB_CONN *spider_odbc_create_conn( SPIDER_CONN *conn ) { DBUG_ENTER("spider_odbc_create_conn"); - DBUG_RETURN(new spider_db_odbc(conn)); + DBUG_RETURN(new spider_db_odbc(conn, &spider_db_odbc_utility)); } -bool spider_odbc_support_direct_join( -) { +bool spider_odbc_support_direct_join() +{ DBUG_ENTER("spider_odbc_support_direct_join"); DBUG_RETURN(FALSE); } @@ -427,7 +416,7 @@ SPIDER_DBTON spider_dbton_odbc = { &spider_db_odbc_utility }; -static int spider_db_odbc_get_error( +int spider_db_odbc_get_error( SQLRETURN ret, SQLSMALLINT hnd_type, SQLHANDLE hnd, @@ -762,12 +751,13 @@ uint spider_db_odbc_row::get_byte_size() spider_db_odbc_result::spider_db_odbc_result( SPIDER_DB_CONN *in_db_conn ) : spider_db_result(in_db_conn), + hstm(((spider_db_odbc *) in_db_conn)->hstm), row(in_db_conn->dbton_id), field_count(0), spider(NULL), buf(NULL), len(NULL), null(NULL), stored_error_num(0) { DBUG_ENTER("spider_db_odbc_result::spider_db_odbc_result"); DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider hstm:%p", ((spider_db_odbc *) db_conn)->hstm)); + DBUG_PRINT("info",("spider hstm:%p", hstm)); DBUG_VOID_RETURN; } @@ -775,7 +765,7 @@ spider_db_odbc_result::~spider_db_odbc_result() { DBUG_ENTER("spider_db_odbc_result::~spider_db_odbc_result"); DBUG_PRINT("info",("spider this=%p", this)); - if (((spider_db_odbc *) db_conn)->hstm) + if (hstm) { free_result(); } @@ -795,11 +785,11 @@ int spider_db_odbc_result::init() SQLRETURN ret; DBUG_ENTER("spider_db_odbc_result::init"); DBUG_PRINT("info",("spider this=%p", this)); - ret = SQLNumResultCols(((spider_db_odbc *) db_conn)->hstm, &field_count); + ret = SQLNumResultCols(hstm, &field_count); if (ret != SQL_SUCCESS) { DBUG_RETURN(spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, - ((spider_db_odbc *) db_conn)->hstm, db_conn->conn, stored_error_msg)); + hstm, db_conn->conn, stored_error_msg)); } DBUG_PRINT("info",("spider field_count=%u", field_count)); if (!spider_bulk_malloc(spider_current_trx, 275, MYF(MY_WME), @@ -839,7 +829,7 @@ bool spider_db_odbc_result::has_result() { DBUG_ENTER("spider_db_odbc_result::has_result"); DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(((spider_db_odbc *) db_conn)->hstm); + DBUG_RETURN(hstm); } void spider_db_odbc_result::free_result() @@ -847,17 +837,16 @@ void spider_db_odbc_result::free_result() SQLRETURN ret; DBUG_ENTER("spider_db_odbc_result::free_result"); DBUG_PRINT("info",("spider this=%p", this)); - SQLHSTMT hstm = ((spider_db_odbc *) db_conn)->hstm; if (hstm) { - ret = SQLCloseCursor(hstm); + ret = SQLFreeStmt(hstm, SQL_CLOSE); if (ret != SQL_SUCCESS) { stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, hstm, db_conn->conn, stored_error_msg); } SQLFreeHandle(SQL_HANDLE_STMT, hstm); - ((spider_db_odbc *) db_conn)->hstm = NULL; + hstm = NULL; } DBUG_VOID_RETURN; } @@ -874,13 +863,13 @@ SPIDER_DB_ROW *spider_db_odbc_result::fetch_row() SQLRETURN ret; DBUG_ENTER("spider_db_odbc_result::fetch_row"); DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider hstm:%p", ((spider_db_odbc *) db_conn)->hstm)); + DBUG_PRINT("info",("spider hstm:%p", hstm)); SQLLEN buf_sz = spider && spider->share ? spider_param_buffer_size(spider->wide_handler->trx->thd, spider->share->buffer_size) : spider_param_buffer_size(current_thd, 16000), sz; row.record_size = 0; - ret = SQLFetch(((spider_db_odbc *) db_conn)->hstm); + ret = SQLFetch(hstm); if (ret != SQL_SUCCESS) { if (ret == SQL_NO_DATA) @@ -888,7 +877,7 @@ SPIDER_DB_ROW *spider_db_odbc_result::fetch_row() stored_error_num = HA_ERR_END_OF_FILE; } else { stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, - ((spider_db_odbc *) db_conn)->hstm, db_conn->conn, stored_error_msg); + hstm, db_conn->conn, stored_error_msg); } DBUG_RETURN(NULL); } @@ -904,12 +893,12 @@ SPIDER_DB_ROW *spider_db_odbc_result::fetch_row() DBUG_RETURN(NULL); } DBUG_PRINT("info",("spider i:%u", i)); - ret = SQLGetData(((spider_db_odbc *) db_conn)->hstm, i + 1, SQL_C_CHAR, + ret = SQLGetData(hstm, i + 1, SQL_C_CHAR, (char *) b->ptr(), buf_sz, &sz); if (ret != SQL_SUCCESS) { stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, - ((spider_db_odbc *) db_conn)->hstm, db_conn->conn, stored_error_msg); + hstm, db_conn->conn, stored_error_msg); DBUG_RETURN(NULL); } if (sz == SQL_NULL_DATA) @@ -929,12 +918,12 @@ SPIDER_DB_ROW *spider_db_odbc_result::fetch_row() DBUG_RETURN(NULL); } DBUG_PRINT("info",("spider length:%u", b->length())); - ret = SQLGetData(((spider_db_odbc *) db_conn)->hstm, i + 1, SQL_C_CHAR, + ret = SQLGetData(hstm, i + 1, SQL_C_CHAR, (char *) b->ptr() + b->length(), buf_sz, &sz); if (ret != SQL_SUCCESS) { stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, - ((spider_db_odbc *) db_conn)->hstm, db_conn->conn, stored_error_msg); + hstm, db_conn->conn, stored_error_msg); DBUG_RETURN(NULL); } b->length(b->length() + sz); @@ -1049,11 +1038,11 @@ longlong spider_db_odbc_result::num_rows() DBUG_ENTER("spider_db_odbc_result::num_rows"); DBUG_PRINT("info",("spider this=%p", this)); /* - ret = SQLRowCount(((spider_db_odbc *) db_conn)->hstm, &cnt); + ret = SQLRowCount(hstm, &cnt); if (ret != SQL_SUCCESS) { stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, - ((spider_db_odbc *) db_conn)->hstm, db_conn->conn, stored_error_msg); + hstm, db_conn->conn, stored_error_msg); DBUG_RETURN(0); } DBUG_RETURN((longlong) cnt); @@ -1075,12 +1064,11 @@ void spider_db_odbc_result::move_to_pos( DBUG_ENTER("spider_db_odbc_result::move_to_pos"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider pos=%lld", pos)); - ret = SQLFetchScroll(((spider_db_odbc *) db_conn)->hstm, SQL_FETCH_FIRST, - (SQLLEN) pos); + ret = SQLFetchScroll(hstm, SQL_FETCH_FIRST, (SQLLEN) pos); if (ret != SQL_SUCCESS) { stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, - ((spider_db_odbc *) db_conn)->hstm, db_conn->conn, stored_error_msg); + hstm, db_conn->conn, stored_error_msg); } DBUG_VOID_RETURN; } @@ -1127,8 +1115,9 @@ int spider_db_odbc_result::fetch_table_for_discover_table_structure( #endif spider_db_odbc::spider_db_odbc( - SPIDER_CONN *conn -) : spider_db_conn(conn), utility(&spider_db_odbc_utility), + SPIDER_CONN *conn, + spider_db_odbc_util *db_util +) : spider_db_conn(conn), utility(db_util), henv(SQL_NULL_HENV), hdbc(SQL_NULL_HDBC), hstm(SQL_NULL_HSTMT), lock_table_hash_inited(FALSE), handler_open_array_inited(FALSE) { @@ -1343,10 +1332,15 @@ int spider_db_odbc::connect( /* create connect string */ use_driver = conn->tgt_default_group_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_driver:%s", use_driver ? "TRUE" : "FALSE")); use_dir = conn->tgt_default_file_length ? TRUE : FALSE; - use_dsn = conn->tgt_socket_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_dir:%s", use_dir ? "TRUE" : "FALSE")); + use_dsn = conn->tgt_dsn_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_dsn:%s", use_dsn ? "TRUE" : "FALSE")); use_db = conn->tgt_db_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_db:%s", use_db ? "TRUE" : "FALSE")); use_uid = conn->tgt_username_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_uid:%s", use_uid ? "TRUE" : "FALSE")); dummy_len = 0; conn_str_len = (use_driver ? @@ -1362,7 +1356,7 @@ int spider_db_odbc::connect( 0) + (use_dsn ? (SPIDER_DB_DSN_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + - conn->tgt_socket_length + SPIDER_SQL_SEMICOLON_LEN) : 0) + + conn->tgt_dsn_length + SPIDER_SQL_SEMICOLON_LEN) : 0) + (use_db ? (SPIDER_SQL_DATABASE_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + conn->tgt_db_length + SPIDER_SQL_COLON_LEN + conn->tgt_host_length + @@ -1396,6 +1390,7 @@ int spider_db_odbc::connect( if (use_driver) { + DBUG_PRINT("info",("spider driver:%s", conn->tgt_default_group)); memcpy(tmp_str, SPIDER_DB_DRIVER_STR, SPIDER_DB_DRIVER_LEN); tmp_str += SPIDER_DB_DRIVER_LEN; memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); @@ -1410,6 +1405,7 @@ int spider_db_odbc::connect( tmp_str += SPIDER_SQL_SEMICOLON_LEN; if (use_dir) { + DBUG_PRINT("info",("spider dir:%s", conn->tgt_default_file)); memcpy(tmp_str, SPIDER_DB_DIRECTORY_STR, SPIDER_DB_DIRECTORY_LEN); tmp_str += SPIDER_DB_DIRECTORY_LEN; memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); @@ -1430,12 +1426,13 @@ int spider_db_odbc::connect( if (use_dsn) { + DBUG_PRINT("info",("spider dsn:%s", conn->tgt_dsn)); memcpy(tmp_str, SPIDER_DB_DSN_STR, SPIDER_DB_DSN_LEN); tmp_str += SPIDER_DB_DSN_LEN; memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; - memcpy(tmp_str, conn->tgt_socket, conn->tgt_socket_length); - tmp_str += conn->tgt_socket_length; + memcpy(tmp_str, conn->tgt_dsn, conn->tgt_dsn_length); + tmp_str += conn->tgt_dsn_length; memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); tmp_str += SPIDER_SQL_SEMICOLON_LEN; } @@ -1449,6 +1446,7 @@ int spider_db_odbc::connect( if (use_db) { + DBUG_PRINT("info",("spider db:%s", conn->tgt_db)); memcpy(tmp_str, SPIDER_SQL_DATABASE_STR, SPIDER_SQL_DATABASE_LEN); tmp_str += SPIDER_SQL_DATABASE_LEN; memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); @@ -1476,6 +1474,7 @@ int spider_db_odbc::connect( if (use_uid) { + DBUG_PRINT("info",("spider uid:%s", conn->tgt_username)); memcpy(tmp_str, SPIDER_SQL_UID_STR, SPIDER_SQL_UID_LEN); tmp_str += SPIDER_SQL_UID_LEN; memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); @@ -1565,8 +1564,20 @@ void spider_db_odbc::bg_disconnect() void spider_db_odbc::disconnect() { + SQLRETURN ret; DBUG_ENTER("spider_db_odbc::disconnect"); DBUG_PRINT("info",("spider this=%p", this)); + if (hstm != SQL_NULL_HSTMT) + { + ret = SQLFreeStmt(hstm, SQL_CLOSE); + if (ret != SQL_SUCCESS) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, + hstm, conn, stored_error_msg); + } + SQLFreeHandle(SQL_HANDLE_STMT, hstm); + hstm = SQL_NULL_HSTMT; + } if (hdbc != SQL_NULL_HDBC) { SQLDisconnect(hdbc); @@ -1626,21 +1637,24 @@ int spider_db_odbc::exec_query( } if (!spider_param_dry_access()) { - ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstm); - if (ret != SQL_SUCCESS) + if (hstm == SQL_NULL_HSTMT) { - stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, - conn, stored_error_msg); - DBUG_RETURN(stored_error); - } - ret = SQLSetCursorName(hstm, (SQLCHAR *) "cur", SQL_NTS); - if (ret != SQL_SUCCESS) - { - stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, hstm, - conn, stored_error_msg); - SQLFreeHandle(SQL_HANDLE_STMT, hstm); - hstm = NULL; - DBUG_RETURN(stored_error); + ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstm); + if (ret != SQL_SUCCESS) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, + conn, stored_error_msg); + DBUG_RETURN(stored_error); + } + ret = SQLSetCursorName(hstm, (SQLCHAR *) "cur", SQL_NTS); + if (ret != SQL_SUCCESS) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, hstm, + conn, stored_error_msg); + SQLFreeHandle(SQL_HANDLE_STMT, hstm); + hstm = NULL; + DBUG_RETURN(stored_error); + } } ret = SQLExecDirect(hstm, (SQLCHAR *) query, (SQLINTEGER) length); if (ret != SQL_SUCCESS && ret != SQL_NO_DATA) @@ -1737,6 +1751,7 @@ spider_db_result *spider_db_odbc::store_result( DBUG_ASSERT(!spider_res_buf); if ((result = new spider_db_odbc_result(this))) { + hstm = SQL_NULL_HSTMT; *err = 0; if (spider_param_dry_access() || (*err = result->init())) @@ -1761,6 +1776,7 @@ spider_db_result *spider_db_odbc::use_result( DBUG_PRINT("info",("spider this=%p", this)); if ((result = new spider_db_odbc_result(this))) { + hstm = SQL_NULL_HSTMT; *err = 0; if (spider_param_dry_access() || (*err = result->init())) @@ -2545,9 +2561,15 @@ bool spider_db_odbc::cmp_request_key_to_snd( DBUG_RETURN(TRUE); } -spider_db_odbc_util::spider_db_odbc_util() : spider_db_util(), - name_quote("\""), value_quote("'"), name_quote_length(1), - value_quote_length(1) +spider_db_odbc_util::spider_db_odbc_util( + const char *nm_quote, + const char *val_quote, + uint nm_quote_length, + uint val_quote_length +) : spider_db_util(), + name_quote(nm_quote), value_quote(val_quote), + name_quote_length(nm_quote_length), + value_quote_length(val_quote_length) { DBUG_ENTER("spider_db_odbc_util::spider_db_odbc_util"); DBUG_PRINT("info",("spider this=%p", this)); @@ -5313,12 +5335,13 @@ uint spider_db_odbc_util::limit_mode() } spider_odbc_share::spider_odbc_share( - st_spider_share *share + st_spider_share *share, + spider_db_odbc_util *db_util ) : spider_db_share( share, - spider_db_odbc_utility.dbton_id + db_util->dbton_id ), - utility(&spider_db_odbc_utility), + utility(db_util), table_select(NULL), table_select_pos(0), key_select(NULL), @@ -5910,12 +5933,13 @@ int spider_odbc_share::discover_table_structure( spider_odbc_handler::spider_odbc_handler( ha_spider *spider, - spider_odbc_share *db_share + spider_odbc_share *db_share, + spider_db_odbc_util *db_util ) : spider_db_handler( spider, db_share ), - utility(&spider_db_odbc_utility), + utility(db_util), where_pos(0), order_pos(0), limit_pos(0), @@ -11452,6 +11476,7 @@ int spider_odbc_handler::get_statistics( SQLBindCol(hstm, 13, SQL_C_CHAR, filter_condition, SPIDER_IDENT_SPACE, &filter_condition_sz); ret = SQLFetch(hstm); + TABLE *table = spider->get_table(); Field *field; memset((uchar *) share->cardinality_upd, 0, sizeof(uchar) * share->bitmap_size); @@ -11476,7 +11501,7 @@ int spider_odbc_handler::get_statistics( share->stat.auto_increment_value = 1; } else { if (cardinality_sz > 0 && - (field = find_field_in_table_sef(field->table, + (field = find_field_in_table_sef(table, (const char *) column_name))) { if ((share->cardinality[field->field_index] = @@ -12345,11 +12370,12 @@ int spider_odbc_handler::append_order_by( #endif spider_odbc_copy_table::spider_odbc_copy_table( - spider_odbc_share *db_share + spider_odbc_share *db_share, + spider_db_odbc_util *db_util ) : spider_db_copy_table( db_share ), - utility(&spider_db_odbc_utility), + utility(db_util), odbc_share(db_share) { DBUG_ENTER("spider_odbc_copy_table::spider_odbc_copy_table"); diff --git a/storage/spider/spd_db_odbc.h b/storage/spider/spd_db_odbc.h index efa677357ca..7cbee694510 100644 --- a/storage/spider/spd_db_odbc.h +++ b/storage/spider/spd_db_odbc.h @@ -18,6 +18,43 @@ #include "sql.h" #include "sqlext.h" +#define HAVE_SPIDER_ODBC + +#define SPIDER_DB_DIRECTORY_STR "directory" +#define SPIDER_DB_DIRECTORY_LEN (sizeof(SPIDER_DB_DIRECTORY_STR) - 1) + +#define SPIDER_SQL_UID_STR "uid" +#define SPIDER_SQL_UID_LEN (sizeof(SPIDER_SQL_UID_STR) - 1) +#define SPIDER_SQL_PWD_STR "pwd" +#define SPIDER_SQL_PWD_LEN (sizeof(SPIDER_SQL_PWD_STR) - 1) + +#define SPIDER_SQL_ODBC_EQUAL_STR "=" +#define SPIDER_SQL_ODBC_EQUAL_LEN (sizeof(SPIDER_SQL_ODBC_EQUAL_STR) - 1) + +int spider_odbc_init(); +int spider_odbc_deinit(); +spider_db_share *spider_odbc_create_share( + SPIDER_SHARE *share +); +spider_db_handler *spider_odbc_create_handler( + ha_spider *spider, + spider_db_share *db_share +); +spider_db_copy_table *spider_odbc_create_copy_table( + spider_db_share *db_share +); +SPIDER_DB_CONN *spider_odbc_create_conn( + SPIDER_CONN *conn +); +bool spider_odbc_support_direct_join(); +int spider_db_odbc_get_error( + SQLRETURN ret, + SQLSMALLINT hnd_type, + SQLHANDLE hnd, + SPIDER_CONN *conn, + char *stored_error_msg +); + class spider_db_odbc_util: public spider_db_util { public: @@ -25,7 +62,12 @@ public: const char *value_quote; uint name_quote_length; uint value_quote_length; - spider_db_odbc_util(); + spider_db_odbc_util( + const char *nm_quote, + const char *val_quote, + uint nm_quote_length, + uint val_quote_length + ); virtual ~spider_db_odbc_util(); int append_name( spider_string *str, @@ -106,7 +148,7 @@ public: int append_lock_table_head( spider_string *str ); - int append_lock_table_body( + virtual int append_lock_table_body( spider_string *str, const char *db_name, uint db_name_length, @@ -116,10 +158,10 @@ public: CHARSET_INFO *table_name_charset, int lock_type ); - int append_lock_table_tail( + virtual int append_lock_table_tail( spider_string *str ); - int append_unlock_table( + virtual int append_unlock_table( spider_string *str ); int open_item_func( @@ -261,6 +303,8 @@ public: class spider_db_odbc_result: public spider_db_result { +protected: + SQLHSTMT hstm; public: spider_db_odbc_row row; SQLSMALLINT field_count; @@ -278,7 +322,7 @@ public: int init(); void set_limit(longlong value); bool has_result(); - void free_result(); + virtual void free_result(); SPIDER_DB_ROW *current_row(); SPIDER_DB_ROW *fetch_row(); SPIDER_DB_ROW *fetch_row_from_result_buffer( @@ -352,14 +396,15 @@ public: ulong handler_open_array_line_no; longlong limit; spider_db_odbc( - SPIDER_CONN *conn + SPIDER_CONN *conn, + spider_db_odbc_util *db_util ); virtual ~spider_db_odbc(); int init(); void set_limit(longlong value); bool is_connected(); void bg_connect(); - int connect( + virtual int connect( char *tgt_host, char *tgt_username, char *tgt_password, @@ -371,9 +416,9 @@ public: ); int ping(); void bg_disconnect(); - void disconnect(); + virtual void disconnect(); int set_net_timeout(); - int exec_query( + virtual int exec_query( const char *query, uint length, int quick_mode @@ -392,12 +437,12 @@ public: int print_warnings( struct tm *l_time ); - spider_db_result *store_result( + virtual spider_db_result *store_result( spider_db_result_buffer **spider_res_buf, st_spider_db_request_key *request_key, int *error_num ); - spider_db_result *use_result( + virtual spider_db_result *use_result( st_spider_db_request_key *request_key, int *error_num ); @@ -544,7 +589,7 @@ public: size_t from_length ); bool have_lock_table_list(); - int append_lock_tables( + virtual int append_lock_tables( spider_string *str ); int append_unlock_tables( @@ -586,7 +631,8 @@ public: int first_all_link_idx; spider_odbc_share( - st_spider_share *share + st_spider_share *share, + spider_db_odbc_util *db_util ); virtual ~spider_odbc_share(); int init(); @@ -695,7 +741,8 @@ public: longlong limit; spider_odbc_handler( ha_spider *spider, - spider_odbc_share *share + spider_odbc_share *share, + spider_db_odbc_util *db_util ); virtual ~spider_odbc_handler(); int init(); @@ -979,7 +1026,7 @@ public: int append_match_where( spider_string *str ); - int append_update_where( + virtual int append_update_where( spider_string *str, const TABLE *table, my_ptrdiff_t ptr_diff @@ -1102,7 +1149,7 @@ public: int append_select_lock_part( ulong sql_type ); - int append_select_lock( + virtual int append_select_lock( spider_string *str ); int append_union_all_start_part( @@ -1410,7 +1457,7 @@ public: key_range *end_key, int link_idx ); - int lock_tables( + virtual int lock_tables( int link_idx ); int unlock_tables( @@ -1563,7 +1610,8 @@ public: longlong offset; longlong limit; spider_odbc_copy_table( - spider_odbc_share *db_share + spider_odbc_share *db_share, + spider_db_odbc_util *db_util ); virtual ~spider_odbc_copy_table(); int init(); @@ -1601,7 +1649,7 @@ public: int append_into_str(); int append_open_paren_str(); int append_values_str(); - int append_select_lock_str( + virtual int append_select_lock_str( int lock_mode ); int exec_query( diff --git a/storage/spider/spd_db_odbc_mariadb.cc b/storage/spider/spd_db_odbc_mariadb.cc new file mode 100644 index 00000000000..55afa2824ba --- /dev/null +++ b/storage/spider/spd_db_odbc_mariadb.cc @@ -0,0 +1,1108 @@ +/* Copyright (C) 2019-2020 Kentoku Shiba + Copyright (C) 2019-2020 MariaDB corp + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define MYSQL_SERVER 1 +#include <my_global.h> +#include "mysql_version.h" +#include "spd_environ.h" +#if MYSQL_VERSION_ID < 50500 +#include "mysql_priv.h" +#include <mysql/plugin.h> +#else +#include "sql_priv.h" +#include "probes_mysql.h" +#include "sql_class.h" +#include "sql_partition.h" +#include "sql_analyse.h" +#include "sql_base.h" +#include "tztime.h" +#ifdef HANDLER_HAS_DIRECT_AGGREGATE +#include "sql_select.h" +#endif +#endif +#include "sql_common.h" +#include <mysql.h> +#include <errmsg.h> +#include "spd_err.h" +#include "spd_param.h" +#include "spd_db_include.h" +#include "spd_include.h" +#include "spd_db_odbc_mariadb.h" +#include "ha_spider.h" +#include "spd_conn.h" +#include "spd_db_conn.h" +#include "spd_malloc.h" +#include "spd_sys_table.h" +#include "spd_table.h" + +#define SPIDER_DB_WRAPPER_ODBC_MARIADB "odbc_mariadb" + +#ifdef HAVE_SPIDER_ODBC + +#define SPIDER_SQL_SERVER_STR "server" +#define SPIDER_SQL_SERVER_LEN (sizeof(SPIDER_SQL_SERVER_STR) - 1) +#define SPIDER_SQL_SOCKET_STR "socket" +#define SPIDER_SQL_SOCKET_LEN (sizeof(SPIDER_SQL_SOCKET_STR) - 1) +#define SPIDER_SQL_PORT_STR "port" +#define SPIDER_SQL_PORT_LEN (sizeof(SPIDER_SQL_PORT_STR) - 1) + +#define SPIDER_SQL_CUR_CUR_STR "CURRENT OF " +#define SPIDER_SQL_CUR_CUR_LEN (sizeof(SPIDER_SQL_CUR_CUR_STR) - 1) + +#define SPIDER_SQL_UNLOCK_TABLE_STR "unlock tables" +#define SPIDER_SQL_UNLOCK_TABLE_LEN (sizeof(SPIDER_SQL_UNLOCK_TABLE_STR) - 1) + +static const char *spider_db_table_lock_str[] = +{ + " read local,", + " read,", + " low_priority write,", + " write," +}; +static const int spider_db_table_lock_len[] = +{ + sizeof(" read local,") - 1, + sizeof(" read,") - 1, + sizeof(" low_priority write,") - 1, + sizeof(" write,") - 1 +}; + +spider_db_odbc_mariadb_util spider_db_odbc_mariadb_utility("`", "'", 1, 1); + +spider_db_share *spider_odbc_mariadb_create_share( + SPIDER_SHARE *share +) { + DBUG_ENTER("spider_odbc_mariadb_create_share"); + DBUG_RETURN(new spider_odbc_share(share, &spider_db_odbc_mariadb_utility)); +} + +spider_db_handler *spider_odbc_mariadb_create_handler( + ha_spider *spider, + spider_db_share *db_share +) { + DBUG_ENTER("spider_odbc_mariadb_create_handler"); + DBUG_RETURN(new spider_odbc_mariadb_handler(spider, + (spider_odbc_share *) db_share, &spider_db_odbc_mariadb_utility)); +} + +spider_db_copy_table *spider_odbc_mariadb_create_copy_table( + spider_db_share *db_share +) { + DBUG_ENTER("spider_odbc_mariadb_create_copy_table"); + DBUG_RETURN(new spider_odbc_mariadb_copy_table( + (spider_odbc_share *) db_share, &spider_db_odbc_mariadb_utility)); +} + +SPIDER_DB_CONN *spider_odbc_mariadb_create_conn( + SPIDER_CONN *conn +) { + DBUG_ENTER("spider_odbc_mariadb_create_conn"); + DBUG_RETURN(new spider_db_odbc_mariadb(conn)); +} + +SPIDER_DBTON spider_dbton_odbc_mariadb = { + 0, + SPIDER_DB_WRAPPER_ODBC_MARIADB, + SPIDER_DB_ACCESS_TYPE_SQL, + spider_odbc_init, + spider_odbc_deinit, + spider_odbc_mariadb_create_share, + spider_odbc_mariadb_create_handler, + spider_odbc_mariadb_create_copy_table, + spider_odbc_mariadb_create_conn, +#ifdef SPIDER_SQL_TYPE_DDL_SQL + NULL, +#endif + spider_odbc_support_direct_join, + &spider_db_odbc_mariadb_utility +}; + +spider_db_odbc_mariadb_result::spider_db_odbc_mariadb_result( + SPIDER_DB_CONN *in_db_conn +) : spider_db_odbc_result(in_db_conn) +{ + DBUG_ENTER("spider_db_odbc_mariadb_result::spider_db_odbc_mariadb_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_odbc_mariadb_result::~spider_db_odbc_mariadb_result() +{ + DBUG_ENTER("spider_db_odbc_mariadb_result::~spider_db_odbc_mariadb_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +void spider_db_odbc_mariadb_result::free_result() +{ + SQLRETURN ret; + DBUG_ENTER("spider_db_odbc_mariadb_result::free_result"); + DBUG_PRINT("info",("spider this=%p", this)); + if (hstm) + { + ret = SQLFreeStmt(hstm, SQL_CLOSE); + if (ret != SQL_SUCCESS) + { + stored_error_num = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, + hstm, db_conn->conn, stored_error_msg); + } + SQLFreeHandle(SQL_HANDLE_STMT, hstm); + hstm = NULL; + } + DBUG_VOID_RETURN; +} + +spider_db_odbc_mariadb::spider_db_odbc_mariadb( + SPIDER_CONN *conn +) : spider_db_odbc(conn, &spider_db_odbc_mariadb_utility) +{ + DBUG_ENTER("spider_db_odbc_mariadb::spider_db_odbc_mariadb"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_odbc_mariadb::~spider_db_odbc_mariadb() +{ + DBUG_ENTER("spider_db_odbc_mariadb::~spider_db_odbc_mariadb"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_db_odbc_mariadb::connect( + char *tgt_host, + char *tgt_username, + char *tgt_password, + long tgt_port, + char *tgt_socket, + char *server_name, + int connect_retry_count, + longlong connect_retry_interval +) { + SQLRETURN ret; + SQLUINTEGER login_tmo; + SQLUINTEGER net_tmo; + bool use_driver; + bool use_dir; + bool use_dsn; + bool use_db; + bool use_uid; + bool use_socket; + bool use_server; + bool use_port; + uint conn_str_len; + SQLSMALLINT dummy_len; + char *conn_str; + char *tmp_str; + DBUG_ENTER("spider_db_odbc_mariadb::connect"); + DBUG_PRINT("info",("spider this=%p", this)); +#ifndef DBUG_OFF + { + SQLCHAR server_name[80]; + SQLCHAR description[80]; + SQLSMALLINT srv_lgt; + SQLSMALLINT dsc_lgt; + ret = SQLDataSources(henv, SQL_FETCH_FIRST, + server_name, (SQLSMALLINT) 80, &srv_lgt, + description, (SQLSMALLINT) 80, &dsc_lgt); + while (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) + { + DBUG_PRINT("info",("spider server_name:%s description:%s", + server_name, description)); + ret = SQLDataSources(henv, SQL_FETCH_NEXT, + server_name, (SQLSMALLINT) 80, &srv_lgt, + description, (SQLSMALLINT) 80, &dsc_lgt); + } + } +#endif + + ret = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); + if (ret != SQL_SUCCESS) + { + if (hdbc == SQL_NULL_HDBC) + { + DBUG_PRINT("info",("spider ret=%d", ret)); + if ((stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_ENV, henv, + conn, stored_error_msg))) + { + goto error_alloc_handle_dbc1; + } + } else { + DBUG_PRINT("info",("spider ret=%d", ret)); + if ((stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, + conn, stored_error_msg))) + { + goto error_alloc_handle_dbc2; + } + } + } + + login_tmo = conn->connect_timeout; + ret = SQLSetConnectAttr(hdbc, SQL_LOGIN_TIMEOUT, + (SQLPOINTER) (SQLULEN) login_tmo, SQL_IS_UINTEGER); + if (ret != SQL_SUCCESS) + { + DBUG_PRINT("info",("spider ret=%d", ret)); + if ((stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, + conn, stored_error_msg))) + { + goto error_set_timeout; + } + } + + net_tmo = conn->net_read_timeout > conn->net_write_timeout ? + conn->net_read_timeout : conn->net_write_timeout; + ret = SQLSetConnectAttr(hdbc, SQL_ATTR_CONNECTION_TIMEOUT, + (SQLPOINTER) (SQLULEN) net_tmo, SQL_IS_UINTEGER); + if (ret != SQL_SUCCESS) + { + DBUG_PRINT("info",("spider ret=%d", ret)); + if ((stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, + conn, stored_error_msg))) + { + goto error_set_timeout; + } + } + + /* create connect string */ + use_driver = conn->tgt_default_group_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_driver:%s", use_driver ? "TRUE" : "FALSE")); + use_dir = conn->tgt_default_file_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_dir:%s", use_dir ? "TRUE" : "FALSE")); + use_dsn = conn->tgt_dsn_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_dsn:%s", use_dsn ? "TRUE" : "FALSE")); + use_server = conn->tgt_host_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_server:%s", use_server ? "TRUE" : "FALSE")); + use_socket = conn->tgt_socket_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_socket:%s", use_socket ? "TRUE" : "FALSE")); + use_port = conn->tgt_port ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_port:%s", use_port ? "TRUE" : "FALSE")); + use_db = conn->tgt_db_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_db:%s", use_db ? "TRUE" : "FALSE")); + use_uid = conn->tgt_username_length ? TRUE : FALSE; + DBUG_PRINT("info",("spider use_uid:%s", use_uid ? "TRUE" : "FALSE")); + dummy_len = 0; + conn_str_len = + (use_driver ? + (SPIDER_DB_DRIVER_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + SPIDER_SQL_OPEN_BRACE_LEN + conn->tgt_default_group_length + + SPIDER_SQL_CLOSE_BRACE_LEN + SPIDER_SQL_SEMICOLON_LEN + + (use_dir ? + (SPIDER_DB_DIRECTORY_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_default_file_length + SPIDER_SQL_SEMICOLON_LEN + ) : + 0) + ) : + 0) + + (use_dsn ? + (SPIDER_DB_DSN_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_dsn_length + SPIDER_SQL_SEMICOLON_LEN) : 0) + + (use_server ? + (SPIDER_SQL_SERVER_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_host_length + SPIDER_SQL_SEMICOLON_LEN) : 0) + + (use_socket ? + (SPIDER_SQL_SOCKET_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_socket_length + SPIDER_SQL_SEMICOLON_LEN) : 0) + + (use_port ? + (SPIDER_SQL_PORT_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + /* conn->tgt_port_length */ 5 + SPIDER_SQL_SEMICOLON_LEN) : 0) + + (use_db ? + (SPIDER_SQL_DATABASE_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_db_length + SPIDER_SQL_SEMICOLON_LEN) : 0) + + (use_uid ? + (SPIDER_SQL_UID_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_username_length + SPIDER_SQL_SEMICOLON_LEN + + SPIDER_SQL_PWD_LEN + SPIDER_SQL_ODBC_EQUAL_LEN + + conn->tgt_password_length + SPIDER_SQL_SEMICOLON_LEN) : + 0) + + conn->tgt_ssl_ca_length + + conn->tgt_ssl_capath_length + + conn->tgt_ssl_cert_length + + conn->tgt_ssl_cipher_length + + conn->tgt_ssl_key_length; + conn_str = (char *) my_alloca(conn_str_len + 1); + if (!conn_str) + { + stored_error = HA_ERR_OUT_OF_MEM; + goto error_alloc_conn_str; + } + tmp_str = conn_str; + + /* additional connect parameter for ODBC */ + if (conn->tgt_ssl_ca_length) + { + memcpy(tmp_str, conn->tgt_ssl_ca, conn->tgt_ssl_ca_length); + tmp_str += conn->tgt_ssl_ca_length; + } + + if (use_driver) + { + memcpy(tmp_str, SPIDER_DB_DRIVER_STR, SPIDER_DB_DRIVER_LEN); + tmp_str += SPIDER_DB_DRIVER_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, SPIDER_SQL_OPEN_BRACE_STR, SPIDER_SQL_OPEN_BRACE_LEN); + tmp_str += SPIDER_SQL_OPEN_BRACE_LEN; + memcpy(tmp_str, conn->tgt_default_group, conn->tgt_default_group_length); + tmp_str += conn->tgt_default_group_length; + memcpy(tmp_str, SPIDER_SQL_CLOSE_BRACE_STR, SPIDER_SQL_CLOSE_BRACE_LEN); + tmp_str += SPIDER_SQL_CLOSE_BRACE_LEN; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + if (use_dir) + { + memcpy(tmp_str, SPIDER_DB_DIRECTORY_STR, SPIDER_DB_DIRECTORY_LEN); + tmp_str += SPIDER_DB_DIRECTORY_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_default_file, conn->tgt_default_file_length); + tmp_str += conn->tgt_default_file_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + } + + /* additional connect parameter for ODBC */ + if (conn->tgt_ssl_capath_length) + { + memcpy(tmp_str, conn->tgt_ssl_capath, conn->tgt_ssl_capath_length); + tmp_str += conn->tgt_ssl_capath_length; + } + + if (use_dsn) + { + memcpy(tmp_str, SPIDER_DB_DSN_STR, SPIDER_DB_DSN_LEN); + tmp_str += SPIDER_DB_DSN_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_dsn, conn->tgt_dsn_length); + tmp_str += conn->tgt_dsn_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + + if (use_server) + { + memcpy(tmp_str, SPIDER_SQL_SERVER_STR, SPIDER_SQL_SERVER_LEN); + tmp_str += SPIDER_SQL_SERVER_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_host, conn->tgt_host_length); + tmp_str += conn->tgt_host_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + + if (use_socket) + { + memcpy(tmp_str, SPIDER_SQL_SOCKET_STR, SPIDER_SQL_SOCKET_LEN); + tmp_str += SPIDER_SQL_SOCKET_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_socket, conn->tgt_socket_length); + tmp_str += conn->tgt_socket_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + + if (use_port) + { + memcpy(tmp_str, SPIDER_SQL_PORT_STR, SPIDER_SQL_PORT_LEN); + tmp_str += SPIDER_SQL_PORT_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + my_sprintf(tmp_str, (tmp_str, "%05ld", conn->tgt_port)); + tmp_str += /* conn->tgt_port_length */ 5; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + + /* additional connect parameter for ODBC */ + if (conn->tgt_ssl_cert_length) + { + memcpy(tmp_str, conn->tgt_ssl_cert, conn->tgt_ssl_cert_length); + tmp_str += conn->tgt_ssl_cert_length; + } + + if (use_db) + { + memcpy(tmp_str, SPIDER_SQL_DATABASE_STR, SPIDER_SQL_DATABASE_LEN); + tmp_str += SPIDER_SQL_DATABASE_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_db, conn->tgt_db_length); + tmp_str += conn->tgt_db_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + + /* additional connect parameter for ODBC */ + if (conn->tgt_ssl_cipher_length) + { + memcpy(tmp_str, conn->tgt_ssl_cipher, conn->tgt_ssl_cipher_length); + tmp_str += conn->tgt_ssl_cipher_length; + } + + if (use_uid) + { + memcpy(tmp_str, SPIDER_SQL_UID_STR, SPIDER_SQL_UID_LEN); + tmp_str += SPIDER_SQL_UID_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_username, conn->tgt_username_length); + tmp_str += conn->tgt_username_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + memcpy(tmp_str, SPIDER_SQL_PWD_STR, SPIDER_SQL_PWD_LEN); + tmp_str += SPIDER_SQL_PWD_LEN; + memcpy(tmp_str, SPIDER_SQL_ODBC_EQUAL_STR, SPIDER_SQL_ODBC_EQUAL_LEN); + tmp_str += SPIDER_SQL_ODBC_EQUAL_LEN; + memcpy(tmp_str, conn->tgt_password, conn->tgt_password_length); + tmp_str += conn->tgt_password_length; + memcpy(tmp_str, SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); + tmp_str += SPIDER_SQL_SEMICOLON_LEN; + } + + /* additional connect parameter for ODBC */ + if (conn->tgt_ssl_key_length) + { + memcpy(tmp_str, conn->tgt_ssl_key, conn->tgt_ssl_key_length); + tmp_str += conn->tgt_ssl_key_length; + } + *tmp_str = '\0'; + + DBUG_PRINT("info",("spider conn_str=%s", conn_str)); + DBUG_PRINT("info",("spider conn_str_len=%u", conn_str_len)); + ret = SQLDriverConnect(hdbc, SQL_NULL_HANDLE, (SQLCHAR *) conn_str, + (SQLSMALLINT) conn_str_len, (SQLCHAR *) NULL, dummy_len, &dummy_len, + SQL_DRIVER_NOPROMPT); + if (ret != SQL_SUCCESS) + { + DBUG_PRINT("info",("spider ret=%d", ret)); + if ((stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, + conn, stored_error_msg))) + { + goto error_connect; + } + } + my_afree(conn_str); + DBUG_RETURN(0); + +error_connect: + my_afree(conn_str); +error_alloc_conn_str: +error_set_timeout: +error_alloc_handle_dbc2: +error_alloc_handle_dbc1: + DBUG_RETURN(stored_error); +} + +void spider_db_odbc_mariadb::disconnect() +{ + SQLRETURN ret; + DBUG_ENTER("spider_db_odbc_mariadb::disconnect"); + DBUG_PRINT("info",("spider this=%p", this)); + if (hstm != SQL_NULL_HSTMT) + { + ret = SQLFreeStmt(hstm, SQL_CLOSE); + if (ret != SQL_SUCCESS) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, + hstm, conn, stored_error_msg); + } + SQLFreeHandle(SQL_HANDLE_STMT, hstm); + hstm = SQL_NULL_HSTMT; + } + if (hdbc != SQL_NULL_HDBC) + { + SQLDisconnect(hdbc); + SQLFreeHandle(SQL_HANDLE_ENV, henv); + henv = SQL_NULL_HENV; + } + DBUG_VOID_RETURN; +} + +int spider_db_odbc_mariadb::exec_query( + const char *query, + uint length, + int quick_mode +) { + SQLRETURN ret; + DBUG_ENTER("spider_db_odbc_mariadb::exec_query"); + DBUG_PRINT("info",("spider this=%p", this)); + stored_error = 0; + if (spider_param_general_log()) + { + const char *tgt_str = conn->tgt_host; + uint32 tgt_len = conn->tgt_host_length; + spider_string tmp_query_str; + tmp_query_str.init_calc_mem(308); + if (tmp_query_str.reserve( + length + conn->tgt_wrapper_length + + tgt_len + (SPIDER_SQL_SPACE_LEN * 2))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + tmp_query_str.q_append(conn->tgt_wrapper, conn->tgt_wrapper_length); + tmp_query_str.q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); + tmp_query_str.q_append(tgt_str, tgt_len); + tmp_query_str.q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); + tmp_query_str.q_append(query, length); + general_log_write(current_thd, COM_QUERY, tmp_query_str.ptr(), + tmp_query_str.length()); + } + if (!spider_param_dry_access()) + { + if (hstm == SQL_NULL_HSTMT) + { + ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstm); + if (ret != SQL_SUCCESS) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_DBC, hdbc, + conn, stored_error_msg); + DBUG_RETURN(stored_error); + } + my_sprintf(cur_nm, (cur_nm, "cur%p", hstm)); + cur_nm_len = strlen(cur_nm); + DBUG_PRINT("info",("spider cur_nm:%s", cur_nm)); + ret = SQLSetCursorName(hstm, (SQLCHAR *) cur_nm, SQL_NTS); + if (ret != SQL_SUCCESS) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, hstm, + conn, stored_error_msg); + SQLFreeHandle(SQL_HANDLE_STMT, hstm); + hstm = NULL; + DBUG_RETURN(stored_error); + } + } + ret = SQLExecDirect(hstm, (SQLCHAR *) query, (SQLINTEGER) length); + if (ret != SQL_SUCCESS && ret != SQL_NO_DATA) + { + stored_error = spider_db_odbc_get_error(ret, SQL_HANDLE_STMT, hstm, + conn, stored_error_msg); + SQLFreeHandle(SQL_HANDLE_STMT, hstm); + hstm = NULL; + DBUG_RETURN(stored_error); + } + } + DBUG_RETURN(stored_error); +} + +spider_db_result *spider_db_odbc_mariadb::store_result( + spider_db_result_buffer **spider_res_buf, + st_spider_db_request_key *request_key, + int *err +) { + spider_db_odbc_mariadb_result *result; + DBUG_ENTER("spider_db_odbc_mariadb::store_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_ASSERT(!spider_res_buf); + if ((result = new spider_db_odbc_mariadb_result(this))) + { + hstm = SQL_NULL_HSTMT; + memcpy(result->cur_nm, cur_nm, cur_nm_len + 1); + result->cur_nm_len = cur_nm_len; + *err = 0; + if (spider_param_dry_access() || + (*err = result->init())) + { + delete result; + result = NULL; + } + result->set_limit(limit); + result->spider = (ha_spider *) request_key->handler; + } else { + *err = HA_ERR_OUT_OF_MEM; + } + DBUG_RETURN(result); +} + +spider_db_result *spider_db_odbc_mariadb::use_result( + st_spider_db_request_key *request_key, + int *err +) { + spider_db_odbc_mariadb_result *result; + DBUG_ENTER("spider_db_odbc_mariadb::use_result"); + DBUG_PRINT("info",("spider this=%p", this)); + if ((result = new spider_db_odbc_mariadb_result(this))) + { + hstm = SQL_NULL_HSTMT; + memcpy(result->cur_nm, cur_nm, cur_nm_len + 1); + result->cur_nm_len = cur_nm_len; + *err = 0; + if (spider_param_dry_access() || + (*err = result->init())) + { + delete result; + result = NULL; + DBUG_RETURN(NULL); + } + result->set_limit(limit); + result->spider = (ha_spider *) request_key->handler; + } else { + *err = HA_ERR_OUT_OF_MEM; + } + DBUG_RETURN(result); +} + +int spider_db_odbc_mariadb::append_lock_tables( + spider_string *str +) { + int error_num; + ha_spider *tmp_spider; + int lock_type; + uint conn_link_idx; + int tmp_link_idx; + SPIDER_LINK_FOR_HASH *tmp_link_for_hash; + const char *db_name; + uint db_name_length; + CHARSET_INFO *db_name_charset; + const char *table_name; + uint table_name_length; + CHARSET_INFO *table_name_charset; + DBUG_ENTER("spider_db_odbc_mariadb::lock_tables"); + DBUG_PRINT("info",("spider this=%p", this)); + if ((error_num = utility->append_lock_table_head(str))) + { + DBUG_RETURN(error_num); + } + while ((tmp_link_for_hash = + (SPIDER_LINK_FOR_HASH *) my_hash_element(&lock_table_hash, 0))) + { + tmp_spider = tmp_link_for_hash->spider; + tmp_link_idx = tmp_link_for_hash->link_idx; + switch (tmp_spider->wide_handler->lock_type) + { + case TL_READ: + lock_type = SPIDER_DB_TABLE_LOCK_READ_LOCAL; + break; + case TL_READ_NO_INSERT: + lock_type = SPIDER_DB_TABLE_LOCK_READ; + break; + case TL_WRITE_LOW_PRIORITY: + lock_type = SPIDER_DB_TABLE_LOCK_LOW_PRIORITY_WRITE; + break; + case TL_WRITE: + lock_type = SPIDER_DB_TABLE_LOCK_WRITE; + break; + default: + // no lock + DBUG_PRINT("info",("spider lock_type=%d", + tmp_spider->wide_handler->lock_type)); + DBUG_RETURN(0); + } + conn_link_idx = tmp_spider->conn_link_idx[tmp_link_idx]; + spider_odbc_share *db_share = (spider_odbc_share *) + tmp_spider->share->dbton_share[conn->dbton_id]; + if (&db_share->db_names_str[conn_link_idx]) + { + db_name = db_share->db_names_str[conn_link_idx].ptr(); + db_name_length = db_share->db_names_str[conn_link_idx].length(); + db_name_charset = tmp_spider->share->access_charset; + } else { + db_name = tmp_spider->share->tgt_dbs[conn_link_idx]; + db_name_length = tmp_spider->share->tgt_dbs_lengths[conn_link_idx]; + db_name_charset = system_charset_info; + } + if (&db_share->table_names_str[conn_link_idx]) + { + table_name = db_share->table_names_str[conn_link_idx].ptr(); + table_name_length = db_share->table_names_str[conn_link_idx].length(); + table_name_charset = tmp_spider->share->access_charset; + } else { + table_name = tmp_spider->share->tgt_table_names[conn_link_idx]; + table_name_length = + tmp_spider->share->tgt_table_names_lengths[conn_link_idx]; + table_name_charset = system_charset_info; + } + if ((error_num = utility-> + append_lock_table_body( + str, + db_name, + db_name_length, + db_name_charset, + table_name, + table_name_length, + table_name_charset, + lock_type + ) + )) { + my_hash_reset(&lock_table_hash); + DBUG_RETURN(error_num); + } +#ifdef HASH_UPDATE_WITH_HASH_VALUE + my_hash_delete_with_hash_value(&lock_table_hash, + tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash); +#else + my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash); +#endif + } + if ((error_num = utility->append_lock_table_tail(str))) + { + DBUG_RETURN(error_num); + } + DBUG_RETURN(0); +} + +spider_db_odbc_mariadb_util::spider_db_odbc_mariadb_util( + const char *nm_quote, + const char *val_quote, + uint nm_quote_length, + uint val_quote_length +) : spider_db_odbc_util( + nm_quote, + val_quote, + nm_quote_length, + val_quote_length +) +{ + DBUG_ENTER("spider_db_odbc_mariadb_util::spider_db_odbc_mariadb_util"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_odbc_mariadb_util::~spider_db_odbc_mariadb_util() +{ + DBUG_ENTER("spider_db_odbc_mariadb_util::~spider_db_odbc_mariadb_util"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_db_odbc_mariadb_util::append_lock_table_body( + spider_string *str, + const char *db_name, + uint db_name_length, + CHARSET_INFO *db_name_charset, + const char *table_name, + uint table_name_length, + CHARSET_INFO *table_name_charset, + int lock_type +) { + DBUG_ENTER("spider_db_odbc_mariadb_util::append_lock_table_body"); + DBUG_PRINT("info",("spider this=%p", this)); + if (str->reserve(name_quote_length)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(name_quote, name_quote_length); + if (db_name) + { + if ( + str->append(db_name, db_name_length, db_name_charset) || + str->reserve((name_quote_length) * 2 + SPIDER_SQL_DOT_LEN) + ) { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(name_quote, name_quote_length); + str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); + str->q_append(name_quote, name_quote_length); + } + if ( + str->append(table_name, table_name_length, table_name_charset) || + str->reserve(name_quote_length + + spider_db_table_lock_len[lock_type]) + ) { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(name_quote, name_quote_length); + str->q_append(spider_db_table_lock_str[lock_type], + spider_db_table_lock_len[lock_type]); + DBUG_RETURN(0); +} + +int spider_db_odbc_mariadb_util::append_lock_table_tail( + spider_string *str +) { + DBUG_ENTER("spider_db_odbc_mariadb_util::append_lock_table_tail"); + DBUG_PRINT("info",("spider this=%p", this)); + str->length(str->length() - SPIDER_SQL_COMMA_LEN); + DBUG_RETURN(0); +} + +int spider_db_odbc_mariadb_util::append_unlock_table( + spider_string *str +) { + DBUG_ENTER("spider_db_odbc_mariadb_util::append_unlock_table"); + DBUG_PRINT("info",("spider this=%p", this)); + if (str->reserve(SPIDER_SQL_UNLOCK_TABLE_LEN)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + str->q_append(SPIDER_SQL_UNLOCK_TABLE_STR, SPIDER_SQL_UNLOCK_TABLE_LEN); + DBUG_RETURN(0); +} + +spider_odbc_mariadb_handler::spider_odbc_mariadb_handler( + ha_spider *spider, + spider_odbc_share *db_share, + spider_db_odbc_util *db_util +) : spider_odbc_handler( + spider, + db_share, + db_util +) +{ + DBUG_ENTER("spider_odbc_mariadb_handler::spider_odbc_mariadb_handler"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_odbc_mariadb_handler::~spider_odbc_mariadb_handler() +{ + DBUG_ENTER("spider_odbc_mariadb_handler::~spider_odbc_mariadb_handler"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_odbc_mariadb_handler::append_update_where( + spider_string *str, + const TABLE *table, + my_ptrdiff_t ptr_diff +) { + uint field_name_length; + Field **field; + THD *thd = spider->wide_handler->trx->thd; + SPIDER_SHARE *share = spider->share; + bool no_pk = (table->s->primary_key == MAX_KEY); + DBUG_ENTER("spider_odbc_mariadb_handler::append_update_where"); + DBUG_PRINT("info", ("spider table->s->primary_key=%s", + table->s->primary_key != MAX_KEY ? "TRUE" : "FALSE")); + uint str_len_bakup = str->length(); + if (str->reserve(SPIDER_SQL_WHERE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); + + bool uk = no_pk; + if (!uk) + { + for (uint i= 0; i < table->s->keys; i++) + { + if (table->s->key_info[i].flags & HA_NOSAME) + { + DBUG_PRINT("info",("spider found i:%u", i)); + uk = TRUE; + break; + } + } + } + if (!uk) + { + spider_db_odbc_mariadb_result *result = + (spider_db_odbc_mariadb_result *) spider->result_list.current; + if (str->reserve(SPIDER_SQL_CUR_CUR_LEN + result->cur_nm_len)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_CUR_CUR_STR, SPIDER_SQL_CUR_CUR_LEN); + str->q_append(result->cur_nm, result->cur_nm_len); + } else { + if ( + no_pk || + spider_param_use_cond_other_than_pk_for_update(thd) + ) { + for (field = table->field; *field; field++) + { + if ( + no_pk || + bitmap_is_set(table->read_set, (*field)->field_index) + ) { + field_name_length = + odbc_share->column_name_str[(*field)->field_index].length(); + if ((*field)->is_null(ptr_diff)) + { + if (str->reserve(field_name_length + + utility->name_quote_length * 2 + + SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + odbc_share->append_column_name(str, (*field)->field_index); + str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN); + } else { + if (str->reserve(field_name_length + + utility->name_quote_length * 2 + + SPIDER_SQL_EQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + odbc_share->append_column_name(str, (*field)->field_index); + str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); + (*field)->move_field_offset(ptr_diff); + if ( + utility->append_column_value(spider, str, *field, NULL, + share->access_charset) || + str->reserve(SPIDER_SQL_AND_LEN) + ) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + (*field)->move_field_offset(-ptr_diff); + } + str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); + } + } + } else { + KEY *key_info = &table->key_info[table->s->primary_key]; + KEY_PART_INFO *key_part; + uint part_num; + for ( + key_part = key_info->key_part, part_num = 0; + part_num < spider_user_defined_key_parts(key_info); + key_part++, part_num++ + ) { + field = &key_part->field; + field_name_length = + odbc_share->column_name_str[(*field)->field_index].length(); + if ((*field)->is_null(ptr_diff)) + { + if (str->reserve(field_name_length + + utility->name_quote_length * 2 + + SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + odbc_share->append_column_name(str, (*field)->field_index); + str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN); + } else { + if (str->reserve(field_name_length + + utility->name_quote_length * 2 + + SPIDER_SQL_EQUAL_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + odbc_share->append_column_name(str, (*field)->field_index); + str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); + (*field)->move_field_offset(ptr_diff); + if ( + utility->append_column_value(spider, str, *field, NULL, + share->access_charset) || + str->reserve(SPIDER_SQL_AND_LEN) + ) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + (*field)->move_field_offset(-ptr_diff); + } + str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); + } + } + if (str->length() == str_len_bakup + SPIDER_SQL_WHERE_LEN) + { + /* no condition */ + str->length(str_len_bakup); + } else { + str->length(str->length() - SPIDER_SQL_AND_LEN); + } + } + DBUG_RETURN(0); +} + +int spider_odbc_mariadb_handler::append_select_lock( + spider_string *str +) { + int lock_mode = spider_conn_lock_mode(spider); + DBUG_ENTER("spider_odbc_mariadb_handler::append_select_lock"); + DBUG_PRINT("info",("spider this=%p", this)); + if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) + { + if (str->reserve(SPIDER_SQL_FOR_UPDATE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN); + } else if (lock_mode == SPIDER_LOCK_MODE_SHARED) + { + if (str->reserve(SPIDER_SQL_SHARED_LOCK_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_SHARED_LOCK_STR, SPIDER_SQL_SHARED_LOCK_LEN); + } + DBUG_RETURN(0); +} + +int spider_odbc_mariadb_handler::lock_tables( + int link_idx +) { + int error_num; + SPIDER_CONN *conn = spider->conns[link_idx]; + spider_string *str = &sql; + DBUG_ENTER("spider_odbc_mariadb_handler::lock_tables"); + str->length(0); + if ((error_num = conn->db_conn->append_lock_tables(str))) + { + DBUG_RETURN(error_num); + } + if (str->length()) + { + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); + conn->need_mon = &spider->need_mons[link_idx]; + conn->mta_conn_mutex_lock_already = TRUE; + conn->mta_conn_mutex_unlock_later = TRUE; + if ((error_num = spider_db_set_names(spider, conn, link_idx))) + { + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); + pthread_mutex_unlock(&conn->mta_conn_mutex); + DBUG_RETURN(error_num); + } + spider_conn_set_timeout_from_share(conn, link_idx, + spider->wide_handler->trx->thd, + spider->share); + if (spider_db_query( + conn, + str->ptr(), + str->length(), + -1, + &spider->need_mons[link_idx]) + ) { + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + DBUG_RETURN(spider_db_errorno(conn)); + } + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); + pthread_mutex_unlock(&conn->mta_conn_mutex); + } + if (!conn->table_locked) + { + conn->table_locked = TRUE; + spider->wide_handler->trx->locked_connections++; + } + DBUG_RETURN(0); +} + +spider_odbc_mariadb_copy_table::spider_odbc_mariadb_copy_table( + spider_odbc_share *db_share, + spider_db_odbc_util *db_util +) : spider_odbc_copy_table( + db_share, + db_util +) +{ + DBUG_ENTER("spider_odbc_mariadb_copy_table::spider_odbc_mariadb_copy_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_odbc_mariadb_copy_table::~spider_odbc_mariadb_copy_table() +{ + DBUG_ENTER("spider_odbc_mariadb_copy_table::~spider_odbc_mariadb_copy_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_odbc_mariadb_copy_table::append_select_lock_str( + int lock_mode +) { + DBUG_ENTER("spider_odbc_mariadb_copy_table::append_select_lock_str"); + DBUG_PRINT("info",("spider this=%p", this)); + if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) + { + if (sql.reserve(SPIDER_SQL_FOR_UPDATE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + sql.q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN); + } else if (lock_mode == SPIDER_LOCK_MODE_SHARED) + { + if (sql.reserve(SPIDER_SQL_SHARED_LOCK_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + sql.q_append(SPIDER_SQL_SHARED_LOCK_STR, SPIDER_SQL_SHARED_LOCK_LEN); + } + DBUG_RETURN(0); +} +#endif diff --git a/storage/spider/spd_db_odbc_mariadb.h b/storage/spider/spd_db_odbc_mariadb.h new file mode 100644 index 00000000000..d245b24b3f5 --- /dev/null +++ b/storage/spider/spd_db_odbc_mariadb.h @@ -0,0 +1,133 @@ +/* Copyright (C) 2020 Kentoku Shiba + Copyright (C) 2020 MariaDB corp + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "spd_db_odbc.h" +#ifdef HAVE_SPIDER_ODBC + +class spider_db_odbc_mariadb_util: public spider_db_odbc_util +{ +public: + spider_db_odbc_mariadb_util( + const char *nm_quote, + const char *val_quote, + uint nm_quote_length, + uint val_quote_length + ); + virtual ~spider_db_odbc_mariadb_util(); + virtual int append_lock_table_body( + spider_string *str, + const char *db_name, + uint db_name_length, + CHARSET_INFO *db_name_charset, + const char *table_name, + uint table_name_length, + CHARSET_INFO *table_name_charset, + int lock_type + ); + virtual int append_lock_table_tail( + spider_string *str + ); + virtual int append_unlock_table( + spider_string *str + ); +}; + +class spider_db_odbc_mariadb_result: public spider_db_odbc_result +{ +public: + char cur_nm[25]; + uint cur_nm_len; + spider_db_odbc_mariadb_result( + SPIDER_DB_CONN *in_db_conn + ); + virtual ~spider_db_odbc_mariadb_result(); + virtual void free_result(); +}; + +class spider_db_odbc_mariadb: public spider_db_odbc +{ +public: + char cur_nm[25]; + uint cur_nm_len; + spider_db_odbc_mariadb( + SPIDER_CONN *conn + ); + virtual ~spider_db_odbc_mariadb(); + virtual int connect( + char *tgt_host, + char *tgt_username, + char *tgt_password, + long tgt_port, + char *tgt_socket, + char *server_name, + int connect_retry_count, + longlong connect_retry_interval + ); + virtual void disconnect(); + virtual int exec_query( + const char *query, + uint length, + int quick_mode + ); + virtual spider_db_result *store_result( + spider_db_result_buffer **spider_res_buf, + st_spider_db_request_key *request_key, + int *err + ); + virtual spider_db_result *use_result( + st_spider_db_request_key *request_key, + int *err + ); + virtual int append_lock_tables( + spider_string *str + ); +}; + +class spider_odbc_mariadb_handler: public spider_odbc_handler +{ +public: + spider_odbc_mariadb_handler( + ha_spider *spider, + spider_odbc_share *share, + spider_db_odbc_util *db_util + ); + virtual ~spider_odbc_mariadb_handler(); + virtual int append_update_where( + spider_string *str, + const TABLE *table, + my_ptrdiff_t ptr_diff + ); + virtual int append_select_lock( + spider_string *str + ); + virtual int lock_tables( + int link_idx + ); +}; + +class spider_odbc_mariadb_copy_table: public spider_odbc_copy_table +{ +public: + spider_odbc_mariadb_copy_table( + spider_odbc_share *db_share, + spider_db_odbc_util *db_util + ); + virtual ~spider_odbc_mariadb_copy_table(); + virtual int append_select_lock_str( + int lock_mode + ); +}; +#endif diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index fde5746e418..cf83bf71e2d 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -#define SPIDER_DETAIL_VERSION "3.3.15" -#define SPIDER_HEX_VERSION 0x0303 +#define SPIDER_DETAIL_VERSION "3.4.0" +#define SPIDER_HEX_VERSION 0x0304 #if MYSQL_VERSION_ID < 50500 #define spider_my_free(A,B) my_free(A,B) diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 22f0b4876ae..89d55baae21 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -145,6 +145,7 @@ extern SPIDER_DBTON spider_dbton_oracle; #endif #ifdef HAVE_SPIDER_UNIXODBC extern SPIDER_DBTON spider_dbton_odbc; +extern SPIDER_DBTON spider_dbton_odbc_mariadb; #endif #ifndef WITHOUT_SPIDER_BG_SEARCH SPIDER_THREAD *spider_table_sts_threads; @@ -7828,7 +7829,12 @@ int spider_db_init( spider_dbton_odbc.db_util->dbton_id = dbton_id; spider_dbton[dbton_id] = spider_dbton_odbc; ++dbton_id; + spider_dbton_odbc_mariadb.dbton_id = dbton_id; + spider_dbton_odbc_mariadb.db_util->dbton_id = dbton_id; + spider_dbton[dbton_id] = spider_dbton_odbc_mariadb; + ++dbton_id; #endif + DBUG_ASSERT(dbton_id <= SPIDER_DBTON_SIZE); for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; roop_count++) { if (spider_dbton[roop_count].init) |