summaryrefslogtreecommitdiffstats
path: root/storage/spider/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'storage/spider/mysql-test')
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc8
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc4
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc4
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc140
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc140
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc140
-rw-r--r--storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc105
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc24
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc12
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_init_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/hs_init_master_1.inc12
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child2_1.inc175
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child2_2.inc80
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child2_3.inc11
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child3_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child3_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_child3_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_master_1.inc194
-rw-r--r--storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc10
-rw-r--r--storage/spider/mysql-test/spider/bg/my.cnf176
-rw-r--r--storage/spider/mysql-test/spider/bg/r/basic_sql.result738
-rw-r--r--storage/spider/mysql-test/spider/bg/r/basic_sql_part.result141
-rw-r--r--storage/spider/mysql-test/spider/bg/r/direct_aggregate.result100
-rw-r--r--storage/spider/mysql-test/spider/bg/r/direct_aggregate_part.result121
-rw-r--r--storage/spider/mysql-test/spider/bg/r/direct_update.result155
-rw-r--r--storage/spider/mysql-test/spider/bg/r/direct_update_part.result145
-rw-r--r--storage/spider/mysql-test/spider/bg/r/function.result160
-rw-r--r--storage/spider/mysql-test/spider/bg/r/ha.result286
-rw-r--r--storage/spider/mysql-test/spider/bg/r/ha_part.result311
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes.result224
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result222
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider_fixes.result616
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result237
-rw-r--r--storage/spider/mysql-test/spider/bg/r/vp_fixes.result93
-rw-r--r--storage/spider/mysql-test/spider/bg/suite.opt1
-rw-r--r--storage/spider/mysql-test/spider/bg/suite.pm11
-rw-r--r--storage/spider/mysql-test/spider/bg/t/basic_sql.test2701
-rw-r--r--storage/spider/mysql-test/spider/bg/t/basic_sql_part.test571
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_child2_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_child2_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_child2_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/connect_slave1_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/bg/t/direct_aggregate.test181
-rw-r--r--storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test210
-rw-r--r--storage/spider/mysql-test/spider/bg/t/direct_update.test198
-rw-r--r--storage/spider/mysql-test/spider/bg/t/direct_update_part.test211
-rw-r--r--storage/spider/mysql-test/spider/bg/t/function.test253
-rw-r--r--storage/spider/mysql-test/spider/bg/t/ha.test882
-rw-r--r--storage/spider/mysql-test/spider/bg/t/ha_part.test1017
-rw-r--r--storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc30
-rw-r--r--storage/spider/mysql-test/spider/bg/t/ha_test_init.inc30
-rw-r--r--storage/spider/mysql-test/spider/bg/t/have_engine.inc7
-rw-r--r--storage/spider/mysql-test/spider/bg/t/have_func.inc5
-rw-r--r--storage/spider/mysql-test/spider/bg/t/have_partition.inc7
-rw-r--r--storage/spider/mysql-test/spider/bg/t/have_trigger.inc2
-rw-r--r--storage/spider/mysql-test/spider/bg/t/hs_test_deinit.inc17
-rw-r--r--storage/spider/mysql-test/spider/bg/t/hs_test_init.inc17
-rw-r--r--storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc6
-rw-r--r--storage/spider/mysql-test/spider/bg/t/slave_test_init.inc44
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes.test294
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test347
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider_fixes.test1427
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test647
-rw-r--r--storage/spider/mysql-test/spider/bg/t/test_deinit.inc37
-rw-r--r--storage/spider/mysql-test/spider/bg/t/test_init.inc74
-rw-r--r--storage/spider/mysql-test/spider/bg/t/vp_fixes.test335
-rw-r--r--storage/spider/mysql-test/spider/bugfix/disabled.def3
-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_default_deinit.inc4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_default_init.inc32
-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/mdev_24523_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/mdev_24523_init.inc31
-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/ddl_log.result12
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result85
-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.result126
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/index.result57
-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_22979.result5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24020.result97
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24343.result75
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24517.result78
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24523.result58
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_24760.result49
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result42
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_25684.result18
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26013.result42
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26151.result34
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26158.result27
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result96
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26539.result36
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result19
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26544.result23
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_26582.result11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result83
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27184.result21
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result20
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result16
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result9
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28218_init_file.result5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result5
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result32
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result180
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28996.result34
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_28998.result26
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result38
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29011.result40
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result26
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29447.result33
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29484.result39
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result68
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result47
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result41
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result33
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_30191.result44
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result8
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result25
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_30981.result12
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_31117.result22
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result16
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_31524.result50
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result28
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_31996.result47
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result16
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_spider.result7
-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/self_reference_multi.result22
-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.result133
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early.result43
l---------storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early_init_file.result1
-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.test74
-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.test82
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/ddl_log.test17
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc102
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_default.cnf4
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_default.test5
-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.test37
-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.test37
-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.test104
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/index.test53
-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.test101
-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.test99
-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.test93
-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.test80
-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.test105
-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_22979.test18
-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_24343.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24343.test84
-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_24523.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test66
-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_25116.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test44
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_25684.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_25684.test19
-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/mdev_26151.test54
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26158.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26158.test31
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26247.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26247.test85
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26539.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26539.test40
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test23
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26544.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26544.test32
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26582.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_26582.test27
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test94
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27184.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27184.test31
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test24
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test29
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218.test10
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test8
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test36
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test163
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28996.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28996.test40
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_28998.test39
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29008.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test39
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29011.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29011.test40
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test36
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29447.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29447.test37
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29484.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29484.test47
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test67
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test54
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test56
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test37
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test6
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_30191.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_30191.test51
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test32
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_30981.test24
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_31117.test31
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test23
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_31524.test73
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test35
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_31996.test50
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test14
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.test7
-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.test158
-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.test158
-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.test158
-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.test159
-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.test104
-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.test80
-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.test74
-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.test76
-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/self_reference_multi.test30
-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.test99
-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.inc68
-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.test109
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test48
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.opt1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql1
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.test4
-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.test73
-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.test71
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc16
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_deinit.inc1
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc2
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc53
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc1
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc2
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc1
-rw-r--r--storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc2
-rw-r--r--storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_deinit.inc10
-rw-r--r--storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_init.inc10
-rw-r--r--storage/spider/mysql-test/spider/feature/my.cnf2
-rw-r--r--storage/spider/mysql-test/spider/feature/my_1_1.cnf44
-rw-r--r--storage/spider/mysql-test/spider/feature/my_2_1.cnf56
-rw-r--r--storage/spider/mysql-test/spider/feature/my_2_2.cnf38
-rw-r--r--storage/spider/mysql-test/spider/feature/my_2_3.cnf8
-rw-r--r--storage/spider/mysql-test/spider/feature/my_3_1.cnf11
-rw-r--r--storage/spider/mysql-test/spider/feature/my_3_2.cnf9
-rw-r--r--storage/spider/mysql-test/spider/feature/my_3_3.cnf9
-rw-r--r--storage/spider/mysql-test/spider/feature/my_4_1.cnf9
-rw-r--r--storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_extended.result130
-rw-r--r--storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_no_opt.result128
-rw-r--r--storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_quick.result128
-rw-r--r--storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result236
-rw-r--r--storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result22
-rw-r--r--storage/spider/mysql-test/spider/feature/suite.opt1
-rw-r--r--storage/spider/mysql-test/spider/feature/suite.pm11
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel.inc109
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.cnf4
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.test5
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.cnf4
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.test5
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.cnf4
-rw-r--r--storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.test5
-rw-r--r--storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.cnf4
-rw-r--r--storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test227
-rw-r--r--storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.cnf4
-rw-r--r--storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.test9
-rw-r--r--storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc33
-rw-r--r--storage/spider/mysql-test/spider/include/clean_up_spider.inc15
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child2_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child2_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child2_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child3_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child3_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_child3_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_engine.inc4
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_handlersocket.inc1
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_innodb_plugin.inc1
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_slave1_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_spider.inc8
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_init.inc53
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_using_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child2_1.inc8
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child2_2.inc4
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child2_3.inc4
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child3_1.inc140
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child3_2.inc140
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_child3_3.inc140
-rw-r--r--storage/spider/mysql-test/spider/include/ha_init_master_1.inc105
-rw-r--r--storage/spider/mysql-test/spider/include/hs_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/hs_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/hs_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/hs_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/hs_init_child2_1.inc24
-rw-r--r--storage/spider/mysql-test/spider/include/hs_init_child2_2.inc12
-rw-r--r--storage/spider/mysql-test/spider/include/hs_init_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/include/hs_init_master_1.inc12
-rw-r--r--storage/spider/mysql-test/spider/include/init_child2_1.inc192
-rw-r--r--storage/spider/mysql-test/spider/include/init_child2_2.inc83
-rw-r--r--storage/spider/mysql-test/spider/include/init_child2_3.inc14
-rw-r--r--storage/spider/mysql-test/spider/include/init_child3_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/init_child3_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/init_child3_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/include/init_engine.inc10
-rw-r--r--storage/spider/mysql-test/spider/include/init_master_1.inc195
-rw-r--r--storage/spider/mysql-test/spider/include/init_slave1_1.inc10
-rw-r--r--storage/spider/mysql-test/spider/include/init_spider.inc191
-rw-r--r--storage/spider/mysql-test/spider/include/partition_cond_push_deinit.inc20
-rw-r--r--storage/spider/mysql-test/spider/include/partition_cond_push_init.inc58
-rw-r--r--storage/spider/mysql-test/spider/include/partition_fulltext_deinit.inc23
-rw-r--r--storage/spider/mysql-test/spider/include/partition_fulltext_init.inc72
-rw-r--r--storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_deinit.inc30
-rw-r--r--storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_init.inc105
-rw-r--r--storage/spider/mysql-test/spider/include/partition_mrr_deinit.inc23
-rw-r--r--storage/spider/mysql-test/spider/include/partition_mrr_init.inc92
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_0_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_1_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_2_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc21
-rw-r--r--storage/spider/mysql-test/spider/include/quick_mode_3_init.inc55
-rw-r--r--storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc17
-rw-r--r--storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc39
-rw-r--r--storage/spider/mysql-test/spider/my.cnf177
-rw-r--r--storage/spider/mysql-test/spider/r/auto_increment.result186
-rw-r--r--storage/spider/mysql-test/spider/r/basic_sql.result748
-rw-r--r--storage/spider/mysql-test/spider/r/basic_sql_part.result141
-rw-r--r--storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result104
-rw-r--r--storage/spider/mysql-test/spider/r/direct_aggregate.result120
-rw-r--r--storage/spider/mysql-test/spider/r/direct_aggregate_part.result121
-rw-r--r--storage/spider/mysql-test/spider/r/direct_join.result197
-rw-r--r--storage/spider/mysql-test/spider/r/direct_join_using.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result112
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result112
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_update.result155
-rw-r--r--storage/spider/mysql-test/spider/r/direct_update_part.result145
-rw-r--r--storage/spider/mysql-test/spider/r/error_row_number.result45
-rw-r--r--storage/spider/mysql-test/spider/r/function.result160
-rw-r--r--storage/spider/mysql-test/spider/r/ha.result286
-rw-r--r--storage/spider/mysql-test/spider/r/ha_part.result320
-rw-r--r--storage/spider/mysql-test/spider/r/partition_cond_push.result168
-rw-r--r--storage/spider/mysql-test/spider/r/partition_fulltext.result126
-rw-r--r--storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result130
-rw-r--r--storage/spider/mysql-test/spider/r/partition_mrr.result267
-rw-r--r--storage/spider/mysql-test/spider/r/pushdown_not_like.result63
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_0.result508
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_1.result508
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_2.result508
-rw-r--r--storage/spider/mysql-test/spider/r/quick_mode_3.result508
-rw-r--r--storage/spider/mysql-test/spider/r/show_system_tables.result37
-rw-r--r--storage/spider/mysql-test/spider/r/slave_trx_isolation.result105
-rw-r--r--storage/spider/mysql-test/spider/r/spider3_fixes.result232
-rw-r--r--storage/spider/mysql-test/spider/r/spider3_fixes_part.result222
-rw-r--r--storage/spider/mysql-test/spider/r/spider_fixes.result623
-rw-r--r--storage/spider/mysql-test/spider/r/spider_fixes_part.result351
-rw-r--r--storage/spider/mysql-test/spider/r/spider_wrapper_protocols.result22
-rw-r--r--storage/spider/mysql-test/spider/r/timestamp.result431
-rw-r--r--storage/spider/mysql-test/spider/r/udf_pushdown.result218
-rw-r--r--storage/spider/mysql-test/spider/r/variable_deprecation.result221
-rw-r--r--storage/spider/mysql-test/spider/r/vp_fixes.result93
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc12
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc36
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc12
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc36
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc25
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/my.cnf3
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf44
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf56
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result94
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result94
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result84
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result104
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result104
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/suite.opt1
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/suite.pm11
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test88
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test88
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc82
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_init.inc54
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc52
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/my.cnf4
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf44
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf56
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf38
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result126
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result114
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result103
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result114
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result123
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result123
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/suite.opt1
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/suite.pm11
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test104
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc106
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/suite.opt1
-rw-r--r--storage/spider/mysql-test/spider/suite.pm11
-rw-r--r--storage/spider/mysql-test/spider/t/auto_increment.test187
-rw-r--r--storage/spider/mysql-test/spider/t/auto_increment_deinit.inc13
-rw-r--r--storage/spider/mysql-test/spider/t/auto_increment_init.inc38
-rw-r--r--storage/spider/mysql-test/spider/t/basic_sql.test2714
-rw-r--r--storage/spider/mysql-test/spider/t/basic_sql_part.test571
-rw-r--r--storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test128
-rw-r--r--storage/spider/mysql-test/spider/t/connect_child2_1.inc2
-rw-r--r--storage/spider/mysql-test/spider/t/connect_child2_2.inc2
-rw-r--r--storage/spider/mysql-test/spider/t/connect_child2_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/t/connect_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/t/connect_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/t/connect_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/t/connect_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/t/connect_slave1_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/t/direct_aggregate.test191
-rw-r--r--storage/spider/mysql-test/spider/t/direct_aggregate_part.test211
-rw-r--r--storage/spider/mysql-test/spider/t/direct_join.test347
-rw-r--r--storage/spider/mysql-test/spider/t/direct_join_using.test199
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_join.test199
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_join_nullable.test214
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test214
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test214
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_join.test199
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_join_nullable.test214
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test214
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test214
-rw-r--r--storage/spider/mysql-test/spider/t/direct_update.test198
-rw-r--r--storage/spider/mysql-test/spider/t/direct_update_part.test211
-rw-r--r--storage/spider/mysql-test/spider/t/error_row_number.test37
-rw-r--r--storage/spider/mysql-test/spider/t/function.test253
-rw-r--r--storage/spider/mysql-test/spider/t/ha.test882
-rw-r--r--storage/spider/mysql-test/spider/t/ha_part.test1024
-rw-r--r--storage/spider/mysql-test/spider/t/ha_test_deinit.inc30
-rw-r--r--storage/spider/mysql-test/spider/t/ha_test_init.inc30
-rw-r--r--storage/spider/mysql-test/spider/t/have_engine.inc7
-rw-r--r--storage/spider/mysql-test/spider/t/have_func.inc5
-rw-r--r--storage/spider/mysql-test/spider/t/have_partition.inc7
-rw-r--r--storage/spider/mysql-test/spider/t/have_plugin.inc5
-rw-r--r--storage/spider/mysql-test/spider/t/have_trigger.inc2
-rw-r--r--storage/spider/mysql-test/spider/t/hs_test_deinit.inc17
-rw-r--r--storage/spider/mysql-test/spider/t/hs_test_init.inc17
-rw-r--r--storage/spider/mysql-test/spider/t/partition_cond_push.test221
-rw-r--r--storage/spider/mysql-test/spider/t/partition_fulltext.test225
-rw-r--r--storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test224
-rw-r--r--storage/spider/mysql-test/spider/t/partition_mrr.test239
-rw-r--r--storage/spider/mysql-test/spider/t/pushdown_not_like.test139
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_0.test300
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_1.test300
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_2.test300
-rw-r--r--storage/spider/mysql-test/spider/t/quick_mode_3.test300
-rw-r--r--storage/spider/mysql-test/spider/t/show_system_tables.test26
-rw-r--r--storage/spider/mysql-test/spider/t/slave_test_deinit.inc6
-rw-r--r--storage/spider/mysql-test/spider/t/slave_test_init.inc44
-rw-r--r--storage/spider/mysql-test/spider/t/slave_trx_isolation.test151
-rw-r--r--storage/spider/mysql-test/spider/t/spider3_fixes.test304
-rw-r--r--storage/spider/mysql-test/spider/t/spider3_fixes_part.test347
-rw-r--r--storage/spider/mysql-test/spider/t/spider_fixes.test1442
-rw-r--r--storage/spider/mysql-test/spider/t/spider_fixes_part.test901
-rw-r--r--storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test16
-rw-r--r--storage/spider/mysql-test/spider/t/test_deinit.inc39
-rw-r--r--storage/spider/mysql-test/spider/t/test_init.inc74
-rw-r--r--storage/spider/mysql-test/spider/t/timestamp.test542
-rw-r--r--storage/spider/mysql-test/spider/t/timestamp_deinit.inc13
-rw-r--r--storage/spider/mysql-test/spider/t/timestamp_init.inc62
-rw-r--r--storage/spider/mysql-test/spider/t/udf_pushdown.inc50
-rw-r--r--storage/spider/mysql-test/spider/t/udf_pushdown.test141
-rw-r--r--storage/spider/mysql-test/spider/t/variable_deprecation.test137
-rw-r--r--storage/spider/mysql-test/spider/t/vp_fixes.test335
755 files changed, 60539 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_master_1.inc
new file mode 100644
index 00000000..c19e376d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_master_1.inc
@@ -0,0 +1 @@
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc
new file mode 100644
index 00000000..c19e376d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_1.inc
@@ -0,0 +1 @@
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc
new file mode 100644
index 00000000..c19e376d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_2.inc
@@ -0,0 +1 @@
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc
new file mode 100644
index 00000000..c19e376d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child3_3.inc
@@ -0,0 +1 @@
+--source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc
new file mode 100644
index 00000000..26848294
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc
@@ -0,0 +1,8 @@
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc
new file mode 100644
index 00000000..205eaa6f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc
@@ -0,0 +1,4 @@
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc
new file mode 100644
index 00000000..55cb8583
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc
@@ -0,0 +1,4 @@
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc
new file mode 100644
index 00000000..3ac4f97b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc
@@ -0,0 +1,140 @@
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc
new file mode 100644
index 00000000..cf47099f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc
@@ -0,0 +1,140 @@
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc
new file mode 100644
index 00000000..094d26b6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc
@@ -0,0 +1,140 @@
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc
new file mode 100644
index 00000000..78797d80
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc
@@ -0,0 +1,105 @@
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $MASTER_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $MASTER_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $MASTER_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $MASTER_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $MASTER_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+let $MASTER_1_COPY_TABLES_2_1=
+ SELECT spider_copy_tables('ta_l', '0', '1');
+
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_HA_2_1=
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $MASTER_1_COMMENT_HA_AS_2_1=
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_HA_2_1=
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $MASTER_1_COMMENT_HA_AS_2_1=
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $MASTER_1_COMMENT_HA_P_2_1=
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $MASTER_1_COMMENT_HA_AS_P_2_1=
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $MASTER_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $MASTER_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $MASTER_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
+let $MASTER_1_COPY_TABLES_P_2_1=
+ SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
+let $MASTER_1_CHECK_HA_STATUS=
+ SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+let $MASTER_1_CHANGE_HA_MON=
+ SELECT spider_flush_table_mon_cache();
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_2.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_deinit_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/bg/include/hs_deinit_master_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_deinit_master_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc
new file mode 100644
index 00000000..ee006858
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_1.inc
@@ -0,0 +1,24 @@
+let $CHILD2_1_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r;
+let $CHILD2_1_HS_CREATE_TABLES=
+ CREATE TABLE hs_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES2=
+ DROP TABLE IF EXISTS hs_r2;
+let $CHILD2_1_HS_CREATE_TABLES2=
+ CREATE TABLE hs_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc
new file mode 100644
index 00000000..1c5a02d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_2.inc
@@ -0,0 +1,12 @@
+let $CHILD2_2_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r3;
+let $CHILD2_2_HS_CREATE_TABLES=
+ CREATE TABLE hs_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_init_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/bg/include/hs_init_master_1.inc
new file mode 100644
index 00000000..a43e9956
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/hs_init_master_1.inc
@@ -0,0 +1,12 @@
+let $MASTER_1_HS_COMMENT_TMP=
+ COMMENT='';
+let $MASTER_1_HS_COMMENT_2_1=
+ COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT", hwr "0"';
+let $MASTER_1_HS_COMMENT_P_2_1=
+ COMMENT='uhr "1", uhw "1", hwr "0"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4)
+ COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"'
+ );
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc
new file mode 100644
index 00000000..611ce601
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc
@@ -0,0 +1,175 @@
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r;
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+let $CHILD2_1_DROP_TABLES2=
+ DROP TABLE IF EXISTS ta_r2;
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE ta_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
+let $CHILD2_1_DROP_TABLES3=
+ DROP TABLE IF EXISTS ta_r_no_idx;
+let $CHILD2_1_CREATE_TABLES3=
+ CREATE TABLE ta_r_no_idx (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
+let $CHILD2_1_DROP_TABLES4=
+ DROP TABLE IF EXISTS ta_r_auto_inc;
+let $CHILD2_1_CREATE_TABLES4=
+ CREATE TABLE ta_r_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
+ ORDER BY a;
+let $CHILD2_1_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_1_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT a, b, c FROM ta_r_int ORDER BY a;
+let $CHILD2_1_DROP_TABLES6=
+ DROP TABLE IF EXISTS ta_r_3;
+let $CHILD2_1_CREATE_TABLES6=
+ CREATE TABLE ta_r_3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r;
+let $CHILD2_1_CREATE_FT_TABLES=
+ CREATE TABLE ft_r (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES2=
+ DROP TABLE IF EXISTS ft_r2;
+let $CHILD2_1_CREATE_FT_TABLES2=
+ CREATE TABLE ft_r2 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT a, b, c, d FROM ft_r2 ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r;
+let $CHILD2_1_CREATE_GM_TABLES=
+ CREATE TABLE gm_r (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES2=
+ DROP TABLE IF EXISTS gm_r2;
+let $CHILD2_1_CREATE_GM_TABLES2=
+ CREATE TABLE gm_r2 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT a, b, c FROM gm_r2 ORDER BY a;
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_2;
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_1 ORDER BY id;
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY (a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT a FROM t1 ORDER BY a;
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT a, b FROM t1 ORDER BY a, b;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc
new file mode 100644
index 00000000..9f0b5e2f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc
@@ -0,0 +1,80 @@
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r3;
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE ta_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_2_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
+let $CHILD2_2_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r3;
+let $CHILD2_2_CREATE_FT_TABLES=
+ CREATE TABLE ft_r3 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r3 ORDER BY a;
+let $CHILD2_2_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r3;
+let $CHILD2_2_CREATE_GM_TABLES=
+ CREATE TABLE gm_r3 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r3 ORDER BY a;
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_1;
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_2 ORDER BY id;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc
new file mode 100644
index 00000000..05dbb1c3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc
@@ -0,0 +1,11 @@
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r4;
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE ta_r4 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+let $CHILD2_3_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/init_child3_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_child3_1.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/init_child3_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_child3_2.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/init_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/init_child3_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_child3_3.inc
diff --git a/storage/spider/mysql-test/spider/bg/include/init_master_1.inc b/storage/spider/mysql-test/spider/bg/include/init_master_1.inc
new file mode 100644
index 00000000..d6e302a6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_master_1.inc
@@ -0,0 +1,194 @@
+--source ../../include/init_spider.inc
+SET spider_internal_sql_log_off= 0;
+SET spider_bgs_mode= 1;
+SET spider_bgs_first_read= 2;
+SET spider_bgs_second_read= 2;
+SET spider_split_read= 2;
+SET spider_conn_recycle_mode= 2;
+SET spider_multi_split_read= 1;
+SET spider_reset_sql_alloc= 0;
+SET spider_bulk_update_size= 40;
+SET spider_direct_order_limit= 10000;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT2_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_no_idx"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password "", prt "2000000"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT2_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_no_idx"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password "", prt "2000000"';
+}
+let $MASTER_1_COMMENT_P_2_1=
+ COMMENT='table "ta_r3"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001"'
+ );
+let $MASTER_1_COMMENT2_P_2_1=
+ COMMENT='table "ta_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
+ table "ta_r2", priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT3_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_auto_inc"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT3_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_auto_inc"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+let $MASTER_1_COMMENT3_P_2_1=
+ COMMENT='table "ta_r_int"'
+ PARTITION BY LIST(MOD(a, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='srv "s_2_1", priority "1000"',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT4_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_int"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT4_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_int"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT5_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_3"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT5_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_3"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_FT_2_1=
+ COMMENT='database "auto_test_remote", table "ft_r"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_FT_2_1=
+ COMMENT='database "auto_test_remote", table "ft_r"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+let $MASTER_1_COMMENT2_FT_P_2_1=
+ COMMENT='table "ft_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
+ table "ft_r2", priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+let $MASTER_1_COMMENT_GM_2_1=
+ COMMENT='srv "s_2_1", table "gm_r"';
+let $MASTER_1_COMMENT2_GM_P_2_1=
+ COMMENT='table "gm_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
+ table "gm_r2", priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+let $MASTER_1_COMMENT_LOCK1=
+ COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2"';
+let $MASTER_1_COMMENT_LOCK2=
+ COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1"';
+let $MASTER_1_COMMENT_INCREMENT1_1=
+ COMMENT 'aim "1", tbl "t1_1", srv "s_2_1"';
+let $MASTER_1_COMMENT_INCREMENT1_P_1=
+ COMMENT 'aim "1"'
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='tbl "t1_1", srv "s_2_1"',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT='tbl "t1_2", srv "s_2_2"'
+ );
+let $MASTER_1_COMMENT_READONLY1_1=
+ COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1"';
+let $MASTER_1_COMMENT_ERROR_MODE1_1=
+ COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1"';
+let $MASTER_1_COMMENT_TEXT_PK1_1=
+ COMMENT 'tbl "t1", srv "s_2_1"';
+let $MASTER_1_COMMENT_TEXT_KEY1_1=
+ COMMENT 'tbl "t1", srv "s_2_1"';
+let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_update';
+let $MASTER_1_CHECK_DIRECT_DELETE_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_delete';
+let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_order_limit';
+let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_aggregate';
+let $MASTER_1_AUTO_INCREMENT_INCREMENT1=
+ SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_INCREMENT2=
+ SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_OFFSET1=
+ SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_OFFSET2=
+ SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_OFFSET3=
+ SET SESSION AUTO_INCREMENT_OFFSET = 1;
+let $MASTER_1_AUTO_INCREMENT_OFFSET4=
+ SET SESSION AUTO_INCREMENT_OFFSET = 777;
diff --git a/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc
new file mode 100644
index 00000000..73c3c6b9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc
@@ -0,0 +1,10 @@
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/bg/my.cnf b/storage/spider/mysql-test/spider/bg/my.cnf
new file mode 100644
index 00000000..246099c6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/my.cnf
@@ -0,0 +1,176 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1.1]
+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
+
+[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
+
+[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
+
+[mysqld.2.3]
+
+[mysqld.3.1]
+loose_partition= 1
+
+[mysqld.3.2]
+loose_partition= 1
+
+[mysqld.3.3]
+loose_partition= 1
+
+[mysqld.4.1]
+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
+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
+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_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_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
+CHILD2_1_FT_MYPORT= @mysqld.1.1.port
+CHILD2_1_FT_MYSOCK= @mysqld.1.1.socket
+CHILD2_1_FT_ENGINE_TYPE= MyISAM
+CHILD2_1_FT_ENGINE= ENGINE=MyISAM
+CHILD2_1_FT_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_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
+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
+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
+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
+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
+
+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
+# 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
+# CHILD2_2_DROP_TABLES
+# CHILD2_2_CREATE_TABLES
+# CHILD2_2_SELECT_TABLES
diff --git a/storage/spider/mysql-test/spider/bg/r/basic_sql.result b/storage/spider/mysql-test/spider/bg/r/basic_sql.result
new file mode 100644
index 00000000..94a09fc3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/basic_sql.result
@@ -0,0 +1,738 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+create table ignore select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'f', '2008-07-01 10:21:39'),
+(2, 'g', '2000-02-01 00:00:00'),
+(3, 'j', '2007-05-04 20:03:11'),
+(4, 'i', '2003-10-30 05:01:03'),
+(5, 'h', '2001-10-31 23:59:59');
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+IGNORE SELECT a, b, c FROM tb_l
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+create table ignore select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+REPLACE SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+create no index table
+connection master_1;
+DROP TABLE IF EXISTS ta_l_no_idx;
+CREATE TABLE ta_l_no_idx
+MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table shared mode
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+LOCK IN SHARE MODE;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table for update
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+FOR UPDATE;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table join
+connection master_1;
+SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
+WHERE a.a = b.a ORDER BY a.a;
+a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table straight_join
+connection master_1;
+SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
+FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
+a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_small_result
+connection master_1;
+SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_big_result
+connection master_1;
+SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_buffer_result
+connection master_1;
+SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_cache
+connection master_1;
+SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_no_cache
+connection master_1;
+SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_calc_found_rows
+connection master_1;
+SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a LIMIT 4;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+connection master_1;
+SELECT found_rows();
+found_rows()
+5
+
+select high_priority
+connection master_1;
+SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select distinct
+connection master_1;
+SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select count
+connection master_1;
+SELECT count(*) FROM ta_l ORDER BY a;
+count(*)
+5
+
+select table join not use index
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
+EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select using pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+select using index and pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.a > 0 AND a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+insert
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert select
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+insert select a
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+
+insert low_priority
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert high_priority
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
+'2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert ignore
+connection master_1;
+INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert update (insert)
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert update (update)
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 f 2005-08-08 11:11:11
+
+replace
+connection master_1;
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 f 2008-02-02 02:02:02
+
+replace select
+connection master_1;
+REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+replace select a
+connection master_1;
+REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+replace low_priority
+connection master_1;
+REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
+'2009-03-03 03:03:03');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+2 g 2000-02-01 00:00:00
+3 g 2009-03-03 03:03:03
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+update
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+2 f 2008-02-02 02:02:02
+
+update select
+connection master_1;
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
+tb_l);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 g 2009-03-03 03:03:03
+
+update select a
+connection master_1;
+UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
+tb_l ORDER BY a LIMIT 1);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 h 2010-04-04 04:04:04
+2 g 2009-03-03 03:03:03
+
+update join
+connection master_1;
+UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+
+update join a
+connection master_1;
+UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
+a.a = b.a;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 g 2009-03-03 03:03:03
+
+update low_priority
+connection master_1;
+UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 f 2008-02-02 02:02:02
+
+update ignore
+connection master_1;
+UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 f 2008-02-02 02:02:02
+
+update pushdown
+connection master_1;
+update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 j 2009-03-03 03:03:03
+
+update index pushdown
+connection master_1;
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 g 2009-03-03 03:03:03
+
+delete
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete all
+connection master_1;
+DELETE FROM ta_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+
+delete select
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete select a
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete join
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete low_priority
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete ignore
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE IGNORE FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete quick
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE QUICK FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE b = 'e';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+10 j 2008-01-01 23:59:59
+
+delete index pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a > 0 AND b = 'e';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+10 j 2008-01-01 23:59:59
+
+truncate
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/basic_sql_part.result b/storage/spider/mysql-test/spider/bg/r/basic_sql_part.result
new file mode 100644
index 00000000..0f402940
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/basic_sql_part.result
@@ -0,0 +1,141 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'f', '2008-07-01 10:21:39'),
+(2, 'g', '2000-02-01 00:00:00'),
+(3, 'j', '2007-05-04 20:03:11'),
+(4, 'i', '2003-10-30 05:01:03'),
+(5, 'h', '2001-10-31 23:59:59');
+
+create table with partition and select test
+connection master_1;
+CREATE TABLE ta_l2 (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
+SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select partition using pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+select partition using index pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+a.a > 0 AND a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+update partition pushdown
+connection master_1;
+UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 e 2009-03-03 03:03:03
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+update partition index pushdown
+connection master_1;
+UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2009-03-03 03:03:03
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+delete partition pushdown
+TRUNCATE TABLE ta_l2;
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+connection master_1;
+DELETE FROM ta_l2 WHERE b = 'g';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+delete partition index pushdown
+TRUNCATE TABLE ta_l2;
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+connection master_1;
+DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/direct_aggregate.result b/storage/spider/mysql-test/spider/bg/r/direct_aggregate.result
new file mode 100644
index 00000000..9a8660ba
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/direct_aggregate.result
@@ -0,0 +1,100 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+direct_aggregating test
+connection master_1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT COUNT(*) FROM ta_l;
+COUNT(*)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MAX(a) FROM ta_l;
+MAX(a)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MIN(a) FROM ta_l;
+MIN(a)
+1
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+MAX(a)
+4
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/bg/r/direct_aggregate_part.result
new file mode 100644
index 00000000..9d65fcc2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/direct_aggregate_part.result
@@ -0,0 +1,121 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+with partition test
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT COUNT(*) FROM ta_l2;
+COUNT(*)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 4
+SELECT SUM(a) FROM ta_l2;
+SUM(a)
+15
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MAX(a) FROM ta_l2;
+MAX(a)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MIN(a) FROM ta_l2;
+MIN(a)
+1
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+MAX(a)
+4
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SET spider_direct_aggregate=0;
+SELECT COUNT(*) FROM ta_l2;
+COUNT(*)
+5
+SELECT SUM(a) FROM ta_l2;
+SUM(a)
+15
+SELECT MAX(a) FROM ta_l2;
+MAX(a)
+5
+SELECT MIN(a) FROM ta_l2;
+MIN(a)
+1
+SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+MAX(a)
+4
+SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/direct_update.result b/storage/spider/mysql-test/spider/bg/r/direct_update.result
new file mode 100644
index 00000000..0e536d48
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/direct_update.result
@@ -0,0 +1,155 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+direct_updating test
+connection master_1;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 0
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+update all rows with function
+UPDATE ta_l SET c = ADDDATE(c, 1);
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 e 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key
+UPDATE ta_l SET b = 'x' WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 2
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by a column without index
+UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-17 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key with order and limit
+UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 4
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by primary key with order and limit
+DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by a column without index
+DELETE FROM ta_l WHERE b = 'c';
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 2
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+delete by primary key
+DELETE FROM ta_l WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+4 d 2003-12-01 05:01:03
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/direct_update_part.result b/storage/spider/mysql-test/spider/bg/r/direct_update_part.result
new file mode 100644
index 00000000..7069cd72
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/direct_update_part.result
@@ -0,0 +1,145 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+with partition test
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 0
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+update all rows with function
+UPDATE ta_l2 SET c = ADDDATE(c, 1);
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 2
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 e 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key
+UPDATE ta_l2 SET b = 'x' WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by a column without index
+UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 5
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-17 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key with order and limit
+UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 6
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by primary key with order and limit
+DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by a column without index
+DELETE FROM ta_l2 WHERE b = 'c';
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+delete by primary key
+DELETE FROM ta_l2 WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 4
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+4 d 2003-12-01 05:01:03
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/function.result b/storage/spider/mysql-test/spider/bg/r/function.result
new file mode 100644
index 00000000..c088a8a9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/function.result
@@ -0,0 +1,160 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+in()
+connection master_1;
+CREATE TABLE t1 (
+a VARCHAR(255),
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1
+insert into t1 values ('1');
+insert into t1 select a + 1 from t1;
+insert into t1 select a + 2 from t1;
+insert into t1 select a + 4 from t1;
+insert into t1 select a + 8 from t1;
+insert into t1 select a + 16 from t1;
+insert into t1 select a + 32 from t1;
+insert into t1 select a + 64 from t1;
+insert into t1 select a + 128 from t1;
+insert into t1 select a + 256 from t1;
+insert into t1 select a + 512 from t1;
+flush tables;
+connection master_1;
+select a from t1 where a in ('15', '120');
+a
+120
+15
+
+date_sub()
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-08-01 10:21:39
+2 b 1999-01-01 00:00:00
+3 e 2006-06-04 20:03:11
+4 d 2002-11-30 05:01:03
+5 c 2000-12-31 23:59:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-11-01 10:21:39
+2 b 1999-04-01 00:00:00
+3 e 2006-09-04 20:03:11
+4 d 2003-02-28 05:01:03
+5 c 2001-03-31 23:59:59
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-01 10:21:39
+2 b 1999-03-01 00:00:00
+3 e 2006-08-04 20:03:11
+4 d 2003-01-28 05:01:03
+5 c 2001-02-28 23:59:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-08 10:21:39
+2 b 1999-03-08 00:00:00
+3 e 2006-08-11 20:03:11
+4 d 2003-02-04 05:01:03
+5 c 2001-03-07 23:59:59
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 10:21:39
+2 b 1999-03-07 00:00:00
+3 e 2006-08-10 20:03:11
+4 d 2003-02-03 05:01:03
+5 c 2001-03-06 23:59:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 11:21:39
+2 b 1999-03-07 01:00:00
+3 e 2006-08-10 21:03:11
+4 d 2003-02-03 06:01:03
+5 c 2001-03-07 00:59:59
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 11:20:39
+2 b 1999-03-07 00:59:00
+3 e 2006-08-10 21:02:11
+4 d 2003-02-03 06:00:03
+5 c 2001-03-07 00:58:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 11:20:40
+2 b 1999-03-07 00:59:01
+3 e 2006-08-10 21:02:12
+4 d 2003-02-03 06:00:04
+5 c 2001-03-07 00:59:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/ha.result b/storage/spider/mysql-test/spider/bg/r/ha.result
new file mode 100644
index 00000000..3c37c2d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/ha.result
@@ -0,0 +1,286 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 0
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote2.ta_r3' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 3
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l 1
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l
+CONNECTION='host "localhost", user "root", password "",
+ msi "5", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 2
+SELECT spider_copy_tables('ta_l', '0', '1');
+spider_copy_tables('ta_l', '0', '1')
+1
+connection master_1;
+ALTER TABLE ta_l
+CONNECTION='host "localhost", user "root", password "",
+ msi "5", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 1
+INSERT INTO ta_l (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+8 g 2011-05-05 21:33:30
+DROP TABLE ta_l;
+connection master_1;
+SELECT spider_flush_table_mon_cache();
+spider_flush_table_mon_cache()
+1
+
+active standby test
+create table test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 2
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote.ta_r' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 3
+auto_test_local ta_l 1 1
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l 1
+auto_test_local ta_l 0
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 2
+Spider_mon_table_cache_version_req 2
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l
+CONNECTION='host "localhost", user "root", password "",
+ msi "5", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 1
+INSERT INTO ta_l (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+8 g 2011-05-05 21:33:30
+DROP TABLE ta_l;
+connection master_1;
+SELECT spider_flush_table_mon_cache();
+spider_flush_table_mon_cache()
+1
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/ha_part.result b/storage/spider/mysql-test/spider/bg/r/ha_part.result
new file mode 100644
index 00000000..39fa2655
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/ha_part.result
@@ -0,0 +1,311 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table with partition test
+connection master_1;
+DROP TABLE IF EXISTS ta_l2;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l2 (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 0
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote3.ta_r4' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 3
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l2#P#pt2 1
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l2
+PARTITION BY KEY(a) (
+PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 2
+SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
+spider_copy_tables('ta_l2#P#pt2', '0', '1')
+1
+connection master_1;
+ALTER TABLE ta_l2
+PARTITION BY KEY(a) (
+PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30'),
+(9, 'h', '2011-05-05 22:32:10');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+8 g 2011-05-05 21:33:30
+9 h 2011-05-05 22:32:10
+DROP TABLE ta_l2;
+
+create table with partition test
+connection master_1;
+DROP TABLE IF EXISTS ta_l2;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l2 (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote.ta_r2' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 3
+auto_test_local ta_l2#P#pt2 1 1
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l2#P#pt2 1
+auto_test_local ta_l2#P#pt2 0
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+3 e 2007-06-04 20:03:11
+5 c 2001-12-31 23:59:59
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l2
+PARTITION BY KEY(a) (
+PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30'),
+(9, 'h', '2011-05-05 22:32:10');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+3 e 2007-06-04 20:03:11
+5 c 2001-12-31 23:59:59
+8 g 2011-05-05 21:33:30
+9 h 2011-05-05 22:32:10
+DROP TABLE ta_l2;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
new file mode 100644
index 00000000..aa734573
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
@@ -0,0 +1,224 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+3.1
+auto_increment
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t2;
+MAX(id)
+1554
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+778
+SELECT MAX(id) FROM t1;
+MAX(id)
+1554
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t2;
+MAX(id)
+2331
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1555
+SELECT id FROM t1 ORDER BY id;
+id
+777
+778
+1554
+1555
+2331
+2332
+3109
+3886
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3108
+SELECT id FROM t2 ORDER BY id;
+id
+777
+778
+1554
+1555
+2331
+2332
+3108
+3109
+3885
+3886
+4662
+5439
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t2 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+6993
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+5000
+10000
+connection master_1;
+
+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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
new file mode 100644
index 00000000..b793346d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
@@ -0,0 +1,222 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+auto_increment with partition
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t2;
+MAX(id)
+1554
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+778
+SELECT MAX(id) FROM t1;
+MAX(id)
+1554
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t2;
+MAX(id)
+2331
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1555
+SELECT id FROM t1 ORDER BY id;
+id
+777
+778
+1554
+1555
+2331
+2332
+3109
+3886
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3108
+SELECT id FROM t2 ORDER BY id;
+id
+777
+778
+1554
+1555
+2331
+2332
+3108
+3109
+3885
+3886
+4662
+5439
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t2 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+6993
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+5000
+10000
+connection master_1;
+
+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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
new file mode 100644
index 00000000..51045e0b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
@@ -0,0 +1,616 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+2.13
+select table with "order by desc" and "<"
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a < 5 ORDER BY a DESC LIMIT 3;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+4 d 2003-11-30 05:01:03
+3 e 2007-06-04 20:03:11
+2 b 2000-01-01 00:00:00
+
+select table with "order by desc" and "<="
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a <= 5 ORDER BY a DESC LIMIT 3;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+5 c 2001-12-31 23:59:59
+4 d 2003-11-30 05:01:03
+3 e 2007-06-04 20:03:11
+
+2.14
+update table with range scan and split_read
+connection master_1;
+UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+2 b 2000-02-02 00:00:00
+3 e 2000-02-02 00:00:00
+4 d 2000-02-02 00:00:00
+5 c 2000-02-02 00:00:00
+
+2.15
+select table with range scan
+TRUNCATE TABLE ta_l;
+DROP TABLE IF EXISTS ta_l;
+connection master_1;
+CREATE TABLE ta_l (
+a int(11) NOT NULL DEFAULT '0',
+b char(1) DEFAULT NULL,
+c datetime DEFAULT NULL,
+PRIMARY KEY (a, b, c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
+AND c = '2001-12-31 23:59:59';
+a b c
+5 c 2001-12-31 23:59:59
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+a b c
+2 b 2000-01-01 00:00:00
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+a b c
+2 b 2000-01-01 00:00:00
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND b <= 'd' AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND b < 'e' AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
+AND b >= 'b' AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
+AND b >= 'b' AND c = '2000-01-01 00:00:00';
+a b c
+2 b 2000-01-01 00:00:00
+
+2.16
+auto_increment insert with trigger
+connection master_1;
+CREATE TABLE ta_l_auto_inc (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tc_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;;
+connection master_1;
+INSERT INTO ta_l_auto_inc (a, b, c) VALUES
+(NULL, 's', '2008-12-31 20:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 s 2008-12-31 20:59:59
+
+2.17
+engine-condition-pushdown with "or" and joining
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+2 b 2000-01-01 00:00:00
+3 e 2007-06-04 20:03:11
+4 d 2003-11-30 05:01:03
+5 c 2001-12-31 23:59:59
+
+2.23
+index merge
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+connection master_1;
+SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+a b c
+3 4 5
+4 5 6
+5 6 7
+
+2.24
+index scan update without PK
+connection master_1;
+DROP TABLE IF EXISTS ta_l_int;
+CREATE TABLE ta_l_int (
+a INT NOT NULL,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+a b c
+1 2 3
+2 3 4
+3 4 5
+4 5 6
+5 6 7
+6 7 8
+7 8 9
+8 9 10
+9 10 11
+10 11 12
+11 12 13
+12 13 14
+13 14 15
+14 15 16
+15 16 17
+16 17 18
+INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
+INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
+connection master_1;
+UPDATE ta_l_int SET c = 4 WHERE b = 2;
+connection master_1;
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+a b c
+1 2 4
+2 3 4
+3 4 5
+4 5 6
+5 6 7
+6 7 8
+7 8 9
+8 9 10
+9 10 11
+10 11 12
+11 12 13
+12 13 14
+13 14 15
+14 15 16
+15 16 17
+16 17 18
+17 2 4
+18 2 4
+
+2.25
+direct order limit
+connection master_1;
+SHOW STATUS LIKE 'Spider_direct_order_limit';
+Variable_name Value
+Spider_direct_order_limit 2
+SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
+a b c
+1 2 4
+2 3 4
+3 4 5
+SHOW STATUS LIKE 'Spider_direct_order_limit';
+Variable_name Value
+Spider_direct_order_limit 3
+
+2.26
+lock tables
+connection master_1;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+CREATE TABLE t2 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+LOCK TABLES t1 READ, t2 READ;
+UNLOCK TABLES;
+
+auto_increment
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t1;
+MAX(id)
+1554
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t1;
+MAX(id)
+2331
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3108
+SELECT MAX(id) FROM t1;
+MAX(id)
+3108
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t1 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1000
+1554
+2331
+3108
+3885
+4662
+5000
+5439
+6216
+10000
+connection master_1;
+
+read only
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1000
+1554
+2331
+3108
+3885
+4662
+5000
+5439
+6216
+10000
+INSERT INTO t1 (id) VALUES (1);
+ERROR HY000: Table 'auto_test_local.t1' is read only
+UPDATE t1 SET id = 4 WHERE id = 777;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+DELETE FROM t1 WHERE id = 777;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+DELETE FROM t1;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+TRUNCATE t1;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+
+2.27
+error mode
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1
+SELECT id FROM t1 ORDER BY id;
+id
+Warnings:
+Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+INSERT INTO t1 (id) VALUES (1);
+Warnings:
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+DELETE FROM t1;
+Warnings:
+Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
+Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+TRUNCATE t1;
+Warnings:
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+
+3.0
+is null
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a VARCHAR(255),
+b VARCHAR(255),
+c VARCHAR(255),
+KEY idx1(a,b),
+KEY idx2(b),
+PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1
+insert into t1 values (null, null, '2048');
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a + 32, b + 32, c + 32 from t1;
+insert into t1 select a + 64, b + 64, c + 64 from t1;
+insert into t1 select a + 128, b + 128, c + 128 from t1;
+insert into t1 select a + 256, b + 256, c + 256 from t1;
+insert into t1 select a + 512, b + 512, c + 512 from t1;
+flush tables;
+connection master_1;
+select a from t1 where a is null order by a limit 30;
+a
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select b from t1 where b is null order by b limit 30;
+b
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+direct_order_limit
+connection master_1;
+TRUNCATE TABLE t1;
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a, b + 32, c + 32 from t1;
+insert into t1 select a, b + 64, c + 64 from t1;
+insert into t1 select a, b + 128, c + 128 from t1;
+flush tables;
+connection master_1;
+select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
+a b c
+10 74 74
+10 42 42
+10 234 234
+10 202 202
+10 170 170
+select a, c from t1 where a = '10' order by b desc limit 5;
+a c
+10 74
+10 42
+10 234
+10 202
+10 170
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result
new file mode 100644
index 00000000..faf0b6ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result
@@ -0,0 +1,237 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+2.17
+partition with sort
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 b 2000-01-01 00:00:00
+3 e 2007-06-04 20:03:11
+4 d 2003-11-30 05:01:03
+5 c 2001-12-31 23:59:59
+
+2.23
+partition update with moving partition
+connection master_1;
+DROP TABLE IF EXISTS ta_l2;
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
+UPDATE ta_l2 SET a = 4 WHERE a = 3;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+4 B 2010-09-26 00:00:00
+index merge with partition
+connection master_1;
+DROP TABLE IF EXISTS ta_l_int;
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1
+INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+connection master_1;
+SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+a b c
+3 4 5
+4 5 6
+5 6 7
+
+2.26
+auto_increment with partition
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t1;
+MAX(id)
+1554
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t1;
+MAX(id)
+2331
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3108
+SELECT MAX(id) FROM t1;
+MAX(id)
+3108
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t1 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1000
+1554
+2331
+3108
+3885
+4662
+5000
+5439
+6216
+10000
+connection master_1;
+
+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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/r/vp_fixes.result b/storage/spider/mysql-test/spider/bg/r/vp_fixes.result
new file mode 100644
index 00000000..cc0e4105
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/r/vp_fixes.result
@@ -0,0 +1,93 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+0.9
+create different primary key table
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT DEFAULT 10,
+b INT AUTO_INCREMENT,
+c INT DEFAULT 11,
+PRIMARY KEY(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+connection master_1;
+INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+create un-correspond primary key table
+connection master_1;
+DROP TABLE IF EXISTS ta_l_int;
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT DEFAULT 10,
+b INT DEFAULT 12,
+c INT DEFAULT 11,
+PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+connection master_1;
+INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/bg/suite.opt b/storage/spider/mysql-test/spider/bg/suite.opt
new file mode 100644
index 00000000..672a3b37
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/suite.opt
@@ -0,0 +1 @@
+--loose-innodb --loose-skip-performance-schema
diff --git a/storage/spider/mysql-test/spider/bg/suite.pm b/storage/spider/mysql-test/spider/bg/suite.pm
new file mode 100644
index 00000000..171fa6c4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/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/bg/t/basic_sql.test b/storage/spider/mysql-test/spider/bg/t/basic_sql.test
new file mode 100644
index 00000000..f680cd43
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/basic_sql.test
@@ -0,0 +1,2701 @@
+# This test tests by executing basic SQL
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SELECT a, b, c FROM tb_l;
+if ($MASTER_1_MERGE)
+{
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_MERGE)
+{
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ SELECT a, b, c FROM tb_l;
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo create table ignore select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'f', '2008-07-01 10:21:39'),
+ (2, 'g', '2000-02-01 00:00:00'),
+ (3, 'j', '2007-05-04 20:03:11'),
+ (4, 'i', '2003-10-30 05:01:03'),
+ (5, 'h', '2001-10-31 23:59:59');
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+IGNORE SELECT a, b, c FROM tb_l;
+if ($MASTER_1_MERGE)
+{
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ IGNORE SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_MERGE)
+{
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ IGNORE SELECT a, b, c FROM tb_l;
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo create table ignore select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+REPLACE SELECT a, b, c FROM tb_l;
+if ($MASTER_1_MERGE)
+{
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ REPLACE SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ REPLACE INTO ta_l SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_MERGE)
+{
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ REPLACE SELECT a, b, c FROM tb_l;
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo create no index table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l_no_idx;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l_no_idx
+MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+SELECT a, b, c FROM tb_l;
+if ($MASTER_1_NEEDPK)
+{
+ --error ER_REQUIRES_PRIMARY_KEY
+ eval CREATE TABLE ta_l_no_idx
+ $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l_no_idx (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+ INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_NEEDPK)
+{
+ if ($MASTER_1_MERGE)
+ {
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l_no_idx
+ $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l_no_idx (
+ a INT,
+ b CHAR(1),
+ c DATETIME
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+ INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
+ }
+ if (!$MASTER_1_MERGE)
+ {
+ eval CREATE TABLE ta_l_no_idx
+ $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
+ SELECT a, b, c FROM tb_l;
+ }
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES3;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
+
+--echo
+--echo select table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table shared mode
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+LOCK IN SHARE MODE;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table for update
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+FOR UPDATE;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table join
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
+WHERE a.a = b.a ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table straight_join
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
+FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_small_result
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_big_result
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_buffer_result
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_cache
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_no_cache
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_calc_found_rows
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a LIMIT 4;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT found_rows();
+--enable_ps2_protocol
+
+--echo
+--echo select high_priority
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select distinct
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select count
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT count(*) FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table join not use index
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
+EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select using pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.b = 'g' ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select using index and pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.a > 0 AND a.b = 'g' ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo insert
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert select
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert select a
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert low_priority
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert high_priority
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
+'2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert ignore
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert update (insert)
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert update (update)
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace
+--connection master_1
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace select
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace select a
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace low_priority
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
+'2009-03-03 03:03:03');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update select
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
+tb_l);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update select a
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
+tb_l ORDER BY a LIMIT 1);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update join
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update join a
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
+a.a = b.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update low_priority
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update ignore
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update index pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete all
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete select
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete select a
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete join
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete low_priority
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete ignore
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE IGNORE FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete quick
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE QUICK FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE b = 'e';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete index pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a > 0 AND b = 'e';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo truncate
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test b/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test
new file mode 100644
index 00000000..1bb18358
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test
@@ -0,0 +1,571 @@
+# This test tests by executing basic SQL
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'f', '2008-07-01 10:21:39'),
+ (2, 'g', '2000-02-01 00:00:00'),
+ (3, 'j', '2007-05-04 20:03:11'),
+ (4, 'i', '2003-10-30 05:01:03'),
+ (5, 'h', '2001-10-31 23:59:59');
+
+--echo
+--echo create table with partition and select test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
+ SELECT a, b, c FROM tb_l;
+ if ($MASTER_1_MERGE)
+ {
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l2 (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ }
+ if (!$MASTER_1_MERGE)
+ {
+ eval CREATE TABLE ta_l2 (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
+ SELECT a, b, c FROM tb_l;
+ }
+ --enable_query_log
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo select partition using pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+ a.b = 'g' ORDER BY a.a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo select partition using index pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+ a.a > 0 AND a.b = 'g' ORDER BY a.a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo update partition pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo update partition index pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo delete partition pushdown
+if ($HAVE_PARTITION)
+{
+ TRUNCATE TABLE ta_l2;
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ DELETE FROM ta_l2 WHERE b = 'g';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo delete partition index pushdown
+if ($HAVE_PARTITION)
+{
+ TRUNCATE TABLE ta_l2;
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/bg/t/connect_child2_1.inc
new file mode 100644
index 00000000..cd9b0c9c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_child2_1.inc
@@ -0,0 +1 @@
+--connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/bg/t/connect_child2_2.inc
new file mode 100644
index 00000000..e145f66b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_child2_2.inc
@@ -0,0 +1 @@
+--connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/bg/t/connect_child2_3.inc
new file mode 100644
index 00000000..d356348d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_child2_3.inc
@@ -0,0 +1 @@
+--connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/bg/t/connect_child3_1.inc
new file mode 100644
index 00000000..03e5c188
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_child3_1.inc
@@ -0,0 +1 @@
+--connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/bg/t/connect_child3_2.inc
new file mode 100644
index 00000000..d62a7ada
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_child3_2.inc
@@ -0,0 +1 @@
+--connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/bg/t/connect_child3_3.inc
new file mode 100644
index 00000000..fb49f5bf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_child3_3.inc
@@ -0,0 +1 @@
+--connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_master_1.inc b/storage/spider/mysql-test/spider/bg/t/connect_master_1.inc
new file mode 100644
index 00000000..0c129ce5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_master_1.inc
@@ -0,0 +1 @@
+--connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/bg/t/connect_slave1_1.inc
new file mode 100644
index 00000000..45a82274
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/connect_slave1_1.inc
@@ -0,0 +1 @@
+--connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test b/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test
new file mode 100644
index 00000000..4b330692
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test
@@ -0,0 +1,181 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+--enable_ps2_protocol
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test
new file mode 100644
index 00000000..af35adb0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test
@@ -0,0 +1,210 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ --disable_ps2_protocol
+ set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+ set spider_direct_aggregate=1;
+
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT SUM(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ --enable_ps2_protocol
+
+ SET spider_direct_aggregate=0;
+ SELECT COUNT(*) FROM ta_l2;
+ SELECT SUM(a) FROM ta_l2;
+ SELECT MAX(a) FROM ta_l2;
+ SELECT MIN(a) FROM ta_l2;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+
+ set spider_direct_aggregate=@old_spider_direct_aggregate;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/direct_update.test b/storage/spider/mysql-test/spider/bg/t/direct_update.test
new file mode 100644
index 00000000..94f27e28
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/direct_update.test
@@ -0,0 +1,198 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_updating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update all rows with function
+UPDATE ta_l SET c = ADDDATE(c, 1);
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update by primary key
+UPDATE ta_l SET b = 'x' WHERE a = 3;
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update by a column without index
+UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update by primary key with order and limit
+UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo delete by primary key with order and limit
+DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
+eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo delete by a column without index
+DELETE FROM ta_l WHERE b = 'c';
+eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo delete by primary key
+DELETE FROM ta_l WHERE a = 3;
+eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/direct_update_part.test b/storage/spider/mysql-test/spider/bg/t/direct_update_part.test
new file mode 100644
index 00000000..e8f18825
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/direct_update_part.test
@@ -0,0 +1,211 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update all rows with function
+ UPDATE ta_l2 SET c = ADDDATE(c, 1);
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update by primary key
+ UPDATE ta_l2 SET b = 'x' WHERE a = 3;
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update by a column without index
+ UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update by primary key with order and limit
+ UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo delete by primary key with order and limit
+ DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
+ eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo delete by a column without index
+ DELETE FROM ta_l2 WHERE b = 'c';
+ eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo delete by primary key
+ DELETE FROM ta_l2 WHERE a = 3;
+ eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/function.test b/storage/spider/mysql-test/spider/bg/t/function.test
new file mode 100644
index 00000000..2472e774
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/function.test
@@ -0,0 +1,253 @@
+# This test tests for using functions
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo in()
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TEXT_PK_TABLES1;
+ echo CHILD2_1_CREATE_TEXT_PK_TABLES1;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TEXT_PK_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TEXT_PK_TABLES1;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1;
+eval CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1;
+--enable_query_log
+insert into t1 values ('1');
+insert into t1 select a + 1 from t1;
+insert into t1 select a + 2 from t1;
+insert into t1 select a + 4 from t1;
+insert into t1 select a + 8 from t1;
+insert into t1 select a + 16 from t1;
+insert into t1 select a + 32 from t1;
+insert into t1 select a + 64 from t1;
+insert into t1 select a + 128 from t1;
+insert into t1 select a + 256 from t1;
+insert into t1 select a + 512 from t1;
+flush tables;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+select a from t1 where a in ('15', '120');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo date_sub()
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/ha.test b/storage/spider/mysql-test/spider/bg/t/ha.test
new file mode 100644
index 00000000..1924b908
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/ha.test
@@ -0,0 +1,882 @@
+# This test tests for ha features
+if ($USE_HA_TEST)
+{
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source ha_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ --connection child2_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ SELECT 1;
+ --connection child3_2
+ SELECT 1;
+ --connection child3_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo fail-over test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_HA_DROP_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_HA_DROP_TABLES;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_HA_STATUS;
+--error 12511
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+eval $MASTER_1_CHECK_LINK_STATUS;
+eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+eval $MASTER_1_CHECK_HA_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo recovery test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_HA_CREATE_TABLES;
+ }
+ eval $CHILD2_2_HA_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_RECOVERY_STATUS_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_RECOVERY_STATUS_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_RECOVERY_STATUS_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
+eval $MASTER_1_CHECK_LINK_STATUS;
+eval $MASTER_1_COPY_TABLES_2_1;
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_SET_OK_STATUS_2_1;
+eval $MASTER_1_CHECK_LINK_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+DROP TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+eval $MASTER_1_CHANGE_HA_MON;
+--enable_ps2_protocol
+
+--echo
+--echo active standby test
+--echo create table test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo fail-over test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_DROP_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_HA_AS_DROP_TABLES;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_HA_STATUS;
+--error 12511
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+eval $MASTER_1_CHECK_LINK_STATUS;
+eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+eval $MASTER_1_CHECK_HA_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo recovery test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_CREATE_TABLES;
+ }
+ eval $CHILD2_1_HA_AS_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_AS_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_AS_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_AS_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_SET_OK_STATUS_AS_2_1;
+eval $MASTER_1_CHECK_LINK_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+DROP TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+eval $MASTER_1_CHANGE_HA_MON;
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+--disable_query_log
+--disable_result_log
+--source ha_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+}
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/ha_part.test b/storage/spider/mysql-test/spider/bg/t/ha_part.test
new file mode 100644
index 00000000..33fe9850
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/ha_part.test
@@ -0,0 +1,1017 @@
+# This test tests for ha features
+if ($USE_HA_TEST)
+{
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source ha_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source ha_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ --connection child2_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ SELECT 1;
+ --connection child3_2
+ SELECT 1;
+ --connection child3_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+if ($HAVE_PARTITION)
+{
+ --echo
+ --echo create table with partition test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_P_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_P_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_P_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+ --echo
+ --echo select test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo fail-over test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_HA_DROP_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_HA_DROP_TABLES;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_CHECK_HA_STATUS;
+ --error 12511
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+ eval $MASTER_1_CHECK_HA_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo recovery test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_HA_CREATE_TABLES;
+ }
+ eval $CHILD2_3_HA_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ eval $MASTER_1_COPY_TABLES_P_2_1;
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_P_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_P_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_P_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_SET_OK_STATUS_P_2_1;
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30'),
+ (9, 'h', '2011-05-05 22:32:10');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ DROP TABLE ta_l2;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+if ($HAVE_PARTITION)
+{
+ --echo
+ --echo create table with partition test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+ --echo
+ --echo select test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo fail-over test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_DROP_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_HA_AS_DROP_TABLES2;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_CHECK_HA_STATUS;
+ --error 12511
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+ eval $MASTER_1_CHECK_HA_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo recovery test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_CREATE_TABLES2;
+ }
+ eval $CHILD2_1_HA_AS_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_SET_OK_STATUS_AS_P_2_1;
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30'),
+ (9, 'h', '2011-05-05 22:32:10');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ DROP TABLE ta_l2;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+--disable_query_log
+--disable_result_log
+--source ha_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+}
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc
new file mode 100644
index 00000000..53d0409d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc
@@ -0,0 +1,30 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/ha_deinit_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/ha_deinit_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/ha_deinit_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/ha_deinit_child2_3.inc
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --connection child3_1
+ --source ../include/ha_deinit_child3_1.inc
+ --echo child3_2
+ --connection child3_2
+ --source ../include/ha_deinit_child3_2.inc
+ --echo child3_3
+ --connection child3_3
+ --source ../include/ha_deinit_child3_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc b/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc
new file mode 100644
index 00000000..70576ab1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc
@@ -0,0 +1,30 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/ha_init_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/ha_init_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/ha_init_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/ha_init_child2_3.inc
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --connection child3_1
+ --source ../include/ha_init_child3_1.inc
+ --echo child3_2
+ --connection child3_2
+ --source ../include/ha_init_child3_2.inc
+ --echo child3_3
+ --connection child3_3
+ --source ../include/ha_init_child3_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/have_engine.inc b/storage/spider/mysql-test/spider/bg/t/have_engine.inc
new file mode 100644
index 00000000..64bef749
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/have_engine.inc
@@ -0,0 +1,7 @@
+if (!`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = '$TEST_ENGINE_TYPE'`)
+{
+ SELECT engine, support FROM information_schema.engines;
+ --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine"
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/have_func.inc b/storage/spider/mysql-test/spider/bg/t/have_func.inc
new file mode 100644
index 00000000..e0823e73
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/have_func.inc
@@ -0,0 +1,5 @@
+if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`)
+{
+ SELECT name FROM mysql.func;
+ --let $SKIP_REASON= "Need $TEST_FUNC_NAME function"
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/have_partition.inc b/storage/spider/mysql-test/spider/bg/t/have_partition.inc
new file mode 100644
index 00000000..b6e69947
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/have_partition.inc
@@ -0,0 +1,7 @@
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/have_trigger.inc b/storage/spider/mysql-test/spider/bg/t/have_trigger.inc
new file mode 100644
index 00000000..32de484b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/have_trigger.inc
@@ -0,0 +1,2 @@
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/bg/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/bg/t/hs_test_deinit.inc
new file mode 100644
index 00000000..7ec2e981
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/hs_test_deinit.inc
@@ -0,0 +1,17 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/hs_deinit_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/hs_deinit_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/hs_deinit_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/hs_deinit_child2_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/hs_test_init.inc b/storage/spider/mysql-test/spider/bg/t/hs_test_init.inc
new file mode 100644
index 00000000..831bf479
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/hs_test_init.inc
@@ -0,0 +1,17 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/hs_init_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/hs_init_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/hs_init_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/hs_init_child2_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc
new file mode 100644
index 00000000..e9d99b7a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc
@@ -0,0 +1,6 @@
+# get connection and exist engine test
+--echo for slave1_1
+--connection slave1_1
+STOP SLAVE;
+--source ../include/deinit_slave1_1.inc
+--disconnect slave1_1
diff --git a/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc b/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc
new file mode 100644
index 00000000..739d8897
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc
@@ -0,0 +1,44 @@
+# get connection and exist engine test
+--echo for slave1_1
+--source connect_slave1_1.inc
+--connection slave1_1
+SET SESSION sql_log_bin= 0;
+--let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id`
+--let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE
+--source have_partition.inc
+--source have_trigger.inc
+--source ../include/init_slave1_1.inc
+--source have_engine.inc
+--let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS`
+if (!$SLAVE1_1_SLAVE_STATUS)
+{
+ eval CHANGE MASTER TO
+ MASTER_HOST = '127.0.0.1',
+ MASTER_USER = 'root',
+ MASTER_PASSWORD = '',
+ MASTER_PORT = $MASTER_1_MYPORT
+ ;
+}
+START SLAVE;
+--connection master_1
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+--connection slave1_1
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child2_2
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child2_3
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child3_2
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child3_3
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
new file mode 100644
index 00000000..64d3b657
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
@@ -0,0 +1,294 @@
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+--disable_ps_protocol
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+--enable_ps_protocol
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
new file mode 100644
index 00000000..bcd85f42
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
@@ -0,0 +1,347 @@
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ --disable_ps_protocol
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ --enable_ps_protocol
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
new file mode 100644
index 00000000..061dbac2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
@@ -0,0 +1,1427 @@
+# This test tests for Spider's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+--echo
+--echo 2.13
+--echo select table with "order by desc" and "<"
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a < 5 ORDER BY a DESC LIMIT 3;
+--enable_ps2_protocol
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table with "order by desc" and "<="
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a <= 5 ORDER BY a DESC LIMIT 3;
+--enable_ps2_protocol
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.14
+--echo update table with range scan and split_read
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo 2.15
+--echo select table with range scan
+TRUNCATE TABLE ta_l;
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_CREATE_TABLES6;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES6;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES6;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a int(11) NOT NULL DEFAULT '0',
+ b char(1) DEFAULT NULL,
+ c datetime DEFAULT NULL,
+ PRIMARY KEY (a, b, c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE ta_l (
+ a int(11) NOT NULL DEFAULT '0',
+ b char(1) DEFAULT NULL,
+ c datetime DEFAULT NULL,
+ PRIMARY KEY (a, b, c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+--enable_query_log
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
+AND c = '2001-12-31 23:59:59';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND b <= 'd' AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND b < 'e' AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
+AND b >= 'b' AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
+AND b >= 'b' AND c = '2000-01-01 00:00:00';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.16
+--echo auto_increment insert with trigger
+if ($HAVE_TRIGGER)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_CREATE_TABLES4;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES4;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES4;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+ eval CREATE TABLE ta_l_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+ echo CREATE TABLE tc_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+ eval CREATE TABLE tc_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+ --enable_query_log
+ --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ INSERT INTO ta_l_auto_inc (a, b, c) VALUES
+ (NULL, 's', '2008-12-31 20:59:59');
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES4;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
+}
+
+--echo
+--echo 2.17
+--echo engine-condition-pushdown with "or" and joining
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.23
+--echo index merge
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.24
+--echo index scan update without PK
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l_int;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+if ($MASTER_1_NEEDPK)
+{
+ --error ER_REQUIRES_PRIMARY_KEY
+ eval CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+ eval CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+}
+if (!$MASTER_1_NEEDPK)
+{
+ eval CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+}
+--enable_query_log
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
+INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l_int SET c = 4 WHERE b = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+
+
+--echo
+--echo 2.25
+--echo direct order limit
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
+--disable_ps2_protocol
+SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
+--enable_ps2_protocol
+eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
+
+
+--echo
+--echo 2.26
+--echo lock tables
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_LOCK_TABLES1;
+ echo CHILD2_1_DROP_LOCK_TABLES2;
+ echo CHILD2_1_CREATE_LOCK_TABLES1;
+ echo CHILD2_1_CREATE_LOCK_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_LOCK_TABLES1;
+ eval $CHILD2_1_DROP_LOCK_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_LOCK_TABLES1;
+ eval $CHILD2_1_CREATE_LOCK_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_LOCK_TABLES1;
+ echo CHILD2_2_DROP_LOCK_TABLES2;
+ echo CHILD2_2_CREATE_LOCK_TABLES1;
+ echo CHILD2_2_CREATE_LOCK_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_LOCK_TABLES1;
+ eval $CHILD2_2_DROP_LOCK_TABLES2;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_LOCK_TABLES1;
+ eval $CHILD2_2_CREATE_LOCK_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2;
+--enable_query_log
+LOCK TABLES t1 READ, t2 READ;
+UNLOCK TABLES;
+
+
+--echo
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+--disable_ps_protocol
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+--enable_ps_protocol
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+SET INSERT_ID=5000;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo read only
+let $MASTER_1_ENGINE_IS_SPIDER=
+ `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR
+ '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`;
+if ($MASTER_1_ENGINE_IS_SPIDER)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1;
+ --let $MIN_VAL= `SELECT MIN(id) FROM t1`
+ --enable_query_log
+ SELECT id FROM t1 ORDER BY id;
+ --error 12518
+ INSERT INTO t1 (id) VALUES (1);
+ --error 12518
+ eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL;
+ --error 12518
+ eval DELETE FROM t1 WHERE id = $MIN_VAL;
+ --error 12518
+ DELETE FROM t1;
+ --error 12518
+ TRUNCATE t1;
+}
+if (!$MASTER_1_ENGINE_IS_SPIDER)
+{
+ --echo skipped
+}
+
+
+--echo
+--echo 2.27
+--echo error mode
+if ($MASTER_1_ENGINE_IS_SPIDER)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1;
+ --enable_query_log
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t1 (id) VALUES (1);
+ DELETE FROM t1;
+ TRUNCATE t1;
+}
+if (!$MASTER_1_ENGINE_IS_SPIDER)
+{
+ --echo skipped
+}
+
+
+--echo
+--echo 3.0
+--echo is null
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TEXT_KEY_TABLES1;
+ echo CHILD2_1_CREATE_TEXT_KEY_TABLES1;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TEXT_KEY_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1;
+eval CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1;
+--enable_query_log
+insert into t1 values (null, null, '2048');
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a + 32, b + 32, c + 32 from t1;
+insert into t1 select a + 64, b + 64, c + 64 from t1;
+insert into t1 select a + 128, b + 128, c + 128 from t1;
+insert into t1 select a + 256, b + 256, c + 256 from t1;
+insert into t1 select a + 512, b + 512, c + 512 from t1;
+flush tables;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+select a from t1 where a is null order by a limit 30;
+select b from t1 where b is null order by b limit 30;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo direct_order_limit
+--connection master_1
+TRUNCATE TABLE t1;
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a, b + 32, c + 32 from t1;
+insert into t1 select a, b + 64, c + 64 from t1;
+insert into t1 select a, b + 128, c + 128 from t1;
+flush tables;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
+select a, c from t1 where a = '10' order by b desc limit 5;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test
new file mode 100644
index 00000000..e6c4456e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test
@@ -0,0 +1,647 @@
+# This test tests for Spider's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo 2.17
+--echo partition with sort
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
+ ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo 2.23
+--echo partition update with moving partition
+if ($HAVE_PARTITION)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
+ UPDATE ta_l2 SET a = 4 WHERE a = 3;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo index merge with partition
+if ($HAVE_PARTITION)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l_int;
+ --enable_warnings
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_2_DROP_TABLES5;
+ echo CHILD2_2_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES5;
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1;
+ eval CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+ WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo 2.26
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ --disable_ps_protocol
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ --enable_ps_protocol
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ SET INSERT_ID=5000;
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/bg/t/test_deinit.inc b/storage/spider/mysql-test/spider/bg/t/test_deinit.inc
new file mode 100644
index 00000000..989bde26
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/test_deinit.inc
@@ -0,0 +1,37 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/deinit_master_1.inc
+--disconnect master_1
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/deinit_child2_1.inc
+ --disconnect child2_1
+ --echo child2_2
+ --connection child2_2
+ --source ../include/deinit_child2_2.inc
+ --disconnect child2_2
+ --echo child2_3
+ --connection child2_3
+ --source ../include/deinit_child2_3.inc
+ --disconnect child2_3
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --connection child3_1
+ --source ../include/deinit_child3_1.inc
+ --disconnect child3_1
+ --echo child3_2
+ --connection child3_2
+ --source ../include/deinit_child3_2.inc
+ --disconnect child3_2
+ --echo child3_3
+ --connection child3_3
+ --source ../include/deinit_child3_3.inc
+ --disconnect child3_3
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/test_init.inc b/storage/spider/mysql-test/spider/bg/t/test_init.inc
new file mode 100644
index 00000000..f2cd6c02
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/test_init.inc
@@ -0,0 +1,74 @@
+# get connection and exist engine test
+--echo for master_1
+--source connect_master_1.inc
+--connection master_1
+CALL mtr.add_suppression("unknown variable");
+SET SESSION sql_log_bin= 0;
+--let $MASTER_1_SERVER_ID=`SELECT @@global.server_id`
+--let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE
+--source have_partition.inc
+--source have_trigger.inc
+--source ../include/init_master_1.inc
+--source have_engine.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --source connect_child2_1.inc
+ --connection child2_1
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
+ --source ../include/init_child2_1.inc
+ --source have_engine.inc
+ --echo child2_2
+ --source connect_child2_2.inc
+ --connection child2_2
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
+ --source ../include/init_child2_2.inc
+ --source have_engine.inc
+ --echo child2_3
+ --source connect_child2_3.inc
+ --connection child2_3
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
+ --source ../include/init_child2_3.inc
+ --source have_engine.inc
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --source connect_child3_1.inc
+ --connection child3_1
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+ --source ../include/init_child3_1.inc
+ --source have_engine.inc
+ --echo child3_2
+ --source connect_child3_2.inc
+ --connection child3_2
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+ --source ../include/init_child3_2.inc
+ --source have_engine.inc
+ --echo child3_3
+ --source connect_child3_3.inc
+ --connection child3_3
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+ --source ../include/init_child3_3.inc
+ --source have_engine.inc
+}
diff --git a/storage/spider/mysql-test/spider/bg/t/vp_fixes.test b/storage/spider/mysql-test/spider/bg/t/vp_fixes.test
new file mode 100644
index 00000000..2c3e1523
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bg/t/vp_fixes.test
@@ -0,0 +1,335 @@
+# This test tests for VP's bug fixes
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+--echo
+--echo 0.9
+--echo create different primary key table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT AUTO_INCREMENT,
+ c INT DEFAULT 11,
+ PRIMARY KEY(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT AUTO_INCREMENT,
+ c INT DEFAULT 11,
+ PRIMARY KEY(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)`
+if ($MASTER_1_IS_VP)
+{
+ --error 14514
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+}
+if (!$MASTER_1_IS_VP)
+{
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+ --disable_query_log
+ --disable_result_log
+ TRUNCATE TABLE ta_l_int;
+ --enable_query_log
+ --enable_result_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES5;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo create un-correspond primary key table
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l_int;
+--enable_warnings
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT DEFAULT 12,
+ c INT DEFAULT 11,
+ PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT DEFAULT 12,
+ c INT DEFAULT 11,
+ PRIMARY KEY(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($MASTER_1_IS_VP)
+{
+ --error 14514
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+}
+if (!$MASTER_1_IS_VP)
+{
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+ --disable_query_log
+ --disable_result_log
+ TRUNCATE TABLE ta_l_int;
+ --enable_query_log
+ --enable_result_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES5;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
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..3fd0a2d4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/disabled.def
@@ -0,0 +1,3 @@
+wait_timeout : MDEV-26045
+mdev_29904 : MDEV-31101
+mdev_27239: MDEV-32046
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..a5dc920e
--- /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 command_type != 'Execute' AND 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..5ef1c301
--- /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 command_type != 'Execute' AND (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_default_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_default_deinit.inc
new file mode 100644
index 00000000..4fd217a5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_default_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_default_init.inc b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_default_init.inc
new file mode 100644
index 00000000..872dd9c0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/delete_with_float_column_default_init.inc
@@ -0,0 +1,32 @@
+--source delete_with_float_column_init.inc
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a",
+ host "localhost",
+ database "auto_test_remote",
+ user "root",
+ password "",
+ port "$CHILD2_1_MYPORT"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a",
+ host "localhost",
+ database "auto_test_remote",
+ user "root",
+ password "",
+ socket "$CHILD2_1_MYSOCK"';
+}
+--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_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..b08c9fb1
--- /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 command_type != 'Execute' AND 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..b11ac98d
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..972fdb7e
--- /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 command_type != 'Execute' AND 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..379cb0fb
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..ca71d739
--- /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 command_type != 'Execute' AND 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..924d3b72
--- /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 command_type != 'Execute' AND 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..68a496a7
--- /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 command_type != 'Execute' AND 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/mdev_24523_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24523_deinit.inc
new file mode 100644
index 00000000..e8d30523
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24523_deinit.inc
@@ -0,0 +1,9 @@
+--let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_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_24523_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_24523_init.inc
new file mode 100644
index 00000000..989faa54
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_24523_init.inc
@@ -0,0 +1,31 @@
+--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_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;
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..2ff26472
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..2120fdaa
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..0f0644c8
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..9556d2e4
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..e383327b
--- /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 command_type != 'Execute' AND (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..e0c25939
--- /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 command_type != 'Execute' AND 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..3a5f91de
--- /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 command_type != 'Execute' AND 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..41c4fd3a
--- /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 command_type != 'Execute' AND 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..bfdb0831
--- /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 command_type != 'Execute' AND 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..09ab2934
--- /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 command_type != 'Execute' AND 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..e4614c87
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..b98f7216
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..80c5440f
--- /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 command_type != 'Execute' AND 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..025ed835
--- /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 command_type != 'Execute' AND 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..033e1593
--- /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 command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+checksum table `auto_test_remote`.`tbl_a` extended
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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..c0566840
--- /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 command_type != 'Execute' AND (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 command_type != 'Execute' AND (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/ddl_log.result b/storage/spider/mysql-test/spider/bugfix/r/ddl_log.result
new file mode 100644
index 00000000..2abbcc6b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/ddl_log.result
@@ -0,0 +1,12 @@
+# restart: --plugin-load-add=ha_spider
+#
+# MDEV-32532 Assertion failure in ddl_log_increment_phase_no_lock upon
+# partition operations with spider plugin loaded
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 2;
+ALTER TABLE t1 REBUILD PARTITION p0;
+drop table t1;
+#
+# End of 10.10
+#
+uninstall plugin spider;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result
new file mode 100644
index 00000000..cb1b190f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result
new file mode 100644
index 00000000..cb1b190f
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..11310212
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..e9054a17
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/group_by_order_by_limit.result
@@ -0,0 +1,126 @@
+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;
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+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
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 60
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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/index.result b/storage/spider/mysql-test/spider/bugfix/r/index.result
new file mode 100644
index 00000000..801fec2e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/index.result
@@ -0,0 +1,57 @@
+for master_1
+for child2
+for child3
+create database auto_test_local;
+set spider_same_server_link= on;
+#
+# MDEV-27590 Auto-increment on Spider tables with DESC PK does not work properly
+#
+select @@spider_auto_increment_mode;
+@@spider_auto_increment_mode
+0
+create or replace table auto_test_local.t (id int primary key) engine=InnoDB;
+create or replace table t_sp1 (id int auto_increment, primary key(id desc))
+engine=Spider COMMENT='wrapper "mysql", srv "s_1", table "t"';
+insert into t_sp1 () values (),(),();
+insert into t_sp1 () values (),(),();
+select * from t_sp1;
+id
+1
+2
+3
+4
+5
+6
+drop table t_sp1, auto_test_local.t;
+#
+# MDEV-27581 Wrong result with DESC key on partitioned Spider table
+#
+create table auto_test_local.t1 (a int primary key);
+create table auto_test_local.t2 (a int primary key);
+create table t (a int, primary key (a desc)) engine=spider
+engine=spider comment='wrapper "mysql", srv "s_1"'
+partition by range (a)
+(partition p1 values less than (4) comment "table 't1'",
+partition p2 values less than (maxvalue) comment "table 't2'");
+insert into t values (1),(2),(10),(11);
+select * from t where a > 1 order by a;
+a
+2
+10
+11
+drop table t, auto_test_local.t1, auto_test_local.t2;
+#
+# MDEV-27617 HANDLER KEY > (x) does not work with DESC keys, Spider is affected and returns wrong results
+#
+create table auto_test_local.t (a int, b char(1), primary key(a desc));
+insert into auto_test_local.t VALUES (1,'f'),(2,'g'),(3,'j'), (4,'i'),(5,'h');
+create table ts (a int, b char(1), primary key(a desc))
+engine=spider comment='wrapper "mysql", srv "s_1", table "t"';
+select a, b from ts where a > 0 and b = 'g' order by a;
+a b
+2 g
+drop table ts, auto_test_local.t;
+drop database auto_test_local;
+for master_1
+for child2
+for child3
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..670777d9
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..dbf0f54c
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..52876c34
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..ee06e449
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..7a9c58e6
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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_22979.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_22979.result
new file mode 100644
index 00000000..b3049af3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_22979.result
@@ -0,0 +1,5 @@
+MDEV-22979 "mysqld --bootstrap" / mysql_install_db hangs when Spider is installed
+# Kill the server
+# restart
+Warnings:
+Note 1305 SONAME ha_spider.so does not exist
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_24343.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24343.result
new file mode 100644
index 00000000..1d154daa
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24343.result
@@ -0,0 +1,75 @@
+#
+# MDEV-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause'
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`first_name` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO `tbl_a` VALUES (1,'RICHARD'), (2,'STEPHANE'), (3,'ALAIN');
+CREATE TABLE `tbl_b` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`last_name` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO `tbl_b` VALUES (1,'DEMONGEOT'),(2,'VAROQUI');
+CREATE TABLE `tbl_c` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`surname` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO `tbl_c` VALUES (1,'CON'),(2,'MOYEN'),(3,'MOYEN2');
+SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id;
+id last_name id surname id first_name
+1 DEMONGEOT 1 CON 1 RICHARD
+2 VAROQUI 2 MOYEN 2 STEPHANE
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`first_name` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"'
+PARTITION BY LIST COLUMNS(`id`) (
+PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+CREATE TABLE `tbl_b` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`last_name` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b"'
+PARTITION BY LIST COLUMNS(`id`) (
+PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+CREATE TABLE `tbl_c` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`surname` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c"'
+PARTITION BY LIST COLUMNS(`id`) (
+PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id;
+id last_name id surname id first_name
+1 DEMONGEOT 1 CON 1 RICHARD
+2 VAROQUI 2 MOYEN 2 STEPHANE
+connection master_1;
+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_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_24523.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_24523.result
new file mode 100644
index 00000000..0b3d6c31
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_24523.result
@@ -0,0 +1,58 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-24523
+
+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 (
+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 VALUES (1, '{ "a": 1, "b": [2, 3]}');
+
+test 1
+connection master_1;
+UPDATE tbl_a SET j = JSON_REPLACE(j, '$.a', 10, '$.c', '[1, 2]');
+SELECT * FROM tbl_a;
+i j
+1 {"a": 10, "b": [2, 3]}
+TRUNCATE TABLE tbl_a;
+INSERT INTO tbl_a VALUES (1, '{ "a": 1, "b": [2, 3]}');
+UPDATE tbl_a SET j = JSON_REPLACE(j, '$.a', 10, '$.b', '[1, 2]');
+SELECT * FROM tbl_a;
+i j
+1 {"a": 10, "b": "[1, 2]"}
+
+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_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_25116.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result
new file mode 100644
index 00000000..09efba25
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_25116.result
@@ -0,0 +1,42 @@
+#
+# MDEV-25116 Spider: IF(COUNT( trigger SQL Error (1054)_ Unknown column '' in field list
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (id INT);
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+id INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+connection master_1;
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT IF(COUNT(id > 0),'Y','N') FROM tbl_a;
+IF(COUNT(id > 0),'Y','N')
+N
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 1
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_25684.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_25684.result
new file mode 100644
index 00000000..8d4bea79
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_25684.result
@@ -0,0 +1,18 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
+
+connection master_1;
+SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', 'non_existing_temporary_table', 'srv "s_2_1"');
+ERROR HY000: Temporary table 'test.non_existing_temporary_table' is not found
+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/mdev_26151.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26151.result
new file mode 100644
index 00000000..b0a430e0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26151.result
@@ -0,0 +1,34 @@
+
+MDEV-26151 MDEV-31787
+
+for master_1
+for child2
+for child3
+set @old_spider_bgs_mode= @@spider_bgs_mode;
+set session spider_bgs_mode=1;
+CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+create table td (a int, PRIMARY KEY (a));
+create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_26151",TABLE "td", casual_read "3"';
+insert into td values (11), (42);
+select max(a) from ts;
+max(a)
+42
+drop table td, ts;
+create table td (a int, PRIMARY KEY (a));
+create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_26151",TABLE "td", casual_read "1"';
+insert into td values (11), (42);
+select max(a) from ts;
+max(a)
+42
+select min(a) from ts;
+min(a)
+11
+drop table td, ts;
+drop server srv_mdev_26151;
+set session spider_bgs_mode=@old_spider_bgs_mode;
+for master_1
+for child2
+for child3
+
+end of test
+
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26158.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26158.result
new file mode 100644
index 00000000..2870dab2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26158.result
@@ -0,0 +1,27 @@
+#
+# MDEV-26158 SIGSEGV in spider_free_mem from ha_spider::open on INSERT
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE t (
+c INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"'
+PARTITION BY LIST COLUMNS(`c`) (
+PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+INSERT INTO t SELECT * FROM t;
+ERROR 42000: Unknown database 'auto_test_remote'
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result
new file mode 100644
index 00000000..723a81a9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result
@@ -0,0 +1,96 @@
+#
+# MDEV-26247 Spider: Valid LEFT JOIN results in ERROR 1064
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE t1 (
+a11 int,
+primary key (a11)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+a21 int,
+a22 int,
+primary key (a21, a22)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+a31 int,
+a32 int,
+primary key (a31, a32)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1, 11), (2, 22), (3, 33);
+INSERT INTO t3 VALUES (1, 111), (2, 222), (3, 333);
+connection master_1;
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE t1 (
+a11 int,
+primary key (a11)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "t1"';
+CREATE TABLE t2 (
+a21 int,
+a22 int,
+primary key (a21, a22)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "t2"';
+CREATE TABLE t3 (
+a31 int,
+a32 int,
+primary key (a31, a32)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "t3"';
+SELECT a22 FROM t1 LEFT JOIN t2 ON a11 = a21 WHERE a11 IN (1);
+a22
+11
+SELECT a22 FROM t1 LEFT JOIN t2 ON a11 = a21 - a21 WHERE a11 IN (1);
+a22
+NULL
+SELECT a22 FROM t2 RIGHT JOIN t1 ON a21 = a11 WHERE a11 IN (1);
+a22
+11
+SELECT a22 FROM t2 RIGHT JOIN t1 ON a21 = a11 WHERE a11 IN (1,2);
+a22
+11
+22
+SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 RIGHT JOIN t3 on a21 = a31 WHERE a11 IN (1);
+a22 a32
+11 111
+SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 - a21 RIGHT JOIN t3 on a21 = a31 - a31 WHERE a11 IN (1);
+a22 a32
+SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 RIGHT JOIN t3 on a21 = a31 WHERE a11 IN (1,2);
+a22 a32
+11 111
+22 222
+SELECT a22 FROM t2 LEFT JOIN t1 ON a11 = a21 WHERE a11 IN (1);
+a22
+11
+SELECT a22 FROM t2 LEFT JOIN t1 ON a11 = a21 - a21 WHERE a11 IN (1);
+a22
+SELECT a22 FROM t1 RIGHT JOIN t2 ON a21 = a11 WHERE a11 IN (1);
+a22
+11
+SELECT a22 FROM t1 RIGHT JOIN t2 ON a21 = a11 WHERE a11 IN (1,2);
+a22
+11
+22
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+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 mdev_26247
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26539.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26539.result
new file mode 100644
index 00000000..4e195fdd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26539.result
@@ -0,0 +1,36 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+#
+# MDEV-26539 SIGSEGV in spider_check_and_set_trx_isolation and I_P_List_iterator from THD::drop_temporary_table (10.5.3 opt only) on ALTER
+#
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+c INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+c INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS (c) (
+PARTITION pt1 DEFAULT COMMENT = 'srv "s_2_1"'
+);
+INSERT INTO tbl_a VALUES (1);
+ALTER TABLE tbl_a CHECK PARTITION ALL;
+Table Op Msg_type Msg_text
+auto_test_local.tbl_a check status OK
+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_26541.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result
new file mode 100644
index 00000000..72921d2e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result
@@ -0,0 +1,19 @@
+#
+# MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds
+#
+INSTALL SONAME 'ha_spider.so';
+DROP FUNCTION spider_flush_table_mon_cache;
+DROP FUNCTION spider_copy_tables;
+DROP FUNCTION spider_ping_table;
+DROP FUNCTION spider_bg_direct_sql;
+DROP FUNCTION spider_direct_sql;
+UNINSTALL SONAME IF EXISTS "ha_spider";
+DROP TABLE IF EXISTS mysql.spider_xa;
+DROP TABLE IF EXISTS mysql.spider_xa_member;
+DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
+DROP TABLE IF EXISTS mysql.spider_tables;
+DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
+DROP TABLE IF EXISTS mysql.spider_link_failed_log;
+DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
+DROP TABLE IF EXISTS mysql.spider_table_sts;
+DROP TABLE IF EXISTS mysql.spider_table_crd;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26544.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26544.result
new file mode 100644
index 00000000..b3d5facc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26544.result
@@ -0,0 +1,23 @@
+#
+# MDEV-26544 Assertion `part_share->auto_inc_initialized' failed in ha_partition::get_auto_increment on INSERT
+#
+for master_1
+for child2
+for child3
+connection master_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE `tbl_a` (
+`a` INT AUTO_INCREMENT, KEY(`a`)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+PARTITION BY LIST COLUMNS (`a`) (
+PARTITION `pt1` DEFAULT
+);
+INSERT INTO tbl_a (a) VALUES (0);
+ERROR HY000: Unable to connect to foreign data source: localhost
+INSERT INTO tbl_a () VALUES ();
+ERROR HY000: Unable to connect to foreign data source: localhost
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26582.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26582.result
new file mode 100644
index 00000000..f393867f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26582.result
@@ -0,0 +1,11 @@
+#
+# MDEV-26582 SIGSEGV in spider_db_bulk_insert and spider_db_connect and spider_db_before_query, and hang in "End of update loop" / "Reset for next command" query states
+#
+CREATE DATABASE IF NOT EXISTS auto_test_local;
+USE auto_test_local;
+CREATE TABLE t (i CHAR) ENGINE=SPIDER;
+INSERT INTO t VALUES (0);
+Got one of the listed errors
+INSERT t SELECT 1 ON DUPLICATE KEY UPDATE c=1;
+ERROR 42S22: Unknown column 'c' in 'field list'
+DROP DATABASE IF EXISTS auto_test_local;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result
new file mode 100644
index 00000000..531e48b8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result
@@ -0,0 +1,83 @@
+#
+# MDEV-27172 Prefix indices on Spider tables may lead to wrong query results
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+SET @general_log_backup = @@global.general_log;
+SET @log_output_backup = @@global.log_output;
+SET @@global.general_log = 1;
+SET @@global.log_output = "TABLE";
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY(greeting)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE tbl_b (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY k (greeting(5))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE tbl_c (
+id int NOT NULL,
+greeting TEXT,
+KEY k (greeting(5))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY k (greeting)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_a WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
+id greeting
+2 Aloha!
+CREATE TABLE tbl_b (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY k (greeting(5))
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"';
+INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_b WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
+id greeting
+2 Aloha!
+CREATE TABLE tbl_c (
+id int NOT NULL,
+greeting TEXT,
+KEY k (greeting(5))
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c", srv "s_2_1"';
+INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_c WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
+id greeting
+2 Aloha!
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE 'select `id`,`greeting` from %';
+argument
+select `id`,`greeting` from `auto_test_remote`.`tbl_a` where `greeting` = 'Aloha!' and ((`greeting` = 'Aloha!'))
+select `id`,`greeting` from `auto_test_remote`.`tbl_b` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
+select `id`,`greeting` from `auto_test_remote`.`tbl_c` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
+connection child2_1;
+SET @@global.general_log = @general_log_backup;
+SET @@global.log_output = @log_output_backup;
+DROP DATABASE auto_test_remote;
+connection master_1;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27184.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27184.result
new file mode 100644
index 00000000..bcd65772
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27184.result
@@ -0,0 +1,21 @@
+#
+# MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) ||
+# ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) &&
+# ((unsigned long) old_end & (pagesize - 1)) == 0)' failed,
+# Assertion `str.alloced_length() >= str.length() + data_len' failed
+#
+for master_1
+for child2
+for child3
+connection master_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (a FLOAT) ENGINE=SPIDER;
+INSERT INTO tbl_a VALUES
+(0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),
+(0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE);
+Got one of the listed errors
+DROP DATABASE auto_test_remote;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result
new file mode 100644
index 00000000..17f3316b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result
@@ -0,0 +1,11 @@
+#
+# MDEV-27233 Server hangs when using --init-file which loads Spider and creates a Spider table
+#
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `c` int(11) DEFAULT NULL
+) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+Warnings:
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result
new file mode 100644
index 00000000..de135972
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result
@@ -0,0 +1,20 @@
+#
+# MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL
+#
+for master_1
+for child2
+for child3
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (a INT) ENGINE=SPIDER;
+FLUSH TABLE tbl_a WITH READ LOCK;
+Warnings:
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
+BEGIN;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result
new file mode 100644
index 00000000..407e916f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result
@@ -0,0 +1,16 @@
+for master_1
+for child2
+for child3
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER;
+SELECT a.z FROM tbl_a AS a,tbl_a b WHERE a.z=b.z;
+ERROR 42S22: Unknown column 'a.z' in 'field list'
+ALTER TABLE tbl_a CHANGE c c INT;
+ERROR 42S22: Unknown column 'c' in 'tbl_a'
+LOCK TABLE tbl_a READ;
+Got one of the listed errors
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result
new file mode 100644
index 00000000..394d3b27
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result
@@ -0,0 +1,9 @@
+#
+# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
+#
+INSTALL SONAME 'ha_spider.so';
+DROP TABLE IF EXISTS mysql.spider_tables;
+show create table mysql.spider_tables;
+ERROR 42S02: Table 'mysql.spider_tables' doesn't exist
+Warnings:
+Note 1051 Unknown table 'mysql.spider_tables'
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28218_init_file.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28218_init_file.result
new file mode 100644
index 00000000..05c396ac
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28218_init_file.result
@@ -0,0 +1,5 @@
+#
+# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
+#
+show create table mysql.spider_tables;
+ERROR 42S02: Table 'mysql.spider_tables' doesn't exist
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result
new file mode 100644
index 00000000..05c396ac
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result
@@ -0,0 +1,5 @@
+#
+# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
+#
+show create table mysql.spider_tables;
+ERROR 42S02: Table 'mysql.spider_tables' doesn't exist
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result
new file mode 100644
index 00000000..e5cee8d4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28854.result
@@ -0,0 +1,32 @@
+#
+# MDEV-28854 Spider: Disallow INSERT DELAYED on Spider 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;
+CREATE TABLE tbl_a (id INT);
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+id INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+connection master_1;
+INSERT DELAYED INTO tbl_a VALUES (1);
+ERROR HY000: DELAYED option not supported for table 'tbl_a'
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result
new file mode 100644
index 00000000..fae3cc6b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result
@@ -0,0 +1,180 @@
+#
+# MDEV-28856 Spider: Implement more engine-defined options
+#
+for master_1
+for child2
+for child3
+CREATE SERVER srv FOREIGN DATA WRAPPER mysql
+OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+# testing monitoring_*
+INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server) VALUES
+('test', 't1', '0', 1, 'srv');
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", monitoring_kind "2"';
+/* 1 */ insert into t1 values (42);
+ERROR HY000: Table 'test.t2' get a problem
+/* 2 */ insert into t1 values (42);
+ERROR HY000: All links of 'test.t1' are failed
+create table t2 (c int);
+/* 3 */ insert into t1 values (42);
+ERROR HY000: All links of 'test.t1' are failed
+drop table t1, t2;
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", monitoring_bg_kind "2",
+ monitoring_bg_interval "500000"';
+/* 4 */ insert into t1 values (42);
+ERROR 42S02: Table 'test.t2' doesn't exist
+drop table t1;
+# testing query_cache_sync
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", query_cache_sync "3"';
+create table t2 (c int);
+/* 5 */ insert into t1 values (42);
+select sql_cache * from t1;
+c
+42
+select sql_no_cache * from t1;
+c
+42
+drop table t1, t2;
+# testing tgt_pk_names
+create table t2 (c int);
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
+/* 6 */ insert ignore into t1 values (42), (42);
+select * from t1;
+c
+42
+42
+drop table t1, t2;
+create table t2 (c int, primary key (c));
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
+/* 7 */ insert ignore into t1 values (42), (42);
+Warnings:
+Warning 1022 Can't write; duplicate key in table 't1'
+select * from t1;
+c
+42
+drop table t1, t2;
+create table t2 (c int, primary key (c));
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
+/* 8 */ insert ignore into t1 values (42), (42);
+Warnings:
+Warning 1062 Duplicate entry '42' for key 'PRIMARY'
+select * from t1;
+c
+42
+drop table t1, t2;
+create table t2 (c int, primary key (c));
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "c"';
+/* 9 */ insert ignore into t1 values (42), (42);
+Warnings:
+Warning 1022 Can't write; duplicate key in table 't1'
+select * from t1;
+c
+42
+drop table t1, t2;
+create table t2 (c int, unique key (c));
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "c"';
+/* 9.1 */ insert ignore into t1 values (42), (42);
+Warnings:
+Warning 1062 Duplicate entry '42' for key 'PRIMARY'
+select * from t1;
+c
+42
+drop table t1, t2;
+create table t2 (c int, unique key (c));
+create table t1 (c int, key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "f"';
+/* 10 */ insert ignore into t1 values (42), (42);
+Warnings:
+Warning 1062 Duplicate entry '42' for key 'c'
+select * from t1;
+c
+42
+drop table t1, t2;
+create table t2 (c int, primary key (c));
+create table t1 (c int, key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "blah"';
+/* 11 */ insert ignore into t1 values (42), (42);
+Warnings:
+Warning 1022 Can't write; duplicate key in table 't1'
+select * from t1;
+c
+42
+drop table t1, t2;
+create table t2 (c int, d int, unique key (c), unique key (d));
+create table t1 (c int, d int, key (c), key (d)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "blah"';
+/* 12 */ insert ignore into t1 values (42, 43), (43, 43);
+Warnings:
+Warning 1062 Duplicate entry '43' for key 'd'
+select * from t1;
+c d
+42 43
+drop table t1, t2;
+# Testing index hint
+create table t2 (c int, d int, primary key (c), key (d));
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) NOT NULL,
+ `d` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c`),
+ KEY `d` (`d`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+create table t1 (c int, d int, primary key (c), key (d)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", idx000 "f d"';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) NOT NULL,
+ `d` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c`),
+ KEY `d` (`d`)
+) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", idx000 "f d"'
+/* 13 */ insert into t1 values (42, 23), (37, 93);
+select max(d) from t1;
+max(d)
+93
+drop table t1, t2;
+create table t2 (c int, d int, e int, primary key (c), key (d), unique key (e));
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) NOT NULL,
+ `d` int(11) DEFAULT NULL,
+ `e` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c`),
+ UNIQUE KEY `e` (`e`),
+ KEY `d` (`d`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+create table t1 (c int, d int, e int, primary key (c), key (d), unique key (e)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", idx000 "f PRIMARY", idx001 "u d", idx002 "ig e"';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) NOT NULL,
+ `d` int(11) DEFAULT NULL,
+ `e` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c`),
+ UNIQUE KEY `e` (`e`),
+ KEY `d` (`d`)
+) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", idx000 "f PRIMARY", idx001 "u d", idx002 "ig e"'
+/* 14 */ insert into t1 values (42, 23, 89), (37, 93, 47);
+select max(d) from t1;
+max(d)
+93
+drop table t1, t2;
+drop server srv;
+for master_1
+for child2
+for child3
+#
+# end of test mdev_28856
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28996.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28996.result
new file mode 100644
index 00000000..f805e7ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28996.result
@@ -0,0 +1,34 @@
+#
+# MDEV-28996 ASAN errors in String::q_append / spider_string::q_append / spider_db_mbase_util::open_item_func
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a CHAR(8)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO tbl_a VALUES ('foo'),('bar');
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a CHAR(8)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT MAX(BINARY a) FROM tbl_a;
+MAX(BINARY a)
+foo
+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_28998.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28998.result
new file mode 100644
index 00000000..d664b090
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28998.result
@@ -0,0 +1,26 @@
+#
+# MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
+#
+for master_1
+for child2
+for child3
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t1_SPIDER (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
+CREATE TABLE t2 AS SELECT a FROM t1_SPIDER;
+SELECT * FROM t2;
+a
+1
+2
+DROP TABLE t2, t1_SPIDER, t1;
+drop server s;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+for master_1
+for child2
+for child3
+#
+# end of test mdev_28998
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result
new file mode 100644
index 00000000..66e33f42
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result
@@ -0,0 +1,38 @@
+#
+# MDEV-29008 Server crash or assertion `field' failed in spider_db_open_item_ident / group by handler
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT,
+b INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO tbl_a VALUES (1,2),(3,4);
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT,
+b INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2;
+f1 f2
+1 2
+1 4
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29011.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29011.result
new file mode 100644
index 00000000..04f9651b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29011.result
@@ -0,0 +1,40 @@
+#
+# MDEV-29011 Server crash in spider_db_open_item_cond with XOR operator
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT,
+b INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO tbl_a VALUES (0, 0), (0, 1), (1, 0), (1, 1);
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT,
+b INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT a XOR b AS f FROM tbl_a;
+f
+0
+1
+1
+0
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result
new file mode 100644
index 00000000..96d8a729
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result
@@ -0,0 +1,26 @@
+#
+# MDEV-29163 Server crash with SIGSEGV or dynamic-stack-buffer-overflow in spider_db_mbase_util::append_table
+#
+for master_1
+for child2
+for child3
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT, PRIMARY KEY(c));
+CREATE TABLE t1_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
+CREATE TABLE t2_spider (b INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't2'";
+CREATE TABLE t3_spider (c INT, PRIMARY KEY(c)) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't3'";
+SELECT t1_spider.* FROM t1_spider LEFT JOIN t2_spider LEFT JOIN t3_spider ON b = c ON a = b;
+a
+DROP TABLE t1_spider, t2_spider, t3_spider, t1, t2, t3;
+drop server s;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+for master_1
+for child2
+for child3
+#
+# end of test mdev_29163
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result
new file mode 100644
index 00000000..975d3834
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29352.result
@@ -0,0 +1,13 @@
+CREATE TABLE t (c INT);
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+FLUSH TABLES WITH READ LOCK;
+CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+SELECT * FROM t;
+c
+# restart
+DROP TABLE t;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29447.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29447.result
new file mode 100644
index 00000000..358e131f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29447.result
@@ -0,0 +1,33 @@
+#
+# MDEV-29447 SIGSEGV in spider_db_open_item_field and SIGSEGV spider_db_print_item_type, on SELECT
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT TRIM(LEADING 'c' FROM a) FROM tbl_a;
+TRIM(LEADING 'c' FROM a)
+connection child2_1;
+DROP DATABASE auto_test_remote;
+connection master_1;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29484.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29484.result
new file mode 100644
index 00000000..cc950ac0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29484.result
@@ -0,0 +1,39 @@
+#
+# MDEV-29484 Assertion `!trx_free || !trx->locked_connections' failed in spider_free_trx_conn on LOCK TABLES
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+CREATE TABLE tbl_b (
+a INT
+) ENGINE=Spider DEFAULT CHARSET=utf8;
+LOCK TABLES tbl_a WRITE;
+LOCK TABLES tbl_b READ, tbl_a READ;
+ERROR HY000: Unable to connect to foreign data source: localhost
+disconnect master_1;
+connect master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
+connection child2_1;
+DROP DATABASE auto_test_remote;
+connection master_1;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result
new file mode 100644
index 00000000..54c5e9a6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result
@@ -0,0 +1,68 @@
+#
+# MDEV-29502 ASAN: heap-buffer-overflow & stack-buffer-overflow in spider_db_mbase_row::append_to_str | SIGSEGV's in __memmove_avx_unaligned_erms from memcpy in Binary_string::q_append, in Static_binary_string::q_append and my_strntoull10rnd_8bit | Unknown error 12801
+#
+for master_1
+for child2
+for child3
+CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (23),(48);
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+CREATE TABLE t1 (a INT KEY) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv_mdev_29502",TABLE "t"';
+SELECT MAX(a) FROM t1;
+MAX(a)
+48
+SELECT SUM(a) FROM t1;
+SUM(a)
+71
+SELECT COUNT(a) FROM t1;
+COUNT(a)
+2
+SELECT MAX(a), SUM(a) FROM t1;
+MAX(a) SUM(a)
+48 71
+SELECT COUNT(a), MAX(a), SUM(a) FROM t1;
+COUNT(a) MAX(a) SUM(a)
+2 48 71
+SELECT MAX(a), COUNT(a), SUM(a) FROM t1;
+MAX(a) COUNT(a) SUM(a)
+48 2 71
+SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
+MAX(a) MAX(COALESCE(a))
+48 48
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+DROP TABLE t, t1;
+CREATE TABLE t (a INT, b INT);
+INSERT INTO t VALUES (23, -1),(48, 97);
+CREATE TABLE t1 (a INT, b INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv_mdev_29502",TABLE "t"';
+SELECT MAX(a + b), SUM(a - b) FROM t1;
+MAX(a + b) SUM(a - b)
+145 -25
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+DROP TABLE t, t1;
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (23),(97),(42);
+CREATE TABLE t1 (a INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv_mdev_29502",TABLE "t"';
+SELECT IF(COUNT(a > 0),'Y','N'), MAX(a) FROM t1;
+IF(COUNT(a > 0),'Y','N') MAX(a)
+Y 97
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 2
+SELECT MAX(a), IF(COUNT(a > 0),'Y','N') FROM t1;
+MAX(a) IF(COUNT(a > 0),'Y','N')
+97 Y
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 4
+DROP TABLE t, t1;
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+DROP SERVER srv_mdev_29502;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result
new file mode 100644
index 00000000..561ce18a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result
@@ -0,0 +1,47 @@
+#
+# MDEV-29562 Spider table with charset utf32/utf16/ucs2 tries to set client charset to unsupported value
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider CHARSET utf32 COMMENT='table "tbl_a", srv "s_2_1"';
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET utf32'
+ALTER DATABASE auto_test_local CHARSET="ucs2";
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider COMMENT='table "tbl_a", srv "s_2_1"';
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET ucs2'
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider CHARSET utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT * FROM tbl_a;
+a
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16;
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET utf16'
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16le;
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET utf16le'
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET latin1;
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result
new file mode 100644
index 00000000..b52cecc5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29644.result
@@ -0,0 +1,41 @@
+#
+# MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings()
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a CHAR(5)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+SET GLOBAL sql_mode='';
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a CHAR(255)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SET sql_mode='';
+INSERT INTO tbl_a VALUES ("this will be truncated");
+NOT FOUND /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err
+SET GLOBAL spider_log_result_errors=4;
+INSERT INTO tbl_a VALUES ("this will be truncated");
+FOUND 1 /\[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*/ in mysqld.1.1.err
+connection master_1;
+SET GLOBAL spider_log_result_errors=DEFAULT;
+SET sql_mode=DEFAULT;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+SET GLOBAL sql_mode=DEFAULT;
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result
new file mode 100644
index 00000000..abbcfcb7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result
@@ -0,0 +1,33 @@
+#
+# MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider 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;
+CREATE TABLE t (
+c INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE ts (
+c INT
+) ENGINE=Spider COMMENT='table "t", srv "s_2_1"';
+SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1));
+1
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result
new file mode 100644
index 00000000..c89309a5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29904.result
@@ -0,0 +1,4 @@
+#
+# MDEV-29904 SPIDER plugin initialization fails upon startup
+#
+# restart: --plugin-load-add=ha_spider
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30191.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30191.result
new file mode 100644
index 00000000..941f210c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30191.result
@@ -0,0 +1,44 @@
+#
+# MDEV-30191 SIGSEGV & heap-use-after-free in spider_db_print_item_type, SIGABRT in __cxa_pure_virtual/spider_db_print_item_type, Got error 128 "Out of memory in engine", 56/112 memory not freed, and Assertion `fixed()' failed in Item_sp_variable::val_str on SP call
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (c INT);
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+c INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+CREATE TABLE tbl_b (c INT);
+CREATE PROCEDURE sp() BEGIN
+DECLARE v1 DATE;
+WHILE EXISTS (SELECT 1 FROM tbl_a WHERE c>v1 AND c<=v1) DO
+SELECT 1;
+END WHILE;
+WHILE EXISTS (SELECT 1
+FROM tbl_a
+WHERE c<v1 AND EXISTS (SELECT 1
+FROM tbl_b
+WHERE tbl_a.c=tbl_b.c)) DO
+SELECT 1;
+END WHILE;
+END $$
+CALL sp();
+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
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result
new file mode 100644
index 00000000..7a0b6a20
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result
@@ -0,0 +1,8 @@
+#
+# MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so
+#
+call mtr.add_suppression(".*\\[Warning\\] InnoDB: Skipping buffer pool dump/restore during wsrep recovery");
+# Kill the server
+# restart
+Warnings:
+Note 1305 SONAME ha_spider.so does not exist
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result
new file mode 100644
index 00000000..13297e10
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result
@@ -0,0 +1,25 @@
+#
+# MDEV-30392 Syntax error upon query with subquery from Spider table
+#
+for master_1
+for child2
+for child3
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 'srv', table 't1'";
+SELECT a FROM t2 WHERE a IN ( SELECT a FROM t2 );
+a
+1
+2
+DROP TABLE t1, t2;
+DROP SERVER srv;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+for master_1
+for child2
+for child3
+#
+# end of test mdev_30392
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30981.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30981.result
new file mode 100644
index 00000000..6db36e2b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30981.result
@@ -0,0 +1,12 @@
+#
+# MDEV-30981 Spider UBSAN: null pointer passed as argument 2, which is declared to never be null in spider_create_trx_alter_table on ALTER
+#
+for master_1
+for child2
+for child3
+CREATE TABLE t (c INT) ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
+ALTER TABLE t ENGINE=InnoDB;
+drop table t;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31117.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31117.result
new file mode 100644
index 00000000..2fb7a658
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31117.result
@@ -0,0 +1,22 @@
+#
+# MDEV-31117 Spider UBSAN runtime error: applying non-zero offset x to null pointer in st_spider_param_string_parse::restore_delims
+#
+for master_1
+for child2
+for child3
+CREATE TABLE t (c INT) ENGINE=Spider COMMENT='abc';
+ERROR HY000: The connect info 'abc' is invalid
+ALTER TABLE mysql.help_topic ENGINE=Spider;
+ERROR HY000: The connect info 'help topics' is invalid
+CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", "srv" "srv",TABLE "t2"';
+ERROR HY000: The connect info '"srv" "srv",TABLE "t2"' is invalid
+create table t1 (c int) ENGINE=Spider CONNECTION='WRAPPER "mysql", srv \'srv\',TABLE "t2", password "say \\"hello\\ world!\\""';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+drop table t1, t2;
+drop server srv;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result
new file mode 100644
index 00000000..62b06336
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result
@@ -0,0 +1,16 @@
+#
+# MDEV-31338 UBSAN: runtime error: member access within null pointer of type 'struct SPIDER_FIELD_CHAIN' and SIGSEGV in spider_db_open_item_ident on SELECT
+#
+for master_1
+for child2
+for child3
+CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t (c BLOB) ENGINE=InnoDB;
+CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
+SELECT TRIM(BOTH ' ' FROM c) FROM ts ORDER BY c;
+TRIM(BOTH ' ' FROM c)
+drop table t, ts;
+drop server srv;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31524.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31524.result
new file mode 100644
index 00000000..c1aa7a1f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31524.result
@@ -0,0 +1,50 @@
+
+MDEV-31524 Spider variables that double as table params overriding mechanism is buggy
+
+for master_1
+for child2
+for child3
+SET @old_spider_read_only_mode = @@session.spider_read_only_mode;
+CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+set session spider_read_only_mode = default;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_31524",TABLE "t2"';
+/* 1 */ insert into t1 values (42);
+drop table t1, t2;
+set session spider_read_only_mode = 1;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_31524",TABLE "t2"';
+/* 2 */ insert into t1 values (42);
+ERROR HY000: Table 'test.t1' is read only
+drop table t1, t2;
+set session spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (fallback to default) is deprecated and will be removed in a future release
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_31524",TABLE "t2"';
+/* 3 */ insert into t1 values (42);
+drop table t1, t2;
+SET session spider_read_only_mode = default;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='read_only_mode "1", WRAPPER "mysql", srv "srv_mdev_31524",TABLE "t2"';
+/* 4 */ insert into t1 values (42);
+ERROR HY000: Table 'test.t1' is read only
+drop table t1, t2;
+set session spider_read_only_mode = 1;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='read_only_mode "0", WRAPPER "mysql", srv "srv_mdev_31524",TABLE "t2"';
+/* 5 */ insert into t1 values (42);
+drop table t1, t2;
+SET session spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (fallback to default) is deprecated and will be removed in a future release
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='read_only_mode "1", WRAPPER "mysql", srv "srv_mdev_31524",TABLE "t2"';
+/* 6 */ insert into t1 values (42);
+ERROR HY000: Table 'test.t1' is read only
+drop table t1, t2;
+drop server srv_mdev_31524;
+SET session spider_read_only_mode = @old_spider_read_only_mode;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result
new file mode 100644
index 00000000..28cb546e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result
@@ -0,0 +1,28 @@
+#
+# MDEV-31645 Spider doesn't recognize semi JOIN
+#
+for master_1
+for child2
+for child3
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a));
+CREATE TABLE t2 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)) ENGINE=SPIDER COMMENT='srv "srv", WRAPPER "mysql", TABLE "t1"';
+SET SESSION optimizer_switch='semijoin=off';
+SELECT * FROM t2
+WHERE A BETWEEN 0 AND 10 AND B IN(SELECT B FROM t2 WHERE A BETWEEN 11 AND 20);
+a b
+SET SESSION optimizer_switch='semijoin=on';
+SELECT * FROM t2
+WHERE A BETWEEN 0 AND 10 AND B IN(SELECT B FROM t2 WHERE A BETWEEN 11 AND 20);
+a b
+drop table t1, t2;
+drop server srv;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+for master_1
+for child2
+for child3
+#
+# end of test mdev_31645
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31996.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31996.result
new file mode 100644
index 00000000..04d7e884
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31996.result
@@ -0,0 +1,47 @@
+for master_1
+for child2
+for child3
+CREATE SERVER srv FOREIGN DATA WRAPPER mysql
+OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+set session spider_delete_all_rows_type=0;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+delete from t1;
+drop table t1, t2;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+insert ignore into t1 values (42), (378);
+select * from t1;
+c
+42
+378
+delete from t1;
+select * from t1;
+c
+drop table t1, t2;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+truncate t1;
+drop table t1, t2;
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+insert ignore into t1 values (42), (378);
+select * from t1;
+c
+42
+378
+truncate t1;
+select * from t1;
+c
+drop table t1, t2;
+drop server srv;
+for master_1
+for child2
+for child3
+#
+# end of test tmp
+#
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result
new file mode 100644
index 00000000..350a723f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result
@@ -0,0 +1,16 @@
+#
+# MDEV-32683 Spider engine does not load with non-default alter-algorithm
+#
+set global alter_algorithm=INSTANT;
+install plugin spider soname 'ha_spider';
+select plugin_name, plugin_status, plugin_type, plugin_license, load_option from information_schema.plugins where plugin_name like 'spider';
+plugin_name plugin_status plugin_type plugin_license load_option
+SPIDER ACTIVE STORAGE ENGINE GPL ON
+uninstall plugin spider;
+drop table mysql.spider_link_failed_log, mysql.spider_link_mon_servers, mysql.spider_tables, mysql.spider_table_crd, mysql.spider_table_position_for_recovery, mysql.spider_table_sts, mysql.spider_xa, mysql.spider_xa_failed_log, mysql.spider_xa_member;
+drop function spider_direct_sql;
+drop function spider_bg_direct_sql;
+drop function spider_ping_table;
+drop function spider_copy_tables;
+drop function spider_flush_table_mon_cache;
+set global alter_algorithm=DEFAULT;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result b/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result
new file mode 100644
index 00000000..04e5ed6d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result
@@ -0,0 +1,7 @@
+#
+# plugin-load-add=ha_spider
+#
+select * from mysql.plugin;
+name dl
+create table t (c int) Engine=SPIDER;
+drop table t;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_spider.result b/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_spider.result
new file mode 100644
index 00000000..04e5ed6d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_spider.result
@@ -0,0 +1,7 @@
+#
+# plugin-load-add=ha_spider
+#
+select * from mysql.plugin;
+name dl
+create table t (c int) Engine=SPIDER;
+drop table t;
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..f785ad35
--- /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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..89a07bf6
--- /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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..cc94cfe4
--- /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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..bc1daa77
--- /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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..24f9cf7c
--- /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 command_type != 'Execute' AND (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 command_type != 'Execute' AND (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 command_type != 'Execute' AND (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 command_type != 'Execute' AND (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 command_type != 'Execute' AND (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 command_type != 'Execute' AND (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..ecca29c8
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..182dd31a
--- /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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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..bfdf8796
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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/self_reference_multi.result b/storage/spider/mysql-test/spider/bugfix/r/self_reference_multi.result
new file mode 100644
index 00000000..196e48d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/self_reference_multi.result
@@ -0,0 +1,22 @@
+for master_1
+for child2
+for child3
+
+MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait forever
+
+CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_self_reference_multi",TABLE "t2"';
+create table t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_self_reference_multi",TABLE "t1"';
+alter table t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_self_reference_multi",TABLE "t0"';
+select * from t0;
+ERROR HY000: An infinite loop is detected when opening table test.t0
+select * from t1;
+ERROR HY000: An infinite loop is detected when opening table test.t0
+select * from t2;
+ERROR HY000: An infinite loop is detected when opening table test.t0
+drop table t0, t1, t2;
+drop server srv_self_reference_multi;
+for master_1
+for child2
+for child3
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..e84d42bb
--- /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 command_type != 'Execute' AND 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 utf8mb3
+set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%set %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+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..a0103695
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..e75378a5
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..fcdab4c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/strict_group_by.result
@@ -0,0 +1,133 @@
+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;
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT count(pkey) cnt, skey FROM tbl_a;
+cnt skey
+30 1
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 2
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select count(`pkey`),min(`pkey`),min(`skey`) from `auto_test_remote`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select count(`pkey`),min(`pkey`),min(`skey`) from `auto_test_remote2`.`tbl_a`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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/udf_mysql_func_early.result b/storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early.result
new file mode 100644
index 00000000..b84f60a6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early.result
@@ -0,0 +1,43 @@
+#
+# Test that udf created by inserting into mysql_func works as expected
+#
+CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+HOST 'localhost',
+DATABASE 'auto_test_local',
+USER 'root',
+PASSWORD '',
+SOCKET '$MASTER_1_MYSOCK'
+ );
+CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+HOST 'localhost',
+DATABASE 'auto_test_remote',
+USER 'root',
+PASSWORD '',
+SOCKET '$CHILD2_1_MYSOCK'
+ );
+connect master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
+connect child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK;
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+insert into tbl_a values (42);
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+create temporary table results (a int);
+SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"');
+SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"')
+1
+select * from results;
+a
+42
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
diff --git a/storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early_init_file.result b/storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early_init_file.result
new file mode 120000
index 00000000..045ddc43
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early_init_file.result
@@ -0,0 +1 @@
+udf_mysql_func_early.result \ No newline at end of file
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..bd4ef0c8
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%insert %'
+connection child2_2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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..ef50d3a3
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..8e1b2994
--- /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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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..de2dd90a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test
@@ -0,0 +1,74 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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..11917970
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test
@@ -0,0 +1,82 @@
+--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;
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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/ddl_log.test b/storage/spider/mysql-test/spider/bugfix/t/ddl_log.test
new file mode 100644
index 00000000..4fe45b83
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/ddl_log.test
@@ -0,0 +1,17 @@
+--source include/have_partition.inc
+--let $restart_parameters= --plugin-load-add=ha_spider
+--source include/restart_mysqld.inc
+
+--echo #
+--echo # MDEV-32532 Assertion failure in ddl_log_increment_phase_no_lock upon
+--echo # partition operations with spider plugin loaded
+--echo #
+CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 2;
+ALTER TABLE t1 REBUILD PARTITION p0;
+drop table t1;
+
+--echo #
+--echo # End of 10.10
+--echo #
+
+uninstall plugin spider;
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..a4def9b3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column.inc
@@ -0,0 +1,102 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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_default.cnf b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_default.cnf
new file mode 100644
index 00000000..45019d6c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_default.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_default.test b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_default.test
new file mode 100644
index 00000000..5a8c9e67
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/delete_with_float_column_default.test
@@ -0,0 +1,5 @@
+--source ../include/delete_with_float_column_default_init.inc
+--source delete_with_float_column.inc
+--source ../include/delete_with_float_column_default_deinit.inc
+--echo
+--echo end of test
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..ede4144a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_comma_pwd.test
@@ -0,0 +1,37 @@
+--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
+
+--disable_ps2_protocol
+eval $DIRECT_SQL_COMMAND;
+--enable_ps2_protocol
+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..01fcc20b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/direct_sql_with_tmp_table.test
@@ -0,0 +1,37 @@
+--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
+
+--disable_ps2_protocol
+eval $DIRECT_SQL_COMMAND;
+--enable_ps2_protocol
+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..d694230b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test
@@ -0,0 +1,104 @@
+--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;
+
+--disable_ps2_protocol
+--connection master_1
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+--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;
+--enable_ps2_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;
+
+--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/index.test b/storage/spider/mysql-test/spider/bugfix/t/index.test
new file mode 100644
index 00000000..641fa164
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/index.test
@@ -0,0 +1,53 @@
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+create database auto_test_local;
+set spider_same_server_link= on;
+
+--echo #
+--echo # MDEV-27590 Auto-increment on Spider tables with DESC PK does not work properly
+--echo #
+
+select @@spider_auto_increment_mode;
+create or replace table auto_test_local.t (id int primary key) engine=InnoDB;
+create or replace table t_sp1 (id int auto_increment, primary key(id desc))
+engine=Spider COMMENT='wrapper "mysql", srv "s_1", table "t"';
+insert into t_sp1 () values (),(),();
+insert into t_sp1 () values (),(),();
+select * from t_sp1;
+drop table t_sp1, auto_test_local.t;
+
+--echo #
+--echo # MDEV-27581 Wrong result with DESC key on partitioned Spider table
+--echo #
+create table auto_test_local.t1 (a int primary key);
+create table auto_test_local.t2 (a int primary key);
+create table t (a int, primary key (a desc)) engine=spider
+engine=spider comment='wrapper "mysql", srv "s_1"'
+partition by range (a)
+(partition p1 values less than (4) comment "table 't1'",
+ partition p2 values less than (maxvalue) comment "table 't2'");
+
+insert into t values (1),(2),(10),(11);
+select * from t where a > 1 order by a;
+drop table t, auto_test_local.t1, auto_test_local.t2;
+
+--echo #
+--echo # MDEV-27617 HANDLER KEY > (x) does not work with DESC keys, Spider is affected and returns wrong results
+--echo #
+
+create table auto_test_local.t (a int, b char(1), primary key(a desc));
+insert into auto_test_local.t VALUES (1,'f'),(2,'g'),(3,'j'), (4,'i'),(5,'h');
+create table ts (a int, b char(1), primary key(a desc))
+engine=spider comment='wrapper "mysql", srv "s_1", table "t"';
+select a, b from ts where a > 0 and b = 'g' order by a;
+drop table ts, auto_test_local.t;
+
+drop database auto_test_local;
+--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/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..c2ac615e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/insert_select.test
@@ -0,0 +1,101 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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..0b8ce69c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test
@@ -0,0 +1,99 @@
+--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
+--disable_ps2_protocol
+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;
+--enable_ps2_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;
+
+--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..3d1ccf3c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test
@@ -0,0 +1,93 @@
+--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
+--disable_ps2_protocol
+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);
+--enable_ps2_protocol
+
+--connection child2_1
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+--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..1cd1c689
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test
@@ -0,0 +1,80 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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_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..c1a9aaa4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test
@@ -0,0 +1,105 @@
+--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
+--disable_ps2_protocol
+SELECT STRAIGHT_JOIN b.a, b.b FROM tb_l a, tbl_a b WHERE a.a = b.a;
+--enable_ps2_protocol
+
+--connection child2_1
+SET NAMES utf8;
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+--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_22979.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_22979.test
new file mode 100644
index 00000000..7f42bd73
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22979.test
@@ -0,0 +1,18 @@
+--echo MDEV-22979 "mysqld --bootstrap" / mysql_install_db hangs when Spider is installed
+
+# This test is not the most faithful, as it does not have any
+# dependency problems on the existence of the `mysql` database. To
+# test MDEV-22979 faithfully, a mysql_install_db invocation with
+# --plugin-load-add=ha_spider should be run. We cannot run it in mtr
+# because we do not have access to --srcdir.
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $PLUGIN_DIR=`select @@plugin_dir`;
+--source include/kill_mysqld.inc
+--write_file $MYSQLTEST_VARDIR/tmp/mdev_22979.sql
+drop table if exists foo.bar;
+EOF
+--exec $MYSQLD_CMD --datadir=$MYSQLD_DATADIR --bootstrap --plugin-dir=$PLUGIN_DIR --plugin-load-add=ha_spider < $MYSQLTEST_VARDIR/tmp/mdev_22979.sql
+--source include/start_mysqld.inc
+--disable_query_log
+--source ../../include/clean_up_spider.inc
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_24343.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.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_24343.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.test
new file mode 100644
index 00000000..5756cbac
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24343.test
@@ -0,0 +1,84 @@
+--echo #
+--echo # MDEV-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause'
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE tbl_a (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `first_name` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO `tbl_a` VALUES (1,'RICHARD'), (2,'STEPHANE'), (3,'ALAIN');
+
+eval CREATE TABLE `tbl_b` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `last_name` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`ID`)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO `tbl_b` VALUES (1,'DEMONGEOT'),(2,'VAROQUI');
+
+eval CREATE TABLE `tbl_c` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `surname` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO `tbl_c` VALUES (1,'CON'),(2,'MOYEN'),(3,'MOYEN2');
+
+SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `first_name` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"'
+PARTITION BY LIST COLUMNS(`id`) (
+ PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+
+eval CREATE TABLE `tbl_b` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `last_name` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b"'
+PARTITION BY LIST COLUMNS(`id`) (
+ PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+
+eval CREATE TABLE `tbl_c` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `surname` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c"'
+PARTITION BY LIST COLUMNS(`id`) (
+ PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+
+SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id;
+
+--connection master_1
+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_result_log
+--enable_query_log
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_24523.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.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_24523.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test
new file mode 100644
index 00000000..00c0c873
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test
@@ -0,0 +1,66 @@
+--source ../include/mdev_24523_init.inc
+--echo
+--echo this test is for MDEV-24523
+--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 (
+ 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 VALUES (1, '{ "a": 1, "b": [2, 3]}');
+
+--echo
+--echo test 1
+
+--connection master_1
+UPDATE tbl_a SET j = JSON_REPLACE(j, '$.a', 10, '$.c', '[1, 2]');
+SELECT * FROM tbl_a;
+TRUNCATE TABLE tbl_a;
+INSERT INTO tbl_a VALUES (1, '{ "a": 1, "b": [2, 3]}');
+UPDATE tbl_a SET j = JSON_REPLACE(j, '$.a', 10, '$.b', '[1, 2]');
+SELECT * FROM tbl_a;
+--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_24523_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_25116.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.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_25116.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test
new file mode 100644
index 00000000..7ef23538
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_25116.test
@@ -0,0 +1,44 @@
+--echo #
+--echo # MDEV-25116 Spider: IF(COUNT( trigger SQL Error (1054)_ Unknown column '' in field list
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+CREATE TABLE tbl_a (id INT);
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ id INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+--connection master_1
+--disable_ps2_protocol
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+SELECT IF(COUNT(id > 0),'Y','N') FROM tbl_a;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+--enable_ps2_protocol
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_25684.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_25684.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_25684.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_25684.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_25684.test
new file mode 100644
index 00000000..243031e5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_25684.test
@@ -0,0 +1,19 @@
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
+--echo
+
+--connection master_1
+--error 12703
+SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', 'non_existing_temporary_table', 'srv "s_2_1"');
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_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/mdev_26151.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26151.test
new file mode 100644
index 00000000..f9e157d3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26151.test
@@ -0,0 +1,54 @@
+--echo
+--echo MDEV-26151 MDEV-31787
+--echo
+
+# This test exercises the code path where a nonzero casual_read takes
+# effect.
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--let $srv=srv_mdev_26151
+set @old_spider_bgs_mode= @@spider_bgs_mode;
+set session spider_bgs_mode=1;
+evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+# casual_read != 0 && casual_read != 1
+create table td (a int, PRIMARY KEY (a));
+
+eval create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "td", casual_read "3"';
+
+insert into td values (11), (42);
+
+select max(a) from ts;
+
+drop table td, ts;
+
+create table td (a int, PRIMARY KEY (a));
+
+# casual_read = 1
+eval create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "td", casual_read "1"';
+
+insert into td values (11), (42);
+
+select max(a) from ts;
+
+select min(a) from ts;
+
+drop table td, ts;
+
+eval drop server $srv;
+set session spider_bgs_mode=@old_spider_bgs_mode;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo end of test
+--echo
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26158.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26158.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26158.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_26158.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26158.test
new file mode 100644
index 00000000..0484d2b6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26158.test
@@ -0,0 +1,31 @@
+--echo #
+--echo # MDEV-26158 SIGSEGV in spider_free_mem from ha_spider::open on INSERT
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE t (
+ c INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"'
+PARTITION BY LIST COLUMNS(`c`) (
+ PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+);
+
+--error ER_BAD_DB_ERROR
+INSERT INTO t SELECT * FROM t;
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26247.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26247.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26247.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_26247.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26247.test
new file mode 100644
index 00000000..8d27c6e0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26247.test
@@ -0,0 +1,85 @@
+--echo #
+--echo # MDEV-26247 Spider: Valid LEFT JOIN results in ERROR 1064
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE t1 (
+ a11 int,
+ primary key (a11)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+eval CREATE TABLE t2 (
+ a21 int,
+ a22 int,
+ primary key (a21, a22)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+eval CREATE TABLE t3 (
+ a31 int,
+ a32 int,
+ primary key (a31, a32)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1, 11), (2, 22), (3, 33);
+INSERT INTO t3 VALUES (1, 111), (2, 222), (3, 333);
+
+--connection master_1
+#FIXME: this is a workaround.
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE t1 (
+ a11 int,
+ primary key (a11)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='srv "s_2_1", table "t1"';
+
+eval CREATE TABLE t2 (
+ a21 int,
+ a22 int,
+ primary key (a21, a22)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='srv "s_2_1", table "t2"';
+
+eval CREATE TABLE t3 (
+ a31 int,
+ a32 int,
+ primary key (a31, a32)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='srv "s_2_1", table "t3"';
+
+SELECT a22 FROM t1 LEFT JOIN t2 ON a11 = a21 WHERE a11 IN (1);
+SELECT a22 FROM t1 LEFT JOIN t2 ON a11 = a21 - a21 WHERE a11 IN (1);
+SELECT a22 FROM t2 RIGHT JOIN t1 ON a21 = a11 WHERE a11 IN (1);
+SELECT a22 FROM t2 RIGHT JOIN t1 ON a21 = a11 WHERE a11 IN (1,2);
+SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 RIGHT JOIN t3 on a21 = a31 WHERE a11 IN (1);
+SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 - a21 RIGHT JOIN t3 on a21 = a31 - a31 WHERE a11 IN (1);
+SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 RIGHT JOIN t3 on a21 = a31 WHERE a11 IN (1,2);
+SELECT a22 FROM t2 LEFT JOIN t1 ON a11 = a21 WHERE a11 IN (1);
+SELECT a22 FROM t2 LEFT JOIN t1 ON a11 = a21 - a21 WHERE a11 IN (1);
+SELECT a22 FROM t1 RIGHT JOIN t2 ON a21 = a11 WHERE a11 IN (1);
+SELECT a22 FROM t1 RIGHT JOIN t2 ON a21 = a11 WHERE a11 IN (1,2);
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
+--echo #
+--echo # end of test mdev_26247
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26539.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26539.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26539.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_26539.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26539.test
new file mode 100644
index 00000000..f2561f8c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26539.test
@@ -0,0 +1,40 @@
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo #
+--echo # MDEV-26539 SIGSEGV in spider_check_and_set_trx_isolation and I_P_List_iterator from THD::drop_temporary_table (10.5.3 opt only) on ALTER
+--echo #
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ c INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ c INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS (c) (
+ PARTITION pt1 DEFAULT COMMENT = 'srv "s_2_1"'
+);
+
+INSERT INTO tbl_a VALUES (1);
+ALTER TABLE tbl_a CHECK PARTITION ALL;
+
+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_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test
new file mode 100644
index 00000000..bf6cb255
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test
@@ -0,0 +1,23 @@
+--echo #
+--echo # MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds
+--echo #
+
+if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%UBSAN%"`)
+{
+--skip test needs to be run with UBSAN
+}
+
+# init spider
+
+INSTALL SONAME 'ha_spider.so';
+
+let $PLUGIN_NAME= spider_flush_table_mon_cache;
+let $PLUGIN_EXIST=
+ `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
+while (!$PLUGIN_EXIST)
+{
+ let $PLUGIN_EXIST=
+ `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
+}
+
+--source ../../include/clean_up_spider.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26544.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26544.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26544.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_26544.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26544.test
new file mode 100644
index 00000000..ac2b6898
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26544.test
@@ -0,0 +1,32 @@
+--echo #
+--echo # MDEV-26544 Assertion `part_share->auto_inc_initialized' failed in ha_partition::get_auto_increment on INSERT
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE `tbl_a` (
+ `a` INT AUTO_INCREMENT, KEY(`a`)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+PARTITION BY LIST COLUMNS (`a`) (
+ PARTITION `pt1` DEFAULT
+);
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
+INSERT INTO tbl_a (a) VALUES (0);
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
+INSERT INTO tbl_a () VALUES ();
+
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26582.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26582.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26582.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_26582.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26582.test
new file mode 100644
index 00000000..b131b093
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26582.test
@@ -0,0 +1,27 @@
+--echo #
+--echo # MDEV-26582 SIGSEGV in spider_db_bulk_insert and spider_db_connect and spider_db_before_query, and hang in "End of update loop" / "Reset for next command" query states
+--echo #
+
+# NOTE: The bug does not reproduce if we import ../../t/test_init.inc instead.
+--disable_query_log
+--disable_result_log
+--source ../../include/init_spider.inc
+--enable_result_log
+--enable_query_log
+
+CREATE DATABASE IF NOT EXISTS auto_test_local;
+USE auto_test_local;
+
+CREATE TABLE t (i CHAR) ENGINE=SPIDER;
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_NET_READ_ERROR
+INSERT INTO t VALUES (0);
+--error ER_BAD_FIELD_ERROR
+INSERT t SELECT 1 ON DUPLICATE KEY UPDATE c=1;
+
+DROP DATABASE IF EXISTS auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../include/deinit_spider.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.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_27172.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test
new file mode 100644
index 00000000..d6e2ff2c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test
@@ -0,0 +1,94 @@
+--echo #
+--echo # MDEV-27172 Prefix indices on Spider tables may lead to wrong query results
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+SET @general_log_backup = @@global.general_log;
+SET @log_output_backup = @@global.log_output;
+SET @@global.general_log = 1;
+SET @@global.log_output = "TABLE";
+
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE tbl_a (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY(greeting)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+eval CREATE TABLE tbl_b (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY k (greeting(5))
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+eval CREATE TABLE tbl_c (
+ id int NOT NULL,
+ greeting TEXT,
+ KEY k (greeting(5))
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+# = (equality)
+eval CREATE TABLE tbl_a (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY k (greeting)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+--disable_ps2_protocol
+INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_a WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
+
+# LIKE
+eval CREATE TABLE tbl_b (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY k (greeting(5))
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b", srv "s_2_1"';
+
+INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_b WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
+
+# LIKE
+eval CREATE TABLE tbl_c (
+ id int NOT NULL,
+ greeting TEXT,
+ KEY k (greeting(5))
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c", srv "s_2_1"';
+
+INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_c WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
+
+--connection child2_1
+SELECT argument FROM mysql.general_log WHERE argument LIKE 'select `id`,`greeting` from %';
+--enable_ps2_protocol
+
+--connection child2_1
+SET @@global.general_log = @general_log_backup;
+SET @@global.log_output = @log_output_backup;
+DROP DATABASE auto_test_remote;
+
+--connection master_1
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27184.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27184.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27184.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_27184.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27184.test
new file mode 100644
index 00000000..c7d64d2b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27184.test
@@ -0,0 +1,31 @@
+--echo #
+--echo # MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) ||
+--echo # ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) &&
+--echo # ((unsigned long) old_end & (pagesize - 1)) == 0)' failed,
+--echo # Assertion `str.alloced_length() >= str.length() + data_len' failed
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+CREATE TABLE tbl_a (a FLOAT) ENGINE=SPIDER;
+
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_NET_READ_ERROR
+INSERT INTO tbl_a VALUES
+ (0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),
+ (0xF5A7),(0xF5A8),(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE);
+
+DROP DATABASE auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt b/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt
new file mode 100644
index 00000000..b0466071
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt
@@ -0,0 +1 @@
+--init-file=$MTR_SUITE_DIR/t/mdev_27233.sql
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql b/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql
new file mode 100644
index 00000000..2be9ec1f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql
@@ -0,0 +1,3 @@
+INSTALL SONAME 'ha_spider.so';
+USE test;
+CREATE TABLE t (c INT) ENGINE=SPIDER;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test
new file mode 100644
index 00000000..88e70f4b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test
@@ -0,0 +1,7 @@
+--echo #
+--echo # MDEV-27233 Server hangs when using --init-file which loads Spider and creates a Spider table
+--echo #
+# ps protocol eats warnings
+--disable_ps_protocol
+show create table t;
+--enable_ps_protocol
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.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_27239.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test
new file mode 100644
index 00000000..3cf4bebd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test
@@ -0,0 +1,24 @@
+--echo #
+--echo # MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+CREATE TABLE tbl_a (a INT) ENGINE=SPIDER;
+FLUSH TABLE tbl_a WITH READ LOCK;
+BEGIN;
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.cnf
new file mode 100644
index 00000000..b0853e32
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.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_27240.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test
new file mode 100644
index 00000000..c9cc9f6e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test
@@ -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
+
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER;
+--error ER_BAD_FIELD_ERROR
+SELECT a.z FROM tbl_a AS a,tbl_a b WHERE a.z=b.z;
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE tbl_a CHANGE c c INT;
+# FIXME: MDEV-32046
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_NET_READ_ERROR
+LOCK TABLE tbl_a READ;
+
+DROP DATABASE auto_test_local;
+
+--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/mdev_28218.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218.test
new file mode 100644
index 00000000..91fdf168
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218.test
@@ -0,0 +1,10 @@
+--echo #
+--echo # MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
+--echo #
+INSTALL SONAME 'ha_spider.so';
+DROP TABLE IF EXISTS mysql.spider_tables;
+--error ER_NO_SUCH_TABLE
+show create table mysql.spider_tables;
+
+--disable_query_log
+--source ../../include/clean_up_spider.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt
new file mode 100644
index 00000000..556df9cd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt
@@ -0,0 +1 @@
+--init-file=$MTR_SUITE_DIR/t/mdev_28218_init_file.sql
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql
new file mode 100644
index 00000000..ef3e1e91
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql
@@ -0,0 +1,2 @@
+INSTALL PLUGIN spider SONAME 'ha_spider.so';
+DROP TABLE IF EXISTS mysql.spider_tables;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test
new file mode 100644
index 00000000..9152df4f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test
@@ -0,0 +1,7 @@
+--echo #
+--echo # MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
+--echo #
+# This is a variant of the testcase in MDEV-28218, where we put the
+# queries are in an init file
+--error ER_NO_SUCH_TABLE
+show create table mysql.spider_tables;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt
new file mode 100644
index 00000000..5561f625
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt
@@ -0,0 +1,2 @@
+--plugin-load-add=ha_spider
+--init-file=$MTR_SUITE_DIR/t/mdev_28218_mixed.sql
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql
new file mode 100644
index 00000000..e408ae0c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS mysql.spider_tables;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test
new file mode 100644
index 00000000..184a5399
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test
@@ -0,0 +1,8 @@
+--echo #
+--echo # MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
+--echo #
+# this is a variant of the testcase in MDEV-28218, where we load
+# spider early with --plugin_load_add, and execute the drop table
+# query in an init file
+--error ER_NO_SUCH_TABLE
+show create table mysql.spider_tables;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.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_28854.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test
new file mode 100644
index 00000000..47f4e57d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28854.test
@@ -0,0 +1,36 @@
+--echo #
+--echo # MDEV-28854 Spider: Disallow INSERT DELAYED on Spider table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (id INT);
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE tbl_a (
+ id INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+--connection master_1
+--error ER_DELAYED_NOT_SUPPORTED
+INSERT DELAYED INTO tbl_a VALUES (1);
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test
new file mode 100644
index 00000000..4f23168e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test
@@ -0,0 +1,163 @@
+--echo #
+--echo # MDEV-28856 Spider: Implement more engine-defined options
+--echo #
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+# This test covers some table params under consideration for inclusion
+# in the engine-defined options to be implemented in MDEV-28856.
+evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
+OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+--echo # testing monitoring_*
+INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server) VALUES
+('test', 't1', '0', 1, 'srv');
+
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", monitoring_kind "2"';
+
+--error 12511
+/* 1 */ insert into t1 values (42);
+--error 12514
+/* 2 */ insert into t1 values (42);
+create table t2 (c int);
+# Even though the table is available now, we still get "all links
+# failed" error
+--error 12514
+/* 3 */ insert into t1 values (42);
+drop table t1, t2;
+
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", monitoring_bg_kind "2",
+ monitoring_bg_interval "500000"';
+
+# The monitoring thread was killed before it could ping the remote
+# table, so the error is not 12511 or 12514
+--error ER_NO_SUCH_TABLE
+/* 4 */ insert into t1 values (42);
+drop table t1;
+
+--echo # testing query_cache_sync
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", query_cache_sync "3"';
+create table t2 (c int);
+/* 5 */ insert into t1 values (42);
+select sql_cache * from t1;
+select sql_no_cache * from t1;
+
+drop table t1, t2;
+
+--echo # testing tgt_pk_names
+# can insert duplicates...
+create table t2 (c int);
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
+/* 6 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# pk_names not used because no key declared in t1, 1022
+create table t2 (c int, primary key (c));
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
+/* 7 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# pk_name is the default "PRIMARY", 1062
+create table t2 (c int, primary key (c));
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
+/* 8 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# key name c does not match PRIMARY, 1022
+create table t2 (c int, primary key (c));
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "c"';
+/* 9 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# local primary key name c matches remote unique key name c, 1062 but
+# warning says PRIMARY instead of c, because key->name is PRIMARY
+# instead of c
+create table t2 (c int, unique key (c));
+create table t1 (c int, primary key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "c"';
+/* 9.1 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# key name f does not match t2 key name, but it is not used any way
+# because there's no primary key, 1062
+create table t2 (c int, unique key (c));
+create table t1 (c int, key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "f"';
+/* 10 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# key name blah does not match t2 error key name PRIMARY, and the
+# non-primary key-route does not return PRIMARY, 1022
+create table t2 (c int, primary key (c));
+create table t1 (c int, key (c)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "blah"';
+/* 11 */ insert ignore into t1 values (42), (42);
+select * from t1;
+
+drop table t1, t2;
+
+# key name blah does not match t2 key name, but still 1062, because we
+# go through the non-primary key route
+create table t2 (c int, d int, unique key (c), unique key (d));
+create table t1 (c int, d int, key (c), key (d)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", pk_name "blah"';
+/* 12 */ insert ignore into t1 values (42, 43), (43, 43);
+select * from t1;
+
+drop table t1, t2;
+
+--echo # Testing index hint
+create table t2 (c int, d int, primary key (c), key (d));
+show create table t2;
+create table t1 (c int, d int, primary key (c), key (d)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", idx000 "f d"';
+show create table t1;
+/* 13 */ insert into t1 values (42, 23), (37, 93);
+select max(d) from t1;
+
+drop table t1, t2;
+
+# multiple indices
+create table t2 (c int, d int, e int, primary key (c), key (d), unique key (e));
+show create table t2;
+create table t1 (c int, d int, e int, primary key (c), key (d), unique key (e)) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", idx000 "f PRIMARY", idx001 "u d", idx002 "ig e"';
+show create table t1;
+/* 14 */ insert into t1 values (42, 23, 89), (37, 93, 47);
+select max(d) from t1;
+
+drop table t1, t2;
+
+drop server srv;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--echo #
+--echo # end of test mdev_28856
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28996.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_28996.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28996.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_28996.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28996.test
new file mode 100644
index 00000000..8097fe7e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28996.test
@@ -0,0 +1,40 @@
+--echo #
+--echo # MDEV-28996 ASAN errors in String::q_append / spider_string::q_append / spider_db_mbase_util::open_item_func
+--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;
+
+eval CREATE TABLE tbl_a (
+ a CHAR(8)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO tbl_a VALUES ('foo'),('bar');
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ a CHAR(8)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+SELECT MAX(BINARY a) 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_28998.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28998.test
new file mode 100644
index 00000000..d67011ca
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28998.test
@@ -0,0 +1,39 @@
+--echo #
+--echo # MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
+--echo #
+
+if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%ASAN%"`)
+{
+--skip test needs to be run with ASAN
+}
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+# FIXME: this is a workaround.
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t1_SPIDER (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
+
+CREATE TABLE t2 AS SELECT a FROM t1_SPIDER;
+SELECT * FROM t2;
+
+# Cleanup
+DROP TABLE t2, t1_SPIDER, t1;
+drop server s;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--echo #
+--echo # end of test mdev_28998
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.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_29008.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test
new file mode 100644
index 00000000..28d9a924
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test
@@ -0,0 +1,39 @@
+--echo #
+--echo # MDEV-29008 Server crash or assertion `field' failed in spider_db_open_item_ident / group by handler
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+INSERT INTO tbl_a VALUES (1,2),(3,4);
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2;
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29011.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29011.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29011.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_29011.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29011.test
new file mode 100644
index 00000000..6aaf9305
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29011.test
@@ -0,0 +1,40 @@
+--echo #
+--echo # MDEV-29011 Server crash in spider_db_open_item_cond with XOR operator
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+INSERT INTO tbl_a VALUES (0, 0), (0, 1), (1, 0), (1, 1);
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+SELECT a XOR b AS f FROM tbl_a;
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test
new file mode 100644
index 00000000..0bfcc46f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test
@@ -0,0 +1,36 @@
+--echo #
+--echo # MDEV-29163 Server crash with SIGSEGV or dynamic-stack-buffer-overflow in spider_db_mbase_util::append_table
+--echo #
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+#FIXME: this is a workaround.
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT, PRIMARY KEY(c));
+
+CREATE TABLE t1_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
+CREATE TABLE t2_spider (b INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't2'";
+CREATE TABLE t3_spider (c INT, PRIMARY KEY(c)) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't3'";
+
+SELECT t1_spider.* FROM t1_spider LEFT JOIN t2_spider LEFT JOIN t3_spider ON b = c ON a = b;
+
+# Cleanup
+DROP TABLE t1_spider, t2_spider, t3_spider, t1, t2, t3;
+drop server s;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--echo #
+--echo # end of test mdev_29163
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test
new file mode 100644
index 00000000..626364ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test
@@ -0,0 +1,11 @@
+CREATE TABLE t (c INT);
+SHOW CREATE TABLE t;
+FLUSH TABLES WITH READ LOCK;
+
+--error ER_CANT_UPDATE_WITH_READLOCK
+CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
+SELECT * FROM t;
+
+--source include/restart_mysqld.inc
+
+DROP TABLE t;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29447.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29447.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29447.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_29447.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29447.test
new file mode 100644
index 00000000..60250be6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29447.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # MDEV-29447 SIGSEGV in spider_db_open_item_field and SIGSEGV spider_db_print_item_type, on SELECT
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+SELECT TRIM(LEADING 'c' FROM a) FROM tbl_a;
+
+--connection child2_1
+DROP DATABASE auto_test_remote;
+
+--connection master_1
+DROP DATABASE auto_test_local;
+
+--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_29484.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29484.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29484.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_29484.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29484.test
new file mode 100644
index 00000000..b6fe3b54
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29484.test
@@ -0,0 +1,47 @@
+--echo #
+--echo # MDEV-29484 Assertion `!trx_free || !trx->locked_connections' failed in spider_free_trx_conn on LOCK TABLES
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+eval CREATE TABLE tbl_b (
+ a INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET;
+
+LOCK TABLES tbl_a WRITE;
+--error 1429
+LOCK TABLES tbl_b READ, tbl_a READ;
+
+--disconnect master_1 # crash
+--source ../../t/connect_master_1.inc
+
+--connection child2_1
+DROP DATABASE auto_test_remote;
+
+--connection master_1
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test
new file mode 100644
index 00000000..88591f80
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test
@@ -0,0 +1,67 @@
+--echo #
+--echo # MDEV-29502 ASAN: heap-buffer-overflow & stack-buffer-overflow in spider_db_mbase_row::append_to_str | SIGSEGV's in __memmove_avx_unaligned_erms from memcpy in Binary_string::q_append, in Static_binary_string::q_append and my_strntoull10rnd_8bit | Unknown error 12801
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--let $srv=srv_mdev_29502
+evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (23),(48);
+
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+
+eval CREATE TABLE t1 (a INT KEY) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "$srv",TABLE "t"';
+
+SELECT MAX(a) FROM t1;
+SELECT SUM(a) FROM t1;
+SELECT COUNT(a) FROM t1;
+SELECT MAX(a), SUM(a) FROM t1;
+SELECT COUNT(a), MAX(a), SUM(a) FROM t1;
+SELECT MAX(a), COUNT(a), SUM(a) FROM t1;
+SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+
+DROP TABLE t, t1;
+
+CREATE TABLE t (a INT, b INT);
+INSERT INTO t VALUES (23, -1),(48, 97);
+
+eval CREATE TABLE t1 (a INT, b INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "$srv",TABLE "t"';
+
+SELECT MAX(a + b), SUM(a - b) FROM t1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+
+DROP TABLE t, t1;
+
+# An example where GBH is not created (MDEV-25116), and direct
+# aggregate is used to speed up the query.
+CREATE TABLE t (a INT);
+INSERT INTO t VALUES (23),(97),(42);
+
+eval CREATE TABLE t1 (a INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "$srv",TABLE "t"';
+
+--disable_ps2_protocol
+SELECT IF(COUNT(a > 0),'Y','N'), MAX(a) FROM t1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+SELECT MAX(a), IF(COUNT(a > 0),'Y','N') FROM t1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+--enable_ps2_protocol
+
+DROP TABLE t, t1;
+
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+eval DROP SERVER $srv;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.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_29562.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test
new file mode 100644
index 00000000..5ddb2cef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test
@@ -0,0 +1,54 @@
+--echo #
+--echo # MDEV-29562 Spider table with charset utf32/utf16/ucs2 tries to set client charset to unsupported value
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE CHARSET utf32 COMMENT='table "tbl_a", srv "s_2_1"';
+
+ALTER DATABASE auto_test_local CHARSET="ucs2";
+--error ER_ILLEGAL_HA_CREATE_OPTION
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE COMMENT='table "tbl_a", srv "s_2_1"';
+
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE CHARSET utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT * FROM tbl_a;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16le;
+
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET latin1;
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test
new file mode 100644
index 00000000..3a8fbb25
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29644.test
@@ -0,0 +1,56 @@
+--echo #
+--echo # MDEV-29644 a potential bug of null pointer dereference in spider_db_mbase::print_warnings()
+--echo #
+
+# The test case below does not cause the potential null pointer dereference.
+# It is just for checking spider_db_mbase::fetch_and_print_warnings() works.
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a CHAR(5)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+SET GLOBAL sql_mode='';
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE tbl_a (
+ a CHAR(255)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+SET sql_mode='';
+
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.1.err;
+let SEARCH_PATTERN= \[WARN SPIDER RESULT\].* Warning 1265 Data truncated for column 'a' at row 1.*;
+
+INSERT INTO tbl_a VALUES ("this will be truncated");
+--source include/search_pattern_in_file.inc # should not find
+
+SET GLOBAL spider_log_result_errors=4;
+
+INSERT INTO tbl_a VALUES ("this will be truncated");
+--source include/search_pattern_in_file.inc # should find
+
+--connection master_1
+SET GLOBAL spider_log_result_errors=DEFAULT;
+SET sql_mode=DEFAULT;
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+SET GLOBAL sql_mode=DEFAULT;
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.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_29653.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test
new file mode 100644
index 00000000..6accaed3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE t (
+ c INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE ts (
+ c INT
+) $MASTER_1_ENGINE COMMENT='table "t", srv "s_2_1"';
+
+SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1));
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test
new file mode 100644
index 00000000..d3dcb363
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29904.test
@@ -0,0 +1,6 @@
+--echo #
+--echo # MDEV-29904 SPIDER plugin initialization fails upon startup
+--echo #
+
+--let $restart_parameters=--plugin-load-add=ha_spider
+--source include/restart_mysqld.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30191.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_30191.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30191.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_30191.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30191.test
new file mode 100644
index 00000000..8d19a351
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30191.test
@@ -0,0 +1,51 @@
+--echo #
+--echo # MDEV-30191 SIGSEGV & heap-use-after-free in spider_db_print_item_type, SIGABRT in __cxa_pure_virtual/spider_db_print_item_type, Got error 128 "Out of memory in engine", 56/112 memory not freed, and Assertion `fixed()' failed in Item_sp_variable::val_str on SP call
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (c INT);
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+eval CREATE TABLE tbl_a (
+ c INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+CREATE TABLE tbl_b (c INT);
+
+--delimiter $$
+CREATE PROCEDURE sp() BEGIN
+ DECLARE v1 DATE;
+ WHILE EXISTS (SELECT 1 FROM tbl_a WHERE c>v1 AND c<=v1) DO
+ SELECT 1;
+ END WHILE;
+ WHILE EXISTS (SELECT 1
+ FROM tbl_a
+ WHERE c<v1 AND EXISTS (SELECT 1
+ FROM tbl_b
+ WHERE tbl_a.c=tbl_b.c)) DO
+ SELECT 1;
+ END WHILE;
+END $$
+--delimiter ;
+CALL sp();
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test
new file mode 100644
index 00000000..73376d27
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test
@@ -0,0 +1,11 @@
+--source include/have_wsrep.inc
+--echo #
+--echo # MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so
+--echo #
+
+call mtr.add_suppression(".*\\[Warning\\] InnoDB: Skipping buffer pool dump/restore during wsrep recovery");
+--source include/kill_mysqld.inc
+--exec $MYSQLD_LAST_CMD --wsrep-recover --plugin-load-add=ha_spider
+--source include/start_mysqld.inc
+--disable_query_log
+--source ../../include/clean_up_spider.inc
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test
new file mode 100644
index 00000000..6d14f155
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test
@@ -0,0 +1,32 @@
+--echo #
+--echo # MDEV-30392 Syntax error upon query with subquery from Spider table
+--echo #
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+
+evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 'srv', table 't1'";
+
+SELECT a FROM t2 WHERE a IN ( SELECT a FROM t2 );
+
+# Cleanup
+
+DROP TABLE t1, t2;
+DROP SERVER srv;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--echo #
+--echo # end of test mdev_30392
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30981.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30981.test
new file mode 100644
index 00000000..cc24ce82
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30981.test
@@ -0,0 +1,24 @@
+--echo #
+--echo # MDEV-30981 Spider UBSAN: null pointer passed as argument 2, which is declared to never be null in spider_create_trx_alter_table on ALTER
+--echo #
+
+if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%UBSAN%"`)
+{
+--skip test needs to be run with UBSAN
+}
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+CREATE TABLE t (c INT) ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2));
+ALTER TABLE t ENGINE=InnoDB;
+drop table t;
+
+--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_31117.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31117.test
new file mode 100644
index 00000000..7baeba3f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31117.test
@@ -0,0 +1,31 @@
+--echo #
+--echo # MDEV-31117 Spider UBSAN runtime error: applying non-zero offset x to null pointer in st_spider_param_string_parse::restore_delims
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--error 12501
+CREATE TABLE t (c INT) ENGINE=Spider COMMENT='abc';
+
+--error 12501
+ALTER TABLE mysql.help_topic ENGINE=Spider;
+
+evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+create table t2 (c int);
+# param title should not have delimiter
+--error 12501
+create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", "srv" "srv",TABLE "t2"';
+# test escaping
+create table t1 (c int) ENGINE=Spider CONNECTION='WRAPPER "mysql", srv \'srv\',TABLE "t2", password "say \\"hello\\ world!\\""';
+drop table t1, t2;
+
+drop server srv;
+--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_31338.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test
new file mode 100644
index 00000000..e628c3b9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test
@@ -0,0 +1,23 @@
+--echo #
+--echo # MDEV-31338 UBSAN: runtime error: member access within null pointer of type 'struct SPIDER_FIELD_CHAIN' and SIGSEGV in spider_db_open_item_ident on SELECT
+--echo #
+--source include/have_innodb.inc
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+CREATE TABLE t (c BLOB) ENGINE=InnoDB;
+CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
+SELECT TRIM(BOTH ' ' FROM c) FROM ts ORDER BY c;
+drop table t, ts;
+
+drop server srv;
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31524.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31524.test
new file mode 100644
index 00000000..64cbf415
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31524.test
@@ -0,0 +1,73 @@
+--echo
+--echo MDEV-31524 Spider variables that double as table params overriding mechanism is buggy
+--echo
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--let $srv=srv_mdev_31524
+SET @old_spider_read_only_mode = @@session.spider_read_only_mode;
+evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+# when the user does not set var nor the table option, the default
+# value (0 in this case) takes effect.
+set session spider_read_only_mode = default;
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "t2"';
+/* 1 */ insert into t1 values (42);
+drop table t1, t2;
+
+# when the user sets var but not the table option, the var should be
+# take effect.
+set session spider_read_only_mode = 1;
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "t2"';
+--error 12518
+/* 2 */ insert into t1 values (42);
+drop table t1, t2;
+
+# when the user sets var to -1 and does not set the table option, the
+# default value takes effect.
+set session spider_read_only_mode = -1;
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "t2"';
+/* 3 */ insert into t1 values (42);
+drop table t1, t2;
+
+# when the user does not set the var, but sets the table option, the
+# table option should take effect
+SET session spider_read_only_mode = default;
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='read_only_mode "1", WRAPPER "mysql", srv "$srv",TABLE "t2"';
+--error 12518
+/* 4 */ insert into t1 values (42);
+drop table t1, t2;
+
+# when the user sets both var and table option, the table option
+# should take precedence
+set session spider_read_only_mode = 1;
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='read_only_mode "0", WRAPPER "mysql", srv "$srv",TABLE "t2"';
+/* 5 */ insert into t1 values (42);
+drop table t1, t2;
+
+# when the user sets the var to -1 and sets the table option, the
+# table option should take effect
+SET session spider_read_only_mode = -1;
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='read_only_mode "1", WRAPPER "mysql", srv "$srv",TABLE "t2"';
+--error 12518
+/* 6 */ insert into t1 values (42);
+drop table t1, t2;
+
+eval drop server $srv;
+
+SET session spider_read_only_mode = @old_spider_read_only_mode;
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test
new file mode 100644
index 00000000..48bfa740
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test
@@ -0,0 +1,35 @@
+--echo #
+--echo # MDEV-31645 Spider doesn't recognize semi JOIN
+--echo #
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
+set spider_disable_group_by_handler=1;
+
+evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a));
+CREATE TABLE t2 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)) ENGINE=SPIDER COMMENT='srv "srv", WRAPPER "mysql", TABLE "t1"';
+
+SET SESSION optimizer_switch='semijoin=off';
+SELECT * FROM t2
+WHERE A BETWEEN 0 AND 10 AND B IN(SELECT B FROM t2 WHERE A BETWEEN 11 AND 20);
+
+SET SESSION optimizer_switch='semijoin=on';
+
+SELECT * FROM t2
+WHERE A BETWEEN 0 AND 10 AND B IN(SELECT B FROM t2 WHERE A BETWEEN 11 AND 20);
+drop table t1, t2;
+drop server srv;
+set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--echo #
+--echo # end of test mdev_31645
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31996.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31996.test
new file mode 100644
index 00000000..3e823790
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31996.test
@@ -0,0 +1,50 @@
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
+OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+
+set session spider_delete_all_rows_type=0;
+
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+delete from t1;
+drop table t1, t2;
+
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+insert ignore into t1 values (42), (378);
+select * from t1;
+delete from t1;
+select * from t1;
+drop table t1, t2;
+
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+truncate t1;
+drop table t1, t2;
+
+create table t2 (c int);
+create table t1 (c int) ENGINE=Spider
+COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", delete_all_rows_type "0"';
+insert ignore into t1 values (42), (378);
+select * from t1;
+truncate t1;
+select * from t1;
+drop table t1, t2;
+
+drop server srv;
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--echo #
+--echo # end of test tmp
+--echo #
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test
new file mode 100644
index 00000000..d208957f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test
@@ -0,0 +1,14 @@
+--echo #
+--echo # MDEV-32683 Spider engine does not load with non-default alter-algorithm
+--echo #
+set global alter_algorithm=INSTANT;
+install plugin spider soname 'ha_spider';
+select plugin_name, plugin_status, plugin_type, plugin_license, load_option from information_schema.plugins where plugin_name like 'spider';
+uninstall plugin spider;
+drop table mysql.spider_link_failed_log, mysql.spider_link_mon_servers, mysql.spider_tables, mysql.spider_table_crd, mysql.spider_table_position_for_recovery, mysql.spider_table_sts, mysql.spider_xa, mysql.spider_xa_failed_log, mysql.spider_xa_member;
+drop function spider_direct_sql;
+drop function spider_bg_direct_sql;
+drop function spider_ping_table;
+drop function spider_copy_tables;
+drop function spider_flush_table_mon_cache;
+set global alter_algorithm=DEFAULT;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt
new file mode 100644
index 00000000..924ea4e3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt
@@ -0,0 +1 @@
+--plugin-load-add=ha_spider
diff --git a/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test
new file mode 100644
index 00000000..396145fb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test
@@ -0,0 +1,7 @@
+--echo #
+--echo # plugin-load-add=ha_spider
+--echo #
+# A simple test that tests plugin-load-add=ha_spider
+select * from mysql.plugin;
+create table t (c int) Engine=SPIDER;
+drop table t;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt
new file mode 100644
index 00000000..bf4180ca
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt
@@ -0,0 +1 @@
+--plugin-load-add=SPIDER=ha_spider
diff --git a/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.test b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.test
new file mode 100644
index 00000000..49db6c38
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.test
@@ -0,0 +1,7 @@
+--echo #
+--echo # plugin-load-add=ha_spider
+--echo #
+# A simple test that tests plugin-load-add=SPIDER=ha_spider
+select * from mysql.plugin;
+create table t (c int) Engine=SPIDER;
+drop table t;
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..3fd9e623
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test
@@ -0,0 +1,158 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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;
+
+--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..940fa61c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test
@@ -0,0 +1,158 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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;
+
+--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..e9270a2e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test
@@ -0,0 +1,158 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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;
+
+--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..ad042aad
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test
@@ -0,0 +1,159 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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;
+
+--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..d4c0db1e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test
@@ -0,0 +1,104 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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..a5f63978
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test
@@ -0,0 +1,80 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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..feb7df57
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test
@@ -0,0 +1,74 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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..b511b05b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test
@@ -0,0 +1,76 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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/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/self_reference_multi.test b/storage/spider/mysql-test/spider/bugfix/t/self_reference_multi.test
new file mode 100644
index 00000000..2ac927d9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/self_reference_multi.test
@@ -0,0 +1,30 @@
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo MDEV-6268 SPIDER table with no COMMENT clause causes queries to wait forever
+--echo
+
+--let $srv=srv_self_reference_multi
+evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
+create table t2 (c int);
+eval create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "t2"';
+eval create table t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "t1"';
+eval alter table t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "t0"';
+--error 12719
+select * from t0;
+--error 12719
+select * from t1;
+--error 12719
+select * from t2;
+drop table t0, t1, t2;
+eval drop server $srv;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/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..3d4280e3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test
@@ -0,0 +1,99 @@
+--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
+
+--disable_ps2_protocol
+--replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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..c4b17f6a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/sql_mode.inc
@@ -0,0 +1,68 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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
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..eaf149fa
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test
@@ -0,0 +1,109 @@
+--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;
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+--disable_ps2_protocol
+SELECT count(pkey) cnt, skey FROM tbl_a;
+--enable_ps2_protocol
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+--connection child2_1
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+--disable_ps2_protocol
+eval $CHILD2_2_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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/udf_mysql_func_early.cnf b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.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/udf_mysql_func_early.opt b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.opt
new file mode 100644
index 00000000..52144383
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.opt
@@ -0,0 +1 @@
+--plugin-load-add=ha_spider \ No newline at end of file
diff --git a/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test
new file mode 100644
index 00000000..4edff9ca
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test
@@ -0,0 +1,48 @@
+--echo #
+--echo # Test that udf created by inserting into mysql_func works as expected
+--echo #
+
+evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+HOST 'localhost',
+DATABASE 'auto_test_local',
+USER 'root',
+PASSWORD '',
+SOCKET '$MASTER_1_MYSOCK'
+ );
+evalp CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+HOST 'localhost',
+DATABASE 'auto_test_remote',
+USER 'root',
+PASSWORD '',
+SOCKET '$CHILD2_1_MYSOCK'
+ );
+
+--connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
+--connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK)
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+insert into tbl_a values (42);
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+create temporary table results (a int);
+--disable_ps_protocol
+SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"');
+--enable_ps_protocol
+select * from results;
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
diff --git a/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.cnf b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.cnf
new file mode 100644
index 00000000..05dfd8a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.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/udf_mysql_func_early_init_file.opt b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.opt
new file mode 100644
index 00000000..d0f5777d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.opt
@@ -0,0 +1 @@
+--init-file=$MTR_SUITE_DIR/t/udf_mysql_func_early_init_file.sql
diff --git a/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql
new file mode 100644
index 00000000..9b767554
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql
@@ -0,0 +1 @@
+install soname "ha_spider.so";
diff --git a/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.test b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.test
new file mode 100644
index 00000000..57b4ee15
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.test
@@ -0,0 +1,4 @@
+# Same as udf_mysql_func_early.test, except that we load spider in
+# init_file, which is after udf_init() and before
+# mysqld_server_started is on.
+--source udf_mysql_func_early.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..d32af316
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test
@@ -0,0 +1,73 @@
+--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;
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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/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..1e831453
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test
@@ -0,0 +1,71 @@
+--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
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc
new file mode 100644
index 00000000..52b0625e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_deinit.inc
@@ -0,0 +1,16 @@
+--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 master_1
+set session spider_bgs_mode= @old_spider_bgs_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/feature/include/checksum_table_parallel_extended_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_deinit.inc
new file mode 100644
index 00000000..799bd983
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_deinit.inc
@@ -0,0 +1 @@
+--source checksum_table_parallel_deinit.inc
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc
new file mode 100644
index 00000000..f17a532d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_extended_init.inc
@@ -0,0 +1,2 @@
+--source checksum_table_parallel_init.inc
+--let $MASTER_1_CHECKSUM_TABLE= CHECKSUM TABLE tbl_a EXTENDED
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc
new file mode 100644
index 00000000..73c358b7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_init.inc
@@ -0,0 +1,53 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source checksum_table_parallel_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 command_type != 'Execute' AND argument LIKE '%checksum %';
+--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 command_type != 'Execute' AND argument LIKE '%checksum %';
+--connection master_1
+set @old_spider_bgs_mode= @@spider_bgs_mode;
+set session spider_bgs_mode= 1;
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc
new file mode 100644
index 00000000..799bd983
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_deinit.inc
@@ -0,0 +1 @@
+--source checksum_table_parallel_deinit.inc
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc
new file mode 100644
index 00000000..230b6432
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_no_opt_init.inc
@@ -0,0 +1,2 @@
+--source checksum_table_parallel_init.inc
+--let $MASTER_1_CHECKSUM_TABLE= CHECKSUM TABLE tbl_a
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc
new file mode 100644
index 00000000..799bd983
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_deinit.inc
@@ -0,0 +1 @@
+--source checksum_table_parallel_deinit.inc
diff --git a/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc
new file mode 100644
index 00000000..66f6ecbe
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/checksum_table_parallel_quick_init.inc
@@ -0,0 +1,2 @@
+--source checksum_table_parallel_init.inc
+--let $MASTER_1_CHECKSUM_TABLE= CHECKSUM TABLE tbl_a QUICK
diff --git a/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_deinit.inc b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_deinit.inc
new file mode 100644
index 00000000..5ac67cdf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_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/feature/include/slave_transaction_retry_errors_init.inc b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_init.inc
new file mode 100644
index 00000000..052d6ebb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/include/slave_transaction_retry_errors_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/feature/my.cnf b/storage/spider/mysql-test/spider/feature/my.cnf
new file mode 100644
index 00000000..b7f76a63
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/my.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/feature/my_1_1.cnf b/storage/spider/mysql-test/spider/feature/my_1_1.cnf
new file mode 100644
index 00000000..5f17295d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_2_1.cnf b/storage/spider/mysql-test/spider/feature/my_2_1.cnf
new file mode 100644
index 00000000..24161645
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_2_2.cnf b/storage/spider/mysql-test/spider/feature/my_2_2.cnf
new file mode 100644
index 00000000..2d3c2a89
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_2_3.cnf b/storage/spider/mysql-test/spider/feature/my_2_3.cnf
new file mode 100644
index 00000000..024da651
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_3_1.cnf b/storage/spider/mysql-test/spider/feature/my_3_1.cnf
new file mode 100644
index 00000000..fad21607
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_3_2.cnf b/storage/spider/mysql-test/spider/feature/my_3_2.cnf
new file mode 100644
index 00000000..6f027b6f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_3_3.cnf b/storage/spider/mysql-test/spider/feature/my_3_3.cnf
new file mode 100644
index 00000000..fbb33694
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/my_4_1.cnf b/storage/spider/mysql-test/spider/feature/my_4_1.cnf
new file mode 100644
index 00000000..d1812a48
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/r/checksum_table_parallel_extended.result b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_extended.result
new file mode 100644
index 00000000..91f162a6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_extended.result
@@ -0,0 +1,130 @@
+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= 1;
+
+this test is for MDEV-16967
+
+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 WRITE;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a WRITE;
+connection master_1;
+CHECKSUM TABLE tbl_a EXTENDED;
+connection child2_1_2;
+SELECT SLEEP(1);
+SLEEP(1)
+0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+checksum table `auto_test_remote`.`tbl_a` extended
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'
+connection child2_2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+checksum table `auto_test_remote2`.`tbl_a` extended
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'
+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;
+UNLOCK TABLES;
+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;
+Table Checksum
+auto_test_local.tbl_a 1061386331
+
+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_bgs_mode= @old_spider_bgs_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/feature/r/checksum_table_parallel_no_opt.result b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_no_opt.result
new file mode 100644
index 00000000..ac114702
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_no_opt.result
@@ -0,0 +1,128 @@
+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= 1;
+
+this test is for MDEV-16967
+
+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 WRITE;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a WRITE;
+connection master_1;
+CHECKSUM TABLE tbl_a;
+connection child2_1_2;
+SELECT SLEEP(1);
+SLEEP(1)
+0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'
+connection child2_2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'
+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;
+UNLOCK TABLES;
+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;
+Table Checksum
+auto_test_local.tbl_a NULL
+
+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_bgs_mode= @old_spider_bgs_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/feature/r/checksum_table_parallel_quick.result b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_quick.result
new file mode 100644
index 00000000..34786113
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/r/checksum_table_parallel_quick.result
@@ -0,0 +1,128 @@
+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= 1;
+
+this test is for MDEV-16967
+
+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 WRITE;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a WRITE;
+connection master_1;
+CHECKSUM TABLE tbl_a QUICK;
+connection child2_1_2;
+SELECT SLEEP(1);
+SLEEP(1)
+0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'
+connection child2_2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'
+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;
+UNLOCK TABLES;
+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;
+Table Checksum
+auto_test_local.tbl_a NULL
+
+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_bgs_mode= @old_spider_bgs_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/feature/r/engine_defined_attributes.result b/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result
new file mode 100644
index 00000000..c772ecf7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/r/engine_defined_attributes.result
@@ -0,0 +1,236 @@
+#
+# MDEV-27106 Spider: specify connection to data node by engine-defined attributes
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+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 tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection child2_2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+# Single data node
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a";
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+# Multiple data nodes with high availability setting
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+REMOTE_SERVER="s_2_1 s_2_2" REMOTE_TABLE="tbl_a";
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+connection child2_1;
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+connection child2_2;
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+connection master_1;
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+# Multiple data nodes with partition options
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+PARTITION BY RANGE (a) (
+PARTITION p1 VALUES LESS THAN (3) REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a",
+PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2" REMOTE_TABLE="tbl_a"
+);
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+# Multiple data nodes with table options + partition options
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a"
+PARTITION BY RANGE (a) (
+PARTITION p1 VALUES LESS THAN (3),
+PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2"
+);
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+connection child2_1;
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+connection master_1;
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+# COMMENT + engine-defined option
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+COMMENT='tbl "tbl_a"'
+PARTITION BY RANGE (a) (
+PARTITION p1 VALUES LESS THAN (3) COMMENT='srv "s_2_1"',
+PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2"
+);
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+3 ccc
+4 ddd
+connection child2_1;
+SELECT * FROM tbl_a;
+a b
+1 aaa
+2 bbb
+connection master_1;
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+# COMMENT + engine-defined option (invalid)
+connection master_1;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a" COMMENT='tbl "tbl_b"';
+ERROR HY000: Can't create table `auto_test_local`.`tbl_a` (errno: 12501 "Unknown error 12501")
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+COMMENT='srv "s_2_1"' REMOTE_TABLE="tbl_a"
+PARTITION BY RANGE (a) (
+PARTITION p1 VALUES LESS THAN (3),
+PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2"
+);
+ERROR HY000: Can't create table `auto_test_local`.`tbl_a` (errno: 12501 "Unknown error 12501")
+# Various combinations of COMMENTs and options
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+REMOTE_SERVER="s_2_1" REMOTE_DATABASE="auto_test_remote" REMOTE_TABLE="tbl_a";
+SELECT * FROM tbl_a;
+a b
+DROP TABLE tbl_a;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+REMOTE_TABLE="tbl_a"
+PARTITION BY RANGE (a) (
+PARTITION p1 VALUES LESS THAN (3)
+REMOTE_SERVER="s_2_1" COMMENT='database "auto_test_remote"',
+PARTITION p2 VALUES LESS THAN MAXVALUE
+REMOTE_SERVER="s_2_2" REMOTE_DATABASE="auto_test_remote2"
+);
+SELECT * FROM tbl_a;
+a b
+DROP TABLE tbl_a;
+CREATE TABLE tbl_a (
+a INT,
+b VARCHAR(255),
+PRIMARY KEY(a)
+) ENGINE=Spider DEFAULT CHARSET=utf8
+COMMENT='tbl "tbl_a"'
+PARTITION BY RANGE (a) (
+PARTITION p1 VALUES LESS THAN (3)
+REMOTE_SERVER="s_2_1" REMOTE_DATABASE="auto_test_remote",
+PARTITION p2 VALUES LESS THAN MAXVALUE
+REMOTE_SERVER="s_2_2" REMOTE_DATABASE="auto_test_remote2"
+);
+SELECT * FROM tbl_a;
+a b
+DROP TABLE tbl_a;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider DEFAULT CHARSET=utf8
+PARTITION BY HASH (a) PARTITIONS 2;
+SELECT * FROM tbl_a;
+ERROR HY000: Unable to connect to foreign data source: localhost
+DROP TABLE tbl_a;
+# MDEV-27860 SIGSEGV in spider_parse_connect_info on CREATE TABLE
+CREATE TABLE tbl_a ENGINE=SPIDER COMMENT="TABLE 'unknown_table'"
+PARTITION BY LIST COLUMNS (c) (
+PARTITION p DEFAULT COMMENT="srv 'unknown_server'" ENGINE=SPIDER
+);
+ERROR HY000: The foreign server name you are trying to reference does not exist. Data source error: unknown_server
+connection child2_1;
+DROP DATABASE auto_test_remote;
+connection child2_2;
+DROP DATABASE auto_test_remote2;
+connection master_1;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result b/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result
new file mode 100644
index 00000000..0a147c03
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.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
+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/feature/suite.opt b/storage/spider/mysql-test/spider/feature/suite.opt
new file mode 100644
index 00000000..672a3b37
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/suite.opt
@@ -0,0 +1 @@
+--loose-innodb --loose-skip-performance-schema
diff --git a/storage/spider/mysql-test/spider/feature/suite.pm b/storage/spider/mysql-test/spider/feature/suite.pm
new file mode 100644
index 00000000..171fa6c4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/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/feature/t/checksum_table_parallel.inc b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel.inc
new file mode 100644
index 00000000..83c3ffd6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel.inc
@@ -0,0 +1,109 @@
+--echo
+--echo this test is for MDEV-16967
+--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
+
+--disable_ps2_protocol
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a WRITE;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+LOCK TABLE tbl_a WRITE;
+
+--connection master_1
+send_eval $MASTER_1_CHECKSUM_TABLE;
+
+--connection child2_1_2
+SELECT SLEEP(1);
+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
+UNLOCK TABLES;
+eval $CHILD2_2_SELECT_TABLES;
+
+--connection master_1
+reap;
+--enable_ps2_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;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.cnf b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.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/feature/t/checksum_table_parallel_extended.test b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.test
new file mode 100644
index 00000000..871e1e86
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_extended.test
@@ -0,0 +1,5 @@
+--source ../include/checksum_table_parallel_extended_init.inc
+--source checksum_table_parallel.inc
+--source ../include/checksum_table_parallel_extended_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.cnf b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.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/feature/t/checksum_table_parallel_no_opt.test b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.test
new file mode 100644
index 00000000..0352d598
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_no_opt.test
@@ -0,0 +1,5 @@
+--source ../include/checksum_table_parallel_no_opt_init.inc
+--source checksum_table_parallel.inc
+--source ../include/checksum_table_parallel_no_opt_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.cnf b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.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/feature/t/checksum_table_parallel_quick.test b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.test
new file mode 100644
index 00000000..f08f782e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/checksum_table_parallel_quick.test
@@ -0,0 +1,5 @@
+--source ../include/checksum_table_parallel_quick_init.inc
+--source checksum_table_parallel.inc
+--source ../include/checksum_table_parallel_quick_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.cnf b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.cnf
new file mode 100644
index 00000000..e0ffb99c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.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/feature/t/engine_defined_attributes.test b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test
new file mode 100644
index 00000000..0d5c8490
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/engine_defined_attributes.test
@@ -0,0 +1,227 @@
+--echo #
+--echo # MDEV-27106 Spider: specify connection to data node by engine-defined attributes
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection child2_2
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--echo # Single data node
+--connection master_1
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a";
+
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+
+--echo # Multiple data nodes with high availability setting
+--connection master_1
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+REMOTE_SERVER="s_2_1 s_2_2" REMOTE_TABLE="tbl_a";
+
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+
+--connection child2_1
+SELECT * FROM tbl_a;
+
+--connection child2_2
+SELECT * FROM tbl_a;
+
+--connection master_1
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+
+--echo # Multiple data nodes with partition options
+--connection master_1
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+PARTITION BY RANGE (a) (
+ PARTITION p1 VALUES LESS THAN (3) REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a",
+ PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2" REMOTE_TABLE="tbl_a"
+);
+
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+
+--echo # Multiple data nodes with table options + partition options
+--connection master_1
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a"
+PARTITION BY RANGE (a) (
+ PARTITION p1 VALUES LESS THAN (3),
+ PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2"
+);
+
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+
+--connection child2_1
+SELECT * FROM tbl_a;
+
+--connection master_1
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+
+--echo # COMMENT + engine-defined option
+--connection master_1
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+COMMENT='tbl "tbl_a"'
+PARTITION BY RANGE (a) (
+ PARTITION p1 VALUES LESS THAN (3) COMMENT='srv "s_2_1"',
+ PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2"
+);
+
+INSERT INTO tbl_a VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
+SELECT * FROM tbl_a;
+
+--connection child2_1
+SELECT * FROM tbl_a;
+
+--connection master_1
+DELETE FROM tbl_a;
+DROP TABLE tbl_a;
+
+--echo # COMMENT + engine-defined option (invalid)
+--connection master_1
+
+--replace_result error: error
+--error ER_CANT_CREATE_TABLE
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+REMOTE_SERVER="s_2_1" REMOTE_TABLE="tbl_a" COMMENT='tbl "tbl_b"';
+
+--replace_result error: error
+--error ER_CANT_CREATE_TABLE
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+COMMENT='srv "s_2_1"' REMOTE_TABLE="tbl_a"
+PARTITION BY RANGE (a) (
+ PARTITION p1 VALUES LESS THAN (3),
+ PARTITION p2 VALUES LESS THAN MAXVALUE REMOTE_SERVER="s_2_2"
+);
+
+--echo # Various combinations of COMMENTs and options
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+REMOTE_SERVER="s_2_1" REMOTE_DATABASE="auto_test_remote" REMOTE_TABLE="tbl_a";
+SELECT * FROM tbl_a;
+DROP TABLE tbl_a;
+
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+REMOTE_TABLE="tbl_a"
+PARTITION BY RANGE (a) (
+ PARTITION p1 VALUES LESS THAN (3)
+ REMOTE_SERVER="s_2_1" COMMENT='database "auto_test_remote"',
+ PARTITION p2 VALUES LESS THAN MAXVALUE
+ REMOTE_SERVER="s_2_2" REMOTE_DATABASE="auto_test_remote2"
+);
+SELECT * FROM tbl_a;
+DROP TABLE tbl_a;
+
+eval CREATE TABLE tbl_a (
+ a INT,
+ b VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+COMMENT='tbl "tbl_a"'
+PARTITION BY RANGE (a) (
+ PARTITION p1 VALUES LESS THAN (3)
+ REMOTE_SERVER="s_2_1" REMOTE_DATABASE="auto_test_remote",
+ PARTITION p2 VALUES LESS THAN MAXVALUE
+ REMOTE_SERVER="s_2_2" REMOTE_DATABASE="auto_test_remote2"
+);
+SELECT * FROM tbl_a;
+DROP TABLE tbl_a;
+
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE $MASTER_1_CHARSET
+PARTITION BY HASH (a) PARTITIONS 2;
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
+SELECT * FROM tbl_a;
+DROP TABLE tbl_a;
+
+--echo # MDEV-27860 SIGSEGV in spider_parse_connect_info on CREATE TABLE
+--error ER_FOREIGN_SERVER_DOESNT_EXIST
+CREATE TABLE tbl_a ENGINE=SPIDER COMMENT="TABLE 'unknown_table'"
+PARTITION BY LIST COLUMNS (c) (
+ PARTITION p DEFAULT COMMENT="srv 'unknown_server'" ENGINE=SPIDER
+);
+
+--connection child2_1
+DROP DATABASE auto_test_remote;
+
+--connection child2_2
+DROP DATABASE auto_test_remote2;
+
+--connection master_1
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.cnf b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.cnf
new file mode 100644
index 00000000..45019d6c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.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/feature/t/slave_transaction_retry_errors.test b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.test
new file mode 100644
index 00000000..436bc3fb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/feature/t/slave_transaction_retry_errors.test
@@ -0,0 +1,9 @@
+--source ../include/slave_transaction_retry_errors_init.inc
+--echo
+
+--connection slave1_1
+SHOW VARIABLES LIKE 'slave_transaction_retry_errors';
+
+--source ../include/slave_transaction_retry_errors_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc
new file mode 100644
index 00000000..7db871c7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_deinit.inc
@@ -0,0 +1,14 @@
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--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/include/checksum_table_with_quick_mode_3_init.inc b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc
new file mode 100644
index 00000000..43a98da5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/checksum_table_with_quick_mode_3_init.inc
@@ -0,0 +1,33 @@
+--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 command_type != 'Execute' AND argument LIKE '%checksum %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--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/include/clean_up_spider.inc b/storage/spider/mysql-test/spider/include/clean_up_spider.inc
new file mode 100644
index 00000000..1f0659dc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/clean_up_spider.inc
@@ -0,0 +1,15 @@
+DROP FUNCTION spider_flush_table_mon_cache;
+DROP FUNCTION spider_copy_tables;
+DROP FUNCTION spider_ping_table;
+DROP FUNCTION spider_bg_direct_sql;
+DROP FUNCTION spider_direct_sql;
+UNINSTALL SONAME IF EXISTS "ha_spider";
+DROP TABLE IF EXISTS mysql.spider_xa;
+DROP TABLE IF EXISTS mysql.spider_xa_member;
+DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
+DROP TABLE IF EXISTS mysql.spider_tables;
+DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
+DROP TABLE IF EXISTS mysql.spider_link_failed_log;
+DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
+DROP TABLE IF EXISTS mysql.spider_table_sts;
+DROP TABLE IF EXISTS mysql.spider_table_crd;
diff --git a/storage/spider/mysql-test/spider/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/include/deinit_child2_1.inc
new file mode 100644
index 00000000..6e7fefe5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_child2_1.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD2_1_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/include/deinit_child2_2.inc
new file mode 100644
index 00000000..0f770f9b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_child2_2.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD2_2_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/include/deinit_child2_3.inc
new file mode 100644
index 00000000..4ed97224
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_child2_3.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD2_3_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/include/deinit_child3_1.inc
new file mode 100644
index 00000000..079b4b3e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_child3_1.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/include/deinit_child3_2.inc
new file mode 100644
index 00000000..e495bf51
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_child3_2.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/include/deinit_child3_3.inc
new file mode 100644
index 00000000..b197faa0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_child3_3.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
+--source ../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_engine.inc b/storage/spider/mysql-test/spider/include/deinit_engine.inc
new file mode 100644
index 00000000..e7bdab41
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_engine.inc
@@ -0,0 +1,4 @@
+if ($INIT_TEST_ENGINE)
+{
+ --echo Deinit $TEST_ENGINE_TYPE engine
+}
diff --git a/storage/spider/mysql-test/spider/include/deinit_handlersocket.inc b/storage/spider/mysql-test/spider/include/deinit_handlersocket.inc
new file mode 100644
index 00000000..3ebf80ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_handlersocket.inc
@@ -0,0 +1 @@
+UNINSTALL PLUGIN handlersocket;
diff --git a/storage/spider/mysql-test/spider/include/deinit_innodb_plugin.inc b/storage/spider/mysql-test/spider/include/deinit_innodb_plugin.inc
new file mode 100644
index 00000000..d1013fe8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_innodb_plugin.inc
@@ -0,0 +1 @@
+UNINSTALL PLUGIN InnoDB;
diff --git a/storage/spider/mysql-test/spider/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/include/deinit_master_1.inc
new file mode 100644
index 00000000..482c8013
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_master_1.inc
@@ -0,0 +1 @@
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/include/deinit_slave1_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_slave1_1.inc
diff --git a/storage/spider/mysql-test/spider/include/deinit_spider.inc b/storage/spider/mysql-test/spider/include/deinit_spider.inc
new file mode 100644
index 00000000..23c8c2e2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/deinit_spider.inc
@@ -0,0 +1,8 @@
+--source clean_up_spider.inc
+DROP SERVER IF EXISTS s_1;
+DROP SERVER IF EXISTS s_2_1;
+DROP SERVER IF EXISTS s_2_2;
+DROP SERVER IF EXISTS s_2_3;
+DROP SERVER IF EXISTS s_3_1;
+DROP SERVER IF EXISTS s_3_2;
+DROP SERVER IF EXISTS s_3_3;
diff --git a/storage/spider/mysql-test/spider/include/direct_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_join_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_join_init.inc b/storage/spider/mysql-test/spider/include/direct_join_init.inc
new file mode 100644
index 00000000..8e51cea3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_init.inc
@@ -0,0 +1,53 @@
+--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_CONST_TABLE_JOIN=
+ COMMENT 'table "tbl_person"';
+let $MASTER_1_COMMENT_CONST_TABLE_JOIN=
+ COMMENT 'table "tbl_ncd_cm_person"';
+let $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN=
+ ROW_FORMAT = Dynamic;
+let $MASTER_1_PART_CONST_TABLE_JOIN=
+ PARTITION BY LIST COLUMNS (region) PARTITIONS 1
+ (PARTITION pt1 values in (510411)
+ COMMENT = 'tbl "tbl_person", srv "s_2_1"' MAX_ROWS = 0 MIN_ROWS = 0);
+let $MASTER_1_PART_CONST_TABLE2_JOIN=
+ PARTITION BY LIST COLUMNS (region) PARTITIONS 1
+ (PARTITION pt1 values in (510411)
+ COMMENT = 'tbl "tbl_ncd_cm_person", srv "s_2_1"' MAX_ROWS = 0 MIN_ROWS = 0);
+let $CHILD2_1_ROW_FORMAT_CONST_TABLE_JOIN=
+ ROW_FORMAT = Dynamic;
+let $CHILD2_1_DROP_CONST_TABLE_JOIN=
+ DROP TABLE IF EXISTS tbl_person;
+let $CHILD2_1_CREATE_CONST_TABLE_JOIN=
+ CREATE TABLE tbl_person (
+ id VARCHAR(50) NOT NULL,
+ hr_status VARCHAR(50) NULL DEFAULT NULL,
+ region_code VARCHAR(50) NULL DEFAULT NULL,
+ region INT(11) NOT NULL,
+ PRIMARY KEY (id, region) USING BTREE
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $CHILD2_1_ROW_FORMAT_CONST_TABLE_JOIN;
+let $CHILD2_1_DROP_CONST_TABLE2_JOIN=
+ DROP TABLE IF EXISTS tbl_ncd_cm_person;
+let $CHILD2_1_CREATE_CONST_TABLE2_JOIN=
+ CREATE TABLE tbl_ncd_cm_person (
+ id VARCHAR(50) NOT NULL,
+ person_id VARCHAR(50) NULL DEFAULT '',
+ diseaseKind_id VARCHAR(50) NULL DEFAULT NULL,
+ region INT(11) NOT NULL,
+ PRIMARY KEY (id, region) USING BTREE
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $CHILD2_1_ROW_FORMAT_CONST_TABLE_JOIN;
+let $CHILD2_1_SELECT_CONST_TABLE_JOIN=
+ SELECT * FROM tbl_person;
+let $CHILD2_1_SELECT_CONST_TABLE2_JOIN=
+ SELECT * FROM tbl_ncd_cm_person;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc b/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_join_using_init.inc b/storage/spider/mysql-test/spider/include/direct_join_using_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_using_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_init.inc b/storage/spider/mysql-test/spider/include/direct_left_join_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_init.inc b/storage/spider/mysql-test/spider/include/direct_right_join_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc
new file mode 100644
index 00000000..53bc29a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc
new file mode 100644
index 00000000..77afbc14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_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 $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc
new file mode 100644
index 00000000..482c8013
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child3_1.inc
@@ -0,0 +1 @@
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc
new file mode 100644
index 00000000..482c8013
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child3_2.inc
@@ -0,0 +1 @@
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc
new file mode 100644
index 00000000..482c8013
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_child3_3.inc
@@ -0,0 +1 @@
+--source ../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc
new file mode 100644
index 00000000..26848294
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc
@@ -0,0 +1,8 @@
+let $CHILD2_1_HA_AS_DROP_TABLES=
+ $CHILD2_1_DROP_TABLES;
+let $CHILD2_1_HA_AS_CREATE_TABLES=
+ $CHILD2_1_CREATE_TABLES;
+let $CHILD2_1_HA_AS_DROP_TABLES2=
+ $CHILD2_1_DROP_TABLES2;
+let $CHILD2_1_HA_AS_CREATE_TABLES2=
+ $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc
new file mode 100644
index 00000000..205eaa6f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc
@@ -0,0 +1,4 @@
+let $CHILD2_2_HA_DROP_TABLES=
+ $CHILD2_2_DROP_TABLES;
+let $CHILD2_2_HA_CREATE_TABLES=
+ $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc
new file mode 100644
index 00000000..55cb8583
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc
@@ -0,0 +1,4 @@
+let $CHILD2_3_HA_DROP_TABLES=
+ $CHILD2_3_DROP_TABLES;
+let $CHILD2_3_HA_CREATE_TABLES=
+ $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc
new file mode 100644
index 00000000..8357f0bd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc
@@ -0,0 +1,140 @@
+--let $CHILD3_1_ENGINE_TYPE=Spider
+--let $CHILD3_1_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_1_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_1_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_1_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc
new file mode 100644
index 00000000..3ffcec24
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc
@@ -0,0 +1,140 @@
+--let $CHILD3_2_ENGINE_TYPE=Spider
+--let $CHILD3_2_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_2_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_2_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_2_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_2_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_2_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_2_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_2_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_2_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc
new file mode 100644
index 00000000..67bd0010
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc
@@ -0,0 +1,140 @@
+--let $CHILD3_3_ENGINE_TYPE=Spider
+--let $CHILD3_3_ENGINE=ENGINE=Spider
+--source ../include/init_spider.inc
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $CHILD3_3_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $CHILD3_3_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $CHILD3_3_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $CHILD3_3_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+
+let $CHILD3_3_DROP_TABLES_HA_2_1=
+ DROP TABLE IF EXISTS ta_l;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $CHILD3_3_CREATE_TABLES_HA_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
+ CREATE TABLE ta_l (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $CHILD3_3_DROP_TABLES_HA_P_2_1=
+ DROP TABLE IF EXISTS ta_l2;
+let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
+ CREATE TABLE ta_l2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $CHILD3_3_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/include/ha_init_master_1.inc
new file mode 100644
index 00000000..78797d80
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/ha_init_master_1.inc
@@ -0,0 +1,105 @@
+eval INSERT INTO mysql.spider_link_mon_servers
+(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
+ username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
+ ssl_verify_server_cert, default_file, default_group) VALUES
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
+('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
+let $MASTER_1_CHECK_LINK_STATUS=
+ SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ ORDER BY db_name, table_name, link_id;
+let $MASTER_1_CHECK_LINK_FAILED_LOG=
+ SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+let $MASTER_1_SET_RECOVERY_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+let $MASTER_1_SET_OK_STATUS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+let $MASTER_1_SET_OK_STATUS_AS_2_1=
+ ALTER TABLE ta_l
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+let $MASTER_1_COPY_TABLES_2_1=
+ SELECT spider_copy_tables('ta_l', '0', '1');
+
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_HA_2_1=
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $MASTER_1_COMMENT_HA_AS_2_1=
+ COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_HA_2_1=
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2",
+ database "auto_test_remote auto_test_remote2"';
+ let $MASTER_1_COMMENT_HA_AS_2_1=
+ COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
+ CONNECTION='host "localhost", user "root", password "",
+ msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2"';
+}
+let $MASTER_1_COMMENT_HA_P_2_1=
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $MASTER_1_COMMENT_HA_AS_P_2_1=
+ COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001"'
+ );
+let $MASTER_1_SET_RECOVERY_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+let $MASTER_1_SET_OK_STATUS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+let $MASTER_1_SET_OK_STATUS_AS_P_2_1=
+ ALTER TABLE ta_l2
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
+let $MASTER_1_COPY_TABLES_P_2_1=
+ SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
+let $MASTER_1_CHECK_HA_STATUS=
+ SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+let $MASTER_1_CHANGE_HA_MON=
+ SELECT spider_flush_table_mon_cache();
diff --git a/storage/spider/mysql-test/spider/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/include/hs_deinit_child2_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_deinit_child2_1.inc
diff --git a/storage/spider/mysql-test/spider/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/include/hs_deinit_child2_2.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_deinit_child2_2.inc
diff --git a/storage/spider/mysql-test/spider/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/include/hs_deinit_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_deinit_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/include/hs_deinit_master_1.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_deinit_master_1.inc
diff --git a/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc
new file mode 100644
index 00000000..ee006858
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_init_child2_1.inc
@@ -0,0 +1,24 @@
+let $CHILD2_1_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r;
+let $CHILD2_1_HS_CREATE_TABLES=
+ CREATE TABLE hs_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
+let $CHILD2_1_HS_DROP_TABLES2=
+ DROP TABLE IF EXISTS hs_r2;
+let $CHILD2_1_HS_CREATE_TABLES2=
+ CREATE TABLE hs_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_HS_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc
new file mode 100644
index 00000000..1c5a02d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_init_child2_2.inc
@@ -0,0 +1,12 @@
+let $CHILD2_2_HS_DROP_TABLES=
+ DROP TABLE IF EXISTS hs_r3;
+let $CHILD2_2_HS_CREATE_TABLES=
+ CREATE TABLE hs_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ d INT DEFAULT 11,
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_HS_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/include/hs_init_child2_3.inc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_init_child2_3.inc
diff --git a/storage/spider/mysql-test/spider/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/include/hs_init_master_1.inc
new file mode 100644
index 00000000..0ff5e2a1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/hs_init_master_1.inc
@@ -0,0 +1,12 @@
+let $MASTER_1_HS_COMMENT_TMP=
+ COMMENT='';
+let $MASTER_1_HS_COMMENT_2_1=
+ COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"';
+let $MASTER_1_HS_COMMENT_P_2_1=
+ COMMENT='uhr "1", uhw "1"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4)
+ COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"'
+ );
diff --git a/storage/spider/mysql-test/spider/include/init_child2_1.inc b/storage/spider/mysql-test/spider/include/init_child2_1.inc
new file mode 100644
index 00000000..782f538e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_child2_1.inc
@@ -0,0 +1,192 @@
+--let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD2_1_ENGINE= $INIT_TEST_ENGINE
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r;
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE ta_r (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+let $CHILD2_1_DROP_TABLES2=
+ DROP TABLE IF EXISTS ta_r2;
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE ta_r2 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a;
+let $CHILD2_1_DROP_TABLES3=
+ DROP TABLE IF EXISTS ta_r_no_idx;
+let $CHILD2_1_CREATE_TABLES3=
+ CREATE TABLE ta_r_no_idx (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES3=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a;
+let $CHILD2_1_DROP_TABLES4=
+ DROP TABLE IF EXISTS ta_r_auto_inc;
+let $CHILD2_1_CREATE_TABLES4=
+ CREATE TABLE ta_r_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES4=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc
+ ORDER BY a;
+let $CHILD2_1_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_1_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES5=
+ SELECT a, b, c FROM ta_r_int ORDER BY a;
+let $CHILD2_1_DROP_TABLES6=
+ DROP TABLE IF EXISTS ta_r_3;
+let $CHILD2_1_CREATE_TABLES6=
+ CREATE TABLE ta_r_3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES6=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a;
+let $CHILD2_1_DROP_TABLES7=
+ DROP TABLE IF EXISTS ta_ob;
+let $CHILD2_1_CREATE_TABLES7=
+ CREATE TABLE ta_ob (
+ a VARCHAR(50) NOT NULL,
+ b VARCHAR(50) NULL DEFAULT NULL,
+ c VARCHAR(100) NULL DEFAULT NULL,
+ d DATETIME(0) NULL DEFAULT NULL,
+ e INT(11) NOT NULL,
+ f INT(10) NULL DEFAULT NULL,
+ PRIMARY KEY (a, e)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TABLES7=
+ SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 6 OFFSET 0;
+let $CHILD2_1_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r;
+let $CHILD2_1_CREATE_FT_TABLES=
+ CREATE TABLE ft_r (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r ORDER BY a;
+let $CHILD2_1_DROP_FT_TABLES2=
+ DROP TABLE IF EXISTS ft_r2;
+let $CHILD2_1_CREATE_FT_TABLES2=
+ CREATE TABLE ft_r2 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET;
+let $CHILD2_1_SELECT_FT_TABLES2=
+ SELECT a, b, c, d FROM ft_r2 ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r;
+let $CHILD2_1_CREATE_GM_TABLES=
+ CREATE TABLE gm_r (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r ORDER BY a;
+let $CHILD2_1_DROP_GM_TABLES2=
+ DROP TABLE IF EXISTS gm_r2;
+let $CHILD2_1_CREATE_GM_TABLES2=
+ CREATE TABLE gm_r2 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET;
+let $CHILD2_1_SELECT_GM_TABLES2=
+ SELECT a, b, c FROM gm_r2 ORDER BY a;
+let $CHILD2_1_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_2;
+let $CHILD2_1_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_1;
+let $CHILD2_1_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_1 ORDER BY id;
+let $CHILD2_1_DROP_TEXT_PK_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY (a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2;
+let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
+ SELECT a FROM t1 ORDER BY a;
+let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
+ DROP TABLE IF EXISTS t1;
+let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
+ CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
+ SELECT a, b FROM t1 ORDER BY a, b;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 2;
diff --git a/storage/spider/mysql-test/spider/include/init_child2_2.inc b/storage/spider/mysql-test/spider/include/init_child2_2.inc
new file mode 100644
index 00000000..5d7227e4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_child2_2.inc
@@ -0,0 +1,83 @@
+--let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD2_2_ENGINE= $INIT_TEST_ENGINE
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r3;
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE ta_r3 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_TABLES5=
+ DROP TABLE IF EXISTS ta_r_int;
+let $CHILD2_2_CREATE_TABLES5=
+ CREATE TABLE ta_r_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a;
+let $CHILD2_2_DROP_FT_TABLES=
+ DROP TABLE IF EXISTS ft_r3;
+let $CHILD2_2_CREATE_FT_TABLES=
+ CREATE TABLE ft_r3 (
+ a INT DEFAULT 0,
+ b TEXT,
+ c TEXT,
+ d TEXT,
+ PRIMARY KEY(a),
+ FULLTEXT INDEX ft_idx1(b),
+ FULLTEXT INDEX ft_idx2(c)
+ ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET;
+let $CHILD2_2_SELECT_FT_TABLES=
+ SELECT a, b, c, d FROM ft_r3 ORDER BY a;
+let $CHILD2_2_DROP_GM_TABLES=
+ DROP TABLE IF EXISTS gm_r3;
+let $CHILD2_2_CREATE_GM_TABLES=
+ CREATE TABLE gm_r3 (
+ a INT DEFAULT 0,
+ b GEOMETRY NOT NULL,
+ c GEOMETRY NOT NULL,
+ PRIMARY KEY(a),
+ SPATIAL INDEX sp_idx1(b),
+ SPATIAL INDEX sp_idx2(c)
+ ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET;
+let $CHILD2_2_SELECT_GM_TABLES=
+ SELECT a, b, c FROM gm_r3 ORDER BY a;
+let $CHILD2_2_DROP_LOCK_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_LOCK_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_LOCK_TABLES2=
+ DROP TABLE IF EXISTS t2_1;
+let $CHILD2_2_CREATE_LOCK_TABLES2=
+ CREATE TABLE t2_1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_DROP_INCREMENT_TABLES1=
+ DROP TABLE IF EXISTS t1_2;
+let $CHILD2_2_CREATE_INCREMENT_TABLES1=
+ CREATE TABLE t1_2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+let $CHILD2_2_SELECT_INCREMENT_TABLES1=
+ SELECT id FROM t1_2 ORDER BY id;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 1;
+let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
+ SET GLOBAL AUTO_INCREMENT_INCREMENT = 4;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 1;
+let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
+ SET GLOBAL AUTO_INCREMENT_OFFSET = 3;
diff --git a/storage/spider/mysql-test/spider/include/init_child2_3.inc b/storage/spider/mysql-test/spider/include/init_child2_3.inc
new file mode 100644
index 00000000..0ae24062
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_child2_3.inc
@@ -0,0 +1,14 @@
+--let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD2_3_ENGINE= $INIT_TEST_ENGINE
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS ta_r4;
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE ta_r4 (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+let $CHILD2_3_SELECT_TABLES=
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a;
diff --git a/storage/spider/mysql-test/spider/include/init_child3_1.inc b/storage/spider/mysql-test/spider/include/init_child3_1.inc
new file mode 100644
index 00000000..0c83d926
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_child3_1.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/include/init_child3_2.inc b/storage/spider/mysql-test/spider/include/init_child3_2.inc
new file mode 100644
index 00000000..29abb5c8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_child3_2.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/include/init_child3_3.inc b/storage/spider/mysql-test/spider/include/init_child3_3.inc
new file mode 100644
index 00000000..9fee4d34
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_child3_3.inc
@@ -0,0 +1,3 @@
+--let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+--source ../include/init_engine.inc
+--let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/include/init_engine.inc b/storage/spider/mysql-test/spider/include/init_engine.inc
new file mode 100644
index 00000000..820a598f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_engine.inc
@@ -0,0 +1,10 @@
+let $INIT_TEST_ENGINE=0;
+if (!`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = '$TEST_ENGINE_TYPE'`)
+{
+ if (!$SKIP_REASON)
+ {
+ --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine"
+ }
+}
diff --git a/storage/spider/mysql-test/spider/include/init_master_1.inc b/storage/spider/mysql-test/spider/include/init_master_1.inc
new file mode 100644
index 00000000..460142b9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_master_1.inc
@@ -0,0 +1,195 @@
+--source ../include/init_spider.inc
+SET spider_direct_order_limit= 10000;
+SET spider_init_sql_alloc_size= 1;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT2_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_no_idx"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password "", prt "2000000"';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT2_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_no_idx"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password "", prt "2000000"';
+}
+let $MASTER_1_COMMENT_P_2_1=
+ COMMENT='table "ta_r3"'
+ PARTITION BY KEY(a) (
+ PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2",
+ priority "1000"',
+ PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001"'
+ );
+let $MASTER_1_COMMENT2_P_2_1=
+ COMMENT='table "ta_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
+ table "ta_r2", priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT3_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_auto_inc"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT3_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_auto_inc"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+let $MASTER_1_COMMENT3_P_2_1=
+ COMMENT='table "ta_r_int"'
+ PARTITION BY LIST(MOD(a, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='srv "s_2_1", priority "1000"',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT4_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_int"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT4_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_int"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT5_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_3"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT5_2_1=
+ COMMENT='database "auto_test_remote", table "ta_r_3"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+let $MASTER_1_COMMENT6_P_1_1=
+ COMMENT='database "auto_test_remote", table "ta_ob"'
+ PARTITION BY LIST COLUMNS (e) PARTITIONS 1
+ (PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"');
+if ($VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_FT_2_1=
+ COMMENT='database "auto_test_remote", table "ft_r"'
+ CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root",
+ password ""';
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ let $MASTER_1_COMMENT_FT_2_1=
+ COMMENT='database "auto_test_remote", table "ft_r"'
+ CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root",
+ password ""';
+}
+let $MASTER_1_COMMENT2_FT_P_2_1=
+ COMMENT='table "ft_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
+ table "ft_r2", priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+let $MASTER_1_COMMENT_GM_2_1=
+ COMMENT='srv "s_2_1", table "gm_r"';
+let $MASTER_1_COMMENT2_GM_P_2_1=
+ COMMENT='table "gm_r3"'
+ PARTITION BY RANGE(a) (
+ PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
+ table "gm_r2", priority "1000"',
+ PARTITION pt2 VALUES LESS THAN MAXVALUE
+ COMMENT='srv "s_2_2", priority "1000001"'
+ );
+let $MASTER_1_COMMENT_LOCK1=
+ COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2"';
+let $MASTER_1_COMMENT_LOCK2=
+ COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1"';
+let $MASTER_1_COMMENT_INCREMENT1_1=
+ COMMENT 'aim "0", tbl "t1_1", srv "s_2_1"';
+let $MASTER_1_COMMENT_INCREMENT1_P_1=
+ COMMENT 'aim "0"'
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='tbl "t1_1", srv "s_2_1"',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT='tbl "t1_2", srv "s_2_2"'
+ );
+let $MASTER_1_COMMENT_READONLY1_1=
+ COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1"';
+let $MASTER_1_COMMENT_ERROR_MODE1_1=
+ COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1"';
+let $MASTER_1_COMMENT_TEXT_PK1_1=
+ COMMENT 'tbl "t1", srv "s_2_1"';
+let $MASTER_1_COMMENT_TEXT_KEY1_1=
+ COMMENT 'tbl "t1", srv "s_2_1"';
+let $MASTER_1_COMMENT_MDEV_25985=
+ COMMENT='table "t1"'
+ PARTITION BY LIST COLUMNS(`a`) (
+ PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+ );
+let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_update';
+let $MASTER_1_CHECK_DIRECT_DELETE_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_delete';
+let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_order_limit';
+let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS=
+ SHOW STATUS LIKE 'Spider_direct_aggregate';
+let $MASTER_1_AUTO_INCREMENT_INCREMENT1=
+ SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_INCREMENT2=
+ SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_OFFSET1=
+ SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_OFFSET2=
+ SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+ 'srv "s_2_1"') $STR_SEMICOLON
+ SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+ 'srv "s_2_2"');
+let $MASTER_1_AUTO_INCREMENT_OFFSET3=
+ SET SESSION AUTO_INCREMENT_OFFSET = 1;
+let $MASTER_1_AUTO_INCREMENT_OFFSET4=
+ SET SESSION AUTO_INCREMENT_OFFSET = 777;
diff --git a/storage/spider/mysql-test/spider/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/include/init_slave1_1.inc
new file mode 100644
index 00000000..73c3c6b9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_slave1_1.inc
@@ -0,0 +1,10 @@
+let $SLAVE1_1_COMMENT_INCREMENT1_1=
+ COMMENT '';
+let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
+ COMMENT ''
+ PARTITION BY LIST(MOD(id, 2)) (
+ PARTITION pt1 VALUES IN (0)
+ COMMENT='',
+ PARTITION pt2 VALUES IN (1)
+ COMMENT=''
+ );
diff --git a/storage/spider/mysql-test/spider/include/init_spider.inc b/storage/spider/mysql-test/spider/include/init_spider.inc
new file mode 100644
index 00000000..ccf9e305
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/init_spider.inc
@@ -0,0 +1,191 @@
+let $VERSION_COMPILE_OS_WIN=
+ `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`;
+if ($VERSION_COMPILE_OS_WIN)
+{
+ INSTALL SONAME 'ha_spider';
+ if ($MASTER_1_MYPORT)
+ {
+ evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ PORT $MASTER_1_MYPORT
+ );
+ }
+ if ($CHILD2_1_MYPORT)
+ {
+ evalp CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_remote',
+ USER 'root',
+ PASSWORD '',
+ PORT $CHILD2_1_MYPORT
+ );
+ }
+ if ($CHILD2_2_MYPORT)
+ {
+ evalp CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_remote2',
+ USER 'root',
+ PASSWORD '',
+ PORT $CHILD2_2_MYPORT
+ );
+ }
+ if ($CHILD2_3_MYPORT)
+ {
+ evalp CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_remote3',
+ USER 'root',
+ PASSWORD '',
+ PORT $CHILD2_3_MYPORT
+ );
+ }
+ if ($CHILD3_1_MYPORT)
+ {
+ evalp CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ PORT $CHILD3_1_MYPORT
+ );
+ }
+ if ($CHILD3_2_MYPORT)
+ {
+ evalp CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ PORT $CHILD3_2_MYPORT
+ );
+ }
+ if ($CHILD2_3_MYPORT)
+ {
+ evalp CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ PORT $CHILD2_3_MYPORT
+ );
+ }
+}
+if (!$VERSION_COMPILE_OS_WIN)
+{
+ INSTALL SONAME 'ha_spider';
+ if ($MASTER_1_MYSOCK)
+ {
+ evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$MASTER_1_MYSOCK'
+ );
+ }
+ if ($CHILD2_1_MYSOCK)
+ {
+ evalp CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_remote',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$CHILD2_1_MYSOCK'
+ );
+ }
+ if ($CHILD2_2_MYSOCK)
+ {
+ evalp CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_remote2',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$CHILD2_2_MYSOCK'
+ );
+ }
+ if ($CHILD2_3_MYSOCK)
+ {
+ evalp CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_remote3',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$CHILD2_3_MYSOCK'
+ );
+ }
+ if ($CHILD3_1_MYSOCK)
+ {
+ evalp CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$CHILD3_1_MYSOCK'
+ );
+ }
+ if ($CHILD3_2_MYSOCK)
+ {
+ evalp CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$CHILD3_2_MYSOCK'
+ );
+ }
+ if ($CHILD3_3_MYSOCK)
+ {
+ evalp CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS (
+ HOST 'localhost',
+ DATABASE 'auto_test_local',
+ USER 'root',
+ PASSWORD '',
+ SOCKET '$CHILD3_3_MYSOCK'
+ );
+ }
+}
+
+let $SERVER_NAME=MariaDB;
+let $SERVER_MAJOR_VERSION=
+ `SELECT SUBSTRING_INDEX(version(), '.', 1)`;
+let $SERVER_MINOR_VERSION=
+ `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '.', 2), '.', -1)`;
+let $PLUGIN_VERSION=
+ `SELECT SUBSTRING_INDEX(plugin_version, '.', 1)
+ FROM information_schema.plugins
+ WHERE plugin_name = 'SPIDER'`;
+if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
+{
+ let $HAS_REWRITE=
+ `SELECT IF (STRCMP('$SERVER_NAME', 'MariaDB') = 0,
+ IF ($SERVER_MAJOR_VERSION = 10,
+ IF ($SERVER_MINOR_VERSION < 4, 0, 1),
+ IF ($SERVER_MAJOR_VERSION < 10, 0, 1)),
+ 0)`;
+ let $HAS_REWRITE= 0;
+ if ($HAS_REWRITE)
+ {
+ let $PLUGIN_NAME= spider_flush_rewrite_cache;
+ let $PLUGIN_EXIST=
+ `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
+ while (!$PLUGIN_EXIST)
+ {
+ let $PLUGIN_EXIST=
+ `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
+ }
+ }
+}
+let $PLUGIN_NAME= spider_flush_table_mon_cache;
+let $PLUGIN_EXIST=
+ `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
+while (!$PLUGIN_EXIST)
+{
+ let $PLUGIN_EXIST=
+ `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
+}
+
+SET spider_internal_sql_log_off= 0;
diff --git a/storage/spider/mysql-test/spider/include/partition_cond_push_deinit.inc b/storage/spider/mysql-test/spider/include/partition_cond_push_deinit.inc
new file mode 100644
index 00000000..668eaa2f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_cond_push_deinit.inc
@@ -0,0 +1,20 @@
+--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
+--let $CHILD2_3_DROP_TABLES= $CHILD2_3_DROP_TABLES_BACKUP
+--let $CHILD2_3_CREATE_TABLES= $CHILD2_3_CREATE_TABLES_BACKUP
+--let $CHILD2_3_SELECT_TABLES= $CHILD2_3_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/partition_cond_push_init.inc b/storage/spider/mysql-test/spider/include/partition_cond_push_init.inc
new file mode 100644
index 00000000..40a0923c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_cond_push_init.inc
@@ -0,0 +1,58 @@
+--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"'
+ PARTITION BY KEY(value) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"',
+ PARTITION pt3 COMMENT='srv "s_2_3"'
+ );
+--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 (
+ value int NOT NULL
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT value FROM tbl_a ORDER BY value;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 (
+ value int NOT NULL
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT value FROM tbl_a ORDER BY value;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $CHILD2_3_DROP_TABLES_BACKUP= $CHILD2_3_DROP_TABLES
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_3_CREATE_TABLES_BACKUP= $CHILD2_3_CREATE_TABLES
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ value int NOT NULL
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+--let $CHILD2_3_SELECT_TABLES_BACKUP= $CHILD2_3_SELECT_TABLES
+let $CHILD2_3_SELECT_TABLES=
+ SELECT value FROM tbl_a ORDER BY value;
+let $CHILD2_3_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/partition_fulltext_deinit.inc b/storage/spider/mysql-test/spider/include/partition_fulltext_deinit.inc
new file mode 100644
index 00000000..c0c652d1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_fulltext_deinit.inc
@@ -0,0 +1,23 @@
+--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
+--let $CHILD2_3_DROP_TABLES= $CHILD2_3_DROP_TABLES_BACKUP
+--let $CHILD2_3_CREATE_TABLES= $CHILD2_3_CREATE_TABLES_BACKUP
+--let $CHILD2_3_SELECT_TABLES= $CHILD2_3_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session join_cache_level= @old_join_cache_level;
+set session optimizer_switch= @old_optimizer_switch;
+--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/include/partition_fulltext_init.inc b/storage/spider/mysql-test/spider/include/partition_fulltext_init.inc
new file mode 100644
index 00000000..aaceeee4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_fulltext_init.inc
@@ -0,0 +1,72 @@
+--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", bka_mode "1"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"',
+ PARTITION pt3 COMMENT='srv "s_2_3"'
+ );
+--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,
+ words text NOT NULL,
+ PRIMARY KEY (pkey),
+ FULLTEXT (words)
+ ) $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 command_type != 'Execute' AND 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,
+ words text NOT NULL,
+ PRIMARY KEY (pkey),
+ FULLTEXT (words)
+ ) $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 command_type != 'Execute' AND argument LIKE '%select %';
+--let $CHILD2_3_DROP_TABLES_BACKUP= $CHILD2_3_DROP_TABLES
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_3_CREATE_TABLES_BACKUP= $CHILD2_3_CREATE_TABLES
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ words text NOT NULL,
+ PRIMARY KEY (pkey),
+ FULLTEXT (words)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+--let $CHILD2_3_SELECT_TABLES_BACKUP= $CHILD2_3_SELECT_TABLES
+let $CHILD2_3_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+let $CHILD2_3_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_join_cache_level= @@join_cache_level;
+set session join_cache_level= 5;
+set @old_optimizer_switch= @@optimizer_switch;
+set session optimizer_switch= 'mrr=on';
diff --git a/storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_deinit.inc b/storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_deinit.inc
new file mode 100644
index 00000000..d9dfcf23
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_deinit.inc
@@ -0,0 +1,30 @@
+--connection master_1
+--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_1_DROP_TABLES2= $CHILD2_1_DROP_TABLES2_BACKUP
+--let $CHILD2_1_CREATE_TABLES2= $CHILD2_1_CREATE_TABLES2_BACKUP
+--let $CHILD2_1_SELECT_TABLES2= $CHILD2_1_SELECT_TABLES2_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
+--let $CHILD2_2_DROP_TABLES2= $CHILD2_2_DROP_TABLES2_BACKUP
+--let $CHILD2_2_CREATE_TABLES2= $CHILD2_2_CREATE_TABLES2_BACKUP
+--let $CHILD2_2_SELECT_TABLES2= $CHILD2_2_SELECT_TABLES2_BACKUP
+--let $CHILD2_3_DROP_TABLES= $CHILD2_3_DROP_TABLES_BACKUP
+--let $CHILD2_3_CREATE_TABLES= $CHILD2_3_CREATE_TABLES_BACKUP
+--let $CHILD2_3_SELECT_TABLES= $CHILD2_3_SELECT_TABLES_BACKUP
+--let $CHILD2_3_DROP_TABLES2= $CHILD2_3_DROP_TABLES2_BACKUP
+--let $CHILD2_3_CREATE_TABLES2= $CHILD2_3_CREATE_TABLES2_BACKUP
+--let $CHILD2_3_SELECT_TABLES2= $CHILD2_3_SELECT_TABLES2_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_init.inc b/storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_init.inc
new file mode 100644
index 00000000..64e4e2a1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_join_pushdown_for_single_partition_init.inc
@@ -0,0 +1,105 @@
+--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"'
+ PARTITION BY RANGE(value) (
+ PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1"',
+ PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_2"',
+ PARTITION pt3 VALUES LESS THAN (15) COMMENT='srv "s_2_3"'
+ );
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b"'
+ PARTITION BY RANGE(value2) (
+ PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1"',
+ PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_2"',
+ PARTITION pt3 VALUES LESS THAN (15) COMMENT='srv "s_2_3"'
+ );
+--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 (
+ value int NOT NULL,
+ PRIMARY KEY(value)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT value FROM tbl_a ORDER BY value;
+--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_TABLES2_BACKUP= $CHILD2_1_CREATE_TABLES2
+let $CHILD2_1_CREATE_TABLES2=
+ CREATE TABLE tbl_b (
+ value2 int NOT NULL,
+ PRIMARY KEY(value2)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES2_BACKUP= $CHILD2_1_SELECT_TABLES2
+let $CHILD2_1_SELECT_TABLES2=
+ SELECT value FROM tbl_b ORDER BY value2;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 (
+ value int NOT NULL,
+ PRIMARY KEY(value)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT value FROM tbl_a ORDER BY value;
+--let $CHILD2_2_DROP_TABLES2_BACKUP= $CHILD2_2_DROP_TABLES2
+let $CHILD2_2_DROP_TABLES2=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_2_CREATE_TABLES2_BACKUP= $CHILD2_2_CREATE_TABLES2
+let $CHILD2_2_CREATE_TABLES2=
+ CREATE TABLE tbl_b (
+ value2 int NOT NULL,
+ PRIMARY KEY(value2)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES2_BACKUP= $CHILD2_2_SELECT_TABLES2
+let $CHILD2_2_SELECT_TABLES2=
+ SELECT value FROM tbl_b ORDER BY value;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $CHILD2_3_DROP_TABLES_BACKUP= $CHILD2_3_DROP_TABLES
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_3_CREATE_TABLES_BACKUP= $CHILD2_3_CREATE_TABLES
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ value int NOT NULL,
+ PRIMARY KEY(value)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+--let $CHILD2_3_SELECT_TABLES_BACKUP= $CHILD2_3_SELECT_TABLES
+let $CHILD2_3_SELECT_TABLES=
+ SELECT value FROM tbl_a ORDER BY value;
+--let $CHILD2_3_DROP_TABLES2_BACKUP= $CHILD2_3_DROP_TABLES2
+let $CHILD2_3_DROP_TABLES2=
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_3_CREATE_TABLES2_BACKUP= $CHILD2_3_CREATE_TABLES2
+let $CHILD2_3_CREATE_TABLES2=
+ CREATE TABLE tbl_b (
+ value2 int NOT NULL,
+ PRIMARY KEY(value2)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+--let $CHILD2_3_SELECT_TABLES2_BACKUP= $CHILD2_3_SELECT_TABLES2
+let $CHILD2_3_SELECT_TABLES2=
+ SELECT value FROM tbl_b ORDER BY value;
+let $CHILD2_3_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/partition_mrr_deinit.inc b/storage/spider/mysql-test/spider/include/partition_mrr_deinit.inc
new file mode 100644
index 00000000..c0c652d1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_mrr_deinit.inc
@@ -0,0 +1,23 @@
+--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
+--let $CHILD2_3_DROP_TABLES= $CHILD2_3_DROP_TABLES_BACKUP
+--let $CHILD2_3_CREATE_TABLES= $CHILD2_3_CREATE_TABLES_BACKUP
+--let $CHILD2_3_SELECT_TABLES= $CHILD2_3_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--connection master_1
+set session join_cache_level= @old_join_cache_level;
+set session optimizer_switch= @old_optimizer_switch;
+--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/include/partition_mrr_init.inc b/storage/spider/mysql-test/spider/include/partition_mrr_init.inc
new file mode 100644
index 00000000..82e13595
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/partition_mrr_init.inc
@@ -0,0 +1,92 @@
+--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", bka_mode "1"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"',
+ PARTITION pt3 COMMENT='srv "s_2_3"'
+ );
+--let $MASTER_1_COMMENT_2_2_BACKUP= $MASTER_1_COMMENT_2_2
+let $MASTER_1_COMMENT_2_2=
+ COMMENT='table "tbl_b", bka_mode "1"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_2"',
+ PARTITION pt2 COMMENT='srv "s_2_3"',
+ PARTITION pt3 COMMENT='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 $STR_SEMICOLON
+ 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 (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE tbl_b (
+ 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 $STR_SEMICOLON
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a $STR_SEMICOLON
+ DROP TABLE IF EXISTS tbl_b;
+--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 $STR_SEMICOLON
+ 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_a ORDER BY pkey $STR_SEMICOLON
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $CHILD2_3_DROP_TABLES_BACKUP= $CHILD2_3_DROP_TABLES
+let $CHILD2_3_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a $STR_SEMICOLON
+ DROP TABLE IF EXISTS tbl_b;
+--let $CHILD2_3_CREATE_TABLES_BACKUP= $CHILD2_3_CREATE_TABLES
+let $CHILD2_3_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET $STR_SEMICOLON
+ CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET;
+--let $CHILD2_3_SELECT_TABLES_BACKUP= $CHILD2_3_SELECT_TABLES
+let $CHILD2_3_SELECT_TABLES=
+ SELECT pkey FROM tbl_a ORDER BY pkey $STR_SEMICOLON
+ SELECT pkey FROM tbl_b ORDER BY pkey;
+let $CHILD2_3_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--connection master_1
+set @old_join_cache_level= @@join_cache_level;
+set session join_cache_level= 5;
+set @old_optimizer_switch= @@optimizer_switch;
+set session optimizer_switch= 'mrr=on';
diff --git a/storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc
new file mode 100644
index 00000000..72d09f54
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_0_deinit.inc
@@ -0,0 +1,21 @@
+--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
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_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/include/quick_mode_0_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_0_init.inc
new file mode 100644
index 00000000..8f525d20
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_0_init.inc
@@ -0,0 +1,55 @@
+--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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--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/include/quick_mode_1_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc
new file mode 100644
index 00000000..72d09f54
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_1_deinit.inc
@@ -0,0 +1,21 @@
+--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
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_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/include/quick_mode_1_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_1_init.inc
new file mode 100644
index 00000000..caab7a07
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_1_init.inc
@@ -0,0 +1,55 @@
+--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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--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/include/quick_mode_2_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc
new file mode 100644
index 00000000..72d09f54
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_2_deinit.inc
@@ -0,0 +1,21 @@
+--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
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_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/include/quick_mode_2_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_2_init.inc
new file mode 100644
index 00000000..b91246ed
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_2_init.inc
@@ -0,0 +1,55 @@
+--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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--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/include/quick_mode_3_deinit.inc b/storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc
new file mode 100644
index 00000000..72d09f54
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_3_deinit.inc
@@ -0,0 +1,21 @@
+--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
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_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/include/quick_mode_3_init.inc b/storage/spider/mysql-test/spider/include/quick_mode_3_init.inc
new file mode 100644
index 00000000..4b5a8edc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/quick_mode_3_init.inc
@@ -0,0 +1,55 @@
+--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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--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/include/slave_trx_isolation_deinit.inc b/storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc
new file mode 100644
index 00000000..e5f585e5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/slave_trx_isolation_deinit.inc
@@ -0,0 +1,17 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--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/include/slave_trx_isolation_init.inc b/storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc
new file mode 100644
index 00000000..67ac5e71
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/slave_trx_isolation_init.inc
@@ -0,0 +1,39 @@
+--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 command_type != 'Execute' AND argument LIKE '%set %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
+--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/my.cnf b/storage/spider/mysql-test/spider/my.cnf
new file mode 100644
index 00000000..db4f7656
--- /dev/null
+++ b/storage/spider/mysql-test/spider/my.cnf
@@ -0,0 +1,177 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[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
+
+[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
+
+[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
+
+[mysqld.2.3]
+
+[mysqld.3.1]
+loose_partition= 1
+
+[mysqld.3.2]
+loose_partition= 1
+
+[mysqld.3.3]
+loose_partition= 1
+
+[mysqld.4.1]
+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
+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
+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_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_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
+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_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_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
+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
+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
+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
+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
+
+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
+# 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
+# CHILD2_2_DROP_TABLES
+# CHILD2_2_CREATE_TABLES
+# CHILD2_2_SELECT_TABLES
diff --git a/storage/spider/mysql-test/spider/r/auto_increment.result b/storage/spider/mysql-test/spider/r/auto_increment.result
new file mode 100644
index 00000000..c3da4575
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/auto_increment.result
@@ -0,0 +1,186 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+col_a INT NOT NULL AUTO_INCREMENT,
+col_b VARCHAR(20) DEFAULT 'defg',
+col_c INT NOT NULL DEFAULT 100,
+PRIMARY KEY(col_a)
+) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` int(11) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` int(11) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+ALTER TABLE tbl_a MODIFY col_c MEDIUMINT NOT NULL DEFAULT 100;
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+RENAME TABLE tbl_a TO tbl_x;
+SHOW CREATE TABLE tbl_x;
+Table Create Table
+tbl_x CREATE TABLE `tbl_x` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+RENAME TABLE tbl_x TO tbl_a;
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+MASTER_1_AUTO_INCREMENT1
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+MASTER_1_AUTO_INCREMENT2
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(11) NOT NULL AUTO_INCREMENT,
+ `col_b` varchar(20) DEFAULT 'defg',
+ `col_c` mediumint(9) NOT NULL DEFAULT 100,
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_a;
+col_a col_b col_c
+1 def 10
+2 def 10
+3 def 10
+4 def 10
+5 def 10
+6 def 10
+7 def 10
+8 def 10
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_a` `col_a`,t0.`col_b` `col_b`,t0.`col_c` `col_c` from `auto_test_remote`.`tbl_a` t0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a;
+col_a col_b col_c
+1 def 10
+2 def 10
+3 def 10
+4 def 10
+5 def 10
+6 def 10
+7 def 10
+8 def 10
+
+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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/basic_sql.result b/storage/spider/mysql-test/spider/r/basic_sql.result
new file mode 100644
index 00000000..2443f348
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/basic_sql.result
@@ -0,0 +1,748 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+create table ignore select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'f', '2008-07-01 10:21:39'),
+(2, 'g', '2000-02-01 00:00:00'),
+(3, 'j', '2007-05-04 20:03:11'),
+(4, 'i', '2003-10-30 05:01:03'),
+(5, 'h', '2001-10-31 23:59:59');
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+IGNORE SELECT a, b, c FROM tb_l
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+create table ignore select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+REPLACE SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+create no index table
+connection master_1;
+DROP TABLE IF EXISTS ta_l_no_idx;
+CREATE TABLE ta_l_no_idx
+MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table shared mode
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+LOCK IN SHARE MODE;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table for update
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+FOR UPDATE;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table join
+connection master_1;
+SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
+WHERE a.a = b.a ORDER BY a.a;
+a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select table straight_join
+connection master_1;
+SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
+FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
+a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_small_result
+connection master_1;
+SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_big_result
+connection master_1;
+SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_buffer_result
+connection master_1;
+SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_cache
+connection master_1;
+SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_no_cache
+connection master_1;
+SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select sql_calc_found_rows
+connection master_1;
+SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a LIMIT 4;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+connection master_1;
+SELECT found_rows();
+found_rows()
+5
+
+select high_priority
+connection master_1;
+SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select distinct
+connection master_1;
+SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select count
+connection master_1;
+SELECT count(*) FROM ta_l ORDER BY a;
+count(*)
+5
+
+select table join not use index
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
+EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select using pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+select using index and pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.a > 0 AND a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+insert
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert select
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+insert select a
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+
+insert low_priority
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert high_priority
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
+'2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert ignore
+connection master_1;
+INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert update (insert)
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+
+insert update (update)
+connection master_1;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 f 2005-08-08 11:11:11
+
+replace
+connection master_1;
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 f 2008-02-02 02:02:02
+
+replace select
+connection master_1;
+REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+replace select a
+connection master_1;
+REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+replace low_priority
+connection master_1;
+REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
+'2009-03-03 03:03:03');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+2 g 2000-02-01 00:00:00
+3 g 2009-03-03 03:03:03
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+update
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59');
+connection master_1;
+UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+2 f 2008-02-02 02:02:02
+
+update select
+connection master_1;
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
+tb_l);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 g 2009-03-03 03:03:03
+
+update select a
+connection master_1;
+UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
+tb_l ORDER BY a LIMIT 1);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 h 2010-04-04 04:04:04
+2 g 2009-03-03 03:03:03
+
+update join
+connection master_1;
+UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+
+update join a
+connection master_1;
+UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
+a.a = b.a;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 g 2009-03-03 03:03:03
+
+update low_priority
+connection master_1;
+UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 f 2008-02-02 02:02:02
+
+update ignore
+connection master_1;
+UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 f 2008-02-02 02:02:02
+
+update pushdown
+connection master_1;
+update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 j 2009-03-03 03:03:03
+
+update index pushdown
+connection master_1;
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 g 2009-03-03 03:03:03
+2 g 2009-03-03 03:03:03
+
+delete
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete all
+connection master_1;
+DELETE FROM ta_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+
+delete select
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete select a
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete join
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete low_priority
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete ignore
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE IGNORE FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete quick
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE QUICK FROM ta_l WHERE a = 2;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 e 2008-01-01 23:59:59
+3 e 2008-01-01 23:59:59
+4 e 2008-01-01 23:59:59
+5 e 2008-01-01 23:59:59
+6 e 2008-01-01 23:59:59
+7 e 2008-01-01 23:59:59
+8 e 2008-01-01 23:59:59
+9 e 2008-01-01 23:59:59
+10 j 2008-01-01 23:59:59
+
+delete pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE b = 'e';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+10 j 2008-01-01 23:59:59
+
+delete index pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+connection master_1;
+DELETE FROM ta_l WHERE a > 0 AND b = 'e';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+10 j 2008-01-01 23:59:59
+
+truncate
+connection master_1;
+TRUNCATE TABLE ta_l;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+connection master_1;
+create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER
+COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"';
+drop table t2345678911234567892123456789312345678941234567895123234234;
+#
+# MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes
+#
+create table mdev_26139 (id int) ENGINE=SPIDER
+COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'";
+drop table mdev_26139;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/basic_sql_part.result b/storage/spider/mysql-test/spider/r/basic_sql_part.result
new file mode 100644
index 00000000..0f402940
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/basic_sql_part.result
@@ -0,0 +1,141 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'f', '2008-07-01 10:21:39'),
+(2, 'g', '2000-02-01 00:00:00'),
+(3, 'j', '2007-05-04 20:03:11'),
+(4, 'i', '2003-10-30 05:01:03'),
+(5, 'h', '2001-10-31 23:59:59');
+
+create table with partition and select test
+connection master_1;
+CREATE TABLE ta_l2 (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
+SELECT a, b, c FROM tb_l
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+select partition using pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+select partition using index pushdown
+connection master_1;
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+a.a > 0 AND a.b = 'g' ORDER BY a.a;
+a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
+2 g 2000-02-01 00:00:00
+
+update partition pushdown
+connection master_1;
+UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 e 2009-03-03 03:03:03
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+update partition index pushdown
+connection master_1;
+UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+2 g 2000-02-01 00:00:00
+3 j 2009-03-03 03:03:03
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+delete partition pushdown
+TRUNCATE TABLE ta_l2;
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+connection master_1;
+DELETE FROM ta_l2 WHERE b = 'g';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-31 23:59:59
+
+delete partition index pushdown
+TRUNCATE TABLE ta_l2;
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+connection master_1;
+DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 f 2008-07-01 10:21:39
+3 j 2007-05-04 20:03:11
+4 i 2003-10-30 05:01:03
+5 h 2001-10-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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result b/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result
new file mode 100644
index 00000000..ff6b968c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/checksum_table_with_quick_mode_3.result
@@ -0,0 +1,104 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+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;
+
+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 command_type != 'Execute' AND argument LIKE '%checksum %';
+argument
+checksum table `auto_test_remote`.`tbl_a` extended
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_aggregate.result b/storage/spider/mysql-test/spider/r/direct_aggregate.result
new file mode 100644
index 00000000..2455fe18
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_aggregate.result
@@ -0,0 +1,120 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+direct_aggregating test
+connection master_1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT COUNT(*) FROM ta_l;
+COUNT(*)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MAX(a) FROM ta_l;
+MAX(a)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MIN(a) FROM ta_l;
+MIN(a)
+1
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+MAX(a)
+4
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SET spider_direct_aggregate=0;
+SELECT COUNT(*) FROM ta_l;
+COUNT(*)
+5
+SELECT MAX(a) FROM ta_l;
+MAX(a)
+5
+SELECT MIN(a) FROM ta_l;
+MIN(a)
+1
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+MAX(a)
+4
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SET spider_direct_aggregate=1;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/r/direct_aggregate_part.result
new file mode 100644
index 00000000..9d65fcc2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_aggregate_part.result
@@ -0,0 +1,121 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+with partition test
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+SELECT COUNT(*) FROM ta_l2;
+COUNT(*)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 4
+SELECT SUM(a) FROM ta_l2;
+SUM(a)
+15
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MAX(a) FROM ta_l2;
+MAX(a)
+5
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MIN(a) FROM ta_l2;
+MIN(a)
+1
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+MAX(a)
+4
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+SET spider_direct_aggregate=0;
+SELECT COUNT(*) FROM ta_l2;
+COUNT(*)
+5
+SELECT SUM(a) FROM ta_l2;
+SUM(a)
+15
+SELECT MAX(a) FROM ta_l2;
+MAX(a)
+5
+SELECT MIN(a) FROM ta_l2;
+MIN(a)
+1
+SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+MAX(a)
+4
+SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+MIN(a)
+2
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 8
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_join.result b/storage/spider/mysql-test/spider/r/direct_join.result
new file mode 100644
index 00000000..398985ac
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_join.result
@@ -0,0 +1,197 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a, tbl_b b, tbl_c c WHERE a.a = b.a and a.a = c.a ORDER BY a.b DESC LIMIT 1,2;
+a b c
+4 40 400
+3 30 300
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc limit 1,2
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+Test JOIN on a constant table.
+Spider should NOT push down the join because the tbl_person table
+is optimized as a constant table.
+connection child2_1;
+CHILD2_1_DROP_CONST_TABLE_JOIN
+CHILD2_1_DROP_CONST_TABLE2_JOIN
+CHILD2_1_CREATE_CONST_TABLE_JOIN
+CHILD2_1_CREATE_CONST_TABLE2_JOIN
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_person;
+DROP TABLE IF EXISTS tbl_ncd_cm_person;
+CREATE TABLE tbl_person (
+id VARCHAR(50) NOT NULL,
+hr_status VARCHAR(50) NULL DEFAULT NULL,
+region_code VARCHAR(50) NULL DEFAULT NULL,
+region INT(11) NOT NULL,
+PRIMARY KEY (id, region) USING BTREE
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE_JOIN
+MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE_JOIN
+SHOW CREATE TABLE tbl_person
+Table Create Table
+tbl_person CREATE TABLE `tbl_person` (
+ `id` varchar(50) NOT NULL,
+ `hr_status` varchar(50) DEFAULT NULL,
+ `region_code` varchar(50) DEFAULT NULL,
+ `region` int(11) NOT NULL,
+ PRIMARY KEY (`id`,`region`) USING BTREE
+) ENGINE=SPIDER DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=DYNAMIC COMMENT='table "tbl_ncd_cm_person"'
+ PARTITION BY LIST COLUMNS(`region`)
+(PARTITION `pt1` VALUES IN (510411) COMMENT = 'tbl "tbl_person", srv "s_2_1"' ENGINE = SPIDER)
+CREATE TABLE tbl_ncd_cm_person (
+id VARCHAR(50) NOT NULL,
+person_id VARCHAR(50) NULL DEFAULT '',
+diseaseKind_id VARCHAR(50) NULL DEFAULT NULL,
+region INT(11) NOT NULL,
+PRIMARY KEY (id, region) USING BTREE
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE2_JOIN
+MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE2_JOIN
+SHOW CREATE TABLE tbl_ncd_cm_person
+Table Create Table
+tbl_ncd_cm_person CREATE TABLE `tbl_ncd_cm_person` (
+ `id` varchar(50) NOT NULL,
+ `person_id` varchar(50) DEFAULT '',
+ `diseaseKind_id` varchar(50) DEFAULT NULL,
+ `region` int(11) NOT NULL,
+ PRIMARY KEY (`id`,`region`) USING BTREE
+) ENGINE=SPIDER DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=DYNAMIC
+ PARTITION BY LIST COLUMNS(`region`)
+(PARTITION `pt1` VALUES IN (510411) COMMENT = 'tbl "tbl_ncd_cm_person", srv "s_2_1"' ENGINE = SPIDER)
+INSERT INTO tbl_person VALUES ('24FC3F0A5119432BAE13DD65AABAA39C',
+'1', '123-51041110620301-321', 510411);
+INSERT INTO tbl_person VALUES ('123456789012345678901234567890AB',
+'1', '123-51041110620301-321', 510411);
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789',
+'24FC3F0A5119432BAE13DD65AABAA39C',
+'52A0328740914BCE86ED10A4D2521816',
+510411);
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB',
+'123456789012345678901234567890AB',
+'52A0328740914BCE86ED10A4D2521816',
+510411);
+DELETE FROM tbl_ncd_cm_person;
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789',
+'24FC3F0A5119432BAE13DD65AABAA39C',
+'52A0328740914BCE86ED10A4D2521816',
+510411);
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB',
+'123456789012345678901234567890AB',
+'52A0328740914BCE86ED10A4D2521816',
+510411);
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT count(0) FROM tbl_person tp INNER JOIN tbl_ncd_cm_person tncp ON tp.id = tncp.person_id WHERE 1 = 1 AND tp.hr_status != "99" AND tp.hr_status != "2" AND tp.region_code LIKE CONCAT(CONCAT('%', '51041110620301', '%')) AND tp.id = '24FC3F0A5119432BAE13DD65AABAA39C' AND tncp.diseaseKind_id = '52A0328740914BCE86ED10A4D2521816' AND tp.region = 510411;
+count(0)
+1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `id`,`hr_status`,`region_code`,`region` from `auto_test_remote`.`tbl_person` where `id` = '24FC3F0A5119432BAE13DD65AABAA39C' and `region` = 510411
+select count(0) `count(0)` from `auto_test_remote`.`tbl_ncd_cm_person` t0 where ((t0.`person_id` = '24FC3F0A5119432BAE13DD65AABAA39C') and (t0.`diseaseKind_id` = '52A0328740914BCE86ED10A4D2521816'))
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT * FROM tbl_person;
+id hr_status region_code region
+123456789012345678901234567890AB 1 123-51041110620301-321 510411
+24FC3F0A5119432BAE13DD65AABAA39C 1 123-51041110620301-321 510411
+SELECT * FROM tbl_ncd_cm_person;
+id person_id diseaseKind_id region
+123456789 24FC3F0A5119432BAE13DD65AABAA39C 52A0328740914BCE86ED10A4D2521816 510411
+123456789AB 123456789012345678901234567890AB 52A0328740914BCE86ED10A4D2521816 510411
+
+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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_join_using.result b/storage/spider/mysql-test/spider/r/direct_join_using.result
new file mode 100644
index 00000000..facfabfe
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_join_using.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join.result b/storage/spider/mysql-test/spider/r/direct_left_join.result
new file mode 100644
index 00000000..1af1a661
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_join.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
new file mode 100644
index 00000000..4adfb1bd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
+a b c a
+5 NULL NULL NULL
+4 NULL NULL NULL
+3 c 2000-01-03 00:00:00 NULL
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on (t3.`b` = t2.`b`) where 1 order by t0.`a` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
new file mode 100644
index 00000000..a6bd3a7c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL NULL NULL 4
+NULL NULL NULL 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result
new file mode 100644
index 00000000..8fab6d24
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result
@@ -0,0 +1,112 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join.result b/storage/spider/mysql-test/spider/r/direct_right_join.result
new file mode 100644
index 00000000..d7780b94
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_join.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
new file mode 100644
index 00000000..5101ea50
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on (t2.`b` = t3.`b`) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result
new file mode 100644
index 00000000..c90fe3ab
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result
@@ -0,0 +1,112 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
new file mode 100644
index 00000000..f6c808be
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL NULL NULL 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_update.result b/storage/spider/mysql-test/spider/r/direct_update.result
new file mode 100644
index 00000000..0e536d48
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_update.result
@@ -0,0 +1,155 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+direct_updating test
+connection master_1;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 0
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+update all rows with function
+UPDATE ta_l SET c = ADDDATE(c, 1);
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 e 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key
+UPDATE ta_l SET b = 'x' WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 2
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by a column without index
+UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-17 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key with order and limit
+UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 4
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by primary key with order and limit
+DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by a column without index
+DELETE FROM ta_l WHERE b = 'c';
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 2
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+delete by primary key
+DELETE FROM ta_l WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+4 d 2003-12-01 05:01:03
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_update_part.result b/storage/spider/mysql-test/spider/r/direct_update_part.result
new file mode 100644
index 00000000..7069cd72
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_update_part.result
@@ -0,0 +1,145 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+with partition test
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 0
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+update all rows with function
+UPDATE ta_l2 SET c = ADDDATE(c, 1);
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 2
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 e 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key
+UPDATE ta_l2 SET b = 'x' WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2007-06-05 20:03:11
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by a column without index
+UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 5
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-17 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+update by primary key with order and limit
+UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_update';
+Variable_name Value
+Spider_direct_update 6
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+2 b 2000-01-02 00:00:00
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by primary key with order and limit
+DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+5 c 2002-01-01 23:59:59
+delete by a column without index
+DELETE FROM ta_l2 WHERE b = 'c';
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 3
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+3 x 2011-10-18 00:00:00
+4 d 2003-12-01 05:01:03
+delete by primary key
+DELETE FROM ta_l2 WHERE a = 3;
+SHOW STATUS LIKE 'Spider_direct_delete';
+Variable_name Value
+Spider_direct_delete 4
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-02 10:21:39
+4 d 2003-12-01 05:01:03
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/error_row_number.result b/storage/spider/mysql-test/spider/r/error_row_number.result
new file mode 100644
index 00000000..cc2b5487
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/error_row_number.result
@@ -0,0 +1,45 @@
+#
+# MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection child2_1;
+create database auto_test_remote;
+use auto_test_remote;
+create table ta_r (id int primary key);
+connection master_1;
+create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+insert into spd values (1),(2),(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+get diagnostics condition 1 @n = row_number;
+select @n;
+@n
+0
+delete from spd;
+insert into spd values (1),(2),(3),(13);
+update spd set id = id + 10;
+ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
+get diagnostics condition 1 @n = row_number;
+select @n;
+@n
+0
+drop table spd;
+connection child2_1;
+drop database auto_test_remote;
+connection master_1;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/r/function.result b/storage/spider/mysql-test/spider/r/function.result
new file mode 100644
index 00000000..c088a8a9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/function.result
@@ -0,0 +1,160 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+in()
+connection master_1;
+CREATE TABLE t1 (
+a VARCHAR(255),
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1
+insert into t1 values ('1');
+insert into t1 select a + 1 from t1;
+insert into t1 select a + 2 from t1;
+insert into t1 select a + 4 from t1;
+insert into t1 select a + 8 from t1;
+insert into t1 select a + 16 from t1;
+insert into t1 select a + 32 from t1;
+insert into t1 select a + 64 from t1;
+insert into t1 select a + 128 from t1;
+insert into t1 select a + 256 from t1;
+insert into t1 select a + 512 from t1;
+flush tables;
+connection master_1;
+select a from t1 where a in ('15', '120');
+a
+120
+15
+
+date_sub()
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-08-01 10:21:39
+2 b 1999-01-01 00:00:00
+3 e 2006-06-04 20:03:11
+4 d 2002-11-30 05:01:03
+5 c 2000-12-31 23:59:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-11-01 10:21:39
+2 b 1999-04-01 00:00:00
+3 e 2006-09-04 20:03:11
+4 d 2003-02-28 05:01:03
+5 c 2001-03-31 23:59:59
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-01 10:21:39
+2 b 1999-03-01 00:00:00
+3 e 2006-08-04 20:03:11
+4 d 2003-01-28 05:01:03
+5 c 2001-02-28 23:59:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-08 10:21:39
+2 b 1999-03-08 00:00:00
+3 e 2006-08-11 20:03:11
+4 d 2003-02-04 05:01:03
+5 c 2001-03-07 23:59:59
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 10:21:39
+2 b 1999-03-07 00:00:00
+3 e 2006-08-10 20:03:11
+4 d 2003-02-03 05:01:03
+5 c 2001-03-06 23:59:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 11:21:39
+2 b 1999-03-07 01:00:00
+3 e 2006-08-10 21:03:11
+4 d 2003-02-03 06:01:03
+5 c 2001-03-07 00:59:59
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 11:20:39
+2 b 1999-03-07 00:59:00
+3 e 2006-08-10 21:02:11
+4 d 2003-02-03 06:00:03
+5 c 2001-03-07 00:58:59
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2007-10-07 11:20:40
+2 b 1999-03-07 00:59:01
+3 e 2006-08-10 21:02:12
+4 d 2003-02-03 06:00:04
+5 c 2001-03-07 00:59:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/ha.result b/storage/spider/mysql-test/spider/r/ha.result
new file mode 100644
index 00000000..3c37c2d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/ha.result
@@ -0,0 +1,286 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 0
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote2.ta_r3' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 3
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l 1
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l
+CONNECTION='host "localhost", user "root", password "",
+ msi "5", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 2
+SELECT spider_copy_tables('ta_l', '0', '1');
+spider_copy_tables('ta_l', '0', '1')
+1
+connection master_1;
+ALTER TABLE ta_l
+CONNECTION='host "localhost", user "root", password "",
+ msi "5", mkd "2",
+ database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 1
+INSERT INTO ta_l (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+8 g 2011-05-05 21:33:30
+DROP TABLE ta_l;
+connection master_1;
+SELECT spider_flush_table_mon_cache();
+spider_flush_table_mon_cache()
+1
+
+active standby test
+create table test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 2
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote.ta_r' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 3
+auto_test_local ta_l 1 1
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l 1
+auto_test_local ta_l 0
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 2
+Spider_mon_table_cache_version_req 2
+INSERT INTO ta_l (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l
+CONNECTION='host "localhost", user "root", password "",
+ msi "5", mkd "2", alc "1",
+ database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l 0 1
+auto_test_local ta_l 1 1
+INSERT INTO ta_l (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+8 g 2011-05-05 21:33:30
+DROP TABLE ta_l;
+connection master_1;
+SELECT spider_flush_table_mon_cache();
+spider_flush_table_mon_cache()
+1
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/ha_part.result b/storage/spider/mysql-test/spider/r/ha_part.result
new file mode 100644
index 00000000..d191cab3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/ha_part.result
@@ -0,0 +1,320 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table with partition test
+connection master_1;
+DROP TABLE IF EXISTS ta_l2;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l2 (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 0
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote3.ta_r4' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 3
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l2#P#pt2 1
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l2
+PARTITION BY KEY(a) (
+PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 2"'
+ );
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 2
+SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
+spider_copy_tables('ta_l2#P#pt2', '0', '1')
+1
+connection master_1;
+ALTER TABLE ta_l2
+PARTITION BY KEY(a) (
+PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "0 1"'
+ );
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30'),
+(9, 'h', '2011-05-05 22:32:10');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+6 e 2011-05-05 20:04:05
+8 g 2011-05-05 21:33:30
+9 h 2011-05-05 22:32:10
+DROP TABLE ta_l2;
+
+create table with partition test
+connection master_1;
+DROP TABLE IF EXISTS ta_l2;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+INSERT INTO ta_l2 (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+select test
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 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
+
+fail-over test
+connection master_1;
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+ERROR HY000: Table 'auto_test_remote.ta_r2' get a problem
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 3
+auto_test_local ta_l2#P#pt2 1 1
+SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
+db_name table_name link_id
+auto_test_local ta_l2#P#pt2 1
+auto_test_local ta_l2#P#pt2 0
+SHOW STATUS LIKE 'Spider_mon_table_cache_version%';
+Variable_name Value
+Spider_mon_table_cache_version 1
+Spider_mon_table_cache_version_req 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+3 e 2007-06-04 20:03:11
+5 c 2001-12-31 23:59:59
+6 e 2011-05-05 20:04:05
+
+recovery test
+connection master_1;
+ALTER TABLE ta_l2
+PARTITION BY KEY(a) (
+PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
+ priority "1000"',
+PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
+ priority "1000001", lst "1 0"'
+ );
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
+ORDER BY db_name, table_name, link_id;
+db_name table_name link_id link_status
+auto_test_local ta_l2#P#pt1 0 1
+auto_test_local ta_l2#P#pt1 1 1
+auto_test_local ta_l2#P#pt2 0 1
+auto_test_local ta_l2#P#pt2 1 1
+INSERT INTO ta_l2 (a, b, c) VALUES
+(8, 'g', '2011-05-05 21:33:30'),
+(9, 'h', '2011-05-05 22:32:10');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+3 e 2007-06-04 20:03:11
+5 c 2001-12-31 23:59:59
+8 g 2011-05-05 21:33:30
+9 h 2011-05-05 22:32:10
+DROP TABLE ta_l2;
+connection master_1;
+CREATE TABLE t (c INT) PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER);
+SHOW FIELDS FROM t;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+SHOW FIELDS FROM t;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+DROP TABLE t;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+connection child2_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+connection child3_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_2;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child3_3;
+DROP DATABASE IF EXISTS auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/partition_cond_push.result b/storage/spider/mysql-test/spider/r/partition_cond_push.result
new file mode 100644
index 00000000..dd91e4b7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/partition_cond_push.result
@@ -0,0 +1,168 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_3;
+CHILD2_3_DROP_TABLES
+CHILD2_3_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+value int NOT NULL
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (value) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (value) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (value) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT value FROM tbl_a WHERE value < 100;
+value
+4
+5
+10
+11
+16
+17
+22
+23
+28
+29
+0
+1
+6
+7
+12
+13
+18
+19
+24
+25
+2
+3
+8
+9
+14
+15
+20
+21
+26
+27
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `value` from `auto_test_remote`.`tbl_a` where (`value` < 100)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT value FROM tbl_a ORDER BY value;
+value
+4
+5
+10
+11
+16
+17
+22
+23
+28
+29
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `value` from `auto_test_remote2`.`tbl_a` where (`value` < 100)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT value FROM tbl_a ORDER BY value;
+value
+0
+1
+6
+7
+12
+13
+18
+19
+24
+25
+connection child2_3;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `value` from `auto_test_remote3`.`tbl_a` where (`value` < 100)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT value FROM tbl_a ORDER BY value;
+value
+2
+3
+8
+9
+14
+15
+20
+21
+26
+27
+
+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_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/partition_fulltext.result b/storage/spider/mysql-test/spider/r/partition_fulltext.result
new file mode 100644
index 00000000..581c731b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/partition_fulltext.result
@@ -0,0 +1,126 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_join_cache_level= @@join_cache_level;
+set session join_cache_level= 5;
+set @old_optimizer_switch= @@optimizer_switch;
+set session optimizer_switch= 'mrr=on';
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+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';
+DROP DATABASE IF EXISTS auto_test_remote;
+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';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_3;
+CHILD2_3_DROP_TABLES
+CHILD2_3_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+words text NOT NULL,
+PRIMARY KEY (pkey),
+FULLTEXT (words)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey, words) VALUES (0, 'abc'),(1, 'def'),(2, 'ghi'),(3, 'jkl'),(4, 'mno'),(5, 'pqr'),(6, 'stu'),(7, 'vwx');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT pkey, words FROM tbl_a WHERE match(words) against('+ghi' in boolean mode);
+pkey words
+2 ghi
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against(_latin1'+ghi' in boolean mode))
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+4
+5
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote2`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against(_latin1'+ghi' in boolean mode))
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+0
+1
+6
+7
+connection child2_3;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select match(`words`)against('+ghi' in boolean mode),`pkey`,`words` from `auto_test_remote3`.`tbl_a` where match(`words`)against('+ghi' in boolean mode) and (match(`words`)against(_latin1'+ghi' in boolean mode))
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+pkey
+2
+3
+
+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_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session join_cache_level= @old_join_cache_level;
+set session optimizer_switch= @old_optimizer_switch;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result b/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result
new file mode 100644
index 00000000..3eed8df2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result
@@ -0,0 +1,130 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES2
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES2
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_DROP_TABLES2
+CHILD2_2_CREATE_TABLES
+CHILD2_2_CREATE_TABLES2
+TRUNCATE TABLE mysql.general_log;
+connection child2_3;
+CHILD2_3_DROP_TABLES
+CHILD2_3_DROP_TABLES2
+CHILD2_3_CREATE_TABLES
+CHILD2_3_CREATE_TABLES2
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+CREATE TABLE tbl_a (
+value int NOT NULL,
+PRIMARY KEY(value)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+value2 int NOT NULL,
+PRIMARY KEY(value2)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2
+insert into tbl_a values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into tbl_b values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+connection master_1;
+SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = b.value2 AND a.value = 5;
+sum(a.value) count(b.value2)
+5 1
+SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = 5 and b.value2 = 5;
+sum(a.value) count(b.value2)
+5 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT value FROM tbl_a ORDER BY value;
+value
+1
+2
+3
+4
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `value` from `auto_test_remote2`.`tbl_a` where `value` = 5
+select `value2` from `auto_test_remote2`.`tbl_b` where `value2` = 5
+select `value` from `auto_test_remote2`.`tbl_a` where `value` = 5
+select `value2` from `auto_test_remote2`.`tbl_b` where `value2` = 5
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT value FROM tbl_a ORDER BY value;
+value
+5
+6
+7
+8
+9
+connection child2_3;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT value FROM tbl_a ORDER BY value;
+value
+10
+
+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_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/partition_mrr.result b/storage/spider/mysql-test/spider/r/partition_mrr.result
new file mode 100644
index 00000000..c1b7d6e6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/partition_mrr.result
@@ -0,0 +1,267 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+set @old_join_cache_level= @@join_cache_level;
+set session join_cache_level= 5;
+set @old_optimizer_switch= @@optimizer_switch;
+set session optimizer_switch= 'mrr=on';
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+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';
+DROP DATABASE IF EXISTS auto_test_remote;
+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';
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+connection child2_3;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote3;
+CREATE DATABASE auto_test_remote3;
+USE auto_test_remote3;
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_DROP_TABLES
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_3;
+CHILD2_3_DROP_TABLES
+CHILD2_3_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+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
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+pkey
+4
+5
+10
+11
+16
+17
+22
+23
+28
+29
+0
+1
+6
+7
+12
+13
+18
+19
+24
+25
+2
+3
+8
+9
+14
+15
+20
+21
+26
+27
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey+0 = b.pkey+0 ORDER BY a.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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+select a.id,b.`pkey` from auto_test_remote.tmp_spider_bka_xxxx a,`auto_test_remote`.`tbl_b` b where a.c0 <=> b.`pkey`
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+select `pkey` from `auto_test_remote`.`tbl_b` order by `pkey`
+select `pkey` from `auto_test_remote`.`tbl_b` order by `pkey`
+select `pkey` from `auto_test_remote`.`tbl_b` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey ;
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+4
+5
+10
+11
+16
+17
+22
+23
+28
+29
+pkey
+2
+3
+8
+9
+14
+15
+20
+21
+26
+27
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote2`.`tbl_a` order by `pkey`
+select a.id,b.`pkey` from auto_test_remote2.tmp_spider_bka_xxxx a,`auto_test_remote2`.`tbl_b` b where a.c0 <=> b.`pkey`
+select `pkey` from `auto_test_remote2`.`tbl_a` order by `pkey`
+select `pkey` from `auto_test_remote2`.`tbl_b` order by `pkey`
+select `pkey` from `auto_test_remote2`.`tbl_b` order by `pkey`
+select `pkey` from `auto_test_remote2`.`tbl_b` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey ;
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+0
+1
+6
+7
+12
+13
+18
+19
+24
+25
+pkey
+4
+5
+10
+11
+16
+17
+22
+23
+28
+29
+connection child2_3;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote3`.`tbl_a` order by `pkey`
+select a.id,b.`pkey` from auto_test_remote3.tmp_spider_bka_xxxx a,`auto_test_remote3`.`tbl_b` b where a.c0 <=> b.`pkey`
+select `pkey` from `auto_test_remote3`.`tbl_a` order by `pkey`
+select `pkey` from `auto_test_remote3`.`tbl_b` order by `pkey`
+select `pkey` from `auto_test_remote3`.`tbl_b` order by `pkey`
+select `pkey` from `auto_test_remote3`.`tbl_b` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT pkey FROM tbl_a ORDER BY pkey ;
+SELECT pkey FROM tbl_b ORDER BY pkey;
+pkey
+2
+3
+8
+9
+14
+15
+20
+21
+26
+27
+pkey
+0
+1
+6
+7
+12
+13
+18
+19
+24
+25
+
+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_3;
+DROP DATABASE IF EXISTS auto_test_remote3;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session join_cache_level= @old_join_cache_level;
+set session optimizer_switch= @old_optimizer_switch;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/pushdown_not_like.result b/storage/spider/mysql-test/spider/r/pushdown_not_like.result
new file mode 100644
index 00000000..5c802c90
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/pushdown_not_like.result
@@ -0,0 +1,63 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2018-11-01 10:21:39'),
+(2, 'b', '2015-06-30 23:59:59'),
+(3, 'c', '2013-11-01 01:01:01');
+
+spider not like bug fix test
+connection master_1;
+select * from ta_l where b not like 'a%';
+a b c
+2 b 2015-06-30 23:59:59
+3 c 2013-11-01 01:01:01
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select%';
+argument
+select t0.`a` `a`,t0.`b` `b`,t0.`c` `c` from `auto_test_remote`.`ta_r` t0 where (t0.`b` not like 'a%')
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select%'
+
+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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_0.result b/storage/spider/mysql-test/spider/r/quick_mode_0.result
new file mode 100644
index 00000000..04c8231b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_0.result
@@ -0,0 +1,508 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+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;
+
+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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_1.result b/storage/spider/mysql-test/spider/r/quick_mode_1.result
new file mode 100644
index 00000000..820d791d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_1.result
@@ -0,0 +1,508 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+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;
+
+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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_2.result b/storage/spider/mysql-test/spider/r/quick_mode_2.result
new file mode 100644
index 00000000..94c5c4cf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_2.result
@@ -0,0 +1,508 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+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;
+
+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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/quick_mode_3.result b/storage/spider/mysql-test/spider/r/quick_mode_3.result
new file mode 100644
index 00000000..88a8914c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/quick_mode_3.result
@@ -0,0 +1,508 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+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;
+
+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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `pkey` from `auto_test_remote`.`tbl_a` order by `pkey`
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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 command_type != 'Execute' AND 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 command_type != 'Execute' AND 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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/show_system_tables.result b/storage/spider/mysql-test/spider/r/show_system_tables.result
new file mode 100644
index 00000000..67411862
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/show_system_tables.result
@@ -0,0 +1,37 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+Show system tables on the Spider node
+connection master_1;
+SELECT table_name, engine FROM information_schema.tables
+WHERE table_schema = 'mysql' AND table_name like '%spider_%';
+table_name engine
+spider_link_failed_log Aria
+spider_link_mon_servers Aria
+spider_table_crd Aria
+spider_table_position_for_recovery Aria
+spider_table_sts Aria
+spider_tables Aria
+spider_xa Aria
+spider_xa_failed_log Aria
+spider_xa_member Aria
+
+deinit
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result
new file mode 100644
index 00000000..28aaf74f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result
@@ -0,0 +1,105 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+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 command_type != 'Execute' AND 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 utf8mb3
+set session transaction isolation level read committed;set session autocommit = 1;set session wait_timeout = 604800;set session sql_mode = 'strict_trans_tables,error_for_division_by_zero,no_auto_create_user,no_engine_substitution';start transaction
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%set %'
+SELECT pkey FROM tbl_a ORDER BY pkey;
+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
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/spider3_fixes.result b/storage/spider/mysql-test/spider/r/spider3_fixes.result
new file mode 100644
index 00000000..7a80e102
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/spider3_fixes.result
@@ -0,0 +1,232 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+3.1
+auto_increment
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t2;
+MAX(id)
+1554
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1555
+SELECT MAX(id) FROM t1;
+MAX(id)
+1555
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t2;
+MAX(id)
+2331
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2332
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+1555
+2331
+2332
+3109
+3886
+4663
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5439
+SELECT id FROM t2 ORDER BY id;
+id
+777
+1554
+1555
+2331
+2332
+3109
+3886
+4663
+5439
+6216
+6993
+7770
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t2 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+6993
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+5000
+10000
+connection master_1;
+#
+# MDEV-28225 Disallow user to create Spider temporary table
+#
+connection master_1;
+CREATE TEMPORARY TABLE t1 (
+a INT
+) ENGINE=Spider;
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'TEMPORARY'
+
+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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/r/spider3_fixes_part.result
new file mode 100644
index 00000000..937f222f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/spider3_fixes_part.result
@@ -0,0 +1,222 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+auto_increment with partition
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
+CREATE TABLE t2 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t2;
+MAX(id)
+1554
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1555
+SELECT MAX(id) FROM t1;
+MAX(id)
+1555
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t2;
+MAX(id)
+2331
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2332
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+1555
+2331
+2332
+3109
+3886
+4663
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5439
+SELECT id FROM t2 ORDER BY id;
+id
+777
+1554
+1555
+2331
+2332
+3109
+3886
+4663
+5439
+6216
+6993
+7770
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t2 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+MASTER_1_AUTO_INCREMENT_OFFSET3
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+MASTER_1_AUTO_INCREMENT_OFFSET4
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+6993
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+6993
+SELECT MAX(id) FROM t2;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+5000
+10000
+connection master_1;
+
+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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result
new file mode 100644
index 00000000..273f37a8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/spider_fixes.result
@@ -0,0 +1,623 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+2.13
+select table with "order by desc" and "<"
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a < 5 ORDER BY a DESC LIMIT 3;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+4 d 2003-11-30 05:01:03
+3 e 2007-06-04 20:03:11
+2 b 2000-01-01 00:00:00
+
+select table with "order by desc" and "<="
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a <= 5 ORDER BY a DESC LIMIT 3;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+5 c 2001-12-31 23:59:59
+4 d 2003-11-30 05:01:03
+3 e 2007-06-04 20:03:11
+
+2.14
+update table with range scan and split_read
+connection master_1;
+UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+2 b 2000-02-02 00:00:00
+3 e 2000-02-02 00:00:00
+4 d 2000-02-02 00:00:00
+5 c 2000-02-02 00:00:00
+
+2.15
+select table with range scan
+TRUNCATE TABLE ta_l;
+DROP TABLE IF EXISTS ta_l;
+connection master_1;
+CREATE TABLE ta_l (
+a int(11) NOT NULL DEFAULT '0',
+b char(1) DEFAULT NULL,
+c datetime DEFAULT NULL,
+PRIMARY KEY (a, b, c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
+AND c = '2001-12-31 23:59:59';
+a b c
+5 c 2001-12-31 23:59:59
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
+AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+a b c
+2 b 2000-01-01 00:00:00
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+a b c
+2 b 2000-01-01 00:00:00
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND b <= 'd' AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND b < 'e' AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
+AND b >= 'b' AND c = '2003-11-30 05:01:03';
+a b c
+4 d 2003-11-30 05:01:03
+connection master_1;
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
+AND b >= 'b' AND c = '2000-01-01 00:00:00';
+a b c
+2 b 2000-01-01 00:00:00
+
+2.16
+auto_increment insert with trigger
+connection master_1;
+CREATE TABLE ta_l_auto_inc (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tc_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;;
+connection master_1;
+INSERT INTO ta_l_auto_inc (a, b, c) VALUES
+(NULL, 's', '2008-12-31 20:59:59');
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 s 2008-12-31 20:59:59
+
+2.17
+engine-condition-pushdown with "or" and joining
+connection master_1;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2008-08-01 10:21:39
+2 b 2000-01-01 00:00:00
+3 e 2007-06-04 20:03:11
+4 d 2003-11-30 05:01:03
+5 c 2001-12-31 23:59:59
+
+2.23
+index merge
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+connection master_1;
+SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+a b c
+3 4 5
+4 5 6
+5 6 7
+
+2.24
+index scan update without PK
+connection master_1;
+DROP TABLE IF EXISTS ta_l_int;
+CREATE TABLE ta_l_int (
+a INT NOT NULL,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+a b c
+1 2 3
+2 3 4
+3 4 5
+4 5 6
+5 6 7
+6 7 8
+7 8 9
+8 9 10
+9 10 11
+10 11 12
+11 12 13
+12 13 14
+13 14 15
+14 15 16
+15 16 17
+16 17 18
+INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
+INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
+connection master_1;
+UPDATE ta_l_int SET c = 4 WHERE b = 2;
+connection master_1;
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+a b c
+1 2 4
+2 3 4
+3 4 5
+4 5 6
+5 6 7
+6 7 8
+7 8 9
+8 9 10
+9 10 11
+10 11 12
+11 12 13
+12 13 14
+13 14 15
+14 15 16
+15 16 17
+16 17 18
+17 2 4
+18 2 4
+
+2.25
+direct order limit
+connection master_1;
+SHOW STATUS LIKE 'Spider_direct_order_limit';
+Variable_name Value
+Spider_direct_order_limit 2
+SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
+a b c
+1 2 4
+2 3 4
+3 4 5
+SHOW STATUS LIKE 'Spider_direct_order_limit';
+Variable_name Value
+Spider_direct_order_limit 3
+
+2.26
+lock tables
+connection master_1;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+CREATE TABLE t2 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+LOCK TABLES t1 READ, t2 READ;
+UNLOCK TABLES;
+
+auto_increment
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t1;
+MAX(id)
+1554
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t1;
+MAX(id)
+2331
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3108
+SELECT MAX(id) FROM t1;
+MAX(id)
+3108
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t1 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1000
+1554
+2331
+3108
+3885
+4662
+5000
+5439
+6216
+10000
+connection master_1;
+
+read only
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1000
+1554
+2331
+3108
+3885
+4662
+5000
+5439
+6216
+10000
+INSERT INTO t1 (id) VALUES (1);
+ERROR HY000: Table 'auto_test_local.t1' is read only
+UPDATE t1 SET id = 4 WHERE id = 777;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+DELETE FROM t1 WHERE id = 777;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+DELETE FROM t1;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+TRUNCATE t1;
+ERROR HY000: Table 'auto_test_local.t1' is read only
+
+2.27
+error mode
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1
+SELECT id FROM t1 ORDER BY id;
+id
+Warnings:
+Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+INSERT INTO t1 (id) VALUES (1);
+Warnings:
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+DELETE FROM t1;
+Warnings:
+Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
+Error 12702 Remote table 'auto_test_remote.ter1_1' is not found
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+TRUNCATE t1;
+Warnings:
+Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+
+3.0
+is null
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a VARCHAR(255),
+b VARCHAR(255),
+c VARCHAR(255),
+KEY idx1(a,b),
+KEY idx2(b),
+PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1
+insert into t1 values (null, null, '2048');
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a + 32, b + 32, c + 32 from t1;
+insert into t1 select a + 64, b + 64, c + 64 from t1;
+insert into t1 select a + 128, b + 128, c + 128 from t1;
+insert into t1 select a + 256, b + 256, c + 256 from t1;
+insert into t1 select a + 512, b + 512, c + 512 from t1;
+flush tables;
+connection master_1;
+select a from t1 where a is null order by a limit 30;
+a
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+select b from t1 where b is null order by b limit 30;
+b
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+
+direct_order_limit
+connection master_1;
+TRUNCATE TABLE t1;
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a, b + 32, c + 32 from t1;
+insert into t1 select a, b + 64, c + 64 from t1;
+insert into t1 select a, b + 128, c + 128 from t1;
+flush tables;
+connection master_1;
+select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
+a b c
+10 74 74
+10 42 42
+10 234 234
+10 202 202
+10 170 170
+select a, c from t1 where a = '10' order by b desc limit 5;
+a c
+10 74
+10 42
+10 234
+10 202
+10 170
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+connection master_1;
+SET @@global.expire_logs_days=11;
+connect master_purge, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
+SET @@global.binlog_checksum=NONE;
+SET @@global.binlog_checksum=$binlog_checksum;
+SET @@global.expire_logs_days=$expire_logs_days;
+disconnect master_purge;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/r/spider_fixes_part.result
new file mode 100644
index 00000000..571af94c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/spider_fixes_part.result
@@ -0,0 +1,351 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+for slave1_1
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection slave1_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+
+2.17
+partition with sort
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
+ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+2 b 2000-01-01 00:00:00
+3 e 2007-06-04 20:03:11
+4 d 2003-11-30 05:01:03
+5 c 2001-12-31 23:59:59
+
+2.23
+partition update with moving partition
+connection master_1;
+DROP TABLE IF EXISTS ta_l2;
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
+UPDATE ta_l2 SET a = 4 WHERE a = 3;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+4 B 2010-09-26 00:00:00
+index merge with partition
+connection master_1;
+DROP TABLE IF EXISTS ta_l_int;
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1
+INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+connection master_1;
+SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+a b c
+3 4 5
+4 5 6
+5 6 7
+
+2.26
+auto_increment with partition
+connection master_1;
+connection slave1_1;
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
+MASTER_1_AUTO_INCREMENT_INCREMENT2
+MASTER_1_AUTO_INCREMENT_OFFSET2
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_1"')
+1
+spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
+'srv "s_2_2"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
+'srv "s_2_1"')
+1
+spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
+'srv "s_2_2"')
+1
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (id)
+) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+777
+SELECT MAX(id) FROM t1;
+MAX(id)
+777
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+1554
+SELECT MAX(id) FROM t1;
+MAX(id)
+1554
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+2331
+SELECT MAX(id) FROM t1;
+MAX(id)
+2331
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3108
+SELECT MAX(id) FROM t1;
+MAX(id)
+3108
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+3885
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1554
+2331
+3108
+3885
+4662
+5439
+6216
+SET INSERT_ID=5000;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+6216
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+INSERT INTO t1 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+5000
+SELECT MAX(id) FROM t1;
+MAX(id)
+10000
+connection slave1_1;
+SELECT id FROM t1 ORDER BY id;
+id
+777
+1000
+1554
+2331
+3108
+3885
+4662
+5000
+5439
+6216
+10000
+connection master_1;
+
+Test ORDER BY with LIMIT and OFFSET
+connection master_1;
+CREATE TABLE ta_ob (
+a VARCHAR(50) NOT NULL,
+b VARCHAR(50) NULL DEFAULT NULL,
+c VARCHAR(100) NULL DEFAULT NULL,
+d DATETIME(0) NULL DEFAULT NULL,
+e INT(11) NOT NULL,
+f INT(10) NULL DEFAULT NULL,
+PRIMARY KEY (a, e)
+) ENGINE=Spider COMMENT='database "auto_test_remote", table "ta_ob"'
+ PARTITION BY LIST COLUMNS (e) PARTITIONS 1
+(PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"')
+INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733',
+'6CFED89FF6A84C7AA55C3C432663D094',
+'51041110620304', '2018-08-02 13:41:13',
+510411, 1);
+INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD',
+'879DC2A0B6AC46D9A62E8EA47E2970F2',
+'51041110620301', NULL,
+510411, 0);
+INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0',
+'017B8A460DBC444682B791305EF75356',
+'51041110620308', '2018-08-02 13:48:29',
+510411, 0);
+INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674',
+'996C7F14989D480589A553717D735E3E',
+'51041110620302', '2018-08-02 13:48:30',
+510411, 0);
+INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583',
+'017B8A460DBC444682B791305EF75356',
+'51041110620308', '2018-08-02 13:48:28',
+510411, 0);
+INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B',
+'821E71E6ABB4404EBAA349BB681089F8',
+'51041110620310', '2018-08-02 13:48:27',
+510411, 0);
+INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70',
+'821E71E6ABB4404EBAA349BB681089F8',
+'51041110620310', '2018-08-02 13:48:28',
+510411, 0);
+SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1;
+a b c d e f
+56E59BC4BDC143868D4A219C2D07A24B 821E71E6ABB4404EBAA349BB681089F8 51041110620310 2018-08-02 13:48:27 510411 0
+53F5266FB069499AB6234755CACA2583 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:28 510411 0
+56B68DA68D6D4A04A08B453D09AD7B70 821E71E6ABB4404EBAA349BB681089F8 51041110620310 2018-08-02 13:48:28 510411 0
+51ECF2C0CD3C48D99C91792E99D3C1A0 017B8A460DBC444682B791305EF75356 51041110620308 2018-08-02 13:48:29 510411 0
+093B37A93A534DF883787AF5F6799674 996C7F14989D480589A553717D735E3E 51041110620302 2018-08-02 13:48:30 510411 0
+#
+# MDEV-25985 Spider handle ">=" as ">" in some cases
+#
+connection child2_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a int,
+b int,
+c int,
+PRIMARY KEY (a),
+KEY (b,c)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 1);
+connection master_1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+a int,
+b int,
+c int,
+PRIMARY KEY (a),
+KEY (b,c)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "t1"'
+ PARTITION BY LIST COLUMNS(`a`) (
+PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
+ );
+connection master_1;
+SELECT * FROM t1 WHERE c > 0 AND b >= 1 AND b <= 2;
+a b c
+1 1 1
+2 2 1
+SELECT * FROM t1 WHERE c < 3 AND b <= 2;
+a b c
+1 1 1
+2 2 1
+
+Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
+Fixed with 4968049799193394d442f26b4e3a8d95b185be72
+Spider crashed if the first partition was not used first
+connection master_1;
+CREATE TABLE ta_l2 (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
+INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+Query a Spider table only using the second partition
+SELECT a,b,c FROM ta_l2 PARTITION (pt2);
+a b c
+4 d 2003-11-30 05:01:03
+5 c 2001-12-31 23:59:59
+Query a Spider table only using the first partition
+SELECT a,b,c FROM ta_l2 PARTITION (pt1);
+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
+Query a Spider table by all paritions, then the second partition
+SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
+min(a) max(a) min(b) max(b)
+1 5 a e
+SELECT a,b,c FROM ta_l2 PARTITION (pt2);
+a b c
+4 d 2003-11-30 05:01:03
+5 c 2001-12-31 23:59:59
+
+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;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for slave1_1
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/spider_wrapper_protocols.result b/storage/spider/mysql-test/spider/r/spider_wrapper_protocols.result
new file mode 100644
index 00000000..f1a7b620
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/spider_wrapper_protocols.result
@@ -0,0 +1,22 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+SELECT * FROM information_schema.spider_wrapper_protocols;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/timestamp.result b/storage/spider/mysql-test/spider/r/timestamp.result
new file mode 100644
index 00000000..4618d920
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/timestamp.result
@@ -0,0 +1,431 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+Initialize Time Zone
+connection master_1;
+SET GLOBAL time_zone='MET';
+SET time_zone='MET';
+connection child2_1;
+SET GLOBAL time_zone='MET';
+SET time_zone='MET';
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS ts_test_local;
+CREATE DATABASE ts_test_local;
+USE ts_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS ts_test_remote;
+CREATE DATABASE ts_test_remote;
+USE ts_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table
+connection child2_1;
+CHILD2_1_DROP_TABLE
+CHILD2_1_DROP_TABLE_F
+CHILD2_1_CREATE_TABLE
+CHILD2_1_CREATE_TABLE_F
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+col_a INT UNSIGNED NOT NULL AUTO_INCREMENT,
+col_dt DATETIME,
+col_ts TIMESTAMP NOT NULL
+DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+PRIMARY KEY(col_a),
+UNIQUE INDEX i_ts (col_ts)
+) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_f (
+col_d DATE,
+col_t TIME
+) ENGINE=Spider COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `col_dt` datetime DEFAULT NULL,
+ `col_ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`col_a`),
+ UNIQUE KEY `i_ts` (`col_ts`)
+) ENGINE=SPIDER AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'
+SHOW CREATE TABLE tbl_f;
+Table Create Table
+tbl_f CREATE TABLE `tbl_f` (
+ `col_d` date DEFAULT NULL,
+ `col_t` time DEFAULT NULL
+) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'
+
+Set a different time zone that has DST
+SET time_zone='+01:00';
+
+Insert Rows
+connection master_1;
+Min value
+SET @@timestamp=1;
+INSERT INTO tbl_a VALUES (1, now(), now());
+SET @@timestamp=0;
+Ambiguous DST values for MET time zone that result in the
+same UTC timestamp
+INSERT INTO tbl_a VALUES (2, '2018-03-25 02:00:00', '2018-03-25 02:00:00');
+INSERT INTO tbl_a VALUES (3, '2018-03-25 02:30:00', '2018-03-25 02:30:00');
+Ambiguous DST values for MET time zone in the 2:00 am to 3:00 am hour
+that occur twice when transitioning from DST to standard time
+SET @@timestamp=1540686600;
+INSERT INTO tbl_a VALUES (4, now(), now());
+SET @@timestamp=1540690200;
+INSERT INTO tbl_a VALUES (5, now(), now());
+Max value
+SET @@timestamp=2147483647;
+INSERT INTO tbl_a VALUES (6, now(), now());
+SET @@timestamp=0;
+
+SELECTs
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 03:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 03:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 02:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+
+DELETEs
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DELETE FROM tbl_a WHERE col_ts='1970-01-01 01:00:01';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+2 2018-03-25 02:00:00 2018-03-25 03:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 03:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 02:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SET @@timestamp=1;
+INSERT INTO tbl_a VALUES (1, now(), now());
+SET @@timestamp=0;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 03:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 03:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 02:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+
+UPDATEs
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+UPDATE tbl_a SET col_ts=col_dt;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select `col_a`,`col_dt`,`col_ts` from `ts_test_remote`.`tbl_a` for update
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 03:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 03:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 02:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+
+Lookups
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > '2018-01-01';
+col_a col_dt col_ts unix_timestamp(col_ts)
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts < '2018-10-28 02:30:00';
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE '2018-10-28 02:30:00' > col_ts;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts BETWEEN '2018-10-28 01:30:00' AND '2018-10-28 02:30:00';
+col_a col_dt col_ts unix_timestamp(col_ts)
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00' AND col_ts <= '2018-10-28 02:30:00';
+col_a col_dt col_ts unix_timestamp(col_ts)
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000;
+col_a col_dt col_ts unix_timestamp(col_ts)
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001;
+col_a col_dt col_ts unix_timestamp(col_ts)
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > _latin1'2017-12-31 23:00:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < _latin1'2018-10-28 01:30:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (_latin1'2018-10-28 01:30:00' > t0.`col_ts`)
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between _latin1'2018-10-28 00:30:00' and _latin1'2018-10-28 01:30:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= _latin1'2018-10-28 00:30:00') and (t0.`col_ts` <= _latin1'2018-10-28 01:30:00'))
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2018-03-25 01:00:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '1970-01-01 00:00:01')
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 03:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 03:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 02:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+
+Drop the index on the timestamp column
+connection child2_1;
+DROP INDEX i_ts ON tbl_a;
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `col_dt` datetime DEFAULT NULL,
+ `col_ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`col_a`)
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP INDEX i_ts ON tbl_a;
+SHOW CREATE TABLE tbl_a;
+Table Create Table
+tbl_a CREATE TABLE `tbl_a` (
+ `col_a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `col_dt` datetime DEFAULT NULL,
+ `col_ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`col_a`)
+) ENGINE=SPIDER AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'
+
+Retry lookups on unindexed timestamp column
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > '2018-01-01';
+col_a col_dt col_ts unix_timestamp(col_ts)
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts < '2018-10-28 02:30:00';
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE '2018-10-28 02:30:00' > col_ts;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts BETWEEN '2018-10-28 01:30:00' AND '2018-10-28 02:30:00';
+col_a col_dt col_ts unix_timestamp(col_ts)
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00' AND col_ts <= '2018-10-28 02:30:00';
+col_a col_dt col_ts unix_timestamp(col_ts)
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000;
+col_a col_dt col_ts unix_timestamp(col_ts)
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001;
+col_a col_dt col_ts unix_timestamp(col_ts)
+2 2018-03-25 02:00:00 2018-03-25 02:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 02:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 01:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > _latin1'2017-12-31 23:00:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` < _latin1'2018-10-28 01:30:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (_latin1'2018-10-28 01:30:00' > t0.`col_ts`)
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` between _latin1'2018-10-28 00:30:00' and _latin1'2018-10-28 01:30:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where ((t0.`col_ts` >= _latin1'2018-10-28 00:30:00') and (t0.`col_ts` <= _latin1'2018-10-28 01:30:00'))
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '2018-03-25 01:00:00')
+select t0.`col_a` `col_a`,t0.`col_dt` `col_dt`,t0.`col_ts` `col_ts`,(unix_timestamp(t0.`col_ts`)) `unix_timestamp(col_ts)` from `ts_test_remote`.`tbl_a` t0 where (t0.`col_ts` > '1970-01-01 00:00:01')
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+col_a col_dt col_ts unix_timestamp(col_ts)
+1 1970-01-01 01:00:01 1970-01-01 01:00:01 1
+2 2018-03-25 02:00:00 2018-03-25 03:00:00 1521939600
+3 2018-03-25 02:30:00 2018-03-25 03:30:00 1521941400
+4 2018-10-28 01:30:00 2018-10-28 02:30:00 1540686600
+5 2018-10-28 02:30:00 2018-10-28 02:30:00 1540690200
+6 2038-01-19 04:14:07 2038-01-19 04:14:07 2147483647
+
+Test the TIMESTAMP function
+connection master_1;
+INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'),
+('2018-06-24', '01:23:45'),
+('2018-08-01', '12:34:56');
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT * FROM tbl_f;
+col_d col_t
+2018-06-24 01:23:45
+2018-06-24 01:23:45
+2018-08-01 12:34:56
+SELECT TIMESTAMP(col_d, col_t) FROM tbl_f;
+TIMESTAMP(col_d, col_t)
+2018-06-24 01:23:45
+2018-06-24 01:23:45
+2018-08-01 12:34:56
+SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f;
+TIMESTAMP('2018-06-25', col_t)
+2018-06-25 01:23:45
+2018-06-25 01:23:45
+2018-06-25 12:34:56
+SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f;
+TIMESTAMP(col_d, '10:43:21')
+2018-06-24 10:43:21
+2018-06-24 10:43:21
+2018-08-01 10:43:21
+SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f;
+TIMESTAMP('2018-06-25', '10:43:21')
+2018-06-25 10:43:21
+2018-06-25 10:43:21
+2018-06-25 10:43:21
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select t0.`col_d` `col_d`,t0.`col_t` `col_t` from `ts_test_remote`.`tbl_f` t0
+select (timestamp(t0.`col_d` , t0.`col_t`)) `TIMESTAMP(col_d, col_t)` from `ts_test_remote`.`tbl_f` t0
+select (timestamp('2018-06-25' , t0.`col_t`)) `TIMESTAMP('2018-06-25', col_t)` from `ts_test_remote`.`tbl_f` t0
+select (timestamp(t0.`col_d` , '10:43:21')) `TIMESTAMP(col_d, '10:43:21')` from `ts_test_remote`.`tbl_f` t0
+select 1 from `ts_test_remote`.`tbl_f` t0
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'
+SELECT col_d, col_t FROM tbl_f;
+col_d col_t
+2018-06-24 01:23:45
+2018-06-24 01:23:45
+2018-08-01 12:34:56
+
+Restore Time Zone settings
+connection master_1;
+SET GLOBAL time_zone=DEFAULT;
+SET time_zone=DEFAULT;
+connection child2_1;
+SET GLOBAL time_zone=DEFAULT;
+SET time_zone=DEFAULT;
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS ts_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS ts_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/udf_pushdown.result b/storage/spider/mysql-test/spider/r/udf_pushdown.result
new file mode 100644
index 00000000..4ca73416
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/udf_pushdown.result
@@ -0,0 +1,218 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+#
+# MDEV-26545 Spider does not correctly handle UDF and stored function in where conds
+#
+
+##### enable general_log #####
+connection child2_1;
+SET @general_log_backup = @@global.general_log;
+SET @log_output_backup = @@global.log_output;
+SET @@global.general_log = 1;
+SET @@global.log_output = "TABLE";
+TRUNCATE TABLE mysql.general_log;
+
+##### 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 tables #####
+connection child2_1;
+CHILD_CREATE_TABLE
+connection master_1;
+MASTER_CREATE_TABLE
+CREATE TABLE ta_l (
+id INT NOT NULL,
+a INT,
+PRIMARY KEY(id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l VALUES
+(1, 11),
+(2, 22),
+(3, 33),
+(4, 44),
+(5, 55);
+
+##### create functions #####
+connection master_1;
+CREATE FUNCTION `plusone`( param INT ) RETURNS INT
+BEGIN
+RETURN param + 1;
+END //
+connection child2_1;
+CREATE FUNCTION `plusone`( param INT ) RETURNS INT
+BEGIN
+RETURN param + 1;
+END //
+
+########## spider_use_pushdown_udf=0 ##########
+connection master_1;
+SET @@spider_use_pushdown_udf = 0;
+
+##### test SELECTs #####
+connection master_1;
+SELECT * FROM ta_l WHERE id = plusone(1);
+id a
+2 22
+SELECT * FROM ta_l WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32);
+id a
+3 33
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE "%select%" AND argument NOT LIKE "%argument%";
+argument
+select `id`,`a` from `auto_test_remote`.`ta_r`
+select `id`,`a` from `auto_test_remote`.`ta_r`
+
+##### test UPDATEs #####
+connection master_1;
+UPDATE ta_l SET a = plusone(221) WHERE id = plusone(1);
+SELECT * FROM ta_l;
+id a
+1 11
+2 222
+3 33
+4 44
+5 55
+UPDATE ta_l SET a = plusone(332) WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32);
+SELECT * FROM ta_l;
+id a
+1 11
+2 222
+3 333
+4 44
+5 55
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE "%update%" AND argument NOT LIKE "%argument%";
+argument
+select `id`,`a` from `auto_test_remote`.`ta_r` for update
+update `auto_test_remote`.`ta_r` set `a` = 222 where `id` = 2 limit 1
+select `id`,`a` from `auto_test_remote`.`ta_r` for update
+update `auto_test_remote`.`ta_r` set `a` = 333 where `id` = 3 and `a` = 33 limit 1
+
+##### test DELETEs #####
+connection master_1;
+DELETE FROM ta_l WHERE id = plusone(1);
+SELECT * FROM ta_l;
+id a
+1 11
+3 333
+4 44
+5 55
+DELETE FROM ta_l WHERE id IN (plusone(1), plusone(2), plusone(3)) AND a = plusone(43);
+SELECT * FROM ta_l;
+id a
+1 11
+3 333
+5 55
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE (argument LIKE "%delete%" OR argument LIKE "%update%") AND argument NOT LIKE "%argument%";
+argument
+select `id` from `auto_test_remote`.`ta_r` for update
+delete from `auto_test_remote`.`ta_r` where `id` = 2 limit 1
+select `id`,`a` from `auto_test_remote`.`ta_r` for update
+delete from `auto_test_remote`.`ta_r` where `id` = 4 and `a` = 44 limit 1
+
+##### reset records #####
+connection master_1;
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l VALUES
+(1, 11),
+(2, 22),
+(3, 33),
+(4, 44),
+(5, 55);
+
+########## spider_use_pushdown_udf=1 ##########
+connection master_1;
+SET @@spider_use_pushdown_udf = 1;
+
+##### test SELECTs #####
+connection master_1;
+SELECT * FROM ta_l WHERE id = plusone(1);
+id a
+2 22
+SELECT * FROM ta_l WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32);
+id a
+3 33
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE "%select%" AND argument NOT LIKE "%argument%";
+argument
+select t0.`id` `id`,t0.`a` `a` from `auto_test_remote`.`ta_r` t0 where (t0.`id` = (`plusone`(1)))
+select t0.`id` `id`,t0.`a` `a` from `auto_test_remote`.`ta_r` t0 where ((t0.`id` in( (`plusone`(1)) , (`plusone`(2)))) and (t0.`a` = (`plusone`(32))))
+
+##### test UPDATEs #####
+connection master_1;
+UPDATE ta_l SET a = plusone(221) WHERE id = plusone(1);
+SELECT * FROM ta_l;
+id a
+1 11
+2 222
+3 33
+4 44
+5 55
+UPDATE ta_l SET a = plusone(332) WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32);
+SELECT * FROM ta_l;
+id a
+1 11
+2 222
+3 333
+4 44
+5 55
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE "%update%" AND argument NOT LIKE "%argument%";
+argument
+update `auto_test_remote`.`ta_r` set `a` = (`plusone`(221)) where (`id` = (`plusone`(1)))
+update `auto_test_remote`.`ta_r` set `a` = (`plusone`(332)) where ((`id` in( (`plusone`(1)) , (`plusone`(2)))) and (`a` = (`plusone`(32))))
+
+##### test DELETEs #####
+connection master_1;
+DELETE FROM ta_l WHERE id = plusone(1);
+SELECT * FROM ta_l;
+id a
+1 11
+3 333
+4 44
+5 55
+DELETE FROM ta_l WHERE id IN (plusone(1), plusone(2), plusone(3)) AND a = plusone(43);
+SELECT * FROM ta_l;
+id a
+1 11
+3 333
+5 55
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE (argument LIKE "%delete%" OR argument LIKE "%update%") AND argument NOT LIKE "%argument%";
+argument
+delete from `auto_test_remote`.`ta_r` where (`id` = (`plusone`(1)))
+delete from `auto_test_remote`.`ta_r` where ((`id` in( (`plusone`(1)) , (`plusone`(2)) , (`plusone`(3)))) and (`a` = (`plusone`(43))))
+
+deinit
+connection master_1;
+DROP FUNCTION `plusone`;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+SET @@global.general_log = @general_log_backup;
+SET @@global.log_output = @log_output_backup;
+DROP FUNCTION `plusone`;
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result
new file mode 100644
index 00000000..cea36ff2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result
@@ -0,0 +1,221 @@
+#
+# MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+# MDEV-28297 Deprecate spider_internal_offset
+SET spider_internal_offset = 1;
+Warnings:
+Warning 1287 '@@spider_internal_offset' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_internal_offset";
+Variable_name Value
+spider_internal_offset 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ios "1"';
+Warnings:
+Warning 1287 The table parameter 'ios' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_offset "1"';
+Warnings:
+Warning 1287 The table parameter 'internal_offset' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-27981 Deprecate spider_internal_limit
+SET spider_internal_limit = 1;
+Warnings:
+Warning 1287 '@@spider_internal_limit' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_internal_limit";
+Variable_name Value
+spider_internal_limit 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ilm "1"';
+Warnings:
+Warning 1287 The table parameter 'ilm' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_limit "1"';
+Warnings:
+Warning 1287 The table parameter 'internal_limit' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28244 Deprecate spider_xa_register_mode
+SET spider_xa_register_mode = 0;
+Warnings:
+Warning 1287 '@@spider_xa_register_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_xa_register_mode";
+Variable_name Value
+spider_xa_register_mode 0
+# MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
+SET GLOBAL spider_store_last_sts = 0;
+Warnings:
+Warning 1287 '@@spider_store_last_sts' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_store_last_sts";
+Variable_name Value
+spider_store_last_sts 0
+SET GLOBAL spider_store_last_crd = 0;
+Warnings:
+Warning 1287 '@@spider_store_last_crd' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_store_last_crd";
+Variable_name Value
+spider_store_last_crd 0
+SET GLOBAL spider_load_sts_at_startup = 0;
+Warnings:
+Warning 1287 '@@spider_load_sts_at_startup' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_load_sts_at_startup";
+Variable_name Value
+spider_load_sts_at_startup 0
+SET GLOBAL spider_load_crd_at_startup = 0;
+Warnings:
+Warning 1287 '@@spider_load_crd_at_startup' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_load_crd_at_startup";
+Variable_name Value
+spider_load_crd_at_startup 0
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
+SET spider_crd_mode = 1;
+Warnings:
+Warning 1287 '@@spider_crd_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_mode";
+Variable_name Value
+spider_crd_mode 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='cmd "3"';
+Warnings:
+Warning 1287 The table parameter 'cmd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_mode "3"';
+Warnings:
+Warning 1287 The table parameter 'crd_mode' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_sts_mode = 1;
+Warnings:
+Warning 1287 '@@spider_sts_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_sts_mode";
+Variable_name Value
+spider_sts_mode 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='smd "3"';
+Warnings:
+Warning 1287 The table parameter 'smd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='sts_mode "3"';
+Warnings:
+Warning 1287 The table parameter 'sts_mode' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
+SET spider_crd_type = 1;
+Warnings:
+Warning 1287 '@@spider_crd_type' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_type";
+Variable_name Value
+spider_crd_type 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ctp "1"';
+Warnings:
+Warning 1287 The table parameter 'ctp' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_type "1"';
+Warnings:
+Warning 1287 The table parameter 'crd_type' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_crd_weight = 1;
+Warnings:
+Warning 1287 '@@spider_crd_weight' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_weight";
+Variable_name Value
+spider_crd_weight 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='cwg "1"';
+Warnings:
+Warning 1287 The table parameter 'cwg' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_weight "1"';
+Warnings:
+Warning 1287 The table parameter 'crd_weight' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28560 Deprecate spider_buffer_size
+SET spider_buffer_size = 1;
+Warnings:
+Warning 1287 '@@spider_buffer_size' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_buffer_size";
+Variable_name Value
+spider_buffer_size 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='bfz "1"';
+Warnings:
+Warning 1287 The table parameter 'bfz' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='buffer_size "1"';
+Warnings:
+Warning 1287 The table parameter 'buffer_size' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-27926 Deprecate spider_init_sql_alloc_size
+SET spider_init_sql_alloc_size = 1;
+Warnings:
+Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
+Variable_name Value
+spider_init_sql_alloc_size 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='isa "1"';
+Warnings:
+Warning 1287 The table parameter 'isa' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='init_sql_alloc_size "1"';
+Warnings:
+Warning 1287 The table parameter 'init_sql_alloc_size' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
+SET spider_semi_table_lock = 1;
+Warnings:
+Warning 1287 '@@spider_semi_table_lock' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_semi_table_lock";
+Variable_name Value
+spider_semi_table_lock 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stl "1"';
+Warnings:
+Warning 1287 The table parameter 'stl' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock "1"';
+Warnings:
+Warning 1287 The table parameter 'semi_table_lock' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_semi_table_lock_connection = 0;
+Warnings:
+Warning 1287 '@@spider_semi_table_lock_connection' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_semi_table_lock_connection";
+Variable_name Value
+spider_semi_table_lock_connection 0
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stc "0"';
+Warnings:
+Warning 1287 The table parameter 'stc' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock_connection "0"';
+Warnings:
+Warning 1287 The table parameter 'semi_table_lock_connection' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28795 Deprecate spider_bka_table_name_type
+SET spider_bka_table_name_type = 1;
+Warnings:
+Warning 1287 '@@spider_bka_table_name_type' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_bka_table_name_type";
+Variable_name Value
+spider_bka_table_name_type 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='btt "1"';
+Warnings:
+Warning 1287 The table parameter 'btt' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='bka_table_name_type "1"';
+Warnings:
+Warning 1287 The table parameter 'bka_table_name_type' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/r/vp_fixes.result b/storage/spider/mysql-test/spider/r/vp_fixes.result
new file mode 100644
index 00000000..cc0e4105
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/vp_fixes.result
@@ -0,0 +1,93 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection master_1;
+DROP TABLE IF EXISTS tb_l;
+CREATE TABLE tb_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2
+INSERT INTO tb_l (a, b, c) VALUES
+(1, 'a', '2008-08-01 10:21:39'),
+(2, 'b', '2000-01-01 00:00:00'),
+(3, 'e', '2007-06-04 20:03:11'),
+(4, 'd', '2003-11-30 05:01:03'),
+(5, 'c', '2001-12-31 23:59:59');
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+0.9
+create different primary key table
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT DEFAULT 10,
+b INT AUTO_INCREMENT,
+c INT DEFAULT 11,
+PRIMARY KEY(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+connection master_1;
+INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+create un-correspond primary key table
+connection master_1;
+DROP TABLE IF EXISTS ta_l_int;
+connection master_1;
+CREATE TABLE ta_l_int (
+a INT DEFAULT 10,
+b INT DEFAULT 12,
+c INT DEFAULT 11,
+PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+connection master_1;
+INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc
new file mode 100644
index 00000000..ad30aac5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_deinit.inc
@@ -0,0 +1,12 @@
+--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_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc
new file mode 100644
index 00000000..b3d16987
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_key_init.inc
@@ -0,0 +1,36 @@
+--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 $STR_SEMICOLON
+ 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 (
+ akey int NOT NULL,
+ val int NOT NULL,
+ KEY idx1 (akey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE tbl_b (
+ bkey int NOT NULL,
+ akey int NOT NULL,
+ PRIMARY KEY (bkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT akey, val FROM tbl_a ORDER BY akey $STR_SEMICOLON
+ SELECT bkey, akey FROM tbl_b ORDER BY bkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' $STR_SEMICOLON
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%';
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc
new file mode 100644
index 00000000..ad30aac5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_deinit.inc
@@ -0,0 +1,12 @@
+--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_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc
new file mode 100644
index 00000000..000b42e2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/direct_join_by_pkey_pkey_init.inc
@@ -0,0 +1,36 @@
+--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 $STR_SEMICOLON
+ 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 (
+ akey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (akey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON
+ CREATE TABLE tbl_b (
+ bkey int NOT NULL,
+ akey int NOT NULL,
+ PRIMARY KEY (bkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT akey, val FROM tbl_a ORDER BY akey $STR_SEMICOLON
+ SELECT bkey, akey FROM tbl_b ORDER BY bkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' $STR_SEMICOLON
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%';
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc
new file mode 100644
index 00000000..f1899d15
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc
new file mode 100644
index 00000000..24f0dc98
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc
@@ -0,0 +1,4 @@
+--source load_data_init.inc
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc
new file mode 100644
index 00000000..f1899d15
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc
new file mode 100644
index 00000000..50ef8d47
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc
@@ -0,0 +1,4 @@
+--source load_data_init.inc
+--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/regression/e1121/include/load_data_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc
new file mode 100644
index 00000000..f8405973
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc
new file mode 100644
index 00000000..96216e01
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_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,
+ val 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, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
diff --git a/storage/spider/mysql-test/spider/regression/e1121/my.cnf b/storage/spider/mysql-test/spider/regression/e1121/my.cnf
new file mode 100644
index 00000000..47558d85
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/my.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include my_1_1.cnf
+!include my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf
new file mode 100644
index 00000000..5f17295d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf
@@ -0,0 +1,44 @@
+[mysqld.1.1]
+log-bin= master-bin
+loose_handlersocket_port= 20000
+loose_handlersocket_port_wr= 20001
+loose_handlersocket_threads= 2
+loose_handlersocket_threads_wr= 1
+loose_handlersocket_support_merge_table= 0
+loose_handlersocket_direct_update_mode= 2
+loose_handlersocket_unlimited_boundary= 65536
+loose_handlersocket_bulk_insert= 0
+loose_handlersocket_bulk_insert_timeout= 0
+loose_handlersocket_general_log= 1
+loose_handlersocket_timeout= 30
+loose_handlersocket_close_table_interval=2
+open_files_limit= 4096
+loose_partition= 1
+
+[ENV]
+USE_GEOMETRY_TEST= 1
+USE_FULLTEXT_TEST= 1
+USE_HA_TEST= 1
+USE_GENERAL_LOG= 1
+USE_REPLICATION= 1
+MASTER_1_MYPORT= @mysqld.1.1.port
+MASTER_1_HSRPORT= 20000
+MASTER_1_HSWPORT= 20001
+MASTER_1_MYSOCK= @mysqld.1.1.socket
+MASTER_1_ENGINE_TYPE= Spider
+#MASTER_1_ENGINE_TYPE= MyISAM
+MASTER_1_ENGINE= ENGINE=Spider
+MASTER_1_CHARSET= DEFAULT CHARSET=utf8
+MASTER_1_ENGINE2= ENGINE=MyISAM
+MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
+MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+
+STR_SEMICOLON= ;
+
+#The followings are set in include/init_xxx.inc files
+# MASTER_1_COMMENT_2_1
+# MASTER_1_COMMENT2_2_1
+# MASTER_1_COMMENT3_2_1
+# MASTER_1_COMMENT4_2_1
+# MASTER_1_COMMENT5_2_1
+# MASTER_1_COMMENT_P_2_1
diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf
new file mode 100644
index 00000000..24161645
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf
@@ -0,0 +1,56 @@
+[mysqld.2.1]
+loose_handlersocket_port= 20002
+loose_handlersocket_port_wr= 20003
+loose_handlersocket_threads= 2
+loose_handlersocket_threads_wr= 1
+loose_handlersocket_support_merge_table= 0
+loose_handlersocket_direct_update_mode= 2
+loose_handlersocket_unlimited_boundary= 65536
+loose_handlersocket_bulk_insert= 0
+loose_handlersocket_bulk_insert_timeout= 0
+loose_handlersocket_general_log= 1
+loose_handlersocket_timeout= 30
+loose_handlersocket_close_table_interval=2
+open_files_limit= 4096
+
+[ENV]
+USE_CHILD_GROUP2= 1
+OUTPUT_CHILD_GROUP2= 0
+CHILD2_1_MYPORT= @mysqld.2.1.port
+CHILD2_1_HSRPORT= 20002
+CHILD2_1_HSWPORT= 20003
+CHILD2_1_MYSOCK= @mysqld.2.1.socket
+CHILD2_1_ENGINE_TYPE= InnoDB
+CHILD2_1_ENGINE= ENGINE=InnoDB
+CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
+CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+CHILD2_1_FT_MYPORT= @mysqld.2.1.port
+CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket
+CHILD2_1_FT_ENGINE_TYPE= MyISAM
+CHILD2_1_FT_ENGINE= ENGINE=MyISAM
+CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
+CHILD2_1_GM_MYPORT= @mysqld.2.1.port
+CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket
+CHILD2_1_GM_ENGINE_TYPE= MyISAM
+CHILD2_1_GM_ENGINE= ENGINE=MyISAM
+CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
+
+#The followings are set in include/init_xxx.inc files
+# CHILD2_1_DROP_TABLES
+# CHILD2_1_CREATE_TABLES
+# CHILD2_1_SELECT_TABLES
+# CHILD2_1_DROP_TABLES2
+# CHILD2_1_CREATE_TABLES2
+# CHILD2_1_SELECT_TABLES2
+# CHILD2_1_DROP_TABLES3
+# CHILD2_1_CREATE_TABLES3
+# CHILD2_1_SELECT_TABLES3
+# CHILD2_1_DROP_TABLES4
+# CHILD2_1_CREATE_TABLES4
+# CHILD2_1_SELECT_TABLES4
+# CHILD2_1_DROP_TABLES5
+# CHILD2_1_CREATE_TABLES5
+# CHILD2_1_SELECT_TABLES5
+# CHILD2_1_DROP_TABLES6
+# CHILD2_1_CREATE_TABLES6
+# CHILD2_1_SELECT_TABLES6
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result
new file mode 100644
index 00000000..a5553304
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_key.result
@@ -0,0 +1,94 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-18995
+
+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 (
+akey int NOT NULL,
+val int NOT NULL,
+KEY idx1 (akey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+bkey int NOT NULL,
+akey int NOT NULL,
+PRIMARY KEY (bkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2
+INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5;
+val akey
+4 4
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' ;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%';
+argument
+select t0.`val` `val`,t0.`akey` `akey` from `auto_test_remote`.`tbl_a` t0 where (t0.`akey` = '4')
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' ;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%'
+argument
+select `bkey`,`akey` from `auto_test_remote`.`tbl_b` where `bkey` = 5
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' ;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%'
+SELECT akey, val FROM tbl_a ORDER BY akey ;
+SELECT bkey, akey FROM tbl_b ORDER BY bkey;
+akey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+bkey akey
+0 0
+1 1
+2 2
+3 3
+4 4
+5 4
+6 3
+7 2
+8 1
+9 0
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result
new file mode 100644
index 00000000..4ea23c88
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/direct_join_by_pkey_pkey.result
@@ -0,0 +1,94 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-18995
+
+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 (
+akey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (akey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+bkey int NOT NULL,
+akey int NOT NULL,
+PRIMARY KEY (bkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2
+INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0);
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5;
+val akey
+4 4
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' ;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%';
+argument
+select `akey`,`val` from `auto_test_remote`.`tbl_a` where `akey` = 4
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' ;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%'
+argument
+select `bkey`,`akey` from `auto_test_remote`.`tbl_b` where `bkey` = 5
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' ;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%'
+SELECT akey, val FROM tbl_a ORDER BY akey ;
+SELECT bkey, akey FROM tbl_b ORDER BY bkey;
+akey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+bkey akey
+0 0
+1 1
+2 2
+3 3
+4 4
+5 4
+6 3
+7 2
+8 1
+9 0
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result
new file mode 100644
index 00000000..9d30f61a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result
@@ -0,0 +1,75 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result
new file mode 100644
index 00000000..594016e1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result
@@ -0,0 +1,75 @@
+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-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result
new file mode 100644
index 00000000..e1ba5470
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result
@@ -0,0 +1,95 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+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/regression/e1121/r/load_data_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result
new file mode 100644
index 00000000..af2bcc3d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result
@@ -0,0 +1,75 @@
+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-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+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/regression/e1121/r/load_data_local_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result
new file mode 100644
index 00000000..057d8386
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.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= 0;
+
+this test is for MDEV-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_local_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result
new file mode 100644
index 00000000..ba643fa6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result
@@ -0,0 +1,75 @@
+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-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_local_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result
new file mode 100644
index 00000000..50248d5a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result
@@ -0,0 +1,95 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+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/regression/e1121/r/load_data_local_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result
new file mode 100644
index 00000000..bb4c6da7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result
@@ -0,0 +1,75 @@
+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-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+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/regression/e1121/r/load_data_local_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result
new file mode 100644
index 00000000..324cdac2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result
@@ -0,0 +1,104 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_local_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result
new file mode 100644
index 00000000..e73b078d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result
@@ -0,0 +1,75 @@
+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-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result
new file mode 100644
index 00000000..dd91e95d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result
@@ -0,0 +1,104 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/r/load_data_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result
new file mode 100644
index 00000000..974287ab
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result
@@ -0,0 +1,75 @@
+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-18987
+
+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,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 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 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/regression/e1121/suite.opt b/storage/spider/mysql-test/spider/regression/e1121/suite.opt
new file mode 100644
index 00000000..672a3b37
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/suite.opt
@@ -0,0 +1 @@
+--loose-innodb --loose-skip-performance-schema
diff --git a/storage/spider/mysql-test/spider/regression/e1121/suite.pm b/storage/spider/mysql-test/spider/regression/e1121/suite.pm
new file mode 100644
index 00000000..171fa6c4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/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/regression/e1121/t/direct_join_by_pkey_key.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test
new file mode 100644
index 00000000..ec4639ed
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test
@@ -0,0 +1,88 @@
+--source ../include/direct_join_by_pkey_key_init.inc
+--echo
+--echo this test is for MDEV-18995
+--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 (
+ akey int NOT NULL,
+ val int NOT NULL,
+ KEY idx1 (akey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ akey int NOT NULL,
+ val int NOT NULL,
+ KEY idx1 (akey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ bkey int NOT NULL,
+ akey int NOT NULL,
+ PRIMARY KEY (bkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2;
+eval CREATE TABLE tbl_b (
+ bkey int NOT NULL,
+ akey int NOT NULL,
+ PRIMARY KEY (bkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2;
+--enable_query_log
+INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5;
+--enable_ps2_protocol
+
+--connection child2_1
+--disable_ps_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+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/direct_join_by_pkey_key_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test
new file mode 100644
index 00000000..52d9b52d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test
@@ -0,0 +1,88 @@
+--source ../include/direct_join_by_pkey_pkey_init.inc
+--echo
+--echo this test is for MDEV-18995
+--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 (
+ akey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (akey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ akey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (akey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ bkey int NOT NULL,
+ akey int NOT NULL,
+ PRIMARY KEY (bkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2;
+eval CREATE TABLE tbl_b (
+ bkey int NOT NULL,
+ akey int NOT NULL,
+ PRIMARY KEY (bkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2;
+--enable_query_log
+INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0);
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5;
+--enable_ps2_protocol
+
+--connection child2_1
+--disable_ps_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+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/direct_join_by_pkey_pkey_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc
new file mode 100644
index 00000000..080ba735
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc
@@ -0,0 +1,82 @@
+--echo
+--echo this test is for MDEV-18987
+--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,
+ val 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,
+ val 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,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+--disable_query_log
+--echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+--disable_ps2_protocol
+eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+--enable_ps2_protocol
+--enable_query_log
+eval $COMMAND_BEFORE_LOAD_DATA;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+--echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+--disable_ps2_protocol
+eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+--enable_ps2_protocol
+--enable_query_log
+--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv
+
+--connection child2_1
+--disable_ps2_protocol
+eval $CHILD2_1_SELECT_ARGUMENT1;
+--enable_ps2_protocol
+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/regression/e1121/t/load_data_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test
new file mode 100644
index 00000000..d43a944d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test
new file mode 100644
index 00000000..a73d1ef0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test
new file mode 100644
index 00000000..6fee83e7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test
new file mode 100644
index 00000000..1c882791
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test
new file mode 100644
index 00000000..dadd0224
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test
new file mode 100644
index 00000000..95b06505
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test
new file mode 100644
index 00000000..2243f892
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test
new file mode 100644
index 00000000..2ab7307e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test
new file mode 100644
index 00000000..1821a9ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test
new file mode 100644
index 00000000..3d53feca
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test
new file mode 100644
index 00000000..4bc402a4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test
new file mode 100644
index 00000000..9dafd24a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_deinit.inc
new file mode 100644
index 00000000..2248eef3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_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/regression/e112122/include/group_by_order_by_limit_ok_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_init.inc
new file mode 100644
index 00000000..48961d0d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/group_by_order_by_limit_ok_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_ok_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(skey) (
+ 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,
+ KEY idx1 (pkey),
+ KEY idx2 (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 command_type != 'Execute' AND 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,
+ KEY idx1 (pkey),
+ KEY idx2 (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 command_type != 'Execute' AND argument LIKE '%select %';
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc
new file mode 100644
index 00000000..c4191734
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_part_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc
new file mode 100644
index 00000000..8e69f52c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc
@@ -0,0 +1,4 @@
+--source load_data_part_init.inc
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc
new file mode 100644
index 00000000..c4191734
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_part_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc
new file mode 100644
index 00000000..b9194ccd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc
@@ -0,0 +1,4 @@
+--source load_data_part_init.inc
+--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/regression/e112122/include/load_data_part_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc
new file mode 100644
index 00000000..2248eef3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_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/regression/e112122/include/load_data_part_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc
new file mode 100644
index 00000000..23126f77
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc
@@ -0,0 +1,52 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source load_data_part_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 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, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+--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 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, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
diff --git a/storage/spider/mysql-test/spider/regression/e112122/my.cnf b/storage/spider/mysql-test/spider/regression/e112122/my.cnf
new file mode 100644
index 00000000..6610e4cf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/my.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/regression/e112122/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf
new file mode 100644
index 00000000..5f17295d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf
@@ -0,0 +1,44 @@
+[mysqld.1.1]
+log-bin= master-bin
+loose_handlersocket_port= 20000
+loose_handlersocket_port_wr= 20001
+loose_handlersocket_threads= 2
+loose_handlersocket_threads_wr= 1
+loose_handlersocket_support_merge_table= 0
+loose_handlersocket_direct_update_mode= 2
+loose_handlersocket_unlimited_boundary= 65536
+loose_handlersocket_bulk_insert= 0
+loose_handlersocket_bulk_insert_timeout= 0
+loose_handlersocket_general_log= 1
+loose_handlersocket_timeout= 30
+loose_handlersocket_close_table_interval=2
+open_files_limit= 4096
+loose_partition= 1
+
+[ENV]
+USE_GEOMETRY_TEST= 1
+USE_FULLTEXT_TEST= 1
+USE_HA_TEST= 1
+USE_GENERAL_LOG= 1
+USE_REPLICATION= 1
+MASTER_1_MYPORT= @mysqld.1.1.port
+MASTER_1_HSRPORT= 20000
+MASTER_1_HSWPORT= 20001
+MASTER_1_MYSOCK= @mysqld.1.1.socket
+MASTER_1_ENGINE_TYPE= Spider
+#MASTER_1_ENGINE_TYPE= MyISAM
+MASTER_1_ENGINE= ENGINE=Spider
+MASTER_1_CHARSET= DEFAULT CHARSET=utf8
+MASTER_1_ENGINE2= ENGINE=MyISAM
+MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
+MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+
+STR_SEMICOLON= ;
+
+#The followings are set in include/init_xxx.inc files
+# MASTER_1_COMMENT_2_1
+# MASTER_1_COMMENT2_2_1
+# MASTER_1_COMMENT3_2_1
+# MASTER_1_COMMENT4_2_1
+# MASTER_1_COMMENT5_2_1
+# MASTER_1_COMMENT_P_2_1
diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf
new file mode 100644
index 00000000..24161645
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf
@@ -0,0 +1,56 @@
+[mysqld.2.1]
+loose_handlersocket_port= 20002
+loose_handlersocket_port_wr= 20003
+loose_handlersocket_threads= 2
+loose_handlersocket_threads_wr= 1
+loose_handlersocket_support_merge_table= 0
+loose_handlersocket_direct_update_mode= 2
+loose_handlersocket_unlimited_boundary= 65536
+loose_handlersocket_bulk_insert= 0
+loose_handlersocket_bulk_insert_timeout= 0
+loose_handlersocket_general_log= 1
+loose_handlersocket_timeout= 30
+loose_handlersocket_close_table_interval=2
+open_files_limit= 4096
+
+[ENV]
+USE_CHILD_GROUP2= 1
+OUTPUT_CHILD_GROUP2= 0
+CHILD2_1_MYPORT= @mysqld.2.1.port
+CHILD2_1_HSRPORT= 20002
+CHILD2_1_HSWPORT= 20003
+CHILD2_1_MYSOCK= @mysqld.2.1.socket
+CHILD2_1_ENGINE_TYPE= InnoDB
+CHILD2_1_ENGINE= ENGINE=InnoDB
+CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
+CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
+CHILD2_1_FT_MYPORT= @mysqld.2.1.port
+CHILD2_1_FT_MYSOCK= @mysqld.2.1.socket
+CHILD2_1_FT_ENGINE_TYPE= MyISAM
+CHILD2_1_FT_ENGINE= ENGINE=MyISAM
+CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
+CHILD2_1_GM_MYPORT= @mysqld.2.1.port
+CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket
+CHILD2_1_GM_ENGINE_TYPE= MyISAM
+CHILD2_1_GM_ENGINE= ENGINE=MyISAM
+CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
+
+#The followings are set in include/init_xxx.inc files
+# CHILD2_1_DROP_TABLES
+# CHILD2_1_CREATE_TABLES
+# CHILD2_1_SELECT_TABLES
+# CHILD2_1_DROP_TABLES2
+# CHILD2_1_CREATE_TABLES2
+# CHILD2_1_SELECT_TABLES2
+# CHILD2_1_DROP_TABLES3
+# CHILD2_1_CREATE_TABLES3
+# CHILD2_1_SELECT_TABLES3
+# CHILD2_1_DROP_TABLES4
+# CHILD2_1_CREATE_TABLES4
+# CHILD2_1_SELECT_TABLES4
+# CHILD2_1_DROP_TABLES5
+# CHILD2_1_CREATE_TABLES5
+# CHILD2_1_SELECT_TABLES5
+# CHILD2_1_DROP_TABLES6
+# CHILD2_1_CREATE_TABLES6
+# CHILD2_1_SELECT_TABLES6
diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf
new file mode 100644
index 00000000..2d3c2a89
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/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/regression/e112122/r/group_by_order_by_limit_ok.result b/storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result
new file mode 100644
index 00000000..695ddadc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/group_by_order_by_limit_ok.result
@@ -0,0 +1,126 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+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,
+KEY idx1 (pkey),
+KEY idx2 (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;
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 0
+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
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+Variable_name Value
+Spider_direct_aggregate 20
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select count(0),`skey` from `auto_test_remote`.`tbl_a` group by `skey` order by count(0) desc,`skey` desc limit 5
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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
+20 5
+22 7
+24 9
+26 11
+28 13
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+argument
+select count(0),`skey` from `auto_test_remote2`.`tbl_a` group by `skey` order by count(0) desc,`skey` desc limit 5
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND 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
+21 6
+23 8
+25 10
+27 12
+29 14
+
+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/regression/e112122/r/load_data_part_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result
new file mode 100644
index 00000000..c32e8793
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result
@@ -0,0 +1,95 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result
new file mode 100644
index 00000000..dab51a3e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result
@@ -0,0 +1,95 @@
+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-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result
new file mode 100644
index 00000000..7d99878b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result
@@ -0,0 +1,114 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+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 child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+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/regression/e112122/r/load_data_part_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result
new file mode 100644
index 00000000..0ae71b49
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result
@@ -0,0 +1,95 @@
+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-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+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 child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+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/regression/e112122/r/load_data_part_local_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result
new file mode 100644
index 00000000..d2362e46
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result
@@ -0,0 +1,103 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_local_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result
new file mode 100644
index 00000000..c57dc96b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result
@@ -0,0 +1,95 @@
+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-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_local_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result
new file mode 100644
index 00000000..81005ac8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result
@@ -0,0 +1,114 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+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 child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+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/regression/e112122/r/load_data_part_local_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result
new file mode 100644
index 00000000..d7cea9ed
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result
@@ -0,0 +1,95 @@
+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-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+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 child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+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/regression/e112122/r/load_data_part_local_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result
new file mode 100644
index 00000000..d6cd973f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result
@@ -0,0 +1,123 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_local_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result
new file mode 100644
index 00000000..ac233777
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result
@@ -0,0 +1,95 @@
+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-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result
new file mode 100644
index 00000000..cd4bf6d7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result
@@ -0,0 +1,123 @@
+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= 0;
+
+this test is for MDEV-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/r/load_data_part_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result
new file mode 100644
index 00000000..98c63603
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result
@@ -0,0 +1,95 @@
+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-18987
+
+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 int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+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_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/regression/e112122/suite.opt b/storage/spider/mysql-test/spider/regression/e112122/suite.opt
new file mode 100644
index 00000000..672a3b37
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/suite.opt
@@ -0,0 +1 @@
+--loose-innodb --loose-skip-performance-schema
diff --git a/storage/spider/mysql-test/spider/regression/e112122/suite.pm b/storage/spider/mysql-test/spider/regression/e112122/suite.pm
new file mode 100644
index 00000000..171fa6c4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/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/regression/e112122/t/group_by_order_by_limit_ok.test b/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test
new file mode 100644
index 00000000..e4f3f215
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test
@@ -0,0 +1,104 @@
+--source ../include/group_by_order_by_limit_ok_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,
+ KEY idx1 (pkey),
+ KEY idx2 (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,
+ KEY idx1 (pkey),
+ KEY idx2 (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;
+
+--disable_ps2_protocol
+--connection master_1
+set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+set spider_direct_aggregate=1;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
+SHOW STATUS LIKE 'Spider_direct_aggregate';
+set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+--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;
+--enable_ps2_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;
+
+--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_ok_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc
new file mode 100644
index 00000000..fd31047a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc
@@ -0,0 +1,106 @@
+--echo
+--echo this test is for MDEV-18987
+--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 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,
+ val 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,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+--disable_query_log
+--echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+--disable_ps_protocol
+eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+--enable_ps2_protocol
+--enable_query_log
+eval $COMMAND_BEFORE_LOAD_DATA;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+--echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+--disable_ps2_protocol
+eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+--enable_ps2_protocol
+--enable_query_log
+--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv
+
+--disable_ps2_protocol
+--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;
+--enable_ps2_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;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test
new file mode 100644
index 00000000..b7852909
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test
new file mode 100644
index 00000000..a2540077
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test
new file mode 100644
index 00000000..a6fb58d6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test
new file mode 100644
index 00000000..b9f75894
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test
new file mode 100644
index 00000000..f44f7ae9
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test
new file mode 100644
index 00000000..4c806096
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test
new file mode 100644
index 00000000..179bab5b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test
new file mode 100644
index 00000000..cd7d8215
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test
new file mode 100644
index 00000000..5df3f420
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test
new file mode 100644
index 00000000..bf3c7c93
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test
new file mode 100644
index 00000000..910b7e81
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test
new file mode 100644
index 00000000..fc84bf14
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/suite.opt b/storage/spider/mysql-test/spider/suite.opt
new file mode 100644
index 00000000..672a3b37
--- /dev/null
+++ b/storage/spider/mysql-test/spider/suite.opt
@@ -0,0 +1 @@
+--loose-innodb --loose-skip-performance-schema
diff --git a/storage/spider/mysql-test/spider/suite.pm b/storage/spider/mysql-test/spider/suite.pm
new file mode 100644
index 00000000..171fa6c4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/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/t/auto_increment.test b/storage/spider/mysql-test/spider/t/auto_increment.test
new file mode 100644
index 00000000..c5f272f5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/auto_increment.test
@@ -0,0 +1,187 @@
+--source auto_increment_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ col_a INT NOT NULL AUTO_INCREMENT,
+ col_b VARCHAR(20) DEFAULT 'defg',
+ col_c INT NOT NULL DEFAULT 100,
+ PRIMARY KEY(col_a)
+) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ col_a INT NOT NULL AUTO_INCREMENT,
+ col_b VARCHAR(20) DEFAULT 'defg',
+ col_c INT NOT NULL DEFAULT 100,
+ PRIMARY KEY(col_a)
+) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1;
+--enable_query_log
+SHOW CREATE TABLE tbl_a;
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+ALTER TABLE tbl_a MODIFY col_c MEDIUMINT NOT NULL DEFAULT 100;
+SHOW CREATE TABLE tbl_a;
+RENAME TABLE tbl_a TO tbl_x;
+SHOW CREATE TABLE tbl_x;
+RENAME TABLE tbl_x TO tbl_a;
+SHOW CREATE TABLE tbl_a;
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT1;
+eval $MASTER_1_AUTO_INCREMENT1;
+--enable_query_log
+SHOW CREATE TABLE tbl_a;
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT2;
+--enable_query_log
+SHOW CREATE TABLE tbl_a;
+INSERT INTO tbl_a () VALUES ();
+INSERT INTO tbl_a () VALUES ();
+SHOW CREATE TABLE tbl_a;
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT * FROM tbl_a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source auto_increment_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc
new file mode 100644
index 00000000..52be67a1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc
@@ -0,0 +1,13 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/t/auto_increment_init.inc b/storage/spider/mysql-test/spider/t/auto_increment_init.inc
new file mode 100644
index 00000000..52245bdd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/auto_increment_init.inc
@@ -0,0 +1,38 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"';
+let $MASTER_1_AUTO_INCREMENT_2_1=
+ AUTO_INCREMENT=20;
+let $MASTER_1_AUTO_INCREMENT1=
+ ALTER TABLE tbl_a AUTO_INCREMENT=30;
+let $MASTER_1_AUTO_INCREMENT2=
+ ALTER TABLE tbl_a AUTO_INCREMENT=10;
+let $CHILD2_1_CHARSET_AUTO_INCREMENT=
+ AUTO_INCREMENT=20;
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ col_a INT NOT NULL AUTO_INCREMENT,
+ col_b VARCHAR(20) DEFAULT 'def',
+ col_c INT NOT NULL DEFAULT 10,
+ PRIMARY KEY(col_a)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET_AUTO_INCREMENT $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/t/basic_sql.test b/storage/spider/mysql-test/spider/t/basic_sql.test
new file mode 100644
index 00000000..b5a9b2f4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/basic_sql.test
@@ -0,0 +1,2714 @@
+# This test tests by executing basic SQL
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+SELECT a, b, c FROM tb_l;
+if ($MASTER_1_MERGE)
+{
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_MERGE)
+{
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ SELECT a, b, c FROM tb_l;
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo create table ignore select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'f', '2008-07-01 10:21:39'),
+ (2, 'g', '2000-02-01 00:00:00'),
+ (3, 'j', '2007-05-04 20:03:11'),
+ (4, 'i', '2003-10-30 05:01:03'),
+ (5, 'h', '2001-10-31 23:59:59');
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+IGNORE SELECT a, b, c FROM tb_l;
+if ($MASTER_1_MERGE)
+{
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ IGNORE SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_MERGE)
+{
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ IGNORE SELECT a, b, c FROM tb_l;
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo create table ignore select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+REPLACE SELECT a, b, c FROM tb_l;
+if ($MASTER_1_MERGE)
+{
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ REPLACE SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ REPLACE INTO ta_l SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_MERGE)
+{
+ eval CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
+ REPLACE SELECT a, b, c FROM tb_l;
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo create no index table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l_no_idx;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l_no_idx
+MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+SELECT a, b, c FROM tb_l;
+if ($MASTER_1_NEEDPK)
+{
+ --error ER_REQUIRES_PRIMARY_KEY
+ eval CREATE TABLE ta_l_no_idx
+ $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l_no_idx (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+ INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
+}
+if (!$MASTER_1_NEEDPK)
+{
+ if ($MASTER_1_MERGE)
+ {
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l_no_idx
+ $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l_no_idx (
+ a INT,
+ b CHAR(1),
+ c DATETIME
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+ INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
+ }
+ if (!$MASTER_1_MERGE)
+ {
+ eval CREATE TABLE ta_l_no_idx
+ $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
+ SELECT a, b, c FROM tb_l;
+ }
+}
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES3;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
+
+--echo
+--echo select table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table shared mode
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+LOCK IN SHARE MODE;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table for update
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
+FOR UPDATE;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table join
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
+WHERE a.a = b.a ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table straight_join
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
+FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_small_result
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_big_result
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_buffer_result
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_cache
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_no_cache
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select sql_calc_found_rows
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a LIMIT 4;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT found_rows();
+--enable_ps2_protocol
+
+--echo
+--echo select high_priority
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select distinct
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select count
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT count(*) FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table join not use index
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
+EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select using pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.b = 'g' ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select using index and pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
+a.a > 0 AND a.b = 'g' ORDER BY a.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo insert
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert select
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert select a
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert low_priority
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert high_priority
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
+'2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert ignore
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert update (insert)
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo insert update (update)
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
+KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace
+--connection master_1
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace select
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace select a
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
+'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo replace low_priority
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
+'2009-03-03 03:03:03');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update select
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
+tb_l);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update select a
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
+tb_l ORDER BY a LIMIT 1);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update join
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update join a
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
+a.a = b.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update low_priority
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update ignore
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo update index pushdown
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete all
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete select
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete select a
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete join
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete low_priority
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete ignore
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE IGNORE FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete quick
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE QUICK FROM ta_l WHERE a = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE b = 'e';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo delete index pushdown
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
+(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
+(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
+(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
+(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
+(10, 'j', '2008-01-01 23:59:59');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM ta_l WHERE a > 0 AND b = 'e';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo truncate
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+TRUNCATE TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--connection master_1
+create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER
+ COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"';
+drop table t2345678911234567892123456789312345678941234567895123234234;
+
+--echo #
+--echo # MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes
+--echo #
+create table mdev_26139 (id int) ENGINE=SPIDER
+ COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'";
+drop table mdev_26139;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/basic_sql_part.test b/storage/spider/mysql-test/spider/t/basic_sql_part.test
new file mode 100644
index 00000000..1bb18358
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/basic_sql_part.test
@@ -0,0 +1,571 @@
+# This test tests by executing basic SQL
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'f', '2008-07-01 10:21:39'),
+ (2, 'g', '2000-02-01 00:00:00'),
+ (3, 'j', '2007-05-04 20:03:11'),
+ (4, 'i', '2003-10-30 05:01:03'),
+ (5, 'h', '2001-10-31 23:59:59');
+
+--echo
+--echo create table with partition and select test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
+ SELECT a, b, c FROM tb_l;
+ if ($MASTER_1_MERGE)
+ {
+ --error ER_WRONG_OBJECT
+ eval CREATE TABLE ta_l2 (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
+ SELECT a, b, c FROM tb_l;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ }
+ if (!$MASTER_1_MERGE)
+ {
+ eval CREATE TABLE ta_l2 (
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
+ SELECT a, b, c FROM tb_l;
+ }
+ --enable_query_log
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo select partition using pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+ a.b = 'g' ORDER BY a.a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo select partition using index pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
+ a.a > 0 AND a.b = 'g' ORDER BY a.a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo update partition pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo update partition index pushdown
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo delete partition pushdown
+if ($HAVE_PARTITION)
+{
+ TRUNCATE TABLE ta_l2;
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ DELETE FROM ta_l2 WHERE b = 'g';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo delete partition index pushdown
+if ($HAVE_PARTITION)
+{
+ TRUNCATE TABLE ta_l2;
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test
new file mode 100644
index 00000000..e0fa7a84
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test
@@ -0,0 +1,128 @@
+--source ../include/checksum_table_with_quick_mode_3_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+FLUSH TABLES;
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+CHECKSUM TABLE tbl_a EXTENDED;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --disable_ps2_protocol
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ --enable_ps2_protocol
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/checksum_table_with_quick_mode_3_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/t/connect_child2_1.inc
new file mode 100644
index 00000000..15e26031
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_child2_1.inc
@@ -0,0 +1,2 @@
+--connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK)
+--connect (child2_1_2, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/t/connect_child2_2.inc
new file mode 100644
index 00000000..75a50821
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_child2_2.inc
@@ -0,0 +1,2 @@
+--connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK)
+--connect (child2_2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/t/connect_child2_3.inc
new file mode 100644
index 00000000..d356348d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_child2_3.inc
@@ -0,0 +1 @@
+--connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/t/connect_child3_1.inc
new file mode 100644
index 00000000..03e5c188
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_child3_1.inc
@@ -0,0 +1 @@
+--connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/t/connect_child3_2.inc
new file mode 100644
index 00000000..d62a7ada
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_child3_2.inc
@@ -0,0 +1 @@
+--connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/t/connect_child3_3.inc
new file mode 100644
index 00000000..fb49f5bf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_child3_3.inc
@@ -0,0 +1 @@
+--connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_master_1.inc b/storage/spider/mysql-test/spider/t/connect_master_1.inc
new file mode 100644
index 00000000..0c129ce5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_master_1.inc
@@ -0,0 +1 @@
+--connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/t/connect_slave1_1.inc
new file mode 100644
index 00000000..45a82274
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/connect_slave1_1.inc
@@ -0,0 +1 @@
+--connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate.test b/storage/spider/mysql-test/spider/t/direct_aggregate.test
new file mode 100644
index 00000000..0acff3f6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_aggregate.test
@@ -0,0 +1,191 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_aggregating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT COUNT(*) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+--enable_ps2_protocol
+
+SET spider_direct_aggregate=0;
+SELECT COUNT(*) FROM ta_l;
+SELECT MAX(a) FROM ta_l;
+SELECT MIN(a) FROM ta_l;
+SELECT MAX(a) FROM ta_l WHERE a < 5;
+SELECT MIN(a) FROM ta_l WHERE a > 1;
+eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+SET spider_direct_aggregate=1;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test
new file mode 100644
index 00000000..8f4c72dc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test
@@ -0,0 +1,211 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ --disable_ps2_protocol
+ set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
+ set spider_direct_aggregate=1;
+
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT COUNT(*) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT SUM(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+ --enable_ps2_protocol
+
+ SET spider_direct_aggregate=0;
+ SELECT COUNT(*) FROM ta_l2;
+ SELECT SUM(a) FROM ta_l2;
+ SELECT MAX(a) FROM ta_l2;
+ SELECT MIN(a) FROM ta_l2;
+ SELECT MAX(a) FROM ta_l2 WHERE a < 5;
+ SELECT MIN(a) FROM ta_l2 WHERE a > 1;
+ eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
+
+ set spider_direct_aggregate=@old_spider_direct_aggregate;
+
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_join.test b/storage/spider/mysql-test/spider/t/direct_join.test
new file mode 100644
index 00000000..634b958f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_join.test
@@ -0,0 +1,347 @@
+--source ../include/direct_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c FROM tbl_a a, tbl_b b, tbl_c c WHERE a.a = b.a and a.a = c.a ORDER BY a.b DESC LIMIT 1,2;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo Test JOIN on a constant table.
+--echo Spider should NOT push down the join because the tbl_person table
+--echo is optimized as a constant table.
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_CONST_TABLE_JOIN;
+ echo CHILD2_1_DROP_CONST_TABLE2_JOIN;
+ echo CHILD2_1_CREATE_CONST_TABLE_JOIN;
+ echo CHILD2_1_CREATE_CONST_TABLE2_JOIN;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_CONST_TABLE_JOIN;
+ eval $CHILD2_1_DROP_CONST_TABLE2_JOIN;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_CONST_TABLE_JOIN;
+ eval $CHILD2_1_CREATE_CONST_TABLE2_JOIN;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_person;
+DROP TABLE IF EXISTS tbl_ncd_cm_person;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_person (
+ id VARCHAR(50) NOT NULL,
+ hr_status VARCHAR(50) NULL DEFAULT NULL,
+ region_code VARCHAR(50) NULL DEFAULT NULL,
+ region INT(11) NOT NULL,
+ PRIMARY KEY (id, region) USING BTREE
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE_JOIN
+ MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE_JOIN;
+eval CREATE TABLE tbl_person (
+ id VARCHAR(50) NOT NULL,
+ hr_status VARCHAR(50) NULL DEFAULT NULL,
+ region_code VARCHAR(50) NULL DEFAULT NULL,
+ region INT(11) NOT NULL,
+ PRIMARY KEY (id, region) USING BTREE
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_CONST_TABLE_JOIN
+ $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN $MASTER_1_PART_CONST_TABLE_JOIN;
+echo SHOW CREATE TABLE tbl_person;
+SHOW CREATE TABLE tbl_person;
+echo CREATE TABLE tbl_ncd_cm_person (
+ id VARCHAR(50) NOT NULL,
+ person_id VARCHAR(50) NULL DEFAULT '',
+ diseaseKind_id VARCHAR(50) NULL DEFAULT NULL,
+ region INT(11) NOT NULL,
+ PRIMARY KEY (id, region) USING BTREE
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE2_JOIN
+ MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE2_JOIN;
+eval CREATE TABLE tbl_ncd_cm_person (
+ id VARCHAR(50) NOT NULL,
+ person_id VARCHAR(50) NULL DEFAULT '',
+ diseaseKind_id VARCHAR(50) NULL DEFAULT NULL,
+ region INT(11) NOT NULL,
+ PRIMARY KEY (id, region) USING BTREE
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_CONST_TABLE2_JOIN
+ $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN $MASTER_1_PART_CONST_TABLE2_JOIN;
+echo SHOW CREATE TABLE tbl_ncd_cm_person;
+SHOW CREATE TABLE tbl_ncd_cm_person;
+--enable_query_log
+INSERT INTO tbl_person VALUES ('24FC3F0A5119432BAE13DD65AABAA39C',
+ '1', '123-51041110620301-321', 510411);
+INSERT INTO tbl_person VALUES ('123456789012345678901234567890AB',
+ '1', '123-51041110620301-321', 510411);
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789',
+ '24FC3F0A5119432BAE13DD65AABAA39C',
+ '52A0328740914BCE86ED10A4D2521816',
+ 510411);
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB',
+ '123456789012345678901234567890AB',
+ '52A0328740914BCE86ED10A4D2521816',
+ 510411);
+DELETE FROM tbl_ncd_cm_person;
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789',
+ '24FC3F0A5119432BAE13DD65AABAA39C',
+ '52A0328740914BCE86ED10A4D2521816',
+ 510411);
+INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB',
+ '123456789012345678901234567890AB',
+ '52A0328740914BCE86ED10A4D2521816',
+ 510411);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT count(0) FROM tbl_person tp INNER JOIN tbl_ncd_cm_person tncp ON tp.id = tncp.person_id WHERE 1 = 1 AND tp.hr_status != "99" AND tp.hr_status != "2" AND tp.region_code LIKE CONCAT(CONCAT('%', '51041110620301', '%')) AND tp.id = '24FC3F0A5119432BAE13DD65AABAA39C' AND tncp.diseaseKind_id = '52A0328740914BCE86ED10A4D2521816' AND tp.region = 510411;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_CONST_TABLE_JOIN;
+ eval $CHILD2_1_SELECT_CONST_TABLE2_JOIN;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_join_using.test b/storage/spider/mysql-test/spider/t/direct_join_using.test
new file mode 100644
index 00000000..3ecfb292
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_join_using.test
@@ -0,0 +1,199 @@
+--source ../include/direct_join_using_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_join_using_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_join.test b/storage/spider/mysql-test/spider/t/direct_left_join.test
new file mode 100644
index 00000000..c9784b04
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_join.test
@@ -0,0 +1,199 @@
+--source ../include/direct_left_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test
new file mode 100644
index 00000000..7c69d73d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test
@@ -0,0 +1,214 @@
+--source ../include/direct_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test
new file mode 100644
index 00000000..dd407482
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test
@@ -0,0 +1,214 @@
+--source ../include/direct_left_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test
new file mode 100644
index 00000000..3de0c310
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test
@@ -0,0 +1,214 @@
+--source ../include/direct_left_right_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_right_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_join.test b/storage/spider/mysql-test/spider/t/direct_right_join.test
new file mode 100644
index 00000000..d124f75a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_join.test
@@ -0,0 +1,199 @@
+--source ../include/direct_right_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test
new file mode 100644
index 00000000..cdb2d4e6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test
@@ -0,0 +1,214 @@
+--source ../include/direct_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test
new file mode 100644
index 00000000..cff40bfd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test
@@ -0,0 +1,214 @@
+--source ../include/direct_right_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test
new file mode 100644
index 00000000..cd677a4b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test
@@ -0,0 +1,214 @@
+--source ../include/direct_right_left_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_left_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_update.test b/storage/spider/mysql-test/spider/t/direct_update.test
new file mode 100644
index 00000000..94f27e28
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_update.test
@@ -0,0 +1,198 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo direct_updating test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update all rows with function
+UPDATE ta_l SET c = ADDDATE(c, 1);
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update by primary key
+UPDATE ta_l SET b = 'x' WHERE a = 3;
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update by a column without index
+UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo update by primary key with order and limit
+UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo delete by primary key with order and limit
+DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
+eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo delete by a column without index
+DELETE FROM ta_l WHERE b = 'c';
+eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+--echo delete by primary key
+DELETE FROM ta_l WHERE a = 3;
+eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_update_part.test b/storage/spider/mysql-test/spider/t/direct_update_part.test
new file mode 100644
index 00000000..e8f18825
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_update_part.test
@@ -0,0 +1,211 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo with partition test
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+ --enable_query_log
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update all rows with function
+ UPDATE ta_l2 SET c = ADDDATE(c, 1);
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update by primary key
+ UPDATE ta_l2 SET b = 'x' WHERE a = 3;
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update by a column without index
+ UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo update by primary key with order and limit
+ UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
+ eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo delete by primary key with order and limit
+ DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
+ eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo delete by a column without index
+ DELETE FROM ta_l2 WHERE b = 'c';
+ eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ --echo delete by primary key
+ DELETE FROM ta_l2 WHERE a = 3;
+ eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/error_row_number.test b/storage/spider/mysql-test/spider/t/error_row_number.test
new file mode 100644
index 00000000..408e7396
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/error_row_number.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+create database auto_test_remote;
+use auto_test_remote;
+create table ta_r (id int primary key);
+
+--connection master_1
+evalp create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+
+--error ER_DUP_ENTRY
+insert into spd values (1),(2),(1);
+get diagnostics condition 1 @n = row_number;
+select @n;
+
+delete from spd;
+insert into spd values (1),(2),(3),(13);
+--error ER_DUP_ENTRY
+update spd set id = id + 10;
+get diagnostics condition 1 @n = row_number;
+select @n;
+
+drop table spd;
+--connection child2_1
+drop database auto_test_remote;
+--connection master_1
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
diff --git a/storage/spider/mysql-test/spider/t/function.test b/storage/spider/mysql-test/spider/t/function.test
new file mode 100644
index 00000000..2472e774
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/function.test
@@ -0,0 +1,253 @@
+# This test tests for using functions
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo in()
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TEXT_PK_TABLES1;
+ echo CHILD2_1_CREATE_TEXT_PK_TABLES1;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TEXT_PK_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TEXT_PK_TABLES1;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1;
+eval CREATE TABLE t1 (
+ a VARCHAR(255),
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1;
+--enable_query_log
+insert into t1 values ('1');
+insert into t1 select a + 1 from t1;
+insert into t1 select a + 2 from t1;
+insert into t1 select a + 4 from t1;
+insert into t1 select a + 8 from t1;
+insert into t1 select a + 16 from t1;
+insert into t1 select a + 32 from t1;
+insert into t1 select a + 64 from t1;
+insert into t1 select a + 128 from t1;
+insert into t1 select a + 256 from t1;
+insert into t1 select a + 512 from t1;
+flush tables;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+select a from t1 where a in ('15', '120');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo date_sub()
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/ha.test b/storage/spider/mysql-test/spider/t/ha.test
new file mode 100644
index 00000000..1924b908
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/ha.test
@@ -0,0 +1,882 @@
+# This test tests for ha features
+if ($USE_HA_TEST)
+{
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source ha_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ --connection child2_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ SELECT 1;
+ --connection child3_2
+ SELECT 1;
+ --connection child3_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo fail-over test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_HA_DROP_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_HA_DROP_TABLES;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_HA_STATUS;
+--error 12511
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+eval $MASTER_1_CHECK_LINK_STATUS;
+eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+eval $MASTER_1_CHECK_HA_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo recovery test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_HA_CREATE_TABLES;
+ }
+ eval $CHILD2_2_HA_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_RECOVERY_STATUS_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_RECOVERY_STATUS_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_RECOVERY_STATUS_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
+eval $MASTER_1_CHECK_LINK_STATUS;
+eval $MASTER_1_COPY_TABLES_2_1;
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_SET_OK_STATUS_2_1;
+eval $MASTER_1_CHECK_LINK_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+DROP TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+eval $MASTER_1_CHANGE_HA_MON;
+--enable_ps2_protocol
+
+--echo
+--echo active standby test
+--echo create table test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo fail-over test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_DROP_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_HA_AS_DROP_TABLES;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_CHECK_HA_STATUS;
+--error 12511
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+eval $MASTER_1_CHECK_LINK_STATUS;
+eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+eval $MASTER_1_CHECK_HA_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo recovery test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_CREATE_TABLES;
+ }
+ eval $CHILD2_1_HA_AS_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_AS_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_AS_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_AS_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+eval $MASTER_1_SET_OK_STATUS_AS_2_1;
+eval $MASTER_1_CHECK_LINK_STATUS;
+INSERT INTO ta_l (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30');
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+DROP TABLE ta_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+eval $MASTER_1_CHANGE_HA_MON;
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+--disable_query_log
+--disable_result_log
+--source ha_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+}
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/ha_part.test b/storage/spider/mysql-test/spider/t/ha_part.test
new file mode 100644
index 00000000..21b5837c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/ha_part.test
@@ -0,0 +1,1024 @@
+# This test tests for ha features
+if ($USE_HA_TEST)
+{
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source ha_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source ha_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ --connection child2_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_CHILD_GROUP3)
+{
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ SELECT 1;
+ --connection child3_2
+ SELECT 1;
+ --connection child3_3
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+if ($HAVE_PARTITION)
+{
+ --echo
+ --echo create table with partition test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_P_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_P_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_P_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+ --echo
+ --echo select test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo fail-over test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_HA_DROP_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_HA_DROP_TABLES;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_CHECK_HA_STATUS;
+ --error 12511
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+ eval $MASTER_1_CHECK_HA_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo recovery test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_HA_CREATE_TABLES;
+ }
+ eval $CHILD2_3_HA_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ eval $MASTER_1_COPY_TABLES_P_2_1;
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_P_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_P_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_P_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_SET_OK_STATUS_P_2_1;
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30'),
+ (9, 'h', '2011-05-05 22:32:10');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ DROP TABLE ta_l2;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+if ($HAVE_PARTITION)
+{
+ --echo
+ --echo create table with partition test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1;
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1;
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+ --echo
+ --echo select test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo fail-over test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_DROP_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_HA_AS_DROP_TABLES2;
+ --enable_warnings
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_CHECK_HA_STATUS;
+ --error 12511
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ eval $MASTER_1_CHECK_LINK_FAILED_LOG;
+ eval $MASTER_1_CHECK_HA_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (6, 'e', '2011-05-05 20:04:05');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
+ --connection child3_2
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
+ --connection child3_3
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+
+ --echo
+ --echo recovery test
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_HA_AS_CREATE_TABLES2;
+ }
+ eval $CHILD2_1_HA_AS_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1;
+ eval $CHILD3_1_CHECK_LINK_STATUS;
+ --connection child3_2
+ eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1;
+ eval $CHILD3_2_CHECK_LINK_STATUS;
+ --connection child3_3
+ eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1;
+ eval $CHILD3_3_CHECK_LINK_STATUS;
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ eval $MASTER_1_SET_OK_STATUS_AS_P_2_1;
+ eval $MASTER_1_CHECK_LINK_STATUS;
+ INSERT INTO ta_l2 (a, b, c) VALUES
+ (8, 'g', '2011-05-05 21:33:30'),
+ (9, 'h', '2011-05-05 22:32:10');
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
+ DROP TABLE ta_l2;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ eval $CHILD2_1_SELECT_TABLES2;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ if ($USE_CHILD_GROUP3)
+ {
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child3_1
+ --disable_warnings
+ eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_2
+ --disable_warnings
+ eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ --connection child3_3
+ --disable_warnings
+ eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
+ --enable_warnings
+ if (!$OUTPUT_CHILD_GROUP3)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--connection master_1
+
+CREATE TABLE t (c INT) PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER);
+SHOW FIELDS FROM t;
+SHOW FIELDS FROM t;
+DROP TABLE t;
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_2
+ DROP DATABASE IF EXISTS auto_test_local;
+ --connection child3_3
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+--disable_query_log
+--disable_result_log
+--source ha_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+}
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/t/ha_test_deinit.inc
new file mode 100644
index 00000000..53d0409d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/ha_test_deinit.inc
@@ -0,0 +1,30 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/ha_deinit_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/ha_deinit_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/ha_deinit_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/ha_deinit_child2_3.inc
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --connection child3_1
+ --source ../include/ha_deinit_child3_1.inc
+ --echo child3_2
+ --connection child3_2
+ --source ../include/ha_deinit_child3_2.inc
+ --echo child3_3
+ --connection child3_3
+ --source ../include/ha_deinit_child3_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/t/ha_test_init.inc b/storage/spider/mysql-test/spider/t/ha_test_init.inc
new file mode 100644
index 00000000..70576ab1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/ha_test_init.inc
@@ -0,0 +1,30 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/ha_init_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/ha_init_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/ha_init_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/ha_init_child2_3.inc
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --connection child3_1
+ --source ../include/ha_init_child3_1.inc
+ --echo child3_2
+ --connection child3_2
+ --source ../include/ha_init_child3_2.inc
+ --echo child3_3
+ --connection child3_3
+ --source ../include/ha_init_child3_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/t/have_engine.inc b/storage/spider/mysql-test/spider/t/have_engine.inc
new file mode 100644
index 00000000..64bef749
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/have_engine.inc
@@ -0,0 +1,7 @@
+if (!`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = '$TEST_ENGINE_TYPE'`)
+{
+ SELECT engine, support FROM information_schema.engines;
+ --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine"
+}
diff --git a/storage/spider/mysql-test/spider/t/have_func.inc b/storage/spider/mysql-test/spider/t/have_func.inc
new file mode 100644
index 00000000..e0823e73
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/have_func.inc
@@ -0,0 +1,5 @@
+if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`)
+{
+ SELECT name FROM mysql.func;
+ --let $SKIP_REASON= "Need $TEST_FUNC_NAME function"
+}
diff --git a/storage/spider/mysql-test/spider/t/have_partition.inc b/storage/spider/mysql-test/spider/t/have_partition.inc
new file mode 100644
index 00000000..b6e69947
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/have_partition.inc
@@ -0,0 +1,7 @@
+let $HAVE_PARTITION= 0;
+if (`SELECT count(*) FROM information_schema.plugins WHERE
+ plugin_status = 'ACTIVE' AND
+ plugin_name = 'partition'`)
+{
+ let $HAVE_PARTITION= 1;
+}
diff --git a/storage/spider/mysql-test/spider/t/have_plugin.inc b/storage/spider/mysql-test/spider/t/have_plugin.inc
new file mode 100644
index 00000000..316ede9e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/have_plugin.inc
@@ -0,0 +1,5 @@
+if (!`SELECT count(*) FROM information_schema.plugins WHERE plugin_name = '$TEST_PLUGIN_NAME'`)
+{
+ SELECT plugin_name FROM information_schema.plugins;
+ --let $SKIP_REASON= "Need $TEST_PLUGIN_NAME plugin"
+}
diff --git a/storage/spider/mysql-test/spider/t/have_trigger.inc b/storage/spider/mysql-test/spider/t/have_trigger.inc
new file mode 100644
index 00000000..32de484b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/have_trigger.inc
@@ -0,0 +1,2 @@
+let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/t/hs_test_deinit.inc
new file mode 100644
index 00000000..7ec2e981
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/hs_test_deinit.inc
@@ -0,0 +1,17 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/hs_deinit_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/hs_deinit_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/hs_deinit_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/hs_deinit_child2_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/t/hs_test_init.inc b/storage/spider/mysql-test/spider/t/hs_test_init.inc
new file mode 100644
index 00000000..831bf479
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/hs_test_init.inc
@@ -0,0 +1,17 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/hs_init_master_1.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/hs_init_child2_1.inc
+ --echo child2_2
+ --connection child2_2
+ --source ../include/hs_init_child2_2.inc
+ --echo child2_3
+ --connection child2_3
+ --source ../include/hs_init_child2_3.inc
+}
diff --git a/storage/spider/mysql-test/spider/t/partition_cond_push.test b/storage/spider/mysql-test/spider/t/partition_cond_push.test
new file mode 100644
index 00000000..e47209ef
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/partition_cond_push.test
@@ -0,0 +1,221 @@
+--source ../include/partition_cond_push_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source ../include/partition_cond_push_deinit.inc
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ value int NOT NULL
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ value int NOT NULL
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (value) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (value) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (value) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT value FROM tbl_a WHERE value < 100;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_3_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/partition_cond_push_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/partition_fulltext.test b/storage/spider/mysql-test/spider/t/partition_fulltext.test
new file mode 100644
index 00000000..1b31fa05
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/partition_fulltext.test
@@ -0,0 +1,225 @@
+--source ../include/partition_fulltext_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source ../include/partition_fulltext_deinit.inc
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ words text NOT NULL,
+ PRIMARY KEY (pkey),
+ FULLTEXT (words)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ words text NOT NULL,
+ PRIMARY KEY (pkey),
+ FULLTEXT (words)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey, words) VALUES (0, 'abc'),(1, 'def'),(2, 'ghi'),(3, 'jkl'),(4, 'mno'),(5, 'pqr'),(6, 'stu'),(7, 'vwx');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT pkey, words FROM tbl_a WHERE match(words) against('+ghi' in boolean mode);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_3_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/partition_fulltext_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test b/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test
new file mode 100644
index 00000000..753014d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test
@@ -0,0 +1,224 @@
+--source ../include/partition_join_pushdown_for_single_partition_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source ../include/partition_join_pushdown_for_single_partition_deinit.inc
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_DROP_TABLES2;
+ echo CHILD2_2_CREATE_TABLES;
+ echo CHILD2_2_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ eval $CHILD2_2_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ eval $CHILD2_2_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_DROP_TABLES2;
+ echo CHILD2_3_CREATE_TABLES;
+ echo CHILD2_3_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ eval $CHILD2_3_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ eval $CHILD2_3_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ value int NOT NULL,
+ PRIMARY KEY(value)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ value int NOT NULL,
+ PRIMARY KEY(value)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ value2 int NOT NULL,
+ PRIMARY KEY(value2)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_b (
+ value2 int NOT NULL,
+ PRIMARY KEY(value2)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+
+insert into tbl_a values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+insert into tbl_b values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+--connection master_1
+--disable_ps2_protocol
+SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = b.value2 AND a.value = 5;
+SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = 5 and b.value2 = 5;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_3_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/partition_join_pushdown_for_single_partition_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/partition_mrr.test b/storage/spider/mysql-test/spider/t/partition_mrr.test
new file mode 100644
index 00000000..840c19d2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/partition_mrr.test
@@ -0,0 +1,239 @@
+--source include/no_protocol.inc
+--source ../include/partition_mrr_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source ../include/partition_mrr_deinit.inc
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ CREATE DATABASE auto_test_remote3;
+ USE auto_test_remote3;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_3
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_3_DROP_TABLES;
+ echo CHILD2_3_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_3_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_3_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+DROP TABLE IF EXISTS tbl_b;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey+0 = b.pkey+0 ORDER BY a.pkey; # MDEV-29947
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_3
+ if ($USE_GENERAL_LOG)
+ {
+--replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_3_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_3_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_3
+ DROP DATABASE IF EXISTS auto_test_remote3;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/partition_mrr_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/pushdown_not_like.test b/storage/spider/mysql-test/spider/t/pushdown_not_like.test
new file mode 100644
index 00000000..45b88e52
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/pushdown_not_like.test
@@ -0,0 +1,139 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ TRUNCATE TABLE mysql.general_log;
+ set global log_output = 'TABLE';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2018-11-01 10:21:39'),
+ (2, 'b', '2015-06-30 23:59:59'),
+ (3, 'c', '2013-11-01 01:01:01');
+
+--echo
+--echo spider not like bug fix test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_ps2_protocol
+select * from ta_l where b not like 'a%';
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select%';
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ SET GLOBAL log_output = @old_log_output;
+}
+
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_0.test b/storage/spider/mysql-test/spider/t/quick_mode_0.test
new file mode 100644
index 00000000..070d9e40
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_0.test
@@ -0,0 +1,300 @@
+--source ../include/quick_mode_0_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_1.test b/storage/spider/mysql-test/spider/t/quick_mode_1.test
new file mode 100644
index 00000000..a2c2bf87
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_1.test
@@ -0,0 +1,300 @@
+--source ../include/quick_mode_1_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_2.test b/storage/spider/mysql-test/spider/t/quick_mode_2.test
new file mode 100644
index 00000000..12a48a90
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_2.test
@@ -0,0 +1,300 @@
+--source ../include/quick_mode_2_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_2_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/quick_mode_3.test b/storage/spider/mysql-test/spider/t/quick_mode_3.test
new file mode 100644
index 00000000..65851a5b
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/quick_mode_3.test
@@ -0,0 +1,300 @@
+--source ../include/quick_mode_3_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_b (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2;
+--enable_query_log
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+INSERT INTO tbl_b (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+INSERT INTO tbl_b (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19);
+INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29);
+
+--echo
+--echo select test 1
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_6;
+
+--echo
+--echo select test 2
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--connection master_1
+eval $MASTER_1_SET_QUICK_PAGE_BYTE_0;
+
+--echo
+--echo select test 3
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/
+ eval $CHILD2_2_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/quick_mode_3_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/show_system_tables.test b/storage/spider/mysql-test/spider/t/show_system_tables.test
new file mode 100644
index 00000000..ae8259b0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/show_system_tables.test
@@ -0,0 +1,26 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+
+--echo
+--echo Show system tables on the Spider node
+--connection master_1
+--sorted_result
+SELECT table_name, engine FROM information_schema.tables
+ WHERE table_schema = 'mysql' AND table_name like '%spider_%';
+
+--echo
+--echo deinit
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/t/slave_test_deinit.inc
new file mode 100644
index 00000000..e9d99b7a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/slave_test_deinit.inc
@@ -0,0 +1,6 @@
+# get connection and exist engine test
+--echo for slave1_1
+--connection slave1_1
+STOP SLAVE;
+--source ../include/deinit_slave1_1.inc
+--disconnect slave1_1
diff --git a/storage/spider/mysql-test/spider/t/slave_test_init.inc b/storage/spider/mysql-test/spider/t/slave_test_init.inc
new file mode 100644
index 00000000..739d8897
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/slave_test_init.inc
@@ -0,0 +1,44 @@
+# get connection and exist engine test
+--echo for slave1_1
+--source connect_slave1_1.inc
+--connection slave1_1
+SET SESSION sql_log_bin= 0;
+--let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id`
+--let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE
+--source have_partition.inc
+--source have_trigger.inc
+--source ../include/init_slave1_1.inc
+--source have_engine.inc
+--let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS`
+if (!$SLAVE1_1_SLAVE_STATUS)
+{
+ eval CHANGE MASTER TO
+ MASTER_HOST = '127.0.0.1',
+ MASTER_USER = 'root',
+ MASTER_PASSWORD = '',
+ MASTER_PORT = $MASTER_1_MYPORT
+ ;
+}
+START SLAVE;
+--connection master_1
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+--connection slave1_1
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child2_2
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child2_3
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+}
+if ($USE_CHILD_GROUP3)
+{
+ --connection child3_1
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child3_2
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+ --connection child3_3
+ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+}
diff --git a/storage/spider/mysql-test/spider/t/slave_trx_isolation.test b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test
new file mode 100644
index 00000000..a3a3fad8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test
@@ -0,0 +1,151 @@
+--source ../include/slave_trx_isolation_init.inc
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ SET SESSION sql_log_bin= 0;
+}
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_query_log
+ echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+ eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+ --enable_query_log
+ --connection master_1
+}
+INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ SET SESSION sql_log_bin= 0;
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ --disable_ps2_protocol
+ if ($USE_GENERAL_LOG)
+ {
+ --replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ --enable_ps2_protocol
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ SELECT pkey FROM tbl_a ORDER BY pkey;
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/slave_trx_isolation_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes.test b/storage/spider/mysql-test/spider/t/spider3_fixes.test
new file mode 100644
index 00000000..eb48b0c8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/spider3_fixes.test
@@ -0,0 +1,304 @@
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo 3.1
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+--disable_ps_protocol
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+--enable_ps_protocol
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+INSERT INTO t2 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t2 ORDER BY id;
+SET INSERT_ID=5000;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+--disable_query_log
+echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+--enable_query_log
+INSERT INTO t2 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t2 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t2;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo #
+--echo # MDEV-28225 Disallow user to create Spider temporary table
+--echo #
+--connection master_1
+--error ER_ILLEGAL_HA_CREATE_OPTION
+CREATE TEMPORARY TABLE t1 (
+ a INT
+) ENGINE=Spider;
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test
new file mode 100644
index 00000000..bcd85f42
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test
@@ -0,0 +1,347 @@
+# This test tests for Spider 3.0's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ --disable_ps_protocol
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ --enable_ps_protocol
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1, t2;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ echo CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t2 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ TRUNCATE TABLE t1;
+ TRUNCATE TABLE t2;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t2 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t2 ORDER BY id;
+ SET INSERT_ID=5000;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET3;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ --disable_query_log
+ echo MASTER_1_AUTO_INCREMENT_OFFSET4;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
+ --enable_query_log
+ INSERT INTO t2 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t2 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t2;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/spider_fixes.test b/storage/spider/mysql-test/spider/t/spider_fixes.test
new file mode 100644
index 00000000..a5a8f228
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/spider_fixes.test
@@ -0,0 +1,1442 @@
+# This test tests for Spider's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+--echo
+--echo 2.13
+--echo select table with "order by desc" and "<"
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a < 5 ORDER BY a DESC LIMIT 3;
+--enable_ps2_protocol
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo select table with "order by desc" and "<="
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
+WHERE a <= 5 ORDER BY a DESC LIMIT 3;
+--enable_ps2_protocol
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.14
+--echo update table with range scan and split_read
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
+
+--echo
+--echo 2.15
+--echo select table with range scan
+TRUNCATE TABLE ta_l;
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_CREATE_TABLES6;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES6;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES6;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a int(11) NOT NULL DEFAULT '0',
+ b char(1) DEFAULT NULL,
+ c datetime DEFAULT NULL,
+ PRIMARY KEY (a, b, c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE ta_l (
+ a int(11) NOT NULL DEFAULT '0',
+ b char(1) DEFAULT NULL,
+ c datetime DEFAULT NULL,
+ PRIMARY KEY (a, b, c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+--enable_query_log
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
+AND c = '2001-12-31 23:59:59';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
+AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
+AND c = '2000-01-01 00:00:00';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
+AND b <= 'd' AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
+AND b < 'e' AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
+AND b >= 'b' AND c = '2003-11-30 05:01:03';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
+AND b >= 'b' AND c = '2000-01-01 00:00:00';
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.16
+--echo auto_increment insert with trigger
+if ($HAVE_TRIGGER)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_CREATE_TABLES4;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES4;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES4;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+ eval CREATE TABLE ta_l_auto_inc (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+ echo CREATE TABLE tc_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+ eval CREATE TABLE tc_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+ --enable_query_log
+ --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ INSERT INTO ta_l_auto_inc (a, b, c) VALUES
+ (NULL, 's', '2008-12-31 20:59:59');
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES4;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
+}
+
+--echo
+--echo 2.17
+--echo engine-condition-pushdown with "or" and joining
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.23
+--echo index merge
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo 2.24
+--echo index scan update without PK
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l_int;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+if ($MASTER_1_NEEDPK)
+{
+ --error ER_REQUIRES_PRIMARY_KEY
+ eval CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+ eval CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+}
+if (!$MASTER_1_NEEDPK)
+{
+ eval CREATE TABLE ta_l_int (
+ a INT NOT NULL,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+}
+--enable_query_log
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
+INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE ta_l_int SET c = 4 WHERE b = 2;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SELECT a, b, c FROM ta_l_int ORDER BY a;
+
+
+--echo
+--echo 2.25
+--echo direct order limit
+--connection master_1
+eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
+--disable_ps2_protocol
+SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
+--enable_ps2_protocol
+eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
+
+
+--echo
+--echo 2.26
+--echo lock tables
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_LOCK_TABLES1;
+ echo CHILD2_1_DROP_LOCK_TABLES2;
+ echo CHILD2_1_CREATE_LOCK_TABLES1;
+ echo CHILD2_1_CREATE_LOCK_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_LOCK_TABLES1;
+ eval $CHILD2_1_DROP_LOCK_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_LOCK_TABLES1;
+ eval $CHILD2_1_CREATE_LOCK_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_LOCK_TABLES1;
+ echo CHILD2_2_DROP_LOCK_TABLES2;
+ echo CHILD2_2_CREATE_LOCK_TABLES1;
+ echo CHILD2_2_CREATE_LOCK_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_LOCK_TABLES1;
+ eval $CHILD2_2_DROP_LOCK_TABLES2;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_LOCK_TABLES1;
+ eval $CHILD2_2_CREATE_LOCK_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1;
+echo CREATE TABLE t2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2;
+eval CREATE TABLE t2 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2;
+--enable_query_log
+LOCK TABLES t1 READ, t2 READ;
+UNLOCK TABLES;
+
+
+--echo
+--echo auto_increment
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
+echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
+--disable_ps_protocol
+eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+--enable_ps_protocol
+if ($USE_REPLICATION)
+{
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
+ --connection master_1
+}
+--enable_query_log
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (null);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 () VALUES (),(),(),();
+SELECT LAST_INSERT_ID();
+SELECT id FROM t1 ORDER BY id;
+SET INSERT_ID=5000;
+INSERT INTO t1 () VALUES ();
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (10000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+INSERT INTO t1 (id) VALUES (1000);
+SELECT LAST_INSERT_ID();
+SELECT MAX(id) FROM t1;
+if ($USE_REPLICATION)
+{
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo read only
+let $MASTER_1_ENGINE_IS_SPIDER=
+ `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR
+ '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`;
+if ($MASTER_1_ENGINE_IS_SPIDER)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1;
+ --let $MIN_VAL= `SELECT MIN(id) FROM t1`
+ --enable_query_log
+ SELECT id FROM t1 ORDER BY id;
+ --error 12518
+ INSERT INTO t1 (id) VALUES (1);
+ --error 12518
+ eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL;
+ --error 12518
+ eval DELETE FROM t1 WHERE id = $MIN_VAL;
+ --error 12518
+ DELETE FROM t1;
+ --error 12518
+ TRUNCATE t1;
+}
+if (!$MASTER_1_ENGINE_IS_SPIDER)
+{
+ --echo skipped
+}
+
+
+--echo
+--echo 2.27
+--echo error mode
+if ($MASTER_1_ENGINE_IS_SPIDER)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1;
+ --enable_query_log
+ SELECT id FROM t1 ORDER BY id;
+ INSERT INTO t1 (id) VALUES (1);
+ DELETE FROM t1;
+ TRUNCATE t1;
+}
+if (!$MASTER_1_ENGINE_IS_SPIDER)
+{
+ --echo skipped
+}
+
+
+--echo
+--echo 3.0
+--echo is null
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TEXT_KEY_TABLES1;
+ echo CHILD2_1_CREATE_TEXT_KEY_TABLES1;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TEXT_KEY_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1;
+eval CREATE TABLE t1 (
+ a VARCHAR(255),
+ b VARCHAR(255),
+ c VARCHAR(255),
+ KEY idx1(a,b),
+ KEY idx2(b),
+ PRIMARY KEY(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1;
+--enable_query_log
+insert into t1 values (null, null, '2048');
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a + 32, b + 32, c + 32 from t1;
+insert into t1 select a + 64, b + 64, c + 64 from t1;
+insert into t1 select a + 128, b + 128, c + 128 from t1;
+insert into t1 select a + 256, b + 256, c + 256 from t1;
+insert into t1 select a + 512, b + 512, c + 512 from t1;
+flush tables;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+select a from t1 where a is null order by a limit 30;
+select b from t1 where b is null order by b limit 30;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo direct_order_limit
+--connection master_1
+TRUNCATE TABLE t1;
+insert into t1 values ('1', '1', '1');
+insert into t1 select a + 1, b + 1, c + 1 from t1;
+insert into t1 select a + 2, b + 2, c + 2 from t1;
+insert into t1 select a + 4, b + 4, c + 4 from t1;
+insert into t1 select a + 8, b + 8, c + 8 from t1;
+insert into t1 select a + 16, b + 16, c + 16 from t1;
+insert into t1 select a, b + 32, c + 32 from t1;
+insert into t1 select a, b + 64, c + 64 from t1;
+insert into t1 select a, b + 128, c + 128 from t1;
+flush tables;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
+select a, c from t1 where a = '10' order by b desc limit 5;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+
+
+# MDEV-27039 LOCK_global_system_variables attempted to re-acquire
+# The test proves no assert anymore.
+--connection master_1
+--let $binlog_checksum=`SELECT @@global.binlog_checksum`
+--let $expire_logs_days=`SELECT @@global.expire_logs_days`
+SET @@global.expire_logs_days=11;
+
+--connect (master_purge, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
+SET @@global.binlog_checksum=NONE;
+--evalp SET @@global.binlog_checksum=$binlog_checksum
+--evalp SET @@global.expire_logs_days=$expire_logs_days
+--disconnect master_purge
+
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/t/spider_fixes_part.test
new file mode 100644
index 00000000..bff2e574
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/spider_fixes_part.test
@@ -0,0 +1,901 @@
+# This test tests for Spider's bug fixes
+source include/have_log_bin.inc;
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--source slave_test_init.inc
+--enable_result_log
+--enable_query_log
+if (!$HAVE_PARTITION)
+{
+ --disable_query_log
+ --disable_result_log
+ --source slave_test_deinit.inc
+ --source test_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+ CREATE DATABASE auto_test_local;
+ USE auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+
+--echo
+--echo 2.17
+--echo partition with sort
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
+ ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo 2.23
+--echo partition update with moving partition
+if ($HAVE_PARTITION)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
+ UPDATE ta_l2 SET a = 4 WHERE a = 3;
+ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo index merge with partition
+if ($HAVE_PARTITION)
+{
+ --connection master_1
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l_int;
+ --enable_warnings
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_2_DROP_TABLES5;
+ echo CHILD2_2_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES5;
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ echo CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1;
+ eval CREATE TABLE ta_l_int (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
+ INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
+ WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo
+--echo 2.26
+--echo auto_increment with partition
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_INCREMENT_TABLES1;
+ echo CHILD2_1_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_INCREMENT_TABLES1;
+ echo CHILD2_2_CREATE_INCREMENT_TABLES1;
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_INCREMENT_TABLES1;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ --disable_query_log
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
+ echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ echo MASTER_1_AUTO_INCREMENT_OFFSET2;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
+ --disable_ps_protocol
+ eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
+ eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
+ --enable_ps_protocol
+ if ($USE_REPLICATION)
+ {
+ SET SESSION sql_log_bin= 1;
+ --connection slave1_1
+ --disable_warnings
+ DROP TABLE IF EXISTS t1;
+ --enable_warnings
+ echo CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ eval CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (id)
+ ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
+ --connection master_1
+ }
+ --enable_query_log
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (null);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 () VALUES (),(),(),();
+ SELECT LAST_INSERT_ID();
+ SELECT id FROM t1 ORDER BY id;
+ SET INSERT_ID=5000;
+ INSERT INTO t1 () VALUES ();
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (10000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ INSERT INTO t1 (id) VALUES (1000);
+ SELECT LAST_INSERT_ID();
+ SELECT MAX(id) FROM t1;
+ if ($USE_REPLICATION)
+ {
+ save_master_pos;
+ --connection slave1_1
+ sync_with_master;
+ SELECT id FROM t1 ORDER BY id;
+ --connection master_1
+ --disable_query_log
+ SET SESSION sql_log_bin= 0;
+ --enable_query_log
+ }
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ }
+ eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
+ eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo Test ORDER BY with LIMIT and OFFSET
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES7;
+ echo CHILD2_1_CREATE_TABLES7;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES7;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES7;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_ob;
+ --enable_warnings
+ echo CREATE TABLE ta_ob (
+ a VARCHAR(50) NOT NULL,
+ b VARCHAR(50) NULL DEFAULT NULL,
+ c VARCHAR(100) NULL DEFAULT NULL,
+ d DATETIME(0) NULL DEFAULT NULL,
+ e INT(11) NOT NULL,
+ f INT(10) NULL DEFAULT NULL,
+ PRIMARY KEY (a, e)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1;
+ eval CREATE TABLE ta_ob (
+ a VARCHAR(50) NOT NULL,
+ b VARCHAR(50) NULL DEFAULT NULL,
+ c VARCHAR(100) NULL DEFAULT NULL,
+ d DATETIME(0) NULL DEFAULT NULL,
+ e INT(11) NOT NULL,
+ f INT(10) NULL DEFAULT NULL,
+ PRIMARY KEY (a, e)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1;
+ --enable_query_log
+ INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733',
+ '6CFED89FF6A84C7AA55C3C432663D094',
+ '51041110620304', '2018-08-02 13:41:13',
+ 510411, 1);
+ INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD',
+ '879DC2A0B6AC46D9A62E8EA47E2970F2',
+ '51041110620301', NULL,
+ 510411, 0);
+ INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0',
+ '017B8A460DBC444682B791305EF75356',
+ '51041110620308', '2018-08-02 13:48:29',
+ 510411, 0);
+ INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674',
+ '996C7F14989D480589A553717D735E3E',
+ '51041110620302', '2018-08-02 13:48:30',
+ 510411, 0);
+ INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583',
+ '017B8A460DBC444682B791305EF75356',
+ '51041110620308', '2018-08-02 13:48:28',
+ 510411, 0);
+ INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B',
+ '821E71E6ABB4404EBAA349BB681089F8',
+ '51041110620310', '2018-08-02 13:48:27',
+ 510411, 0);
+ INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70',
+ '821E71E6ABB4404EBAA349BB681089F8',
+ '51041110620310', '2018-08-02 13:48:28',
+ 510411, 0);
+ SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1;
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES7;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+
+--echo #
+--echo # MDEV-25985 Spider handle ">=" as ">" in some cases
+--echo #
+
+--connection child2_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+eval CREATE TABLE t1 (
+ a int,
+ b int,
+ c int,
+ PRIMARY KEY (a),
+ KEY (b,c)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 1);
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+eval CREATE TABLE t1 (
+ a int,
+ b int,
+ c int,
+ PRIMARY KEY (a),
+ KEY (b,c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_MDEV_25985;
+
+--connection master_1
+SELECT * FROM t1 WHERE c > 0 AND b >= 1 AND b <= 2;
+SELECT * FROM t1 WHERE c < 3 AND b <= 2;
+
+--echo
+--echo Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
+--echo Fixed with 4968049799193394d442f26b4e3a8d95b185be72
+--echo Spider crashed if the first partition was not used first
+if ($HAVE_PARTITION)
+{
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_2_DROP_TABLES;
+ echo CHILD2_2_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_2_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_2_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES2;
+ echo CHILD2_1_CREATE_TABLES2;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES2;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES2;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+ --connection master_1
+ --disable_query_log
+ --disable_warnings
+ DROP TABLE IF EXISTS ta_l2;
+ --enable_warnings
+ echo CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
+ eval CREATE TABLE ta_l2 (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+ ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
+ --enable_query_log
+ INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
+ --echo Query a Spider table only using the second partition
+ SELECT a,b,c FROM ta_l2 PARTITION (pt2);
+ --echo Query a Spider table only using the first partition
+ SELECT a,b,c FROM ta_l2 PARTITION (pt1);
+ --echo Query a Spider table by all paritions, then the second partition
+ SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
+ SELECT a,b,c FROM ta_l2 PARTITION (pt2);
+ if ($USE_CHILD_GROUP2)
+ {
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_2
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_2_SELECT_TABLES;
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+ }
+ eval $CHILD2_1_SELECT_TABLES2;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_REPLICATION)
+{
+ --connection slave1_1
+ DROP DATABASE IF EXISTS auto_test_local;
+}
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source slave_test_deinit.inc
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test b/storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test
new file mode 100644
index 00000000..d0753cf7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/spider_wrapper_protocols.test
@@ -0,0 +1,16 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_query_log
+
+--connection master_1
+SELECT * FROM information_schema.spider_wrapper_protocols;
+
+--disable_query_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/test_deinit.inc b/storage/spider/mysql-test/spider/t/test_deinit.inc
new file mode 100644
index 00000000..5a82b43c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/test_deinit.inc
@@ -0,0 +1,39 @@
+# get connection and exist engine test
+--echo for master_1
+--connection master_1
+--source ../include/deinit_master_1.inc
+--disconnect master_1
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --connection child2_1
+ --source ../include/deinit_child2_1.inc
+ --disconnect child2_1
+ --disconnect child2_1_2
+ --echo child2_2
+ --connection child2_2
+ --source ../include/deinit_child2_2.inc
+ --disconnect child2_2
+ --disconnect child2_2_2
+ --echo child2_3
+ --connection child2_3
+ --source ../include/deinit_child2_3.inc
+ --disconnect child2_3
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --connection child3_1
+ --source ../include/deinit_child3_1.inc
+ --disconnect child3_1
+ --echo child3_2
+ --connection child3_2
+ --source ../include/deinit_child3_2.inc
+ --disconnect child3_2
+ --echo child3_3
+ --connection child3_3
+ --source ../include/deinit_child3_3.inc
+ --disconnect child3_3
+}
diff --git a/storage/spider/mysql-test/spider/t/test_init.inc b/storage/spider/mysql-test/spider/t/test_init.inc
new file mode 100644
index 00000000..f2cd6c02
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/test_init.inc
@@ -0,0 +1,74 @@
+# get connection and exist engine test
+--echo for master_1
+--source connect_master_1.inc
+--connection master_1
+CALL mtr.add_suppression("unknown variable");
+SET SESSION sql_log_bin= 0;
+--let $MASTER_1_SERVER_ID=`SELECT @@global.server_id`
+--let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE
+--source have_partition.inc
+--source have_trigger.inc
+--source ../include/init_master_1.inc
+--source have_engine.inc
+--echo for child2
+if ($USE_CHILD_GROUP2)
+{
+ --echo child2_1
+ --source connect_child2_1.inc
+ --connection child2_1
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
+ --source ../include/init_child2_1.inc
+ --source have_engine.inc
+ --echo child2_2
+ --source connect_child2_2.inc
+ --connection child2_2
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
+ --source ../include/init_child2_2.inc
+ --source have_engine.inc
+ --echo child2_3
+ --source connect_child2_3.inc
+ --connection child2_3
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
+ --source ../include/init_child2_3.inc
+ --source have_engine.inc
+}
+--echo for child3
+if ($USE_CHILD_GROUP3)
+{
+ --echo child3_1
+ --source connect_child3_1.inc
+ --connection child3_1
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
+ --source ../include/init_child3_1.inc
+ --source have_engine.inc
+ --echo child3_2
+ --source connect_child3_2.inc
+ --connection child3_2
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
+ --source ../include/init_child3_2.inc
+ --source have_engine.inc
+ --echo child3_3
+ --source connect_child3_3.inc
+ --connection child3_3
+ CALL mtr.add_suppression("unknown variable *");
+ SET SESSION sql_log_bin= 0;
+ --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id`
+ --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
+ --source ../include/init_child3_3.inc
+ --source have_engine.inc
+}
diff --git a/storage/spider/mysql-test/spider/t/timestamp.test b/storage/spider/mysql-test/spider/t/timestamp.test
new file mode 100644
index 00000000..47d637bb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/timestamp.test
@@ -0,0 +1,542 @@
+--source timestamp_init.inc
+
+--echo
+--echo Initialize Time Zone
+--connection master_1
+SET GLOBAL time_zone='MET';
+SET time_zone='MET';
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ SET GLOBAL time_zone='MET';
+ SET time_zone='MET';
+}
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS ts_test_local;
+CREATE DATABASE ts_test_local;
+USE ts_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS ts_test_remote;
+ CREATE DATABASE ts_test_remote;
+ USE ts_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLE;
+ echo CHILD2_1_DROP_TABLE_F;
+ echo CHILD2_1_CREATE_TABLE;
+ echo CHILD2_1_CREATE_TABLE_F;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLE;
+ eval $CHILD2_1_DROP_TABLE_F;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLE;
+ eval $CHILD2_1_CREATE_TABLE_F;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ col_a INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ col_dt DATETIME,
+ col_ts TIMESTAMP NOT NULL
+ DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY(col_a),
+ UNIQUE INDEX i_ts (col_ts)
+) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ col_a INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ col_dt DATETIME,
+ col_ts TIMESTAMP NOT NULL
+ DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY(col_a),
+ UNIQUE INDEX i_ts (col_ts)
+) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_f (
+ col_d DATE,
+ col_t TIME
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F;
+eval CREATE TABLE tbl_f (
+ col_d DATE,
+ col_t TIME
+) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F;
+--enable_query_log
+SHOW CREATE TABLE tbl_a;
+SHOW CREATE TABLE tbl_f;
+
+--echo
+--echo Set a different time zone that has DST
+SET time_zone='+01:00';
+
+--echo
+--echo Insert Rows
+--connection master_1
+--echo Min value
+SET @@timestamp=1;
+INSERT INTO tbl_a VALUES (1, now(), now());
+SET @@timestamp=0;
+--echo Ambiguous DST values for MET time zone that result in the
+--echo same UTC timestamp
+INSERT INTO tbl_a VALUES (2, '2018-03-25 02:00:00', '2018-03-25 02:00:00');
+INSERT INTO tbl_a VALUES (3, '2018-03-25 02:30:00', '2018-03-25 02:30:00');
+--echo Ambiguous DST values for MET time zone in the 2:00 am to 3:00 am hour
+--echo that occur twice when transitioning from DST to standard time
+SET @@timestamp=1540686600;
+INSERT INTO tbl_a VALUES (4, now(), now());
+SET @@timestamp=1540690200;
+INSERT INTO tbl_a VALUES (5, now(), now());
+--echo Max value
+SET @@timestamp=2147483647;
+INSERT INTO tbl_a VALUES (6, now(), now());
+SET @@timestamp=0;
+
+--echo
+--echo SELECTs
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo DELETEs
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DELETE FROM tbl_a WHERE col_ts='1970-01-01 01:00:01';
+--disable_ps2_protocol
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+SET @@timestamp=1;
+INSERT INTO tbl_a VALUES (1, now(), now());
+SET @@timestamp=0;
+--disable_ps2_protocol
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo UPDATEs
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+UPDATE tbl_a SET col_ts=col_dt;
+--disable_ps2_protocol
+SELECT *, unix_timestamp(col_ts) FROM tbl_a;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo Lookups
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > '2018-01-01';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts < '2018-10-28 02:30:00';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE '2018-10-28 02:30:00' > col_ts;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts BETWEEN '2018-10-28 01:30:00' AND '2018-10-28 02:30:00';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00' AND col_ts <= '2018-10-28 02:30:00';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo Drop the index on the timestamp column
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ eval $CHILD2_1_DROP_INDEX;
+ eval $CHILD2_1_SHOW_CREATE_TABLE;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+DROP INDEX i_ts ON tbl_a;
+SHOW CREATE TABLE tbl_a;
+
+--echo
+--echo Retry lookups on unindexed timestamp column
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > '2018-01-01';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts < '2018-10-28 02:30:00';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE '2018-10-28 02:30:00' > col_ts;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts BETWEEN '2018-10-28 01:30:00' AND '2018-10-28 02:30:00';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00' AND col_ts <= '2018-10-28 02:30:00';
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000;
+SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo Test the TIMESTAMP function
+--connection master_1
+INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'),
+ ('2018-06-24', '01:23:45'),
+ ('2018-08-01', '12:34:56');
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_ps2_protocol
+SELECT * FROM tbl_f;
+SELECT TIMESTAMP(col_d, col_t) FROM tbl_f;
+SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f;
+SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f;
+SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLE_F;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--enable_ps2_protocol
+
+--echo
+--echo Restore Time Zone settings
+--connection master_1
+SET GLOBAL time_zone=DEFAULT;
+SET time_zone=DEFAULT;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ SET GLOBAL time_zone=DEFAULT;
+ SET time_zone=DEFAULT;
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS ts_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS ts_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source timestamp_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/timestamp_deinit.inc b/storage/spider/mysql-test/spider/t/timestamp_deinit.inc
new file mode 100644
index 00000000..52be67a1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/timestamp_deinit.inc
@@ -0,0 +1,13 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/t/timestamp_init.inc b/storage/spider/mysql-test/spider/t/timestamp_init.inc
new file mode 100644
index 00000000..22587bcf
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/timestamp_init.inc
@@ -0,0 +1,62 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+--let $MASTER_1_COMMENT_2_1_F_BACKUP= $MASTER_1_COMMENT_2_1_F
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"';
+let $MASTER_1_COMMENT_2_1_F=
+ COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"';
+let $MASTER_1_AUTO_INCREMENT_2_1=
+ AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
+let $MASTER_1_AUTO_INCREMENT1=
+ AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
+let $MASTER_1_AUTO_INCREMENT2=
+ AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
+let $CHILD2_1_AUTO_INCREMENT=
+ AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
+--let $CHILD2_1_DROP_TABLE_BACKUP= $CHILD2_1_DROP_TABLE
+--let $CHILD2_1_DROP_TABLE_F_BACKUP= $CHILD2_1_DROP_TABLE_F
+let $CHILD2_1_DROP_TABLE=
+ DROP TABLE IF EXISTS tbl_a;
+let $CHILD2_1_DROP_TABLE_F=
+ DROP TABLE IF EXISTS tbl_f;
+--let $CHILD2_1_CREATE_TABLE_BACKUP= $CHILD2_1_CREATE_TABLE
+--let $CHILD2_1_CREATE_TABLE_F_BACKUP= $CHILD2_1_CREATE_TABLE_F
+let $CHILD2_1_CREATE_TABLE=
+ CREATE TABLE tbl_a (
+ col_a INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ col_dt DATETIME,
+ col_ts TIMESTAMP NOT NULL
+ DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY(col_a),
+ UNIQUE INDEX i_ts (col_ts)
+ ) $CHILD2_1_ENGINE $CHILD2_1_AUTO_INCREMENT;
+let $CHILD2_1_CREATE_TABLE_F=
+ CREATE TABLE tbl_f (
+ col_d DATE,
+ col_t TIME
+ ) $CHILD2_1_ENGINE;
+--let $CHILD2_1_SELECT_TABLE_BACKUP= $CHILD2_1_SELECT_TABLE
+--let $CHILD2_1_SELECT_TABLE_F_BACKUP= $CHILD2_1_SELECT_TABLE_F
+let $CHILD2_1_SELECT_TABLE=
+ SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a;
+let $CHILD2_1_SELECT_TABLE_F=
+ SELECT col_d, col_t FROM tbl_f;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
+let $CHILD2_1_DROP_INDEX=
+ DROP INDEX i_ts ON tbl_a;
+let $CHILD2_1_SHOW_CREATE_TABLE=
+ SHOW CREATE TABLE tbl_a;
+let $CHILD2_1_SHOW_CREATE_TABLE_F=
+ SHOW CREATE TABLE tbl_f;
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/t/udf_pushdown.inc b/storage/spider/mysql-test/spider/t/udf_pushdown.inc
new file mode 100644
index 00000000..df9742a3
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/udf_pushdown.inc
@@ -0,0 +1,50 @@
+--echo
+--echo ##### test SELECTs #####
+--connection master_1
+--disable_ps2_protocol
+SELECT * FROM ta_l WHERE id = plusone(1);
+SELECT * FROM ta_l WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32);
+--enable_ps2_protocol
+
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ SELECT argument FROM mysql.general_log WHERE argument LIKE "%select%" AND argument NOT LIKE "%argument%";
+ --disable_query_log
+ TRUNCATE TABLE mysql.general_log;
+ --enable_query_log
+}
+
+--echo
+--echo ##### test UPDATEs #####
+--connection master_1
+UPDATE ta_l SET a = plusone(221) WHERE id = plusone(1);
+SELECT * FROM ta_l;
+UPDATE ta_l SET a = plusone(332) WHERE id IN (plusone(1), plusone(2)) AND a = plusone(32);
+SELECT * FROM ta_l;
+
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ SELECT argument FROM mysql.general_log WHERE argument LIKE "%update%" AND argument NOT LIKE "%argument%";
+ --disable_query_log
+ TRUNCATE TABLE mysql.general_log;
+ --enable_query_log
+}
+
+--echo
+--echo ##### test DELETEs #####
+--connection master_1
+DELETE FROM ta_l WHERE id = plusone(1);
+SELECT * FROM ta_l;
+DELETE FROM ta_l WHERE id IN (plusone(1), plusone(2), plusone(3)) AND a = plusone(43);
+SELECT * FROM ta_l;
+
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ SELECT argument FROM mysql.general_log WHERE (argument LIKE "%delete%" OR argument LIKE "%update%") AND argument NOT LIKE "%argument%";
+ --disable_query_log
+ TRUNCATE TABLE mysql.general_log;
+ --enable_query_log
+}
diff --git a/storage/spider/mysql-test/spider/t/udf_pushdown.test b/storage/spider/mysql-test/spider/t/udf_pushdown.test
new file mode 100644
index 00000000..2eadbbbb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/udf_pushdown.test
@@ -0,0 +1,141 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo #
+--echo # MDEV-26545 Spider does not correctly handle UDF and stored function in where conds
+--echo #
+
+let $CHILD_CREATE_TABLE=
+ CREATE TABLE ta_r (
+ id INT NOT NULL,
+ a INT,
+ PRIMARY KEY(id)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+let $MASTER_CREATE_TABLE_OUTPUT=
+ CREATE TABLE ta_l (
+ id INT NOT NULL,
+ a INT,
+ PRIMARY KEY(id)
+ ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+
+let $MASTER_CREATE_TABLE=
+ CREATE TABLE ta_l (
+ id INT NOT NULL,
+ a INT,
+ PRIMARY KEY(id)
+ ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+
+--echo
+--echo ##### enable general_log #####
+--connection child2_1
+SET @general_log_backup = @@global.general_log;
+SET @log_output_backup = @@global.log_output;
+SET @@global.general_log = 1;
+SET @@global.log_output = "TABLE";
+TRUNCATE TABLE mysql.general_log;
+
+--echo
+--echo ##### create databases #####
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+
+--echo
+--echo ##### create tables #####
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ --disable_query_log
+ echo CHILD_CREATE_TABLE;
+ eval $CHILD_CREATE_TABLE;
+ --enable_query_log
+}
+
+--connection master_1
+--disable_query_log
+echo MASTER_CREATE_TABLE;
+echo $MASTER_CREATE_TABLE_OUTPUT;
+eval $MASTER_CREATE_TABLE;
+--enable_query_log
+
+INSERT INTO ta_l VALUES
+ (1, 11),
+ (2, 22),
+ (3, 33),
+ (4, 44),
+ (5, 55);
+
+--echo
+--echo ##### create functions #####
+--connection master_1
+DELIMITER //;
+CREATE FUNCTION `plusone`( param INT ) RETURNS INT
+BEGIN
+ RETURN param + 1;
+END //
+DELIMITER ;//
+
+--connection child2_1
+DELIMITER //;
+CREATE FUNCTION `plusone`( param INT ) RETURNS INT
+BEGIN
+ RETURN param + 1;
+END //
+DELIMITER ;//
+
+--echo
+--echo ########## spider_use_pushdown_udf=0 ##########
+--connection master_1
+SET @@spider_use_pushdown_udf = 0;
+--source udf_pushdown.inc
+
+--echo
+--echo ##### reset records #####
+--connection master_1
+TRUNCATE TABLE ta_l;
+INSERT INTO ta_l VALUES
+ (1, 11),
+ (2, 22),
+ (3, 33),
+ (4, 44),
+ (5, 55);
+
+--echo
+--echo ########## spider_use_pushdown_udf=1 ##########
+--connection master_1
+SET @@spider_use_pushdown_udf = 1;
+--source udf_pushdown.inc
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP FUNCTION `plusone`;
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ SET @@global.general_log = @general_log_backup;
+ SET @@global.log_output = @log_output_backup;
+ DROP FUNCTION `plusone`;
+ DROP DATABASE IF EXISTS auto_test_remote;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test
new file mode 100644
index 00000000..3ed8dcf5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test
@@ -0,0 +1,137 @@
+--echo #
+--echo # MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--echo # MDEV-28297 Deprecate spider_internal_offset
+SET spider_internal_offset = 1;
+SHOW VARIABLES LIKE "spider_internal_offset";
+
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ios "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_offset "1"';
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-27981 Deprecate spider_internal_limit
+SET spider_internal_limit = 1;
+SHOW VARIABLES LIKE "spider_internal_limit";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ilm "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_limit "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28244 Deprecate spider_xa_register_mode
+SET spider_xa_register_mode = 0;
+SHOW VARIABLES LIKE "spider_xa_register_mode";
+
+--echo # MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
+SET GLOBAL spider_store_last_sts = 0;
+SHOW VARIABLES LIKE "spider_store_last_sts";
+
+SET GLOBAL spider_store_last_crd = 0;
+SHOW VARIABLES LIKE "spider_store_last_crd";
+
+SET GLOBAL spider_load_sts_at_startup = 0;
+SHOW VARIABLES LIKE "spider_load_sts_at_startup";
+
+SET GLOBAL spider_load_crd_at_startup = 0;
+SHOW VARIABLES LIKE "spider_load_crd_at_startup";
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
+SET spider_crd_mode = 1;
+SHOW VARIABLES LIKE "spider_crd_mode";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cmd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_mode "3"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_sts_mode = 1;
+SHOW VARIABLES LIKE "spider_sts_mode";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='smd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='sts_mode "3"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
+SET spider_crd_type = 1;
+SHOW VARIABLES LIKE "spider_crd_type";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ctp "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_type "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_crd_weight = 1;
+SHOW VARIABLES LIKE "spider_crd_weight";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cwg "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_weight "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28560 Deprecate spider_buffer_size
+SET spider_buffer_size = 1;
+SHOW VARIABLES LIKE "spider_buffer_size";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='bfz "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='buffer_size "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-27926 Deprecate spider_init_sql_alloc_size
+SET spider_init_sql_alloc_size = 1;
+SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='isa "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
+SET spider_semi_table_lock = 1;
+SHOW VARIABLES LIKE "spider_semi_table_lock";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stl "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_semi_table_lock_connection = 0;
+SHOW VARIABLES LIKE "spider_semi_table_lock_connection";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stc "0"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock_connection "0"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28795 Deprecate spider_bka_table_name_type
+SET spider_bka_table_name_type = 1;
+SHOW VARIABLES LIKE "spider_bka_table_name_type";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='btt "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='bka_table_name_type "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/mysql-test/spider/t/vp_fixes.test b/storage/spider/mysql-test/spider/t/vp_fixes.test
new file mode 100644
index 00000000..2c3e1523
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/vp_fixes.test
@@ -0,0 +1,335 @@
+# This test tests for VP's bug fixes
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+ CREATE DATABASE auto_test_remote2;
+ USE auto_test_remote2;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ --connection child2_2
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tb_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
+eval CREATE TABLE tb_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
+--enable_query_log
+INSERT INTO tb_l (a, b, c) VALUES
+ (1, 'a', '2008-08-01 10:21:39'),
+ (2, 'b', '2000-01-01 00:00:00'),
+ (3, 'e', '2007-06-04 20:03:11'),
+ (4, 'd', '2003-11-30 05:01:03'),
+ (5, 'c', '2001-12-31 23:59:59');
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l SELECT a, b, c FROM tb_l;
+
+--echo
+--echo 0.9
+--echo create different primary key table
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT AUTO_INCREMENT,
+ c INT DEFAULT 11,
+ PRIMARY KEY(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT AUTO_INCREMENT,
+ c INT DEFAULT 11,
+ PRIMARY KEY(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)`
+if ($MASTER_1_IS_VP)
+{
+ --error 14514
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+}
+if (!$MASTER_1_IS_VP)
+{
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+ --disable_query_log
+ --disable_result_log
+ TRUNCATE TABLE ta_l_int;
+ --enable_query_log
+ --enable_result_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES5;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo create un-correspond primary key table
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l_int;
+--enable_warnings
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_result_log
+ }
+ --disable_query_log
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES5;
+ --enable_query_log
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_query_log
+echo CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT DEFAULT 12,
+ c INT DEFAULT 11,
+ PRIMARY KEY(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE ta_l_int (
+ a INT DEFAULT 10,
+ b INT DEFAULT 12,
+ c INT DEFAULT 11,
+ PRIMARY KEY(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+if ($MASTER_1_IS_VP)
+{
+ --error 14514
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+}
+if (!$MASTER_1_IS_VP)
+{
+ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
+ --disable_query_log
+ --disable_result_log
+ TRUNCATE TABLE ta_l_int;
+ --enable_query_log
+ --enable_result_log
+}
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
+ }
+ eval $CHILD2_1_SELECT_TABLES5;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ --connection child2_2
+ DROP DATABASE IF EXISTS auto_test_remote2;
+}
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test