summaryrefslogtreecommitdiffstats
path: root/storage/spider/mysql-test/spider/bugfix
diff options
context:
space:
mode:
Diffstat (limited to 'storage/spider/mysql-test/spider/bugfix')
-rw-r--r--storage/spider/mysql-test/spider/bugfix/disabled.def1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc29
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc29
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc24
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc16
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_deinit.inc7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_init.inc9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc54
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/insert_select_deinit.inc16
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/insert_select_init.inc43
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc52
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_20100_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_20100_init.inc46
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_20502_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_20502_init.inc25
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc57
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc48
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_22265_deinit.inc7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_22265_init.inc7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc43
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc43
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_deinit.inc19
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_init.inc51
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_deinit.inc19
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_init.inc51
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_deinit.inc19
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_init.inc51
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_deinit.inc19
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_init.inc51
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc27
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc26
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc15
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc24
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc25
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/self_reference_deinit.inc10
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/self_reference_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc10
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc10
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_deinit.inc15
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_init.inc35
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc12
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc40
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/strict_group_by_deinit.inc18
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/strict_group_by_init.inc60
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc18
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc56
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc24
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc24
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_1_1.cnf44
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_2_1.cnf56
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_2_2.cnf38
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_2_3.cnf8
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_3_1.cnf11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_3_2.cnf9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_3_3.cnf9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/my_4_1.cnf9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result100
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/cp932_column.result84
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result85
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result85
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result37
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_tmp_table.result33
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result117
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/insert_select.result102
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result111
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result119
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result85
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result104
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result79
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_22265.result23
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result97
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result78
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result49
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26013.result42
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/quick_mode_0.result504
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/quick_mode_1.result504
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/quick_mode_2.result504
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/quick_mode_3.result504
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result179
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result99
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/same_server_link.result42
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/select_by_null.result90
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result75
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/self_reference.result36
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result22
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result99
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result38
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result83
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result83
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/strict_group_by.result124
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result130
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result78
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result68
-rw-r--r--storage/spider/mysql-test/spider/bugfix/suite.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/suite.pm11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test72
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/cp932_column.test80
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc100
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test35
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.test35
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test97
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/insert_select.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/insert_select.test99
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test97
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_20100.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test89
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_20502.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test78
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test101
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test92
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_22265.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_22265.test28
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24020.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test90
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24517.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test80
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24760.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24760.test49
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26013.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26013.test51
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test156
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test156
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test156
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test157
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test98
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test78
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/same_server_link.test55
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/select_by_null.test72
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test74
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/self_reference.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/self_reference.test45
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf6
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test96
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test46
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc66
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/strict_group_by.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test98
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test109
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test71
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test69
199 files changed, 9507 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/disabled.def b/storage/spider/mysql-test/spider/bugfix/disabled.def
new file mode 100644
index 00000000..e19ea07b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/disabled.def
@@ -0,0 +1 @@
+wait_timeout : MDEV-26045
diff --git a/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_deinit.inc
new file mode 100644
index 00000000..47f6df94
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_deinit.inc
@@ -0,0 +1,14 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc b/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc
new file mode 100644
index 00000000..12341038
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/checksum_table_with_quick_mode_3_init.inc
@@ -0,0 +1,29 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %';
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc
new file mode 100644
index 00000000..930cde88
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_deinit.inc
@@ -0,0 +1,13 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc
new file mode 100644
index 00000000..ba412b56
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/cp932_column_init.inc
@@ -0,0 +1,29 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE DEFAULT CHARACTER SET utf8;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, txt_utf8, txt_cp932 FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%update %';
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc
new file mode 100644
index 00000000..4ea789fe
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_deinit.inc
@@ -0,0 +1,13 @@
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--connection master_1
+set session binlog_format= @old_binlog_format;
+--connection slave1_1
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/deinit_spider.inc
+--source ../t/slave_test_deinit.inc
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc
new file mode 100644
index 00000000..f2f8635f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_init.inc
@@ -0,0 +1,24 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--source ../t/slave_test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, f FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %';
+--connection slave1_1
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/init_spider.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--connection master_1
+set @old_binlog_format= @@binlog_format;
+set session binlog_format= 'ROW';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc
new file mode 100644
index 00000000..4fd217a5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_deinit.inc
@@ -0,0 +1,4 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--source delete_with_float_column_deinit.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc
new file mode 100644
index 00000000..9d396149
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mariadb_init.inc
@@ -0,0 +1,14 @@
+--source delete_with_float_column_init.inc
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ f float DEFAULT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc
new file mode 100644
index 00000000..4fd217a5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_deinit.inc
@@ -0,0 +1,4 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--source delete_with_float_column_deinit.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc
new file mode 100644
index 00000000..d98f3c12
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_mysql_init.inc
@@ -0,0 +1,16 @@
+--source delete_with_float_column_init.inc
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1", wrapper "mysql"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a $STR_SEMICOLON
+ DROP FUNCTION to_float;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ f float DEFAULT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE FUNCTION to_float(a decimal(20,6)) RETURNS float RETURN cast(a as double);
diff --git a/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc
new file mode 100644
index 00000000..27682e43
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_deinit.inc
@@ -0,0 +1,9 @@
+--connection child2_1
+DROP USER tu@'%';
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc
new file mode 100644
index 00000000..c87af2d0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_comma_pwd_init.inc
@@ -0,0 +1,11 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $DIRECT_SQL_COMMAND=
+ SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"');
+--connection child2_1
+GRANT ALL ON *.* TO tu@'%' IDENTIFIED BY 'pass,1234';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_deinit.inc
new file mode 100644
index 00000000..ecb5622a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_deinit.inc
@@ -0,0 +1,7 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_init.inc b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_init.inc
new file mode 100644
index 00000000..7b58bd3e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/direct_sql_with_tmp_table_init.inc
@@ -0,0 +1,9 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $DIRECT_SQL_COMMAND=
+ SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"');
diff --git a/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc
new file mode 100644
index 00000000..9d255152
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_deinit.inc
@@ -0,0 +1,14 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc
new file mode 100644
index 00000000..ac60580f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/group_by_order_by_limit_init.inc
@@ -0,0 +1,54 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source group_by_order_by_limit_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/insert_select_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/insert_select_deinit.inc
new file mode 100644
index 00000000..b8b2f200
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/insert_select_deinit.inc
@@ -0,0 +1,16 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_1_2= $MASTER_1_COMMENT_2_1_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_DROP_TABLES2= $CHILD2_1_DROP_TABLES2_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES2= $CHILD2_1_CREATE_TABLES2_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/insert_select_init.inc b/storage/spider/mysql-test/spider/bugfix/include/insert_select_init.inc
new file mode 100644
index 00000000..62a8821a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/insert_select_init.inc
@@ -0,0 +1,43 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_1_2_BACKUP= $MASTER_1_COMMENT_2_1_2
+let $MASTER_1_COMMENT_2_1_2=
+ COMMENT='table "tbl_b", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_DROP_TABLES2_BACKUP= $CHILD2_1_DROP_TABLES2
+let $CHILD2_1_DROP_TABLES2=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ KEY idx1 (skey,dt,tm)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_CREATE_TABLES2_BACKUP= $CHILD2_1_CREATE_TABLES2
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ dt datetime NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (dt)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, dt FROM tbl_b ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc
new file mode 100644
index 00000000..9d255152
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_deinit.inc
@@ -0,0 +1,14 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc
new file mode 100644
index 00000000..dceae822
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_19866_init.inc
@@ -0,0 +1,52 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source group_by_order_by_limit_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val char(1) NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val char(1) NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_20100_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_20100_deinit.inc
new file mode 100644
index 00000000..1880a1c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_20100_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_20100_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_20100_init.inc
new file mode 100644
index 00000000..ed6e2796
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_20100_init.inc
@@ -0,0 +1,46 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1
+let $MASTER_1_COMMENT_P_2_1=
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"',
+ PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"',
+ PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r3 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r4;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r3 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r4 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, c FROM ta_r2 ORDER BY a $STR_SEMICOLON
+ SELECT a, b, c FROM ta_r3 ORDER BY a $STR_SEMICOLON
+ SELECT a, b, c FROM ta_r4 ORDER BY a;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_20502_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_20502_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_20502_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_20502_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_20502_init.inc
new file mode 100644
index 00000000..fd8cc0d8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_20502_init.inc
@@ -0,0 +1,25 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ val int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT id, val FROM tbl_a ORDER BY id;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc
new file mode 100644
index 00000000..74efe3a2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_deinit.inc
@@ -0,0 +1,14 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--connection master_1
+set session spider_bgs_mode= @old_spider_bgs_mode;
+set session spider_quick_mode= @old_spider_quick_mode;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc
new file mode 100644
index 00000000..25455ffc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc
@@ -0,0 +1,57 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1
+let $MASTER_1_COMMENT_P_2_1=
+ COMMENT='table "ta_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r2",
+ priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", priority "1000001"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r3;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt char(8) NOT NULL,
+ PRIMARY KEY (pkey, txt)
+ ) $CHILD2_1_ENGINE DEFAULT CHARACTER SET utf8;
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a,b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r3 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a,b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, txt FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, c FROM ta_r2 ORDER BY a $STR_SEMICOLON
+ SELECT a, b, c FROM ta_r3 ORDER BY a;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_bgs_mode= @@spider_bgs_mode;
+set session spider_bgs_mode= 2;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc
new file mode 100644
index 00000000..9d255152
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_deinit.inc
@@ -0,0 +1,14 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc
new file mode 100644
index 00000000..48226ba2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_22246_init.inc
@@ -0,0 +1,48 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source group_by_order_by_limit_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a"'
+ PARTITION BY HASH(id) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ id bigint NOT NULL,
+ node text,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT * FROM tbl_a ORDER BY id;
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ id bigint NOT NULL,
+ node text,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT * FROM tbl_a ORDER BY id;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_22265_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_22265_deinit.inc
new file mode 100644
index 00000000..ecb5622a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_22265_deinit.inc
@@ -0,0 +1,7 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_22265_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_22265_init.inc
new file mode 100644
index 00000000..6cf6b0c1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_22265_init.inc
@@ -0,0 +1,7 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc
new file mode 100644
index 00000000..1880a1c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc
new file mode 100644
index 00000000..63fd70a4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24020_init.inc
@@ -0,0 +1,43 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1
+let $MASTER_1_COMMENT_P_2_1=
+ PARTITION BY LIST(a % 3) (
+ PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"',
+ PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"',
+ PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r3 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r4;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r2 (
+ a INT,
+ b VARCHAR(30),
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r3 (
+ a INT,
+ b VARCHAR(30),
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r4 (
+ a INT,
+ b VARCHAR(30),
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b FROM ta_r2 ORDER BY a $STR_SEMICOLON
+ SELECT a, b FROM ta_r3 ORDER BY a $STR_SEMICOLON
+ SELECT a, b FROM ta_r4 ORDER BY a;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc
new file mode 100644
index 00000000..1880a1c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc
new file mode 100644
index 00000000..b5b77a53
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24517_init.inc
@@ -0,0 +1,43 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1
+let $MASTER_1_COMMENT_P_2_1=
+ PARTITION BY RANGE(i) (
+ PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"',
+ PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"',
+ PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r3 $STR_SEMICOLON
+ DROP TABLE IF EXISTS ta_r4;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r2 (
+ i INT,
+ j JSON,
+ PRIMARY KEY(i)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r3 (
+ i INT,
+ j JSON,
+ PRIMARY KEY(i)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE ta_r4 (
+ i INT,
+ j JSON,
+ PRIMARY KEY(i)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT i, j FROM ta_r2 ORDER BY i $STR_SEMICOLON
+ SELECT i, j FROM ta_r3 ORDER BY i $STR_SEMICOLON
+ SELECT i, j FROM ta_r4 ORDER BY i;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_deinit.inc
new file mode 100644
index 00000000..42124a79
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_deinit.inc
@@ -0,0 +1,19 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_init.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_init.inc
new file mode 100644
index 00000000..26565172
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_0_init.inc
@@ -0,0 +1,51 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 0;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_deinit.inc
new file mode 100644
index 00000000..42124a79
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_deinit.inc
@@ -0,0 +1,19 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_init.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_init.inc
new file mode 100644
index 00000000..9a8de407
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_1_init.inc
@@ -0,0 +1,51 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 1;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_deinit.inc
new file mode 100644
index 00000000..42124a79
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_deinit.inc
@@ -0,0 +1,19 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_init.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_init.inc
new file mode 100644
index 00000000..dbe3f703
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_2_init.inc
@@ -0,0 +1,51 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 2;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_deinit.inc
new file mode 100644
index 00000000..42124a79
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_deinit.inc
@@ -0,0 +1,19 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $MASTER_1_COMMENT_2_2= $MASTER_1_COMMENT_2_2_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--connection master_1
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_init.inc b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_init.inc
new file mode 100644
index 00000000..81239206
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/quick_mode_3_init.inc
@@ -0,0 +1,51 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", srv "s_2_2"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_6=
+ set session spider_quick_page_byte= 6;
+let $MASTER_1_SET_QUICK_PAGE_BYTE_0=
+ set session spider_quick_page_byte= 0;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc
new file mode 100644
index 00000000..da6778de
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_insert_init.inc
@@ -0,0 +1,27 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ PRIMARY KEY (skey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT skey, dt, tm FROM tbl_a ORDER BY skey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %';
+--let $MASTER_1_SET_COMMAND=set session spider_direct_dup_insert=1 $STR_SEMICOLON
diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc
new file mode 100644
index 00000000..884ef74c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/return_found_rows_update_init.inc
@@ -0,0 +1,26 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ KEY idx1 (skey,dt)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT skey, dt, tm FROM tbl_a ORDER BY skey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc
new file mode 100644
index 00000000..a4e8a10d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_deinit.inc
@@ -0,0 +1,11 @@
+--connection master_1
+set global spider_same_server_link= @old_global_spider_same_server_link;
+set session spider_same_server_link= @old_session_spider_same_server_link;
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc
new file mode 100644
index 00000000..2c8150c9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/same_server_link_init.inc
@@ -0,0 +1,15 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_b", host "127.0.0.1", port "$MASTER_1_MYPORT", user "root"';
+--connection master_1
+set @old_global_spider_same_server_link= @@global.spider_same_server_link;
+set @old_session_spider_same_server_link= @@session.spider_same_server_link;
+set global spider_same_server_link= 0;
+set session spider_same_server_link= 0;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc
new file mode 100644
index 00000000..d07ba2a9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc
@@ -0,0 +1,24 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc
new file mode 100644
index 00000000..37bf690c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc
@@ -0,0 +1,25 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE DEFAULT CHARACTER SET utf8;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/self_reference_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/self_reference_deinit.inc
new file mode 100644
index 00000000..34376d50
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/self_reference_deinit.inc
@@ -0,0 +1,10 @@
+--connection master_1
+set spider_same_server_link= @old_spider_same_server_link;
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/self_reference_init.inc b/storage/spider/mysql-test/spider/bugfix/include/self_reference_init.inc
new file mode 100644
index 00000000..b7e2c4d0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/self_reference_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", host "127.0.0.1", port "$MASTER_1_MYPORT", user "root"';
+--connection master_1
+set @old_spider_same_server_link= @@spider_same_server_link;
+set spider_same_server_link= ON;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc
new file mode 100644
index 00000000..5ac67cdf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_deinit.inc
@@ -0,0 +1,10 @@
+--connection slave1_1
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/deinit_spider.inc
+--source ../t/slave_test_deinit.inc
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc
new file mode 100644
index 00000000..052d6ebb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/slave_transaction_retry_errors_5digit_init.inc
@@ -0,0 +1,10 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--source ../t/slave_test_init.inc
+--connection slave1_1
+--source ../include/init_spider.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_deinit.inc
new file mode 100644
index 00000000..7c20b2bc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_deinit.inc
@@ -0,0 +1,15 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--connection slave1_1
+set global spider_slave_trx_isolation= @old_spider_slave_trx_isolation;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/deinit_spider.inc
+--source ../t/slave_test_deinit.inc
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_init.inc b/storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_init.inc
new file mode 100644
index 00000000..3a058a55
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/slave_trx_isolation_init.inc
@@ -0,0 +1,35 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--source ../t/slave_test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %';
+--connection slave1_1
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../include/init_spider.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+set @old_spider_slave_trx_isolation= @@spider_slave_trx_isolation;
+set global spider_slave_trx_isolation= 1;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc
new file mode 100644
index 00000000..01645e85
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc
@@ -0,0 +1,12 @@
+--connection master_1
+alter table mysql.spider_table_sts add column checksum bigint unsigned default null after update_time;
+DROP DATABASE IF EXISTS auto_test_local;
+
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc
new file mode 100644
index 00000000..1e438812
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", host "127.0.0.1", port "$MASTER_1_MYPORT", user "root"';
+--connection master_1
+alter table mysql.spider_table_sts drop column checksum;
+insert into mysql.spider_table_sts values ('auto_test_local', 'tbl_a', 0, 0, 0, 0, 0, '2019-01-01 00:00:00', '2019-01-01 00:00:00', '2019-01-01 00:00:00');
diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc
new file mode 100644
index 00000000..07f4d39a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_deinit.inc
@@ -0,0 +1,13 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--connection master_1
+set session sql_mode= @old_sql_mode;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc
new file mode 100644
index 00000000..65e2f910
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc
@@ -0,0 +1,40 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $SQL_MODES= real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length
+if (`SELECT IF(STRCMP('$SERVER_NAME', 'MariaDB') = 0, 1, 0)`)
+{
+ if (`SELECT IF($SERVER_MAJOR_VERSION = 10, 1, 0)`)
+ {
+ if (`SELECT IF($SERVER_MINOR_VERSION >= 3, 1, 0)`)
+ {
+ --let $SQL_MODES= $SQL_MODES,empty_string_is_null,simultaneous_assignment
+ }
+ if (`SELECT IF($SERVER_MINOR_VERSION >= 4, 1, 0)`)
+ {
+ --let $SQL_MODES= $SQL_MODES,time_round_fractional
+ }
+ }
+}
+--connection master_1
+set @old_sql_mode= @@sql_mode;
+eval set session sql_mode= '$SQL_MODES';
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc
new file mode 100644
index 00000000..0dbff811
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_deinit.inc
@@ -0,0 +1 @@
+--source sql_mode_deinit.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc
new file mode 100644
index 00000000..8e03b94b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mariadb_init.inc
@@ -0,0 +1,3 @@
+--source sql_mode_init.inc
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc
new file mode 100644
index 00000000..0dbff811
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_deinit.inc
@@ -0,0 +1 @@
+--source sql_mode_deinit.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc
new file mode 100644
index 00000000..2cdd56bc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_mysql_init.inc
@@ -0,0 +1,3 @@
+--source sql_mode_init.inc
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1", wrapper "mysql"';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/strict_group_by_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/strict_group_by_deinit.inc
new file mode 100644
index 00000000..2b0f9cbb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/strict_group_by_deinit.inc
@@ -0,0 +1,18 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--connection child2_1
+set global sql_mode= @old_sql_mode;
+--connection master_1
+set session spider_sync_sql_mode= @old_spider_sync_sql_mode;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/strict_group_by_init.inc b/storage/spider/mysql-test/spider/bugfix/include/strict_group_by_init.inc
new file mode 100644
index 00000000..15c2a9ee
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/strict_group_by_init.inc
@@ -0,0 +1,60 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source strict_group_by_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--connection master_1
+set @old_spider_sync_sql_mode= @@spider_sync_sql_mode;
+set session spider_sync_sql_mode= FALSE;
+--connection child2_1
+set @old_sql_mode= @@sql_mode;
+set global sql_mode= 'ONLY_FULL_GROUP_BY';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc
new file mode 100644
index 00000000..e66247c8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_deinit.inc
@@ -0,0 +1,18 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--connection child2_1
+set global wait_timeout= @old_wait_timeout;
+--connection child2_2
+set global wait_timeout= @old_wait_timeout;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc
new file mode 100644
index 00000000..d56d7a20
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/wait_timeout_init.inc
@@ -0,0 +1,56 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source wait_timeout_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+--connection child2_1
+set @old_wait_timeout= @@wait_timeout;
+set global wait_timeout= 1;
+--connection child2_2
+set @old_wait_timeout= @@wait_timeout;
+set global wait_timeout= 1;
diff --git a/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc
new file mode 100644
index 00000000..df3d44c3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc
@@ -0,0 +1,24 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc
new file mode 100644
index 00000000..76b7582a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc
new file mode 100644
index 00000000..5c607bd1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/xa_cmd_init.inc
@@ -0,0 +1,24 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
diff --git a/storage/spider/mysql-test/spider/bugfix/my.cnf b/storage/spider/mysql-test/spider/bugfix/my.cnf
new file mode 100644
index 00000000..b7f76a63
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/my.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf b/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf
new file mode 100644
index 00000000..5f17295d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf
@@ -0,0 +1,44 @@
+[mysqld.1.1]
+log-bin= master-bin
+loose_handlersocket_port= 20000
+loose_handlersocket_port_wr= 20001
+loose_handlersocket_threads= 2
+loose_handlersocket_threads_wr= 1
+loose_handlersocket_support_merge_table= 0
+loose_handlersocket_direct_update_mode= 2
+loose_handlersocket_unlimited_boundary= 65536
+loose_handlersocket_bulk_insert= 0
+loose_handlersocket_bulk_insert_timeout= 0
+loose_handlersocket_general_log= 1
+loose_handlersocket_timeout= 30
+loose_handlersocket_close_table_interval=2
+open_files_limit= 4096
+loose_partition= 1
+
+[ENV]
+USE_GEOMETRY_TEST= 1
+USE_FULLTEXT_TEST= 1
+USE_HA_TEST= 1
+USE_GENERAL_LOG= 1
+USE_REPLICATION= 1
+MASTER_1_MYPORT= @mysqld.1.1.port
+MASTER_1_HSRPORT= 20000
+MASTER_1_HSWPORT= 20001
+MASTER_1_MYSOCK= @mysqld.1.1.socket
+MASTER_1_ENGINE_TYPE= Spider
+#MASTER_1_ENGINE_TYPE= MyISAM
+MASTER_1_ENGINE= ENGINE=Spider
+MASTER_1_CHARSET= DEFAULT CHARSET=utf8
+MASTER_1_ENGINE2= ENGINE=MyISAM
+MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
+MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+
+STR_SEMICOLON= ;
+
+#The followings are set in include/init_xxx.inc files
+# MASTER_1_COMMENT_2_1
+# MASTER_1_COMMENT2_2_1
+# MASTER_1_COMMENT3_2_1
+# MASTER_1_COMMENT4_2_1
+# MASTER_1_COMMENT5_2_1
+# MASTER_1_COMMENT_P_2_1
diff --git a/storage/spider/mysql-test/spider/bugfix/my_2_1.cnf b/storage/spider/mysql-test/spider/bugfix/my_2_1.cnf
new file mode 100644
index 00000000..24161645
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/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/bugfix/my_2_2.cnf b/storage/spider/mysql-test/spider/bugfix/my_2_2.cnf
new file mode 100644
index 00000000..2d3c2a89
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/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/bugfix/my_2_3.cnf b/storage/spider/mysql-test/spider/bugfix/my_2_3.cnf
new file mode 100644
index 00000000..024da651
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/my_2_3.cnf
@@ -0,0 +1,8 @@
+[mysqld.2.3]
+
+[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/bugfix/my_3_1.cnf b/storage/spider/mysql-test/spider/bugfix/my_3_1.cnf
new file mode 100644
index 00000000..fad21607
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/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/bugfix/my_3_2.cnf b/storage/spider/mysql-test/spider/bugfix/my_3_2.cnf
new file mode 100644
index 00000000..6f027b6f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/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/bugfix/my_3_3.cnf b/storage/spider/mysql-test/spider/bugfix/my_3_3.cnf
new file mode 100644
index 00000000..fbb33694
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/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/bugfix/my_4_1.cnf b/storage/spider/mysql-test/spider/bugfix/my_4_1.cnf
new file mode 100644
index 00000000..d1812a48
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/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/bugfix/r/checksum_table_with_quick_mode_3.result b/storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result
new file mode 100644
index 00000000..bd423d93
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/checksum_table_with_quick_mode_3.result
@@ -0,0 +1,100 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+
+this test is for MDEV-16279
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+FLUSH TABLES;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CHECKSUM TABLE tbl_a EXTENDED;
+Table Checksum
+auto_test_local.tbl_a 1061386331
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %';
+argument
+checksum table `auto_test_remote`.`tbl_a` extended
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%checksum %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/cp932_column.result b/storage/spider/mysql-test/spider/bugfix/r/cp932_column.result
new file mode 100644
index 00000000..30b333c5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/cp932_column.result
@@ -0,0 +1,84 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18992
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+txt_utf8 char(8) NOT NULL,
+txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'',''),(1,'',''),(2,'',''),(3,'',''),(4,'',''),(5,'',''),(6,'',''),(7,'',''),(8,'',''),(9,'','');
+FLUSH TABLES;
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SET NAMES cp932;
+INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (10,'','’†‘');
+INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'','') ON DUPLICATE KEY UPDATE txt_cp932 = '’†‘';
+UPDATE tbl_a SET txt_cp932 = '’†‘' WHERE pkey = 2;
+SET NAMES utf8;
+connection child2_1;
+SET NAMES cp932;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%update %';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`txt_utf8`,`txt_cp932`)values(10,'',_cp932'\\x92\\x86\\x8D\\x91')
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`txt_utf8`,`txt_cp932`)values(0,'',_cp932'') on duplicate key update `txt_cp932` = _cp932'\x92\x86\x8D\x91'
+update `auto_test_remote`.`tbl_a` set `txt_cp932` = _cp932'\x92\x86\x8D\x91' where (`pkey` = 2)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%update %'
+SELECT pkey, txt_utf8, txt_cp932 FROM tbl_a ORDER BY pkey;
+pkey txt_utf8 txt_cp932
+0 ’†‘
+1
+2 ’†‘
+3
+4
+5
+6
+7
+8
+9
+10 ’†‘
+SET NAMES utf8;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result
new file mode 100644
index 00000000..d9fb00a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result
@@ -0,0 +1,85 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+for slave1_1
+connection slave1_1;
+connection master_1;
+set @old_binlog_format= @@binlog_format;
+set session binlog_format= 'ROW';
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+connection slave1_1;
+connection master_1;
+SET SESSION sql_log_bin= 0;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+f float DEFAULT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SET SESSION sql_log_bin= 1;
+connection slave1_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+f float DEFAULT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+connection master_1;
+INSERT INTO tbl_a (pkey, f) VALUES (0,NULL);
+INSERT INTO tbl_a (pkey, f) VALUES (1,0.671437);
+DELETE FROM tbl_a WHERE pkey = 0;
+DELETE FROM tbl_a WHERE pkey = 1;
+connection slave1_1;
+connection master_1;
+SET SESSION sql_log_bin= 0;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %';
+argument
+delete from `auto_test_remote`.`tbl_a` where `pkey` = 0 and `f` is null limit 1
+delete from `auto_test_remote`.`tbl_a` where `pkey` = 1 and `f` = cast(0.671437 as float) limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'
+SELECT pkey, f FROM tbl_a ORDER BY pkey;
+pkey f
+connection slave1_1;
+SELECT pkey, f FROM tbl_a ORDER BY pkey;
+pkey f
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session binlog_format= @old_binlog_format;
+connection slave1_1;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result
new file mode 100644
index 00000000..9b11de7c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result
@@ -0,0 +1,85 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+for slave1_1
+connection slave1_1;
+connection master_1;
+set @old_binlog_format= @@binlog_format;
+set session binlog_format= 'ROW';
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+connection slave1_1;
+connection master_1;
+SET SESSION sql_log_bin= 0;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+f float DEFAULT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SET SESSION sql_log_bin= 1;
+connection slave1_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+f float DEFAULT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+connection master_1;
+INSERT INTO tbl_a (pkey, f) VALUES (0,NULL);
+INSERT INTO tbl_a (pkey, f) VALUES (1,0.671437);
+DELETE FROM tbl_a WHERE pkey = 0;
+DELETE FROM tbl_a WHERE pkey = 1;
+connection slave1_1;
+connection master_1;
+SET SESSION sql_log_bin= 0;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %';
+argument
+delete from `auto_test_remote`.`tbl_a` where `pkey` = 0 and `f` is null limit 1
+delete from `auto_test_remote`.`tbl_a` where `pkey` = 1 and `f` = /* create function to_float(a decimal(20,6)) returns float return a */ to_float(0.671437) limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'
+SELECT pkey, f FROM tbl_a ORDER BY pkey;
+pkey f
+connection slave1_1;
+SELECT pkey, f FROM tbl_a ORDER BY pkey;
+pkey f
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session binlog_format= @old_binlog_format;
+connection slave1_1;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result b/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result
new file mode 100644
index 00000000..b485d645
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_comma_pwd.result
@@ -0,0 +1,37 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+GRANT ALL ON *.* TO tu@'%' IDENTIFIED BY 'pass,1234';
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TEMPORARY TABLE tmp_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2
+SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"');
+spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test", password "pass,1234", user "tu"')
+1
+SELECT pkey FROM tmp_a;
+pkey
+22
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP USER tu@'%';
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_tmp_table.result b/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_tmp_table.result
new file mode 100644
index 00000000..65beb8a4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/direct_sql_with_tmp_table.result
@@ -0,0 +1,33 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TEMPORARY TABLE tmp_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2
+SELECT spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"');
+spider_direct_sql('SELECT 22', 'tmp_a', 'srv "s_2_1", database "test"')
+1
+SELECT pkey FROM tmp_a;
+pkey
+22
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result b/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result
new file mode 100644
index 00000000..8a2bcb73
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result
@@ -0,0 +1,117 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-16520
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+skey int NOT NULL,
+PRIMARY KEY (pkey),
+KEY idx1 (skey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19);
+INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
+skey cnt
+14 2
+13 2
+12 2
+11 2
+10 2
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select count(0),`skey` from `auto_test_remote`.`tbl_a` group by `skey` order by `skey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+pkey skey
+1 1
+3 3
+5 5
+7 7
+9 9
+11 11
+13 13
+15 15
+17 17
+19 19
+21 6
+23 8
+25 10
+27 12
+29 14
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select count(0),`skey` from `auto_test_remote2`.`tbl_a` group by `skey` order by `skey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+pkey skey
+0 0
+2 2
+4 4
+6 6
+8 8
+10 10
+12 12
+14 14
+16 16
+18 18
+20 5
+22 7
+24 9
+26 11
+28 13
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/insert_select.result b/storage/spider/mysql-test/spider/bugfix/r/insert_select.result
new file mode 100644
index 00000000..0783995e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/insert_select.result
@@ -0,0 +1,102 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-16399
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES2
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+skey int NOT NULL,
+dt date NOT NULL,
+tm time NOT NULL,
+KEY idx1 (skey,dt,tm)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+dt datetime NOT NULL,
+PRIMARY KEY (pkey),
+KEY idx1 (dt)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-11-01', '11:00:00'),(1, '2012-12-01', '11:00:00'),(2, '2012-11-30', '11:00:00'),(3, '2012-11-29', '11:00:00'),(4, '2012-11-28', '11:00:00'),(5, '2012-11-27', '11:00:00'),(6, '2012-11-26', '11:00:00'),(7, '2012-11-25', '11:00:00'),(8, '2012-11-24', '11:00:00'),(9, '2012-11-23', '11:00:00');
+FLUSH TABLES;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 4 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 3 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 2 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 1 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 0 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 9 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 8 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 7 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 6 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 5 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 4) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 3) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 2) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 1) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 0) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 9) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 8) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 7) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 6) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+select t0.`skey` `skey`,cast((concat(t0.`dt` , _latin1' ' , t0.`tm`)) as datetime) `CAST(CONCAT(dt, ' ', tm) AS datetime)` from `auto_test_remote`.`tbl_a` t0 where ((t0.`skey` = 5) and (t0.`dt` > _latin1'2012-11-21')) lock in share mode
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, dt FROM tbl_b ORDER BY pkey;
+pkey dt
+0 2013-01-01 13:00:00
+1 2012-12-01 11:00:00
+2 2012-11-30 11:00:00
+3 2012-11-29 11:00:00
+4 2012-11-28 11:00:00
+5 2012-11-27 11:00:00
+6 2012-11-26 11:00:00
+7 2012-11-25 11:00:00
+8 2012-11-24 11:00:00
+9 2012-11-23 11:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result
new file mode 100644
index 00000000..5d483481
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result
@@ -0,0 +1,111 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-19866
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val char(1) NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (1,'1'),(2,'2'),(3,'3'),(4,'4');
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a;
+pkey val
+1 1
+3 3
+2 2
+4 4
+SELECT * FROM tbl_a WHERE pkey = 1;
+pkey val
+1 1
+SELECT * FROM tbl_a;
+pkey val
+1 1
+3 3
+2 2
+4 4
+SELECT * FROM tbl_a WHERE pkey = 2;
+pkey val
+2 2
+SELECT * FROM tbl_a;
+pkey val
+1 1
+3 3
+2 2
+4 4
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey`,`val` from `auto_test_remote`.`tbl_a`
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1
+select `pkey`,`val` from `auto_test_remote`.`tbl_a`
+select `pkey`,`val` from `auto_test_remote`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a`
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a`
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+2 2
+4 4
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result
new file mode 100644
index 00000000..9d2297b4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_20100.result
@@ -0,0 +1,119 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-20100
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) ENGINE=Spider PARTITION BY RANGE(a) (
+PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"',
+PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"',
+PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"'
+ )
+INSERT INTO tbl_a (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');
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a, b, c FROM tbl_a PARTITION (pt2) WHERE b = 'c';
+a b c
+5 c 2001-12-31 23:59:59
+SELECT a, b, c FROM tbl_a PARTITION (pt1,pt2);
+a b c
+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, c FROM tbl_a PARTITION (pt3) WHERE b = 'c';
+a b c
+SELECT a, b, c FROM tbl_a PARTITION (pt1,pt2);
+a b c
+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, c FROM tbl_a PARTITION (pt1) WHERE b = 'c';
+a b c
+SELECT a, b, c FROM tbl_a PARTITION (pt1,pt3);
+a b c
+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
+SELECT a, b, c FROM tbl_a PARTITION (pt1) WHERE b = 'c';
+a b c
+SELECT a, b, c FROM tbl_a PARTITION (pt2,pt3);
+a b c
+5 c 2001-12-31 23:59:59
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r3` t0 where (t0.`b` = 'c')
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r2`
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r3`
+select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r4` t0 where (t0.`b` = 'c')
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r2`
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r3`
+select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r2` t0 where (t0.`b` = 'c')
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r2`
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r4`
+select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r2` t0 where (t0.`b` = 'c')
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r3`
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r4`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, c FROM ta_r2 ORDER BY a ;
+SELECT a, b, c FROM ta_r3 ORDER BY a ;
+SELECT a, b, c FROM ta_r4 ORDER BY a;
+a b c
+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
+a b c
+5 c 2001-12-31 23:59:59
+a b c
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result
new file mode 100644
index 00000000..e5f16b81
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result
@@ -0,0 +1,85 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-20502
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+id int(10) unsigned NOT NULL AUTO_INCREMENT,
+val int(10) unsigned DEFAULT NULL,
+PRIMARY KEY(id)
+) ENGINE=Spider COMMENT='table "tbl_a", srv "s_2_1"'
+INSERT INTO tbl_a (val) VALUES (1);
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT id, 0 AS const, val FROM tbl_a;
+id const val
+1 0 1
+SELECT 1+2, id, 0 AS const, val, val+10, (SELECT tbl_a.val+1 FROM tbl_a) AS sq
+FROM tbl_a;
+1+2 id const val val+10 sq
+3 1 0 1 11 2
+INSERT INTO tbl_a (val) VALUES (2), (1);
+SELECT val+10, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
+FROM tbl_a GROUP BY val;
+val+10 const val sq
+11 0 1 2
+12 0 2 2
+SELECT MAX(id) AS m, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
+FROM tbl_a GROUP BY val;
+m const val sq
+3 0 1 2
+2 0 2 2
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`id` `id`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0
+select t0.`id` `id`,t0.`val` `val`,(t0.`val` + 10) `val+10` from `auto_test_remote`.`tbl_a` t0
+select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0
+select `id`,`val` from `auto_test_remote`.`tbl_a` order by `id` desc limit 1 for update
+select (t0.`val` + 10) `val+10`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 group by t0.`val` order by t0.`val`
+select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 limit 1
+select max(t0.`id`) `m`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 group by t0.`val` order by t0.`val`
+select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT id, val FROM tbl_a ORDER BY id;
+id val
+1 1
+2 2
+3 1
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result
new file mode 100644
index 00000000..d5ba9b1e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_21884.result
@@ -0,0 +1,104 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_bgs_mode= @@spider_bgs_mode;
+set session spider_bgs_mode= 2;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+
+this test is for MDEV-21884
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a,b)
+) ENGINE=Spider COMMENT='table "ta_r3"'
+ PARTITION BY RANGE(a) (
+PARTITION pt1 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r2",
+ priority "1000"',
+PARTITION pt2 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", priority "1000001"'
+ )
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tbl_a (a, b, c) VALUES
+(11, 'a', '2008-08-01 10:21:39'),
+(11, 'b', '2000-01-01 00:00:00'),
+(12, 'e', '2007-06-04 20:03:11'),
+(12, 'd', '2003-11-30 05:01:03'),
+(13, 'c', '2001-12-31 23:59:59');
+INSERT INTO tb_l (a, b, c) VALUES
+(11, 'a', '2008-08-01 10:21:39'),
+(12, 'b', '2000-01-01 00:00:00'),
+(13, 'e', '2007-06-04 20:03:11'),
+(14, 'd', '2003-11-30 05:01:03'),
+(15, 'c', '2001-12-31 23:59:59');
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT STRAIGHT_JOIN b.a, b.b FROM tb_l a, tbl_a b WHERE a.a = b.a;
+a b
+11 a
+11 b
+12 d
+12 e
+13 c
+connection child2_1;
+SET NAMES utf8;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `a`,`b` from `auto_test_remote`.`ta_r2` order by `a`,`b`
+select `a`,`b` from `auto_test_remote`.`ta_r3` order by `a`,`b`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, c FROM ta_r2 ORDER BY a ;
+SELECT a, b, c FROM ta_r3 ORDER BY a;
+a b c
+a b c
+11 a 2008-08-01 10:21:39
+11 b 2000-01-01 00:00:00
+12 d 2003-11-30 05:01:03
+12 e 2007-06-04 20:03:11
+13 c 2001-12-31 23:59:59
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_bgs_mode= @old_spider_bgs_mode;
+set session spider_quick_mode= @old_spider_quick_mode;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result
new file mode 100644
index 00000000..0254d8bf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_22246.result
@@ -0,0 +1,79 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-22246
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+id bigint NOT NULL,
+node text,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (id,node) VALUES (1,'DB-G0'),(2,'DB-G1');
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a;
+id node
+2 DB-G1
+1 DB-G0
+SELECT * FROM tbl_a WHERE id <0 || id >0;
+id node
+1 DB-G0
+2 DB-G1
+connection child2_1;
+SELECT * FROM tbl_a ORDER BY id;
+id node
+2 DB-G1
+connection child2_2;
+SELECT * FROM tbl_a ORDER BY id;
+id node
+1 DB-G0
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_22265.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_22265.result
new file mode 100644
index 00000000..0331943a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_22265.result
@@ -0,0 +1,23 @@
+for master_1
+for child2
+for child3
+
+this test is for MDEV-22265
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+create table
+connection master_1;
+create table t2345678911234567892123456789312345678941234567895123(id int) ENGINE=SPIDER DEFAULT CHARSET=latin1 COMMENT='host "h114", user "spider", password "spider", port "3306", database "test32738"';
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result
new file mode 100644
index 00000000..164c68fb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result
@@ -0,0 +1,97 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-24020
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(30),
+PRIMARY KEY(a)
+) ENGINE=Spider PARTITION BY LIST(a % 3) (
+PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"',
+PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"',
+PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"'
+ )
+INSERT INTO tbl_a VALUES(10000, " abcd ");
+INSERT INTO tbl_a VALUES(10001, " abcd ");
+INSERT INTO tbl_a VALUES(10002, " abcd ");
+INSERT INTO tbl_a VALUES(10003, "[[[abcd][[");
+INSERT INTO tbl_a VALUES(10004, "[[[abcd][[");
+INSERT INTO tbl_a VALUES(10005, "[[[abcd][[");
+INSERT INTO tbl_a VALUES(10006, "[[[abcd]]");
+INSERT INTO tbl_a VALUES(10007, "[[[abcd]]");
+INSERT INTO tbl_a VALUES(10008, "[[[abcd]]");
+INSERT INTO tbl_a VALUES(10009, "[[[**abcd****]]");
+
+test 1
+connection master_1;
+UPDATE tbl_a SET b = trim(b) WHERE a = 10000;
+SELECT * FROM tbl_a WHERE a = 10000;
+a b
+10000 abcd
+UPDATE tbl_a SET b = ltrim(b) WHERE a = 10001;
+SELECT * FROM tbl_a WHERE a = 10001;
+a b
+10001 abcd
+UPDATE tbl_a SET b = rtrim(b) WHERE a = 10002;
+SELECT * FROM tbl_a WHERE a = 10002;
+a b
+10002 abcd
+UPDATE tbl_a SET b = trim(BOTH '[' FROM b) WHERE a = 10003;
+SELECT * FROM tbl_a WHERE a = 10003;
+a b
+10003 abcd]
+UPDATE tbl_a SET b = trim(LEADING '[' FROM b) WHERE a = 10004;
+SELECT * FROM tbl_a WHERE a = 10004;
+a b
+10004 abcd][[
+UPDATE tbl_a SET b = trim(TRAILING '[' FROM b) WHERE a = 10005;
+SELECT * FROM tbl_a WHERE a = 10005;
+a b
+10005 [[[abcd]
+UPDATE tbl_a SET b = trim(LEADING '[' FROM trim(TRAILING ']' FROM b)) WHERE a = 10006;
+SELECT * FROM tbl_a WHERE a = 10006;
+a b
+10006 abcd
+UPDATE tbl_a SET b = trim(TRAILING '[' FROM trim(LEADING ']' FROM b)) WHERE a = 10007;
+SELECT * FROM tbl_a WHERE a = 10007;
+a b
+10007 [[[abcd]]
+UPDATE tbl_a SET b = trim(TRAILING ']' FROM trim(LEADING '[' FROM b)) WHERE a = 10008;
+SELECT * FROM tbl_a WHERE a = 10008;
+a b
+10008 abcd
+UPDATE tbl_a SET b = trim(BOTH '*' FROM trim(TRAILING ']' FROM trim(LEADING '[' FROM b))) WHERE a = 10009;
+SELECT * FROM tbl_a WHERE a = 10009;
+a b
+10009 abcd
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result
new file mode 100644
index 00000000..f084c967
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result
@@ -0,0 +1,78 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-24517
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+i INT,
+j JSON,
+PRIMARY KEY(i)
+) ENGINE=Spider PARTITION BY RANGE(i) (
+PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"',
+PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"',
+PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"'
+ )
+INSERT INTO tbl_a (i, j) VALUES
+(1, '{"ID": "3", "Name": "Barney", "Age": 18}'),
+(2, '{"ID": "4", "Name": "Betty", "Age": 19}'),
+(3, '{"ID": "2", "Name": "Wilma", "Age": 20}'),
+(4, '[10, 20, [30, 40]]');
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Age')=19;
+i j
+2 {"ID": "4", "Name": "Betty", "Age": 19}
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Name')="Betty";
+i j
+2 {"ID": "4", "Name": "Betty", "Age": 19}
+SELECT i, JSON_EXTRACT(j, "$.ID")
+FROM tbl_a
+WHERE JSON_EXTRACT(j, "$.ID") > 1 AND i < 4
+ORDER BY JSON_EXTRACT(j, "$.Name");
+i JSON_EXTRACT(j, "$.ID")
+1 "3"
+2 "4"
+3 "2"
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[1]') = 20;
+i j
+4 [10, 20, [30, 40]]
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[2][0]') = 30;
+i j
+4 [10, 20, [30, 40]]
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result
new file mode 100644
index 00000000..08481cd1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result
@@ -0,0 +1,49 @@
+#
+# MDEV-24760 SELECT..CASE statement syntax error at Spider Engine table
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+DROP TABLE IF EXISTS tbl_a;
+Warnings:
+Note 1051 Unknown table 'auto_test_remote.tbl_a'
+CREATE TABLE tbl_a (
+id int NOT NULL AUTO_INCREMENT,
+name varchar(255) DEFAULT NULL,
+PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO tbl_a (name) VALUES ('Alice'), ('Bob');
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+id int NOT NULL AUTO_INCREMENT,
+name varchar(255) DEFAULT NULL,
+PRIMARY KEY (id)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"'
+PARTITION BY HASH(id) (
+PARTITION pt1 COMMENT='srv "s_2_1"'
+);
+SELECT id, CASE WHEN name='Alice' THEN "A" WHEN name='Bob' THEN "B" END FROM tbl_a;
+id CASE WHEN name='Alice' THEN "A" WHEN name='Bob' THEN "B" END
+1 A
+2 B
+SELECT id, CASE name WHEN 'Alice' THEN "A" WHEN 'Bob' THEN "B" END FROM tbl_a;
+id CASE name WHEN 'Alice' THEN "A" WHEN 'Bob' THEN "B" END
+1 A
+2 B
+DROP DATABASE auto_test_local;
+connection child2_1;
+DROP DATABASE auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26013.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26013.result
new file mode 100644
index 00000000..3af1f7df
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26013.result
@@ -0,0 +1,42 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+MDEV-26013 distinct not work properly in some cases for spider tables
+
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+`a`int,
+`b`int,
+PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+insert into `tbl_a` VALUES (1,999), (2,999);
+connection master_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+`a`int,
+`b`int,
+PRIMARY KEY (`a`)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS(`a`) (
+PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+connection master_1;
+SELECT distinct b FROM tbl_a WHERE b=999;
+b
+999
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/quick_mode_0.result b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_0.result
new file mode 100644
index 00000000..6e5a0052
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_0.result
@@ -0,0 +1,504 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 0;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+this test is for MDEV-16520
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/quick_mode_1.result b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_1.result
new file mode 100644
index 00000000..bca6d172
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_1.result
@@ -0,0 +1,504 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 1;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+this test is for MDEV-16520
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/quick_mode_2.result b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_2.result
new file mode 100644
index 00000000..61a7764d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_2.result
@@ -0,0 +1,504 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 2;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+this test is for MDEV-16520
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/quick_mode_3.result b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_3.result
new file mode 100644
index 00000000..38387a45
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/quick_mode_3.result
@@ -0,0 +1,504 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_quick_mode= @@spider_quick_mode;
+set session spider_quick_mode= 3;
+set @old_spider_quick_page_size= @@spider_quick_page_size;
+set session spider_quick_page_size= 3;
+set @old_spider_quick_page_byte= @@spider_quick_page_byte;
+
+this test is for MDEV-16520
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 6;
+
+select test 2
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection master_1;
+set session spider_quick_page_byte= 0;
+
+select test 3
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 0
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 1
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 2
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 3
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 4
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 5
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 6
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 7
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 8
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 9
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 10
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 11
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 12
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 13
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 14
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 15
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 16
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 17
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 18
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 19
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 20
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 21
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 22
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 23
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 24
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 25
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 26
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 27
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 28
+select `pkey` from `auto_test_remote2`.`tbl_b` where `pkey` = 29
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_quick_mode= @old_spider_quick_mode;
+set session spider_quick_page_size= @old_spider_quick_page_size;
+set session spider_quick_page_byte= @old_spider_quick_page_byte;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result
new file mode 100644
index 00000000..2ddec02e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_insert.result
@@ -0,0 +1,179 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-18973
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+skey int NOT NULL,
+dt date NOT NULL,
+tm time NOT NULL,
+PRIMARY KEY (skey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00');
+FLUSH TABLES;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')" auto_test_local
+--------------
+set session spider_direct_dup_insert=1
+--------------
+
+Query OK, 0 rows affected
+
+--------------
+INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')
+--------------
+
+Query OK, 5 rows affected
+Records: 10 Duplicates: 5 Warnings: 0
+
+Bye
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %';
+argument
+insert ignore into `auto_test_remote`.`tbl_a`(`skey`,`dt`,`tm`)values(0,_latin1'2013-01-01',_latin1'13:00:00'),(2,_latin1'2013-02-01',_latin1'13:00:00'),(4,_latin1'2013-03-01',_latin1'13:00:00'),(7,_latin1'2013-04-01',_latin1'13:00:00'),(8,_latin1'2013-05-01',_latin1'13:00:00'),(10,_latin1'2013-06-01',_latin1'13:00:00'),(11,_latin1'2013-07-01',_latin1'13:00:00'),(12,_latin1'2013-08-01',_latin1'13:00:00'),(13,_latin1'2013-09-01',_latin1'13:00:00'),(14,_latin1'2013-10-01',_latin1'13:00:00')
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'
+SELECT skey, dt, tm FROM tbl_a ORDER BY skey;
+skey dt tm
+0 2012-01-01 12:00:00
+1 2012-02-01 12:00:00
+2 2012-03-01 12:00:00
+3 2012-04-01 12:00:00
+4 2012-05-01 12:00:00
+5 2012-06-01 12:00:00
+6 2012-07-01 12:00:00
+7 2012-08-01 12:00:00
+8 2012-09-01 12:00:00
+9 2012-10-01 12:00:00
+10 2013-06-01 13:00:00
+11 2013-07-01 13:00:00
+12 2013-08-01 13:00:00
+13 2013-09-01 13:00:00
+14 2013-10-01 13:00:00
+TRUNCATE TABLE mysql.general_log;
+MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')" auto_test_local
+--------------
+set session spider_direct_dup_insert=1
+--------------
+
+Query OK, 0 rows affected
+
+--------------
+REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')
+--------------
+
+Query OK, 14 rows affected
+Records: 10 Duplicates: 4 Warnings: 0
+
+Bye
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %';
+argument
+replace into `auto_test_remote`.`tbl_a`(`skey`,`dt`,`tm`)values(1,_latin1'2012-02-01',_latin1'12:00:00'),(3,_latin1'2012-12-01',_latin1'11:00:00'),(8,_latin1'2012-11-30',_latin1'11:00:00'),(9,_latin1'2012-11-29',_latin1'11:00:00'),(10,_latin1'2012-11-28',_latin1'11:00:00'),(15,_latin1'2012-11-27',_latin1'11:00:00'),(16,_latin1'2012-11-26',_latin1'11:00:00'),(17,_latin1'2012-11-25',_latin1'11:00:00'),(18,_latin1'2012-11-24',_latin1'11:00:00'),(19,_latin1'2012-11-23',_latin1'11:00:00')
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'
+SELECT skey, dt, tm FROM tbl_a ORDER BY skey;
+skey dt tm
+0 2012-01-01 12:00:00
+1 2012-02-01 12:00:00
+2 2012-03-01 12:00:00
+3 2012-12-01 11:00:00
+4 2012-05-01 12:00:00
+5 2012-06-01 12:00:00
+6 2012-07-01 12:00:00
+7 2012-08-01 12:00:00
+8 2012-11-30 11:00:00
+9 2012-11-29 11:00:00
+10 2012-11-28 11:00:00
+11 2013-07-01 13:00:00
+12 2013-08-01 13:00:00
+13 2013-09-01 13:00:00
+14 2013-10-01 13:00:00
+15 2012-11-27 11:00:00
+16 2012-11-26 11:00:00
+17 2012-11-25 11:00:00
+18 2012-11-24 11:00:00
+19 2012-11-23 11:00:00
+TRUNCATE TABLE mysql.general_log;
+MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)" auto_test_local
+--------------
+set session spider_direct_dup_insert=1
+--------------
+
+Query OK, 0 rows affected
+
+--------------
+INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)
+--------------
+
+Query OK, 13 rows affected
+Records: 10 Duplicates: 4 Warnings: 0
+
+Bye
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`skey`,`dt`,`tm`)values(1,_latin1'2012-11-01',_latin1'11:00:00'),(3,_latin1'2012-12-01',_latin1'11:00:00'),(11,_latin1'2012-11-30',_latin1'11:00:00'),(15,_latin1'2012-11-29',_latin1'11:00:00'),(16,_latin1'2012-11-28',_latin1'11:00:00'),(20,_latin1'2012-11-27',_latin1'11:00:00'),(21,_latin1'2012-11-26',_latin1'11:00:00'),(22,_latin1'2012-11-25',_latin1'11:00:00'),(23,_latin1'2012-11-24',_latin1'11:00:00'),(24,_latin1'2012-11-23',_latin1'11:00:00') on duplicate key update `dt` = values(`dt`),`tm` = values(`tm`)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %' OR argument LIKE '%replace %'
+SELECT skey, dt, tm FROM tbl_a ORDER BY skey;
+skey dt tm
+0 2012-01-01 12:00:00
+1 2012-11-01 11:00:00
+2 2012-03-01 12:00:00
+3 2012-12-01 11:00:00
+4 2012-05-01 12:00:00
+5 2012-06-01 12:00:00
+6 2012-07-01 12:00:00
+7 2012-08-01 12:00:00
+8 2012-11-30 11:00:00
+9 2012-11-29 11:00:00
+10 2012-11-28 11:00:00
+11 2012-11-30 11:00:00
+12 2013-08-01 13:00:00
+13 2013-09-01 13:00:00
+14 2013-10-01 13:00:00
+15 2012-11-29 11:00:00
+16 2012-11-28 11:00:00
+17 2012-11-25 11:00:00
+18 2012-11-24 11:00:00
+19 2012-11-23 11:00:00
+20 2012-11-27 11:00:00
+21 2012-11-26 11:00:00
+22 2012-11-25 11:00:00
+23 2012-11-24 11:00:00
+24 2012-11-23 11:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result
new file mode 100644
index 00000000..cd5423ed
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/return_found_rows_update.result
@@ -0,0 +1,99 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-18973
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+skey int NOT NULL,
+dt date NOT NULL,
+tm time NOT NULL,
+KEY idx1 (skey,dt)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-11-01', '11:00:00'),(1, '2012-12-01', '11:00:00'),(2, '2012-11-30', '11:00:00'),(3, '2012-11-29', '11:00:00'),(4, '2012-11-28', '11:00:00'),(5, '2012-11-27', '11:00:00'),(6, '2012-11-26', '11:00:00'),(7, '2012-11-25', '11:00:00'),(8, '2012-11-24', '11:00:00'),(9, '2012-11-23', '11:00:00');
+FLUSH TABLES;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0" auto_test_local
+--------------
+UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0
+--------------
+
+Query OK, 2 rows affected
+Rows matched: 3 Changed: 2 Warnings: 0
+
+Bye
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %';
+argument
+update `auto_test_remote`.`tbl_a` set `tm` = _latin1'12:00:00' where (`skey` = 0)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'
+SELECT skey, dt, tm FROM tbl_a ORDER BY skey;
+skey dt tm
+0 2012-01-01 12:00:00
+0 2013-01-01 12:00:00
+0 2012-11-01 12:00:00
+1 2012-12-01 11:00:00
+1 2013-02-01 13:00:00
+1 2012-02-01 12:00:00
+2 2013-03-01 13:00:00
+2 2012-11-30 11:00:00
+2 2012-03-01 12:00:00
+3 2012-11-29 11:00:00
+3 2013-04-01 13:00:00
+3 2012-04-01 12:00:00
+4 2012-11-28 11:00:00
+4 2012-05-01 12:00:00
+4 2013-05-01 13:00:00
+5 2012-11-27 11:00:00
+5 2012-06-01 12:00:00
+5 2013-06-01 13:00:00
+6 2013-07-01 13:00:00
+6 2012-11-26 11:00:00
+6 2012-07-01 12:00:00
+7 2012-11-25 11:00:00
+7 2012-08-01 12:00:00
+7 2013-08-01 13:00:00
+8 2012-09-01 12:00:00
+8 2013-09-01 13:00:00
+8 2012-11-24 11:00:00
+9 2012-10-01 12:00:00
+9 2013-10-01 13:00:00
+9 2012-11-23 11:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/same_server_link.result b/storage/spider/mysql-test/spider/bugfix/r/same_server_link.result
new file mode 100644
index 00000000..1f417756
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/same_server_link.result
@@ -0,0 +1,42 @@
+for master_1
+for child2
+for child3
+connection master_1;
+set @old_global_spider_same_server_link= @@global.spider_same_server_link;
+set @old_session_spider_same_server_link= @@session.spider_same_server_link;
+set global spider_same_server_link= 0;
+set session spider_same_server_link= 0;
+
+this test is for MDEV-6268
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+create table
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+
+select test 1
+connection master_1;
+INSERT INTO tbl_a VALUES(1);
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection master_1;
+set global spider_same_server_link= @old_global_spider_same_server_link;
+set session spider_same_server_link= @old_session_spider_same_server_link;
+for master_1
+for child2
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/select_by_null.result b/storage/spider/mysql-test/spider/bugfix/r/select_by_null.result
new file mode 100644
index 00000000..a7fa1b3b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/select_by_null.result
@@ -0,0 +1,90 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-16279
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+FLUSH TABLES;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT pkey FROM tbl_a WHERE NULL;
+pkey
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result
new file mode 100644
index 00000000..52f8c98b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-17204
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+txt_utf8 char(8) NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456');
+FLUSH TABLES;
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SET NAMES utf8;
+SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(`txt_utf8`, 4) LIMIT 3;
+pkey LEFT(`txt_utf8`, 4)
+0 0123
+1 1234
+2 2345
+connection child2_1;
+SET NAMES utf8;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`pkey` `pkey`,(left(t0.`txt_utf8` , 4)) `LEFT(``txt_utf8``, 4)` from `auto_test_remote`.`tbl_a` t0 order by `LEFT(``txt_utf8``, 4)` limit 3
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey;
+pkey txt_utf8
+0 01234567
+1 12345678
+2 23456789
+3 34567890
+4 45678901
+5 56789012
+6 67890123
+7 78901234
+8 89012345
+9 90123456
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/self_reference.result b/storage/spider/mysql-test/spider/bugfix/r/self_reference.result
new file mode 100644
index 00000000..1ce9c60a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/self_reference.result
@@ -0,0 +1,36 @@
+for master_1
+for child2
+for child3
+connection master_1;
+set @old_spider_same_server_link= @@spider_same_server_link;
+set spider_same_server_link= ON;
+
+this test is for MDEV-6268
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+create table
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+
+select test 1
+connection master_1;
+SELECT pkey FROM tbl_a;
+ERROR HY000: An infinite loop is detected when opening table auto_test_local.tbl_a
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection master_1;
+set spider_same_server_link= @old_spider_same_server_link;
+for master_1
+for child2
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result b/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result
new file mode 100644
index 00000000..f2cab6b0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result
@@ -0,0 +1,22 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+for slave1_1
+
+connection slave1_1;
+SHOW VARIABLES LIKE 'slave_transaction_retry_errors';
+Variable_name Value
+slave_transaction_retry_errors 1158,1159,1160,1161,1205,1213,1429,2013,12701,10000,20000,30000
+connection slave1_1;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result
new file mode 100644
index 00000000..d50da8a7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result
@@ -0,0 +1,99 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+for slave1_1
+connection slave1_1;
+set @old_spider_slave_trx_isolation= @@spider_slave_trx_isolation;
+set global spider_slave_trx_isolation= 1;
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+connection slave1_1;
+connection master_1;
+SET SESSION sql_log_bin= 0;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SET SESSION sql_log_bin= 1;
+connection slave1_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+connection master_1;
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+connection slave1_1;
+connection master_1;
+SET SESSION sql_log_bin= 0;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %';
+argument
+set session time_zone = '+00:00';set @`spider_lc_./auto_test_remote/tbl_a` = '-xxxxxxxxxxxx-xxxxx-./auto_test_local/tbl_a-'
+SET NAMES utf8
+set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%set %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+connection slave1_1;
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection slave1_1;
+set global spider_slave_trx_isolation= @old_spider_slave_trx_isolation;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result b/storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result
new file mode 100644
index 00000000..f915cc95
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result
@@ -0,0 +1,38 @@
+for master_1
+for child2
+for child3
+connection master_1;
+alter table mysql.spider_table_sts drop column checksum;
+insert into mysql.spider_table_sts values ('auto_test_local', 'tbl_a', 0, 0, 0, 0, 0, '2019-01-01 00:00:00', '2019-01-01 00:00:00', '2019-01-01 00:00:00');
+
+this test is for MDEV-19842
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+create table
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+
+select test 1
+connection master_1;
+SELECT pkey FROM tbl_a;
+ERROR HY000: System table spider_table_sts is different version
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+ERROR HY000: System table spider_table_sts is different version
+connection master_1;
+alter table mysql.spider_table_sts add column checksum bigint unsigned default null after update_time;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result
new file mode 100644
index 00000000..1bf6fbcc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mariadb.result
@@ -0,0 +1,83 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_sql_mode= @@sql_mode;
+set session sql_mode= 'real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional';
+
+this test is for MDEV-16508
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%';
+argument
+set session transaction isolation level repeatable read;set session autocommit = 1;set session sql_log_off = 0;set session wait_timeout = 604800;set session sql_mode = 'real_as_float,ignore_bad_table_options,no_unsigned_subtraction,no_dir_in_create,no_auto_value_on_zero,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional';set session time_zone = '+00:00';set @`spider_lc_./auto_test_remote/tbl_a` = '-xxxxxxxxxxxx-xxxxx-./auto_test_local/tbl_a-';start transaction
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session sql_mode= @old_sql_mode;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result
new file mode 100644
index 00000000..3ec96a66
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/sql_mode_mysql.result
@@ -0,0 +1,83 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_sql_mode= @@sql_mode;
+set session sql_mode= 'real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional';
+
+this test is for MDEV-16508
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%';
+argument
+set session transaction isolation level repeatable read;set session autocommit = 1;set session sql_log_off = 0;set session wait_timeout = 604800;set session sql_mode = 'real_as_float,ignore_bad_table_options,no_unsigned_subtraction,no_dir_in_create,no_auto_value_on_zero,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length';set session time_zone = '+00:00';set @`spider_lc_./auto_test_remote/tbl_a` = '-xxxxxxxxxxxx-xxxxx-./auto_test_local/tbl_a-';start transaction
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%sql_mode%'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session sql_mode= @old_sql_mode;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/strict_group_by.result b/storage/spider/mysql-test/spider/bugfix/r/strict_group_by.result
new file mode 100644
index 00000000..f2287dea
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/strict_group_by.result
@@ -0,0 +1,124 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_sync_sql_mode= @@spider_sync_sql_mode;
+set session spider_sync_sql_mode= FALSE;
+connection child2_1;
+set @old_sql_mode= @@sql_mode;
+set global sql_mode= 'ONLY_FULL_GROUP_BY';
+
+this test is for MDEV-18988
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+skey int NOT NULL,
+PRIMARY KEY (pkey),
+KEY idx1 (skey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19);
+INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+FLUSH TABLES;
+SELECT count(pkey) cnt, skey FROM tbl_a;
+cnt skey
+30 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select count(`pkey`),min(`pkey`),min(`skey`) from `auto_test_remote`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+pkey skey
+1 1
+3 3
+5 5
+7 7
+9 9
+11 11
+13 13
+15 15
+17 17
+19 19
+21 6
+23 8
+25 10
+27 12
+29 14
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select count(`pkey`),min(`pkey`),min(`skey`) from `auto_test_remote2`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, skey FROM tbl_a ORDER BY pkey;
+pkey skey
+0 0
+2 2
+4 4
+6 6
+8 8
+10 10
+12 12
+14 14
+16 16
+18 18
+20 5
+22 7
+24 9
+26 11
+28 13
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection child2_1;
+set global sql_mode= @old_sql_mode;
+connection master_1;
+set session spider_sync_sql_mode= @old_spider_sync_sql_mode;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result b/storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result
new file mode 100644
index 00000000..ec9534f7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/wait_timeout.result
@@ -0,0 +1,130 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+set @old_wait_timeout= @@wait_timeout;
+set global wait_timeout= 1;
+connection child2_2;
+set @old_wait_timeout= @@wait_timeout;
+set global wait_timeout= 1;
+
+this test is for MDEV-16530
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_1_2;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_2_2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a READ;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+INSERT INTO tbl_a SELECT pkey + 30 FROM tbl_a ORDER BY pkey;
+connection child2_1_2;
+SELECT SLEEP(2);
+SLEEP(2)
+0
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`)values(31),(33),(35),(37),(39),(41),(43),(45),(47),(49),(51),(53),(55),(57),(59)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'
+connection child2_2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+argument
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'
+connection child2_1;
+UNLOCK TABLES;
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+1
+3
+5
+7
+9
+11
+13
+15
+17
+19
+21
+23
+25
+27
+29
+connection child2_2;
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+2
+4
+6
+8
+10
+12
+14
+16
+18
+20
+22
+24
+26
+28
+connection master_1;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection child2_1;
+set global wait_timeout= @old_wait_timeout;
+connection child2_2;
+set global wait_timeout= @old_wait_timeout;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result
new file mode 100644
index 00000000..7c01421f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result
@@ -0,0 +1,78 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-18313
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`pkey` `pkey` from `auto_test_remote`.`tbl_a` t0 order by `pkey`
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result b/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result
new file mode 100644
index 00000000..846dc6c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result
@@ -0,0 +1,68 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-19794
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+XA START 'test';
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+XA END 'test';
+XA PREPARE 'test';
+XA COMMIT 'test';
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`)values(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/suite.opt b/storage/spider/mysql-test/spider/bugfix/suite.opt
new file mode 100644
index 00000000..672a3b37
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/suite.opt
@@ -0,0 +1 @@
+--loose-innodb --loose-skip-performance-schema
diff --git a/storage/spider/mysql-test/spider/bugfix/suite.pm b/storage/spider/mysql-test/spider/bugfix/suite.pm
new file mode 100644
index 00000000..171fa6c4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/suite.pm
@@ -0,0 +1,11 @@
+package My::Suite::Spider;
+
+@ISA = qw(My::Suite);
+
+return "No Spider engine" unless $ENV{HA_SPIDER_SO};
+return "Not run for embedded server" if $::opt_embedded_server;
+
+sub is_default { 1 }
+
+bless { };
+
diff --git a/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.cnf b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test
new file mode 100644
index 00000000..5dc4a88c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test
@@ -0,0 +1,72 @@
+--source ../include/checksum_table_with_quick_mode_3_init.inc
+--echo
+--echo this test is for MDEV-16279
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+FLUSH TABLES;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+CHECKSUM TABLE tbl_a EXTENDED;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/checksum_table_with_quick_mode_3_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test
new file mode 100644
index 00000000..8bd0d40c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test
@@ -0,0 +1,80 @@
+--source ../include/cp932_column_init.inc
+--echo
+--echo this test is for MDEV-18992
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'',''),(1,'',''),(2,'',''),(3,'',''),(4,'',''),(5,'',''),(6,'',''),(7,'',''),(8,'',''),(9,'','');
+FLUSH TABLES;
+
+--echo
+--echo test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SET NAMES cp932;
+INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (10,'','’†‘');
+INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'','') ON DUPLICATE KEY UPDATE txt_cp932 = '’†‘';
+UPDATE tbl_a SET txt_cp932 = '’†‘' WHERE pkey = 2;
+SET NAMES utf8;
+
+--connection child2_1
+SET NAMES cp932;
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+SET NAMES utf8;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/cp932_column_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc
new file mode 100644
index 00000000..34980882
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc
@@ -0,0 +1,100 @@
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection slave1_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+--disable_ps_protocol
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_ps_protocol
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+save_master_pos;
+
+--connection slave1_1
+sync_with_master;
+
+--connection master_1
+SET SESSION sql_log_bin= 0;
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ f float DEFAULT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ f float DEFAULT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+SET SESSION sql_log_bin= 1;
+
+--connection slave1_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ f float DEFAULT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ f float DEFAULT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+
+--connection master_1
+INSERT INTO tbl_a (pkey, f) VALUES (0,NULL);
+INSERT INTO tbl_a (pkey, f) VALUES (1,0.671437);
+DELETE FROM tbl_a WHERE pkey = 0;
+DELETE FROM tbl_a WHERE pkey = 1;
+save_master_pos;
+
+--connection slave1_1
+sync_with_master;
+
+--connection master_1
+SET SESSION sql_log_bin= 0;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection slave1_1
+SELECT pkey, f FROM tbl_a ORDER BY pkey;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection slave1_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf
new file mode 100644
index 00000000..45019d6c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_4_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test
new file mode 100644
index 00000000..ce1a09d6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mariadb.test
@@ -0,0 +1,5 @@
+--source ../include/delete_with_float_column_mariadb_init.inc
+--source delete_with_float_column.inc
+--source ../include/delete_with_float_column_mariadb_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf
new file mode 100644
index 00000000..45019d6c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_4_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test
new file mode 100644
index 00000000..c687f947
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_mysql.test
@@ -0,0 +1,5 @@
+--source ../include/delete_with_float_column_mysql_init.inc
+--source delete_with_float_column.inc
+--source ../include/delete_with_float_column_mysql_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test
new file mode 100644
index 00000000..0b7d5119
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test
@@ -0,0 +1,35 @@
+--source ../include/direct_sql_with_comma_pwd_init.inc
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--enable_warnings
+
+--disable_query_log
+echo CREATE TEMPORARY TABLE tmp_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2;
+eval CREATE TEMPORARY TABLE tmp_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2;
+--enable_query_log
+
+eval $DIRECT_SQL_COMMAND;
+SELECT pkey FROM tmp_a;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--enable_warnings
+--source ../include/direct_sql_with_comma_pwd_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.cnf b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.test b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.test
new file mode 100644
index 00000000..139af5c8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.test
@@ -0,0 +1,35 @@
+--source ../include/direct_sql_with_tmp_table_init.inc
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--enable_warnings
+
+--disable_query_log
+echo CREATE TEMPORARY TABLE tmp_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2;
+eval CREATE TEMPORARY TABLE tmp_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2;
+--enable_query_log
+
+eval $DIRECT_SQL_COMMAND;
+SELECT pkey FROM tmp_a;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--enable_warnings
+--source ../include/direct_sql_with_tmp_table_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test
new file mode 100644
index 00000000..f1de6d5d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test
@@ -0,0 +1,97 @@
+--source ../include/group_by_order_by_limit_init.inc
+--echo
+--echo this test is for MDEV-16520
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19);
+INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/group_by_order_by_limit_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/insert_select.cnf b/storage/spider/mysql-test/spider/bugfix/t/insert_select.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/insert_select.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/insert_select.test b/storage/spider/mysql-test/spider/bugfix/t/insert_select.test
new file mode 100644
index 00000000..381e72f7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/insert_select.test
@@ -0,0 +1,99 @@
+--source ../include/insert_select_init.inc
+--echo
+--echo this test is for MDEV-16399
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+echo CHILD2_1_CREATE_TABLES2;
+eval $CHILD2_1_CREATE_TABLES2;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ KEY idx1 (skey,dt,tm)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ KEY idx1 (skey,dt,tm)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ dt datetime NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (dt)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ dt datetime NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (dt)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2;
+--enable_query_log
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-11-01', '11:00:00'),(1, '2012-12-01', '11:00:00'),(2, '2012-11-30', '11:00:00'),(3, '2012-11-29', '11:00:00'),(4, '2012-11-28', '11:00:00'),(5, '2012-11-27', '11:00:00'),(6, '2012-11-26', '11:00:00'),(7, '2012-11-25', '11:00:00'),(8, '2012-11-24', '11:00:00'),(9, '2012-11-23', '11:00:00');
+FLUSH TABLES;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 4 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 3 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 2 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 1 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 0 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 9 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 8 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 7 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 6 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FROM tbl_a WHERE skey = 5 AND dt > DATE_ADD('2012-12-01', INTERVAL -10 DAY));
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/insert_select_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test
new file mode 100644
index 00000000..05b753ae
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test
@@ -0,0 +1,97 @@
+--source ../include/mdev_19866_init.inc
+--echo
+--echo this test is for MDEV-19866
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val char(1) NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val char(1) NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,val) VALUES (1,'1'),(2,'2'),(3,'3'),(4,'4');
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT * FROM tbl_a;
+SELECT * FROM tbl_a WHERE pkey = 1;
+SELECT * FROM tbl_a;
+SELECT * FROM tbl_a WHERE pkey = 2;
+SELECT * FROM tbl_a;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/mdev_19866_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test
new file mode 100644
index 00000000..3f522b4f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test
@@ -0,0 +1,89 @@
+--source ../include/mdev_20100_init.inc
+--echo
+--echo this test is for MDEV-20100
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+--disable_ps_protocol
+eval $CHILD2_1_CREATE_TABLES;
+--enable_ps_protocol
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+--enable_query_log
+INSERT INTO tbl_a (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 test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a, b, c FROM tbl_a PARTITION (pt2) WHERE b = 'c';
+SELECT a, b, c FROM tbl_a PARTITION (pt1,pt2);
+SELECT a, b, c FROM tbl_a PARTITION (pt3) WHERE b = 'c';
+SELECT a, b, c FROM tbl_a PARTITION (pt1,pt2);
+SELECT a, b, c FROM tbl_a PARTITION (pt1) WHERE b = 'c';
+SELECT a, b, c FROM tbl_a PARTITION (pt1,pt3);
+SELECT a, b, c FROM tbl_a PARTITION (pt1) WHERE b = 'c';
+SELECT a, b, c FROM tbl_a PARTITION (pt2,pt3);
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--disable_ps_protocol
+eval $CHILD2_1_SELECT_TABLES;
+--enable_ps_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/mdev_20100_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test
new file mode 100644
index 00000000..2d6ff5b4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test
@@ -0,0 +1,78 @@
+--source ../include/mdev_20502_init.inc
+--echo
+--echo this test is for MDEV-20502
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ val int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY(id)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ val int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY(id)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (val) VALUES (1);
+
+--echo
+--echo test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT id, 0 AS const, val FROM tbl_a;
+SELECT 1+2, id, 0 AS const, val, val+10, (SELECT tbl_a.val+1 FROM tbl_a) AS sq
+FROM tbl_a;
+INSERT INTO tbl_a (val) VALUES (2), (1);
+SELECT val+10, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
+FROM tbl_a GROUP BY val;
+SELECT MAX(id) AS m, 0 AS const, val, (SELECT tbl_a.val+1 FROM tbl_a LIMIT 1) AS sq
+FROM tbl_a GROUP BY val;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/mdev_20502_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test
new file mode 100644
index 00000000..16836cfc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test
@@ -0,0 +1,101 @@
+--source ../include/mdev_21884_init.inc
+--echo
+--echo this test is for MDEV-21884
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+--disable_ps_protocol
+eval $CHILD2_1_CREATE_TABLES;
+--enable_ps_protocol
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a,b)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a,b)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+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 tbl_a (a, b, c) VALUES
+ (11, 'a', '2008-08-01 10:21:39'),
+ (11, 'b', '2000-01-01 00:00:00'),
+ (12, 'e', '2007-06-04 20:03:11'),
+ (12, 'd', '2003-11-30 05:01:03'),
+ (13, 'c', '2001-12-31 23:59:59');
+INSERT INTO tb_l (a, b, c) VALUES
+ (11, 'a', '2008-08-01 10:21:39'),
+ (12, 'b', '2000-01-01 00:00:00'),
+ (13, 'e', '2007-06-04 20:03:11'),
+ (14, 'd', '2003-11-30 05:01:03'),
+ (15, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT STRAIGHT_JOIN b.a, b.b FROM tb_l a, tbl_a b WHERE a.a = b.a;
+
+--connection child2_1
+SET NAMES utf8;
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--disable_ps_protocol
+eval $CHILD2_1_SELECT_TABLES;
+--enable_ps_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/mdev_21884_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test
new file mode 100644
index 00000000..9e58bc1a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test
@@ -0,0 +1,92 @@
+--source ../include/mdev_22246_init.inc
+--echo
+--echo this test is for MDEV-22246
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ id bigint NOT NULL,
+ node text,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ id bigint NOT NULL,
+ node text,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (id,node) VALUES (1,'DB-G0'),(2,'DB-G1');
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT * FROM tbl_a;
+SELECT * FROM tbl_a WHERE id <0 || id >0;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/mdev_22246_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22265.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_22265.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22265.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22265.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_22265.test
new file mode 100644
index 00000000..0dcb1031
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22265.test
@@ -0,0 +1,28 @@
+--source ../include/mdev_22265_init.inc
+--echo
+--echo this test is for MDEV-22265
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--enable_warnings
+
+--echo
+--echo create table
+--connection master_1
+create table t2345678911234567892123456789312345678941234567895123(id int) ENGINE=SPIDER DEFAULT CHARSET=latin1 COMMENT='host "h114", user "spider", password "spider", port "3306", database "test32738"';
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--enable_warnings
+--source ../include/mdev_22265_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test
new file mode 100644
index 00000000..ac06d860
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test
@@ -0,0 +1,90 @@
+--source ../include/mdev_24020_init.inc
+--echo
+--echo this test is for MDEV-24020
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+--disable_ps_protocol
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_ps_protocol
+--enable_query_log
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(30),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(30),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+--enable_query_log
+INSERT INTO tbl_a VALUES(10000, " abcd ");
+INSERT INTO tbl_a VALUES(10001, " abcd ");
+INSERT INTO tbl_a VALUES(10002, " abcd ");
+INSERT INTO tbl_a VALUES(10003, "[[[abcd][[");
+INSERT INTO tbl_a VALUES(10004, "[[[abcd][[");
+INSERT INTO tbl_a VALUES(10005, "[[[abcd][[");
+INSERT INTO tbl_a VALUES(10006, "[[[abcd]]");
+INSERT INTO tbl_a VALUES(10007, "[[[abcd]]");
+INSERT INTO tbl_a VALUES(10008, "[[[abcd]]");
+INSERT INTO tbl_a VALUES(10009, "[[[**abcd****]]");
+
+--echo
+--echo test 1
+
+--connection master_1
+UPDATE tbl_a SET b = trim(b) WHERE a = 10000;
+SELECT * FROM tbl_a WHERE a = 10000;
+UPDATE tbl_a SET b = ltrim(b) WHERE a = 10001;
+SELECT * FROM tbl_a WHERE a = 10001;
+UPDATE tbl_a SET b = rtrim(b) WHERE a = 10002;
+SELECT * FROM tbl_a WHERE a = 10002;
+UPDATE tbl_a SET b = trim(BOTH '[' FROM b) WHERE a = 10003;
+SELECT * FROM tbl_a WHERE a = 10003;
+UPDATE tbl_a SET b = trim(LEADING '[' FROM b) WHERE a = 10004;
+SELECT * FROM tbl_a WHERE a = 10004;
+UPDATE tbl_a SET b = trim(TRAILING '[' FROM b) WHERE a = 10005;
+SELECT * FROM tbl_a WHERE a = 10005;
+UPDATE tbl_a SET b = trim(LEADING '[' FROM trim(TRAILING ']' FROM b)) WHERE a = 10006;
+SELECT * FROM tbl_a WHERE a = 10006;
+UPDATE tbl_a SET b = trim(TRAILING '[' FROM trim(LEADING ']' FROM b)) WHERE a = 10007;
+SELECT * FROM tbl_a WHERE a = 10007;
+UPDATE tbl_a SET b = trim(TRAILING ']' FROM trim(LEADING '[' FROM b)) WHERE a = 10008;
+SELECT * FROM tbl_a WHERE a = 10008;
+UPDATE tbl_a SET b = trim(BOTH '*' FROM trim(TRAILING ']' FROM trim(LEADING '[' FROM b))) WHERE a = 10009;
+SELECT * FROM tbl_a WHERE a = 10009;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--enable_warnings
+--source ../include/mdev_24020_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test
new file mode 100644
index 00000000..21b9dda4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test
@@ -0,0 +1,80 @@
+--source ../include/mdev_24517_init.inc
+--echo
+--echo this test is for MDEV-24517
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+--disable_ps_protocol
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_ps_protocol
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ i INT,
+ j JSON,
+ PRIMARY KEY(i)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+eval CREATE TABLE tbl_a (
+ i INT,
+ j JSON,
+ PRIMARY KEY(i)
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+--enable_query_log
+INSERT INTO tbl_a (i, j) VALUES
+ (1, '{"ID": "3", "Name": "Barney", "Age": 18}'),
+ (2, '{"ID": "4", "Name": "Betty", "Age": 19}'),
+ (3, '{"ID": "2", "Name": "Wilma", "Age": 20}'),
+ (4, '[10, 20, [30, 40]]');
+
+--echo
+--echo test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Age')=19;
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$.Name')="Betty";
+SELECT i, JSON_EXTRACT(j, "$.ID")
+ FROM tbl_a
+ WHERE JSON_EXTRACT(j, "$.ID") > 1 AND i < 4
+ ORDER BY JSON_EXTRACT(j, "$.Name");
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[1]') = 20;
+SELECT * FROM tbl_a WHERE JSON_EXTRACT(j, '$[2][0]') = 30;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/mdev_24517_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.test
new file mode 100644
index 00000000..149b057d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24760.test
@@ -0,0 +1,49 @@
+--echo #
+--echo # MDEV-24760 SELECT..CASE statement syntax error at Spider Engine table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_query_log
+--enable_result_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+DROP TABLE IF EXISTS tbl_a;
+eval CREATE TABLE tbl_a (
+ id int NOT NULL AUTO_INCREMENT,
+ name varchar(255) DEFAULT NULL,
+ PRIMARY KEY (id)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO tbl_a (name) VALUES ('Alice'), ('Bob');
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ id int NOT NULL AUTO_INCREMENT,
+ name varchar(255) DEFAULT NULL,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"'
+PARTITION BY HASH(id) (
+ PARTITION pt1 COMMENT='srv "s_2_1"'
+);
+
+SELECT id, CASE WHEN name='Alice' THEN "A" WHEN name='Bob' THEN "B" END FROM tbl_a;
+SELECT id, CASE name WHEN 'Alice' THEN "A" WHEN 'Bob' THEN "B" END FROM tbl_a;
+
+DROP DATABASE auto_test_local;
+
+--connection child2_1
+DROP DATABASE auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26013.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26013.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26013.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26013.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26013.test
new file mode 100644
index 00000000..e31041c3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26013.test
@@ -0,0 +1,51 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+
+--echo
+--echo MDEV-26013 distinct not work properly in some cases for spider tables
+--echo
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE tbl_a (
+ `a`int,
+ `b`int,
+ PRIMARY KEY (`a`)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+insert into `tbl_a` VALUES (1,999), (2,999);
+
+--connection master_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE tbl_a (
+ `a`int,
+ `b`int,
+ PRIMARY KEY (`a`)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS(`a`) (
+ PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+
+--connection master_1
+SELECT distinct b FROM tbl_a WHERE b=999;
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_remote;
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.cnf b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test
new file mode 100644
index 00000000..235edc10
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test
@@ -0,0 +1,156 @@
+--source ../include/quick_mode_0_init.inc
+--echo
+--echo this test is for MDEV-16520
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/quick_mode_0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.cnf b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test
new file mode 100644
index 00000000..01fa0cb5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test
@@ -0,0 +1,156 @@
+--source ../include/quick_mode_1_init.inc
+--echo
+--echo this test is for MDEV-16520
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/quick_mode_1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.cnf b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test
new file mode 100644
index 00000000..3ea8138e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test
@@ -0,0 +1,156 @@
+--source ../include/quick_mode_2_init.inc
+--echo
+--echo this test is for MDEV-16520
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/quick_mode_2_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.cnf b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test
new file mode 100644
index 00000000..bc926b0a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test
@@ -0,0 +1,157 @@
+--source ../include/quick_mode_3_init.inc
+--echo
+--echo this test is for MDEV-16520
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+
+--connection child2_1
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/quick_mode_3_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test
new file mode 100644
index 00000000..2beb9d9d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test
@@ -0,0 +1,98 @@
+--source ../include/return_found_rows_insert_init.inc
+--echo
+--echo this test is for MDEV-18973
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ PRIMARY KEY (skey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ PRIMARY KEY (skey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00');
+FLUSH TABLES;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--disable_query_log
+echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')" auto_test_local;
+exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "$MASTER_1_SET_COMMAND INSERT IGNORE INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(2, '2013-02-01', '13:00:00'),(4, '2013-03-01', '13:00:00'),(7, '2013-04-01', '13:00:00'),(8, '2013-05-01', '13:00:00'),(10, '2013-06-01', '13:00:00'),(11, '2013-07-01', '13:00:00'),(12, '2013-08-01', '13:00:00'),(13, '2013-09-01', '13:00:00'),(14, '2013-10-01', '13:00:00')" auto_test_local;
+--enable_query_log
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+TRUNCATE TABLE mysql.general_log;
+
+--disable_query_log
+echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')" auto_test_local;
+exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "$MASTER_1_SET_COMMAND REPLACE INTO tbl_a (skey, dt, tm) VALUES (1, '2012-02-01', '12:00:00'),(3, '2012-12-01', '11:00:00'),(8, '2012-11-30', '11:00:00'),(9, '2012-11-29', '11:00:00'),(10, '2012-11-28', '11:00:00'),(15, '2012-11-27', '11:00:00'),(16, '2012-11-26', '11:00:00'),(17, '2012-11-25', '11:00:00'),(18, '2012-11-24', '11:00:00'),(19, '2012-11-23', '11:00:00')" auto_test_local;
+--enable_query_log
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+TRUNCATE TABLE mysql.general_log;
+
+--disable_query_log
+echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "MASTER_1_SET_COMMAND INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)" auto_test_local;
+exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "$MASTER_1_SET_COMMAND INSERT INTO tbl_a (skey, dt, tm) VALUES (1, '2012-11-01', '11:00:00'),(3, '2012-12-01', '11:00:00'),(11, '2012-11-30', '11:00:00'),(15, '2012-11-29', '11:00:00'),(16, '2012-11-28', '11:00:00'),(20, '2012-11-27', '11:00:00'),(21, '2012-11-26', '11:00:00'),(22, '2012-11-25', '11:00:00'),(23, '2012-11-24', '11:00:00'),(24, '2012-11-23', '11:00:00') ON DUPLICATE KEY UPDATE dt=VALUE(dt), tm=VALUE(tm)" auto_test_local;
+--enable_query_log
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/return_found_rows_insert_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test
new file mode 100644
index 00000000..50d9f345
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test
@@ -0,0 +1,78 @@
+--source ../include/return_found_rows_update_init.inc
+--echo
+--echo this test is for MDEV-18973
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ KEY idx1 (skey,dt)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ skey int NOT NULL,
+ dt date NOT NULL,
+ tm time NOT NULL,
+ KEY idx1 (skey,dt)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00');
+INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-11-01', '11:00:00'),(1, '2012-12-01', '11:00:00'),(2, '2012-11-30', '11:00:00'),(3, '2012-11-29', '11:00:00'),(4, '2012-11-28', '11:00:00'),(5, '2012-11-27', '11:00:00'),(6, '2012-11-26', '11:00:00'),(7, '2012-11-25', '11:00:00'),(8, '2012-11-24', '11:00:00'),(9, '2012-11-23', '11:00:00');
+FLUSH TABLES;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--disable_query_log
+echo MYSQL -v -v -u root -h localhost -P MASTER_1_MYPORT -S MASTER_1_MYSOCK -e "UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0" auto_test_local;
+exec $MYSQL -v -v -u root -h localhost --default-character-set=latin1 -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK -e "UPDATE tbl_a SET tm = '12:00:00' WHERE skey = 0" auto_test_local;
+--enable_query_log
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/return_found_rows_update_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/same_server_link.test b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.test
new file mode 100644
index 00000000..1468f00c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/same_server_link.test
@@ -0,0 +1,55 @@
+--source ../include/same_server_link_init.inc
+--echo
+--echo this test is for MDEV-6268
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--enable_warnings
+
+--echo
+--echo create table
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+
+--echo
+--echo select test 1
+
+--connection master_1
+--disable_result_log
+--error 12720
+INSERT INTO tbl_a VALUES(1);
+--enable_result_log
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--enable_warnings
+--source ../include/same_server_link_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test
new file mode 100644
index 00000000..1f540b2a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test
@@ -0,0 +1,72 @@
+--source ../include/select_by_null_init.inc
+--echo
+--echo this test is for MDEV-16279
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+FLUSH TABLES;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT pkey FROM tbl_a WHERE NULL;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/select_by_null_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test
new file mode 100644
index 00000000..4c4d687c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test
@@ -0,0 +1,74 @@
+--source ../include/select_with_backquote_init.inc
+--echo
+--echo this test is for MDEV-17204
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456');
+FLUSH TABLES;
+
+--echo
+--echo test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SET NAMES utf8;
+SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(`txt_utf8`, 4) LIMIT 3;
+
+--connection child2_1
+SET NAMES utf8;
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/select_with_backquote_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/self_reference.cnf b/storage/spider/mysql-test/spider/bugfix/t/self_reference.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/self_reference.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/self_reference.test b/storage/spider/mysql-test/spider/bugfix/t/self_reference.test
new file mode 100644
index 00000000..b93cf8ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/self_reference.test
@@ -0,0 +1,45 @@
+--source ../include/self_reference_init.inc
+--echo
+--echo this test is for MDEV-6268
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--enable_warnings
+
+--echo
+--echo create table
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+
+--echo
+--echo select test 1
+
+--connection master_1
+--error 12719
+SELECT pkey FROM tbl_a;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--enable_warnings
+--source ../include/self_reference_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf
new file mode 100644
index 00000000..c861d27b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.cnf
@@ -0,0 +1,6 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_4_1.cnf
+[mysqld.4.1]
+slave_transaction_retry_errors="10000,20000,30000"
diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test
new file mode 100644
index 00000000..fc91a43e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/slave_transaction_retry_errors_5digit.test
@@ -0,0 +1,9 @@
+--source ../include/slave_transaction_retry_errors_5digit_init.inc
+--echo
+
+--connection slave1_1
+SHOW VARIABLES LIKE 'slave_transaction_retry_errors';
+
+--source ../include/slave_transaction_retry_errors_5digit_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.cnf b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.cnf
new file mode 100644
index 00000000..45019d6c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_4_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test
new file mode 100644
index 00000000..c608ae01
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test
@@ -0,0 +1,96 @@
+--source ../include/slave_trx_isolation_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection slave1_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+save_master_pos;
+
+--connection slave1_1
+sync_with_master;
+
+--connection master_1
+SET SESSION sql_log_bin= 0;
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+SET SESSION sql_log_bin= 1;
+
+--connection slave1_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+
+--connection master_1
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+save_master_pos;
+
+--connection slave1_1
+sync_with_master;
+
+--connection master_1
+SET SESSION sql_log_bin= 0;
+
+--connection child2_1
+--replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection slave1_1
+SELECT pkey FROM tbl_a ORDER BY pkey;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection slave1_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/slave_trx_isolation_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test
new file mode 100644
index 00000000..72130175
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test
@@ -0,0 +1,46 @@
+--source ../include/spider_table_sts_init.inc
+--echo
+--echo this test is for MDEV-19842
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--enable_warnings
+
+--echo
+--echo create table
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+
+--echo
+--echo select test 1
+
+--connection master_1
+--error 12609
+SELECT pkey FROM tbl_a;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+--error 12609
+DROP DATABASE IF EXISTS auto_test_local;
+
+--enable_warnings
+--source ../include/spider_table_sts_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc b/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc
new file mode 100644
index 00000000..f094b1f8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc
@@ -0,0 +1,66 @@
+--echo
+--echo this test is for MDEV-16508
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+--echo
+--echo select test
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT * FROM tbl_a ORDER BY pkey;
+
+--connection child2_1
+--replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test
new file mode 100644
index 00000000..c63514d2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mariadb.test
@@ -0,0 +1,5 @@
+--source ../include/sql_mode_mariadb_init.inc
+--source sql_mode.inc
+--source ../include/sql_mode_mariadb_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test
new file mode 100644
index 00000000..3a0f8d20
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode_mysql.test
@@ -0,0 +1,5 @@
+--source ../include/sql_mode_mysql_init.inc
+--source sql_mode.inc
+--source ../include/sql_mode_mysql_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.cnf b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test
new file mode 100644
index 00000000..8b8da46d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test
@@ -0,0 +1,98 @@
+--source ../include/strict_group_by_init.inc
+--echo
+--echo this test is for MDEV-18988
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ skey int NOT NULL,
+ PRIMARY KEY (pkey),
+ KEY idx1 (skey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19);
+INSERT INTO tbl_a (pkey,skey) VALUES (20,5),(21,6),(22,7),(23,8),(24,9),(25,10),(26,11),(27,12),(28,13),(29,14);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+FLUSH TABLES;
+SELECT count(pkey) cnt, skey FROM tbl_a;
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/strict_group_by_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.cnf
@@ -0,0 +1,4 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
+!include ../my_2_2.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test
new file mode 100644
index 00000000..8da6e8fe
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test
@@ -0,0 +1,109 @@
+--source ../include/wait_timeout_init.inc
+--echo
+--echo this test is for MDEV-16530
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--connection child2_1_2
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--connection child2_2_2
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a READ;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+send_eval INSERT INTO tbl_a SELECT pkey + 30 FROM tbl_a ORDER BY pkey;
+
+--connection child2_1_2
+SELECT SLEEP(2);
+eval $CHILD2_1_SELECT_ARGUMENT1;
+
+--connection child2_2_2
+eval $CHILD2_2_SELECT_ARGUMENT1;
+
+--connection child2_1
+UNLOCK TABLES;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+reap;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/wait_timeout_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test
new file mode 100644
index 00000000..4f980140
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test
@@ -0,0 +1,71 @@
+--source ../include/wrapper_mariadb_init.inc
+--echo
+--echo this test is for MDEV-18313
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+--echo
+--echo select test
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SELECT * FROM tbl_a ORDER BY pkey;
+
+--connection child2_1
+# in --ps a query is logged differently in a general log
+replace_regex /order by t0.`pkey`/order by `pkey`/;
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/wrapper_mariadb_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test
new file mode 100644
index 00000000..9ae52807
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test
@@ -0,0 +1,69 @@
+--source ../include/xa_cmd_init.inc
+--echo
+--echo this test is for MDEV-19794
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+XA START 'test';
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+XA END 'test';
+XA PREPARE 'test';
+XA COMMIT 'test';
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
+--source ../include/xa_cmd_deinit.inc
+--echo
+--echo end of test