summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/analyze-format.inc2
-rw-r--r--mysql-test/include/ctype_casefolding.inc6
-rw-r--r--mysql-test/include/ctype_casefolding_supplementary.inc16
-rw-r--r--mysql-test/include/ctype_nopad_prefix_unique.inc85
-rw-r--r--mysql-test/include/expect_crash.inc4
-rw-r--r--mysql-test/include/explain_non_select.inc16
-rw-r--r--mysql-test/include/kill_galera.inc4
-rw-r--r--mysql-test/include/kill_mysqld.inc4
-rw-r--r--mysql-test/include/shutdown_mysqld.inc4
-rw-r--r--mysql-test/include/sql_mode_pad_char_to_full_length.inc31
-rw-r--r--mysql-test/lib/My/CoreDump.pm33
-rw-r--r--mysql-test/main/alter_table.result22
-rw-r--r--mysql-test/main/alter_table.test14
-rw-r--r--mysql-test/main/analyze_format_json.result177
-rw-r--r--mysql-test/main/analyze_format_json.test42
-rw-r--r--mysql-test/main/analyze_format_json_emb.result11
-rw-r--r--mysql-test/main/analyze_format_json_emb.test18
-rw-r--r--mysql-test/main/analyze_format_json_timings.result199
-rw-r--r--mysql-test/main/analyze_format_json_timings.test127
-rw-r--r--mysql-test/main/analyze_stmt_orderby.result10
-rw-r--r--mysql-test/main/bootstrap.result45
-rw-r--r--mysql-test/main/bootstrap.test108
-rw-r--r--mysql-test/main/cli_options_force_protocol_not_win.result20
-rw-r--r--mysql-test/main/cli_options_force_protocol_not_win.test34
-rw-r--r--mysql-test/main/cli_options_force_protocol_win.result25
-rw-r--r--mysql-test/main/cli_options_force_protocol_win.test38
-rw-r--r--mysql-test/main/ctype_ldml.result47
-rw-r--r--mysql-test/main/ctype_ldml.test7
-rw-r--r--mysql-test/main/ctype_uca_partitions.result40
-rw-r--r--mysql-test/main/ctype_uca_partitions.test32
-rw-r--r--mysql-test/main/ctype_ucs.result17
-rw-r--r--mysql-test/main/ctype_ucs.test12
-rw-r--r--mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result3
-rw-r--r--mysql-test/main/ctype_upgrade.result53
-rw-r--r--mysql-test/main/ctype_upgrade.test35
-rw-r--r--mysql-test/main/ctype_utf8_uca.result211
-rw-r--r--mysql-test/main/ctype_utf8_uca.test18
-rw-r--r--mysql-test/main/ctype_utf8mb4_uca.result165
-rw-r--r--mysql-test/main/ctype_utf8mb4_uca.test5
-rw-r--r--mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.result2927
-rw-r--r--mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.test15
-rw-r--r--mysql-test/main/derived.result63
-rw-r--r--mysql-test/main/derived.test54
-rw-r--r--mysql-test/main/derived_cond_pushdown.result97
-rw-r--r--mysql-test/main/derived_cond_pushdown.test30
-rw-r--r--mysql-test/main/derived_split_innodb.result585
-rw-r--r--mysql-test/main/derived_split_innodb.test247
-rw-r--r--mysql-test/main/derived_view.result550
-rw-r--r--mysql-test/main/derived_view.test359
-rw-r--r--mysql-test/main/disabled.def1
-rw-r--r--mysql-test/main/distinct.result51
-rw-r--r--mysql-test/main/distinct.test35
-rw-r--r--mysql-test/main/except.result20
-rw-r--r--mysql-test/main/except_all.result20
-rw-r--r--mysql-test/main/explain_innodb.result18
-rw-r--r--mysql-test/main/explain_innodb.test19
-rw-r--r--mysql-test/main/explain_json.result5
-rw-r--r--mysql-test/main/explain_non_select.result4
-rw-r--r--mysql-test/main/flush_corruption.result (renamed from mysql-test/main/merge-big.result)0
-rw-r--r--mysql-test/main/flush_corruption.test (renamed from mysql-test/main/merge-big.test)2
-rw-r--r--mysql-test/main/func_group.result9
-rw-r--r--mysql-test/main/func_group.test11
-rw-r--r--mysql-test/main/func_json.result20
-rw-r--r--mysql-test/main/func_json.test22
-rw-r--r--mysql-test/main/func_str.result9
-rw-r--r--mysql-test/main/func_str.test10
-rw-r--r--mysql-test/main/grant5.result9
-rw-r--r--mysql-test/main/grant5.test12
-rw-r--r--mysql-test/main/group_by.result10
-rw-r--r--mysql-test/main/group_by.test23
-rw-r--r--mysql-test/main/group_min_max.result12
-rw-r--r--mysql-test/main/group_min_max.test11
-rw-r--r--mysql-test/main/insert_innodb.result2
-rw-r--r--mysql-test/main/insert_innodb.test2
-rw-r--r--mysql-test/main/insert_returning.result10
-rw-r--r--mysql-test/main/insert_update.result42
-rw-r--r--mysql-test/main/insert_update.test27
-rw-r--r--mysql-test/main/intersect.result10
-rw-r--r--mysql-test/main/intersect_all.result10
-rw-r--r--mysql-test/main/join_cache.result24
-rw-r--r--mysql-test/main/join_cache_cardinality.result105
-rw-r--r--mysql-test/main/join_cache_cardinality.test41
-rw-r--r--mysql-test/main/join_nested_jcl6.result68
-rw-r--r--mysql-test/main/join_outer_jcl6.result22
-rw-r--r--mysql-test/main/kill-2.result31
-rw-r--r--mysql-test/main/kill-2.test27
-rw-r--r--mysql-test/main/locale.result52
-rw-r--r--mysql-test/main/locale.test40
-rw-r--r--mysql-test/main/long_unique_bugs.result6
-rw-r--r--mysql-test/main/long_unique_bugs.test7
-rw-r--r--mysql-test/main/myisam_explain_non_select_all.result193
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.result42
-rw-r--r--mysql-test/main/mysqlbinlog.test2
-rw-r--r--mysql-test/main/mysqld--help,win.rdiff12
-rw-r--r--mysql-test/main/mysqld--help.result8
-rw-r--r--mysql-test/main/mysqltest_tracking_info.result2
-rw-r--r--mysql-test/main/name_resolution_cache_debug.result25
-rw-r--r--mysql-test/main/name_resolution_cache_debug.test36
-rw-r--r--mysql-test/main/old-mode.result36
-rw-r--r--mysql-test/main/old-mode.test20
-rw-r--r--mysql-test/main/opt_trace.result682
-rw-r--r--mysql-test/main/opt_trace.test102
-rw-r--r--mysql-test/main/parser.result28
-rw-r--r--mysql-test/main/parser.test17
-rw-r--r--mysql-test/main/partition.result38
-rw-r--r--mysql-test/main/partition.test39
-rw-r--r--mysql-test/main/ps.result4
-rw-r--r--mysql-test/main/rowid_filter_innodb.result10
-rw-r--r--mysql-test/main/rownum.result33
-rw-r--r--mysql-test/main/rownum.test42
-rw-r--r--mysql-test/main/selectivity.result6
-rw-r--r--mysql-test/main/selectivity.test7
-rw-r--r--mysql-test/main/selectivity_innodb.result6
-rw-r--r--mysql-test/main/selectivity_innodb_notembedded.result104
-rw-r--r--mysql-test/main/selectivity_innodb_notembedded.test16
-rw-r--r--mysql-test/main/selectivity_no_engine.result29
-rw-r--r--mysql-test/main/selectivity_no_engine.test21
-rw-r--r--mysql-test/main/selectivity_notembedded.result95
-rw-r--r--mysql-test/main/selectivity_notembedded.test121
-rw-r--r--mysql-test/main/shutdown.test4
-rw-r--r--mysql-test/main/skr.result54
-rw-r--r--mysql-test/main/skr.test56
-rw-r--r--mysql-test/main/sql_mode_pad_char_to_full_length.result94
-rw-r--r--mysql-test/main/sql_mode_pad_char_to_full_length.test19
-rw-r--r--mysql-test/main/status.result19
-rw-r--r--mysql-test/main/status.test40
-rw-r--r--mysql-test/main/subselect.result262
-rw-r--r--mysql-test/main/subselect.test215
-rw-r--r--mysql-test/main/subselect3_jcl6.result8
-rw-r--r--mysql-test/main/subselect4.result4
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result262
-rw-r--r--mysql-test/main/subselect_no_mat.result262
-rw-r--r--mysql-test/main/subselect_no_opts.result262
-rw-r--r--mysql-test/main/subselect_no_scache.result262
-rw-r--r--mysql-test/main/subselect_no_semijoin.result262
-rw-r--r--mysql-test/main/subselect_sj.test6
-rw-r--r--mysql-test/main/subselect_sj2.result2
-rw-r--r--mysql-test/main/subselect_sj2.test3
-rw-r--r--mysql-test/main/subselect_sj2_jcl6.result23
-rw-r--r--mysql-test/main/subselect_sj2_mat.result22
-rw-r--r--mysql-test/main/subselect_sj_jcl6.result4
-rw-r--r--mysql-test/main/system_mysql_db_fix50030.result4
-rw-r--r--mysql-test/main/system_mysql_db_fix50117.result4
-rw-r--r--mysql-test/main/system_mysql_db_fix50568.result297
-rw-r--r--mysql-test/main/system_mysql_db_fix50568.test99
-rw-r--r--mysql-test/main/table_value_constr.result119
-rw-r--r--mysql-test/main/table_value_constr.test74
-rw-r--r--mysql-test/main/type_datetime.result4
-rw-r--r--mysql-test/main/type_time.result26
-rw-r--r--mysql-test/main/type_time.test19
-rw-r--r--mysql-test/main/update.result29
-rw-r--r--mysql-test/main/update.test23
-rw-r--r--mysql-test/main/view.result18
-rw-r--r--mysql-test/main/view.test19
-rwxr-xr-xmysql-test/mariadb-test-run.pl34
-rw-r--r--mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYDbin0 -> 60 bytes
-rw-r--r--mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYIbin0 -> 2048 bytes
-rw-r--r--mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.frmbin0 -> 982 bytes
-rw-r--r--mysql-test/std_data/rpl/master-bin-seq_10.3.36.000001bin0 -> 1245 bytes
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result4
-rw-r--r--mysql-test/suite/binlog/r/flashback.result4
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test9
-rw-r--r--mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc8
-rw-r--r--mysql-test/suite/binlog/t/flashback.test8
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.cnf (renamed from mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.cnf)0
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result (renamed from mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result)1
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test (renamed from mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test)30
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.cnf8
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result84
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test154
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_binlog_errors.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_checksum.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_checksum_cache.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_corruption.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_gtid_basic.result24
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_gtid_basic.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_incident.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_loaddata_local.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_loadfile.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_packet.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_relayrotate.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_semi_sync.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_skip_replication.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_special_charset.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_sporadic_master.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_ssl.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_sync.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_typeconv.test2
-rw-r--r--mysql-test/suite/encryption/r/import_4k.result10
-rw-r--r--mysql-test/suite/encryption/t/import_4k.opt1
-rw-r--r--mysql-test/suite/encryption/t/import_4k.test20
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test2
-rw-r--r--mysql-test/suite/events/disabled.def12
-rw-r--r--mysql-test/suite/events/events_1.result (renamed from mysql-test/main/events_1.result)0
-rw-r--r--mysql-test/suite/events/events_1.test (renamed from mysql-test/main/events_1.test)0
-rw-r--r--mysql-test/suite/events/events_2.result (renamed from mysql-test/main/events_2.result)0
-rw-r--r--mysql-test/suite/events/events_2.test (renamed from mysql-test/main/events_2.test)0
-rw-r--r--mysql-test/suite/events/events_bugs-master.opt (renamed from mysql-test/main/events_bugs-master.opt)0
-rw-r--r--mysql-test/suite/events/events_bugs.result (renamed from mysql-test/main/events_bugs.result)0
-rw-r--r--mysql-test/suite/events/events_bugs.test (renamed from mysql-test/main/events_bugs.test)0
-rw-r--r--mysql-test/suite/events/events_embedded.result (renamed from mysql-test/main/events_embedded.result)0
-rw-r--r--mysql-test/suite/events/events_embedded.test (renamed from mysql-test/main/events_embedded.test)0
-rw-r--r--mysql-test/suite/events/events_grant.result (renamed from mysql-test/main/events_grant.result)0
-rw-r--r--mysql-test/suite/events/events_grant.test (renamed from mysql-test/main/events_grant.test)0
-rw-r--r--mysql-test/suite/events/events_logs_tests-master.opt (renamed from mysql-test/main/events_logs_tests-master.opt)0
-rw-r--r--mysql-test/suite/events/events_logs_tests.result (renamed from mysql-test/main/events_logs_tests.result)0
-rw-r--r--mysql-test/suite/events/events_logs_tests.test (renamed from mysql-test/main/events_logs_tests.test)0
-rw-r--r--mysql-test/suite/events/events_microsec.result (renamed from mysql-test/main/events_microsec.result)0
-rw-r--r--mysql-test/suite/events/events_microsec.test (renamed from mysql-test/main/events_microsec.test)0
-rw-r--r--mysql-test/suite/events/events_restart-master.opt (renamed from mysql-test/main/events_restart-master.opt)0
-rw-r--r--mysql-test/suite/events/events_restart.result (renamed from mysql-test/main/events_restart.result)0
-rw-r--r--mysql-test/suite/events/events_restart.test (renamed from mysql-test/main/events_restart.test)0
-rw-r--r--mysql-test/suite/events/events_scheduling.result (renamed from mysql-test/main/events_scheduling.result)0
-rw-r--r--mysql-test/suite/events/events_scheduling.test (renamed from mysql-test/main/events_scheduling.test)0
-rw-r--r--mysql-test/suite/events/events_slowlog.result (renamed from mysql-test/main/events_slowlog.result)0
-rw-r--r--mysql-test/suite/events/events_slowlog.test (renamed from mysql-test/main/events_slowlog.test)0
-rw-r--r--mysql-test/suite/events/events_stress.result (renamed from mysql-test/main/events_stress.result)0
-rw-r--r--mysql-test/suite/events/events_stress.test (renamed from mysql-test/main/events_stress.test)0
-rw-r--r--mysql-test/suite/events/events_time_zone.result (renamed from mysql-test/main/events_time_zone.result)0
-rw-r--r--mysql-test/suite/events/events_time_zone.test (renamed from mysql-test/main/events_time_zone.test)0
-rw-r--r--mysql-test/suite/events/events_trans.result (renamed from mysql-test/main/events_trans.result)0
-rw-r--r--mysql-test/suite/events/events_trans.test (renamed from mysql-test/main/events_trans.test)0
-rw-r--r--mysql-test/suite/events/events_trans_notembedded.result (renamed from mysql-test/main/events_trans_notembedded.result)0
-rw-r--r--mysql-test/suite/events/events_trans_notembedded.test (renamed from mysql-test/main/events_trans_notembedded.test)0
-rw-r--r--mysql-test/suite/galera/galera_2x2nodes.cnf77
-rw-r--r--mysql-test/suite/galera/include/kill_galera.inc4
-rw-r--r--mysql-test/suite/galera/include/shutdown_mysqld.inc4
-rw-r--r--mysql-test/suite/galera/r/MDEV-30804.result11
-rw-r--r--mysql-test/suite/galera/r/MDEV-30955.result26
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache_invalidate.result119
-rw-r--r--mysql-test/suite/galera/r/galera_sequences.result61
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_aria_on.result5
-rw-r--r--mysql-test/suite/galera/r/galera_var_retry_autocommit.result12
-rw-r--r--mysql-test/suite/galera/r/mdev-26175.result24
-rw-r--r--mysql-test/suite/galera/t/MDEV-30804.cnf7
-rw-r--r--mysql-test/suite/galera/t/MDEV-30804.test21
-rw-r--r--mysql-test/suite/galera/t/MDEV-30955.test70
-rw-r--r--mysql-test/suite/galera/t/galera_ist_restart_joiner.test4
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf25
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_invalidate.test120
-rw-r--r--mysql-test/suite/galera/t/galera_sequences.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_sequences.test54
-rw-r--r--mysql-test/suite/galera/t/galera_var_replicate_aria_on.test8
-rw-r--r--mysql-test/suite/galera/t/galera_var_retry_autocommit.test19
-rw-r--r--mysql-test/suite/galera/t/mdev-26175.test27
-rw-r--r--mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf2
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-832.test4
-rw-r--r--mysql-test/suite/galera_sr/r/MDEV-30838.result15
-rw-r--r--mysql-test/suite/galera_sr/r/MDEV-30862.result11
-rw-r--r--mysql-test/suite/galera_sr/t/MDEV-30838.test18
-rw-r--r--mysql-test/suite/galera_sr/t/MDEV-30862.test24
-rw-r--r--mysql-test/suite/gcol/r/gcol_rollback.result21
-rw-r--r--mysql-test/suite/gcol/t/gcol_rollback.test23
-rw-r--r--mysql-test/suite/innodb/r/default_row_format_alter.result20
-rw-r--r--mysql-test/suite/innodb/r/full_crc32_import.result11
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522.result14
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_ctype_utf8.result98
-rw-r--r--mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result21
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_crash.result24
-rw-r--r--mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result51
-rw-r--r--mysql-test/suite/innodb/t/alter_crash.test4
-rw-r--r--mysql-test/suite/innodb/t/default_row_format_alter.test17
-rw-r--r--mysql-test/suite/innodb/t/full_crc32_import.test10
-rw-r--r--mysql-test/suite/innodb/t/import_tablespace_race.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-tempfile.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522.test21
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test10
-rw-r--r--mysql-test/suite/innodb/t/innodb_ctype_utf8.test12
-rw-r--r--mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test18
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_crash.test26
-rw-r--r--mysql-test/suite/innodb/t/purge_thread_shutdown.test4
-rw-r--r--mysql-test/suite/innodb/t/restart.test25
-rw-r--r--mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test18
-rw-r--r--mysql-test/suite/innodb/t/temporary_table.test4
-rw-r--r--mysql-test/suite/innodb_fts/r/concurrent_insert.result2
-rw-r--r--mysql-test/suite/innodb_fts/r/sync.result16
-rw-r--r--mysql-test/suite/innodb_fts/r/sync_block.result83
-rw-r--r--mysql-test/suite/innodb_fts/t/concurrent_insert.test2
-rw-r--r--mysql-test/suite/innodb_fts/t/sync.test7
-rw-r--r--mysql-test/suite/innodb_fts/t/sync_block.test124
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_optimize.result44
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_optimize.test44
-rw-r--r--mysql-test/suite/innodb_i_s/innodb_sys_indexes.result4
-rw-r--r--mysql-test/suite/maria/aria_log_dir_path.result29
-rw-r--r--mysql-test/suite/maria/aria_log_dir_path.test65
-rw-r--r--mysql-test/suite/maria/maria3.result1
-rw-r--r--mysql-test/suite/mariabackup/aria_log_dir_path.result41
-rw-r--r--mysql-test/suite/mariabackup/aria_log_dir_path.test105
-rw-r--r--mysql-test/suite/mariabackup/aria_log_dir_path_rel.result41
-rw-r--r--mysql-test/suite/mariabackup/aria_log_dir_path_rel.test4
-rw-r--r--mysql-test/suite/mariabackup/include/restart_and_restore.inc2
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.result7
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.test20
-rw-r--r--mysql-test/suite/mariabackup/relative_path.opt1
-rw-r--r--mysql-test/suite/mariabackup/relative_path.result20
-rw-r--r--mysql-test/suite/mariabackup/relative_path.test35
-rw-r--r--mysql-test/suite/merge/alter_table.result22
-rw-r--r--mysql-test/suite/merge/alter_table.test12
-rw-r--r--mysql-test/suite/merge/merge.result (renamed from mysql-test/main/merge.result)14
-rw-r--r--mysql-test/suite/merge/merge.test (renamed from mysql-test/main/merge.test)10
-rw-r--r--mysql-test/suite/merge/merge_debug.result (renamed from mysql-test/main/merge_debug.result)0
-rw-r--r--mysql-test/suite/merge/merge_debug.test (renamed from mysql-test/main/merge_debug.test)0
-rw-r--r--mysql-test/suite/merge/merge_innodb.result (renamed from mysql-test/main/merge_innodb.result)0
-rw-r--r--mysql-test/suite/merge/merge_innodb.test (renamed from mysql-test/main/merge_innodb.test)0
-rw-r--r--mysql-test/suite/merge/merge_mmap-master.opt (renamed from mysql-test/main/merge_mmap-master.opt)0
-rw-r--r--mysql-test/suite/merge/merge_mmap.result (renamed from mysql-test/main/merge_mmap.result)0
-rw-r--r--mysql-test/suite/merge/merge_mmap.test (renamed from mysql-test/main/merge_mmap.test)0
-rw-r--r--mysql-test/suite/perfschema/r/digest_view.result50
-rw-r--r--mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result41
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result4
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result120
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result180
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result120
-rw-r--r--mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result180
-rw-r--r--mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test62
-rw-r--r--mysql-test/suite/period/r/overlaps.result98
-rw-r--r--mysql-test/suite/period/t/overlaps.test110
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_install.result2
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result2
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result4
-rw-r--r--mysql-test/suite/plugins/r/locales.result4
-rw-r--r--mysql-test/suite/roles/role_grant_propagate.result13
-rw-r--r--mysql-test/suite/roles/role_grant_propagate.test11
-rw-r--r--mysql-test/suite/rpl/include/rpl_binlog_errors.inc443
-rw-r--r--mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc88
-rw-r--r--mysql-test/suite/rpl/include/rpl_checksum.inc342
-rw-r--r--mysql-test/suite/rpl/include/rpl_checksum_cache.inc261
-rw-r--r--mysql-test/suite/rpl/include/rpl_corruption.inc181
-rw-r--r--mysql-test/suite/rpl/include/rpl_gtid_basic.inc572
-rw-r--r--mysql-test/suite/rpl/include/rpl_incident.inc61
-rw-r--r--mysql-test/suite/rpl/include/rpl_init_slave_errors.inc96
-rw-r--r--mysql-test/suite/rpl/include/rpl_loadfile.inc120
-rw-r--r--mysql-test/suite/rpl/include/rpl_packet.inc184
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc115
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc38
-rw-r--r--mysql-test/suite/rpl/include/rpl_relayrotate.inc18
-rw-r--r--mysql-test/suite/rpl/include/rpl_semi_sync.inc532
-rw-r--r--mysql-test/suite/rpl/include/rpl_skip_replication.inc408
-rw-r--r--mysql-test/suite/rpl/include/rpl_special_charset.inc32
-rw-r--r--mysql-test/suite/rpl/include/rpl_sporadic_master.inc32
-rw-r--r--mysql-test/suite/rpl/include/rpl_ssl.inc116
-rw-r--r--mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc107
-rw-r--r--mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc633
-rw-r--r--mysql-test/suite/rpl/include/rpl_sync_test.inc159
-rw-r--r--mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc82
-rw-r--r--mysql-test/suite/rpl/include/rpl_typeconv.inc78
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_local.result (renamed from mysql-test/suite/rpl/r/rpl_loaddatalocal.result)0
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result81
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_seq.result85
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result51
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_errors.test444
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_index.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test89
-rw-r--r--mysql-test/suite/rpl/t/rpl_checksum.test343
-rw-r--r--mysql-test/suite/rpl/t/rpl_checksum_cache.test262
-rw-r--r--mysql-test/suite/rpl/t/rpl_corruption.test182
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_basic.test573
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_stop_start.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_incident.test62
-rw-r--r--mysql-test/suite/rpl/t/rpl_init_slave_errors.test97
-rw-r--r--mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_local.test (renamed from mysql-test/suite/rpl/include/rpl_loaddata_local.inc)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_loadfile.test121
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev12179.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev382.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test185
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test116
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test180
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_seq.test131
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test39
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayrotate.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test533
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_event.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_skip_replication.test409
-rw-r--r--mysql-test/suite/rpl/t/rpl_special_charset.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_sporadic_master.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl.test117
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test108
-rw-r--r--mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test634
-rw-r--r--mysql-test/suite/rpl/t/rpl_sync.test159
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test83
-rw-r--r--mysql-test/suite/rpl/t/rpl_typeconv.test79
-rw-r--r--mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test106
-rw-r--r--mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result36
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_client_basic.result11
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_connection_basic.result16
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_results_basic.resultbin16427 -> 16895 bytes
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_server_basic.result16
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_switch_basic.result32
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_aria.result12
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result16
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result16
-rw-r--r--mysql-test/suite/sys_vars/t/all_vars.test2
-rw-r--r--mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test35
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_client_basic.test9
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_connection_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_results_basic.test12
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_server_basic.test12
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_aria.test4
-rw-r--r--mysql-test/suite/sysschema/r/optimizer_switch.result1
-rw-r--r--mysql-test/suite/versioning/r/delete_history.result2
-rw-r--r--mysql-test/suite/versioning/r/rpl.result24
-rw-r--r--mysql-test/suite/versioning/t/rpl.test34
421 files changed, 19426 insertions, 6621 deletions
diff --git a/mysql-test/include/analyze-format.inc b/mysql-test/include/analyze-format.inc
index e65450ff001..7628156b205 100644
--- a/mysql-test/include/analyze-format.inc
+++ b/mysql-test/include/analyze-format.inc
@@ -1,3 +1,3 @@
# The time on ANALYSE FORMAT=JSON is rather variable
---replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms|r_query_time_in_progress_ms|r_unpack_time_ms|cost)": )[^, \n]*/\1"REPLACED"/
+--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size|cost)": )[^, \n]*/\1"REPLACED"/
diff --git a/mysql-test/include/ctype_casefolding.inc b/mysql-test/include/ctype_casefolding.inc
index 74b2ab7650a..fc77b396f68 100644
--- a/mysql-test/include/ctype_casefolding.inc
+++ b/mysql-test/include/ctype_casefolding.inc
@@ -21,6 +21,12 @@ INSERT INTO case_folding (code) VALUES
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
+
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
DROP TABLE case_folding;
diff --git a/mysql-test/include/ctype_casefolding_supplementary.inc b/mysql-test/include/ctype_casefolding_supplementary.inc
new file mode 100644
index 00000000000..7646ab5682e
--- /dev/null
+++ b/mysql-test/include/ctype_casefolding_supplementary.inc
@@ -0,0 +1,16 @@
+CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c, SPACE(64) AS comment LIMIT 0;
+SHOW CREATE TABLE case_folding;
+
+INSERT INTO case_folding (code, comment) VALUES (0x10595, 'VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x105BC, 'VITHKUQI SMALL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E921, 'ADLAM CAPITAL LETTER SHA (Unicode-9.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E943, 'ADLAM SMALL LETTER SHA (Unicode-9.0)');
+
+UPDATE case_folding SET c=CHAR(code USING utf32);
+SELECT
+ HEX(CONVERT(c USING utf32)) AS ch,
+ HEX(CONVERT(LOWER(c) USING utf32)) AS cl,
+ HEX(CONVERT(UPPER(c) USING utf32)) AS cu,
+ comment
+FROM case_folding ORDER BY BINARY(c);
+DROP TABLE case_folding;
diff --git a/mysql-test/include/ctype_nopad_prefix_unique.inc b/mysql-test/include/ctype_nopad_prefix_unique.inc
new file mode 100644
index 00000000000..b25128e9fef
--- /dev/null
+++ b/mysql-test/include/ctype_nopad_prefix_unique.inc
@@ -0,0 +1,85 @@
+--echo #
+--echo # MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations
+--echo #
+
+# TEXT
+
+if (`SELECT UPPER(@@storage_engine) != 'MEMORY'`)
+{
+EXECUTE IMMEDIATE REPLACE(
+ 'CREATE TABLE t1 ( '
+ ' a TEXT COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+ '<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ss ');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+
+
+EXECUTE IMMEDIATE REPLACE(
+ 'CREATE TABLE t1 ( '
+ ' a TEXT COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+ '<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ss ');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+}
+
+
+# VARCHAR
+
+EXECUTE IMMEDIATE REPLACE(
+ 'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+ '<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ss ');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+
+
+EXECUTE IMMEDIATE REPLACE(
+ 'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+ '<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ss ');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+
+# CHAR
+
+# MyISAM is buggy on CHAR+BTREE+UNIQUE+PREFIX (see MDEV-30048), disable for now
+# Other engines work fine
+
+if (`SELECT UPPER(@@storage_engine) != 'MYISAM'`)
+{
+EXECUTE IMMEDIATE REPLACE(
+ 'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+ '<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+}
+
+EXECUTE IMMEDIATE REPLACE(
+ 'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+ '<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
diff --git a/mysql-test/include/expect_crash.inc b/mysql-test/include/expect_crash.inc
index af8b0908104..b4bd9828a08 100644
--- a/mysql-test/include/expect_crash.inc
+++ b/mysql-test/include/expect_crash.inc
@@ -1,5 +1,5 @@
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
# There should be a debug crash after using this .inc file
--exec echo "wait" > $_expect_file_name
diff --git a/mysql-test/include/explain_non_select.inc b/mysql-test/include/explain_non_select.inc
index 8e60f582f9e..6caa093aab2 100644
--- a/mysql-test/include/explain_non_select.inc
+++ b/mysql-test/include/explain_non_select.inc
@@ -792,6 +792,22 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
DROP TABLE t1;
+--echo #75
+
+CREATE TABLE t1 (id INT PRIMARY KEY, i INT);
+--let $query = INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+--source include/explain_utils.inc
+DROP TABLE t1;
+
+--echo #76
+
+CREATE TABLE t1 (id INT PRIMARY KEY, i INT);
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (1,10), (3,10), (7,11), (3,11);
+--let $query = INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+--source include/explain_utils.inc
+DROP TABLE t1,t2;
+
--echo #
--echo # Bug #12949629: CLIENT LOSES CONNECTION AFTER EXECUTING A PROCEDURE WITH
--echo # EXPLAIN UPDATE/DEL/INS
diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc
index d7f665df6c7..aba672d8a89 100644
--- a/mysql-test/include/kill_galera.inc
+++ b/mysql-test/include/kill_galera.inc
@@ -1,8 +1,8 @@
--echo Killing server ...
# Write file to make mysql-test-run.pl expect the crash, but don't start it
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
# Kill the connected server
diff --git a/mysql-test/include/kill_mysqld.inc b/mysql-test/include/kill_mysqld.inc
index 86ee048a0f1..01ee7f82bdc 100644
--- a/mysql-test/include/kill_mysqld.inc
+++ b/mysql-test/include/kill_mysqld.inc
@@ -1,5 +1,5 @@
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--echo # Kill the server
--exec echo "wait" > $_expect_file_name
diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc
index db0cfb82c68..fc2972560c3 100644
--- a/mysql-test/include/shutdown_mysqld.inc
+++ b/mysql-test/include/shutdown_mysqld.inc
@@ -22,8 +22,8 @@ if ($rpl_inited)
}
# Write file to make mysql-test-run.pl expect the "crash", but don't start it
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
# Avoid warnings from connection threads that does not have time to exit
diff --git a/mysql-test/include/sql_mode_pad_char_to_full_length.inc b/mysql-test/include/sql_mode_pad_char_to_full_length.inc
new file mode 100644
index 00000000000..df03c4dbc28
--- /dev/null
+++ b/mysql-test/include/sql_mode_pad_char_to_full_length.inc
@@ -0,0 +1,31 @@
+--echo #
+--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+--echo #
+
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+
+
+SET sql_mode='';
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+SET sql_mode='pad_char_to_full_length';
+INSERT INTO t1 VALUES (0,0);
+DELETE FROM t1;
+DROP TABLE t1;
+
+
+SET sql_mode='';
+CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
+SHOW CREATE TABLE t1;
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index 05b6edf1385..be6d21146d1 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -310,16 +310,8 @@ sub cdb_check {
`cdb -? 2>&1`;
if ($? >> 8)
{
- print "Cannot find cdb. Please Install Debugging tools for Windows\n";
- print "from http://www.microsoft.com/whdc/devtools/debugging/";
- if($ENV{'ProgramW6432'})
- {
- print "install64bit.mspx (native x64 version)\n";
- }
- else
- {
- print "installx86.mspx\n";
- }
+ print "Cannot find the cdb debugger. Please install Debugging tools for Windows\n";
+ print "and set PATH environment variable to include location of cdb.exe";
}
}
@@ -328,25 +320,6 @@ sub _cdb {
my ($core_name, $format)= @_;
print "\nTrying 'cdb' to get a backtrace\n";
return unless -f $core_name;
-
- # Try to set environment for debugging tools for Windows
- if ($ENV{'PATH'} !~ /Debugging Tools/)
- {
- if ($ENV{'ProgramW6432'})
- {
- # On x64 computer
- $ENV{'PATH'}.= ";".$ENV{'ProgramW6432'}."\\Debugging Tools For Windows (x64)";
- }
- else
- {
- # On x86 computer. Newest versions of Debugging tools are installed in the
- # directory with (x86) suffix, older versions did not have this suffix.
- $ENV{'PATH'}.= ";".$ENV{'ProgramFiles'}."\\Debugging Tools For Windows (x86)";
- $ENV{'PATH'}.= ";".$ENV{'ProgramFiles'}."\\Debugging Tools For Windows";
- }
- }
-
-
# Read module list, find out the name of executable and
# build symbol path (required by cdb if executable was built on
# different machine)
@@ -384,7 +357,7 @@ sub _cdb {
if (!$ENV{'_NT_SYMBOL_PATH'})
{
my $windir= $ENV{'windir'};
- my $symbol_cache= substr($windir ,0, index($windir,'\\'))."\\cdb_symbols";
+ my $symbol_cache= substr($windir ,0, index($windir,'\\'))."\\symbols";
print "OS debug symbols will be downloaded and stored in $symbol_cache.\n";
print "You can control the location of symbol cache with _NT_SYMBOL_PATH\n";
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 879bc0edfec..1508bb9d34a 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -268,28 +268,6 @@ ERROR 42000: Incorrect table name ''
rename table t1 to ``;
ERROR 42000: Incorrect table name ''
drop table t1;
-drop table if exists t1, t2;
-Warnings:
-Note 1051 Unknown table 'test.t1,test.t2'
-create table t1 ( a varchar(10) not null primary key ) engine=myisam;
-create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
-flush tables;
-alter table t1 modify a varchar(10);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` varchar(10) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`)
-flush tables;
-alter table t1 modify a varchar(10) not null;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` varchar(10) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`)
-drop table if exists t1, t2;
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
insert ignore into t1 (a) values(1);
Warnings:
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index 8ddf60f26d8..ebf10008f48 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -244,20 +244,6 @@ alter table t1 rename to ``;
rename table t1 to ``;
drop table t1;
-#
-# BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns
-#
-drop table if exists t1, t2;
-create table t1 ( a varchar(10) not null primary key ) engine=myisam;
-create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
-flush tables;
-alter table t1 modify a varchar(10);
-show create table t2;
-flush tables;
-alter table t1 modify a varchar(10) not null;
-show create table t2;
-drop table if exists t1, t2;
-
# The following is also part of bug #6236 (CREATE TABLE didn't properly count
# not null columns for primary keys)
diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result
index 02635a8f3dd..0e1ea88404b 100644
--- a/mysql-test/main/analyze_format_json.result
+++ b/mysql-test/main/analyze_format_json.result
@@ -201,8 +201,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "1Kb",
"join_type": "BNL",
+ "r_loops": 20,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 60
}
}
]
@@ -257,8 +260,11 @@ ANALYZE
"buffer_size": "1Kb",
"join_type": "BNL",
"attached_condition": "tbl1.c > tbl2.c",
+ "r_loops": 20,
"r_filtered": 15.83333333,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 60
}
}
]
@@ -836,8 +842,11 @@ ANALYZE
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
+ "r_loops": 2,
"r_filtered": null,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 0
}
}
],
@@ -950,8 +959,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "1",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": null,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 0
}
}
],
@@ -994,8 +1006,11 @@ ANALYZE
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t2.f2 = t3.f3",
+ "r_loops": 0,
"r_filtered": null,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": null
}
}
]
@@ -1089,3 +1104,155 @@ ANALYZE
}
}
drop table t0,t1,t2;
+#
+# MDEV-30806: ANALYZE FORMAT=JSON: better support for BNL and BNL-H joins
+#
+create table t10 (
+a int,
+b int
+);
+insert into t10 select seq, seq/3 from seq_0_to_999;
+create table t11 (
+a int,
+b int
+);
+insert into t11 select seq, seq/5 from seq_0_to_999;
+analyze table t10,t11 persistent for all;
+Table Op Msg_type Msg_text
+test.t10 analyze status Engine-independent statistics collected
+test.t10 analyze status OK
+test.t11 analyze status Engine-independent statistics collected
+test.t11 analyze status OK
+analyze format=json
+select * from t10, t11
+where
+t10.a < 700 and
+t11.a < 100
+and t10.b=t11.b;
+ANALYZE
+{
+ "query_optimization": {
+ "r_total_time_ms": "REPLACED"
+ },
+ "query_block": {
+ "select_id": 1,
+ "cost": "REPLACED",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t11",
+ "access_type": "ALL",
+ "loops": 1,
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10,
+ "r_filtered": 10,
+ "attached_condition": "t11.a < 100"
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t10",
+ "access_type": "ALL",
+ "loops": 100,
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 70,
+ "r_filtered": 70,
+ "attached_condition": "t10.a < 700"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL",
+ "attached_condition": "t10.b = t11.b",
+ "r_loops": 100,
+ "r_filtered": 0.424285714,
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 700
+ }
+ }
+ ]
+ }
+}
+set @tmp=@@join_cache_level, join_cache_level=6;
+analyze format=json
+select * from t10, t11
+where
+t10.a < 700 and
+t11.a < 100
+and t10.b=t11.b;
+ANALYZE
+{
+ "query_optimization": {
+ "r_total_time_ms": "REPLACED"
+ },
+ "query_block": {
+ "select_id": 1,
+ "cost": "REPLACED",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t11",
+ "access_type": "ALL",
+ "loops": 1,
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10,
+ "r_filtered": 10,
+ "attached_condition": "t11.a < 100 and t11.b is not null"
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t10",
+ "access_type": "hash_ALL",
+ "key": "#hash#$hj",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t11.b"],
+ "loops": 100,
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 0.209580004,
+ "r_filtered": 70,
+ "attached_condition": "t10.a < 700"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "3Kb",
+ "join_type": "BNLH",
+ "attached_condition": "t10.b = t11.b",
+ "r_loops": 100,
+ "r_filtered": 100,
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 2.97
+ }
+ }
+ ]
+ }
+}
+set join_cache_level=@tmp;
+drop table t10, t11;
diff --git a/mysql-test/main/analyze_format_json.test b/mysql-test/main/analyze_format_json.test
index 84625f125fb..001616304cf 100644
--- a/mysql-test/main/analyze_format_json.test
+++ b/mysql-test/main/analyze_format_json.test
@@ -228,3 +228,45 @@ create table t2 as select * from t1;
--source include/analyze-format.inc
analyze format=json select a, (select t2.b from t2 where t2.a<t1.a order by t2.c limit 1) from t1 where t1.a<0;
drop table t0,t1,t2;
+
+
+--echo #
+--echo # MDEV-30806: ANALYZE FORMAT=JSON: better support for BNL and BNL-H joins
+--echo #
+--source include/have_sequence.inc
+create table t10 (
+ a int,
+ b int
+);
+insert into t10 select seq, seq/3 from seq_0_to_999;
+
+create table t11 (
+ a int,
+ b int
+);
+insert into t11 select seq, seq/5 from seq_0_to_999;
+
+analyze table t10,t11 persistent for all;
+
+--source include/analyze-format.inc
+analyze format=json
+select * from t10, t11
+where
+ t10.a < 700 and
+ t11.a < 100
+ and t10.b=t11.b;
+
+set @tmp=@@join_cache_level, join_cache_level=6;
+
+--source include/analyze-format.inc
+analyze format=json
+select * from t10, t11
+where
+ t10.a < 700 and
+ t11.a < 100
+ and t10.b=t11.b;
+
+set join_cache_level=@tmp;
+drop table t10, t11;
+
+
diff --git a/mysql-test/main/analyze_format_json_emb.result b/mysql-test/main/analyze_format_json_emb.result
new file mode 100644
index 00000000000..d61e205f031
--- /dev/null
+++ b/mysql-test/main/analyze_format_json_emb.result
@@ -0,0 +1,11 @@
+#
+# MDEV-31121: ANALYZE statement produces 0 for all timings in embedded serve
+#
+create table t1 (a int);
+insert into t1 values (0),(0);
+set @js='$out';
+set @out=(select json_extract(@js,'$**.query_block.r_total_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+cast(json_extract(@out,'$[0]') as DOUBLE) > 0
+1
+drop table t1;
diff --git a/mysql-test/main/analyze_format_json_emb.test b/mysql-test/main/analyze_format_json_emb.test
new file mode 100644
index 00000000000..dcf6f24dd8e
--- /dev/null
+++ b/mysql-test/main/analyze_format_json_emb.test
@@ -0,0 +1,18 @@
+--source include/is_embedded.inc
+--source include/big_test.inc
+
+--echo #
+--echo # MDEV-31121: ANALYZE statement produces 0 for all timings in embedded serve
+--echo #
+create table t1 (a int);
+insert into t1 values (0),(0);
+let $out=`
+analyze format=json select sleep(1+a) from t1
+`;
+
+evalp set @js='$out';
+set @out=(select json_extract(@js,'$**.query_block.r_total_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+
+drop table t1;
+
diff --git a/mysql-test/main/analyze_format_json_timings.result b/mysql-test/main/analyze_format_json_timings.result
new file mode 100644
index 00000000000..4686359186e
--- /dev/null
+++ b/mysql-test/main/analyze_format_json_timings.result
@@ -0,0 +1,199 @@
+#
+# MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins
+#
+#
+# First, check a regular BNL-join
+#
+create table t1 (
+a int,
+b int
+);
+insert into t1 select seq, seq/3 from seq_0_to_99;
+create table t2 (
+a int,
+b int
+);
+insert into t2 select seq, seq/5 from seq_0_to_99;
+set @js='$out';
+set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+cast(json_extract(@out,'$[0]') as DOUBLE) > 0
+1
+drop table t1,t2;
+#
+# Now, check the hashed, BNL-H join
+#
+create table t1 (
+a int,
+b int
+);
+insert into t1 select seq, seq/3 from seq_0_to_499;
+create table t2 (
+a int,
+b int
+);
+insert into t2 select seq, seq/5 from seq_0_to_499;
+set @tmp=@@join_cache_level, join_cache_level=6;
+select '$out' as X;
+X
+{
+ "query_optimization": {
+ "r_total_time_ms": "REPLACED"
+ },
+ "query_block": {
+ "select_id": 1,
+ "cost": "REPLACED",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "loops": 1,
+ "r_loops": 1,
+ "rows": 500,
+ "r_rows": 500,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.a < 700 and t1.b is not null"
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "hash_ALL",
+ "key": "#hash#$hj",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.b"],
+ "loops": 500,
+ "r_loops": 1,
+ "rows": 500,
+ "r_rows": 500,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10,
+ "r_filtered": 20,
+ "attached_condition": "t2.a < 100"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "18Kb",
+ "join_type": "BNLH",
+ "attached_condition": "t2.b = t1.b",
+ "r_loops": 500,
+ "r_filtered": 100,
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 0.594
+ }
+ }
+ ]
+ }
+}
+set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+cast(json_extract(@out,'$[0]') as DOUBLE) > 0
+1
+set join_cache_level=@tmp;
+drop table t1, t2;
+#
+# MDEV-30972: ANALYZE FORMAT=JSON: some time is unaccounted-for in BNL-H join
+#
+create table t1 (
+a int,
+col1 varchar(100),
+col2 varchar(100),
+col3 varchar(100)
+);
+insert into t1 select
+seq/100,
+concat('col1-', seq),
+concat('col1-', seq),
+concat('col1-', seq)
+from seq_1_to_1000;
+create table t2 (
+a int,
+col1 varchar(100),
+col2 varchar(100),
+col3 varchar(100)
+);
+insert into t2 select
+seq/100,
+concat('col1-', seq),
+concat('col1-', seq),
+concat('col1-', seq)
+from seq_1_to_2000;
+set @tmp=@@join_cache_level, join_cache_level=6;
+select '$out' as X;
+X
+{
+ "query_optimization": {
+ "r_total_time_ms": "REPLACED"
+ },
+ "query_block": {
+ "select_id": 1,
+ "cost": "REPLACED",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "loops": 1,
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "hash_ALL",
+ "key": "#hash#$hj",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "loops": 1000,
+ "r_loops": 1,
+ "rows": 2000,
+ "r_rows": 2000,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNLH",
+ "attached_condition": "t2.a = t1.a and concat(t1.col1,t1.col2,t1.col3) = concat(t2.col1,t2.col2,t2.col3)",
+ "r_loops": 1000,
+ "r_filtered": 1.025630506,
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 97.501
+ }
+ }
+ ]
+ }
+}
+set @out=(select json_extract(@js,'$**.block-nl-join.r_other_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+cast(json_extract(@out,'$[0]') as DOUBLE) > 0
+1
+set join_cache_level=@tmp;
+drop table t1, t2;
diff --git a/mysql-test/main/analyze_format_json_timings.test b/mysql-test/main/analyze_format_json_timings.test
new file mode 100644
index 00000000000..fe02c318388
--- /dev/null
+++ b/mysql-test/main/analyze_format_json_timings.test
@@ -0,0 +1,127 @@
+#
+# Tests to check that r_something_time_ms is non-zero in
+# ANALYZE FORMAT=JSON <statement>
+#
+--source include/default_optimizer_switch.inc
+--source include/have_sequence.inc
+
+# The tests here are large so that we get non-zero timings
+--source include/big_test.inc
+
+--echo #
+--echo # MDEV-30830: ANALYZE FORMAT=JSON: r_unpack_time_ms is empty for the hashed joins
+--echo #
+
+--echo #
+--echo # First, check a regular BNL-join
+--echo #
+create table t1 (
+ a int,
+ b int
+);
+insert into t1 select seq, seq/3 from seq_0_to_99;
+
+create table t2 (
+ a int,
+ b int
+);
+insert into t2 select seq, seq/5 from seq_0_to_99;
+
+let $out=`
+analyze format=json
+select * from t1, t2
+where
+ t1.a < 700 and
+ t2.a < 100
+ and t1.b=t2.b
+`;
+
+evalp set @js='$out';
+set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+drop table t1,t2;
+
+--echo #
+--echo # Now, check the hashed, BNL-H join
+--echo #
+create table t1 (
+ a int,
+ b int
+);
+insert into t1 select seq, seq/3 from seq_0_to_499;
+
+create table t2 (
+ a int,
+ b int
+);
+insert into t2 select seq, seq/5 from seq_0_to_499;
+set @tmp=@@join_cache_level, join_cache_level=6;
+
+let $out=`
+analyze format=json
+select * from t1, t2
+where
+ t1.a < 700 and
+ t2.a < 100
+ and t1.b=t2.b
+`;
+
+--source include/analyze-format.inc
+evalp select '$out' as X;
+
+set @out=(select json_extract(@js,'$**.block-nl-join.r_unpack_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+
+set join_cache_level=@tmp;
+drop table t1, t2;
+
+--echo #
+--echo # MDEV-30972: ANALYZE FORMAT=JSON: some time is unaccounted-for in BNL-H join
+--echo #
+
+create table t1 (
+ a int,
+ col1 varchar(100),
+ col2 varchar(100),
+ col3 varchar(100)
+);
+
+insert into t1 select
+ seq/100,
+ concat('col1-', seq),
+ concat('col1-', seq),
+ concat('col1-', seq)
+from seq_1_to_1000;
+
+create table t2 (
+ a int,
+ col1 varchar(100),
+ col2 varchar(100),
+ col3 varchar(100)
+);
+
+insert into t2 select
+ seq/100,
+ concat('col1-', seq),
+ concat('col1-', seq),
+ concat('col1-', seq)
+from seq_1_to_2000;
+
+set @tmp=@@join_cache_level, join_cache_level=6;
+
+let $out=`
+analyze format=json
+select * from t1, t2
+where
+ t1.a=t2.a
+ and concat(t1.col1, t1.col2, t1.col3)= concat(t2.col1, t2.col2, t2.col3)
+`;
+--source include/analyze-format.inc
+evalp select '$out' as X;
+
+set @out=(select json_extract(@js,'$**.block-nl-join.r_other_time_ms'));
+select cast(json_extract(@out,'$[0]') as DOUBLE) > 0;
+
+set join_cache_level=@tmp;
+drop table t1, t2;
+
diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result
index c3a3f2c562e..7008ad8dea3 100644
--- a/mysql-test/main/analyze_stmt_orderby.result
+++ b/mysql-test/main/analyze_stmt_orderby.result
@@ -522,8 +522,11 @@ ANALYZE
"buffer_size": "65",
"join_type": "BNL",
"attached_condition": "t3.a = t0.a",
+ "r_loops": 10,
"r_filtered": 10,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 10
}
}
]
@@ -612,8 +615,11 @@ ANALYZE
"buffer_size": "119",
"join_type": "BNL",
"attached_condition": "t5.a = t6.a",
+ "r_loops": 4,
"r_filtered": 21.42857143,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 7
}
}
]
diff --git a/mysql-test/main/bootstrap.result b/mysql-test/main/bootstrap.result
index fd9b4726cb6..cfff13136d6 100644
--- a/mysql-test/main/bootstrap.result
+++ b/mysql-test/main/bootstrap.result
@@ -1,15 +1,28 @@
-drop table if exists t1;
+#
+# test mysqld in bootstrap mode
+#
+#
+# Check that --bootstrap reads from stdin
+#
# Kill the server
# restart
drop table t1;
+#
+# Check that --bootstrap of file with SQL error returns error
+#
# Kill the server
# restart
drop table t1;
ERROR 42S02: Unknown table 'test.t1'
+#
+# Bootstrap with a large thd->net.max_packet
+#
# Kill the server
# restart
drop table t1;
-End of 5.1 tests
+#
+# End of 5.1 tests
+#
#
# Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
# STARTED WITH --SKIP-INNODB
@@ -18,9 +31,23 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES';
# Kill the server
+#
+# MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
+#
+#
+# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check
+#
# restart
-End of 5.5 tests
+#
+# End of 5.5 tests
+#
+#
+# Check that --bootstrap can install and uninstall plugins
+#
# Kill the server
+#
+# Check that installed plugins are *not* automatically loaded in --bootstrap
+#
# restart
flush tables;
show create table t1;
@@ -35,6 +62,18 @@ EXAMPLE ha_example.so
truncate table mysql.plugin;
# Kill the server
#
+# MDEV-9969 mysql_install_db error processing ignore_db_dirs.
+#
+#
+# MDEV-13397 MariaDB upgrade fail when using default_time_zone
+#
+#
+# MDEV-30818 invalid ssl prevents bootstrap
+#
+#
+# End of 10.3 tests
+#
+#
# MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode
#
#
diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test
index f7bddf23408..d7cc8e36d56 100644
--- a/mysql-test/main/bootstrap.test
+++ b/mysql-test/main/bootstrap.test
@@ -1,17 +1,20 @@
+--echo #
+--echo # test mysqld in bootstrap mode
+--echo #
--source include/not_embedded.inc
-#
-# test mysqld in bootstrap mode
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
+--source include/have_example_plugin.inc
+
+--let test_bootstrap=$MYSQLTEST_VARDIR/tmp/test_bootstrap.sql
+--write_file $test_bootstrap
+use test;
+EOF
# Add the datadir to the bootstrap command
let $MYSQLD_DATADIR= `select @@datadir`;
let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --tmpdir=$MYSQL_TMP_DIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown;
-#
-# Check that --bootstrap reads from stdin
-#
+--echo #
+--echo # Check that --bootstrap reads from stdin
+--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
use test;
CREATE TABLE t1(a int);
@@ -21,9 +24,9 @@ EOF
--source include/start_mysqld.inc
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
-#
-# Check that --bootstrap of file with SQL error returns error
-#
+--echo #
+--echo # Check that --bootstrap of file with SQL error returns error
+--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
use test;
CREATE TABLE t1;
@@ -37,9 +40,9 @@ EOF
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
-#
-# Bootstrap with a large thd->net.max_packet
-#
+--echo #
+--echo # Bootstrap with a large thd->net.max_packet
+--echo #
--disable_query_log
create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b;
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
@@ -51,7 +54,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql;
--source include/start_mysqld.inc
drop table t1;
---echo End of 5.1 tests
+--echo #
+--echo # End of 5.1 tests
+--echo #
--echo #
--echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
@@ -63,29 +68,25 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES';
--source include/kill_mysqld.inc
-#
-# MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
-#
+--echo #
+--echo # MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
+--echo #
--error 1
--exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE
-#
-# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check
-#
---write_file $MYSQLTEST_VARDIR/tmp/1
-use test;
-EOF
---exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/1 >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/1
+--echo #
+--echo # MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check
+--echo #
+--exec $MYSQLD_BOOTSTRAP_CMD < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--source include/start_mysqld.inc
---echo End of 5.5 tests
+--echo #
+--echo # End of 5.5 tests
+--echo #
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
-#
-# Check that --bootstrap can install and uninstall plugins
-#
+--echo #
+--echo # Check that --bootstrap can install and uninstall plugins
+--echo #
let $PLUGIN_DIR=`select @@plugin_dir`;
--source include/kill_mysqld.inc
--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
@@ -95,9 +96,9 @@ EOF
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
-#
-# Check that installed plugins are *not* automatically loaded in --bootstrap
-#
+--echo #
+--echo # Check that installed plugins are *not* automatically loaded in --bootstrap
+--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
SET SQL_MODE="";
use test;
@@ -113,25 +114,25 @@ drop table t1;
select * from mysql.plugin;
truncate table mysql.plugin;
-
-#
-# MDEV-9969 mysql_install_db error processing ignore_db_dirs.
-#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
-use test;
-EOF
--source include/kill_mysqld.inc
---exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
+--echo #
+--echo # MDEV-9969 mysql_install_db error processing ignore_db_dirs.
+--echo #
+--exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
-#
-# MDEV-13397 MariaDB upgrade fail when using default_time_zone
-#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
-use test;
-EOF
---exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
+--echo #
+--echo # MDEV-13397 MariaDB upgrade fail when using default_time_zone
+--echo #
+--exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+
+--echo #
+--echo # MDEV-30818 invalid ssl prevents bootstrap
+--echo #
+--exec $MYSQLD_BOOTSTRAP_CMD --ssl-ca=/dev/nonexistent < $test_bootstrap >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
--echo #
--echo # MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap mode
@@ -160,3 +161,4 @@ EOF
# restore
--source include/start_mysqld.inc
+--remove_file $test_bootstrap
diff --git a/mysql-test/main/cli_options_force_protocol_not_win.result b/mysql-test/main/cli_options_force_protocol_not_win.result
index 20b12eb2cc0..46ee29dc509 100644
--- a/mysql-test/main/cli_options_force_protocol_not_win.result
+++ b/mysql-test/main/cli_options_force_protocol_not_win.result
@@ -4,21 +4,19 @@
#
# The following group of tests should produce no warnings
#
-# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
+# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket
-# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
+# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
Connection: localhost via TCP/IP
-# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
+# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket
-# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
+# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
Connection: 127.0.0.1 via TCP/IP
-# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
+# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
+Connection: localhost via TCP/IP
+# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket
-# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
+# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket
-#
-# The remaining tests should produce warnings
-#
-# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
-WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol.
+# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
Connection: localhost via TCP/IP
diff --git a/mysql-test/main/cli_options_force_protocol_not_win.test b/mysql-test/main/cli_options_force_protocol_not_win.test
index a3c495f26ee..a92f6b93c4d 100644
--- a/mysql-test/main/cli_options_force_protocol_not_win.test
+++ b/mysql-test/main/cli_options_force_protocol_not_win.test
@@ -10,28 +10,26 @@
--echo # The following group of tests should produce no warnings
--echo #
---echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
---echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
---echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
---echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
---echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=localhost --port=MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
+--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
---echo #
---echo # The remaining tests should produce warnings
---echo #
-
---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
---exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
+--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
+--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
diff --git a/mysql-test/main/cli_options_force_protocol_win.result b/mysql-test/main/cli_options_force_protocol_win.result
index 4fffc2a4837..eedfde4f1de 100644
--- a/mysql-test/main/cli_options_force_protocol_win.result
+++ b/mysql-test/main/cli_options_force_protocol_win.result
@@ -1,24 +1,17 @@
#
# MDEV-14974: --port ignored for --host=localhost
#
-#
-# The following group of tests should produce no warnings
-#
-# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP
-# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP
-# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP
-# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
-Connection: localhost via named pipe
-# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
-Connection: localhost via named pipe
-# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe
-#
-# The remaining tests should produce warnings
-#
-# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
-WARNING: Forcing protocol to PIPE due to option specification. Please explicitly state intended protocol.
+# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe
+# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
+Connection: localhost via TCP/IP
+# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
+Connection: localhost via TCP/IP
diff --git a/mysql-test/main/cli_options_force_protocol_win.test b/mysql-test/main/cli_options_force_protocol_win.test
index 54fbb78e5dc..63024f3b620 100644
--- a/mysql-test/main/cli_options_force_protocol_win.test
+++ b/mysql-test/main/cli_options_force_protocol_win.test
@@ -5,33 +5,23 @@
--source include/not_embedded.inc
--source include/windows.inc
+--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
---echo #
---echo # The following group of tests should produce no warnings
---echo #
-
---echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
-
---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
---echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
---echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+--echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
---echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+--echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
---echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
-
-
---echo #
---echo # The remaining tests should produce warnings
---echo #
+--echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
---echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
---exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
+--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
+--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
diff --git a/mysql-test/main/ctype_ldml.result b/mysql-test/main/ctype_ldml.result
index a23e835d1fa..31508fcd1b1 100644
--- a/mysql-test/main/ctype_ldml.result
+++ b/mysql-test/main/ctype_ldml.result
@@ -3074,6 +3074,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -3091,6 +3096,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
#
# End of 10.3 tests
@@ -3267,6 +3276,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -3284,6 +3298,39 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B19F E2B0AF Ⱟ
+2C5F E2B19F E2B0AF ⱟ
+A7C0 EA9F81 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F80 ꟁ
+DROP TABLE case_folding;
+#
+# MDEV-30577 Case folding for uca1400 collations is not up to date
+#
+SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_test01_as_ci;
+CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c, SPACE(64) AS comment LIMIT 0;
+SHOW CREATE TABLE case_folding;
+Table Create Table
+case_folding CREATE TABLE `case_folding` (
+ `code` int(1) NOT NULL,
+ `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_test01_as_ci DEFAULT NULL,
+ `comment` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_test01_as_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO case_folding (code, comment) VALUES (0x10595, 'VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x105BC, 'VITHKUQI SMALL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E921, 'ADLAM CAPITAL LETTER SHA (Unicode-9.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E943, 'ADLAM SMALL LETTER SHA (Unicode-9.0)');
+UPDATE case_folding SET c=CHAR(code USING utf32);
+SELECT
+HEX(CONVERT(c USING utf32)) AS ch,
+HEX(CONVERT(LOWER(c) USING utf32)) AS cl,
+HEX(CONVERT(UPPER(c) USING utf32)) AS cu,
+comment
+FROM case_folding ORDER BY BINARY(c);
+ch cl cu comment
+00010595 000105BC 00010595 VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)
+000105BC 000105BC 00010595 VITHKUQI SMALL LETTER ZE (Unicode-14.0)
+0001E921 0001E943 0001E921 ADLAM CAPITAL LETTER SHA (Unicode-9.0)
+0001E943 0001E943 0001E921 ADLAM SMALL LETTER SHA (Unicode-9.0)
DROP TABLE case_folding;
#
# End of 10.10 tests
diff --git a/mysql-test/main/ctype_ldml.test b/mysql-test/main/ctype_ldml.test
index 6336a1d0f5f..9189630e5a3 100644
--- a/mysql-test/main/ctype_ldml.test
+++ b/mysql-test/main/ctype_ldml.test
@@ -705,5 +705,12 @@ SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_test01_as_ci;
--source include/ctype_casefolding.inc
--echo #
+--echo # MDEV-30577 Case folding for uca1400 collations is not up to date
+--echo #
+
+SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_test01_as_ci;
+--source include/ctype_casefolding_supplementary.inc
+
+--echo #
--echo # End of 10.10 tests
--echo #
diff --git a/mysql-test/main/ctype_uca_partitions.result b/mysql-test/main/ctype_uca_partitions.result
index 677b68e2387..486e848e191 100644
--- a/mysql-test/main/ctype_uca_partitions.result
+++ b/mysql-test/main/ctype_uca_partitions.result
@@ -84,3 +84,43 @@ O
P
Y
DROP TABLE t1;
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-30072 Wrong ORDER BY for a partitioned prefix key + NOPAD
+#
+SET NAMES utf8mb4;
+CREATE TABLE t1
+(
+id INT,
+data VARCHAR(20),
+KEY data_id (data,id)
+) COLLATE utf8mb3_unicode_nopad_ci ENGINE=MyISAM
+PARTITION BY RANGE COLUMNS (id)
+(
+PARTITION p10 VALUES LESS THAN (20),
+PARTITION p20 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (30, 'ss '), (10, 'ß ');
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id;
+id
+10
+30
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC;
+id
+30
+10
+ALTER TABLE t1 DROP KEY data_id, ADD KEY data_id2(data(10),id);
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id;
+id
+10
+30
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC;
+id
+30
+10
+DROP TABLE t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/ctype_uca_partitions.test b/mysql-test/main/ctype_uca_partitions.test
index 5734bb52008..81f1a091574 100644
--- a/mysql-test/main/ctype_uca_partitions.test
+++ b/mysql-test/main/ctype_uca_partitions.test
@@ -36,3 +36,35 @@ SELECT * FROM t1 PARTITION (p0) ORDER BY c1;
SELECT * FROM t1 PARTITION (p1) ORDER BY c1;
SELECT * FROM t1 PARTITION (p2) ORDER BY c1;
DROP TABLE t1;
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-30072 Wrong ORDER BY for a partitioned prefix key + NOPAD
+--echo #
+
+SET NAMES utf8mb4;
+CREATE TABLE t1
+(
+ id INT,
+ data VARCHAR(20),
+ KEY data_id (data,id)
+) COLLATE utf8mb3_unicode_nopad_ci ENGINE=MyISAM
+PARTITION BY RANGE COLUMNS (id)
+(
+ PARTITION p10 VALUES LESS THAN (20),
+ PARTITION p20 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (30, 'ss '), (10, 'ß ');
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id;
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC;
+ALTER TABLE t1 DROP KEY data_id, ADD KEY data_id2(data(10),id);
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id;
+SELECT id FROM t1 WHERE data='ss ' ORDER BY id DESC;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result
index 987f1b704fd..f4ca4089e55 100644
--- a/mysql-test/main/ctype_ucs.result
+++ b/mysql-test/main/ctype_ucs.result
@@ -6439,6 +6439,23 @@ IS_IPV4('10.0.0.1')
1
SET NAMES utf8;
#
+# MDEV-30746 Regression in ucs2_general_mysql500_ci
+#
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_general_mysql500_ci);
+INSERT INTO t1 VALUES ('s'),('z'),(_latin1 0xDF);
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a;
+GROUP_CONCAT(a)
+s
+z
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+a HEX(a) HEX(WEIGHT_STRING(a))
+s 0073 0053
+z 007A 005A
+ß 00DF 00DF
+DROP TABLE t1;
+#
# End of 10.4 tests
#
#
diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test
index 20e2ea3908d..b77636507dd 100644
--- a/mysql-test/main/ctype_ucs.test
+++ b/mysql-test/main/ctype_ucs.test
@@ -1141,6 +1141,18 @@ SELECT IS_IPV4('10.0.0.1');
SET NAMES utf8;
--echo #
+--echo # MDEV-30746 Regression in ucs2_general_mysql500_ci
+--echo #
+
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_general_mysql500_ci);
+INSERT INTO t1 VALUES ('s'),('z'),(_latin1 0xDF);
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a;
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result b/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result
index 3679169122e..40ba714560f 100644
--- a/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result
+++ b/mysql-test/main/ctype_ucs2_general_mysql500_ci_ws.result
@@ -24,7 +24,7 @@ SUM(codepoint_hex4=HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_codepoint,
SUM(codepoint_hex4<>HEX(WEIGHT_STRING(c))) AS count_bmp_weight_is_not_codepoint
FROM v_bmp;
count_bmp_weight_is_codepoint count_bmp_weight_is_not_codepoint
-64428 1108
+64429 1107
SELECT codepoint_hex4,HEX(WEIGHT_STRING(c))
FROM v_bmp
WHERE codepoint_hex4<>HEX(WEIGHT_STRING(c));
@@ -82,7 +82,6 @@ codepoint_hex4 HEX(WEIGHT_STRING(c))
00DB 0055
00DC 0055
00DD 0059
-00DF 0053
00E0 0041
00E1 0041
00E2 0041
diff --git a/mysql-test/main/ctype_upgrade.result b/mysql-test/main/ctype_upgrade.result
index 30684df4023..500b013a5a1 100644
--- a/mysql-test/main/ctype_upgrade.result
+++ b/mysql-test/main/ctype_upgrade.result
@@ -603,3 +603,56 @@ DROP TABLE maria050313_utf8_croatian_ci;
DROP TABLE maria050533_xxx_croatian_ci;
DROP TABLE maria100004_xxx_croatian_ci;
DROP TABLE mysql050614_xxx_croatian_ci;
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-30746 Regression in ucs2_general_mysql500_ci
+#
+SET NAMES utf8mb3;
+SHOW CREATE TABLE t1;
+ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.t1` FORCE" or dump/reload to fix it!
+SELECT * FROM t1;
+ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.t1` FORCE" or dump/reload to fix it!
+SELECT * FROM t1 IGNORE KEY(a);
+ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.t1` FORCE" or dump/reload to fix it!
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+a HEX(a) HEX(WEIGHT_STRING(a))
+s 0073 0053
+z 007A 005A
+ß 00DF 00DF
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 FORCE KEY(a) ORDER BY a;
+a HEX(a) HEX(WEIGHT_STRING(a))
+s 0073 0053
+z 007A 005A
+ß 00DF 00DF
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 IGNORE KEY(a) ORDER BY a;
+a HEX(a) HEX(WEIGHT_STRING(a))
+s 0073 0053
+z 007A 005A
+ß 00DF 00DF
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a;
+GROUP_CONCAT(a)
+s
+z
+SELECT GROUP_CONCAT(a) FROM t1 IGNORE KEY(a) GROUP BY a ORDER BY a;
+GROUP_CONCAT(a)
+s
+z
+SELECT GROUP_CONCAT(a) FROM t1 FORCE KEY(a) GROUP BY a ORDER BY a;
+GROUP_CONCAT(a)
+s
+z
+DROP TABLE t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/ctype_upgrade.test b/mysql-test/main/ctype_upgrade.test
index f2fdc36554e..f28d23eeae9 100644
--- a/mysql-test/main/ctype_upgrade.test
+++ b/mysql-test/main/ctype_upgrade.test
@@ -203,3 +203,38 @@ DROP TABLE maria050313_utf8_croatian_ci;
DROP TABLE maria050533_xxx_croatian_ci;
DROP TABLE maria100004_xxx_croatian_ci;
DROP TABLE mysql050614_xxx_croatian_ci;
+
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-30746 Regression in ucs2_general_mysql500_ci
+--echo #
+
+SET NAMES utf8mb3;
+
+copy_file std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYD $MYSQLD_DATADIR/test/t1.MYD;
+copy_file std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYI $MYSQLD_DATADIR/test/t1.MYI;
+
+--error ER_TABLE_NEEDS_REBUILD
+SHOW CREATE TABLE t1;
+--error ER_TABLE_NEEDS_REBUILD
+SELECT * FROM t1;
+--error ER_TABLE_NEEDS_REBUILD
+SELECT * FROM t1 IGNORE KEY(a);
+CHECK TABLE t1;
+REPAIR TABLE t1;
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 FORCE KEY(a) ORDER BY a;
+SELECT a, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 IGNORE KEY(a) ORDER BY a;
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a ORDER BY a;
+SELECT GROUP_CONCAT(a) FROM t1 IGNORE KEY(a) GROUP BY a ORDER BY a;
+SELECT GROUP_CONCAT(a) FROM t1 FORCE KEY(a) GROUP BY a ORDER BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/ctype_utf8_uca.result b/mysql-test/main/ctype_utf8_uca.result
index ecd2daa5272..97bdadbb97b 100644
--- a/mysql-test/main/ctype_utf8_uca.result
+++ b/mysql-test/main/ctype_utf8_uca.result
@@ -618,6 +618,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -635,6 +640,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb3 COLLATE utf8mb3_turkish_ci /*Unicode-4.0 folding, with Turkish mapping for I */;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -661,6 +670,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -678,6 +692,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 C4B0 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -704,6 +722,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -721,6 +744,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -747,6 +774,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -764,6 +796,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb3 COLLATE utf8mb3_myanmar_ci;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -790,6 +826,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -807,6 +848,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb3 COLLATE utf8mb3_thai_520_w2;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -833,6 +878,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -850,11 +900,163 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
#
# End of 10.3 tests
#
#
+# Start of 10.4 tests
+#
+SET DEFAULT_STORAGE_ENGINE=MyISAM;
+SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci;
+#
+# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations
+#
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a TEXT COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a TEXT COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+SET DEFAULT_STORAGE_ENGINE=HEAP;
+#
+# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations
+#
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+SET DEFAULT_STORAGE_ENGINE=DEFAULT;
+#
+# End of 10.4 tests
+#
+#
# Start of 10.10 tests
#
#
@@ -1657,6 +1859,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -1674,6 +1881,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B19F E2B0AF Ⱟ
+2C5F E2B19F E2B0AF ⱟ
+A7C0 EA9F81 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F80 ꟁ
DROP TABLE case_folding;
#
# End of 10.10 tests
diff --git a/mysql-test/main/ctype_utf8_uca.test b/mysql-test/main/ctype_utf8_uca.test
index 5abf9192511..6f89d646260 100644
--- a/mysql-test/main/ctype_utf8_uca.test
+++ b/mysql-test/main/ctype_utf8_uca.test
@@ -54,6 +54,24 @@ SET NAMES utf8mb3 COLLATE utf8mb3_thai_520_w2;
--echo # End of 10.3 tests
--echo #
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+SET DEFAULT_STORAGE_ENGINE=MyISAM;
+SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci;
+--source include/ctype_nopad_prefix_unique.inc
+
+SET DEFAULT_STORAGE_ENGINE=HEAP;
+--source include/ctype_nopad_prefix_unique.inc
+
+SET DEFAULT_STORAGE_ENGINE=DEFAULT;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
+
--echo #
--echo # Start of 10.10 tests
--echo #
diff --git a/mysql-test/main/ctype_utf8mb4_uca.result b/mysql-test/main/ctype_utf8mb4_uca.result
index 42de45c98a3..3cd25891119 100644
--- a/mysql-test/main/ctype_utf8mb4_uca.result
+++ b/mysql-test/main/ctype_utf8mb4_uca.result
@@ -6636,6 +6636,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -6653,6 +6658,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb4 COLLATE utf8mb4_turkish_ci /*Unicode-4.0 folding with Turkish mapping for I */;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -6679,6 +6688,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -6696,6 +6710,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 C4B0 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -6722,6 +6740,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -6739,6 +6762,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -6765,6 +6792,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -6782,6 +6814,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -6808,6 +6844,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -6825,6 +6866,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
SET NAMES utf8mb4 COLLATE utf8mb4_thai_520_w2;
CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
@@ -6851,6 +6896,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -6868,6 +6918,10 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B0AF E2B0AF Ⱟ
+2C5F E2B19F E2B19F ⱟ
+A7C0 EA9F80 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F81 ꟁ
DROP TABLE case_folding;
#
# End of 10.3 tests
@@ -11499,6 +11553,11 @@ INSERT INTO case_folding (code) VALUES
(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
(0x0131) /* LATIN SMALL LETTER DOTLESS I */
;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
UPDATE case_folding SET c=CHAR(code USING ucs2);
SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
@@ -11516,6 +11575,112 @@ HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
69 69 49 i
130 69 C4B0 İ
131 C4B1 49 ı
+2C2F E2B19F E2B0AF Ⱟ
+2C5F E2B19F E2B0AF ⱟ
+A7C0 EA9F81 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F80 ꟁ
+DROP TABLE case_folding;
+CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c, SPACE(64) AS comment LIMIT 0;
+SHOW CREATE TABLE case_folding;
+Table Create Table
+case_folding CREATE TABLE `case_folding` (
+ `code` int(1) NOT NULL,
+ `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL,
+ `comment` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO case_folding (code, comment) VALUES (0x10595, 'VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x105BC, 'VITHKUQI SMALL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E921, 'ADLAM CAPITAL LETTER SHA (Unicode-9.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E943, 'ADLAM SMALL LETTER SHA (Unicode-9.0)');
+UPDATE case_folding SET c=CHAR(code USING utf32);
+SELECT
+HEX(CONVERT(c USING utf32)) AS ch,
+HEX(CONVERT(LOWER(c) USING utf32)) AS cl,
+HEX(CONVERT(UPPER(c) USING utf32)) AS cu,
+comment
+FROM case_folding ORDER BY BINARY(c);
+ch cl cu comment
+00010595 000105BC 00010595 VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)
+000105BC 000105BC 00010595 VITHKUQI SMALL LETTER ZE (Unicode-14.0)
+0001E921 0001E943 0001E921 ADLAM CAPITAL LETTER SHA (Unicode-9.0)
+0001E943 0001E943 0001E921 ADLAM SMALL LETTER SHA (Unicode-9.0)
+DROP TABLE case_folding;
+SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_turkish_ai_ci;
+CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0;
+SHOW CREATE TABLE case_folding;
+Table Create Table
+case_folding CREATE TABLE `case_folding` (
+ `code` int(1) NOT NULL,
+ `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_turkish_ai_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO case_folding (code) VALUES
+(0x23A),
+(0x23E),
+(0x23F),
+(0x240),
+(0x250),
+(0x251),
+(0x252),
+(0x26B),
+(0x271),
+(0x27D);
+INSERT INTO case_folding (code) VALUES
+(0x0049) /* LATIN CAPITAL LETTER I */,
+(0x0069) /* LATIN SMALL LETTER I */,
+(0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */,
+(0x0131) /* LATIN SMALL LETTER DOTLESS I */
+;
+INSERT INTO case_folding (code) VALUES
+(0x2C2F) /* GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0x2C5F) /* GLAGOLITIC SMALL LETTER CAUDATE CHRIVI (Unicode-14.0) */,
+(0xA7C0) /* LATIN CAPITAL LETTER OLD POLISH O (Unicode-14.0) */,
+(0xA7C1) /* LATIN SMALL LETTER OLD POLISH O (Unicode-14.0) */;
+UPDATE case_folding SET c=CHAR(code USING ucs2);
+SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding;
+HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c
+23A E2B1A5 C8BA Ⱥ
+23E E2B1A6 C8BE Ⱦ
+23F C8BF E2B1BE ȿ
+240 C980 E2B1BF ɀ
+250 C990 E2B1AF ɐ
+251 C991 E2B1AD ɑ
+252 C992 E2B1B0 ɒ
+26B C9AB E2B1A2 ɫ
+271 C9B1 E2B1AE ɱ
+27D C9BD E2B1A4 ɽ
+49 C4B1 49 I
+69 69 C4B0 i
+130 69 C4B0 İ
+131 C4B1 49 ı
+2C2F E2B19F E2B0AF Ⱟ
+2C5F E2B19F E2B0AF ⱟ
+A7C0 EA9F81 EA9F80 Ꟁ
+A7C1 EA9F81 EA9F80 ꟁ
+DROP TABLE case_folding;
+CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c, SPACE(64) AS comment LIMIT 0;
+SHOW CREATE TABLE case_folding;
+Table Create Table
+case_folding CREATE TABLE `case_folding` (
+ `code` int(1) NOT NULL,
+ `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_turkish_ai_ci DEFAULT NULL,
+ `comment` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_turkish_ai_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO case_folding (code, comment) VALUES (0x10595, 'VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x105BC, 'VITHKUQI SMALL LETTER ZE (Unicode-14.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E921, 'ADLAM CAPITAL LETTER SHA (Unicode-9.0)');
+INSERT INTO case_folding (code, comment) VALUES (0x1E943, 'ADLAM SMALL LETTER SHA (Unicode-9.0)');
+UPDATE case_folding SET c=CHAR(code USING utf32);
+SELECT
+HEX(CONVERT(c USING utf32)) AS ch,
+HEX(CONVERT(LOWER(c) USING utf32)) AS cl,
+HEX(CONVERT(UPPER(c) USING utf32)) AS cu,
+comment
+FROM case_folding ORDER BY BINARY(c);
+ch cl cu comment
+00010595 000105BC 00010595 VITHKUQI CAPITAL LETTER ZE (Unicode-14.0)
+000105BC 000105BC 00010595 VITHKUQI SMALL LETTER ZE (Unicode-14.0)
+0001E921 0001E943 0001E921 ADLAM CAPITAL LETTER SHA (Unicode-9.0)
+0001E943 0001E943 0001E921 ADLAM SMALL LETTER SHA (Unicode-9.0)
DROP TABLE case_folding;
#
# End of 10.10 tests
diff --git a/mysql-test/main/ctype_utf8mb4_uca.test b/mysql-test/main/ctype_utf8mb4_uca.test
index 3f428447cc9..1b709ebba69 100644
--- a/mysql-test/main/ctype_utf8mb4_uca.test
+++ b/mysql-test/main/ctype_utf8mb4_uca.test
@@ -435,6 +435,11 @@ DROP PROCEDURE test_styles;
SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
--source include/ctype_casefolding.inc
+--source include/ctype_casefolding_supplementary.inc
+
+SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_turkish_ai_ci;
+--source include/ctype_casefolding.inc
+--source include/ctype_casefolding_supplementary.inc
--echo #
--echo # End of 10.10 tests
diff --git a/mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.result b/mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.result
new file mode 100644
index 00000000000..85e87f217cc
--- /dev/null
+++ b/mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.result
@@ -0,0 +1,2927 @@
+#
+# Start of 10.10 tests
+#
+#
+# MDEV-30577 Case folding for uca1400 collations is not up to date
+#
+SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
+EXECUTE IMMEDIATE SFORMAT('
+CREATE VIEW v_bmp AS
+SELECT
+ seq AS codepoint,
+ LPAD(HEX(seq),4,''0'') AS codepoint_hex4,
+ CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c
+FROM
+ seq_0_to_65535', @@character_set_connection, @@collation_connection);
+SELECT COLLATION(c) FROM v_bmp LIMIT 1;
+COLLATION(c)
+utf8mb4_uca1400_ai_ci
+SELECT
+codepoint_hex4,
+HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)),
+HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2))
+FROM v_bmp
+WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c));
+codepoint_hex4 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET ucs2)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET ucs2))
+0041 0061 0041
+0042 0062 0042
+0043 0063 0043
+0044 0064 0044
+0045 0065 0045
+0046 0066 0046
+0047 0067 0047
+0048 0068 0048
+0049 0069 0049
+004A 006A 004A
+004B 006B 004B
+004C 006C 004C
+004D 006D 004D
+004E 006E 004E
+004F 006F 004F
+0050 0070 0050
+0051 0071 0051
+0052 0072 0052
+0053 0073 0053
+0054 0074 0054
+0055 0075 0055
+0056 0076 0056
+0057 0077 0057
+0058 0078 0058
+0059 0079 0059
+005A 007A 005A
+0061 0061 0041
+0062 0062 0042
+0063 0063 0043
+0064 0064 0044
+0065 0065 0045
+0066 0066 0046
+0067 0067 0047
+0068 0068 0048
+0069 0069 0049
+006A 006A 004A
+006B 006B 004B
+006C 006C 004C
+006D 006D 004D
+006E 006E 004E
+006F 006F 004F
+0070 0070 0050
+0071 0071 0051
+0072 0072 0052
+0073 0073 0053
+0074 0074 0054
+0075 0075 0055
+0076 0076 0056
+0077 0077 0057
+0078 0078 0058
+0079 0079 0059
+007A 007A 005A
+00B5 00B5 039C
+00C0 00E0 00C0
+00C1 00E1 00C1
+00C2 00E2 00C2
+00C3 00E3 00C3
+00C4 00E4 00C4
+00C5 00E5 00C5
+00C6 00E6 00C6
+00C7 00E7 00C7
+00C8 00E8 00C8
+00C9 00E9 00C9
+00CA 00EA 00CA
+00CB 00EB 00CB
+00CC 00EC 00CC
+00CD 00ED 00CD
+00CE 00EE 00CE
+00CF 00EF 00CF
+00D0 00F0 00D0
+00D1 00F1 00D1
+00D2 00F2 00D2
+00D3 00F3 00D3
+00D4 00F4 00D4
+00D5 00F5 00D5
+00D6 00F6 00D6
+00D8 00F8 00D8
+00D9 00F9 00D9
+00DA 00FA 00DA
+00DB 00FB 00DB
+00DC 00FC 00DC
+00DD 00FD 00DD
+00DE 00FE 00DE
+00E0 00E0 00C0
+00E1 00E1 00C1
+00E2 00E2 00C2
+00E3 00E3 00C3
+00E4 00E4 00C4
+00E5 00E5 00C5
+00E6 00E6 00C6
+00E7 00E7 00C7
+00E8 00E8 00C8
+00E9 00E9 00C9
+00EA 00EA 00CA
+00EB 00EB 00CB
+00EC 00EC 00CC
+00ED 00ED 00CD
+00EE 00EE 00CE
+00EF 00EF 00CF
+00F0 00F0 00D0
+00F1 00F1 00D1
+00F2 00F2 00D2
+00F3 00F3 00D3
+00F4 00F4 00D4
+00F5 00F5 00D5
+00F6 00F6 00D6
+00F8 00F8 00D8
+00F9 00F9 00D9
+00FA 00FA 00DA
+00FB 00FB 00DB
+00FC 00FC 00DC
+00FD 00FD 00DD
+00FE 00FE 00DE
+00FF 00FF 0178
+0100 0101 0100
+0101 0101 0100
+0102 0103 0102
+0103 0103 0102
+0104 0105 0104
+0105 0105 0104
+0106 0107 0106
+0107 0107 0106
+0108 0109 0108
+0109 0109 0108
+010A 010B 010A
+010B 010B 010A
+010C 010D 010C
+010D 010D 010C
+010E 010F 010E
+010F 010F 010E
+0110 0111 0110
+0111 0111 0110
+0112 0113 0112
+0113 0113 0112
+0114 0115 0114
+0115 0115 0114
+0116 0117 0116
+0117 0117 0116
+0118 0119 0118
+0119 0119 0118
+011A 011B 011A
+011B 011B 011A
+011C 011D 011C
+011D 011D 011C
+011E 011F 011E
+011F 011F 011E
+0120 0121 0120
+0121 0121 0120
+0122 0123 0122
+0123 0123 0122
+0124 0125 0124
+0125 0125 0124
+0126 0127 0126
+0127 0127 0126
+0128 0129 0128
+0129 0129 0128
+012A 012B 012A
+012B 012B 012A
+012C 012D 012C
+012D 012D 012C
+012E 012F 012E
+012F 012F 012E
+0130 0069 0130
+0131 0131 0049
+0132 0133 0132
+0133 0133 0132
+0134 0135 0134
+0135 0135 0134
+0136 0137 0136
+0137 0137 0136
+0139 013A 0139
+013A 013A 0139
+013B 013C 013B
+013C 013C 013B
+013D 013E 013D
+013E 013E 013D
+013F 0140 013F
+0140 0140 013F
+0141 0142 0141
+0142 0142 0141
+0143 0144 0143
+0144 0144 0143
+0145 0146 0145
+0146 0146 0145
+0147 0148 0147
+0148 0148 0147
+014A 014B 014A
+014B 014B 014A
+014C 014D 014C
+014D 014D 014C
+014E 014F 014E
+014F 014F 014E
+0150 0151 0150
+0151 0151 0150
+0152 0153 0152
+0153 0153 0152
+0154 0155 0154
+0155 0155 0154
+0156 0157 0156
+0157 0157 0156
+0158 0159 0158
+0159 0159 0158
+015A 015B 015A
+015B 015B 015A
+015C 015D 015C
+015D 015D 015C
+015E 015F 015E
+015F 015F 015E
+0160 0161 0160
+0161 0161 0160
+0162 0163 0162
+0163 0163 0162
+0164 0165 0164
+0165 0165 0164
+0166 0167 0166
+0167 0167 0166
+0168 0169 0168
+0169 0169 0168
+016A 016B 016A
+016B 016B 016A
+016C 016D 016C
+016D 016D 016C
+016E 016F 016E
+016F 016F 016E
+0170 0171 0170
+0171 0171 0170
+0172 0173 0172
+0173 0173 0172
+0174 0175 0174
+0175 0175 0174
+0176 0177 0176
+0177 0177 0176
+0178 00FF 0178
+0179 017A 0179
+017A 017A 0179
+017B 017C 017B
+017C 017C 017B
+017D 017E 017D
+017E 017E 017D
+017F 017F 0053
+0180 0180 0243
+0181 0253 0181
+0182 0183 0182
+0183 0183 0182
+0184 0185 0184
+0185 0185 0184
+0186 0254 0186
+0187 0188 0187
+0188 0188 0187
+0189 0256 0189
+018A 0257 018A
+018B 018C 018B
+018C 018C 018B
+018E 01DD 018E
+018F 0259 018F
+0190 025B 0190
+0191 0192 0191
+0192 0192 0191
+0193 0260 0193
+0194 0263 0194
+0195 0195 01F6
+0196 0269 0196
+0197 0268 0197
+0198 0199 0198
+0199 0199 0198
+019A 019A 023D
+019C 026F 019C
+019D 0272 019D
+019E 019E 0220
+019F 0275 019F
+01A0 01A1 01A0
+01A1 01A1 01A0
+01A2 01A3 01A2
+01A3 01A3 01A2
+01A4 01A5 01A4
+01A5 01A5 01A4
+01A6 0280 01A6
+01A7 01A8 01A7
+01A8 01A8 01A7
+01A9 0283 01A9
+01AC 01AD 01AC
+01AD 01AD 01AC
+01AE 0288 01AE
+01AF 01B0 01AF
+01B0 01B0 01AF
+01B1 028A 01B1
+01B2 028B 01B2
+01B3 01B4 01B3
+01B4 01B4 01B3
+01B5 01B6 01B5
+01B6 01B6 01B5
+01B7 0292 01B7
+01B8 01B9 01B8
+01B9 01B9 01B8
+01BC 01BD 01BC
+01BD 01BD 01BC
+01BF 01BF 01F7
+01C4 01C6 01C4
+01C5 01C6 01C4
+01C6 01C6 01C4
+01C7 01C9 01C7
+01C8 01C9 01C7
+01C9 01C9 01C7
+01CA 01CC 01CA
+01CB 01CC 01CA
+01CC 01CC 01CA
+01CD 01CE 01CD
+01CE 01CE 01CD
+01CF 01D0 01CF
+01D0 01D0 01CF
+01D1 01D2 01D1
+01D2 01D2 01D1
+01D3 01D4 01D3
+01D4 01D4 01D3
+01D5 01D6 01D5
+01D6 01D6 01D5
+01D7 01D8 01D7
+01D8 01D8 01D7
+01D9 01DA 01D9
+01DA 01DA 01D9
+01DB 01DC 01DB
+01DC 01DC 01DB
+01DD 01DD 018E
+01DE 01DF 01DE
+01DF 01DF 01DE
+01E0 01E1 01E0
+01E1 01E1 01E0
+01E2 01E3 01E2
+01E3 01E3 01E2
+01E4 01E5 01E4
+01E5 01E5 01E4
+01E6 01E7 01E6
+01E7 01E7 01E6
+01E8 01E9 01E8
+01E9 01E9 01E8
+01EA 01EB 01EA
+01EB 01EB 01EA
+01EC 01ED 01EC
+01ED 01ED 01EC
+01EE 01EF 01EE
+01EF 01EF 01EE
+01F1 01F3 01F1
+01F2 01F3 01F1
+01F3 01F3 01F1
+01F4 01F5 01F4
+01F5 01F5 01F4
+01F6 0195 01F6
+01F7 01BF 01F7
+01F8 01F9 01F8
+01F9 01F9 01F8
+01FA 01FB 01FA
+01FB 01FB 01FA
+01FC 01FD 01FC
+01FD 01FD 01FC
+01FE 01FF 01FE
+01FF 01FF 01FE
+0200 0201 0200
+0201 0201 0200
+0202 0203 0202
+0203 0203 0202
+0204 0205 0204
+0205 0205 0204
+0206 0207 0206
+0207 0207 0206
+0208 0209 0208
+0209 0209 0208
+020A 020B 020A
+020B 020B 020A
+020C 020D 020C
+020D 020D 020C
+020E 020F 020E
+020F 020F 020E
+0210 0211 0210
+0211 0211 0210
+0212 0213 0212
+0213 0213 0212
+0214 0215 0214
+0215 0215 0214
+0216 0217 0216
+0217 0217 0216
+0218 0219 0218
+0219 0219 0218
+021A 021B 021A
+021B 021B 021A
+021C 021D 021C
+021D 021D 021C
+021E 021F 021E
+021F 021F 021E
+0220 019E 0220
+0222 0223 0222
+0223 0223 0222
+0224 0225 0224
+0225 0225 0224
+0226 0227 0226
+0227 0227 0226
+0228 0229 0228
+0229 0229 0228
+022A 022B 022A
+022B 022B 022A
+022C 022D 022C
+022D 022D 022C
+022E 022F 022E
+022F 022F 022E
+0230 0231 0230
+0231 0231 0230
+0232 0233 0232
+0233 0233 0232
+023A 2C65 023A
+023B 023C 023B
+023C 023C 023B
+023D 019A 023D
+023E 2C66 023E
+023F 023F 2C7E
+0240 0240 2C7F
+0241 0242 0241
+0242 0242 0241
+0243 0180 0243
+0244 0289 0244
+0245 028C 0245
+0246 0247 0246
+0247 0247 0246
+0248 0249 0248
+0249 0249 0248
+024A 024B 024A
+024B 024B 024A
+024C 024D 024C
+024D 024D 024C
+024E 024F 024E
+024F 024F 024E
+0250 0250 2C6F
+0251 0251 2C6D
+0252 0252 2C70
+0253 0253 0181
+0254 0254 0186
+0256 0256 0189
+0257 0257 018A
+0259 0259 018F
+025B 025B 0190
+025C 025C A7AB
+0260 0260 0193
+0261 0261 A7AC
+0263 0263 0194
+0265 0265 A78D
+0266 0266 A7AA
+0268 0268 0197
+0269 0269 0196
+026A 026A A7AE
+026B 026B 2C62
+026C 026C A7AD
+026F 026F 019C
+0271 0271 2C6E
+0272 0272 019D
+0275 0275 019F
+027D 027D 2C64
+0280 0280 01A6
+0282 0282 A7C5
+0283 0283 01A9
+0287 0287 A7B1
+0288 0288 01AE
+0289 0289 0244
+028A 028A 01B1
+028B 028B 01B2
+028C 028C 0245
+0292 0292 01B7
+029D 029D A7B2
+029E 029E A7B0
+0345 0345 0399
+0370 0371 0370
+0371 0371 0370
+0372 0373 0372
+0373 0373 0372
+0376 0377 0376
+0377 0377 0376
+037B 037B 03FD
+037C 037C 03FE
+037D 037D 03FF
+037F 03F3 037F
+0386 03AC 0386
+0388 03AD 0388
+0389 03AE 0389
+038A 03AF 038A
+038C 03CC 038C
+038E 03CD 038E
+038F 03CE 038F
+0391 03B1 0391
+0392 03B2 0392
+0393 03B3 0393
+0394 03B4 0394
+0395 03B5 0395
+0396 03B6 0396
+0397 03B7 0397
+0398 03B8 0398
+0399 03B9 0399
+039A 03BA 039A
+039B 03BB 039B
+039C 03BC 039C
+039D 03BD 039D
+039E 03BE 039E
+039F 03BF 039F
+03A0 03C0 03A0
+03A1 03C1 03A1
+03A3 03C3 03A3
+03A4 03C4 03A4
+03A5 03C5 03A5
+03A6 03C6 03A6
+03A7 03C7 03A7
+03A8 03C8 03A8
+03A9 03C9 03A9
+03AA 03CA 03AA
+03AB 03CB 03AB
+03AC 03AC 0386
+03AD 03AD 0388
+03AE 03AE 0389
+03AF 03AF 038A
+03B1 03B1 0391
+03B2 03B2 0392
+03B3 03B3 0393
+03B4 03B4 0394
+03B5 03B5 0395
+03B6 03B6 0396
+03B7 03B7 0397
+03B8 03B8 0398
+03B9 03B9 0399
+03BA 03BA 039A
+03BB 03BB 039B
+03BC 03BC 039C
+03BD 03BD 039D
+03BE 03BE 039E
+03BF 03BF 039F
+03C0 03C0 03A0
+03C1 03C1 03A1
+03C2 03C2 03A3
+03C3 03C3 03A3
+03C4 03C4 03A4
+03C5 03C5 03A5
+03C6 03C6 03A6
+03C7 03C7 03A7
+03C8 03C8 03A8
+03C9 03C9 03A9
+03CA 03CA 03AA
+03CB 03CB 03AB
+03CC 03CC 038C
+03CD 03CD 038E
+03CE 03CE 038F
+03CF 03D7 03CF
+03D0 03D0 0392
+03D1 03D1 0398
+03D5 03D5 03A6
+03D6 03D6 03A0
+03D7 03D7 03CF
+03D8 03D9 03D8
+03D9 03D9 03D8
+03DA 03DB 03DA
+03DB 03DB 03DA
+03DC 03DD 03DC
+03DD 03DD 03DC
+03DE 03DF 03DE
+03DF 03DF 03DE
+03E0 03E1 03E0
+03E1 03E1 03E0
+03E2 03E3 03E2
+03E3 03E3 03E2
+03E4 03E5 03E4
+03E5 03E5 03E4
+03E6 03E7 03E6
+03E7 03E7 03E6
+03E8 03E9 03E8
+03E9 03E9 03E8
+03EA 03EB 03EA
+03EB 03EB 03EA
+03EC 03ED 03EC
+03ED 03ED 03EC
+03EE 03EF 03EE
+03EF 03EF 03EE
+03F0 03F0 039A
+03F1 03F1 03A1
+03F2 03F2 03F9
+03F3 03F3 037F
+03F4 03B8 03F4
+03F5 03F5 0395
+03F7 03F8 03F7
+03F8 03F8 03F7
+03F9 03F2 03F9
+03FA 03FB 03FA
+03FB 03FB 03FA
+03FD 037B 03FD
+03FE 037C 03FE
+03FF 037D 03FF
+0400 0450 0400
+0401 0451 0401
+0402 0452 0402
+0403 0453 0403
+0404 0454 0404
+0405 0455 0405
+0406 0456 0406
+0407 0457 0407
+0408 0458 0408
+0409 0459 0409
+040A 045A 040A
+040B 045B 040B
+040C 045C 040C
+040D 045D 040D
+040E 045E 040E
+040F 045F 040F
+0410 0430 0410
+0411 0431 0411
+0412 0432 0412
+0413 0433 0413
+0414 0434 0414
+0415 0435 0415
+0416 0436 0416
+0417 0437 0417
+0418 0438 0418
+0419 0439 0419
+041A 043A 041A
+041B 043B 041B
+041C 043C 041C
+041D 043D 041D
+041E 043E 041E
+041F 043F 041F
+0420 0440 0420
+0421 0441 0421
+0422 0442 0422
+0423 0443 0423
+0424 0444 0424
+0425 0445 0425
+0426 0446 0426
+0427 0447 0427
+0428 0448 0428
+0429 0449 0429
+042A 044A 042A
+042B 044B 042B
+042C 044C 042C
+042D 044D 042D
+042E 044E 042E
+042F 044F 042F
+0430 0430 0410
+0431 0431 0411
+0432 0432 0412
+0433 0433 0413
+0434 0434 0414
+0435 0435 0415
+0436 0436 0416
+0437 0437 0417
+0438 0438 0418
+0439 0439 0419
+043A 043A 041A
+043B 043B 041B
+043C 043C 041C
+043D 043D 041D
+043E 043E 041E
+043F 043F 041F
+0440 0440 0420
+0441 0441 0421
+0442 0442 0422
+0443 0443 0423
+0444 0444 0424
+0445 0445 0425
+0446 0446 0426
+0447 0447 0427
+0448 0448 0428
+0449 0449 0429
+044A 044A 042A
+044B 044B 042B
+044C 044C 042C
+044D 044D 042D
+044E 044E 042E
+044F 044F 042F
+0450 0450 0400
+0451 0451 0401
+0452 0452 0402
+0453 0453 0403
+0454 0454 0404
+0455 0455 0405
+0456 0456 0406
+0457 0457 0407
+0458 0458 0408
+0459 0459 0409
+045A 045A 040A
+045B 045B 040B
+045C 045C 040C
+045D 045D 040D
+045E 045E 040E
+045F 045F 040F
+0460 0461 0460
+0461 0461 0460
+0462 0463 0462
+0463 0463 0462
+0464 0465 0464
+0465 0465 0464
+0466 0467 0466
+0467 0467 0466
+0468 0469 0468
+0469 0469 0468
+046A 046B 046A
+046B 046B 046A
+046C 046D 046C
+046D 046D 046C
+046E 046F 046E
+046F 046F 046E
+0470 0471 0470
+0471 0471 0470
+0472 0473 0472
+0473 0473 0472
+0474 0475 0474
+0475 0475 0474
+0476 0477 0476
+0477 0477 0476
+0478 0479 0478
+0479 0479 0478
+047A 047B 047A
+047B 047B 047A
+047C 047D 047C
+047D 047D 047C
+047E 047F 047E
+047F 047F 047E
+0480 0481 0480
+0481 0481 0480
+048A 048B 048A
+048B 048B 048A
+048C 048D 048C
+048D 048D 048C
+048E 048F 048E
+048F 048F 048E
+0490 0491 0490
+0491 0491 0490
+0492 0493 0492
+0493 0493 0492
+0494 0495 0494
+0495 0495 0494
+0496 0497 0496
+0497 0497 0496
+0498 0499 0498
+0499 0499 0498
+049A 049B 049A
+049B 049B 049A
+049C 049D 049C
+049D 049D 049C
+049E 049F 049E
+049F 049F 049E
+04A0 04A1 04A0
+04A1 04A1 04A0
+04A2 04A3 04A2
+04A3 04A3 04A2
+04A4 04A5 04A4
+04A5 04A5 04A4
+04A6 04A7 04A6
+04A7 04A7 04A6
+04A8 04A9 04A8
+04A9 04A9 04A8
+04AA 04AB 04AA
+04AB 04AB 04AA
+04AC 04AD 04AC
+04AD 04AD 04AC
+04AE 04AF 04AE
+04AF 04AF 04AE
+04B0 04B1 04B0
+04B1 04B1 04B0
+04B2 04B3 04B2
+04B3 04B3 04B2
+04B4 04B5 04B4
+04B5 04B5 04B4
+04B6 04B7 04B6
+04B7 04B7 04B6
+04B8 04B9 04B8
+04B9 04B9 04B8
+04BA 04BB 04BA
+04BB 04BB 04BA
+04BC 04BD 04BC
+04BD 04BD 04BC
+04BE 04BF 04BE
+04BF 04BF 04BE
+04C0 04CF 04C0
+04C1 04C2 04C1
+04C2 04C2 04C1
+04C3 04C4 04C3
+04C4 04C4 04C3
+04C5 04C6 04C5
+04C6 04C6 04C5
+04C7 04C8 04C7
+04C8 04C8 04C7
+04C9 04CA 04C9
+04CA 04CA 04C9
+04CB 04CC 04CB
+04CC 04CC 04CB
+04CD 04CE 04CD
+04CE 04CE 04CD
+04CF 04CF 04C0
+04D0 04D1 04D0
+04D1 04D1 04D0
+04D2 04D3 04D2
+04D3 04D3 04D2
+04D4 04D5 04D4
+04D5 04D5 04D4
+04D6 04D7 04D6
+04D7 04D7 04D6
+04D8 04D9 04D8
+04D9 04D9 04D8
+04DA 04DB 04DA
+04DB 04DB 04DA
+04DC 04DD 04DC
+04DD 04DD 04DC
+04DE 04DF 04DE
+04DF 04DF 04DE
+04E0 04E1 04E0
+04E1 04E1 04E0
+04E2 04E3 04E2
+04E3 04E3 04E2
+04E4 04E5 04E4
+04E5 04E5 04E4
+04E6 04E7 04E6
+04E7 04E7 04E6
+04E8 04E9 04E8
+04E9 04E9 04E8
+04EA 04EB 04EA
+04EB 04EB 04EA
+04EC 04ED 04EC
+04ED 04ED 04EC
+04EE 04EF 04EE
+04EF 04EF 04EE
+04F0 04F1 04F0
+04F1 04F1 04F0
+04F2 04F3 04F2
+04F3 04F3 04F2
+04F4 04F5 04F4
+04F5 04F5 04F4
+04F6 04F7 04F6
+04F7 04F7 04F6
+04F8 04F9 04F8
+04F9 04F9 04F8
+04FA 04FB 04FA
+04FB 04FB 04FA
+04FC 04FD 04FC
+04FD 04FD 04FC
+04FE 04FF 04FE
+04FF 04FF 04FE
+0500 0501 0500
+0501 0501 0500
+0502 0503 0502
+0503 0503 0502
+0504 0505 0504
+0505 0505 0504
+0506 0507 0506
+0507 0507 0506
+0508 0509 0508
+0509 0509 0508
+050A 050B 050A
+050B 050B 050A
+050C 050D 050C
+050D 050D 050C
+050E 050F 050E
+050F 050F 050E
+0510 0511 0510
+0511 0511 0510
+0512 0513 0512
+0513 0513 0512
+0514 0515 0514
+0515 0515 0514
+0516 0517 0516
+0517 0517 0516
+0518 0519 0518
+0519 0519 0518
+051A 051B 051A
+051B 051B 051A
+051C 051D 051C
+051D 051D 051C
+051E 051F 051E
+051F 051F 051E
+0520 0521 0520
+0521 0521 0520
+0522 0523 0522
+0523 0523 0522
+0524 0525 0524
+0525 0525 0524
+0526 0527 0526
+0527 0527 0526
+0528 0529 0528
+0529 0529 0528
+052A 052B 052A
+052B 052B 052A
+052C 052D 052C
+052D 052D 052C
+052E 052F 052E
+052F 052F 052E
+0531 0561 0531
+0532 0562 0532
+0533 0563 0533
+0534 0564 0534
+0535 0565 0535
+0536 0566 0536
+0537 0567 0537
+0538 0568 0538
+0539 0569 0539
+053A 056A 053A
+053B 056B 053B
+053C 056C 053C
+053D 056D 053D
+053E 056E 053E
+053F 056F 053F
+0540 0570 0540
+0541 0571 0541
+0542 0572 0542
+0543 0573 0543
+0544 0574 0544
+0545 0575 0545
+0546 0576 0546
+0547 0577 0547
+0548 0578 0548
+0549 0579 0549
+054A 057A 054A
+054B 057B 054B
+054C 057C 054C
+054D 057D 054D
+054E 057E 054E
+054F 057F 054F
+0550 0580 0550
+0551 0581 0551
+0552 0582 0552
+0553 0583 0553
+0554 0584 0554
+0555 0585 0555
+0556 0586 0556
+0561 0561 0531
+0562 0562 0532
+0563 0563 0533
+0564 0564 0534
+0565 0565 0535
+0566 0566 0536
+0567 0567 0537
+0568 0568 0538
+0569 0569 0539
+056A 056A 053A
+056B 056B 053B
+056C 056C 053C
+056D 056D 053D
+056E 056E 053E
+056F 056F 053F
+0570 0570 0540
+0571 0571 0541
+0572 0572 0542
+0573 0573 0543
+0574 0574 0544
+0575 0575 0545
+0576 0576 0546
+0577 0577 0547
+0578 0578 0548
+0579 0579 0549
+057A 057A 054A
+057B 057B 054B
+057C 057C 054C
+057D 057D 054D
+057E 057E 054E
+057F 057F 054F
+0580 0580 0550
+0581 0581 0551
+0582 0582 0552
+0583 0583 0553
+0584 0584 0554
+0585 0585 0555
+0586 0586 0556
+10A0 2D00 10A0
+10A1 2D01 10A1
+10A2 2D02 10A2
+10A3 2D03 10A3
+10A4 2D04 10A4
+10A5 2D05 10A5
+10A6 2D06 10A6
+10A7 2D07 10A7
+10A8 2D08 10A8
+10A9 2D09 10A9
+10AA 2D0A 10AA
+10AB 2D0B 10AB
+10AC 2D0C 10AC
+10AD 2D0D 10AD
+10AE 2D0E 10AE
+10AF 2D0F 10AF
+10B0 2D10 10B0
+10B1 2D11 10B1
+10B2 2D12 10B2
+10B3 2D13 10B3
+10B4 2D14 10B4
+10B5 2D15 10B5
+10B6 2D16 10B6
+10B7 2D17 10B7
+10B8 2D18 10B8
+10B9 2D19 10B9
+10BA 2D1A 10BA
+10BB 2D1B 10BB
+10BC 2D1C 10BC
+10BD 2D1D 10BD
+10BE 2D1E 10BE
+10BF 2D1F 10BF
+10C0 2D20 10C0
+10C1 2D21 10C1
+10C2 2D22 10C2
+10C3 2D23 10C3
+10C4 2D24 10C4
+10C5 2D25 10C5
+10C7 2D27 10C7
+10CD 2D2D 10CD
+10D0 10D0 1C90
+10D1 10D1 1C91
+10D2 10D2 1C92
+10D3 10D3 1C93
+10D4 10D4 1C94
+10D5 10D5 1C95
+10D6 10D6 1C96
+10D7 10D7 1C97
+10D8 10D8 1C98
+10D9 10D9 1C99
+10DA 10DA 1C9A
+10DB 10DB 1C9B
+10DC 10DC 1C9C
+10DD 10DD 1C9D
+10DE 10DE 1C9E
+10DF 10DF 1C9F
+10E0 10E0 1CA0
+10E1 10E1 1CA1
+10E2 10E2 1CA2
+10E3 10E3 1CA3
+10E4 10E4 1CA4
+10E5 10E5 1CA5
+10E6 10E6 1CA6
+10E7 10E7 1CA7
+10E8 10E8 1CA8
+10E9 10E9 1CA9
+10EA 10EA 1CAA
+10EB 10EB 1CAB
+10EC 10EC 1CAC
+10ED 10ED 1CAD
+10EE 10EE 1CAE
+10EF 10EF 1CAF
+10F0 10F0 1CB0
+10F1 10F1 1CB1
+10F2 10F2 1CB2
+10F3 10F3 1CB3
+10F4 10F4 1CB4
+10F5 10F5 1CB5
+10F6 10F6 1CB6
+10F7 10F7 1CB7
+10F8 10F8 1CB8
+10F9 10F9 1CB9
+10FA 10FA 1CBA
+10FD 10FD 1CBD
+10FE 10FE 1CBE
+10FF 10FF 1CBF
+13A0 AB70 13A0
+13A1 AB71 13A1
+13A2 AB72 13A2
+13A3 AB73 13A3
+13A4 AB74 13A4
+13A5 AB75 13A5
+13A6 AB76 13A6
+13A7 AB77 13A7
+13A8 AB78 13A8
+13A9 AB79 13A9
+13AA AB7A 13AA
+13AB AB7B 13AB
+13AC AB7C 13AC
+13AD AB7D 13AD
+13AE AB7E 13AE
+13AF AB7F 13AF
+13B0 AB80 13B0
+13B1 AB81 13B1
+13B2 AB82 13B2
+13B3 AB83 13B3
+13B4 AB84 13B4
+13B5 AB85 13B5
+13B6 AB86 13B6
+13B7 AB87 13B7
+13B8 AB88 13B8
+13B9 AB89 13B9
+13BA AB8A 13BA
+13BB AB8B 13BB
+13BC AB8C 13BC
+13BD AB8D 13BD
+13BE AB8E 13BE
+13BF AB8F 13BF
+13C0 AB90 13C0
+13C1 AB91 13C1
+13C2 AB92 13C2
+13C3 AB93 13C3
+13C4 AB94 13C4
+13C5 AB95 13C5
+13C6 AB96 13C6
+13C7 AB97 13C7
+13C8 AB98 13C8
+13C9 AB99 13C9
+13CA AB9A 13CA
+13CB AB9B 13CB
+13CC AB9C 13CC
+13CD AB9D 13CD
+13CE AB9E 13CE
+13CF AB9F 13CF
+13D0 ABA0 13D0
+13D1 ABA1 13D1
+13D2 ABA2 13D2
+13D3 ABA3 13D3
+13D4 ABA4 13D4
+13D5 ABA5 13D5
+13D6 ABA6 13D6
+13D7 ABA7 13D7
+13D8 ABA8 13D8
+13D9 ABA9 13D9
+13DA ABAA 13DA
+13DB ABAB 13DB
+13DC ABAC 13DC
+13DD ABAD 13DD
+13DE ABAE 13DE
+13DF ABAF 13DF
+13E0 ABB0 13E0
+13E1 ABB1 13E1
+13E2 ABB2 13E2
+13E3 ABB3 13E3
+13E4 ABB4 13E4
+13E5 ABB5 13E5
+13E6 ABB6 13E6
+13E7 ABB7 13E7
+13E8 ABB8 13E8
+13E9 ABB9 13E9
+13EA ABBA 13EA
+13EB ABBB 13EB
+13EC ABBC 13EC
+13ED ABBD 13ED
+13EE ABBE 13EE
+13EF ABBF 13EF
+13F0 13F8 13F0
+13F1 13F9 13F1
+13F2 13FA 13F2
+13F3 13FB 13F3
+13F4 13FC 13F4
+13F5 13FD 13F5
+13F8 13F8 13F0
+13F9 13F9 13F1
+13FA 13FA 13F2
+13FB 13FB 13F3
+13FC 13FC 13F4
+13FD 13FD 13F5
+1C80 1C80 0412
+1C81 1C81 0414
+1C82 1C82 041E
+1C83 1C83 0421
+1C84 1C84 0422
+1C85 1C85 0422
+1C86 1C86 042A
+1C87 1C87 0462
+1C88 1C88 A64A
+1C90 10D0 1C90
+1C91 10D1 1C91
+1C92 10D2 1C92
+1C93 10D3 1C93
+1C94 10D4 1C94
+1C95 10D5 1C95
+1C96 10D6 1C96
+1C97 10D7 1C97
+1C98 10D8 1C98
+1C99 10D9 1C99
+1C9A 10DA 1C9A
+1C9B 10DB 1C9B
+1C9C 10DC 1C9C
+1C9D 10DD 1C9D
+1C9E 10DE 1C9E
+1C9F 10DF 1C9F
+1CA0 10E0 1CA0
+1CA1 10E1 1CA1
+1CA2 10E2 1CA2
+1CA3 10E3 1CA3
+1CA4 10E4 1CA4
+1CA5 10E5 1CA5
+1CA6 10E6 1CA6
+1CA7 10E7 1CA7
+1CA8 10E8 1CA8
+1CA9 10E9 1CA9
+1CAA 10EA 1CAA
+1CAB 10EB 1CAB
+1CAC 10EC 1CAC
+1CAD 10ED 1CAD
+1CAE 10EE 1CAE
+1CAF 10EF 1CAF
+1CB0 10F0 1CB0
+1CB1 10F1 1CB1
+1CB2 10F2 1CB2
+1CB3 10F3 1CB3
+1CB4 10F4 1CB4
+1CB5 10F5 1CB5
+1CB6 10F6 1CB6
+1CB7 10F7 1CB7
+1CB8 10F8 1CB8
+1CB9 10F9 1CB9
+1CBA 10FA 1CBA
+1CBD 10FD 1CBD
+1CBE 10FE 1CBE
+1CBF 10FF 1CBF
+1D79 1D79 A77D
+1D7D 1D7D 2C63
+1D8E 1D8E A7C6
+1E00 1E01 1E00
+1E01 1E01 1E00
+1E02 1E03 1E02
+1E03 1E03 1E02
+1E04 1E05 1E04
+1E05 1E05 1E04
+1E06 1E07 1E06
+1E07 1E07 1E06
+1E08 1E09 1E08
+1E09 1E09 1E08
+1E0A 1E0B 1E0A
+1E0B 1E0B 1E0A
+1E0C 1E0D 1E0C
+1E0D 1E0D 1E0C
+1E0E 1E0F 1E0E
+1E0F 1E0F 1E0E
+1E10 1E11 1E10
+1E11 1E11 1E10
+1E12 1E13 1E12
+1E13 1E13 1E12
+1E14 1E15 1E14
+1E15 1E15 1E14
+1E16 1E17 1E16
+1E17 1E17 1E16
+1E18 1E19 1E18
+1E19 1E19 1E18
+1E1A 1E1B 1E1A
+1E1B 1E1B 1E1A
+1E1C 1E1D 1E1C
+1E1D 1E1D 1E1C
+1E1E 1E1F 1E1E
+1E1F 1E1F 1E1E
+1E20 1E21 1E20
+1E21 1E21 1E20
+1E22 1E23 1E22
+1E23 1E23 1E22
+1E24 1E25 1E24
+1E25 1E25 1E24
+1E26 1E27 1E26
+1E27 1E27 1E26
+1E28 1E29 1E28
+1E29 1E29 1E28
+1E2A 1E2B 1E2A
+1E2B 1E2B 1E2A
+1E2C 1E2D 1E2C
+1E2D 1E2D 1E2C
+1E2E 1E2F 1E2E
+1E2F 1E2F 1E2E
+1E30 1E31 1E30
+1E31 1E31 1E30
+1E32 1E33 1E32
+1E33 1E33 1E32
+1E34 1E35 1E34
+1E35 1E35 1E34
+1E36 1E37 1E36
+1E37 1E37 1E36
+1E38 1E39 1E38
+1E39 1E39 1E38
+1E3A 1E3B 1E3A
+1E3B 1E3B 1E3A
+1E3C 1E3D 1E3C
+1E3D 1E3D 1E3C
+1E3E 1E3F 1E3E
+1E3F 1E3F 1E3E
+1E40 1E41 1E40
+1E41 1E41 1E40
+1E42 1E43 1E42
+1E43 1E43 1E42
+1E44 1E45 1E44
+1E45 1E45 1E44
+1E46 1E47 1E46
+1E47 1E47 1E46
+1E48 1E49 1E48
+1E49 1E49 1E48
+1E4A 1E4B 1E4A
+1E4B 1E4B 1E4A
+1E4C 1E4D 1E4C
+1E4D 1E4D 1E4C
+1E4E 1E4F 1E4E
+1E4F 1E4F 1E4E
+1E50 1E51 1E50
+1E51 1E51 1E50
+1E52 1E53 1E52
+1E53 1E53 1E52
+1E54 1E55 1E54
+1E55 1E55 1E54
+1E56 1E57 1E56
+1E57 1E57 1E56
+1E58 1E59 1E58
+1E59 1E59 1E58
+1E5A 1E5B 1E5A
+1E5B 1E5B 1E5A
+1E5C 1E5D 1E5C
+1E5D 1E5D 1E5C
+1E5E 1E5F 1E5E
+1E5F 1E5F 1E5E
+1E60 1E61 1E60
+1E61 1E61 1E60
+1E62 1E63 1E62
+1E63 1E63 1E62
+1E64 1E65 1E64
+1E65 1E65 1E64
+1E66 1E67 1E66
+1E67 1E67 1E66
+1E68 1E69 1E68
+1E69 1E69 1E68
+1E6A 1E6B 1E6A
+1E6B 1E6B 1E6A
+1E6C 1E6D 1E6C
+1E6D 1E6D 1E6C
+1E6E 1E6F 1E6E
+1E6F 1E6F 1E6E
+1E70 1E71 1E70
+1E71 1E71 1E70
+1E72 1E73 1E72
+1E73 1E73 1E72
+1E74 1E75 1E74
+1E75 1E75 1E74
+1E76 1E77 1E76
+1E77 1E77 1E76
+1E78 1E79 1E78
+1E79 1E79 1E78
+1E7A 1E7B 1E7A
+1E7B 1E7B 1E7A
+1E7C 1E7D 1E7C
+1E7D 1E7D 1E7C
+1E7E 1E7F 1E7E
+1E7F 1E7F 1E7E
+1E80 1E81 1E80
+1E81 1E81 1E80
+1E82 1E83 1E82
+1E83 1E83 1E82
+1E84 1E85 1E84
+1E85 1E85 1E84
+1E86 1E87 1E86
+1E87 1E87 1E86
+1E88 1E89 1E88
+1E89 1E89 1E88
+1E8A 1E8B 1E8A
+1E8B 1E8B 1E8A
+1E8C 1E8D 1E8C
+1E8D 1E8D 1E8C
+1E8E 1E8F 1E8E
+1E8F 1E8F 1E8E
+1E90 1E91 1E90
+1E91 1E91 1E90
+1E92 1E93 1E92
+1E93 1E93 1E92
+1E94 1E95 1E94
+1E95 1E95 1E94
+1E9B 1E9B 1E60
+1E9E 00DF 1E9E
+1EA0 1EA1 1EA0
+1EA1 1EA1 1EA0
+1EA2 1EA3 1EA2
+1EA3 1EA3 1EA2
+1EA4 1EA5 1EA4
+1EA5 1EA5 1EA4
+1EA6 1EA7 1EA6
+1EA7 1EA7 1EA6
+1EA8 1EA9 1EA8
+1EA9 1EA9 1EA8
+1EAA 1EAB 1EAA
+1EAB 1EAB 1EAA
+1EAC 1EAD 1EAC
+1EAD 1EAD 1EAC
+1EAE 1EAF 1EAE
+1EAF 1EAF 1EAE
+1EB0 1EB1 1EB0
+1EB1 1EB1 1EB0
+1EB2 1EB3 1EB2
+1EB3 1EB3 1EB2
+1EB4 1EB5 1EB4
+1EB5 1EB5 1EB4
+1EB6 1EB7 1EB6
+1EB7 1EB7 1EB6
+1EB8 1EB9 1EB8
+1EB9 1EB9 1EB8
+1EBA 1EBB 1EBA
+1EBB 1EBB 1EBA
+1EBC 1EBD 1EBC
+1EBD 1EBD 1EBC
+1EBE 1EBF 1EBE
+1EBF 1EBF 1EBE
+1EC0 1EC1 1EC0
+1EC1 1EC1 1EC0
+1EC2 1EC3 1EC2
+1EC3 1EC3 1EC2
+1EC4 1EC5 1EC4
+1EC5 1EC5 1EC4
+1EC6 1EC7 1EC6
+1EC7 1EC7 1EC6
+1EC8 1EC9 1EC8
+1EC9 1EC9 1EC8
+1ECA 1ECB 1ECA
+1ECB 1ECB 1ECA
+1ECC 1ECD 1ECC
+1ECD 1ECD 1ECC
+1ECE 1ECF 1ECE
+1ECF 1ECF 1ECE
+1ED0 1ED1 1ED0
+1ED1 1ED1 1ED0
+1ED2 1ED3 1ED2
+1ED3 1ED3 1ED2
+1ED4 1ED5 1ED4
+1ED5 1ED5 1ED4
+1ED6 1ED7 1ED6
+1ED7 1ED7 1ED6
+1ED8 1ED9 1ED8
+1ED9 1ED9 1ED8
+1EDA 1EDB 1EDA
+1EDB 1EDB 1EDA
+1EDC 1EDD 1EDC
+1EDD 1EDD 1EDC
+1EDE 1EDF 1EDE
+1EDF 1EDF 1EDE
+1EE0 1EE1 1EE0
+1EE1 1EE1 1EE0
+1EE2 1EE3 1EE2
+1EE3 1EE3 1EE2
+1EE4 1EE5 1EE4
+1EE5 1EE5 1EE4
+1EE6 1EE7 1EE6
+1EE7 1EE7 1EE6
+1EE8 1EE9 1EE8
+1EE9 1EE9 1EE8
+1EEA 1EEB 1EEA
+1EEB 1EEB 1EEA
+1EEC 1EED 1EEC
+1EED 1EED 1EEC
+1EEE 1EEF 1EEE
+1EEF 1EEF 1EEE
+1EF0 1EF1 1EF0
+1EF1 1EF1 1EF0
+1EF2 1EF3 1EF2
+1EF3 1EF3 1EF2
+1EF4 1EF5 1EF4
+1EF5 1EF5 1EF4
+1EF6 1EF7 1EF6
+1EF7 1EF7 1EF6
+1EF8 1EF9 1EF8
+1EF9 1EF9 1EF8
+1EFA 1EFB 1EFA
+1EFB 1EFB 1EFA
+1EFC 1EFD 1EFC
+1EFD 1EFD 1EFC
+1EFE 1EFF 1EFE
+1EFF 1EFF 1EFE
+1F00 1F00 1F08
+1F01 1F01 1F09
+1F02 1F02 1F0A
+1F03 1F03 1F0B
+1F04 1F04 1F0C
+1F05 1F05 1F0D
+1F06 1F06 1F0E
+1F07 1F07 1F0F
+1F08 1F00 1F08
+1F09 1F01 1F09
+1F0A 1F02 1F0A
+1F0B 1F03 1F0B
+1F0C 1F04 1F0C
+1F0D 1F05 1F0D
+1F0E 1F06 1F0E
+1F0F 1F07 1F0F
+1F10 1F10 1F18
+1F11 1F11 1F19
+1F12 1F12 1F1A
+1F13 1F13 1F1B
+1F14 1F14 1F1C
+1F15 1F15 1F1D
+1F18 1F10 1F18
+1F19 1F11 1F19
+1F1A 1F12 1F1A
+1F1B 1F13 1F1B
+1F1C 1F14 1F1C
+1F1D 1F15 1F1D
+1F20 1F20 1F28
+1F21 1F21 1F29
+1F22 1F22 1F2A
+1F23 1F23 1F2B
+1F24 1F24 1F2C
+1F25 1F25 1F2D
+1F26 1F26 1F2E
+1F27 1F27 1F2F
+1F28 1F20 1F28
+1F29 1F21 1F29
+1F2A 1F22 1F2A
+1F2B 1F23 1F2B
+1F2C 1F24 1F2C
+1F2D 1F25 1F2D
+1F2E 1F26 1F2E
+1F2F 1F27 1F2F
+1F30 1F30 1F38
+1F31 1F31 1F39
+1F32 1F32 1F3A
+1F33 1F33 1F3B
+1F34 1F34 1F3C
+1F35 1F35 1F3D
+1F36 1F36 1F3E
+1F37 1F37 1F3F
+1F38 1F30 1F38
+1F39 1F31 1F39
+1F3A 1F32 1F3A
+1F3B 1F33 1F3B
+1F3C 1F34 1F3C
+1F3D 1F35 1F3D
+1F3E 1F36 1F3E
+1F3F 1F37 1F3F
+1F40 1F40 1F48
+1F41 1F41 1F49
+1F42 1F42 1F4A
+1F43 1F43 1F4B
+1F44 1F44 1F4C
+1F45 1F45 1F4D
+1F48 1F40 1F48
+1F49 1F41 1F49
+1F4A 1F42 1F4A
+1F4B 1F43 1F4B
+1F4C 1F44 1F4C
+1F4D 1F45 1F4D
+1F51 1F51 1F59
+1F53 1F53 1F5B
+1F55 1F55 1F5D
+1F57 1F57 1F5F
+1F59 1F51 1F59
+1F5B 1F53 1F5B
+1F5D 1F55 1F5D
+1F5F 1F57 1F5F
+1F60 1F60 1F68
+1F61 1F61 1F69
+1F62 1F62 1F6A
+1F63 1F63 1F6B
+1F64 1F64 1F6C
+1F65 1F65 1F6D
+1F66 1F66 1F6E
+1F67 1F67 1F6F
+1F68 1F60 1F68
+1F69 1F61 1F69
+1F6A 1F62 1F6A
+1F6B 1F63 1F6B
+1F6C 1F64 1F6C
+1F6D 1F65 1F6D
+1F6E 1F66 1F6E
+1F6F 1F67 1F6F
+1F70 1F70 1FBA
+1F71 1F71 1FBB
+1F72 1F72 1FC8
+1F73 1F73 1FC9
+1F74 1F74 1FCA
+1F75 1F75 1FCB
+1F76 1F76 1FDA
+1F77 1F77 1FDB
+1F78 1F78 1FF8
+1F79 1F79 1FF9
+1F7A 1F7A 1FEA
+1F7B 1F7B 1FEB
+1F7C 1F7C 1FFA
+1F7D 1F7D 1FFB
+1F80 1F80 1F88
+1F81 1F81 1F89
+1F82 1F82 1F8A
+1F83 1F83 1F8B
+1F84 1F84 1F8C
+1F85 1F85 1F8D
+1F86 1F86 1F8E
+1F87 1F87 1F8F
+1F88 1F80 1F88
+1F89 1F81 1F89
+1F8A 1F82 1F8A
+1F8B 1F83 1F8B
+1F8C 1F84 1F8C
+1F8D 1F85 1F8D
+1F8E 1F86 1F8E
+1F8F 1F87 1F8F
+1F90 1F90 1F98
+1F91 1F91 1F99
+1F92 1F92 1F9A
+1F93 1F93 1F9B
+1F94 1F94 1F9C
+1F95 1F95 1F9D
+1F96 1F96 1F9E
+1F97 1F97 1F9F
+1F98 1F90 1F98
+1F99 1F91 1F99
+1F9A 1F92 1F9A
+1F9B 1F93 1F9B
+1F9C 1F94 1F9C
+1F9D 1F95 1F9D
+1F9E 1F96 1F9E
+1F9F 1F97 1F9F
+1FA0 1FA0 1FA8
+1FA1 1FA1 1FA9
+1FA2 1FA2 1FAA
+1FA3 1FA3 1FAB
+1FA4 1FA4 1FAC
+1FA5 1FA5 1FAD
+1FA6 1FA6 1FAE
+1FA7 1FA7 1FAF
+1FA8 1FA0 1FA8
+1FA9 1FA1 1FA9
+1FAA 1FA2 1FAA
+1FAB 1FA3 1FAB
+1FAC 1FA4 1FAC
+1FAD 1FA5 1FAD
+1FAE 1FA6 1FAE
+1FAF 1FA7 1FAF
+1FB0 1FB0 1FB8
+1FB1 1FB1 1FB9
+1FB3 1FB3 1FBC
+1FB8 1FB0 1FB8
+1FB9 1FB1 1FB9
+1FBA 1F70 1FBA
+1FBB 1F71 1FBB
+1FBC 1FB3 1FBC
+1FBE 1FBE 0399
+1FC3 1FC3 1FCC
+1FC8 1F72 1FC8
+1FC9 1F73 1FC9
+1FCA 1F74 1FCA
+1FCB 1F75 1FCB
+1FCC 1FC3 1FCC
+1FD0 1FD0 1FD8
+1FD1 1FD1 1FD9
+1FD8 1FD0 1FD8
+1FD9 1FD1 1FD9
+1FDA 1F76 1FDA
+1FDB 1F77 1FDB
+1FE0 1FE0 1FE8
+1FE1 1FE1 1FE9
+1FE5 1FE5 1FEC
+1FE8 1FE0 1FE8
+1FE9 1FE1 1FE9
+1FEA 1F7A 1FEA
+1FEB 1F7B 1FEB
+1FEC 1FE5 1FEC
+1FF3 1FF3 1FFC
+1FF8 1F78 1FF8
+1FF9 1F79 1FF9
+1FFA 1F7C 1FFA
+1FFB 1F7D 1FFB
+1FFC 1FF3 1FFC
+2126 03C9 2126
+212A 006B 212A
+212B 00E5 212B
+2132 214E 2132
+214E 214E 2132
+2160 2170 2160
+2161 2171 2161
+2162 2172 2162
+2163 2173 2163
+2164 2174 2164
+2165 2175 2165
+2166 2176 2166
+2167 2177 2167
+2168 2178 2168
+2169 2179 2169
+216A 217A 216A
+216B 217B 216B
+216C 217C 216C
+216D 217D 216D
+216E 217E 216E
+216F 217F 216F
+2170 2170 2160
+2171 2171 2161
+2172 2172 2162
+2173 2173 2163
+2174 2174 2164
+2175 2175 2165
+2176 2176 2166
+2177 2177 2167
+2178 2178 2168
+2179 2179 2169
+217A 217A 216A
+217B 217B 216B
+217C 217C 216C
+217D 217D 216D
+217E 217E 216E
+217F 217F 216F
+2183 2184 2183
+2184 2184 2183
+24B6 24D0 24B6
+24B7 24D1 24B7
+24B8 24D2 24B8
+24B9 24D3 24B9
+24BA 24D4 24BA
+24BB 24D5 24BB
+24BC 24D6 24BC
+24BD 24D7 24BD
+24BE 24D8 24BE
+24BF 24D9 24BF
+24C0 24DA 24C0
+24C1 24DB 24C1
+24C2 24DC 24C2
+24C3 24DD 24C3
+24C4 24DE 24C4
+24C5 24DF 24C5
+24C6 24E0 24C6
+24C7 24E1 24C7
+24C8 24E2 24C8
+24C9 24E3 24C9
+24CA 24E4 24CA
+24CB 24E5 24CB
+24CC 24E6 24CC
+24CD 24E7 24CD
+24CE 24E8 24CE
+24CF 24E9 24CF
+24D0 24D0 24B6
+24D1 24D1 24B7
+24D2 24D2 24B8
+24D3 24D3 24B9
+24D4 24D4 24BA
+24D5 24D5 24BB
+24D6 24D6 24BC
+24D7 24D7 24BD
+24D8 24D8 24BE
+24D9 24D9 24BF
+24DA 24DA 24C0
+24DB 24DB 24C1
+24DC 24DC 24C2
+24DD 24DD 24C3
+24DE 24DE 24C4
+24DF 24DF 24C5
+24E0 24E0 24C6
+24E1 24E1 24C7
+24E2 24E2 24C8
+24E3 24E3 24C9
+24E4 24E4 24CA
+24E5 24E5 24CB
+24E6 24E6 24CC
+24E7 24E7 24CD
+24E8 24E8 24CE
+24E9 24E9 24CF
+2C00 2C30 2C00
+2C01 2C31 2C01
+2C02 2C32 2C02
+2C03 2C33 2C03
+2C04 2C34 2C04
+2C05 2C35 2C05
+2C06 2C36 2C06
+2C07 2C37 2C07
+2C08 2C38 2C08
+2C09 2C39 2C09
+2C0A 2C3A 2C0A
+2C0B 2C3B 2C0B
+2C0C 2C3C 2C0C
+2C0D 2C3D 2C0D
+2C0E 2C3E 2C0E
+2C0F 2C3F 2C0F
+2C10 2C40 2C10
+2C11 2C41 2C11
+2C12 2C42 2C12
+2C13 2C43 2C13
+2C14 2C44 2C14
+2C15 2C45 2C15
+2C16 2C46 2C16
+2C17 2C47 2C17
+2C18 2C48 2C18
+2C19 2C49 2C19
+2C1A 2C4A 2C1A
+2C1B 2C4B 2C1B
+2C1C 2C4C 2C1C
+2C1D 2C4D 2C1D
+2C1E 2C4E 2C1E
+2C1F 2C4F 2C1F
+2C20 2C50 2C20
+2C21 2C51 2C21
+2C22 2C52 2C22
+2C23 2C53 2C23
+2C24 2C54 2C24
+2C25 2C55 2C25
+2C26 2C56 2C26
+2C27 2C57 2C27
+2C28 2C58 2C28
+2C29 2C59 2C29
+2C2A 2C5A 2C2A
+2C2B 2C5B 2C2B
+2C2C 2C5C 2C2C
+2C2D 2C5D 2C2D
+2C2E 2C5E 2C2E
+2C2F 2C5F 2C2F
+2C30 2C30 2C00
+2C31 2C31 2C01
+2C32 2C32 2C02
+2C33 2C33 2C03
+2C34 2C34 2C04
+2C35 2C35 2C05
+2C36 2C36 2C06
+2C37 2C37 2C07
+2C38 2C38 2C08
+2C39 2C39 2C09
+2C3A 2C3A 2C0A
+2C3B 2C3B 2C0B
+2C3C 2C3C 2C0C
+2C3D 2C3D 2C0D
+2C3E 2C3E 2C0E
+2C3F 2C3F 2C0F
+2C40 2C40 2C10
+2C41 2C41 2C11
+2C42 2C42 2C12
+2C43 2C43 2C13
+2C44 2C44 2C14
+2C45 2C45 2C15
+2C46 2C46 2C16
+2C47 2C47 2C17
+2C48 2C48 2C18
+2C49 2C49 2C19
+2C4A 2C4A 2C1A
+2C4B 2C4B 2C1B
+2C4C 2C4C 2C1C
+2C4D 2C4D 2C1D
+2C4E 2C4E 2C1E
+2C4F 2C4F 2C1F
+2C50 2C50 2C20
+2C51 2C51 2C21
+2C52 2C52 2C22
+2C53 2C53 2C23
+2C54 2C54 2C24
+2C55 2C55 2C25
+2C56 2C56 2C26
+2C57 2C57 2C27
+2C58 2C58 2C28
+2C59 2C59 2C29
+2C5A 2C5A 2C2A
+2C5B 2C5B 2C2B
+2C5C 2C5C 2C2C
+2C5D 2C5D 2C2D
+2C5E 2C5E 2C2E
+2C5F 2C5F 2C2F
+2C60 2C61 2C60
+2C61 2C61 2C60
+2C62 026B 2C62
+2C63 1D7D 2C63
+2C64 027D 2C64
+2C65 2C65 023A
+2C66 2C66 023E
+2C67 2C68 2C67
+2C68 2C68 2C67
+2C69 2C6A 2C69
+2C6A 2C6A 2C69
+2C6B 2C6C 2C6B
+2C6C 2C6C 2C6B
+2C6D 0251 2C6D
+2C6E 0271 2C6E
+2C6F 0250 2C6F
+2C70 0252 2C70
+2C72 2C73 2C72
+2C73 2C73 2C72
+2C75 2C76 2C75
+2C76 2C76 2C75
+2C7E 023F 2C7E
+2C7F 0240 2C7F
+2C80 2C81 2C80
+2C81 2C81 2C80
+2C82 2C83 2C82
+2C83 2C83 2C82
+2C84 2C85 2C84
+2C85 2C85 2C84
+2C86 2C87 2C86
+2C87 2C87 2C86
+2C88 2C89 2C88
+2C89 2C89 2C88
+2C8A 2C8B 2C8A
+2C8B 2C8B 2C8A
+2C8C 2C8D 2C8C
+2C8D 2C8D 2C8C
+2C8E 2C8F 2C8E
+2C8F 2C8F 2C8E
+2C90 2C91 2C90
+2C91 2C91 2C90
+2C92 2C93 2C92
+2C93 2C93 2C92
+2C94 2C95 2C94
+2C95 2C95 2C94
+2C96 2C97 2C96
+2C97 2C97 2C96
+2C98 2C99 2C98
+2C99 2C99 2C98
+2C9A 2C9B 2C9A
+2C9B 2C9B 2C9A
+2C9C 2C9D 2C9C
+2C9D 2C9D 2C9C
+2C9E 2C9F 2C9E
+2C9F 2C9F 2C9E
+2CA0 2CA1 2CA0
+2CA1 2CA1 2CA0
+2CA2 2CA3 2CA2
+2CA3 2CA3 2CA2
+2CA4 2CA5 2CA4
+2CA5 2CA5 2CA4
+2CA6 2CA7 2CA6
+2CA7 2CA7 2CA6
+2CA8 2CA9 2CA8
+2CA9 2CA9 2CA8
+2CAA 2CAB 2CAA
+2CAB 2CAB 2CAA
+2CAC 2CAD 2CAC
+2CAD 2CAD 2CAC
+2CAE 2CAF 2CAE
+2CAF 2CAF 2CAE
+2CB0 2CB1 2CB0
+2CB1 2CB1 2CB0
+2CB2 2CB3 2CB2
+2CB3 2CB3 2CB2
+2CB4 2CB5 2CB4
+2CB5 2CB5 2CB4
+2CB6 2CB7 2CB6
+2CB7 2CB7 2CB6
+2CB8 2CB9 2CB8
+2CB9 2CB9 2CB8
+2CBA 2CBB 2CBA
+2CBB 2CBB 2CBA
+2CBC 2CBD 2CBC
+2CBD 2CBD 2CBC
+2CBE 2CBF 2CBE
+2CBF 2CBF 2CBE
+2CC0 2CC1 2CC0
+2CC1 2CC1 2CC0
+2CC2 2CC3 2CC2
+2CC3 2CC3 2CC2
+2CC4 2CC5 2CC4
+2CC5 2CC5 2CC4
+2CC6 2CC7 2CC6
+2CC7 2CC7 2CC6
+2CC8 2CC9 2CC8
+2CC9 2CC9 2CC8
+2CCA 2CCB 2CCA
+2CCB 2CCB 2CCA
+2CCC 2CCD 2CCC
+2CCD 2CCD 2CCC
+2CCE 2CCF 2CCE
+2CCF 2CCF 2CCE
+2CD0 2CD1 2CD0
+2CD1 2CD1 2CD0
+2CD2 2CD3 2CD2
+2CD3 2CD3 2CD2
+2CD4 2CD5 2CD4
+2CD5 2CD5 2CD4
+2CD6 2CD7 2CD6
+2CD7 2CD7 2CD6
+2CD8 2CD9 2CD8
+2CD9 2CD9 2CD8
+2CDA 2CDB 2CDA
+2CDB 2CDB 2CDA
+2CDC 2CDD 2CDC
+2CDD 2CDD 2CDC
+2CDE 2CDF 2CDE
+2CDF 2CDF 2CDE
+2CE0 2CE1 2CE0
+2CE1 2CE1 2CE0
+2CE2 2CE3 2CE2
+2CE3 2CE3 2CE2
+2CEB 2CEC 2CEB
+2CEC 2CEC 2CEB
+2CED 2CEE 2CED
+2CEE 2CEE 2CED
+2CF2 2CF3 2CF2
+2CF3 2CF3 2CF2
+2D00 2D00 10A0
+2D01 2D01 10A1
+2D02 2D02 10A2
+2D03 2D03 10A3
+2D04 2D04 10A4
+2D05 2D05 10A5
+2D06 2D06 10A6
+2D07 2D07 10A7
+2D08 2D08 10A8
+2D09 2D09 10A9
+2D0A 2D0A 10AA
+2D0B 2D0B 10AB
+2D0C 2D0C 10AC
+2D0D 2D0D 10AD
+2D0E 2D0E 10AE
+2D0F 2D0F 10AF
+2D10 2D10 10B0
+2D11 2D11 10B1
+2D12 2D12 10B2
+2D13 2D13 10B3
+2D14 2D14 10B4
+2D15 2D15 10B5
+2D16 2D16 10B6
+2D17 2D17 10B7
+2D18 2D18 10B8
+2D19 2D19 10B9
+2D1A 2D1A 10BA
+2D1B 2D1B 10BB
+2D1C 2D1C 10BC
+2D1D 2D1D 10BD
+2D1E 2D1E 10BE
+2D1F 2D1F 10BF
+2D20 2D20 10C0
+2D21 2D21 10C1
+2D22 2D22 10C2
+2D23 2D23 10C3
+2D24 2D24 10C4
+2D25 2D25 10C5
+2D27 2D27 10C7
+2D2D 2D2D 10CD
+A640 A641 A640
+A641 A641 A640
+A642 A643 A642
+A643 A643 A642
+A644 A645 A644
+A645 A645 A644
+A646 A647 A646
+A647 A647 A646
+A648 A649 A648
+A649 A649 A648
+A64A A64B A64A
+A64B A64B A64A
+A64C A64D A64C
+A64D A64D A64C
+A64E A64F A64E
+A64F A64F A64E
+A650 A651 A650
+A651 A651 A650
+A652 A653 A652
+A653 A653 A652
+A654 A655 A654
+A655 A655 A654
+A656 A657 A656
+A657 A657 A656
+A658 A659 A658
+A659 A659 A658
+A65A A65B A65A
+A65B A65B A65A
+A65C A65D A65C
+A65D A65D A65C
+A65E A65F A65E
+A65F A65F A65E
+A660 A661 A660
+A661 A661 A660
+A662 A663 A662
+A663 A663 A662
+A664 A665 A664
+A665 A665 A664
+A666 A667 A666
+A667 A667 A666
+A668 A669 A668
+A669 A669 A668
+A66A A66B A66A
+A66B A66B A66A
+A66C A66D A66C
+A66D A66D A66C
+A680 A681 A680
+A681 A681 A680
+A682 A683 A682
+A683 A683 A682
+A684 A685 A684
+A685 A685 A684
+A686 A687 A686
+A687 A687 A686
+A688 A689 A688
+A689 A689 A688
+A68A A68B A68A
+A68B A68B A68A
+A68C A68D A68C
+A68D A68D A68C
+A68E A68F A68E
+A68F A68F A68E
+A690 A691 A690
+A691 A691 A690
+A692 A693 A692
+A693 A693 A692
+A694 A695 A694
+A695 A695 A694
+A696 A697 A696
+A697 A697 A696
+A698 A699 A698
+A699 A699 A698
+A69A A69B A69A
+A69B A69B A69A
+A722 A723 A722
+A723 A723 A722
+A724 A725 A724
+A725 A725 A724
+A726 A727 A726
+A727 A727 A726
+A728 A729 A728
+A729 A729 A728
+A72A A72B A72A
+A72B A72B A72A
+A72C A72D A72C
+A72D A72D A72C
+A72E A72F A72E
+A72F A72F A72E
+A732 A733 A732
+A733 A733 A732
+A734 A735 A734
+A735 A735 A734
+A736 A737 A736
+A737 A737 A736
+A738 A739 A738
+A739 A739 A738
+A73A A73B A73A
+A73B A73B A73A
+A73C A73D A73C
+A73D A73D A73C
+A73E A73F A73E
+A73F A73F A73E
+A740 A741 A740
+A741 A741 A740
+A742 A743 A742
+A743 A743 A742
+A744 A745 A744
+A745 A745 A744
+A746 A747 A746
+A747 A747 A746
+A748 A749 A748
+A749 A749 A748
+A74A A74B A74A
+A74B A74B A74A
+A74C A74D A74C
+A74D A74D A74C
+A74E A74F A74E
+A74F A74F A74E
+A750 A751 A750
+A751 A751 A750
+A752 A753 A752
+A753 A753 A752
+A754 A755 A754
+A755 A755 A754
+A756 A757 A756
+A757 A757 A756
+A758 A759 A758
+A759 A759 A758
+A75A A75B A75A
+A75B A75B A75A
+A75C A75D A75C
+A75D A75D A75C
+A75E A75F A75E
+A75F A75F A75E
+A760 A761 A760
+A761 A761 A760
+A762 A763 A762
+A763 A763 A762
+A764 A765 A764
+A765 A765 A764
+A766 A767 A766
+A767 A767 A766
+A768 A769 A768
+A769 A769 A768
+A76A A76B A76A
+A76B A76B A76A
+A76C A76D A76C
+A76D A76D A76C
+A76E A76F A76E
+A76F A76F A76E
+A779 A77A A779
+A77A A77A A779
+A77B A77C A77B
+A77C A77C A77B
+A77D 1D79 A77D
+A77E A77F A77E
+A77F A77F A77E
+A780 A781 A780
+A781 A781 A780
+A782 A783 A782
+A783 A783 A782
+A784 A785 A784
+A785 A785 A784
+A786 A787 A786
+A787 A787 A786
+A78B A78C A78B
+A78C A78C A78B
+A78D 0265 A78D
+A790 A791 A790
+A791 A791 A790
+A792 A793 A792
+A793 A793 A792
+A794 A794 A7C4
+A796 A797 A796
+A797 A797 A796
+A798 A799 A798
+A799 A799 A798
+A79A A79B A79A
+A79B A79B A79A
+A79C A79D A79C
+A79D A79D A79C
+A79E A79F A79E
+A79F A79F A79E
+A7A0 A7A1 A7A0
+A7A1 A7A1 A7A0
+A7A2 A7A3 A7A2
+A7A3 A7A3 A7A2
+A7A4 A7A5 A7A4
+A7A5 A7A5 A7A4
+A7A6 A7A7 A7A6
+A7A7 A7A7 A7A6
+A7A8 A7A9 A7A8
+A7A9 A7A9 A7A8
+A7AA 0266 A7AA
+A7AB 025C A7AB
+A7AC 0261 A7AC
+A7AD 026C A7AD
+A7AE 026A A7AE
+A7B0 029E A7B0
+A7B1 0287 A7B1
+A7B2 029D A7B2
+A7B3 AB53 A7B3
+A7B4 A7B5 A7B4
+A7B5 A7B5 A7B4
+A7B6 A7B7 A7B6
+A7B7 A7B7 A7B6
+A7B8 A7B9 A7B8
+A7B9 A7B9 A7B8
+A7BA A7BB A7BA
+A7BB A7BB A7BA
+A7BC A7BD A7BC
+A7BD A7BD A7BC
+A7BE A7BF A7BE
+A7BF A7BF A7BE
+A7C0 A7C1 A7C0
+A7C1 A7C1 A7C0
+A7C2 A7C3 A7C2
+A7C3 A7C3 A7C2
+A7C4 A794 A7C4
+A7C5 0282 A7C5
+A7C6 1D8E A7C6
+A7C7 A7C8 A7C7
+A7C8 A7C8 A7C7
+A7C9 A7CA A7C9
+A7CA A7CA A7C9
+A7D0 A7D1 A7D0
+A7D1 A7D1 A7D0
+A7D6 A7D7 A7D6
+A7D7 A7D7 A7D6
+A7D8 A7D9 A7D8
+A7D9 A7D9 A7D8
+A7F5 A7F6 A7F5
+A7F6 A7F6 A7F5
+AB53 AB53 A7B3
+AB70 AB70 13A0
+AB71 AB71 13A1
+AB72 AB72 13A2
+AB73 AB73 13A3
+AB74 AB74 13A4
+AB75 AB75 13A5
+AB76 AB76 13A6
+AB77 AB77 13A7
+AB78 AB78 13A8
+AB79 AB79 13A9
+AB7A AB7A 13AA
+AB7B AB7B 13AB
+AB7C AB7C 13AC
+AB7D AB7D 13AD
+AB7E AB7E 13AE
+AB7F AB7F 13AF
+AB80 AB80 13B0
+AB81 AB81 13B1
+AB82 AB82 13B2
+AB83 AB83 13B3
+AB84 AB84 13B4
+AB85 AB85 13B5
+AB86 AB86 13B6
+AB87 AB87 13B7
+AB88 AB88 13B8
+AB89 AB89 13B9
+AB8A AB8A 13BA
+AB8B AB8B 13BB
+AB8C AB8C 13BC
+AB8D AB8D 13BD
+AB8E AB8E 13BE
+AB8F AB8F 13BF
+AB90 AB90 13C0
+AB91 AB91 13C1
+AB92 AB92 13C2
+AB93 AB93 13C3
+AB94 AB94 13C4
+AB95 AB95 13C5
+AB96 AB96 13C6
+AB97 AB97 13C7
+AB98 AB98 13C8
+AB99 AB99 13C9
+AB9A AB9A 13CA
+AB9B AB9B 13CB
+AB9C AB9C 13CC
+AB9D AB9D 13CD
+AB9E AB9E 13CE
+AB9F AB9F 13CF
+ABA0 ABA0 13D0
+ABA1 ABA1 13D1
+ABA2 ABA2 13D2
+ABA3 ABA3 13D3
+ABA4 ABA4 13D4
+ABA5 ABA5 13D5
+ABA6 ABA6 13D6
+ABA7 ABA7 13D7
+ABA8 ABA8 13D8
+ABA9 ABA9 13D9
+ABAA ABAA 13DA
+ABAB ABAB 13DB
+ABAC ABAC 13DC
+ABAD ABAD 13DD
+ABAE ABAE 13DE
+ABAF ABAF 13DF
+ABB0 ABB0 13E0
+ABB1 ABB1 13E1
+ABB2 ABB2 13E2
+ABB3 ABB3 13E3
+ABB4 ABB4 13E4
+ABB5 ABB5 13E5
+ABB6 ABB6 13E6
+ABB7 ABB7 13E7
+ABB8 ABB8 13E8
+ABB9 ABB9 13E9
+ABBA ABBA 13EA
+ABBB ABBB 13EB
+ABBC ABBC 13EC
+ABBD ABBD 13ED
+ABBE ABBE 13EE
+ABBF ABBF 13EF
+FF21 FF41 FF21
+FF22 FF42 FF22
+FF23 FF43 FF23
+FF24 FF44 FF24
+FF25 FF45 FF25
+FF26 FF46 FF26
+FF27 FF47 FF27
+FF28 FF48 FF28
+FF29 FF49 FF29
+FF2A FF4A FF2A
+FF2B FF4B FF2B
+FF2C FF4C FF2C
+FF2D FF4D FF2D
+FF2E FF4E FF2E
+FF2F FF4F FF2F
+FF30 FF50 FF30
+FF31 FF51 FF31
+FF32 FF52 FF32
+FF33 FF53 FF33
+FF34 FF54 FF34
+FF35 FF55 FF35
+FF36 FF56 FF36
+FF37 FF57 FF37
+FF38 FF58 FF38
+FF39 FF59 FF39
+FF3A FF5A FF3A
+FF41 FF41 FF21
+FF42 FF42 FF22
+FF43 FF43 FF23
+FF44 FF44 FF24
+FF45 FF45 FF25
+FF46 FF46 FF26
+FF47 FF47 FF27
+FF48 FF48 FF28
+FF49 FF49 FF29
+FF4A FF4A FF2A
+FF4B FF4B FF2B
+FF4C FF4C FF2C
+FF4D FF4D FF2D
+FF4E FF4E FF2E
+FF4F FF4F FF2F
+FF50 FF50 FF30
+FF51 FF51 FF31
+FF52 FF52 FF32
+FF53 FF53 FF33
+FF54 FF54 FF34
+FF55 FF55 FF35
+FF56 FF56 FF36
+FF57 FF57 FF37
+FF58 FF58 FF38
+FF59 FF59 FF39
+FF5A FF5A FF3A
+DROP VIEW v_bmp;
+EXECUTE IMMEDIATE SFORMAT('
+CREATE VIEW v_supplementary AS
+SELECT
+ seq AS codepoint,
+ LPAD(HEX(seq),8,''0'') AS codepoint_hex8,
+ CONVERT(CHAR(seq USING utf32) USING {}) COLLATE {} AS c
+FROM
+ seq_65536_to_1114111', @@character_set_connection, @@collation_connection);
+SELECT COLLATION(c) FROM v_supplementary LIMIT 1;
+COLLATION(c)
+utf8mb4_uca1400_ai_ci
+SELECT
+codepoint_hex8,
+HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)),
+HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32))
+FROM v_supplementary
+WHERE BINARY(c)<>BINARY(LOWER(c)) OR BINARY(c)<>BINARY(UPPER(c));
+codepoint_hex8 HEX(CAST(LOWER(c) AS CHAR CHARACTER SET utf32)) HEX(CAST(UPPER(c) AS CHAR CHARACTER SET utf32))
+00010400 00010428 00010400
+00010401 00010429 00010401
+00010402 0001042A 00010402
+00010403 0001042B 00010403
+00010404 0001042C 00010404
+00010405 0001042D 00010405
+00010406 0001042E 00010406
+00010407 0001042F 00010407
+00010408 00010430 00010408
+00010409 00010431 00010409
+0001040A 00010432 0001040A
+0001040B 00010433 0001040B
+0001040C 00010434 0001040C
+0001040D 00010435 0001040D
+0001040E 00010436 0001040E
+0001040F 00010437 0001040F
+00010410 00010438 00010410
+00010411 00010439 00010411
+00010412 0001043A 00010412
+00010413 0001043B 00010413
+00010414 0001043C 00010414
+00010415 0001043D 00010415
+00010416 0001043E 00010416
+00010417 0001043F 00010417
+00010418 00010440 00010418
+00010419 00010441 00010419
+0001041A 00010442 0001041A
+0001041B 00010443 0001041B
+0001041C 00010444 0001041C
+0001041D 00010445 0001041D
+0001041E 00010446 0001041E
+0001041F 00010447 0001041F
+00010420 00010448 00010420
+00010421 00010449 00010421
+00010422 0001044A 00010422
+00010423 0001044B 00010423
+00010424 0001044C 00010424
+00010425 0001044D 00010425
+00010426 0001044E 00010426
+00010427 0001044F 00010427
+00010428 00010428 00010400
+00010429 00010429 00010401
+0001042A 0001042A 00010402
+0001042B 0001042B 00010403
+0001042C 0001042C 00010404
+0001042D 0001042D 00010405
+0001042E 0001042E 00010406
+0001042F 0001042F 00010407
+00010430 00010430 00010408
+00010431 00010431 00010409
+00010432 00010432 0001040A
+00010433 00010433 0001040B
+00010434 00010434 0001040C
+00010435 00010435 0001040D
+00010436 00010436 0001040E
+00010437 00010437 0001040F
+00010438 00010438 00010410
+00010439 00010439 00010411
+0001043A 0001043A 00010412
+0001043B 0001043B 00010413
+0001043C 0001043C 00010414
+0001043D 0001043D 00010415
+0001043E 0001043E 00010416
+0001043F 0001043F 00010417
+00010440 00010440 00010418
+00010441 00010441 00010419
+00010442 00010442 0001041A
+00010443 00010443 0001041B
+00010444 00010444 0001041C
+00010445 00010445 0001041D
+00010446 00010446 0001041E
+00010447 00010447 0001041F
+00010448 00010448 00010420
+00010449 00010449 00010421
+0001044A 0001044A 00010422
+0001044B 0001044B 00010423
+0001044C 0001044C 00010424
+0001044D 0001044D 00010425
+0001044E 0001044E 00010426
+0001044F 0001044F 00010427
+000104B0 000104D8 000104B0
+000104B1 000104D9 000104B1
+000104B2 000104DA 000104B2
+000104B3 000104DB 000104B3
+000104B4 000104DC 000104B4
+000104B5 000104DD 000104B5
+000104B6 000104DE 000104B6
+000104B7 000104DF 000104B7
+000104B8 000104E0 000104B8
+000104B9 000104E1 000104B9
+000104BA 000104E2 000104BA
+000104BB 000104E3 000104BB
+000104BC 000104E4 000104BC
+000104BD 000104E5 000104BD
+000104BE 000104E6 000104BE
+000104BF 000104E7 000104BF
+000104C0 000104E8 000104C0
+000104C1 000104E9 000104C1
+000104C2 000104EA 000104C2
+000104C3 000104EB 000104C3
+000104C4 000104EC 000104C4
+000104C5 000104ED 000104C5
+000104C6 000104EE 000104C6
+000104C7 000104EF 000104C7
+000104C8 000104F0 000104C8
+000104C9 000104F1 000104C9
+000104CA 000104F2 000104CA
+000104CB 000104F3 000104CB
+000104CC 000104F4 000104CC
+000104CD 000104F5 000104CD
+000104CE 000104F6 000104CE
+000104CF 000104F7 000104CF
+000104D0 000104F8 000104D0
+000104D1 000104F9 000104D1
+000104D2 000104FA 000104D2
+000104D3 000104FB 000104D3
+000104D8 000104D8 000104B0
+000104D9 000104D9 000104B1
+000104DA 000104DA 000104B2
+000104DB 000104DB 000104B3
+000104DC 000104DC 000104B4
+000104DD 000104DD 000104B5
+000104DE 000104DE 000104B6
+000104DF 000104DF 000104B7
+000104E0 000104E0 000104B8
+000104E1 000104E1 000104B9
+000104E2 000104E2 000104BA
+000104E3 000104E3 000104BB
+000104E4 000104E4 000104BC
+000104E5 000104E5 000104BD
+000104E6 000104E6 000104BE
+000104E7 000104E7 000104BF
+000104E8 000104E8 000104C0
+000104E9 000104E9 000104C1
+000104EA 000104EA 000104C2
+000104EB 000104EB 000104C3
+000104EC 000104EC 000104C4
+000104ED 000104ED 000104C5
+000104EE 000104EE 000104C6
+000104EF 000104EF 000104C7
+000104F0 000104F0 000104C8
+000104F1 000104F1 000104C9
+000104F2 000104F2 000104CA
+000104F3 000104F3 000104CB
+000104F4 000104F4 000104CC
+000104F5 000104F5 000104CD
+000104F6 000104F6 000104CE
+000104F7 000104F7 000104CF
+000104F8 000104F8 000104D0
+000104F9 000104F9 000104D1
+000104FA 000104FA 000104D2
+000104FB 000104FB 000104D3
+00010570 00010597 00010570
+00010571 00010598 00010571
+00010572 00010599 00010572
+00010573 0001059A 00010573
+00010574 0001059B 00010574
+00010575 0001059C 00010575
+00010576 0001059D 00010576
+00010577 0001059E 00010577
+00010578 0001059F 00010578
+00010579 000105A0 00010579
+0001057A 000105A1 0001057A
+0001057C 000105A3 0001057C
+0001057D 000105A4 0001057D
+0001057E 000105A5 0001057E
+0001057F 000105A6 0001057F
+00010580 000105A7 00010580
+00010581 000105A8 00010581
+00010582 000105A9 00010582
+00010583 000105AA 00010583
+00010584 000105AB 00010584
+00010585 000105AC 00010585
+00010586 000105AD 00010586
+00010587 000105AE 00010587
+00010588 000105AF 00010588
+00010589 000105B0 00010589
+0001058A 000105B1 0001058A
+0001058C 000105B3 0001058C
+0001058D 000105B4 0001058D
+0001058E 000105B5 0001058E
+0001058F 000105B6 0001058F
+00010590 000105B7 00010590
+00010591 000105B8 00010591
+00010592 000105B9 00010592
+00010594 000105BB 00010594
+00010595 000105BC 00010595
+00010597 00010597 00010570
+00010598 00010598 00010571
+00010599 00010599 00010572
+0001059A 0001059A 00010573
+0001059B 0001059B 00010574
+0001059C 0001059C 00010575
+0001059D 0001059D 00010576
+0001059E 0001059E 00010577
+0001059F 0001059F 00010578
+000105A0 000105A0 00010579
+000105A1 000105A1 0001057A
+000105A3 000105A3 0001057C
+000105A4 000105A4 0001057D
+000105A5 000105A5 0001057E
+000105A6 000105A6 0001057F
+000105A7 000105A7 00010580
+000105A8 000105A8 00010581
+000105A9 000105A9 00010582
+000105AA 000105AA 00010583
+000105AB 000105AB 00010584
+000105AC 000105AC 00010585
+000105AD 000105AD 00010586
+000105AE 000105AE 00010587
+000105AF 000105AF 00010588
+000105B0 000105B0 00010589
+000105B1 000105B1 0001058A
+000105B3 000105B3 0001058C
+000105B4 000105B4 0001058D
+000105B5 000105B5 0001058E
+000105B6 000105B6 0001058F
+000105B7 000105B7 00010590
+000105B8 000105B8 00010591
+000105B9 000105B9 00010592
+000105BB 000105BB 00010594
+000105BC 000105BC 00010595
+00010C80 00010CC0 00010C80
+00010C81 00010CC1 00010C81
+00010C82 00010CC2 00010C82
+00010C83 00010CC3 00010C83
+00010C84 00010CC4 00010C84
+00010C85 00010CC5 00010C85
+00010C86 00010CC6 00010C86
+00010C87 00010CC7 00010C87
+00010C88 00010CC8 00010C88
+00010C89 00010CC9 00010C89
+00010C8A 00010CCA 00010C8A
+00010C8B 00010CCB 00010C8B
+00010C8C 00010CCC 00010C8C
+00010C8D 00010CCD 00010C8D
+00010C8E 00010CCE 00010C8E
+00010C8F 00010CCF 00010C8F
+00010C90 00010CD0 00010C90
+00010C91 00010CD1 00010C91
+00010C92 00010CD2 00010C92
+00010C93 00010CD3 00010C93
+00010C94 00010CD4 00010C94
+00010C95 00010CD5 00010C95
+00010C96 00010CD6 00010C96
+00010C97 00010CD7 00010C97
+00010C98 00010CD8 00010C98
+00010C99 00010CD9 00010C99
+00010C9A 00010CDA 00010C9A
+00010C9B 00010CDB 00010C9B
+00010C9C 00010CDC 00010C9C
+00010C9D 00010CDD 00010C9D
+00010C9E 00010CDE 00010C9E
+00010C9F 00010CDF 00010C9F
+00010CA0 00010CE0 00010CA0
+00010CA1 00010CE1 00010CA1
+00010CA2 00010CE2 00010CA2
+00010CA3 00010CE3 00010CA3
+00010CA4 00010CE4 00010CA4
+00010CA5 00010CE5 00010CA5
+00010CA6 00010CE6 00010CA6
+00010CA7 00010CE7 00010CA7
+00010CA8 00010CE8 00010CA8
+00010CA9 00010CE9 00010CA9
+00010CAA 00010CEA 00010CAA
+00010CAB 00010CEB 00010CAB
+00010CAC 00010CEC 00010CAC
+00010CAD 00010CED 00010CAD
+00010CAE 00010CEE 00010CAE
+00010CAF 00010CEF 00010CAF
+00010CB0 00010CF0 00010CB0
+00010CB1 00010CF1 00010CB1
+00010CB2 00010CF2 00010CB2
+00010CC0 00010CC0 00010C80
+00010CC1 00010CC1 00010C81
+00010CC2 00010CC2 00010C82
+00010CC3 00010CC3 00010C83
+00010CC4 00010CC4 00010C84
+00010CC5 00010CC5 00010C85
+00010CC6 00010CC6 00010C86
+00010CC7 00010CC7 00010C87
+00010CC8 00010CC8 00010C88
+00010CC9 00010CC9 00010C89
+00010CCA 00010CCA 00010C8A
+00010CCB 00010CCB 00010C8B
+00010CCC 00010CCC 00010C8C
+00010CCD 00010CCD 00010C8D
+00010CCE 00010CCE 00010C8E
+00010CCF 00010CCF 00010C8F
+00010CD0 00010CD0 00010C90
+00010CD1 00010CD1 00010C91
+00010CD2 00010CD2 00010C92
+00010CD3 00010CD3 00010C93
+00010CD4 00010CD4 00010C94
+00010CD5 00010CD5 00010C95
+00010CD6 00010CD6 00010C96
+00010CD7 00010CD7 00010C97
+00010CD8 00010CD8 00010C98
+00010CD9 00010CD9 00010C99
+00010CDA 00010CDA 00010C9A
+00010CDB 00010CDB 00010C9B
+00010CDC 00010CDC 00010C9C
+00010CDD 00010CDD 00010C9D
+00010CDE 00010CDE 00010C9E
+00010CDF 00010CDF 00010C9F
+00010CE0 00010CE0 00010CA0
+00010CE1 00010CE1 00010CA1
+00010CE2 00010CE2 00010CA2
+00010CE3 00010CE3 00010CA3
+00010CE4 00010CE4 00010CA4
+00010CE5 00010CE5 00010CA5
+00010CE6 00010CE6 00010CA6
+00010CE7 00010CE7 00010CA7
+00010CE8 00010CE8 00010CA8
+00010CE9 00010CE9 00010CA9
+00010CEA 00010CEA 00010CAA
+00010CEB 00010CEB 00010CAB
+00010CEC 00010CEC 00010CAC
+00010CED 00010CED 00010CAD
+00010CEE 00010CEE 00010CAE
+00010CEF 00010CEF 00010CAF
+00010CF0 00010CF0 00010CB0
+00010CF1 00010CF1 00010CB1
+00010CF2 00010CF2 00010CB2
+000118A0 000118C0 000118A0
+000118A1 000118C1 000118A1
+000118A2 000118C2 000118A2
+000118A3 000118C3 000118A3
+000118A4 000118C4 000118A4
+000118A5 000118C5 000118A5
+000118A6 000118C6 000118A6
+000118A7 000118C7 000118A7
+000118A8 000118C8 000118A8
+000118A9 000118C9 000118A9
+000118AA 000118CA 000118AA
+000118AB 000118CB 000118AB
+000118AC 000118CC 000118AC
+000118AD 000118CD 000118AD
+000118AE 000118CE 000118AE
+000118AF 000118CF 000118AF
+000118B0 000118D0 000118B0
+000118B1 000118D1 000118B1
+000118B2 000118D2 000118B2
+000118B3 000118D3 000118B3
+000118B4 000118D4 000118B4
+000118B5 000118D5 000118B5
+000118B6 000118D6 000118B6
+000118B7 000118D7 000118B7
+000118B8 000118D8 000118B8
+000118B9 000118D9 000118B9
+000118BA 000118DA 000118BA
+000118BB 000118DB 000118BB
+000118BC 000118DC 000118BC
+000118BD 000118DD 000118BD
+000118BE 000118DE 000118BE
+000118BF 000118DF 000118BF
+000118C0 000118C0 000118A0
+000118C1 000118C1 000118A1
+000118C2 000118C2 000118A2
+000118C3 000118C3 000118A3
+000118C4 000118C4 000118A4
+000118C5 000118C5 000118A5
+000118C6 000118C6 000118A6
+000118C7 000118C7 000118A7
+000118C8 000118C8 000118A8
+000118C9 000118C9 000118A9
+000118CA 000118CA 000118AA
+000118CB 000118CB 000118AB
+000118CC 000118CC 000118AC
+000118CD 000118CD 000118AD
+000118CE 000118CE 000118AE
+000118CF 000118CF 000118AF
+000118D0 000118D0 000118B0
+000118D1 000118D1 000118B1
+000118D2 000118D2 000118B2
+000118D3 000118D3 000118B3
+000118D4 000118D4 000118B4
+000118D5 000118D5 000118B5
+000118D6 000118D6 000118B6
+000118D7 000118D7 000118B7
+000118D8 000118D8 000118B8
+000118D9 000118D9 000118B9
+000118DA 000118DA 000118BA
+000118DB 000118DB 000118BB
+000118DC 000118DC 000118BC
+000118DD 000118DD 000118BD
+000118DE 000118DE 000118BE
+000118DF 000118DF 000118BF
+00016E40 00016E60 00016E40
+00016E41 00016E61 00016E41
+00016E42 00016E62 00016E42
+00016E43 00016E63 00016E43
+00016E44 00016E64 00016E44
+00016E45 00016E65 00016E45
+00016E46 00016E66 00016E46
+00016E47 00016E67 00016E47
+00016E48 00016E68 00016E48
+00016E49 00016E69 00016E49
+00016E4A 00016E6A 00016E4A
+00016E4B 00016E6B 00016E4B
+00016E4C 00016E6C 00016E4C
+00016E4D 00016E6D 00016E4D
+00016E4E 00016E6E 00016E4E
+00016E4F 00016E6F 00016E4F
+00016E50 00016E70 00016E50
+00016E51 00016E71 00016E51
+00016E52 00016E72 00016E52
+00016E53 00016E73 00016E53
+00016E54 00016E74 00016E54
+00016E55 00016E75 00016E55
+00016E56 00016E76 00016E56
+00016E57 00016E77 00016E57
+00016E58 00016E78 00016E58
+00016E59 00016E79 00016E59
+00016E5A 00016E7A 00016E5A
+00016E5B 00016E7B 00016E5B
+00016E5C 00016E7C 00016E5C
+00016E5D 00016E7D 00016E5D
+00016E5E 00016E7E 00016E5E
+00016E5F 00016E7F 00016E5F
+00016E60 00016E60 00016E40
+00016E61 00016E61 00016E41
+00016E62 00016E62 00016E42
+00016E63 00016E63 00016E43
+00016E64 00016E64 00016E44
+00016E65 00016E65 00016E45
+00016E66 00016E66 00016E46
+00016E67 00016E67 00016E47
+00016E68 00016E68 00016E48
+00016E69 00016E69 00016E49
+00016E6A 00016E6A 00016E4A
+00016E6B 00016E6B 00016E4B
+00016E6C 00016E6C 00016E4C
+00016E6D 00016E6D 00016E4D
+00016E6E 00016E6E 00016E4E
+00016E6F 00016E6F 00016E4F
+00016E70 00016E70 00016E50
+00016E71 00016E71 00016E51
+00016E72 00016E72 00016E52
+00016E73 00016E73 00016E53
+00016E74 00016E74 00016E54
+00016E75 00016E75 00016E55
+00016E76 00016E76 00016E56
+00016E77 00016E77 00016E57
+00016E78 00016E78 00016E58
+00016E79 00016E79 00016E59
+00016E7A 00016E7A 00016E5A
+00016E7B 00016E7B 00016E5B
+00016E7C 00016E7C 00016E5C
+00016E7D 00016E7D 00016E5D
+00016E7E 00016E7E 00016E5E
+00016E7F 00016E7F 00016E5F
+0001E900 0001E922 0001E900
+0001E901 0001E923 0001E901
+0001E902 0001E924 0001E902
+0001E903 0001E925 0001E903
+0001E904 0001E926 0001E904
+0001E905 0001E927 0001E905
+0001E906 0001E928 0001E906
+0001E907 0001E929 0001E907
+0001E908 0001E92A 0001E908
+0001E909 0001E92B 0001E909
+0001E90A 0001E92C 0001E90A
+0001E90B 0001E92D 0001E90B
+0001E90C 0001E92E 0001E90C
+0001E90D 0001E92F 0001E90D
+0001E90E 0001E930 0001E90E
+0001E90F 0001E931 0001E90F
+0001E910 0001E932 0001E910
+0001E911 0001E933 0001E911
+0001E912 0001E934 0001E912
+0001E913 0001E935 0001E913
+0001E914 0001E936 0001E914
+0001E915 0001E937 0001E915
+0001E916 0001E938 0001E916
+0001E917 0001E939 0001E917
+0001E918 0001E93A 0001E918
+0001E919 0001E93B 0001E919
+0001E91A 0001E93C 0001E91A
+0001E91B 0001E93D 0001E91B
+0001E91C 0001E93E 0001E91C
+0001E91D 0001E93F 0001E91D
+0001E91E 0001E940 0001E91E
+0001E91F 0001E941 0001E91F
+0001E920 0001E942 0001E920
+0001E921 0001E943 0001E921
+0001E922 0001E922 0001E900
+0001E923 0001E923 0001E901
+0001E924 0001E924 0001E902
+0001E925 0001E925 0001E903
+0001E926 0001E926 0001E904
+0001E927 0001E927 0001E905
+0001E928 0001E928 0001E906
+0001E929 0001E929 0001E907
+0001E92A 0001E92A 0001E908
+0001E92B 0001E92B 0001E909
+0001E92C 0001E92C 0001E90A
+0001E92D 0001E92D 0001E90B
+0001E92E 0001E92E 0001E90C
+0001E92F 0001E92F 0001E90D
+0001E930 0001E930 0001E90E
+0001E931 0001E931 0001E90F
+0001E932 0001E932 0001E910
+0001E933 0001E933 0001E911
+0001E934 0001E934 0001E912
+0001E935 0001E935 0001E913
+0001E936 0001E936 0001E914
+0001E937 0001E937 0001E915
+0001E938 0001E938 0001E916
+0001E939 0001E939 0001E917
+0001E93A 0001E93A 0001E918
+0001E93B 0001E93B 0001E919
+0001E93C 0001E93C 0001E91A
+0001E93D 0001E93D 0001E91B
+0001E93E 0001E93E 0001E91C
+0001E93F 0001E93F 0001E91D
+0001E940 0001E940 0001E91E
+0001E941 0001E941 0001E91F
+0001E942 0001E942 0001E920
+0001E943 0001E943 0001E921
+DROP VIEW v_supplementary;
+#
+# End of 10.10 tests
+#
diff --git a/mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.test b/mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.test
new file mode 100644
index 00000000000..288f86155e2
--- /dev/null
+++ b/mysql-test/main/ctype_utf8mb4_uca1400_ai_ci_casefold.test
@@ -0,0 +1,15 @@
+--echo #
+--echo # Start of 10.10 tests
+--echo #
+
+--echo #
+--echo # MDEV-30577 Case folding for uca1400 collations is not up to date
+--echo #
+
+SET NAMES utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
+--source include/ctype_unicode_casefold_bmp.inc
+--source include/ctype_unicode_casefold_supplementary.inc
+
+--echo #
+--echo # End of 10.10 tests
+--echo #
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result
index 7203c9bf67a..0c23f558757 100644
--- a/mysql-test/main/derived.result
+++ b/mysql-test/main/derived.result
@@ -1357,6 +1357,29 @@ a b
DROP VIEW v1;
DROP TABLE t1;
#
+# MDEV-28616: derived table over union with order by clause that
+# contains subquery with unresolvable column reference
+#
+SELECT 1 FROM (
+SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0)
+) dt;
+ERROR 42S22: Unknown column 'xxx' in 'where clause'
+create table t1 (a int, b int);
+insert into t1 values (3,8), (7,2), (1,4), (5,9);
+create table t2 (a int, b int);
+insert into t2 values (9,1), (7,3), (2,6);
+create table t3 (c int, d int);
+insert into t3 values (7,8), (1,2), (3,8);
+select * from
+(
+select a,b from t1 where t1.a > 3
+union
+select a,b from t2 where t2.b < 6
+order by (a - b / (select a + max(c) from t3 where d = x))
+) dt;
+ERROR 42S22: Unknown column 'x' in 'where clause'
+drop table t1,t2,t3;
+#
# End of 10.3 tests
#
#
@@ -1476,6 +1499,34 @@ a
2
drop table t1;
#
+# MDEV-31022: SIGSEGV in maria_create from create_internal_tmp_table
+# keydef incorrectly allocated on the stack in create_internal_tmp_table()
+#
+CREATE TABLE t1 (c CHAR(1) NULL) ENGINE=MyISAM;
+INSERT INTO t1 (c) VALUES (1);
+SET statement
+optimizer_where_cost=1,
+big_tables=1,
+in_predicate_conversion_threshold=2
+FOR
+SELECT * FROM t1 WHERE c IN ('','');
+c
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
+SET statement
+optimizer_where_cost=1,
+big_tables=1,
+in_predicate_conversion_threshold=2,
+sql_mode=''
+FOR
+SELECT * FROM t1 WHERE c IN ('','');
+c
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
+DROP TABLE t1;
+#
# End of 11.0 tests
#
#
@@ -1668,7 +1719,8 @@ t1.a = ( select * from (select a from t1) dt where dt.a > 7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 2 Using where
update t1,t3 set t1.a = 1
where t1.a=t3.a and
t1.a = ( select * from (select a from t1) dt where dt.a > 7);
@@ -1705,7 +1757,8 @@ t1.a = ( select * from (select a from t2) dt where dt.a > 7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where
+2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 4 Using where
+3 DERIVED t2 ALL NULL NULL NULL NULL 4 Using where
update t1,t3 set t1.a = 1
where t1.a=t3.a and
t1.a = ( select * from (select a from t2) dt where dt.a > 7);
@@ -1745,7 +1798,8 @@ t1.a = ( select * from (select a from t1) dt where dt.a > 7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where
+2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 4 Using where
+3 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where
delete from t1 using t1,t3
where t1.a=t3.a and
t1.a = ( select * from (select a from t1) dt where dt.a > 7);
@@ -1781,7 +1835,8 @@ t1.a = ( select * from (select a from t2) dt where dt.a > 7);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where
+2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 4 Using where
+3 DERIVED t2 ALL NULL NULL NULL NULL 4 Using where
delete from t1 using t1,t3
where t1.a=t3.a and
t1.a = ( select * from (select a from t2) dt where dt.a > 7);
diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test
index dceae7a8c8f..772d7be2ace 100644
--- a/mysql-test/main/derived.test
+++ b/mysql-test/main/derived.test
@@ -1153,6 +1153,36 @@ DROP VIEW v1;
DROP TABLE t1;
--echo #
+--echo # MDEV-28616: derived table over union with order by clause that
+--echo # contains subquery with unresolvable column reference
+--echo #
+
+--error ER_BAD_FIELD_ERROR
+SELECT 1 FROM (
+ SELECT 1 UNION SELECT 2 ORDER BY (SELECT 1 FROM DUAL WHERE xxx = 0)
+) dt;
+
+create table t1 (a int, b int);
+insert into t1 values (3,8), (7,2), (1,4), (5,9);
+
+create table t2 (a int, b int);
+insert into t2 values (9,1), (7,3), (2,6);
+
+create table t3 (c int, d int);
+insert into t3 values (7,8), (1,2), (3,8);
+
+--error ER_BAD_FIELD_ERROR
+select * from
+(
+ select a,b from t1 where t1.a > 3
+ union
+ select a,b from t2 where t2.b < 6
+ order by (a - b / (select a + max(c) from t3 where d = x))
+) dt;
+
+drop table t1,t2,t3;
+
+--echo #
--echo # End of 10.3 tests
--echo #
@@ -1244,6 +1274,30 @@ SELECT a FROM t1 WHERE a IN ( 1, 1, 2, 194 );
drop table t1;
--echo #
+--echo # MDEV-31022: SIGSEGV in maria_create from create_internal_tmp_table
+--echo # keydef incorrectly allocated on the stack in create_internal_tmp_table()
+--echo #
+
+CREATE TABLE t1 (c CHAR(1) NULL) ENGINE=MyISAM;
+INSERT INTO t1 (c) VALUES (1);
+SET statement
+ optimizer_where_cost=1,
+ big_tables=1,
+ in_predicate_conversion_threshold=2
+FOR
+SELECT * FROM t1 WHERE c IN ('','');
+
+SET statement
+ optimizer_where_cost=1,
+ big_tables=1,
+ in_predicate_conversion_threshold=2,
+ sql_mode=''
+FOR
+SELECT * FROM t1 WHERE c IN ('','');
+
+DROP TABLE t1;
+
+--echo #
--echo # End of 11.0 tests
--echo #
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index 544c8ace7b7..76f899edc96 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -22609,6 +22609,103 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
drop view v1;
drop table t1;
+#
+# MDEV-31102: execution of PS for query where pushdown of condition
+# into view defined as union is applied
+#
+create table t1 (
+n int,
+lv varchar(31) charset latin1,
+mv varchar(31) charset utf8mb3
+) engine=myisam;
+insert into t1 values (1,'aa','xxx'), ('2','bb','yyy'), (3,'cc','zzz');
+create view v1 as
+select case when n=1 then lv when n=2 then mv else NULL end as r from t1
+union
+select 'a';
+select * from v1 where r < 'x';
+r
+aa
+a
+explain extended select * from v1 where r < 'x';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `v1`.`r` AS `r` from `test`.`v1` where `v1`.`r` < 'x'
+explain format=json select * from v1 where r < 'x';
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "cost": 0.012461052,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "loops": 1,
+ "rows": 3,
+ "cost": 0.012461052,
+ "filtered": 100,
+ "attached_condition": "v1.r < 'x'",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "cost": 0.010504815,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "loops": 1,
+ "rows": 3,
+ "cost": 0.010504815,
+ "filtered": 100,
+ "attached_condition": "case when t1.n = 1 then convert(t1.lv using utf8mb3) when t1.n = 2 then t1.mv else NULL end < 'x'"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+prepare stmt from "select * from v1 where r < 'x'";
+execute stmt;
+r
+aa
+a
+execute stmt;
+r
+aa
+a
+deallocate prepare stmt;
+drop view v1;
+drop table t1;
# End of 10.4 tests
#
# MDEV-28958: condition pushable into view after simplification
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index d77e0210eae..5bd1489db78 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -4143,6 +4143,36 @@ explain select * from v1;
drop view v1;
drop table t1;
+--echo #
+--echo # MDEV-31102: execution of PS for query where pushdown of condition
+--echo # into view defined as union is applied
+--echo #
+
+create table t1 (
+ n int,
+ lv varchar(31) charset latin1,
+ mv varchar(31) charset utf8mb3
+) engine=myisam;
+insert into t1 values (1,'aa','xxx'), ('2','bb','yyy'), (3,'cc','zzz');
+create view v1 as
+select case when n=1 then lv when n=2 then mv else NULL end as r from t1
+union
+select 'a';
+
+let $q=
+select * from v1 where r < 'x';
+
+eval $q;
+eval explain extended $q;
+eval explain format=json $q;
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop view v1;
+drop table t1;
+
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result
index 9ea3d0f1396..f6d7cb02246 100644
--- a/mysql-test/main/derived_split_innodb.result
+++ b/mysql-test/main/derived_split_innodb.result
@@ -287,4 +287,589 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort
drop table t3, t4;
# End of 10.3 tests
+#
+# MDEV-26301: Split optimization refills temporary table too many times
+#
+create table t1(a int, b int);
+insert into t1 select seq,seq from seq_1_to_5;
+create table t2(a int, b int, key(a));
+insert into t2
+select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
+create table t3(a int, b int, key(a));
+insert into t3
+select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
+analyze table t1,t2,t3 persistent for all;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze status Table is already up to date
+explain
+select * from
+(t1 left join t2 on t2.a=t1.b) left join t3 on t3.a=t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+1 SIMPLE t2 ref a a 5 test.t1.b 2 Using where
+1 SIMPLE t3 ref a a 5 test.t1.b 3 Using where
+create table t10 (
+grp_id int,
+col1 int,
+key(grp_id)
+);
+insert into t10
+select
+A.seq,
+B.seq
+from
+seq_1_to_100 A,
+seq_1_to_100 B;
+create table t11 (
+col1 int,
+col2 int
+);
+insert into t11
+select A.seq, A.seq from seq_1_to_10 A;
+analyze table t10,t11 persistent for all;
+Table Op Msg_type Msg_text
+test.t10 analyze status Engine-independent statistics collected
+test.t10 analyze status Table is already up to date
+test.t11 analyze status Engine-independent statistics collected
+test.t11 analyze status OK
+explain select * from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join t3 on t3.a=t1.b
+) left join (select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id) T on T.grp_id=t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
+1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
+2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+# The important part in the below output is:
+# "lateral": 1,
+# "query_block": {
+# "select_id": 2,
+# "r_loops": 5, <-- must be 5, not 30.
+analyze format=json select * from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join t3 on t3.a=t1.b
+) left join (select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id) T on T.grp_id=t1.b;
+ANALYZE
+{
+ "query_optimization": {
+ "r_total_time_ms": "REPLACED"
+ },
+ "query_block": {
+ "select_id": 1,
+ "cost": "REPLACED",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "const_condition": "1",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "loops": 1,
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.b"],
+ "loops": 5,
+ "r_loops": 5,
+ "rows": 2,
+ "r_rows": 2,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "trigcond(trigcond(t1.b is not null))"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.b"],
+ "loops": 10,
+ "r_loops": 10,
+ "rows": 3,
+ "r_rows": 3,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "trigcond(trigcond(t1.b is not null))"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["grp_id"],
+ "ref": ["test.t1.b"],
+ "loops": 30,
+ "r_loops": 30,
+ "rows": 10,
+ "r_rows": 1,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "trigcond(trigcond(t1.b is not null))",
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "cost": "REPLACED",
+ "r_loops": 5,
+ "r_total_time_ms": "REPLACED",
+ "outer_ref_condition": "t1.b is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t10",
+ "access_type": "ref",
+ "possible_keys": ["grp_id"],
+ "key": "grp_id",
+ "key_length": "5",
+ "used_key_parts": ["grp_id"],
+ "ref": ["test.t1.b"],
+ "loops": 1,
+ "r_loops": 5,
+ "rows": 100,
+ "r_rows": 100,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t11",
+ "access_type": "ALL",
+ "loops": 100,
+ "r_loops": 5,
+ "rows": 10,
+ "r_rows": 10,
+ "cost": "REPLACED",
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL",
+ "attached_condition": "trigcond(t11.col1 = t10.col1)",
+ "r_loops": 500,
+ "r_filtered": 10,
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 10
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+create table t21 (pk int primary key);
+insert into t21 values (1),(2),(3);
+create table t22 (pk int primary key);
+insert into t22 values (1),(2),(3);
+explain
+select * from
+t21, t22,
+(
+(t1 left join t2 on t2.a=t1.b)
+left join t3 on t3.a=t1.b
+) left join (select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id) T on T.grp_id=t1.b
+where
+t21.pk=1 and t22.pk=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index
+1 PRIMARY t22 const PRIMARY PRIMARY 4 const 1 Using index
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
+1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
+2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+explain
+select * from
+t21,
+(
+(t1 left join t2 on t2.a=t1.b)
+left join t3 on t3.a=t1.b
+) left join (select grp_id, count(*)
+from
+t22 join t10 left join t11 on t11.col1=t10.col1
+where
+t22.pk=1
+group by grp_id) T on T.grp_id=t1.b
+where
+t21.pk=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
+1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t22 const PRIMARY PRIMARY 4 const 1 Using index
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
+2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+create table t5 (
+pk int primary key
+);
+insert into t5 select seq from seq_1_to_1000;
+explain
+select * from
+t21,
+(
+(((t1 join t5 on t5.pk=t1.b)) left join t2 on t2.a=t1.b)
+left join t3 on t3.a=t1.b
+) left join (select grp_id, count(*)
+from
+t22 join t10 left join t11 on t11.col1=t10.col1
+where
+t22.pk=1
+group by grp_id) T on T.grp_id=t1.b
+where
+t21.pk=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
+1 PRIMARY t5 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index
+1 PRIMARY t2 ref a a 5 test.t1.b 2
+1 PRIMARY t3 ref a a 5 test.t1.b 3
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t22 const PRIMARY PRIMARY 4 const 1 Using index
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t5.pk 100 Using index condition
+2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+drop table t1,t2,t3,t5, t10, t11, t21, t22;
+create table t1(a int, b int);
+insert into t1 select seq,seq from seq_1_to_5;
+create table t2(a int, b int, key(a));
+insert into t2
+select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
+create table t3(a int, b int, key(a));
+insert into t3
+select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
+analyze table t1,t2,t3 persistent for all;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze status Table is already up to date
+create table t10 (
+grp_id int,
+col1 int,
+key(grp_id)
+);
+insert into t10
+select
+A.seq,
+B.seq
+from
+seq_1_to_100 A,
+seq_1_to_100 B;
+create table t11 (
+col1 int,
+col2 int
+);
+insert into t11
+select A.seq, A.seq from seq_1_to_10 A;
+analyze table t10,t11 persistent for all;
+Table Op Msg_type Msg_text
+test.t10 analyze status Engine-independent statistics collected
+test.t10 analyze status Table is already up to date
+test.t11 analyze status Engine-independent statistics collected
+test.t11 analyze status OK
+explain select *
+from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join
+t3
+on t3.a=t1.b
+)
+left join
+(
+select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id
+)dt
+on dt.grp_id=t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
+1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
+2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+select *
+from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join
+t3
+on t3.a=t1.b
+)
+left join
+(
+select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id
+)dt
+on dt.grp_id=t1.b;
+a b a b a b grp_id count(*)
+1 1 1 1 1 1 1 100
+1 1 1 1 1 2 1 100
+1 1 1 1 1 3 1 100
+1 1 1 2 1 1 1 100
+1 1 1 2 1 2 1 100
+1 1 1 2 1 3 1 100
+2 2 2 1 2 1 2 100
+2 2 2 1 2 2 2 100
+2 2 2 1 2 3 2 100
+2 2 2 2 2 1 2 100
+2 2 2 2 2 2 2 100
+2 2 2 2 2 3 2 100
+3 3 3 1 3 1 3 100
+3 3 3 1 3 2 3 100
+3 3 3 1 3 3 3 100
+3 3 3 2 3 1 3 100
+3 3 3 2 3 2 3 100
+3 3 3 2 3 3 3 100
+4 4 4 1 4 1 4 100
+4 4 4 1 4 2 4 100
+4 4 4 1 4 3 4 100
+4 4 4 2 4 1 4 100
+4 4 4 2 4 2 4 100
+4 4 4 2 4 3 4 100
+5 5 5 1 5 1 5 100
+5 5 5 1 5 2 5 100
+5 5 5 1 5 3 5 100
+5 5 5 2 5 1 5 100
+5 5 5 2 5 2 5 100
+5 5 5 2 5 3 5 100
+set join_cache_level=4;
+set optimizer_trace=1;
+set @tmp=@@optimizer_switch, optimizer_switch='hash_join_cardinality=off';
+insert into t11
+select A.seq, A.seq from seq_11_to_100 A;
+analyze table t11 persistent for all;
+Table Op Msg_type Msg_text
+test.t11 analyze status Engine-independent statistics collected
+test.t11 analyze status OK
+explain select *
+from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join
+t3
+on t3.a=t1.b
+)
+left join
+(
+select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id
+)dt
+on dt.grp_id=t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
+1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
+2 LATERAL DERIVED t11 hash_ALL NULL #hash#$hj 5 test.t10.col1 100 Using where; Using join buffer (flat, BNLH join)
+select *
+from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join
+t3
+on t3.a=t1.b
+)
+left join
+(
+select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id
+)dt
+on dt.grp_id=t1.b;
+a b a b a b grp_id count(*)
+1 1 1 1 1 1 1 100
+1 1 1 1 1 2 1 100
+1 1 1 1 1 3 1 100
+1 1 1 2 1 1 1 100
+1 1 1 2 1 2 1 100
+1 1 1 2 1 3 1 100
+2 2 2 1 2 1 2 100
+2 2 2 1 2 2 2 100
+2 2 2 1 2 3 2 100
+2 2 2 2 2 1 2 100
+2 2 2 2 2 2 2 100
+2 2 2 2 2 3 2 100
+3 3 3 1 3 1 3 100
+3 3 3 1 3 2 3 100
+3 3 3 1 3 3 3 100
+3 3 3 2 3 1 3 100
+3 3 3 2 3 2 3 100
+3 3 3 2 3 3 3 100
+4 4 4 1 4 1 4 100
+4 4 4 1 4 2 4 100
+4 4 4 1 4 3 4 100
+4 4 4 2 4 1 4 100
+4 4 4 2 4 2 4 100
+4 4 4 2 4 3 4 100
+5 5 5 1 5 1 5 100
+5 5 5 1 5 2 5 100
+5 5 5 1 5 3 5 100
+5 5 5 2 5 1 5 100
+5 5 5 2 5 2 5 100
+5 5 5 2 5 3 5 100
+set optimizer_switch=@tmp;
+set join_cache_level=default;
+delete from t11;
+insert into t11 select A.seq, A.seq from seq_1_to_10 A;
+analyze table t11 persistent for all;
+Table Op Msg_type Msg_text
+test.t11 analyze status Engine-independent statistics collected
+test.t11 analyze status OK
+drop index a on t2;
+drop index a on t3;
+explain select *
+from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join
+t3
+on t3.a=t1.b
+)
+left join
+(
+select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id
+)dt
+on dt.grp_id=t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 1000 Using where
+2 DERIVED t10 ALL grp_id NULL NULL NULL 10000 Using temporary; Using filesort
+2 DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+select *
+from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join
+t3
+on t3.a=t1.b
+)
+left join
+(
+select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id
+)dt
+on dt.grp_id=t1.b;
+a b a b a b grp_id count(*)
+1 1 1 1 1 1 1 100
+1 1 1 2 1 1 1 100
+1 1 1 1 1 2 1 100
+1 1 1 2 1 2 1 100
+1 1 1 1 1 3 1 100
+1 1 1 2 1 3 1 100
+2 2 2 1 2 1 2 100
+2 2 2 2 2 1 2 100
+2 2 2 1 2 2 2 100
+2 2 2 2 2 2 2 100
+2 2 2 1 2 3 2 100
+2 2 2 2 2 3 2 100
+3 3 3 1 3 1 3 100
+3 3 3 2 3 1 3 100
+3 3 3 1 3 2 3 100
+3 3 3 2 3 2 3 100
+3 3 3 1 3 3 3 100
+3 3 3 2 3 3 3 100
+4 4 4 1 4 1 4 100
+4 4 4 2 4 1 4 100
+4 4 4 1 4 2 4 100
+4 4 4 2 4 2 4 100
+4 4 4 1 4 3 4 100
+4 4 4 2 4 3 4 100
+5 5 5 1 5 1 5 100
+5 5 5 2 5 1 5 100
+5 5 5 1 5 2 5 100
+5 5 5 2 5 2 5 100
+5 5 5 1 5 3 5 100
+5 5 5 2 5 3 5 100
+drop table t1,t2,t3;
+drop table t10, t11;
+#
+# MDEV-31194: Server crash or assertion failure with join_cache_level=4
+# (a followup to the above bug, MDEV-26301)
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (3),(4);
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria;
+INSERT INTO t2 VALUES (1),(2);
+set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level;
+set
+optimizer_switch= 'derived_with_keys=off',
+join_cache_level= 4;
+SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a;
+a
+set optimizer_switch= @tmp1, join_cache_level= @tmp2;
+DROP TABLE t1, t2;
+# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test
index 86a2b6d73b0..e7c5cc8f274 100644
--- a/mysql-test/main/derived_split_innodb.test
+++ b/mysql-test/main/derived_split_innodb.test
@@ -233,4 +233,251 @@ drop table t3, t4;
--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-26301: Split optimization refills temporary table too many times
+--echo #
+
+# 5 values
+create table t1(a int, b int);
+insert into t1 select seq,seq from seq_1_to_5;
+
+# 5 value groups of size 2 each
+create table t2(a int, b int, key(a));
+insert into t2
+select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
+
+# 5 value groups of size 3 each
+create table t3(a int, b int, key(a));
+insert into t3
+select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
+
+analyze table t1,t2,t3 persistent for all;
+
+explain
+select * from
+ (t1 left join t2 on t2.a=t1.b) left join t3 on t3.a=t1.b;
+
+# Now, create tables for Groups.
+
+create table t10 (
+ grp_id int,
+ col1 int,
+ key(grp_id)
+);
+
+# 100 groups of 100 values each
+insert into t10
+select
+ A.seq,
+ B.seq
+from
+ seq_1_to_100 A,
+ seq_1_to_100 B;
+
+# and X10 multiplier
+
+create table t11 (
+ col1 int,
+ col2 int
+);
+insert into t11
+select A.seq, A.seq from seq_1_to_10 A;
+
+analyze table t10,t11 persistent for all;
+
+let $q1=
+select * from
+ (
+ (t1 left join t2 on t2.a=t1.b)
+ left join t3 on t3.a=t1.b
+ ) left join (select grp_id, count(*)
+ from t10 left join t11 on t11.col1=t10.col1
+ group by grp_id) T on T.grp_id=t1.b;
+
+eval
+explain $q1;
+
+--echo # The important part in the below output is:
+--echo # "lateral": 1,
+--echo # "query_block": {
+--echo # "select_id": 2,
+--echo # "r_loops": 5, <-- must be 5, not 30.
+--source include/analyze-format.inc
+
+eval
+analyze format=json $q1;
+
+create table t21 (pk int primary key);
+insert into t21 values (1),(2),(3);
+
+create table t22 (pk int primary key);
+insert into t22 values (1),(2),(3);
+
+# Same as above but throw in a couple of const tables.
+explain
+select * from
+ t21, t22,
+ (
+ (t1 left join t2 on t2.a=t1.b)
+ left join t3 on t3.a=t1.b
+ ) left join (select grp_id, count(*)
+ from t10 left join t11 on t11.col1=t10.col1
+ group by grp_id) T on T.grp_id=t1.b
+where
+ t21.pk=1 and t22.pk=2;
+
+explain
+select * from
+ t21,
+ (
+ (t1 left join t2 on t2.a=t1.b)
+ left join t3 on t3.a=t1.b
+ ) left join (select grp_id, count(*)
+ from
+ t22 join t10 left join t11 on t11.col1=t10.col1
+ where
+ t22.pk=1
+ group by grp_id) T on T.grp_id=t1.b
+where
+ t21.pk=1;
+
+# And also add a non-const table
+
+create table t5 (
+ pk int primary key
+ );
+insert into t5 select seq from seq_1_to_1000;
+
+explain
+select * from
+ t21,
+ (
+ (((t1 join t5 on t5.pk=t1.b)) left join t2 on t2.a=t1.b)
+ left join t3 on t3.a=t1.b
+ ) left join (select grp_id, count(*)
+ from
+ t22 join t10 left join t11 on t11.col1=t10.col1
+ where
+ t22.pk=1
+ group by grp_id) T on T.grp_id=t1.b
+where
+ t21.pk=1;
+
+drop table t1,t2,t3,t5, t10, t11, t21, t22;
+
+# 5 values
+create table t1(a int, b int);
+insert into t1 select seq,seq from seq_1_to_5;
+
+# 5 value groups of size 2 each
+create table t2(a int, b int, key(a));
+insert into t2
+select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
+
+# 5 value groups of size 3 each
+create table t3(a int, b int, key(a));
+insert into t3
+select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
+
+analyze table t1,t2,t3 persistent for all;
+
+create table t10 (
+ grp_id int,
+ col1 int,
+ key(grp_id)
+);
+
+# 100 groups of 100 values each
+insert into t10
+select
+ A.seq,
+ B.seq
+from
+ seq_1_to_100 A,
+ seq_1_to_100 B;
+
+# and X10 multiplier
+
+create table t11 (
+ col1 int,
+ col2 int
+);
+insert into t11
+select A.seq, A.seq from seq_1_to_10 A;
+
+analyze table t10,t11 persistent for all;
+
+let $q=
+select *
+from
+ (
+ (t1 left join t2 on t2.a=t1.b)
+ left join
+ t3
+ on t3.a=t1.b
+ )
+ left join
+ (
+ select grp_id, count(*)
+ from t10 left join t11 on t11.col1=t10.col1
+ group by grp_id
+ )dt
+ on dt.grp_id=t1.b;
+
+eval explain $q;
+eval $q;
+
+set join_cache_level=4;
+set optimizer_trace=1;
+set @tmp=@@optimizer_switch, optimizer_switch='hash_join_cardinality=off';
+# Need table t11 to be larger in 11.0:
+insert into t11
+select A.seq, A.seq from seq_11_to_100 A;
+analyze table t11 persistent for all;
+
+eval explain $q;
+eval $q;
+
+set optimizer_switch=@tmp;
+set join_cache_level=default;
+
+delete from t11;
+insert into t11 select A.seq, A.seq from seq_1_to_10 A;
+analyze table t11 persistent for all;
+
+drop index a on t2;
+drop index a on t3;
+
+eval explain $q;
+eval $q;
+
+drop table t1,t2,t3;
+drop table t10, t11;
+
+
+--echo #
+--echo # MDEV-31194: Server crash or assertion failure with join_cache_level=4
+--echo # (a followup to the above bug, MDEV-26301)
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (3),(4);
+
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria;
+INSERT INTO t2 VALUES (1),(2);
+
+set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level;
+set
+ optimizer_switch= 'derived_with_keys=off',
+ join_cache_level= 4;
+
+SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a;
+
+set optimizer_switch= @tmp1, join_cache_level= @tmp2;
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--echo # End of 10.4 tests
+
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index aa7519ae750..75c92b23089 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -3828,3 +3828,553 @@ drop procedure sp2;
drop view v, v2;
drop table t1,t2;
# End of 10.2 tests
+#
+# MDEV-30706: view defined as select with implicit grouping and
+# a set function used in a subquery
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2);
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
+INSERT INTO t2 VALUES (1,1), (3,3);
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT);
+INSERT INTO t3 VALUES (2,2), (4,4), (7,7);
+CREATE TABLE t4 (a INT PRIMARY KEY, b INT);
+INSERT INTO t4 VALUES (2,2), (5,5), (7,7);
+CREATE VIEW v AS SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b;
+SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b;
+m
+9
+SELECT * FROM v;
+m
+9
+WITH cte AS ( SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b ) SELECT * FROM cte;
+m
+9
+EXPLAIN SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using index
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using index
+EXPLAIN SELECT * FROM v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 SUBQUERY t4 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using index
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
+3 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using index
+EXPLAIN WITH cte AS ( SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b ) SELECT * FROM cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 DERIVED t4 ALL NULL NULL NULL NULL 3 Using where
+2 DERIVED t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 Using index
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
+3 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 Using index
+PREPARE stmt FROM "SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b";
+execute stmt;
+m
+9
+execute stmt;
+m
+9
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+m
+9
+execute stmt;
+m
+9
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "WITH cte AS ( SELECT
+(SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+WHERE t3.a = t4.b ) SELECT * FROM cte";
+execute stmt;
+m
+9
+execute stmt;
+m
+9
+DEALLOCATE PREPARE stmt;
+DROP VIEW v;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-29224: view defined as select with implicit grouping and
+# a set function used in a subquery
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 int);
+INSERT INTO t2 VALUES (3);
+CREATE VIEW v AS SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+( SELECT MAX(f1) FROM t2 )
+2
+SELECT * FROM v;
+( SELECT MAX(f1) FROM t2 )
+2
+WITH cte AS ( SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1 ) SELECT * FROM cte;
+( SELECT MAX(f1) FROM t2 )
+2
+EXPLAIN SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
+EXPLAIN SELECT * FROM v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
+EXPLAIN WITH cte AS ( SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1 ) SELECT * FROM cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 2
+3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
+PREPARE stmt FROM "SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1";
+execute stmt;
+( SELECT MAX(f1) FROM t2 )
+2
+execute stmt;
+( SELECT MAX(f1) FROM t2 )
+2
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+( SELECT MAX(f1) FROM t2 )
+2
+execute stmt;
+( SELECT MAX(f1) FROM t2 )
+2
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "WITH cte AS ( SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1 ) SELECT * FROM cte";
+execute stmt;
+( SELECT MAX(f1) FROM t2 )
+2
+execute stmt;
+( SELECT MAX(f1) FROM t2 )
+2
+DEALLOCATE PREPARE stmt;
+DROP VIEW v;
+DROP TABLE t1,t2;
+#
+# MDEV-28573: view defined as select with implicit grouping and
+# a set function used in a subquery
+#
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+CREATE TABLE t2 (c INTEGER);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+INSERT INTO t2 VALUES (1), (2);
+CREATE VIEW v1 AS SELECT (SELECT COUNT(b) FROM t2) FROM t1;
+CREATE VIEW v2 AS SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1;
+SELECT (SELECT COUNT(b) FROM t2) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT * FROM v1;
+ERROR 21000: Subquery returns more than 1 row
+WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2) FROM t1 ) SELECT * FROM cte;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+SELECT * FROM v2;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1 ) SELECT * FROM cte;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+EXPLAIN SELECT (SELECT COUNT(b) FROM t2) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
+EXPLAIN SELECT * FROM v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 3
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
+EXPLAIN WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2) FROM t1 ) SELECT * FROM cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 DERIVED t1 ALL NULL NULL NULL NULL 3
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2
+PREPARE stmt FROM "SELECT (SELECT COUNT(b) FROM t2) FROM t1";
+execute stmt;
+ERROR 21000: Subquery returns more than 1 row
+execute stmt;
+ERROR 21000: Subquery returns more than 1 row
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT * FROM v1";
+execute stmt;
+ERROR 21000: Subquery returns more than 1 row
+execute stmt;
+ERROR 21000: Subquery returns more than 1 row
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2) FROM t1 ) SELECT * FROM cte";
+execute stmt;
+ERROR 21000: Subquery returns more than 1 row
+execute stmt;
+ERROR 21000: Subquery returns more than 1 row
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1";
+execute stmt;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+execute stmt;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT * FROM v2";
+execute stmt;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+execute stmt;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "WITH cte AS ( SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1 ) SELECT * FROM cte";
+execute stmt;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+execute stmt;
+(SELECT COUNT(b) FROM t2 WHERE c > 1)
+3
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1,v2;
+DROP TABLE t1,t2;
+#
+# MDEV-28570: VIEW with WHERE containing subquery
+# with set function aggregated in query
+#
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (c int, d int);
+INSERT INTO t1 VALUES
+(1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40);
+INSERT INTO t2 VALUES
+(2,10), (2,20), (4,10), (5,10), (3,20), (2,40);
+CREATE VIEW v AS SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
+a
+2
+4
+SELECT * FROM v;
+a
+2
+4
+WITH cte AS ( SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20) ) SELECT * FROM cte;
+a
+2
+4
+EXPLAIN SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6
+EXPLAIN SELECT * FROM v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
+2 DERIVED t1 ALL NULL NULL NULL NULL 7 Using temporary; Using filesort
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6
+EXPLAIN WITH cte AS ( SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20) ) SELECT * FROM cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
+2 DERIVED t1 ALL NULL NULL NULL NULL 7 Using temporary; Using filesort
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6
+PREPARE stmt FROM "SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20)";
+execute stmt;
+a
+2
+4
+execute stmt;
+a
+2
+4
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+a
+2
+4
+execute stmt;
+a
+2
+4
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "WITH cte AS ( SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20) ) SELECT * FROM cte";
+execute stmt;
+a
+2
+4
+execute stmt;
+a
+2
+4
+DEALLOCATE PREPARE stmt;
+DROP VIEW v;
+DROP TABLE t1,t2;
+#
+# MDEV-28571: VIEW with select list containing subquery
+# with set function aggregated in query
+#
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+CREATE VIEW v AS SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a;
+SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a;
+c
+2
+3
+1,1
+SELECT * FROM v;
+c
+2
+3
+1,1
+WITH cte AS ( SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a ) SELECT * FROM cte;
+c
+2
+3
+1,1
+EXPLAIN SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
+EXPLAIN SELECT * FROM v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6
+2 DERIVED t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
+EXPLAIN WITH cte AS ( SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a ) SELECT * FROM cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6
+2 DERIVED t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
+PREPARE stmt FROM "SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a";
+execute stmt;
+c
+2
+3
+1,1
+execute stmt;
+c
+2
+3
+1,1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+c
+2
+3
+1,1
+execute stmt;
+c
+2
+3
+1,1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM "WITH cte AS ( SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a ) SELECT * FROM cte";
+execute stmt;
+c
+2
+3
+1,1
+execute stmt;
+c
+2
+3
+1,1
+DEALLOCATE PREPARE stmt;
+DROP VIEW v;
+DROP TABLE t1,t2;
+#
+# MDEV-30668: VIEW with WHERE containing nested subquery
+# with set function aggregated in outer subquery
+#
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+create table t2 (b int);
+insert into t2 values (2), (1), (4), (7);
+create table t3 (a int, b int);
+insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40);
+create view v as select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b)));
+select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b)));
+a
+7
+select * from v;
+a
+7
+with cte as ( select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b))) ) select * from cte;
+a
+7
+explain select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b)));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1
+2 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using temporary
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where
+explain select * from v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 test.t1.a 1
+3 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using temporary
+4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where
+explain with cte as ( select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b))) ) select * from cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 test.t1.a 1
+3 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using temporary
+4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where
+prepare stmt from "select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b)))";
+execute stmt;
+a
+7
+execute stmt;
+a
+7
+deallocate prepare stmt;
+prepare stmt from "select * from v";
+execute stmt;
+a
+7
+execute stmt;
+a
+7
+deallocate prepare stmt;
+prepare stmt from "with cte as ( select * from t1
+where t1.a in (select t3.a from t3 group by t3.a
+having t3.a > any (select t2.b from t2
+where t2.b*10 < sum(t3.b))) ) select * from cte";
+execute stmt;
+a
+7
+execute stmt;
+a
+7
+deallocate prepare stmt;
+drop view v;
+drop table t1,t2,t3;
+# End of 10.4 tests
+#
+# MDEV-31143: view with ORDER BY used in query with rownum() in WHERE
+#
+create table t1 (id int primary key);
+insert into t1 values (3), (7), (1);
+create table t2 (a int);
+insert into t2 values (2), (4);
+create view v as select a from t2 order by a;
+set big_tables= 1;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
+select t1.id from v, t1 where rownum() = 1 group by t1.id;
+id
+1
+set big_tables=default;
+Warnings:
+Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
+drop view v;
+drop table t1, t2;
+#
+# MDEV-31162: multi-table mergeable view with ORDER BY used
+# in query with rownum() in WHERE
+#
+create table t1 (a INT) engine=MyISAM;
+insert into t1 values (1),(2);
+create table t2 (b INT) engine=MyISAM;
+insert into t2 values (3),(4);
+create view v1 AS select * from t1 join t2 order by b;
+explain select * from v1 where rownum() <= 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+select * from v1 where rownum() <= 2;
+a b
+1 3
+2 3
+prepare stmt from "select * from v1 where rownum() <= 2";
+execute stmt;
+a b
+1 3
+2 3
+execute stmt;
+a b
+1 3
+2 3
+deallocate prepare stmt;
+create view v2 AS select * from t1 join t2 order by b/a;
+explain select * from v2 where rownum() <= 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+select * from v2 where rownum() <= 2;
+a b
+2 3
+1 3
+prepare stmt from "select * from v2 where rownum() <= 2";
+execute stmt;
+a b
+2 3
+1 3
+execute stmt;
+a b
+2 3
+1 3
+deallocate prepare stmt;
+drop view v1,v2;
+drop table t1,t2;
+# End of 10.6 tests
diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test
index 13444676659..379c58cc73c 100644
--- a/mysql-test/main/derived_view.test
+++ b/mysql-test/main/derived_view.test
@@ -2463,3 +2463,362 @@ drop view v, v2;
drop table t1,t2;
--echo # End of 10.2 tests
+
+--echo #
+--echo # MDEV-30706: view defined as select with implicit grouping and
+--echo # a set function used in a subquery
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2);
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
+INSERT INTO t2 VALUES (1,1), (3,3);
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT);
+INSERT INTO t3 VALUES (2,2), (4,4), (7,7);
+CREATE TABLE t4 (a INT PRIMARY KEY, b INT);
+INSERT INTO t4 VALUES (2,2), (5,5), (7,7);
+
+let $q=
+SELECT
+ (SELECT SUM(t4.b) FROM t1, t2 WHERE t1.a = t2.b GROUP BY t1.a) AS m
+FROM t3, t4
+ WHERE t3.a = t4.b;
+
+eval CREATE VIEW v AS $q;
+
+eval $q;
+SELECT * FROM v;
+eval WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval EXPLAIN $q;
+EXPLAIN SELECT * FROM v;
+eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval PREPARE stmt FROM "$q";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v;
+DROP TABLE t1,t2,t3,t4;
+
+--echo #
+--echo # MDEV-29224: view defined as select with implicit grouping and
+--echo # a set function used in a subquery
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 int);
+INSERT INTO t2 VALUES (3);
+
+let $q=
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+
+eval CREATE VIEW v AS $q;
+
+eval $q;
+SELECT * FROM v;
+eval WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval EXPLAIN $q;
+EXPLAIN SELECT * FROM v;
+eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval PREPARE stmt FROM "$q";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-28573: view defined as select with implicit grouping and
+--echo # a set function used in a subquery
+--echo #
+
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+CREATE TABLE t2 (c INTEGER);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+INSERT INTO t2 VALUES (1), (2);
+
+let $q1=
+SELECT (SELECT COUNT(b) FROM t2) FROM t1;
+let $q2=
+SELECT (SELECT COUNT(b) FROM t2 WHERE c > 1) FROM t1;
+
+eval CREATE VIEW v1 AS $q1;
+eval CREATE VIEW v2 AS $q2;
+
+--error ER_SUBQUERY_NO_1_ROW
+eval $q1;
+--error ER_SUBQUERY_NO_1_ROW
+SELECT * FROM v1;
+--error ER_SUBQUERY_NO_1_ROW
+eval WITH cte AS ( $q1 ) SELECT * FROM cte;
+eval $q2;
+SELECT * FROM v2;
+eval WITH cte AS ( $q2 ) SELECT * FROM cte;
+
+eval EXPLAIN $q1;
+EXPLAIN SELECT * FROM v1;
+eval EXPLAIN WITH cte AS ( $q1 ) SELECT * FROM cte;
+
+eval PREPARE stmt FROM "$q1";
+--error ER_SUBQUERY_NO_1_ROW
+execute stmt;
+--error ER_SUBQUERY_NO_1_ROW
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "SELECT * FROM v1";
+--error ER_SUBQUERY_NO_1_ROW
+execute stmt;
+--error ER_SUBQUERY_NO_1_ROW
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "WITH cte AS ( $q1 ) SELECT * FROM cte";
+--error ER_SUBQUERY_NO_1_ROW
+execute stmt;
+--error ER_SUBQUERY_NO_1_ROW
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "$q2";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "SELECT * FROM v2";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "WITH cte AS ( $q2 ) SELECT * FROM cte";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v1,v2;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-28570: VIEW with WHERE containing subquery
+--echo # with set function aggregated in query
+--echo #
+
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (c int, d int);
+
+INSERT INTO t1 VALUES
+ (1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40);
+INSERT INTO t2 VALUES
+ (2,10), (2,20), (4,10), (5,10), (3,20), (2,40);
+
+let $q=
+SELECT a FROM t1 GROUP BY a
+ HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
+
+eval CREATE VIEW v AS $q;
+
+eval $q;
+SELECT * FROM v;
+eval WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval EXPLAIN $q;
+EXPLAIN SELECT * FROM v;
+eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval PREPARE stmt FROM "$q";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-28571: VIEW with select list containing subquery
+--echo # with set function aggregated in query
+--echo #
+
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+
+let $q=
+SELECT (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a) AS c
+FROM t1
+GROUP BY a;
+
+eval CREATE VIEW v AS $q;
+
+eval $q;
+SELECT * FROM v;
+eval WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval EXPLAIN $q;
+EXPLAIN SELECT * FROM v;
+eval EXPLAIN WITH cte AS ( $q ) SELECT * FROM cte;
+
+eval PREPARE stmt FROM "$q";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "SELECT * FROM v";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+eval PREPARE stmt FROM "WITH cte AS ( $q ) SELECT * FROM cte";
+execute stmt;
+execute stmt;
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-30668: VIEW with WHERE containing nested subquery
+--echo # with set function aggregated in outer subquery
+--echo #
+
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+
+create table t2 (b int);
+insert into t2 values (2), (1), (4), (7);
+
+create table t3 (a int, b int);
+insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40);
+
+let $q=
+select * from t1
+ where t1.a in (select t3.a from t3 group by t3.a
+ having t3.a > any (select t2.b from t2
+ where t2.b*10 < sum(t3.b)));
+eval create view v as $q;
+
+eval $q;
+eval select * from v;
+eval with cte as ( $q ) select * from cte;
+
+eval explain $q;
+eval explain select * from v;
+eval explain with cte as ( $q ) select * from cte;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval prepare stmt from "select * from v";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval prepare stmt from "with cte as ( $q ) select * from cte";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop view v;
+drop table t1,t2,t3;
+
+--echo # End of 10.4 tests
+
+--echo #
+--echo # MDEV-31143: view with ORDER BY used in query with rownum() in WHERE
+--echo #
+
+create table t1 (id int primary key);
+insert into t1 values (3), (7), (1);
+
+create table t2 (a int);
+insert into t2 values (2), (4);
+
+create view v as select a from t2 order by a;
+
+set big_tables= 1;
+select t1.id from v, t1 where rownum() = 1 group by t1.id;
+
+set big_tables=default;
+
+drop view v;
+drop table t1, t2;
+
+--echo #
+--echo # MDEV-31162: multi-table mergeable view with ORDER BY used
+--echo # in query with rownum() in WHERE
+--echo #
+
+create table t1 (a INT) engine=MyISAM;
+insert into t1 values (1),(2);
+
+create table t2 (b INT) engine=MyISAM;
+insert into t2 values (3),(4);
+
+create view v1 AS select * from t1 join t2 order by b;
+let $q1=
+select * from v1 where rownum() <= 2;
+
+eval explain $q1;
+--sorted_result
+eval $q1;
+
+eval prepare stmt from "$q1";
+--sorted_result
+execute stmt;
+--sorted_result
+execute stmt;
+deallocate prepare stmt;
+
+create view v2 AS select * from t1 join t2 order by b/a;
+let $q2=
+select * from v2 where rownum() <= 2;
+
+eval explain $q2;
+eval $q2;
+eval prepare stmt from "$q2";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop view v1,v2;
+drop table t1,t2;
+
+--echo # End of 10.6 tests
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def
index 02104f6a680..7d0c59e1c84 100644
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@ -10,7 +10,6 @@
#
##############################################################################
tablespace : disabled in MariaDB (no TABLESPACE table attribute)
-events_time_zone : Test is not predictable as it depends on precise timing.
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
#show_explain : Psergey: random timeout in range-checked-for-each record query.
diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result
index 02a76cf3e09..c779459ebb5 100644
--- a/mysql-test/main/distinct.result
+++ b/mysql-test/main/distinct.result
@@ -1075,6 +1075,57 @@ UNION
drop table t1;
End of 5.5 tests
#
+# MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result
+#
+create table t1 (c int, d int);
+insert into t1 values (5, 1), (0, 3);
+select distinct sum(distinct 1), sum(t1.d) > 2 from (t1 e join t1) group by t1.c;
+sum(distinct 1) sum(t1.d) > 2
+1 1
+1 0
+select distinct sum(distinct 1), sum(t1.d) > 2, t1.c from (t1 e join t1) group by t1.c;
+sum(distinct 1) sum(t1.d) > 2 c
+1 1 0
+1 0 5
+insert into t1 values (6,6);
+select distinct sum(distinct 1), sum(t1.d) > 5 from (t1 e join t1) group by t1.c;
+sum(distinct 1) sum(t1.d) > 5
+1 1
+1 0
+select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c;
+sum(distinct 1) sum(t1.d) > 5 c
+1 1 0
+1 0 5
+1 1 6
+SET @sort_buffer_size_save= @@sort_buffer_size;
+set @@sort_buffer_size=1024;
+insert into t1 select -seq,-seq from seq_1_to_100;
+select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ;
+sum(distinct 1) sum(t1.d) > 2 length(group_concat(t1.d)) > 1000
+1 0 0
+1 1 0
+select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2;
+sum(distinct 1) sum(t1.d) > 2 length(group_concat(t1.d)) > 1000 c
+1 0 0 -1
+1 1 0 0
+1 1 0 5
+1 1 0 6
+drop table t1;
+set @@sort_buffer_size=@sort_buffer_size_save;
+#
+# MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key
+# with DISTINCT and group function
+#
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP;
+f1 f2
+0.0000 #
+0.0000 #
+0.5000 #
+DROP TABLE t;
+# End of 10.4 tests
+#
# MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
#
CREATE TABLE t1 (
diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test
index 2f10d866560..06d04afca56 100644
--- a/mysql-test/main/distinct.test
+++ b/mysql-test/main/distinct.test
@@ -822,6 +822,41 @@ drop table t1;
--echo End of 5.5 tests
--echo #
+--echo # MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result
+--echo #
+
+create table t1 (c int, d int);
+insert into t1 values (5, 1), (0, 3);
+select distinct sum(distinct 1), sum(t1.d) > 2 from (t1 e join t1) group by t1.c;
+select distinct sum(distinct 1), sum(t1.d) > 2, t1.c from (t1 e join t1) group by t1.c;
+
+insert into t1 values (6,6);
+select distinct sum(distinct 1), sum(t1.d) > 5 from (t1 e join t1) group by t1.c;
+select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c;
+
+# Force usage of remove_dup_with_compare() algorithm
+SET @sort_buffer_size_save= @@sort_buffer_size;
+set @@sort_buffer_size=1024;
+insert into t1 select -seq,-seq from seq_1_to_100;
+select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ;
+select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2;
+drop table t1;
+set @@sort_buffer_size=@sort_buffer_size_save;
+
+--echo #
+--echo # MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key
+--echo # with DISTINCT and group function
+--echo #
+
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+--replace_column 2 #
+SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP;
+DROP TABLE t;
+
+--echo # End of 10.4 tests
+
+--echo #
--echo # MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
--echo #
CREATE TABLE t1 (
diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result
index ec7d085c70f..e08427d9c65 100644
--- a/mysql-test/main/except.result
+++ b/mysql-test/main/except.result
@@ -423,8 +423,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 2
}
}
]
@@ -471,8 +474,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 2
}
}
]
@@ -556,8 +562,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 2
}
}
]
@@ -604,8 +613,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 2
}
}
]
diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result
index f79f35ee932..ffc9ddb7601 100644
--- a/mysql-test/main/except_all.result
+++ b/mysql-test/main/except_all.result
@@ -556,8 +556,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 3,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 3
}
}
]
@@ -604,8 +607,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 3
}
}
]
@@ -688,8 +694,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 3,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 3
}
}
]
@@ -736,8 +745,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL",
+ "r_loops": 2,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 3
}
}
]
diff --git a/mysql-test/main/explain_innodb.result b/mysql-test/main/explain_innodb.result
index 0bdd5a44985..03052eb3006 100644
--- a/mysql-test/main/explain_innodb.result
+++ b/mysql-test/main/explain_innodb.result
@@ -18,3 +18,21 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t1 range NULL id 53 NULL 1 Using index for group-by
SET GLOBAL slow_query_log = @sql_tmp;
drop table t1;
+#
+# MDEV-31181: Server crash in subselect_uniquesubquery_engine::print
+# upon EXPLAIN EXTENDED DELETE
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (pk INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
+Warnings:
+Note 1003 delete from `test`.`t1` using `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a`
+drop table t1, t2;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/explain_innodb.test b/mysql-test/main/explain_innodb.test
index 2c29a6e26da..3dcad4c2d49 100644
--- a/mysql-test/main/explain_innodb.test
+++ b/mysql-test/main/explain_innodb.test
@@ -18,3 +18,22 @@ SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0;
SET GLOBAL slow_query_log = @sql_tmp;
drop table t1;
+
+
+--echo #
+--echo # MDEV-31181: Server crash in subselect_uniquesubquery_engine::print
+--echo # upon EXPLAIN EXTENDED DELETE
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (pk INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+
+EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2);
+
+drop table t1, t2;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result
index df443003a86..969e069da83 100644
--- a/mysql-test/main/explain_json.result
+++ b/mysql-test/main/explain_json.result
@@ -2060,8 +2060,11 @@ ANALYZE
"buffer_size": "400",
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
+ "r_loops": 10,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 1
}
}
]
diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result
index 7dea232f260..e998d8745c1 100644
--- a/mysql-test/main/explain_non_select.result
+++ b/mysql-test/main/explain_non_select.result
@@ -157,9 +157,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain extended update t2 set b=3 where a in (3,4);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`b` = 3 where `test`.`t2`.`a` in (3,4)
explain extended delete from t2 where a in (3,4);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`a` in (3,4)
drop table t1,t2;
#
# Check the special case where partition pruning removed all partitions
diff --git a/mysql-test/main/merge-big.result b/mysql-test/main/flush_corruption.result
index bd188d7a856..bd188d7a856 100644
--- a/mysql-test/main/merge-big.result
+++ b/mysql-test/main/flush_corruption.result
diff --git a/mysql-test/main/merge-big.test b/mysql-test/main/flush_corruption.test
index 5873d2eb233..97ef416307f 100644
--- a/mysql-test/main/merge-big.test
+++ b/mysql-test/main/flush_corruption.test
@@ -1,5 +1,5 @@
#
-# Test of MERGE tables with multisession and many waits.
+# Test of MyISAM tables with multisession and many waits.
#
# This test takes rather long time so let us run it only in --big-test mode
--source include/big_test.inc
diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result
index de64d01ed4c..37420df6f00 100644
--- a/mysql-test/main/func_group.result
+++ b/mysql-test/main/func_group.result
@@ -1443,16 +1443,11 @@ FROM derived1 AS X
WHERE
X.int_nokey < 61
GROUP BY pk
-LIMIT 1)
+LIMIT 1) AS m
FROM D AS X
WHERE X.int_key < 13
GROUP BY int_nokey LIMIT 1;
-(SELECT COUNT( int_nokey )
-FROM derived1 AS X
-WHERE
-X.int_nokey < 61
-GROUP BY pk
-LIMIT 1)
+m
1
DROP TABLE derived1;
DROP TABLE D;
diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test
index 842ca4388ef..05946908fcf 100644
--- a/mysql-test/main/func_group.test
+++ b/mysql-test/main/func_group.test
@@ -583,8 +583,6 @@ DROP TABLE t1;
#
# Bug #16792 query with subselect, join, and group not returning proper values
#
-#enable after fix MDEV-28573
---disable_view_protocol
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
@@ -595,7 +593,6 @@ SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12),
COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2),
GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2);
DROP TABLE t1;
---enable_view_protocol
# End of 4.1 tests
@@ -627,13 +624,10 @@ drop table t1, t2, t3;
#
# BUG#3190, WL#1639: Standard Deviation STDDEV - 2 different calculations
#
-#enable after fix MDEV-28573
---disable_view_protocol
CREATE TABLE t1 (id int(11),value1 float(10,2));
INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00), (2,13.00);
select id, stddev_pop(value1), var_pop(value1), stddev_samp(value1), var_samp(value1) from t1 group by id;
DROP TABLE t1;
---enable_view_protocol
#
# BUG#8464 decimal AVG returns incorrect result
@@ -970,22 +964,19 @@ INSERT INTO D VALUES
(83,45,4,repeat(' X', 42)),
(105,53,12,NULL);
-#enable after fix MDEV-27871
---disable_view_protocol
SELECT
(SELECT COUNT( int_nokey )
FROM derived1 AS X
WHERE
X.int_nokey < 61
GROUP BY pk
- LIMIT 1)
+ LIMIT 1) AS m
FROM D AS X
WHERE X.int_key < 13
GROUP BY int_nokey LIMIT 1;
DROP TABLE derived1;
DROP TABLE D;
---enable_view_protocol
#
# Bug #39656: Behaviour different for agg functions with & without where -
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index bdda00e256d..f202de76359 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -1449,6 +1449,13 @@ JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives'))
[{"range_scan_alternatives": [{"index": "a_b", "ranges": ["2 <= a <= 2 AND 4 <= b <= 4", "123"], "rowid_ordered": true, "using_mrr": false, "index_only": true, "rows": 1, "cost": 1.1752, "chosen": true}], "analyzing_roworder_intersect": {"cause": "too few roworder scans"}, "analyzing_index_merge_union": [], "test_one_line_array": ["123"]}]
drop table t200;
#
+# MDEV-24538: JSON_LENGTH does not return error upon wrong number of parameters
+#
+SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo');
+ERROR 42000: Incorrect parameter count in the call to native function 'json_length'
+SELECT JSON_LENGTH();
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_LENGTH'
+#
# End of 10.4 tests
#
#
@@ -1667,7 +1674,18 @@ DROP TABLE t;
# End of 10.6 tests
#
#
-# Beginning of 10.9 tests
+# MDEV-31147 json_normalize does not work correctly with MSAN build
+#
+CREATE TABLE t1 (val JSON);
+ALTER TABLE t1 ADD COLUMN normalized_json JSON AS (JSON_NORMALIZE(val));
+INSERT INTO t1 (val) VALUES ('15');
+SELECT * FROM t1;
+val normalized_json
+15 1.5E1
+DROP TABLE t1;
+#
+# End of 10.8 tests
+#
#
# MDEV-27677: Implement JSON_OVERLAPS()
#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 7fc2f05a57a..120e5085ddb 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -665,6 +665,7 @@ SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest');
SELECT NULL;
SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
+
--echo #
--echo # End of 10.3 tests
--echo #
@@ -918,6 +919,14 @@ select JSON_LOOSE(JSON_EXTRACT(a, '$**.analyzing_range_alternatives')) from t200
drop table t200;
--echo #
+--echo # MDEV-24538: JSON_LENGTH does not return error upon wrong number of parameters
+--echo #
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_LENGTH('{"a":"b"}','$','$', 'foo');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_LENGTH();
+
+--echo #
--echo # End of 10.4 tests
--echo #
@@ -1105,7 +1114,18 @@ DROP TABLE t;
--echo #
--echo #
---echo # Beginning of 10.9 tests
+--echo # MDEV-31147 json_normalize does not work correctly with MSAN build
+--echo #
+CREATE TABLE t1 (val JSON);
+ALTER TABLE t1 ADD COLUMN normalized_json JSON AS (JSON_NORMALIZE(val));
+INSERT INTO t1 (val) VALUES ('15');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.8 tests
+--echo #
+
--echo #
--echo # MDEV-27677: Implement JSON_OVERLAPS()
--echo #
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index a477c3c2ec4..149eeebe0bb 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -5241,6 +5241,15 @@ DROP TABLE t1;
# Start of 10.4 tests
#
#
+# MDEV-30351 crash in Item_func_left::val_str
+#
+SELECT WEIGHT_STRING('aa') IN (LEFT(WEIGHT_STRING('aaa'),4),'bbb') as expect_1;
+expect_1
+1
+SELECT UNHEX('0032') in (LEFT(UNHEX('003200'), 2),'dog') as expect_1;
+expect_1
+1
+#
# MDEV-21841 CONV() function truncates the result type to 21 symbol.
#
CREATE TABLE t1(i BIGINT);
diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test
index 1c8839f24a2..377470ca60e 100644
--- a/mysql-test/main/func_str.test
+++ b/mysql-test/main/func_str.test
@@ -2280,17 +2280,23 @@ CREATE TABLE crash_test_2 (
--echo # Cleanup
DROP TABLE t1;
-
--echo #
--echo # End of 10.3 tests
--echo #
-
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
+--echo # MDEV-30351 crash in Item_func_left::val_str
+--echo #
+
+SELECT WEIGHT_STRING('aa') IN (LEFT(WEIGHT_STRING('aaa'),4),'bbb') as expect_1;
+
+SELECT UNHEX('0032') in (LEFT(UNHEX('003200'), 2),'dog') as expect_1;
+
+--echo #
--echo # MDEV-21841 CONV() function truncates the result type to 21 symbol.
--echo #
diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result
index 6f50f530a3e..76a5f5375e9 100644
--- a/mysql-test/main/grant5.result
+++ b/mysql-test/main/grant5.result
@@ -453,4 +453,13 @@ insert mysql.host values (1);
flush privileges;
ERROR HY000: Fatal error: mysql.host table is damaged or in unsupported 3.20 format
drop table mysql.host;
+#
+# MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade to 10.4
+#
+create table mysql.host (host char(60) binary default '' not null, db char(64) binary default '' not null, select_priv enum('n','y') collate utf8_general_ci default 'n' not null, insert_priv enum('n','y') collate utf8_general_ci default 'n' not null, update_priv enum('n','y') collate utf8_general_ci default 'n' not null, delete_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_priv enum('n','y') collate utf8_general_ci default 'n' not null, drop_priv enum('n','y') collate utf8_general_ci default 'n' not null, grant_priv enum('n','y') collate utf8_general_ci default 'n' not null, references_priv enum('n','y') collate utf8_general_ci default 'n' not null, index_priv enum('n','y') collate utf8_general_ci default 'n' not null, alter_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_tmp_table_priv enum('n','y') collate utf8_general_ci default 'n' not null, lock_tables_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_view_priv enum('n','y') collate utf8_general_ci default 'n' not null, show_view_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_routine_priv enum('n','y') collate utf8_general_ci default 'n' not null, alter_routine_priv enum('n','y') collate utf8_general_ci default 'n' not null, execute_priv enum('n','y') collate utf8_general_ci default 'n' not null, trigger_priv enum('n','y') collate utf8_general_ci default 'n' not null, primary key /*host*/ (host,db)) engine=myisam character set utf8 collate utf8_bin comment='host privileges; merged with database privileges';
+insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N');
+flush privileges;
+drop table mysql.host;
+#
# End of 10.4 tests
+#
diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test
index c4a302fca86..49e0ab1abf1 100644
--- a/mysql-test/main/grant5.test
+++ b/mysql-test/main/grant5.test
@@ -408,4 +408,16 @@ insert mysql.host values (1);
flush privileges;
drop table mysql.host;
+--echo #
+--echo # MDEV-30826 Invalid data on mysql.host segfaults the server after an upgrade to 10.4
+--echo #
+
+# from mysql_system_tables.sql in 10.3:
+create table mysql.host (host char(60) binary default '' not null, db char(64) binary default '' not null, select_priv enum('n','y') collate utf8_general_ci default 'n' not null, insert_priv enum('n','y') collate utf8_general_ci default 'n' not null, update_priv enum('n','y') collate utf8_general_ci default 'n' not null, delete_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_priv enum('n','y') collate utf8_general_ci default 'n' not null, drop_priv enum('n','y') collate utf8_general_ci default 'n' not null, grant_priv enum('n','y') collate utf8_general_ci default 'n' not null, references_priv enum('n','y') collate utf8_general_ci default 'n' not null, index_priv enum('n','y') collate utf8_general_ci default 'n' not null, alter_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_tmp_table_priv enum('n','y') collate utf8_general_ci default 'n' not null, lock_tables_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_view_priv enum('n','y') collate utf8_general_ci default 'n' not null, show_view_priv enum('n','y') collate utf8_general_ci default 'n' not null, create_routine_priv enum('n','y') collate utf8_general_ci default 'n' not null, alter_routine_priv enum('n','y') collate utf8_general_ci default 'n' not null, execute_priv enum('n','y') collate utf8_general_ci default 'n' not null, trigger_priv enum('n','y') collate utf8_general_ci default 'n' not null, primary key /*host*/ (host,db)) engine=myisam character set utf8 collate utf8_bin comment='host privileges; merged with database privileges';
+insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N');
+flush privileges;
+drop table mysql.host;
+
+--echo #
--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result
index ef5e500c314..79102ffaf61 100644
--- a/mysql-test/main/group_by.result
+++ b/mysql-test/main/group_by.result
@@ -1037,8 +1037,9 @@ FROM t1 AS t1_outer GROUP BY t1_outer.b;
21
21
SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1)
+AS m
FROM t1 AS t1_outer;
-(SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1)
+m
3
3
3
@@ -1278,12 +1279,9 @@ a
select avg (
(select
(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt
-from t1 as outr order by outr.a limit 1))
+from t1 as outr order by outr.a limit 1)) as m
from t1 as most_outer;
-avg (
-(select
-(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt
-from t1 as outr order by outr.a limit 1))
+m
29.0000
select avg (
(select (
diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test
index 3aa7f1cd0d3..6ca80f55ebf 100644
--- a/mysql-test/main/group_by.test
+++ b/mysql-test/main/group_by.test
@@ -786,11 +786,9 @@ SELECT 1 FROM t1 as t1_outer GROUP BY a
SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1)
FROM t1 AS t1_outer GROUP BY t1_outer.b;
-#enable after fix MDEV-27871
---disable_view_protocol
SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1)
+AS m
FROM t1 AS t1_outer;
---enable_view_protocol
--error ER_WRONG_FIELD_WITH_GROUP
SELECT (SELECT SUM(t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
@@ -866,6 +864,7 @@ DROP TABLE t1;
--echo #
--echo # Bug#27219: Aggregate functions in ORDER BY.
--echo #
+
SET @save_sql_mode=@@sql_mode;
SET @@sql_mode='ONLY_FULL_GROUP_BY';
@@ -887,6 +886,8 @@ SELECT 1 FROM t1 ORDER BY SUM(a) + 1;
--error 1140
SELECT 1 FROM t1 ORDER BY SUM(a), b;
+--disable_service_connection
+
--error 1140
SELECT a FROM t1 ORDER BY COUNT(b);
@@ -899,9 +900,6 @@ SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a);
--error 1140
SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
-#enable after fix MDEV-28570
---disable_view_protocol
-
--error 1140
SELECT t1.a FROM t1
WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
@@ -939,7 +937,7 @@ SELECT 1 FROM t1 GROUP BY t1.a
SELECT 1 FROM t1 GROUP BY t1.a
HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
---enable_view_protocol
+--enable_service_connection
# Both SUMs are aggregated in the subquery, no mixture:
SELECT t1.a FROM t1
@@ -964,18 +962,17 @@ SELECT t1.a, SUM(t1.b) FROM t1
ORDER BY SUM(t2.b + t1.a) LIMIT 1)
GROUP BY t1.a;
-#enable after fix MDEV-28570, MDEV-28571
---disable_view_protocol
-
SELECT t1.a FROM t1 GROUP BY t1.a
HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1);
select avg (
(select
(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt
- from t1 as outr order by outr.a limit 1))
+ from t1 as outr order by outr.a limit 1)) as m
from t1 as most_outer;
+--disable_service_connection
+
--error 1140
select avg (
(select (
@@ -983,7 +980,7 @@ select avg (
from t1 as outr order by count(outr.a) limit 1)) as tt
from t1 as most_outer;
---enable_view_protocol
+--enable_service_connection
select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a;
@@ -1388,7 +1385,7 @@ DROP TABLE t1;
--echo # Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
--echo # by functions
--echo #
-#createing view adds one new warning
+#creating view adds one new warning
--disable_view_protocol
set tmp_memory_table_size=0;
diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result
index a227246e7ec..cf4bfd62424 100644
--- a/mysql-test/main/group_min_max.result
+++ b/mysql-test/main/group_min_max.result
@@ -4117,6 +4117,18 @@ MIN(pk)
1
DROP TABLE t1, t2;
#
+# MDEV-30605 Wrong result while using index for group-by
+#
+CREATE TABLE t1 (pk INT primary key, a int, key(a)) engine=innodb;
+INSERT INTO t1 VALUES (1,-1),(2,8),(3,5),(4,-1),(5,10), (6,-1);
+SELECT MIN(pk), a FROM t1 WHERE pk <> 1 GROUP BY a;
+MIN(pk) a
+4 -1
+3 5
+2 8
+5 10
+DROP TABLE t1;
+#
# End of 10.5 tests
#
#
diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test
index d230cd15749..a1d2988ad4c 100644
--- a/mysql-test/main/group_min_max.test
+++ b/mysql-test/main/group_min_max.test
@@ -1746,6 +1746,17 @@ SELECT MIN(pk) FROM t1, t2;
DROP TABLE t1, t2;
--echo #
+--echo # MDEV-30605 Wrong result while using index for group-by
+--echo #
+
+CREATE TABLE t1 (pk INT primary key, a int, key(a)) engine=innodb;
+INSERT INTO t1 VALUES (1,-1),(2,8),(3,5),(4,-1),(5,10), (6,-1);
+
+SELECT MIN(pk), a FROM t1 WHERE pk <> 1 GROUP BY a;
+
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.5 tests
--echo #
diff --git a/mysql-test/main/insert_innodb.result b/mysql-test/main/insert_innodb.result
index 314412bcfdd..b8f3979d2ba 100644
--- a/mysql-test/main/insert_innodb.result
+++ b/mysql-test/main/insert_innodb.result
@@ -51,7 +51,7 @@ CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNI
ERROR HY000: Field 'v1' doesn't have a default value
CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb
REPLACE SELECT NULL AS a;
-ERROR HY000: Field 'DB_ROW_HASH_1' doesn't have a default value
+ERROR 23000: CONSTRAINT `t1.i` failed for `test`.`t1`
#
# End of 10.5 tests
#
diff --git a/mysql-test/main/insert_innodb.test b/mysql-test/main/insert_innodb.test
index b5a9fc72c07..56ddb2eafbf 100644
--- a/mysql-test/main/insert_innodb.test
+++ b/mysql-test/main/insert_innodb.test
@@ -71,7 +71,7 @@ DROP TABLE t2, t1;
--error ER_NO_DEFAULT_FOR_FIELD
CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ;
---error ER_NO_DEFAULT_FOR_FIELD
+--error ER_CONSTRAINT_FAILED
CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb
REPLACE SELECT NULL AS a;
diff --git a/mysql-test/main/insert_returning.result b/mysql-test/main/insert_returning.result
index 1976c1ca02e..b2ed9c90e51 100644
--- a/mysql-test/main/insert_returning.result
+++ b/mysql-test/main/insert_returning.result
@@ -63,6 +63,8 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN EXTENDED INSERT INTO t1(id1,val1) VALUES(9,'j') RETURNING id1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`t1`(id1,val1) values (9,'j')
EXPLAIN FORMAT="json" INSERT INTO t1(id1,val1) VALUES (10,'k') RETURNING id1;
EXPLAIN
{
@@ -151,6 +153,8 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN EXTENDED INSERT INTO t1 VALUES (17,'s'),(18,'t') RETURNING *;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`t1` values (17,'s'),(18,'t')
EXPLAIN FORMAT="json" INSERT INTO t1 VALUES(19,'u'),(20,'v') RETURNING id1;
EXPLAIN
{
@@ -236,6 +240,8 @@ EXPLAIN EXTENDED INSERT INTO ins_duplicate(id,val) VALUES (2,'b')
ON DUPLICATE KEY UPDATE val='i' RETURNING val;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT ins_duplicate ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`ins_duplicate`(id,val) values (2,'b') on duplicate key update `test`.`ins_duplicate`.`val` = 'i'
EXPLAIN FORMAT="json" INSERT INTO ins_duplicate(id,val) VALUES (2,'b')
ON DUPLICATE KEY UPDATE val='j' RETURNING val;
EXPLAIN
@@ -320,6 +326,8 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN EXTENDED INSERT INTO t1 SET id1=10, val1='j' RETURNING val1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`t1`(id1,val1) values (10,'j')
EXPLAIN FORMAT="json" INSERT INTO t1 SET id1=11, val1='k' RETURNING val1;
EXPLAIN
{
@@ -404,6 +412,8 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN EXTENDED INSERT INTO t1 SELECT * FROM t1 WHERE id1=9 RETURNING val1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 insert into `test`.`t1` select sql_buffer_result NULL AS `id1`,NULL AS `val1` from `test`.`t1` where 0
EXPLAIN FORMAT="json" INSERT INTO t1 SELECT * FROM t1 WHERE id1=10 RETURNING val1;
EXPLAIN
{
diff --git a/mysql-test/main/insert_update.result b/mysql-test/main/insert_update.result
index 68a1003ad85..3cbc1944b5e 100644
--- a/mysql-test/main/insert_update.result
+++ b/mysql-test/main/insert_update.result
@@ -412,3 +412,45 @@ select if( @stamp1 = @stamp2, "correct", "wrong");
if( @stamp1 = @stamp2, "correct", "wrong")
correct
drop table t1;
+#
+# MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
+#
+set timestamp=unix_timestamp('2000-10-20 0:0:0');
+create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp
+default current_timestamp on update current_timestamp);
+insert t1 (pk, val) values(1, 'val1');
+select * from t1;
+pk val ts
+1 val1 2000-10-20 00:00:00
+set timestamp=unix_timestamp('2000-10-20 1:0:0');
+insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
+ on duplicate key update ts=now();
+select * from t1;
+pk val ts
+1 val1 2000-10-20 00:00:00
+2 val3 2000-10-20 01:00:00
+3 val4 2000-10-20 01:00:00
+set timestamp=unix_timestamp('2000-10-20 2:0:0');
+insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
+ on duplicate key update ts=now();
+select * from t1;
+pk val ts
+1 val1 2000-10-20 02:00:00
+2 val3 2000-10-20 01:00:00
+3 val4 2000-10-20 01:00:00
+4 val2 2000-10-20 02:00:00
+set timestamp=unix_timestamp('2000-10-20 3:0:0');
+insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
+ on duplicate key update ts=now();
+select * from t1;
+pk val ts
+1 val1 2000-10-20 03:00:00
+2 val3 2000-10-20 01:00:00
+3 val4 2000-10-20 01:00:00
+4 val2 2000-10-20 02:00:00
+5 val1 2000-10-20 03:00:00
+drop table t1;
+set timestamp=default;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/insert_update.test b/mysql-test/main/insert_update.test
index 06e16be84d7..bb56f04c532 100644
--- a/mysql-test/main/insert_update.test
+++ b/mysql-test/main/insert_update.test
@@ -311,3 +311,30 @@ insert into t1(f1) values(1) on duplicate key update f1=1;
select @stamp2:=f2 from t1;
select if( @stamp1 = @stamp2, "correct", "wrong");
drop table t1;
+
+--echo #
+--echo # MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
+--echo #
+set timestamp=unix_timestamp('2000-10-20 0:0:0');
+create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp
+ default current_timestamp on update current_timestamp);
+insert t1 (pk, val) values(1, 'val1');
+select * from t1;
+set timestamp=unix_timestamp('2000-10-20 1:0:0');
+insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
+ on duplicate key update ts=now();
+select * from t1;
+set timestamp=unix_timestamp('2000-10-20 2:0:0');
+insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
+ on duplicate key update ts=now();
+select * from t1;
+set timestamp=unix_timestamp('2000-10-20 3:0:0');
+insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
+ on duplicate key update ts=now();
+select * from t1;
+drop table t1;
+set timestamp=default;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result
index 83a607f4e45..9e1b60ca381 100644
--- a/mysql-test/main/intersect.result
+++ b/mysql-test/main/intersect.result
@@ -508,8 +508,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
+ "r_loops": 3,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 3
}
}
]
@@ -618,8 +621,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
+ "r_loops": 3,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 3
}
}
]
diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result
index 8f826a193aa..3b1f3f2ac47 100644
--- a/mysql-test/main/intersect_all.result
+++ b/mysql-test/main/intersect_all.result
@@ -539,8 +539,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "65",
"join_type": "BNL",
+ "r_loops": 5,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 7
}
}
]
@@ -649,8 +652,11 @@ ANALYZE
"buffer_type": "flat",
"buffer_size": "65",
"join_type": "BNL",
+ "r_loops": 5,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 7
}
}
]
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index c02ac192dde..d6a530a9f77 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -5977,10 +5977,9 @@ LEFT JOIN t5 ON t4.e1 = t5.e1
LEFT JOIN (SELECT e1 FROM t2 ) AS d ON t4.e1 = d.e1) a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 128 Using where
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t4 ALL NULL NULL NULL NULL 128
-2 MATERIALIZED t5 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (flat, BNLH join)
-2 MATERIALIZED t2 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (incremental, BNLH join)
+1 PRIMARY t4 hash_ALL NULL #hash#$hj 5 test.t1.i1 128 Using where; Start temporary; Using join buffer (flat, BNLH join)
+1 PRIMARY t5 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (incremental, BNLH join)
+1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; End temporary; Using join buffer (incremental, BNLH join)
SELECT * FROM t1
WHERE
i1 < 10 AND
@@ -6035,12 +6034,11 @@ f1 f2
EXPLAIN EXTENDED SELECT * FROM temp
WHERE (f1,f2) IN (SELECT t1.i1, t1.v1 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1)));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY temp ALL NULL NULL NULL NULL 7 100.00
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
-2 MATERIALIZED t1 ALL NULL NULL NULL NULL 1 100.00 Using where
-2 MATERIALIZED t2 hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 33.33 Using index; Using join buffer (flat, BNLH join)
+1 PRIMARY t1 ALL NULL NULL NULL NULL 1 100.00 Using where; Start temporary
+1 PRIMARY temp hash_ALL NULL #hash#$hj 9 test.t1.i1,test.t1.v1 7 10.00 Using where; Using join buffer (flat, BNLH join)
+1 PRIMARY t2 hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 10.00 Using index; End temporary; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`temp`.`f1` AS `f1`,`test`.`temp`.`f2` AS `f2` from `test`.`temp` semi join (`test`.`t2` join `test`.`t1`) where `test`.`t2`.`v1` = `test`.`t1`.`v1`
+Note 1003 select `test`.`temp`.`f1` AS `f1`,`test`.`temp`.`f2` AS `f2` from `test`.`temp` semi join (`test`.`t2` join `test`.`t1`) where `test`.`temp`.`f1` = `test`.`t1`.`i1` and `test`.`temp`.`f2` = `test`.`t1`.`v1` and `test`.`t2`.`v1` = `test`.`t1`.`v1`
DROP TABLE t1,t2,temp;
set join_cache_level=@save_join_cache_level;
#
@@ -6163,9 +6161,9 @@ b c d e
EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t4 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t4.e 2 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
-1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using index; Using join buffer (incremental, BNLH join)
SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
a b c d e
1 1 2 2 1
@@ -6176,9 +6174,9 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b
WHERE e IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t4 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index; Not exists; Using join buffer (flat, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t4.e 2 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
-1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using where; Using index; Not exists; Using join buffer (incremental, BNLH join)
SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
WHERE e IS NULL;
a b c d e
diff --git a/mysql-test/main/join_cache_cardinality.result b/mysql-test/main/join_cache_cardinality.result
new file mode 100644
index 00000000000..de6b99f4b3a
--- /dev/null
+++ b/mysql-test/main/join_cache_cardinality.result
@@ -0,0 +1,105 @@
+create table t1 (a int, b int, c int);
+insert into t1 select seq,seq/2, seq/4 from seq_1_to_100;
+create table t2 (a int, b int, c int);
+insert into t2 select seq, seq/2, seq/4 from seq_1_to_200;
+analyze table t1,t2 persistent for all;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+set optimizer_trace=1;
+set join_cache_level=6;
+set optimizer_switch='hash_join_cardinality=on';
+explain select *
+from t1, t2
+where t1.a=t2.a and t1.a=t2.b and t1.c=t2.c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 15 test.t1.a,test.t1.a,test.t1.c 200 Using where; Using join buffer (flat, BNLH join)
+set @json= (select trace from information_schema.optimizer_trace);
+select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS;
+JS
+[
+ {
+ "hash_join_columns":
+ [
+ {
+ "field": "a",
+ "avg_frequency": 1
+ },
+ {
+ "field": "b",
+ "avg_frequency": 2
+ },
+ {
+ "field": "c",
+ "avg_frequency": 3.9216
+ }
+ ],
+ "rows": 1
+ }
+]
+select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan'))
+as ROWS_FOR_PLAN;
+ROWS_FOR_PLAN
+[100]
+explain select *
+from t1, t2 where t1.c=t2.c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.c 200 Using where; Using join buffer (flat, BNLH join)
+set @json= (select trace from information_schema.optimizer_trace);
+select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS;
+JS
+[
+ {
+ "hash_join_columns":
+ [
+ {
+ "field": "c",
+ "avg_frequency": 3.9216
+ }
+ ],
+ "rows": 3.9216
+ }
+]
+select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan'))
+as ROWS_FOR_PLAN;
+ROWS_FOR_PLAN
+[392.16]
+explain select *
+from t1 straight_join t2 where t1.c=t2.c and t2.a<30;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.c 200 Using where; Using join buffer (flat, BNLH join)
+set @json= (select trace from information_schema.optimizer_trace);
+# Note that rows is the same:
+select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS;
+JS
+[
+ {
+ "hash_join_columns":
+ [
+ {
+ "field": "c",
+ "avg_frequency": 3.9216
+ }
+ ],
+ "rows": 0.568632
+ }
+]
+# Despite available selectivity:
+select json_detailed(json_extract(@json, '$**.selectivity_for_columns')) as JS;
+JS
+[
+ [
+ {
+ "column_name": "a",
+ "ranges":
+ ["NULL < a < 30"],
+ "selectivity_from_histogram": 0.145
+ }
+ ]
+]
+drop table t1,t2;
diff --git a/mysql-test/main/join_cache_cardinality.test b/mysql-test/main/join_cache_cardinality.test
new file mode 100644
index 00000000000..b178810b807
--- /dev/null
+++ b/mysql-test/main/join_cache_cardinality.test
@@ -0,0 +1,41 @@
+--source include/have_sequence.inc
+
+# Embedded doesn't have optimizer trace:
+--source include/not_embedded.inc
+
+create table t1 (a int, b int, c int);
+insert into t1 select seq,seq/2, seq/4 from seq_1_to_100;
+
+create table t2 (a int, b int, c int);
+insert into t2 select seq, seq/2, seq/4 from seq_1_to_200;
+
+analyze table t1,t2 persistent for all;
+
+set optimizer_trace=1;
+set join_cache_level=6;
+set optimizer_switch='hash_join_cardinality=on';
+explain select *
+from t1, t2
+where t1.a=t2.a and t1.a=t2.b and t1.c=t2.c;
+
+set @json= (select trace from information_schema.optimizer_trace);
+select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS;
+select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan'))
+as ROWS_FOR_PLAN;
+
+explain select *
+from t1, t2 where t1.c=t2.c;
+set @json= (select trace from information_schema.optimizer_trace);
+select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS;
+select json_detailed(json_extract(@json, '$**.rest_of_plan[*].rows_for_plan'))
+as ROWS_FOR_PLAN;
+
+explain select *
+from t1 straight_join t2 where t1.c=t2.c and t2.a<30;
+set @json= (select trace from information_schema.optimizer_trace);
+--echo # Note that rows is the same:
+select json_detailed(json_extract(@json, '$**.hash_join_cardinality')) as JS;
+
+--echo # Despite available selectivity:
+select json_detailed(json_extract(@json, '$**.selectivity_for_columns')) as JS;
+drop table t1,t2;
diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result
index d5c46d48e68..3c292484c9e 100644
--- a/mysql-test/main/join_nested_jcl6.result
+++ b/mysql-test/main/join_nested_jcl6.result
@@ -61,8 +61,8 @@ LEFT JOIN
ON t2.b=t4.b;
a b a b a b
4 2 1 2 3 2
-4 2 2 2 3 2
4 2 1 2 4 2
+4 2 2 2 3 2
4 2 2 2 4 2
3 3 NULL NULL NULL NULL
5 3 NULL NULL NULL NULL
@@ -85,8 +85,8 @@ ON t2.b=t4.b
WHERE t3.a=1 OR t3.c IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
@@ -139,16 +139,16 @@ LEFT JOIN
ON t2.b=t4.b;
a b a b a b a b
4 2 1 2 3 2 3 1
-4 2 2 2 3 2 3 1
4 2 1 2 4 2 3 1
+4 2 2 2 3 2 3 1
4 2 2 2 4 2 3 1
4 2 1 2 3 2 2 2
-4 2 2 2 3 2 2 2
4 2 1 2 4 2 2 2
+4 2 2 2 3 2 2 2
4 2 2 2 4 2 2 2
4 2 1 2 3 2 3 3
-4 2 2 2 3 2 3 3
4 2 1 2 4 2 3 3
+4 2 2 2 3 2 3 3
4 2 2 2 4 2 3 3
3 3 NULL NULL NULL NULL NULL NULL
5 3 NULL NULL NULL NULL NULL NULL
@@ -161,8 +161,8 @@ ON t2.b=t4.b
WHERE t3.a>1 OR t3.c IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null
@@ -191,8 +191,8 @@ WHERE (t3.a>1 OR t3.c IS NULL) AND
(t5.a<3 OR t5.c IS NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`t5`.`c` is null)
@@ -242,7 +242,7 @@ ON t7.b=t8.b AND t6.b < 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
-1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10 and `test`.`t7`.`b` is not null) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
@@ -556,14 +556,14 @@ t0.b=t1.b AND
(t2.a >= 4 OR t2.c IS NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 10.00 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
-1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null)
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
@@ -651,17 +651,17 @@ t0.b=t1.b AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 10.00 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
SELECT t9.a,t9.b
FROM t9;
a b
@@ -849,8 +849,8 @@ WHERE t1.a <= 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t1`.`a` <= 2
INSERT INTO t2 VALUES (-1,9,0), (-3,10,0), (-2,8,0), (-4,11,0), (-5,15,0);
@@ -919,17 +919,17 @@ t0.b=t1.b AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 10.00 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null)
INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0);
INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0);
CREATE INDEX idx_b ON t4(b);
@@ -971,12 +971,12 @@ t0.b=t1.b AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 10.00 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
@@ -1021,10 +1021,10 @@ t0.b=t1.b AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
-1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 10.00 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join)
@@ -1075,7 +1075,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 10.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join)
@@ -1848,8 +1848,8 @@ ON t1.a=t2.a
WHERE t3.a IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.a 1 10.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 10.00 Using where; Not exists; Using join buffer (incremental, BNLH join)
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a` and `test`.`t3`.`a` is not null)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null
diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result
index ff5e76b78ad..a34bf96a0ef 100644
--- a/mysql-test/main/join_outer_jcl6.result
+++ b/mysql-test/main/join_outer_jcl6.result
@@ -2230,8 +2230,8 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
WHERE d3 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 10.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 10.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1` and `test`.`t1`.`i1` is not null and `test`.`t1`.`i1` is not null) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
DROP TABLE t1,t2,t3;
@@ -2251,7 +2251,7 @@ WHERE b IN (1,2,3) OR b = d;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 const 2 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 const 2 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10 and 10 is not null) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
@@ -2368,7 +2368,7 @@ ON t1.x = t2.x
WHERE IFNULL(t2.x,0)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where ifnull(`test`.`t2`.`x`,0) = 0
SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
@@ -2384,7 +2384,7 @@ ON t1.x = t2.x
WHERE f(t2.x,0)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where `f`(`test`.`t2`.`x`,0) = 0
drop function f;
@@ -2424,7 +2424,7 @@ FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE IFNULL(t2.col3,0) = 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where ifnull(`test`.`t2`.`col3`,0) = 0
SELECT t1.col1, t2.col1, t2.col3
@@ -2438,7 +2438,7 @@ FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE f1(t2.col3,0) = 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
@@ -2542,7 +2542,7 @@ a b
explain extended select * from t1 left join t2 on a=b where (b > 3) is not true;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where `test`.`t2`.`b` > 3 is not true
select * from t1 left join t2 on a=b where (b > 3) is not false;
@@ -2552,7 +2552,7 @@ a b
explain extended select * from t1 left join t2 on a=b where (b > 3) is not false;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
-1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where `test`.`t2`.`b` > 3 is not false
drop table t1,t2;
@@ -2783,8 +2783,8 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNLH join)
+1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
#
# .. part 2: make sure condition selectivity can use the condition too.
#
diff --git a/mysql-test/main/kill-2.result b/mysql-test/main/kill-2.result
index daaba2c092a..0f9d069aacc 100644
--- a/mysql-test/main/kill-2.result
+++ b/mysql-test/main/kill-2.result
@@ -10,3 +10,34 @@ foo
root
kill user foo@'127.0.0.1';
drop user foo@'127.0.0.1';
+#
+# KILL USER and missing privileges
+#
+create user a@'127.0.0.1';
+create user b@'127.0.0.1';
+grant process on *.* to a@'127.0.0.1';
+grant select on *.* to b@'127.0.0.1';
+connect a,127.0.0.1,a;
+show grants;
+Grants for a@127.0.0.1
+GRANT PROCESS ON *.* TO `a`@`127.0.0.1`
+connect b,127.0.0.1,b;
+show processlist;
+Id User Host db Command Time State Info Progress
+# b # test # # starting show processlist #
+kill user a;
+kill user x;
+connection a;
+show processlist;
+Id User Host db Command Time State Info Progress
+# root # test # # # # #
+# a # NULL # # # # #
+# b # test # # # # #
+kill user b;
+ERROR HY000: Operation KILL USER failed for b@%
+connection default;
+drop user a@'127.0.0.1';
+drop user b@'127.0.0.1';
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/kill-2.test b/mysql-test/main/kill-2.test
index 6d40e14a700..9bc4fe03346 100644
--- a/mysql-test/main/kill-2.test
+++ b/mysql-test/main/kill-2.test
@@ -27,3 +27,30 @@ let $wait_condition=
--source include/wait_condition.inc
drop user foo@'127.0.0.1';
--enable_service_connection
+
+--echo #
+--echo # KILL USER and missing privileges
+--echo #
+create user a@'127.0.0.1';
+create user b@'127.0.0.1';
+grant process on *.* to a@'127.0.0.1';
+grant select on *.* to b@'127.0.0.1';
+--connect a,127.0.0.1,a
+show grants;
+--connect b,127.0.0.1,b
+--replace_column 1 # 3 # 5 # 6 # 9 #
+show processlist;
+kill user a; # existing connection, but not visible to current_user
+kill user x; # not existing connection
+--connection a
+--replace_column 1 # 3 # 5 # 6 # 7 # 8 # 9 #
+show processlist;
+--error ER_KILL_DENIED_ERROR
+kill user b;
+--connection default
+drop user a@'127.0.0.1';
+drop user b@'127.0.0.1';
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/locale.result b/mysql-test/main/locale.result
index 39f11053df6..b1d41709a9d 100644
--- a/mysql-test/main/locale.result
+++ b/mysql-test/main/locale.result
@@ -307,6 +307,16 @@ select date_format('2001-09-01', '%c %b %M', 'de_CH');
date_format('2001-09-01', '%c %b %M', 'de_CH')
9 Sep September
#
+# MDEV-30630 locale: Chinese error message for ZH_CN
+#
+SET lc_messages=ZH_CN;
+SELECT x;
+ERROR 42S22: 未知列'x'在'field list'
+SET lc_messages=DEFAULT;
+#
+# End of 10.4 tests
+#
+#
# MDEV-30789 Add Georgian error messages and locale
#
SET lc_messages=ka_GE;
@@ -314,5 +324,47 @@ SELECT x;
ERROR 42S22: უცნობი სვეტი 'x' 'field list'-ში
SET lc_messages=DEFAULT;
#
+# MDEV-30997 SIGSEGV in __strlen_avx2 | make_date_time | Item_func_date_format::val_str
+#
+SET lc_messages=en_US;
+SET lc_time_names=111;
+SELECT DATE_FORMAT('1-12-01','%c %b %M');
+DATE_FORMAT('1-12-01','%c %b %M')
+12 დეკ დეკემბერი
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+SELECT d, DATE_FORMAT(d, '%b') AS MONTH_ABBR, MONTHNAME(d) FROM
+(
+SELECT CAST(CONCAT('2001-', i, '-01') AS DATE) AS d FROM t1
+) d1 ORDER BY d;
+d MONTH_ABBR MONTHNAME(d)
+2001-01-01 იან იანვარი
+2001-02-01 თებ თებერვალი
+2001-03-01 მარ მარტი
+2001-04-01 აპრ აპრილი
+2001-05-01 მაი მაისი
+2001-06-01 ივნ ივნისი
+2001-07-01 ივლ ივლისი
+2001-08-01 აგვ აგვისტო
+2001-09-01 სექტ სექტემბერი
+2001-10-01 ოქტ ოქტომბერი
+2001-11-01 ნოე ნოემბერი
+2001-12-01 დეკ დეკემბერი
+SELECT d, WEEKDAY(d), DATE_FORMAT(d, '%a') AS DAY_ABBR, DAYNAME(d) FROM
+(
+SELECT CAST(CONCAT('2001-01-', i) AS DATE) AS d FROM t1 WHERE i BETWEEN 1 AND 7
+) d1 ORDER BY d;
+d WEEKDAY(d) DAY_ABBR DAYNAME(d)
+2001-01-01 0 ორშ ორშაბათი
+2001-01-02 1 სამშ სამშაბათი
+2001-01-03 2 ოთხშ ოთხშაბათი
+2001-01-04 3 ხუთშ ხუთშაბათი
+2001-01-05 4 პარ პარასკევი
+2001-01-06 5 შაბ შაბათი
+2001-01-07 6 კვ კვირა
+DROP TABLE t1;
+SET lc_time_names=DEFAULT;
+SET lc_messages=DEFAULT;
+#
# End of 10.11 tests
#
diff --git a/mysql-test/main/locale.test b/mysql-test/main/locale.test
index 9f4ceb270d9..c99f2cb3865 100644
--- a/mysql-test/main/locale.test
+++ b/mysql-test/main/locale.test
@@ -182,6 +182,20 @@ select date_format('2001-12-01', '%c %b %M', 'rm_CH');
select date_format('2001-01-06', '%w %a %W', 'de_CH');
select date_format('2001-09-01', '%c %b %M', 'de_CH');
+--echo #
+--echo # MDEV-30630 locale: Chinese error message for ZH_CN
+--echo #
+
+SET lc_messages=ZH_CN;
+--error ER_BAD_FIELD_ERROR
+SELECT x;
+
+SET lc_messages=DEFAULT;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
+
--echo #
--echo # MDEV-30789 Add Georgian error messages and locale
@@ -193,6 +207,32 @@ SELECT x;
SET lc_messages=DEFAULT;
+
+--echo #
+--echo # MDEV-30997 SIGSEGV in __strlen_avx2 | make_date_time | Item_func_date_format::val_str
+--echo #
+
+SET lc_messages=en_US;
+SET lc_time_names=111;
+SELECT DATE_FORMAT('1-12-01','%c %b %M');
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+SELECT d, DATE_FORMAT(d, '%b') AS MONTH_ABBR, MONTHNAME(d) FROM
+(
+ SELECT CAST(CONCAT('2001-', i, '-01') AS DATE) AS d FROM t1
+) d1 ORDER BY d;
+
+SELECT d, WEEKDAY(d), DATE_FORMAT(d, '%a') AS DAY_ABBR, DAYNAME(d) FROM
+(
+ SELECT CAST(CONCAT('2001-01-', i) AS DATE) AS d FROM t1 WHERE i BETWEEN 1 AND 7
+) d1 ORDER BY d;
+
+
+DROP TABLE t1;
+SET lc_time_names=DEFAULT;
+SET lc_messages=DEFAULT;
+
+
--echo #
--echo # End of 10.11 tests
--echo #
diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result
index 283ea870a5f..ed13c668ec3 100644
--- a/mysql-test/main/long_unique_bugs.result
+++ b/mysql-test/main/long_unique_bugs.result
@@ -451,6 +451,12 @@ a b
1 xxx
drop table t1;
#
+# MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
+#
+create table t1 (f text not null, unique (f));
+insert into t1 (f) select 'f';
+drop table t1;
+#
# End of 10.4 tests
#
#
diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test
index 27bb402bd8b..6fc29e1d2dd 100644
--- a/mysql-test/main/long_unique_bugs.test
+++ b/mysql-test/main/long_unique_bugs.test
@@ -444,6 +444,13 @@ select * from t1;
drop table t1;
--echo #
+--echo # MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
+--echo #
+create table t1 (f text not null, unique (f));
+insert into t1 (f) select 'f';
+drop table t1;
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/myisam_explain_non_select_all.result b/mysql-test/main/myisam_explain_non_select_all.result
index 28107af3770..84b8d9ae4c5 100644
--- a/mysql-test/main/myisam_explain_non_select_all.result
+++ b/mysql-test/main/myisam_explain_non_select_all.result
@@ -15,6 +15,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a < 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 update `test`.`t1` set `test`.`t1`.`a` = 10 where `test`.`t1`.`a` < 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -54,6 +56,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`a` < 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -93,6 +97,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using `test`.`t1` where `test`.`t1`.`a` = 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -136,6 +142,8 @@ EXPLAIN EXTENDED UPDATE t1, t2 SET t1.a = 10 WHERE t1.a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 update `test`.`t1` join `test`.`t2` set `test`.`t1`.`a` = 10 where `test`.`t1`.`a` = 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -182,6 +190,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t1` `t11` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `t12` set `test`.`t11`.`a` = 10 where `test`.`t11`.`a` = 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -226,6 +236,8 @@ EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 33.33 Using where; FirstMatch
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 update `test`.`t1` semi join (`test`.`t2`) set `test`.`t1`.`a` = 10 where `test`.`t2`.`b` < 3
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -273,6 +285,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 33.33 Using where; FirstMatch(t1)
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 update `test`.`t1` semi join (`test`.`t2`) set `test`.`t1`.`a` = 10 where `test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -325,6 +338,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 100.00
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 1004 100.00 Using where
+Warnings:
+Note 1003 update `test`.`t1` semi join (`test`.`t3`) join `test`.`t2` set `test`.`t1`.`a` = 10 where `test`.`t3`.`b` < 3
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -373,6 +388,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t1` `t11` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `t12` set `test`.`t11`.`a` = `test`.`t11`.`a` + 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -421,6 +438,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t1` `t11` set `test`.`t11`.`a` = `test`.`t11`.`a` + 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -471,6 +490,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t1` `t11` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `t12` set `test`.`t11`.`a` = 10 where `test`.`t11`.`a` > 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -511,6 +532,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE a > 1 LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`a` > 1 limit 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -550,6 +573,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where 0
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -586,6 +611,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 delete from `test`.`t1` using `test`.`t1` where 0
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -622,6 +649,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE a = 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`a` = 3
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 5
@@ -659,6 +688,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`a` < 3
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 5
@@ -694,6 +725,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -729,6 +762,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -768,6 +803,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -808,6 +845,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 ORDER BY a ASC, b ASC LIMIT 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using filesort
+Warnings:
+Note 1003 delete from `test`.`t1` using dual order by `test`.`t1`.`a`,`test`.`t1`.`b` limit 1
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
@@ -861,6 +900,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00
+Warnings:
+Note 1003 delete from `test`.`t1`,`test`.`t2`,`test`.`t3` using `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 13
@@ -909,6 +950,8 @@ EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 25.00 Using where; FirstMatch(t1)
+Warnings:
+Note 1003 update `test`.`t1` semi join (`test`.`t2`) set `test`.`t1`.`a` = 10 where `test`.`t2`.`a` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -954,6 +997,8 @@ EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ delete from `test`.`t1` using dual where <in_optimizer>(`test`.`t1`.`a1`,<exists>(/* select#2 */ select `test`.`t2`.`a2` from `test`.`t2` where `test`.`t2`.`a2` > 2 and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`a2`))
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -995,6 +1040,8 @@ EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 20.00 Using where; FirstMatch(t1)
+Warnings:
+Note 1003 delete from `test`.`t1` using (`test`.`t2`) where `test`.`t2`.`a2` > 2 and `test`.`t1`.`a1` = `test`.`t2`.`a2`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1035,6 +1082,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET i = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
+Warnings:
+Note 1003 update `test`.`t1` set `test`.`t1`.`i` = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -1074,6 +1123,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL 5 NULL Deleting all rows
+Warnings:
+Note 1003 delete from `test`.`t1` using dual
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -1116,6 +1167,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1158,6 +1211,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED INSERT INTO t2 SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 insert into `test`.`t2` select `test`.`t1`.`i` AS `i` from `test`.`t1`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1198,6 +1253,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED REPLACE INTO t2 SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 replace into `test`.`t2` select `test`.`t1`.`i` AS `i` from `test`.`t1`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1236,6 +1293,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED INSERT INTO t1 SET i = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`t1`(i) values (10)
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -1259,6 +1318,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED REPLACE INTO t1 SET i = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 replace into `test`.`t1`(i) values (10)
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -1285,6 +1346,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1326,6 +1389,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1375,6 +1440,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1421,6 +1488,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1466,6 +1535,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1516,6 +1587,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1567,6 +1640,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -1616,6 +1691,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t2` using dual where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1659,6 +1736,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a, b DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort
+Warnings:
+Note 1003 delete from `test`.`t2` using dual order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -1709,6 +1788,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 6 NULL 5 100.00
+Warnings:
+Note 1003 delete from `test`.`t2` using dual order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -1754,6 +1835,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1798,6 +1881,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -1848,6 +1933,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where; Using buffer
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1895,6 +1982,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where; Using buffer
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1941,6 +2030,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -1991,6 +2082,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`d` = 10 where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 8
@@ -2042,6 +2135,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`i` = 123 where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2091,6 +2186,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -2135,6 +2232,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`c` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2186,6 +2285,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL a 6 NULL 5 100.00 Using buffer
+Warnings:
+Note 1003 update `test`.`t2` set `test`.`t2`.`c` = 10 order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2234,6 +2335,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort
+Warnings:
+Note 1003 update `test`.`t1` set `test`.`t1`.`c2` = 0 where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2276,6 +2379,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort
+Warnings:
+Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2321,6 +2426,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a=a+10 WHERE a > 34;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using buffer
+Warnings:
+Note 1003 update `test`.`t1` set `test`.`t1`.`a` = `test`.`t1`.`a` + 10 where `test`.`t1`.`a` > 34
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -2364,6 +2471,8 @@ EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1003 update `test`.`t1` set NULL = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
@@ -2403,6 +2512,8 @@ EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 W
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 update `test`.`t1` set NULL = 10 where `test`.`t1`.`c3` = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
@@ -2451,6 +2562,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ref IDX IDX 5 test.t1.f1 1 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
+Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`f2` = (/* select#2 */ select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`)
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
@@ -2520,6 +2632,8 @@ EXPLAIN EXTENDED UPDATE v1 SET a = 1 WHERE a > 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1003 update `test`.`t1` `t11` join `test`.`t1` `t12` set `test`.`t11`.`a` = 1 where `test`.`t11`.`a` > 0
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -2561,6 +2675,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1003 update `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` set `test`.`t11`.`a` = 1 where `test`.`t11`.`a` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -2606,6 +2722,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM v1 WHERE a < 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ delete from `test`.`t1` using dual where `test`.`t1`.`a` < 4
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -2653,6 +2771,8 @@ EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00
+Warnings:
+Note 1003 delete from `test`.`t1` using `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2700,6 +2820,8 @@ EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00
+Warnings:
+Note 1003 delete from `test`.`t1` using `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 6
@@ -2742,6 +2864,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED INSERT INTO v1 VALUES (10);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`t1`(x) values (10)
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 2
@@ -2780,6 +2904,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found
+Warnings:
+Note 1003 insert into `test`.`t2`(x) /* select#1 */ select NULL AS `a` from `test`.`t1`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -2833,6 +2959,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived3> eq_ref distinct_key distinct_key 5 test.t1.a 1 100.00
3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort
+Warnings:
+Note 1003 /* select#1 */ update (/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x` join `test`.`t1` set `test`.`t1`.`a` = 10 where `x`.`b` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -2882,6 +3010,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> eq_ref distinct_key distinct_key 5 test.t1.a 1 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00
3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort
+Warnings:
+Note 1003 /* select#1 */ update (/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x` join `test`.`t1` join `test`.`t2` set `test`.`t1`.`a` = 10 where `x`.`b` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -2933,6 +3063,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
4 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 /* select#1 */ update (/* select#4 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x` join `test`.`t1` join (/* select#2 */ select `test`.`t2`.`b` AS `b` from `test`.`t2`) `y` set `test`.`t1`.`a` = 10 where `x`.`b` = `test`.`t1`.`a`
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
@@ -2979,6 +3111,8 @@ JOIN t1 AS a12 ON a12.c1 = a11.c1
);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t3` set `test`.`t3`.`c3` = (/* select#2 */ select count(NULL) from `test`.`t1` `a11` straight_join `test`.`t2` `a21` join `test`.`t1` `a12` where 0)
DROP TABLE t1, t2, t3;
#73
CREATE TABLE t1 (id INT);
@@ -3005,6 +3139,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using buffer
+Warnings:
+Note 1003 update `test`.`t1` set `test`.`t1`.`a` = `test`.`t1`.`a` + 1 where `test`.`t1`.`a` > 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -3038,6 +3174,8 @@ FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10 ORDER BY a+20;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using filesort
+Warnings:
+Note 1003 update `test`.`t1` set `test`.`t1`.`a` = `test`.`t1`.`a` + 1 where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 3
@@ -3061,6 +3199,61 @@ Handler_read_key 4
Sort_range 1
DROP TABLE t1;
+#75
+CREATE TABLE t1 (id INT PRIMARY KEY, i INT);
+#
+# query: INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+# select:
+#
+EXPLAIN INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);;
+id select_type table type possible_keys key key_len ref rows Extra
+1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL
+FLUSH STATUS;
+FLUSH TABLES;
+EXPLAIN EXTENDED INSERT INTO t1 VALUES (3,10), (7,11), (3,11) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL
+Warnings:
+Note 1003 insert into `test`.`t1` values (3,10),(7,11),(3,11) on duplicate key update `test`.`t1`.`id` = last_insert_id(`test`.`t1`.`id`)
+# Status of EXPLAIN EXTENDED query
+Variable_name Value
+Handler_read_key 4
+# Status of testing query execution:
+Variable_name Value
+Handler_read_key 4
+Handler_read_rnd 1
+Handler_write 3
+
+DROP TABLE t1;
+#76
+CREATE TABLE t1 (id INT PRIMARY KEY, i INT);
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (1,10), (3,10), (7,11), (3,11);
+#
+# query: INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
+# select:
+#
+EXPLAIN INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+FLUSH STATUS;
+FLUSH TABLES;
+EXPLAIN EXTENDED INSERT INTO t1 SELECT * FROM t2 ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 insert into `test`.`t1` select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` on duplicate key update `test`.`t1`.`id` = last_insert_id(`test`.`t1`.`id`)
+# Status of EXPLAIN EXTENDED query
+Variable_name Value
+Handler_read_key 7
+# Status of testing query execution:
+Variable_name Value
+Handler_read_key 7
+Handler_read_rnd 1
+Handler_read_rnd_next 5
+Handler_write 4
+
+DROP TABLE t1,t2;
#
# Bug #12949629: CLIENT LOSES CONNECTION AFTER EXECUTING A PROCEDURE WITH
# EXPLAIN UPDATE/DEL/INS
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
index b6b35e44988..97548768a2d 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
@@ -10,13 +10,13 @@ CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
@@ -59,13 +59,13 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_t
set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
@@ -191,13 +191,13 @@ TRUNCATE TABLE time_zone_leap_second;
set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
time_zone_leap_second WRITE,
@@ -313,20 +313,20 @@ TRUNCATE TABLE time_zone_leap_second;
set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
/*M!100602 execute immediate if(@wsrep_cannot_replicate_tz, 'start transaction', 'LOCK TABLES time_zone WRITE,
time_zone_leap_second WRITE,
time_zone_name WRITE,
time_zone_transition WRITE,
time_zone_transition_type WRITE')*/;
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_leap_second_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_leap_second'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_leap_second_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_leap_second''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_leap_second ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone_leap_second;
execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_leap_second ENGINE=', @time_zone_leap_second_engine), 'do 0');
@@ -497,13 +497,13 @@ set sql_mode=default;
set @wsrep_is_on=(select coalesce(sum(SESSION_VALUE='ON'), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_on');
SET STATEMENT SQL_MODE='' FOR SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select coalesce(sum(GLOBAL_VALUE NOT LIKE @replicate_opt), 0) from information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='wsrep_mode');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_name'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_name_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_name''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_name ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0');
-execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone_transition_type'", 'do 0');
+execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0');
execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0');
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
diff --git a/mysql-test/main/mysqlbinlog.test b/mysql-test/main/mysqlbinlog.test
index 430cdb708cd..9394ca3fbd3 100644
--- a/mysql-test/main/mysqlbinlog.test
+++ b/mysql-test/main/mysqlbinlog.test
@@ -534,7 +534,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;
--echo # MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1
# The error produces the absolute path of the mysqlbinlog executable, remove it.
--replace_regex /.*mariadb-binlog.*:/mariadb-binlog:/i
---error 1
+--error 5
--exec $MYSQL_BINLOG std_data/master-bin.000001 --base64-output 2>&1
--echo #
diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff
index a43d7f0d86c..3e9541d7d2f 100644
--- a/mysql-test/main/mysqld--help,win.rdiff
+++ b/mysql-test/main/mysqld--help,win.rdiff
@@ -1,6 +1,12 @@
---- a/mysql-test/r/mysqld--help.result
-+++ b/mysql-test/r/mysqld--help.result
-@@ -685,6 +685,7 @@
+@@ -180,6 +180,7 @@
+ --console Write error output on screen; don't remove the console
+ window on windows.
+ --core-file Write core on crashes
++ (Defaults to on; use --skip-core-file to disable.)
+ -h, --datadir=name Path to the database root directory
+ --date-format=name The DATE format (ignored)
+ --datetime-format=name
+@@ -650,6 +651,7 @@
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index fb059b8b988..dbb4fbc262d 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -190,7 +190,7 @@ The following specify which files/extra groups are read (specified before remain
ALWAYS
--console Write error output on screen; don't remove the console
window on windows.
- --core-file Write core on errors.
+ --core-file Write core on crashes
-h, --datadir=name Path to the database root directory
--date-format=name The DATE format (ignored)
--datetime-format=name
@@ -799,7 +799,8 @@ The following specify which files/extra groups are read (specified before remain
extended_keys, exists_to_in, orderby_uses_equalities,
condition_pushdown_for_derived, split_materialized,
condition_pushdown_for_subquery, rowid_filter,
- condition_pushdown_from_having, not_null_range_scan
+ condition_pushdown_from_having, not_null_range_scan,
+ hash_join_cardinality
--optimizer-trace=name
Controls tracing of the Optimizer:
optimizer_trace=option=val[,option=val...], where option
@@ -1583,6 +1584,7 @@ column-compression-zlib-wrap FALSE
completion-type NO_CHAIN
concurrent-insert AUTO
console TRUE
+core-file TRUE
date-format %Y-%m-%d
datetime-format %Y-%m-%d %H:%i:%s
deadlock-search-depth-long 15
@@ -1757,7 +1759,7 @@ optimizer-rowid-copy-cost 0.002653
optimizer-scan-setup-cost 10
optimizer-search-depth 62
optimizer-selectivity-sampling-limit 100
-optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
+optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
optimizer-trace
optimizer-trace-max-mem-size 1048576
optimizer-use-condition-selectivity 4
diff --git a/mysql-test/main/mysqltest_tracking_info.result b/mysql-test/main/mysqltest_tracking_info.result
index 61bb3f2d1e2..c4fedd6b59c 100644
--- a/mysql-test/main/mysqltest_tracking_info.result
+++ b/mysql-test/main/mysqltest_tracking_info.result
@@ -38,7 +38,7 @@ SET @@session.session_track_system_variables='optimizer_switch';
set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- optimizer_switch
--- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+-- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
Warnings:
Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
diff --git a/mysql-test/main/name_resolution_cache_debug.result b/mysql-test/main/name_resolution_cache_debug.result
new file mode 100644
index 00000000000..7030176c5fe
--- /dev/null
+++ b/mysql-test/main/name_resolution_cache_debug.result
@@ -0,0 +1,25 @@
+connect con1,localhost,root;
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+create view v1 as select c+1 as e, d+1 as f from t2;
+SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go';
+prepare stmt1 from "select a from t1";
+execute stmt1;
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+SET DEBUG_SYNC= 'now SIGNAL go';
+connection con1;
+a
+SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go';
+prepare stmt1 from "select e from v1";
+execute stmt1;
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+SET DEBUG_SYNC= 'now SIGNAL go';
+connection con1;
+e
+connection default;
+disconnect con1;
+SET DEBUG_SYNC = 'RESET';
+drop view v1;
+drop table t1,t2;
diff --git a/mysql-test/main/name_resolution_cache_debug.test b/mysql-test/main/name_resolution_cache_debug.test
new file mode 100644
index 00000000000..362d883cbd1
--- /dev/null
+++ b/mysql-test/main/name_resolution_cache_debug.test
@@ -0,0 +1,36 @@
+
+source include/have_debug_sync.inc;
+
+connect con1,localhost,root;
+create table t1 (a int, b int);
+create table t2 (c int, d int);
+create view v1 as select c+1 as e, d+1 as f from t2;
+
+SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go';
+prepare stmt1 from "select a from t1";
+--send execute stmt1
+
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+SET DEBUG_SYNC= 'now SIGNAL go';
+
+connection con1;
+--reap
+
+SET DEBUG_SYNC= 'table_field_cached SIGNAL in_sync WAIT_FOR go';
+prepare stmt1 from "select e from v1";
+--send execute stmt1
+
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+SET DEBUG_SYNC= 'now SIGNAL go';
+
+connection con1;
+--reap
+
+connection default;
+disconnect con1;
+
+SET DEBUG_SYNC = 'RESET';
+drop view v1;
+drop table t1,t2;
diff --git a/mysql-test/main/old-mode.result b/mysql-test/main/old-mode.result
index 44e8f5bfece..daa2a4dc915 100644
--- a/mysql-test/main/old-mode.result
+++ b/mysql-test/main/old-mode.result
@@ -221,3 +221,39 @@ a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a)
DROP TABLE t1;
SET time_zone=DEFAULT;
SET global mysql56_temporal_format=true;
+#
+# MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!?
+#
+SET old_mode=zero_date_time_cast;
+SET @@time_zone='+00:00';
+SET timestamp=1234567;
+SELECT CURRENT_TIMESTAMP;
+CURRENT_TIMESTAMP
+1970-01-15 06:56:07
+SELECT UNIX_TIMESTAMP(CURRENT_TIME());
+UNIX_TIMESTAMP(CURRENT_TIME())
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '06:56:07'
+SELECT UNIX_TIMESTAMP(TIME'06:56:07');
+UNIX_TIMESTAMP(TIME'06:56:07')
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '06:56:07'
+SELECT UNIX_TIMESTAMP(TIME'10:20:30');
+UNIX_TIMESTAMP(TIME'10:20:30')
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '10:20:30'
+CREATE OR REPLACE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30');
+SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+UNIX_TIMESTAMP(a)
+NULL
+NULL
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+DROP TABLE t1;
+SET @@time_zone=DEFAULT;
+SET TIMESTAMP=DEFAULT;
diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test
index 0419be4bf6a..e4928329b47 100644
--- a/mysql-test/main/old-mode.test
+++ b/mysql-test/main/old-mode.test
@@ -149,3 +149,23 @@ SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2
DROP TABLE t1;
SET time_zone=DEFAULT;
SET global mysql56_temporal_format=true;
+
+
+--echo #
+--echo # MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!?
+--echo #
+
+SET old_mode=zero_date_time_cast;
+SET @@time_zone='+00:00';
+SET timestamp=1234567;
+SELECT CURRENT_TIMESTAMP;
+SELECT UNIX_TIMESTAMP(CURRENT_TIME());
+SELECT UNIX_TIMESTAMP(TIME'06:56:07');
+SELECT UNIX_TIMESTAMP(TIME'10:20:30');
+CREATE OR REPLACE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30');
+SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+SET @@time_zone=DEFAULT;
+SET TIMESTAMP=DEFAULT;
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 634ef3343a4..1342bc65f17 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -515,6 +515,11 @@ select * from v2 {
]
},
{
+ "check_split_materialized": {
+ "not_applicable": "no candidate field can be accessed through ref"
+ }
+ },
+ {
"best_join_order": ["t1"],
"rows": 1,
"cost": 0.010978597
@@ -901,6 +906,11 @@ explain select * from v1 {
]
},
{
+ "check_split_materialized": {
+ "not_applicable": "group list has no candidates"
+ }
+ },
+ {
"best_join_order": ["t1"],
"rows": 10,
"cost": 0.017968034
@@ -4266,7 +4276,7 @@ explain delete from t0 where t0.a<3 {
"select_id": 1,
"steps": [
{
- "expanded_query": "select from dual where t0.a < 3"
+ "expanded_query": "delete from t0 using dual where t0.a < 3"
}
]
}
@@ -4346,7 +4356,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"select_id": 1,
"steps": [
{
- "expanded_query": "select from t0 join t1 where t0.a = t1.a and t1.a < 3"
+ "expanded_query": "delete from t0,t1 using t0 join t1 where t0.a = t1.a and t1.a < 3"
}
]
}
@@ -4792,7 +4802,7 @@ explain select * from (select rand() from t1)q {
"derived": {
"table": "q",
"select_id": 2,
- "algorithm": "merged"
+ "algorithm": "materialized"
}
},
{
@@ -4806,7 +4816,7 @@ explain select * from (select rand() from t1)q {
}
},
{
- "expanded_query": "/* select#1 */ select rand() AS `rand()` from (/* select#2 */ select rand() AS `rand()` from t1) q"
+ "expanded_query": "/* select#1 */ select q.`rand()` AS `rand()` from (/* select#2 */ select rand() AS `rand()` from t1) q"
}
]
}
@@ -4816,14 +4826,6 @@ explain select * from (select rand() from t1)q {
"select_id": 1,
"steps": [
{
- "derived": {
- "table": "q",
- "select_id": 2,
- "algorithm": "materialized",
- "cause": "Random function in the select"
- }
- },
- {
"join_optimization": {
"select_id": 2,
"steps": [
@@ -11586,6 +11588,518 @@ SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d);
a
DROP TABLE t1;
#
+# MDEV-31085: multi-update using view with optimizer trace enabled
+#
+SET SESSION optimizer_trace = 'enabled=on';
+CREATE TABLE t (a int, b int);
+CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c;
+INSERT INTO t VALUES (0,4),(5,6);
+UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a;
+SELECT * FROM information_schema.optimizer_trace;
+QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
+UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a {
+ "steps": [
+ {
+ "view": {
+ "table": "v",
+ "select_id": 2,
+ "algorithm": "materialized"
+ }
+ },
+ {
+ "join_preparation": {
+ "select_id": 2,
+ "steps": [
+ {
+ "expanded_query": "/* select#2 */ select 1 AS c"
+ }
+ ]
+ }
+ },
+ {
+ "join_preparation": {
+ "select_id": 3,
+ "steps": [
+ {
+ "expanded_query": "/* select#3 */ select 2 AS c"
+ }
+ ]
+ }
+ },
+ {
+ "join_preparation": {
+ "select_id": 1,
+ "steps": [
+ {
+ "expanded_query": "/* select#1 */ update t join v set t.b = t.a,t.a = v.c where v.c < t.a"
+ }
+ ]
+ }
+ },
+ {
+ "join_optimization": {
+ "select_id": 1,
+ "steps": [
+ {
+ "condition_processing": {
+ "condition": "WHERE",
+ "original_condition": "v.c < t.a",
+ "steps": [
+ {
+ "transformation": "equality_propagation",
+ "resulting_condition": "v.c < t.a"
+ },
+ {
+ "transformation": "constant_propagation",
+ "resulting_condition": "v.c < t.a"
+ },
+ {
+ "transformation": "trivial_condition_removal",
+ "resulting_condition": "v.c < t.a"
+ }
+ ]
+ }
+ },
+ {
+ "join_optimization": {
+ "select_id": 2,
+ "steps": []
+ }
+ },
+ {
+ "join_optimization": {
+ "select_id": 3,
+ "steps": []
+ }
+ },
+ {
+ "table_dependencies": [
+ {
+ "table": "t",
+ "row_may_be_null": false,
+ "map_bit": 0,
+ "depends_on_map_bits": []
+ },
+ {
+ "table": "<derived2>",
+ "row_may_be_null": false,
+ "map_bit": 1,
+ "depends_on_map_bits": []
+ }
+ ]
+ },
+ {
+ "ref_optimizer_key_uses": []
+ },
+ {
+ "rows_estimation": [
+ {
+ "table": "t",
+ "table_scan": {
+ "rows": 2,
+ "read_cost": 0.01028441,
+ "read_and_compare_cost": 0.01034841
+ }
+ },
+ {
+ "table": "<derived2>",
+ "table_scan": {
+ "rows": 2,
+ "read_cost": 0.012350033,
+ "read_and_compare_cost": 0.012418701
+ }
+ }
+ ]
+ },
+ {
+ "considered_execution_plans": [
+ {
+ "plan_prefix": "",
+ "get_costs_for_tables": [
+ {
+ "best_access_path": {
+ "table": "t",
+ "plan_details": {
+ "record_count": 1
+ },
+ "considered_access_paths": [
+ {
+ "access_type": "scan",
+ "rows": 2,
+ "rows_after_filter": 2,
+ "rows_out": 2,
+ "cost": 0.01034841,
+ "index_only": false,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "rows_read": 2,
+ "rows_out": 2,
+ "cost": 0.01034841,
+ "uses_join_buffering": false
+ }
+ }
+ },
+ {
+ "best_access_path": {
+ "table": "<derived2>",
+ "plan_details": {
+ "record_count": 1
+ },
+ "considered_access_paths": [
+ {
+ "access_type": "scan",
+ "rows": 2,
+ "rows_after_filter": 2,
+ "rows_out": 2,
+ "cost": 0.012418701,
+ "index_only": false,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "rows_read": 2,
+ "rows_out": 2,
+ "cost": 0.012418701,
+ "uses_join_buffering": false
+ }
+ }
+ }
+ ]
+ },
+ {
+ "plan_prefix": "",
+ "table": "t",
+ "rows_for_plan": 2,
+ "cost_for_plan": 0.01034841,
+ "rest_of_plan": [
+ {
+ "plan_prefix": "t",
+ "get_costs_for_tables": [
+ {
+ "best_access_path": {
+ "table": "<derived2>",
+ "plan_details": {
+ "record_count": 2
+ },
+ "considered_access_paths": [
+ {
+ "access_type": "scan_with_join_cache",
+ "rows": 2,
+ "rows_after_filter": 2,
+ "rows_out": 2,
+ "cost": 0.012911897,
+ "index_only": false,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "rows_read": 2,
+ "rows_out": 2,
+ "cost": 0.012911897,
+ "uses_join_buffering": true
+ }
+ }
+ }
+ ]
+ },
+ {
+ "plan_prefix": "t",
+ "table": "<derived2>",
+ "rows_for_plan": 4,
+ "cost_for_plan": 0.023260307
+ }
+ ]
+ },
+ {
+ "plan_prefix": "",
+ "table": "<derived2>",
+ "rows_for_plan": 2,
+ "cost_for_plan": 0.012418701,
+ "pruned_by_heuristic": true
+ }
+ ]
+ },
+ {
+ "best_join_order": ["t", "<derived2>"],
+ "rows": 4,
+ "cost": 0.023260307
+ },
+ {
+ "substitute_best_equal": {
+ "condition": "WHERE",
+ "resulting_condition": "v.c < t.a"
+ }
+ },
+ {
+ "attaching_conditions_to_tables": {
+ "attached_conditions_computation": [],
+ "attached_conditions_summary": [
+ {
+ "table": "t",
+ "attached_condition": null
+ },
+ {
+ "table": "<derived2>",
+ "attached_condition": "v.c < t.a"
+ }
+ ]
+ }
+ },
+ {
+ "make_join_readinfo": []
+ }
+ ]
+ }
+ },
+ {
+ "join_execution": {
+ "select_id": 1,
+ "steps": [
+ {
+ "join_execution": {
+ "select_id": 2,
+ "steps": []
+ }
+ },
+ {
+ "join_execution": {
+ "select_id": 3,
+ "steps": []
+ }
+ },
+ {
+ "join_preparation": {
+ "select_id": "fake",
+ "steps": [
+ {
+ "expanded_query": "select c AS c from dual"
+ }
+ ]
+ }
+ },
+ {
+ "join_optimization": {
+ "select_id": "fake",
+ "steps": [
+ {
+ "table_dependencies": [
+ {
+ "table": "union",
+ "row_may_be_null": false,
+ "map_bit": 0,
+ "depends_on_map_bits": []
+ }
+ ]
+ },
+ {
+ "rows_estimation": [
+ {
+ "table": "union",
+ "table_scan": {
+ "rows": 2,
+ "read_cost": 0.010020701,
+ "read_and_compare_cost": 0.010084701
+ }
+ }
+ ]
+ },
+ {
+ "considered_execution_plans": [
+ {
+ "plan_prefix": "",
+ "get_costs_for_tables": [
+ {
+ "best_access_path": {
+ "table": "union",
+ "plan_details": {
+ "record_count": 1
+ },
+ "considered_access_paths": [
+ {
+ "access_type": "scan",
+ "rows": 2,
+ "rows_after_filter": 2,
+ "rows_out": 2,
+ "cost": 0.010084701,
+ "index_only": false,
+ "chosen": true
+ }
+ ],
+ "chosen_access_method": {
+ "type": "scan",
+ "rows_read": 2,
+ "rows_out": 2,
+ "cost": 0.010084701,
+ "uses_join_buffering": false
+ }
+ }
+ }
+ ]
+ },
+ {
+ "plan_prefix": "",
+ "table": "union",
+ "rows_for_plan": 2,
+ "cost_for_plan": 0.010084701
+ }
+ ]
+ },
+ {
+ "best_join_order": ["union"],
+ "rows": 2,
+ "cost": 0.010084701
+ },
+ {
+ "attaching_conditions_to_tables": {
+ "attached_conditions_computation": [],
+ "attached_conditions_summary": [
+ {
+ "table": "union",
+ "attached_condition": null
+ }
+ ]
+ }
+ },
+ {
+ "make_join_readinfo": []
+ }
+ ]
+ }
+ },
+ {
+ "join_execution": {
+ "select_id": "fake",
+ "steps": []
+ }
+ }
+ ]
+ }
+ }
+ ]
+} 0 0
+SELECT * FROM t;
+a b
+0 4
+1 5
+SET optimizer_trace=DEFAULT;
+DROP VIEW v;
+DROP TABLE t;
+#
+# MDEV-26301: Split optimization improvements: Optimizer Trace coverage
+#
+create table t1(a int, b int);
+insert into t1 select seq,seq from seq_1_to_5;
+create table t2(a int, b int, key(a));
+insert into t2
+select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
+create table t3(a int, b int, key(a));
+insert into t3
+select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
+analyze table t1,t2,t3 persistent for all;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status Table is already up to date
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze status Table is already up to date
+create table t10 (
+grp_id int,
+col1 int,
+key(grp_id)
+);
+insert into t10
+select
+A.seq,
+B.seq
+from
+seq_1_to_100 A,
+seq_1_to_100 B;
+create table t11 (
+col1 int,
+col2 int
+);
+insert into t11
+select A.seq, A.seq from seq_1_to_10 A;
+analyze table t10,t11 persistent for all;
+Table Op Msg_type Msg_text
+test.t10 analyze status Engine-independent statistics collected
+test.t10 analyze status Table is already up to date
+test.t11 analyze status Engine-independent statistics collected
+test.t11 analyze status OK
+set optimizer_trace=1;
+explain
+select * from
+(
+(t1 left join t2 on t2.a=t1.b)
+left join t3 on t3.a=t1.b
+) left join (select grp_id, count(*)
+from t10 left join t11 on t11.col1=t10.col1
+group by grp_id) T on T.grp_id=t1.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5
+1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
+1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
+2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
+2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
+select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS
+from information_schema.optimizer_trace;
+JS
+[
+ {
+ "split_candidates":
+ ["t10.grp_id"]
+ }
+]
+select
+json_detailed(
+json_remove(
+json_extract(trace, '$**.choose_best_splitting')
+, '$[0].split_plan_search[0]'
+ )
+) as JS
+from information_schema.optimizer_trace;
+JS
+[
+ {
+ "considered_keys":
+ [
+ {
+ "table_name": "t10",
+ "index": "grp_id",
+ "rec_per_key": 100,
+ "param_tables": 1
+ }
+ ],
+ "refills": 5,
+ "spl_pd_boundary": 2,
+ "split_plan_search":
+ [],
+ "split_materialized":
+ {
+ "table": "t10",
+ "key": "grp_id",
+ "org_cost": 1.159965,
+ "postjoin_cost": 4.020888502,
+ "one_splitting_cost": 5.180853502,
+ "unsplit_postjoin_cost": 32.78652054,
+ "unsplit_cost": 148.7830205,
+ "rows": 100,
+ "refills": 5,
+ "total_splitting_cost": 25.90426751,
+ "chosen": true
+ }
+ }
+]
+drop table t1,t2,t3,t10,t11;
+set optimizer_trace=DEFAULT;
+#
# End of 10.4 tests
#
set optimizer_trace='enabled=on';
@@ -12017,84 +12531,94 @@ from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.choose_best_splitting'))
[
- [
- {
- "considered_execution_plans":
- [
- {
- "plan_prefix": "",
- "get_costs_for_tables":
- [
- {
- "best_access_path":
+ {
+ "considered_keys":
+ []
+ },
+ {
+ "considered_keys":
+ [
+ {
+ "table_name": "t2",
+ "index": "idx_a",
+ "rec_per_key": 1.8367,
+ "param_tables": 1
+ }
+ ],
+ "refills": 4,
+ "spl_pd_boundary": 2,
+ "split_plan_search":
+ [
+ {
+ "considered_execution_plans":
+ [
+ {
+ "plan_prefix": "",
+ "get_costs_for_tables":
+ [
{
- "table": "t2",
- "plan_details":
+ "best_access_path":
{
- "record_count": 1
- },
- "considered_access_paths":
- [
+ "table": "t2",
+ "plan_details":
{
- "access_type": "ref",
- "index": "idx_a",
- "used_range_estimates": false,
- "reason": "not available",
- "rows": 1.8367,
- "cost": 0.002051185,
- "chosen": true
+ "record_count": 1
},
+ "considered_access_paths":
+ [
+ {
+ "access_type": "ref",
+ "index": "idx_a",
+ "used_range_estimates": false,
+ "reason": "not available",
+ "rows": 1.8367,
+ "cost": 0.002051185,
+ "chosen": true
+ },
+ {
+ "type": "scan",
+ "chosen": false,
+ "cause": "cost"
+ }
+ ],
+ "chosen_access_method":
{
- "type": "scan",
- "chosen": false,
- "cause": "cost"
+ "type": "ref",
+ "rows_read": 1.8367,
+ "rows_out": 1.8367,
+ "cost": 0.002051185,
+ "uses_join_buffering": false
}
- ],
- "chosen_access_method":
- {
- "type": "ref",
- "rows_read": 1.8367,
- "rows_out": 1.8367,
- "cost": 0.002051185,
- "uses_join_buffering": false
}
}
- }
- ]
- },
- {
- "plan_prefix": "",
- "table": "t2",
- "rows_for_plan": 1.8367,
- "cost_for_plan": 0.002051185,
- "cost_for_sorting": 0.001155201
- }
- ]
- },
- {
- "split_materialized":
- {
- "table": "t2",
- "key": "idx_a",
- "org_cost": 0.002051185,
- "postjoin_cost": 0.001135418,
- "one_splitting_cost": 0.003186603,
- "unsplit_postjoin_cost": 0.036032575,
- "unsplit_cost": 0.060625425,
- "rows": 1.8367,
- "outer_rows": 4,
- "total_splitting_cost": 0.012746412,
- "chosen": true
+ ]
+ },
+ {
+ "plan_prefix": "",
+ "table": "t2",
+ "rows_for_plan": 1.8367,
+ "cost_for_plan": 0.002051185,
+ "cost_for_sorting": 0.001155201
+ }
+ ]
}
+ ],
+ "split_materialized":
+ {
+ "table": "t2",
+ "key": "idx_a",
+ "org_cost": 0.002051185,
+ "postjoin_cost": 0.001135418,
+ "one_splitting_cost": 0.003186603,
+ "unsplit_postjoin_cost": 0.036032575,
+ "unsplit_cost": 0.060625425,
+ "rows": 1.8367,
+ "refills": 4,
+ "total_splitting_cost": 0.012746412,
+ "chosen": true
}
- ]
+ }
]
-select
-json_detailed(json_extract(trace, '$**.lateral_derived'))
-from
-information_schema.optimizer_trace;
-json_detailed(json_extract(trace, '$**.lateral_derived'))
-NULL
drop table t1,t2;
#
# Test table functions.
diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test
index 6f8040f1689..b60cb95fcd6 100644
--- a/mysql-test/main/opt_trace.test
+++ b/mysql-test/main/opt_trace.test
@@ -654,6 +654,101 @@ SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d);
DROP TABLE t1;
--echo #
+--echo # MDEV-31085: multi-update using view with optimizer trace enabled
+--echo #
+
+SET SESSION optimizer_trace = 'enabled=on';
+
+CREATE TABLE t (a int, b int);
+CREATE VIEW v AS SELECT 1 AS c UNION SELECT 2 AS c;
+INSERT INTO t VALUES (0,4),(5,6);
+UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a;
+SELECT * FROM information_schema.optimizer_trace;
+
+SELECT * FROM t;
+
+SET optimizer_trace=DEFAULT;
+
+DROP VIEW v;
+DROP TABLE t;
+
+--echo #
+--echo # MDEV-26301: Split optimization improvements: Optimizer Trace coverage
+--echo #
+
+# 5 values
+create table t1(a int, b int);
+insert into t1 select seq,seq from seq_1_to_5;
+
+# 5 value groups of size 2 each
+create table t2(a int, b int, key(a));
+insert into t2
+select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
+
+# 5 value groups of size 3 each
+create table t3(a int, b int, key(a));
+insert into t3
+select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
+
+analyze table t1,t2,t3 persistent for all;
+
+create table t10 (
+ grp_id int,
+ col1 int,
+ key(grp_id)
+);
+
+# 100 groups of 100 values each
+insert into t10
+select
+ A.seq,
+ B.seq
+from
+ seq_1_to_100 A,
+ seq_1_to_100 B;
+
+# and X10 multiplier
+create table t11 (
+ col1 int,
+ col2 int
+);
+insert into t11
+select A.seq, A.seq from seq_1_to_10 A;
+
+analyze table t10,t11 persistent for all;
+
+set optimizer_trace=1;
+explain
+select * from
+ (
+ (t1 left join t2 on t2.a=t1.b)
+ left join t3 on t3.a=t1.b
+ ) left join (select grp_id, count(*)
+ from t10 left join t11 on t11.col1=t10.col1
+ group by grp_id) T on T.grp_id=t1.b;
+
+# Not sure how MDEV-27871 is related but this test uses this reason
+# all over the place:
+#enable after fix MDEV-27871
+--disable_view_protocol
+
+select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS
+from information_schema.optimizer_trace;
+
+select
+ json_detailed(
+ json_remove(
+ json_extract(trace, '$**.choose_best_splitting')
+ , '$[0].split_plan_search[0]'
+ )
+ ) as JS
+from information_schema.optimizer_trace;
+
+--enable_view_protocol
+drop table t1,t2,t3,t10,t11;
+set optimizer_trace=DEFAULT;
+
+--echo #
--echo # End of 10.4 tests
--echo #
@@ -861,13 +956,6 @@ from
information_schema.optimizer_trace;
--enable_view_protocol
-# Same as above. just to show that splitting plan has some coverage in the
-# trace.
-select
- json_detailed(json_extract(trace, '$**.lateral_derived'))
-from
- information_schema.optimizer_trace;
-
drop table t1,t2;
--echo #
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index c0c459e57b4..2f343c7bca8 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1905,12 +1905,32 @@ SET @@sql_mode=@save_sql_mode;
#
# MDEV-30151 parse error 1=2 not between/in
#
-select 1=2 not in (3,4);
-1=2 not in (3,4)
+SELECT 1=2 NOT IN (3,4);
+1=2 NOT IN (3,4)
1
-select 1=2 not between 3 and 4;
-1=2 not between 3 and 4
+SELECT 1=2 NOT BETWEEN 3 AND 4;
+1=2 NOT BETWEEN 3 AND 4
1
+CREATE TABLE t1 ( f INT AS ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) );
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` int(11) GENERATED ALWAYS AS (1 = 2 not between 3 and 4) VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CREATE TABLE t1 ( f INT, CHECK ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) );
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` int(11) DEFAULT NULL,
+ CONSTRAINT `CONSTRAINT_1` CHECK (1 = 2 not between 3 and 4)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CREATE VIEW v1 AS SELECT 1 IN ( 2 NOT BETWEEN 3 AND 4 );
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 = 2 not between 3 and 4 AS `1 IN ( 2 NOT BETWEEN 3 AND 4 )` latin1 latin1_swedish_ci
+DROP VIEW v1;
#
# End of 10.3 tests
#
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index 48cda68b416..dcad30b36b8 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1687,8 +1687,21 @@ SET @@sql_mode=@save_sql_mode;
--echo #
--echo # MDEV-30151 parse error 1=2 not between/in
--echo #
-select 1=2 not in (3,4);
-select 1=2 not between 3 and 4;
+
+SELECT 1=2 NOT IN (3,4);
+SELECT 1=2 NOT BETWEEN 3 AND 4;
+
+CREATE TABLE t1 ( f INT AS ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) );
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 ( f INT, CHECK ( 1 IN ( 2 NOT BETWEEN 3 AND 4 ) ) );
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE VIEW v1 AS SELECT 1 IN ( 2 NOT BETWEEN 3 AND 4 );
+SHOW CREATE VIEW v1;
+DROP VIEW v1;
--echo #
--echo # End of 10.3 tests
diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result
index ad4c3cf1ad3..78d4aa3f87c 100644
--- a/mysql-test/main/partition.result
+++ b/mysql-test/main/partition.result
@@ -2820,3 +2820,41 @@ DROP TABLE t1,t2;
#
# End of 10.1 tests
#
+#
+# MDEV-30596: Assertion 'pushed_rowid_filter != __null ...' failed
+#
+create table t1 (a int);
+insert into t1 values (NULL),(1),(2);
+create table t2 (a int);
+insert into t2 select seq from seq_1_to_1000;
+create table t3 (
+a1 int,
+a2 int,
+b int,
+c int,
+filler1 char(200),
+filler2 char(200),
+key(a1,a2),
+key(b)
+) partition by hash(a1) partitions 2;
+insert into t3 select seq/100, seq/100, seq, seq, seq, seq from seq_1_to_10000;
+analyze table t3 persistent for all;
+Table Op Msg_type Msg_text
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze status OK
+set @tmp_os= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+# Must not show "Using rowid filter":
+explain
+select *
+from t1
+where
+t1.a not in (select straight_join t3.a1
+from t2, t3
+where t3.b < 3000 and t3.a2=t2.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1000 Using where
+2 DEPENDENT SUBQUERY t3 ref_or_null a1,b a1 10 func,test.t2.a 198 Using where; Full scan on NULL key
+set optimizer_switch=@tmp_os;
+drop table t1,t2,t3;
diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test
index 5f4c5f659ca..d96031a6b2b 100644
--- a/mysql-test/main/partition.test
+++ b/mysql-test/main/partition.test
@@ -3021,7 +3021,44 @@ INSERT INTO t2 VALUES (1),(2);
UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
DROP TABLE t1,t2;
-
--echo #
--echo # End of 10.1 tests
--echo #
+
+--echo #
+--echo # MDEV-30596: Assertion 'pushed_rowid_filter != __null ...' failed
+--echo #
+--source include/have_sequence.inc
+create table t1 (a int);
+insert into t1 values (NULL),(1),(2);
+create table t2 (a int);
+insert into t2 select seq from seq_1_to_1000;
+
+create table t3 (
+ a1 int,
+ a2 int,
+ b int,
+ c int,
+ filler1 char(200),
+ filler2 char(200),
+ key(a1,a2),
+ key(b)
+) partition by hash(a1) partitions 2;
+insert into t3 select seq/100, seq/100, seq, seq, seq, seq from seq_1_to_10000;
+analyze table t3 persistent for all;
+
+set @tmp_os= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+
+--echo # Must not show "Using rowid filter":
+explain
+select *
+from t1
+where
+ t1.a not in (select straight_join t3.a1
+ from t2, t3
+ where t3.b < 3000 and t3.a2=t2.a);
+set optimizer_switch=@tmp_os;
+
+drop table t1,t2,t3;
+
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index cb2e9651c3d..cb7b215a110 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -5553,10 +5553,14 @@ CREATE TABLE t3 (c3 INT) ENGINE=MyISAM;
EXPLAIN EXTENDED UPDATE t3 SET c3 = ( SELECT COUNT(d1.c1) FROM ( SELECT a11.c1 FROM t1 AS a11 STRAIGHT_JOIN t2 AS a21 ON a21.c2 = a11.c1 JOIN t1 AS a12 ON a12.c1 = a11.c1 ) d1 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t3` set `test`.`t3`.`c3` = (/* select#2 */ select count(NULL) from `test`.`t1` `a11` straight_join `test`.`t2` `a21` join `test`.`t1` `a12` where 0)
PREPARE stmt FROM "EXPLAIN EXTENDED UPDATE t3 SET c3 = ( SELECT COUNT(d1.c1) FROM ( SELECT a11.c1 FROM t1 AS a11 STRAIGHT_JOIN t2 AS a21 ON a21.c2 = a11.c1 JOIN t1 AS a12 ON a12.c1 = a11.c1 ) d1 )";
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t3` set `test`.`t3`.`c3` = (/* select#2 */ select count(NULL) from `test`.`t1` `a11` straight_join `test`.`t2` `a21` join `test`.`t1` `a12` where 0)
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2, t3;
#
diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result
index da6c848e334..5b8c56c87d3 100644
--- a/mysql-test/main/rowid_filter_innodb.result
+++ b/mysql-test/main/rowid_filter_innodb.result
@@ -3342,8 +3342,11 @@ ANALYZE
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"attached_condition": "a.atp = 1",
+ "r_loops": 3,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 1
}
},
{
@@ -3384,8 +3387,11 @@ ANALYZE
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)",
+ "r_loops": 3,
"r_filtered": 100,
- "r_unpack_time_ms": "REPLACED"
+ "r_unpack_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "r_effective_rows": 10.66666667
}
}
]
diff --git a/mysql-test/main/rownum.result b/mysql-test/main/rownum.result
index 3ad51c93260..b61269b1b47 100644
--- a/mysql-test/main/rownum.result
+++ b/mysql-test/main/rownum.result
@@ -139,6 +139,13 @@ select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a;
a b a b
2 20 2 21
3 30 3 31
+create view v1 as
+select * from (select * from t1 order by a desc) as t where rownum() <= 2;
+select * from v1;
+a b
+3 30
+2 20
+drop view v1;
#
# Having
#
@@ -984,3 +991,29 @@ next row is 3
3
next row is 5
5
+#
+# MDEV-31073: Server crash, assertion `table != 0 &&
+# view->field_translation != 0' failure with ROWNUM and view
+#
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v AS SELECT * FROM t;
+UPDATE v SET f = 10 WHERE ROWNUM() > 42 LIMIT 1;
+DROP VIEW v;
+DROP TABLE t;
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v AS SELECT f, 3 as e FROM t;
+UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
+DROP VIEW v;
+DROP TABLE t;
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v AS SELECT f, ROWNUM() as e FROM t;
+UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
+ERROR HY000: The target table v of the UPDATE is not updatable
+DROP VIEW v;
+DROP TABLE t;
+#
+# End of 10.6 tests
+#
diff --git a/mysql-test/main/rownum.test b/mysql-test/main/rownum.test
index bdd0bfa4f41..291bd9bd993 100644
--- a/mysql-test/main/rownum.test
+++ b/mysql-test/main/rownum.test
@@ -58,6 +58,11 @@ select *,rownum() from t1,t2 order by t2.a desc, t1.a desc;
select * from (select * from t1 order by a desc) as t where rownum() <= 2;
select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a;
+create view v1 as
+select * from (select * from t1 order by a desc) as t where rownum() <= 2;
+select * from v1;
+drop view v1;
+
--echo #
--echo # Having
--echo #
@@ -568,3 +573,40 @@ drop table t1;
--echo # Table value constructors
--echo #
values ("first row"),("next row is 3"),(rownum()),("next row is 5"),(rownum());
+
+--echo #
+--echo # MDEV-31073: Server crash, assertion `table != 0 &&
+--echo # view->field_translation != 0' failure with ROWNUM and view
+--echo #
+
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v AS SELECT * FROM t;
+UPDATE v SET f = 10 WHERE ROWNUM() > 42 LIMIT 1;
+
+# Cleanup
+DROP VIEW v;
+DROP TABLE t;
+
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v AS SELECT f, 3 as e FROM t;
+UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
+
+# Cleanup
+DROP VIEW v;
+DROP TABLE t;
+
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v AS SELECT f, ROWNUM() as e FROM t;
+--error ER_NON_UPDATABLE_TABLE
+UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
+
+# Cleanup
+DROP VIEW v;
+DROP TABLE t;
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result
index 54c39d090d2..ad8d733a163 100644
--- a/mysql-test/main/selectivity.result
+++ b/mysql-test/main/selectivity.result
@@ -834,7 +834,7 @@ flush table t1;
set optimizer_use_condition_selectivity=4;
explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1;
@@ -1977,11 +1977,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+DROP TABLE t1;
+# End of 10.2 tests
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
-DROP TABLE t1;
-# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size;
#
# MDEV-20595
diff --git a/mysql-test/main/selectivity.test b/mysql-test/main/selectivity.test
index 6957773fc8e..c96fb864408 100644
--- a/mysql-test/main/selectivity.test
+++ b/mysql-test/main/selectivity.test
@@ -1331,17 +1331,18 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
-set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
-set histogram_size=@save_histogram_size;
-set use_stat_tables= @save_use_stat_tables;
DROP TABLE t1;
--echo # End of 10.2 tests
+
#
# Clean up
#
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
--source include/restore_charset.inc
set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index 03e5079eff0..99723013eaa 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -840,7 +840,7 @@ flush table t1;
set optimizer_use_condition_selectivity=4;
explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1;
@@ -1984,11 +1984,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+DROP TABLE t1;
+# End of 10.2 tests
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
-DROP TABLE t1;
-# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size;
#
# MDEV-20595
diff --git a/mysql-test/main/selectivity_innodb_notembedded.result b/mysql-test/main/selectivity_innodb_notembedded.result
new file mode 100644
index 00000000000..8b06fe7556b
--- /dev/null
+++ b/mysql-test/main/selectivity_innodb_notembedded.result
@@ -0,0 +1,104 @@
+SET SESSION STORAGE_ENGINE='InnoDB';
+Warnings:
+Warning 1287 '@@storage_engine' is deprecated and will be removed in a future release. Please use '@@default_storage_engine' instead
+set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
+set optimizer_switch='extended_keys=on';
+drop table if exists t0,t1,t2,t3;
+select @@global.use_stat_tables;
+@@global.use_stat_tables
+COMPLEMENTARY
+select @@session.use_stat_tables;
+@@session.use_stat_tables
+COMPLEMENTARY
+set @save_use_stat_tables=@@use_stat_tables;
+set use_stat_tables='preferably';
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @save_histogram_size=@@histogram_size;
+set @save_histogram_type=@@histogram_type;
+set join_cache_level=2;
+set @@global.histogram_size=0,@@local.histogram_size=0;
+set histogram_type='single_prec_hb';
+set optimizer_use_condition_selectivity=3;
+#
+# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
+#
+create table t0(a int);
+insert into t0 select 1 from seq_1_to_78;
+create table t1(a int);
+insert into t1 select 1 from seq_1_to_26;
+create table t10 (a int);
+insert into t10 select 0 from t0, seq_1_to_4;
+insert into t10 select 8693 from t1;
+insert into t10 select 8694 from t1;
+insert into t10 select 8695 from t1;
+insert into t10 select 34783 from t1;
+insert into t10 select 34784 from t1;
+insert into t10 select 34785 from t1;
+insert into t10 select 34785 from t0, seq_1_to_8;
+insert into t10 select 65214 from t1;
+insert into t10 select 65215 from t1;
+insert into t10 select 65216 from t1;
+insert into t10 select 65216 from t0, seq_1_to_52;
+insert into t10 select 65217 from t1;
+insert into t10 select 65218 from t1;
+insert into t10 select 65219 from t1;
+insert into t10 select 65219 from t0;
+insert into t10 select 73913 from t1;
+insert into t10 select 73914 from t1;
+insert into t10 select 73915 from t1;
+insert into t10 select 73915 from t0, seq_1_to_40;
+insert into t10 select 78257 from t1;
+insert into t10 select 78258 from t1;
+insert into t10 select 78259 from t1;
+insert into t10 select 91300 from t1;
+insert into t10 select 91301 from t1;
+insert into t10 select 91302 from t1;
+insert into t10 select 91302 from t0, seq_1_to_6;
+insert into t10 select 91303 from t1;
+insert into t10 select 91304 from t1;
+insert into t10 select 91305 from t1;
+insert into t10 select 91305 from t0, seq_1_to_8;
+insert into t10 select 99998 from t1;
+insert into t10 select 99999 from t1;
+insert into t10 select 100000 from t1;
+set use_stat_tables=preferably;
+analyze table t10 persistent for all;
+Table Op Msg_type Msg_text
+test.t10 analyze status Engine-independent statistics collected
+test.t10 analyze status OK
+flush tables;
+set @tmp=@@optimizer_trace;
+set optimizer_trace=1;
+explain select * from t10 where a in (91303);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where
+# Must have selectivity_from_histogram <= 1.0:
+select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
+from information_schema.optimizer_trace;
+sel
+[
+ [
+ {
+ "column_name": "a",
+ "ranges":
+ ["91303 <= a <= 91303"],
+ "selectivity_from_histogram": 0.035714283
+ }
+ ]
+]
+set optimizer_trace=@tmp;
+drop table t0,t1,t10;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+#
+# End of 10.4 tests
+#
+#
+# Clean up
+#
+set @@global.histogram_size=@save_histogram_size;
+set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
+SET SESSION STORAGE_ENGINE=DEFAULT;
+Warnings:
+Warning 1287 '@@storage_engine' is deprecated and will be removed in a future release. Please use '@@default_storage_engine' instead
diff --git a/mysql-test/main/selectivity_innodb_notembedded.test b/mysql-test/main/selectivity_innodb_notembedded.test
new file mode 100644
index 00000000000..387f7dcb7de
--- /dev/null
+++ b/mysql-test/main/selectivity_innodb_notembedded.test
@@ -0,0 +1,16 @@
+--source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
+--source include/default_optimizer_switch.inc
+--source include/not_embedded.inc
+
+SET SESSION STORAGE_ENGINE='InnoDB';
+
+set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
+set optimizer_switch='extended_keys=on';
+
+--source selectivity_notembedded.test
+
+set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
+
+SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/main/selectivity_no_engine.result b/mysql-test/main/selectivity_no_engine.result
index 5df1c61e758..3f23b579b23 100644
--- a/mysql-test/main/selectivity_no_engine.result
+++ b/mysql-test/main/selectivity_no_engine.result
@@ -36,12 +36,12 @@ test.t2 analyze status OK
# The following two must have the same in 'Extra' column:
explain extended select * from t2 where col1 IN (20, 180);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180)
explain extended select * from t2 where col1 IN (180, 20);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where
Warnings:
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20)
drop table t1, t2;
@@ -102,7 +102,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
explain extended select * from t1 where col1 in (1,2,3);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 2.97 Using where
Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3)
# Must not cause fp division by zero, or produce nonsense numbers:
@@ -333,6 +333,29 @@ SELECT * FROM t1 JOIN t2 ON t1.a = t2.c WHERE t2.b IN ('o') OR t2.e >= 'f' OR t2
a b c d e
set join_cache_level=@tmp_jcl;
drop table t1,t2;
+#
+# MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
+#
+CREATE TABLE t1 (a VARCHAR(255));
+INSERT INTO t1 VALUES ('u'),('uu');
+CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4;
+INSERT INTO t2 VALUES ('x'),('xx');
+CREATE TABLE t3 (c VARCHAR(255));
+INSERT INTO t3 VALUES ('z'),('zz');
+ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze status OK
+set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level;
+set optimizer_switch='hash_join_cardinality=on', join_cache_level=3;
+SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a;
+a
+set optimizer_switch=@tmp1, join_cache_level=@tmp2;
+DROP TABLE t1, t2, t3;
#
# End of the test file
#
diff --git a/mysql-test/main/selectivity_no_engine.test b/mysql-test/main/selectivity_no_engine.test
index 8596fce9bf2..4d050513015 100644
--- a/mysql-test/main/selectivity_no_engine.test
+++ b/mysql-test/main/selectivity_no_engine.test
@@ -271,6 +271,27 @@ SELECT * FROM t1 JOIN t2 ON t1.a = t2.c WHERE t2.b IN ('o') OR t2.e >= 'f' OR t2
set join_cache_level=@tmp_jcl;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
+--echo #
+CREATE TABLE t1 (a VARCHAR(255));
+INSERT INTO t1 VALUES ('u'),('uu');
+
+CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4;
+INSERT INTO t2 VALUES ('x'),('xx');
+
+CREATE TABLE t3 (c VARCHAR(255));
+INSERT INTO t3 VALUES ('z'),('zz');
+
+ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL; # Optional, fails either way
+
+set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level;
+set optimizer_switch='hash_join_cardinality=on', join_cache_level=3;
+SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a;
+set optimizer_switch=@tmp1, join_cache_level=@tmp2;
+DROP TABLE t1, t2, t3;
+
--echo #
--echo # End of the test file
--echo #
diff --git a/mysql-test/main/selectivity_notembedded.result b/mysql-test/main/selectivity_notembedded.result
new file mode 100644
index 00000000000..d2e90a19a68
--- /dev/null
+++ b/mysql-test/main/selectivity_notembedded.result
@@ -0,0 +1,95 @@
+drop table if exists t0,t1,t2,t3;
+select @@global.use_stat_tables;
+@@global.use_stat_tables
+COMPLEMENTARY
+select @@session.use_stat_tables;
+@@session.use_stat_tables
+COMPLEMENTARY
+set @save_use_stat_tables=@@use_stat_tables;
+set use_stat_tables='preferably';
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @save_histogram_size=@@histogram_size;
+set @save_histogram_type=@@histogram_type;
+set join_cache_level=2;
+set @@global.histogram_size=0,@@local.histogram_size=0;
+set histogram_type='single_prec_hb';
+set optimizer_use_condition_selectivity=3;
+#
+# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
+#
+create table t0(a int);
+insert into t0 select 1 from seq_1_to_78;
+create table t1(a int);
+insert into t1 select 1 from seq_1_to_26;
+create table t10 (a int);
+insert into t10 select 0 from t0, seq_1_to_4;
+insert into t10 select 8693 from t1;
+insert into t10 select 8694 from t1;
+insert into t10 select 8695 from t1;
+insert into t10 select 34783 from t1;
+insert into t10 select 34784 from t1;
+insert into t10 select 34785 from t1;
+insert into t10 select 34785 from t0, seq_1_to_8;
+insert into t10 select 65214 from t1;
+insert into t10 select 65215 from t1;
+insert into t10 select 65216 from t1;
+insert into t10 select 65216 from t0, seq_1_to_52;
+insert into t10 select 65217 from t1;
+insert into t10 select 65218 from t1;
+insert into t10 select 65219 from t1;
+insert into t10 select 65219 from t0;
+insert into t10 select 73913 from t1;
+insert into t10 select 73914 from t1;
+insert into t10 select 73915 from t1;
+insert into t10 select 73915 from t0, seq_1_to_40;
+insert into t10 select 78257 from t1;
+insert into t10 select 78258 from t1;
+insert into t10 select 78259 from t1;
+insert into t10 select 91300 from t1;
+insert into t10 select 91301 from t1;
+insert into t10 select 91302 from t1;
+insert into t10 select 91302 from t0, seq_1_to_6;
+insert into t10 select 91303 from t1;
+insert into t10 select 91304 from t1;
+insert into t10 select 91305 from t1;
+insert into t10 select 91305 from t0, seq_1_to_8;
+insert into t10 select 99998 from t1;
+insert into t10 select 99999 from t1;
+insert into t10 select 100000 from t1;
+set use_stat_tables=preferably;
+analyze table t10 persistent for all;
+Table Op Msg_type Msg_text
+test.t10 analyze status Engine-independent statistics collected
+test.t10 analyze status OK
+flush tables;
+set @tmp=@@optimizer_trace;
+set optimizer_trace=1;
+explain select * from t10 where a in (91303);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where
+# Must have selectivity_from_histogram <= 1.0:
+select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
+from information_schema.optimizer_trace;
+sel
+[
+ [
+ {
+ "column_name": "a",
+ "ranges":
+ ["91303 <= a <= 91303"],
+ "selectivity_from_histogram": 0.035714283
+ }
+ ]
+]
+set optimizer_trace=@tmp;
+drop table t0,t1,t10;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+#
+# End of 10.4 tests
+#
+#
+# Clean up
+#
+set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test
new file mode 100644
index 00000000000..6752bd3c7e1
--- /dev/null
+++ b/mysql-test/main/selectivity_notembedded.test
@@ -0,0 +1,121 @@
+--source include/no_valgrind_without_big.inc
+--source include/have_stat_tables.inc
+--source include/have_sequence.inc
+--source include/default_charset.inc
+--source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t0,t1,t2,t3;
+--enable_warnings
+
+select @@global.use_stat_tables;
+select @@session.use_stat_tables;
+
+set @save_use_stat_tables=@@use_stat_tables;
+set use_stat_tables='preferably';
+
+--source include/default_optimizer_switch.inc
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @save_histogram_size=@@histogram_size;
+set @save_histogram_type=@@histogram_type;
+set join_cache_level=2;
+set @@global.histogram_size=0,@@local.histogram_size=0;
+set histogram_type='single_prec_hb';
+
+# check that statistics on nulls is used
+
+set optimizer_use_condition_selectivity=3;
+
+--echo #
+--echo # MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
+--echo #
+create table t0(a int); # This holds how many rows we hold in a bucket.
+insert into t0 select 1 from seq_1_to_78;
+
+create table t1(a int); # one-third of a bucket
+insert into t1 select 1 from seq_1_to_26;
+
+create table t10 (a int);
+insert into t10 select 0 from t0, seq_1_to_4;
+
+insert into t10 select 8693 from t1;
+insert into t10 select 8694 from t1;
+insert into t10 select 8695 from t1;
+
+
+insert into t10 select 34783 from t1;
+insert into t10 select 34784 from t1;
+insert into t10 select 34785 from t1;
+
+
+insert into t10 select 34785 from t0, seq_1_to_8;
+
+insert into t10 select 65214 from t1;
+insert into t10 select 65215 from t1;
+insert into t10 select 65216 from t1;
+
+insert into t10 select 65216 from t0, seq_1_to_52;
+
+insert into t10 select 65217 from t1;
+insert into t10 select 65218 from t1;
+insert into t10 select 65219 from t1;
+
+insert into t10 select 65219 from t0;
+
+
+insert into t10 select 73913 from t1;
+insert into t10 select 73914 from t1;
+insert into t10 select 73915 from t1;
+
+insert into t10 select 73915 from t0, seq_1_to_40;
+
+
+insert into t10 select 78257 from t1;
+insert into t10 select 78258 from t1;
+insert into t10 select 78259 from t1;
+
+insert into t10 select 91300 from t1;
+insert into t10 select 91301 from t1;
+insert into t10 select 91302 from t1;
+
+insert into t10 select 91302 from t0, seq_1_to_6;
+
+insert into t10 select 91303 from t1; # Only 1/3rd of bucket matches the search tuple
+insert into t10 select 91304 from t1;
+insert into t10 select 91305 from t1;
+
+insert into t10 select 91305 from t0, seq_1_to_8;
+
+insert into t10 select 99998 from t1;
+insert into t10 select 99999 from t1;
+insert into t10 select 100000 from t1;
+
+set use_stat_tables=preferably;
+analyze table t10 persistent for all;
+flush tables;
+
+set @tmp=@@optimizer_trace;
+set optimizer_trace=1;
+explain select * from t10 where a in (91303);
+
+--echo # Must have selectivity_from_histogram <= 1.0:
+select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
+from information_schema.optimizer_trace;
+
+set optimizer_trace=@tmp;
+drop table t0,t1,t10;
+
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
+
+--echo #
+--echo # Clean up
+--echo #
+--source include/restore_charset.inc
+set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/main/shutdown.test b/mysql-test/main/shutdown.test
index 13b7ac3f672..71f2156a17f 100644
--- a/mysql-test/main/shutdown.test
+++ b/mysql-test/main/shutdown.test
@@ -18,8 +18,8 @@ disconnect c1;
create procedure try_shutdown() shutdown;
drop procedure try_shutdown;
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--send shutdown
diff --git a/mysql-test/main/skr.result b/mysql-test/main/skr.result
deleted file mode 100644
index 291377573bc..00000000000
--- a/mysql-test/main/skr.result
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# MDEV-23406: query with mutually recursive CTEs when big_tables=1
-#
-set @save_big_tables=@@big_tables;
-set big_tables=1;
-Warnings:
-Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
-create table folks(id int, name char(32), dob date, father int, mother int);
-insert into folks values
-(100, 'Me', '2000-01-01', 20, 30),
-(20, 'Dad', '1970-02-02', 10, 9),
-(30, 'Mom', '1975-03-03', 8, 7),
-(10, 'Grandpa Bill', '1940-04-05', null, null),
-(9, 'Grandma Ann', '1941-10-15', null, null),
-(25, 'Uncle Jim', '1968-11-18', 8, 7),
-(98, 'Sister Amy', '2001-06-20', 20, 30),
-(7, 'Grandma Sally', '1943-08-23', null, 6),
-(8, 'Grandpa Ben', '1940-10-21', null, null),
-(6, 'Grandgrandma Martha', '1923-05-17', null, null),
-(67, 'Cousin Eddie', '1992-02-28', 25, 27),
-(27, 'Auntie Melinda', '1971-03-29', null, null);
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
-w_id, w_name, w_dob, w_father, w_mother)
-as
-(
-select h.*, w.*
-from folks h, folks w, coupled_ancestors a
-where a.father = h.id AND a.mother = w.id
-union
-select h.*, w.*
-from folks v, folks h, folks w
-where v.name = 'Me' and
-(v.father = h.id AND v.mother= w.id)
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
-select h_id, h_name, h_dob, h_father, h_mother
-from ancestor_couples
-union
-select w_id, w_name, w_dob, w_father, w_mother
-from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
-from ancestor_couples;
-h_name h_dob w_name w_dob
-Dad 1970-02-02 Mom 1975-03-03
-Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
-Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
-drop table folks;
-set big_tables=@save_big_tables;
-Warnings:
-Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
diff --git a/mysql-test/main/skr.test b/mysql-test/main/skr.test
deleted file mode 100644
index 3094faff696..00000000000
--- a/mysql-test/main/skr.test
+++ /dev/null
@@ -1,56 +0,0 @@
---source include/default_optimizer_switch.inc
-
---echo #
---echo # MDEV-23406: query with mutually recursive CTEs when big_tables=1
---echo #
-
-set @save_big_tables=@@big_tables;
-set big_tables=1;
-
-create table folks(id int, name char(32), dob date, father int, mother int);
-
-insert into folks values
-(100, 'Me', '2000-01-01', 20, 30),
-(20, 'Dad', '1970-02-02', 10, 9),
-(30, 'Mom', '1975-03-03', 8, 7),
-(10, 'Grandpa Bill', '1940-04-05', null, null),
-(9, 'Grandma Ann', '1941-10-15', null, null),
-(25, 'Uncle Jim', '1968-11-18', 8, 7),
-(98, 'Sister Amy', '2001-06-20', 20, 30),
-(7, 'Grandma Sally', '1943-08-23', null, 6),
-(8, 'Grandpa Ben', '1940-10-21', null, null),
-(6, 'Grandgrandma Martha', '1923-05-17', null, null),
-(67, 'Cousin Eddie', '1992-02-28', 25, 27),
-(27, 'Auntie Melinda', '1971-03-29', null, null);
-
-let q=
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
- w_id, w_name, w_dob, w_father, w_mother)
-as
-(
- select h.*, w.*
- from folks h, folks w, coupled_ancestors a
- where a.father = h.id AND a.mother = w.id
- union
- select h.*, w.*
- from folks v, folks h, folks w
- where v.name = 'Me' and
- (v.father = h.id AND v.mother= w.id)
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select h_id, h_name, h_dob, h_father, h_mother
- from ancestor_couples
- union
- select w_id, w_name, w_dob, w_father, w_mother
- from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
- from ancestor_couples;
-
-eval $q;
-drop table folks;
-
-set big_tables=@save_big_tables;
diff --git a/mysql-test/main/sql_mode_pad_char_to_full_length.result b/mysql-test/main/sql_mode_pad_char_to_full_length.result
new file mode 100644
index 00000000000..6f68aade613
--- /dev/null
+++ b/mysql-test/main/sql_mode_pad_char_to_full_length.result
@@ -0,0 +1,94 @@
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+#
+SET default_storage_engine=MyISAM;
+#
+# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+#
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+SET sql_mode='';
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+SET sql_mode='pad_char_to_full_length';
+INSERT INTO t1 VALUES (0,0);
+DELETE FROM t1;
+DROP TABLE t1;
+SET sql_mode='';
+CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+SET default_storage_engine=MEMORY;
+#
+# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+#
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+SET sql_mode='';
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+SET sql_mode='pad_char_to_full_length';
+INSERT INTO t1 VALUES (0,0);
+DELETE FROM t1;
+DROP TABLE t1;
+SET sql_mode='';
+CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+SET default_storage_engine=DEFAULT;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/sql_mode_pad_char_to_full_length.test b/mysql-test/main/sql_mode_pad_char_to_full_length.test
new file mode 100644
index 00000000000..4d492bc1b70
--- /dev/null
+++ b/mysql-test/main/sql_mode_pad_char_to_full_length.test
@@ -0,0 +1,19 @@
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+--echo #
+
+SET default_storage_engine=MyISAM;
+--source include/sql_mode_pad_char_to_full_length.inc
+
+SET default_storage_engine=MEMORY;
+--source include/sql_mode_pad_char_to_full_length.inc
+
+SET default_storage_engine=DEFAULT;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result
index 0669bdf3b34..9a4dd7c9302 100644
--- a/mysql-test/main/status.result
+++ b/mysql-test/main/status.result
@@ -447,3 +447,22 @@ Feature_json 2
connection default;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
+#
+# MDEV-30543 New status variable: Max_used_connections_time
+#
+FLUSH STATUS;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+disconnect con2;
+SELECT 'DTVALUE' = 'DTVALUE' AS expect_1;
+expect_1
+1
+connect con3,localhost,root,,;
+connect con4,localhost,root,,;
+SELECT 'DTVALUE' < 'DTVALUE' as expect_1;
+expect_1
+1
+disconnect con4;
+disconnect con3;
+disconnect con1;
diff --git a/mysql-test/main/status.test b/mysql-test/main/status.test
index 78626615d45..acf29f35b9e 100644
--- a/mysql-test/main/status.test
+++ b/mysql-test/main/status.test
@@ -280,7 +280,6 @@ show status like 'Com%function';
#
connect (root, localhost, root,,test);
connection root;
-let $root_connection_id= `select connection_id()`;
--disable_warnings
create database db37908;
--enable_warnings
@@ -296,7 +295,6 @@ delimiter ;|
connect (user1,localhost,mysqltest_1,,test);
connection user1;
-let $user1_connection_id= `select connection_id()`;
--error ER_TABLEACCESS_DENIED_ERROR
select * from db37908.t1;
@@ -315,11 +313,8 @@ drop procedure proc37908;
drop function func37908;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
DROP USER mysqltest_1@localhost;
-# Wait till the sessions user1 and root are disconnected
-let $wait_condition =
- SELECT COUNT(*) = 0
- FROM information_schema.processlist
- WHERE id in ('$root_connection_id','$user1_connection_id');
+# Wait until all non-default sessions are disconnected
+let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.processlist;
--source include/wait_condition.inc
#
@@ -447,3 +442,34 @@ SET GLOBAL log_output = @old_log_output;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
+--echo #
+--echo # MDEV-30543 New status variable: Max_used_connections_time
+--echo #
+
+FLUSH STATUS;
+
+connect (con1,localhost,root,,);
+--sleep 1
+connect (con2,localhost,root,,);
+--sleep 1
+let $time_1=`SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections_time'`;
+--sleep 1
+connection con1;
+disconnect con2;
+--sleep 1
+let $time_2=`SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections_time'`;
+--replace_regex /[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*/DTVALUE/
+eval SELECT '$time_1' = '$time_2' AS expect_1;
+--sleep 1
+connect (con3,localhost,root,,);
+--sleep 1
+connect (con4,localhost,root,,);
+--sleep 1
+let $time_3=`SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections_time'`;
+--replace_regex /[0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*/DTVALUE/
+eval SELECT '$time_1' < '$time_3' as expect_1;
+
+disconnect con4;
+disconnect con3;
+disconnect con1;
+
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index e0cf1e61d95..6e0c956b77e 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -118,27 +118,27 @@ ROW(1,2,3) > (SELECT 1,2,1)
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
ROW(1,2,3) = (SELECT 1,2,NULL)
NULL
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+m
1
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+m
0
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+m
1
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'c'
@@ -228,19 +228,26 @@ a
2
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
a
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+b m
8 7.5000
8 4.5000
9 7.5000
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -307,21 +314,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w
b ma
7 12
create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
@@ -330,7 +350,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -486,8 +506,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 1
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
@@ -505,8 +528,11 @@ joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
mot topic date pseudo
joce 40143 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 0
drop table t1,t2;
@@ -890,6 +916,25 @@ NULL
select 1.5 > ANY (SELECT * from t1);
1.5 > ANY (SELECT * from t1)
NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
@@ -900,6 +945,20 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -1547,8 +1606,8 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
+a m
3 1
2 2
1 2
@@ -1746,8 +1805,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name m
-1 Valid 1
-1 Valid 2 1
-1 Should Not Return 0
@@ -3809,9 +3868,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
2
1
1
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+m
2
1
1
@@ -3821,9 +3881,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
1 1
1 1
SELECT COUNT(DISTINCT t1.b),
-(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+COUNT(DISTINCT t1.b) m
2 2
1 1
1 1
@@ -3847,16 +3907,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
-FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
-(
-SELECT (
-SELECT (
-SELECT COUNT(DISTINCT t1.b)
-)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+m
2
2
2
@@ -6453,11 +6507,10 @@ CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
-SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+SUM(DISTINCT b) m
7 NULL
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -6590,66 +6643,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2);
INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
set @@session.optimizer_switch=@old_optimizer_switch;
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
select (null, null) = (null, null);
(null, null) = (null, null)
@@ -6695,8 +6775,10 @@ INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+SELECT
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
+m
1
NULL
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -6913,7 +6995,9 @@ CREATE TABLE t3 (c INT);
INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6923,9 +7007,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
@@ -6951,7 +7037,9 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 22
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6961,9 +7049,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test
index 578dbe86406..089eb10b6f0 100644
--- a/mysql-test/main/subselect.test
+++ b/mysql-test/main/subselect.test
@@ -79,13 +79,13 @@ SELECT ROW(1,2,3) > (SELECT 1,2,1);
#enable after fix MDEV-28585
--disable_view_protocol
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
--enable_view_protocol
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
-- error ER_OPERAND_COLUMNS
SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
@@ -123,11 +123,15 @@ set optimizer_switch=@tmp_optimizer_switch;
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
-#enable afte fix MDEV-27871
---disable_view_protocol
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
---enable_view_protocol
+select
+ b,
+ (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+explain extended
+select
+ b,
+ (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
select * from t3 where exists (select * from t2 where t2.b=t3.a);
select * from t3 where not exists (select * from t2 where t2.b=t3.a);
select * from t3 where a in (select b from t2);
@@ -160,16 +164,25 @@ delete from t2 where a=2 and b=10;
select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b);
create table t5 (a int);
-#enable afte fix MDEV-27871
---disable_view_protocol
-
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+select
+ (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+ a
+from t2;
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+select
+ (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+ a
+from t2;
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
---enable_view_protocol
+select
+ (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+ a
+from t2;
+explain extended
+select
+ (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+ a
+from t2;
-- error ER_SUBQUERY_NO_1_ROW
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
@@ -274,19 +287,19 @@ SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING t
SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic);
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
-#enable after fix MDEV-27871
---disable_view_protocol
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
---enable_view_protocol
+SELECT
+ *,
+ topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
-#enable after fix MDEV-27871
---disable_view_protocol
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
---enable_view_protocol
+SELECT
+ *,
+ topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
drop table t1,t2;
#forumconthardwarefr7
@@ -535,13 +548,22 @@ select 10.5 IN (SELECT * from t1);
select 1.5 > ALL (SELECT * from t1);
select 10.5 > ALL (SELECT * from t1);
select 1.5 > ANY (SELECT * from t1);
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+select 3.5 IN (SELECT * from t1);
+select 10.5 IN (SELECT * from t1);
+select 1.5 > ALL (SELECT * from t1);
+select 10.5 > ALL (SELECT * from t1);
+select 1.5 > ANY (SELECT * from t1);
select 10.5 > ANY (SELECT * from t1);
--enable_prepare_warnings
+--enable_view_protocol
+explain extended select (select a+1) from t1;
+explain extended select (select a+1) from t1;
explain extended select (select a+1) from t1;
--disable_prepare_warnings
select (select a+1) from t1;
drop table t1;
---enable_view_protocol
--echo #
--echo # Null with keys
@@ -961,10 +983,7 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-#enable after fix MDEV-27871
---disable_view_protocol
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
---enable_view_protocol
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
drop table t1,t2,t3;
#
@@ -1083,10 +1102,7 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-#enable after fix MDEV-27871
---disable_view_protocol
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
---enable_view_protocol
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid;
drop table t1,t2,t3,t4;
@@ -2406,9 +2422,6 @@ SELECT a, MAX(b), MIN(b) FROM t1 GROUP BY a;
SELECT * FROM t2;
SELECT * FROM t3;
-#enable after fix MDEV-28570
---disable_view_protocol
-
SELECT a FROM t1 GROUP BY a
HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
SELECT a FROM t1 GROUP BY a
@@ -2473,8 +2486,6 @@ SELECT t1.a, SUM(b) AS sum FROM t1 GROUP BY t1.a
HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
HAVING t2.c+sum > 20);
---enable_view_protocol
-
DROP TABLE t1,t2,t3;
@@ -2705,19 +2716,17 @@ DROP TABLE t1;
# Bug#21540 Subqueries with no from and aggregate functions return
# wrong results
-#enable after fix MDEV-27871, MDEV-28573
---disable_view_protocol
-
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT);
INSERT INTO t2 values (1);
INSERT INTO t1 VALUES (1,1),(1,2),(2,3),(3,4);
SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+ (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
SELECT COUNT(DISTINCT t1.b), (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
SELECT COUNT(DISTINCT t1.b),
- (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+ (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
SELECT (
SELECT (
@@ -2731,11 +2740,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
- FROM t1 GROUP BY t1.a LIMIT 1)
+ FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
DROP TABLE t1,t2;
---enable_view_protocol
#
# Bug#21727 Correlated subquery that requires filesort:
@@ -2970,8 +2978,6 @@ DROP TABLE t1,t2;
# Bug#27229 GROUP_CONCAT in subselect with COUNT() as an argument
#
-#enable after fix MDEV-28571
---disable_view_protocol
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (m int, n int);
INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
@@ -2986,7 +2992,6 @@ SELECT COUNT(*) c, a,
FROM t1 GROUP BY a;
DROP table t1,t2;
---enable_view_protocol
#
# Bug#27321 Wrong subquery result in a grouping select
@@ -3017,14 +3022,11 @@ SELECT tt.a,
FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
FROM t1 as tt GROUP BY tt.a;
-#enable after fix MDEV-28571
---disable_view_protocol
SELECT tt.a, MAX(
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
LIMIT 1)
FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
FROM t1 as tt GROUP BY tt.a;
---enable_view_protocol
DROP TABLE t1;
@@ -3180,8 +3182,6 @@ CREATE TABLE t2 (x INTEGER);
INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
INSERT INTO t2 VALUES (1), (2);
-#enable after fix MDEV-28573
---disable_view_protocol
# wasn't failing, but should
--error ER_SUBQUERY_NO_1_ROW
SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a;
@@ -3191,7 +3191,6 @@ SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a;
SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a;
SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1;
---enable_view_protocol
DROP TABLE t1,t2;
@@ -3206,8 +3205,6 @@ GROUP BY a1.a;
DROP TABLE t1;
#test cases from 29297
-#enable after fix MDEV-28573
---disable_view_protocol
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (1),(2);
@@ -3217,7 +3214,6 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1;
SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1;
DROP TABLE t1,t2;
---enable_view_protocol
#
# Bug#31884 Assertion + crash in subquery in the SELECT clause.
@@ -5420,14 +5416,11 @@ INSERT INTO t2 VALUES (10,7,0), (0,7,0);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
-#enable after fix MDEV-27871
---disable_view_protocol
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
- WHERE t.a != 0 AND t2.a != 0)
+ WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
---enable_view_protocol
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -5585,29 +5578,53 @@ INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-#enable after fix MDEV-27871
---disable_view_protocol
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
+SELECT
+ (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+ FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+SELECT
+ (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
set @@session.optimizer_switch=@old_optimizer_switch;
# check different IN with default switches
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
---enable_view_protocol
+SELECT
+ (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+SELECT
+ (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
+SELECT
+ (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+SELECT
+ (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
# other row operation with NULL single row subquery also should work
select (null, null) = (null, null);
@@ -5647,10 +5664,9 @@ INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-#enable after fix MDEV-27871
---disable_view_protocol
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
---enable_view_protocol
+SELECT
+ ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
# This query just for example, it should return the same as above (1 and NULL)
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -5839,15 +5855,17 @@ INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
-#enable after fix MDEV-27871
---disable_view_protocol
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+ (SELECT MIN(b) FROM t1, t2
+ WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+ (SELECT MIN(b) FROM t1, t2
+ WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
show status like "subquery_cache%";
@@ -5856,17 +5874,20 @@ show status like '%Handler_read%';
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+ (SELECT MIN(b) FROM t1, t2
+ WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+ (SELECT MIN(b) FROM t1, t2
+ WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
show status like "subquery_cache%";
show status like '%Handler_read%';
---enable_view_protocol
drop table t1, t2, t3;
@@ -6120,22 +6141,16 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 int);
INSERT INTO t2 VALUES (3);
-#enable after fix MDEV-29224
---disable_view_protocol
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
---enable_view_protocol
INSERT INTO t2 VALUES (4);
-#enable after fix MDEV-28573
---disable_view_protocol
--error ER_SUBQUERY_NO_1_ROW
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
--error ER_SUBQUERY_NO_1_ROW
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
---enable_view_protocol
drop view v1;
drop table t1,t2;
diff --git a/mysql-test/main/subselect3_jcl6.result b/mysql-test/main/subselect3_jcl6.result
index acd1269d875..ca06d25db49 100644
--- a/mysql-test/main/subselect3_jcl6.result
+++ b/mysql-test/main/subselect3_jcl6.result
@@ -1170,11 +1170,11 @@ set @@optimizer_switch='firstmatch=off,materialization=off';
set @@max_heap_table_size= 16384;
explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY E ALL NULL NULL NULL NULL 5 Using where; Start temporary
-1 PRIMARY A ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+1 PRIMARY E ALL NULL NULL NULL NULL 5 Using where; Start temporary; Using join buffer (flat, BNL join)
+1 PRIMARY D hash_ALL NULL #hash#$hj 5 test.E.a 10 Using where; Using join buffer (incremental, BNLH join)
1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (incremental, BNL join)
-1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join)
-1 PRIMARY D hash_ALL NULL #hash#$hj 5 test.E.a 10 Using where; End temporary; Using join buffer (incremental, BNLH join)
+1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (incremental, BNL join)
flush status;
select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a);
count(*)
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 29e7e11f0ba..cef56e27d91 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -20,8 +20,8 @@ WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
ORDER BY count(*);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 5 NULL 2 Using index
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
-3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 Const row not found
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
# should not crash the next statement
SELECT 1 FROM t1
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index 3be4f07b8ca..3750c96871b 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -122,27 +122,27 @@ ROW(1,2,3) > (SELECT 1,2,1)
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
ROW(1,2,3) = (SELECT 1,2,NULL)
NULL
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+m
1
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+m
0
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+m
1
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'c'
@@ -232,19 +232,26 @@ a
2
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
a
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+b m
8 7.5000
8 4.5000
9 7.5000
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -311,21 +318,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w
b ma
7 12
create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
@@ -334,7 +354,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -490,8 +510,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 1
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
@@ -509,8 +532,11 @@ joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
mot topic date pseudo
joce 40143 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 0
drop table t1,t2;
@@ -894,6 +920,25 @@ NULL
select 1.5 > ANY (SELECT * from t1);
1.5 > ANY (SELECT * from t1)
NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
@@ -904,6 +949,20 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -1551,8 +1610,8 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
+a m
3 1
2 2
1 2
@@ -1750,8 +1809,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name m
-1 Valid 1
-1 Valid 2 1
-1 Should Not Return 0
@@ -3812,9 +3871,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
2
1
1
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+m
2
1
1
@@ -3824,9 +3884,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
1 1
1 1
SELECT COUNT(DISTINCT t1.b),
-(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+COUNT(DISTINCT t1.b) m
2 2
1 1
1 1
@@ -3850,16 +3910,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
-FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
-(
-SELECT (
-SELECT (
-SELECT COUNT(DISTINCT t1.b)
-)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+m
2
2
2
@@ -6455,11 +6509,10 @@ CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
-SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+SUM(DISTINCT b) m
7 NULL
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -6592,66 +6645,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2);
INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
set @@session.optimizer_switch=@old_optimizer_switch;
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
select (null, null) = (null, null);
(null, null) = (null, null)
@@ -6697,8 +6777,10 @@ INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+SELECT
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
+m
1
NULL
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -6915,7 +6997,9 @@ CREATE TABLE t3 (c INT);
INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6925,9 +7009,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
@@ -6953,7 +7039,9 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 22
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6963,9 +7051,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index a47e2977774..f837e20be8b 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -125,27 +125,27 @@ ROW(1,2,3) > (SELECT 1,2,1)
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
ROW(1,2,3) = (SELECT 1,2,NULL)
NULL
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+m
1
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+m
0
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+m
1
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'c'
@@ -235,19 +235,26 @@ a
2
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
a
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+b m
8 7.5000
8 4.5000
9 7.5000
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -314,21 +321,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w
b ma
7 12
create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
@@ -337,7 +357,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -493,8 +513,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 1
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
@@ -512,8 +535,11 @@ joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
mot topic date pseudo
joce 40143 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 0
drop table t1,t2;
@@ -897,6 +923,25 @@ NULL
select 1.5 > ANY (SELECT * from t1);
1.5 > ANY (SELECT * from t1)
NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
@@ -907,6 +952,20 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -1554,8 +1613,8 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
+a m
3 1
2 2
1 2
@@ -1753,8 +1812,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name m
-1 Valid 1
-1 Valid 2 1
-1 Should Not Return 0
@@ -3812,9 +3871,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
2
1
1
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+m
2
1
1
@@ -3824,9 +3884,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
1 1
1 1
SELECT COUNT(DISTINCT t1.b),
-(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+COUNT(DISTINCT t1.b) m
2 2
1 1
1 1
@@ -3850,16 +3910,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
-FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
-(
-SELECT (
-SELECT (
-SELECT COUNT(DISTINCT t1.b)
-)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+m
2
2
2
@@ -6452,11 +6506,10 @@ CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
-SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+SUM(DISTINCT b) m
7 NULL
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -6589,66 +6642,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2);
INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
set @@session.optimizer_switch=@old_optimizer_switch;
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
select (null, null) = (null, null);
(null, null) = (null, null)
@@ -6694,8 +6774,10 @@ INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+SELECT
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
+m
1
NULL
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -6911,7 +6993,9 @@ CREATE TABLE t3 (c INT);
INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6921,9 +7005,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
@@ -6949,7 +7035,9 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 22
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6959,9 +7047,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index 10153b0f60c..e2352090797 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -121,27 +121,27 @@ ROW(1,2,3) > (SELECT 1,2,1)
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
ROW(1,2,3) = (SELECT 1,2,NULL)
NULL
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+m
1
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+m
0
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+m
1
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'c'
@@ -231,19 +231,26 @@ a
2
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
a
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+b m
8 7.5000
8 4.5000
9 7.5000
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `m` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -310,21 +317,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w
b ma
7 12
create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
@@ -333,7 +353,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -489,8 +509,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 1
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
@@ -508,8 +531,11 @@ joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
mot topic date pseudo
joce 40143 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 0
drop table t1,t2;
@@ -893,6 +919,25 @@ NULL
select 1.5 > ANY (SELECT * from t1);
1.5 > ANY (SELECT * from t1)
NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
@@ -903,6 +948,20 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -1550,8 +1609,8 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
+a m
3 1
2 2
1 2
@@ -1749,8 +1808,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name m
-1 Valid 1
-1 Valid 2 1
-1 Should Not Return 0
@@ -3808,9 +3867,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
2
1
1
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+m
2
1
1
@@ -3820,9 +3880,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
1 1
1 1
SELECT COUNT(DISTINCT t1.b),
-(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+COUNT(DISTINCT t1.b) m
2 2
1 1
1 1
@@ -3846,16 +3906,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
-FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
-(
-SELECT (
-SELECT (
-SELECT COUNT(DISTINCT t1.b)
-)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+m
2
2
2
@@ -6448,11 +6502,10 @@ CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
-SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+SUM(DISTINCT b) m
7 NULL
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -6585,66 +6638,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2);
INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
set @@session.optimizer_switch=@old_optimizer_switch;
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
select (null, null) = (null, null);
(null, null) = (null, null)
@@ -6690,8 +6770,10 @@ INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+SELECT
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
+m
1
NULL
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -6908,7 +6990,9 @@ CREATE TABLE t3 (c INT);
INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6918,9 +7002,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
@@ -6946,7 +7032,9 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 22
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6956,9 +7044,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 456d1dec846..0e5216eb120 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -124,27 +124,27 @@ ROW(1,2,3) > (SELECT 1,2,1)
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
ROW(1,2,3) = (SELECT 1,2,NULL)
NULL
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+m
1
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+m
0
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+m
1
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'c'
@@ -234,19 +234,26 @@ a
2
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
a
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+b m
8 7.5000
8 4.5000
9 7.5000
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `m` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -313,21 +320,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w
b ma
7 12
create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
@@ -336,7 +356,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 /* select#1 */ select (/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -492,8 +512,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 1
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
@@ -511,8 +534,11 @@ joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
mot topic date pseudo
joce 40143 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 0
drop table t1,t2;
@@ -896,6 +922,25 @@ NULL
select 1.5 > ANY (SELECT * from t1);
1.5 > ANY (SELECT * from t1)
NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
@@ -906,6 +951,20 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -1553,8 +1612,8 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
+a m
3 1
2 2
1 2
@@ -1752,8 +1811,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name m
-1 Valid 1
-1 Valid 2 1
-1 Should Not Return 0
@@ -3815,9 +3874,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
2
1
1
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+m
2
1
1
@@ -3827,9 +3887,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
1 1
1 1
SELECT COUNT(DISTINCT t1.b),
-(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+COUNT(DISTINCT t1.b) m
2 2
1 1
1 1
@@ -3853,16 +3913,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
-FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
-(
-SELECT (
-SELECT (
-SELECT COUNT(DISTINCT t1.b)
-)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+m
2
2
2
@@ -6459,11 +6513,10 @@ CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
-SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+SUM(DISTINCT b) m
7 NULL
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -6596,66 +6649,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2);
INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
set @@session.optimizer_switch=@old_optimizer_switch;
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
select (null, null) = (null, null);
(null, null) = (null, null)
@@ -6701,8 +6781,10 @@ INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+SELECT
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
+m
1
NULL
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -6919,7 +7001,9 @@ CREATE TABLE t3 (c INT);
INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6929,9 +7013,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
@@ -6957,7 +7043,9 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 58
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6967,9 +7055,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index eba0f55a072..c7acdc2990c 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -121,27 +121,27 @@ ROW(1,2,3) > (SELECT 1,2,1)
SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
ROW(1,2,3) = (SELECT 1,2,NULL)
NULL
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m;
+m
1
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m;
+m
0
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a') AS m;
+m
1
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a') AS m;
+m
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'c'
@@ -231,19 +231,26 @@ a
2
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
a
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
+b m
8 7.5000
8 4.5000
9 7.5000
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain extended
+select
+b,
+(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) as m
+from t4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `m` from `test`.`t4`
select * from t3 where exists (select * from t2 where t2.b=t3.a);
a
7
@@ -310,21 +317,34 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 w
b ma
7 12
create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
+m a
NULL 1
2 2
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain extended
+select
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) as m,
+a
+from t2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
@@ -333,7 +353,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 /* select#1 */ select <expr_cache><`test`.`t2`.`a`>((/* select#2 */ select 2 from dual where 2 = `test`.`t2`.`a` union /* select#3 */ select `test`.`t5`.`a` from `test`.`t5` where `test`.`t5`.`a` = `test`.`t2`.`a`)) AS `m`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -489,8 +509,11 @@ SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING t
mot topic date pseudo
joce 40143 2002-10-22 joce
joce 43506 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 1
SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
@@ -508,8 +531,11 @@ joce 40143 2002-10-22 joce
SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
mot topic date pseudo
joce 40143 2002-10-22 joce
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+SELECT
+*,
+topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) AS m
+FROM t2;
+mot topic date pseudo m
joce 40143 2002-10-22 joce 1
joce 43506 2002-10-22 joce 0
drop table t1,t2;
@@ -893,6 +919,25 @@ NULL
select 1.5 > ANY (SELECT * from t1);
1.5 > ANY (SELECT * from t1)
NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
select 10.5 > ANY (SELECT * from t1);
10.5 > ANY (SELECT * from t1)
1
@@ -903,6 +948,20 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t1`.`a` + 1 AS `(select a+1)` from `test`.`t1`
select (select a+1) from t1;
(select a+1)
2.5
@@ -1550,8 +1609,8 @@ create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) as m from t3;
+a m
3 1
2 2
1 2
@@ -1749,8 +1808,8 @@ CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(1
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') as m FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') as m from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name m
-1 Valid 1
-1 Valid 2 1
-1 Should Not Return 0
@@ -3808,9 +3867,10 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
2
1
1
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+SELECT
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+m
2
1
1
@@ -3820,9 +3880,9 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
1 1
1 1
SELECT COUNT(DISTINCT t1.b),
-(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3) AS m
FROM t1 GROUP BY t1.a;
-COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+COUNT(DISTINCT t1.b) m
2 2
1 1
1 1
@@ -3846,16 +3906,10 @@ SELECT (
SELECT COUNT(DISTINCT t1.b)
)
)
-FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 GROUP BY t1.a LIMIT 1) AS m
FROM t1 t2
GROUP BY t2.a;
-(
-SELECT (
-SELECT (
-SELECT COUNT(DISTINCT t1.b)
-)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+m
2
2
2
@@ -6448,11 +6502,10 @@ CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (10,7), (0,7);
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+WHERE t.a != 0 AND t2.a != 0) AS m
FROM (SELECT * FROM t3) AS t
GROUP BY 2;
-SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
-WHERE t.a != 0 AND t2.a != 0)
+SUM(DISTINCT b) m
7 NULL
SELECT SUM(DISTINCT b),
(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
@@ -6585,66 +6638,93 @@ CREATE TABLE t3 (f3a int default 1, f3b int default 2);
INSERT INTO t3 VALUES (1,1),(2,2);
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
set @@session.optimizer_switch=@old_optimizer_switch;
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+SELECT
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2 AS m;
(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
NULL
NULL
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+SELECT
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m
+FROM t2;
+m
NULL
NULL
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+SELECT
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) AS m;
+m
NULL
select (null, null) = (null, null);
(null, null) = (null, null)
@@ -6690,8 +6770,10 @@ INSERT INTO t2 VALUES (1);
CREATE TABLE t3 ( c INT );
INSERT INTO t3 VALUES (4),(5);
SET optimizer_switch='subquery_cache=off';
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+SELECT
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) AS m
+FROM t1;
+m
1
NULL
SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
@@ -6908,7 +6990,9 @@ CREATE TABLE t3 (c INT);
INSERT INTO t3 VALUES (8),(3);
set @@expensive_subquery_limit= 0;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6918,9 +7002,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
@@ -6946,7 +7032,9 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 22
set @@expensive_subquery_limit= default;
EXPLAIN
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
@@ -6956,9 +7044,11 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
flush status;
-SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+SELECT
+(SELECT MIN(b) FROM t1, t2
+WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m
FROM t2 alias1, t1 alias2, t1 alias3;
-(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+m
NULL
NULL
NULL
diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test
index 3c046c6321c..b4aff7561cf 100644
--- a/mysql-test/main/subselect_sj.test
+++ b/mysql-test/main/subselect_sj.test
@@ -780,7 +780,13 @@ eval $query;
let $query=
SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
+#set optimizer_trace=1;
+#select @@optimizer_switch;
+#select @@join_cache_level;
+#select @@optimizer_use_condition_selectivity;
eval EXPLAIN EXTENDED $query;
+#select * from information_schema.optimizer_trace;
+
eval $query;
let $query=
diff --git a/mysql-test/main/subselect_sj2.result b/mysql-test/main/subselect_sj2.result
index fa10a4aa066..e2e44fd8e80 100644
--- a/mysql-test/main/subselect_sj2.result
+++ b/mysql-test/main/subselect_sj2.result
@@ -152,7 +152,7 @@ insert into t1 values (2, 'duplicate ok', 'duplicate ok');
insert into t1 values (18, 'duplicate ok', 'duplicate ok');
insert into t2 values (3, 'duplicate ok', 'duplicate ok');
insert into t2 values (19, 'duplicate ok', 'duplicate ok');
-explain select
+explain select
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
from t1 ot where a in (select a from t2 it);
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/subselect_sj2.test b/mysql-test/main/subselect_sj2.test
index 4ccdcc50a38..67c70d449d7 100644
--- a/mysql-test/main/subselect_sj2.test
+++ b/mysql-test/main/subselect_sj2.test
@@ -124,7 +124,7 @@ insert into t1 values (18, 'duplicate ok', 'duplicate ok');
insert into t2 values (3, 'duplicate ok', 'duplicate ok');
insert into t2 values (19, 'duplicate ok', 'duplicate ok');
-explain select
+explain select
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
from t1 ot where a in (select a from t2 it);
select
@@ -1248,6 +1248,7 @@ INSERT INTO t2 VALUES
analyze table t1 persistent for all;
analyze table t2 persistent for all;
--replace_column 9 #
+
EXPLAIN
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result
index 6ccec99ba5e..a5bcfbfa147 100644
--- a/mysql-test/main/subselect_sj2_jcl6.result
+++ b/mysql-test/main/subselect_sj2_jcl6.result
@@ -161,7 +161,7 @@ insert into t1 values (2, 'duplicate ok', 'duplicate ok');
insert into t1 values (18, 'duplicate ok', 'duplicate ok');
insert into t2 values (3, 'duplicate ok', 'duplicate ok');
insert into t2 values (19, 'duplicate ok', 'duplicate ok');
-explain select
+explain select
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
from t1 ot where a in (select a from t2 it);
id select_type table type possible_keys key key_len ref rows Extra
@@ -912,11 +912,10 @@ EXPLAIN
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
WHERE t3.b IN (SELECT b FROM t4);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 ALL NULL NULL NULL NULL 1
+1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where
1 PRIMARY t2 hash_ALL NULL #hash#$hj 4 test.t3.a 1 Using where; Using join buffer (flat, BNLH join)
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join)
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2
+1 PRIMARY t4 hash_ALL NULL #hash#$hj 4 test.t3.b 2 Using where; Start temporary; End temporary; Using join buffer (incremental, BNLH join)
3 DERIVED t1 ALL NULL NULL NULL NULL 1
SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
WHERE t3.b IN (SELECT b FROM t4);
@@ -1151,10 +1150,10 @@ WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where
-1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index
-1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3)
-1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join)
+1 PRIMARY alias4 index PRIMARY,c c 4 NULL # Using where; Using index; Start temporary
+1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using join buffer (flat, BKA join); Key-ordered scan
+1 PRIMARY alias3 hash_ALL PRIMARY #hash#$hj 4 test.alias4.c # Using where; End temporary; Using join buffer (incremental, BNLH join)
+1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join)
1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join)
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
@@ -1172,10 +1171,10 @@ WHERE alias5.b = alias4.b
AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where
-1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index
-1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3)
-1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join)
+1 PRIMARY alias4 index PRIMARY,c c 4 NULL # Using where; Using index; Start temporary
+1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using join buffer (flat, BKA join); Key-ordered scan
+1 PRIMARY alias3 hash_ALL PRIMARY #hash#$hj 4 test.alias4.c # Using where; End temporary; Using join buffer (incremental, BNLH join)
+1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join)
1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join)
SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
WHERE alias3.d IN (
diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result
index 5bc7751eeaa..acd600a734f 100644
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@ -154,7 +154,7 @@ insert into t1 values (2, 'duplicate ok', 'duplicate ok');
insert into t1 values (18, 'duplicate ok', 'duplicate ok');
insert into t2 values (3, 'duplicate ok', 'duplicate ok');
insert into t2 values (19, 'duplicate ok', 'duplicate ok');
-explain select
+explain select
a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
from t1 ot where a in (select a from t2 it);
id select_type table type possible_keys key key_len ref rows Extra
@@ -1661,7 +1661,7 @@ SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
-2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join)
+2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 10.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i1`>(<in_optimizer>(`test`.`t1`.`i1`,<exists>(/* select#2 */ select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and <cache>(`test`.`t1`.`i1`) = `test`.`t3`.`i3`)))
SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
@@ -1671,12 +1671,11 @@ set optimizer_switch='materialization=on,semijoin=on';
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
-2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary
+1 PRIMARY t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 10.00 Using where; Using join buffer (flat, BNLH join)
+1 PRIMARY t1 hash_ALL NULL #hash#$hj 5 test.t2.i2 5 10.00 Using where; End temporary; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2`
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`i1` = `test`.`t2`.`i2`
SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
i1
7
@@ -1684,12 +1683,11 @@ EXPLAIN EXTENDED
SELECT * FROM t1
WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
-2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
-2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary
+1 PRIMARY t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 10.00 Using where; Using join buffer (flat, BNLH join)
+1 PRIMARY t1 hash_ALL NULL #hash#$hj 5 test.t2.i2 5 10.00 Using where; End temporary; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t3`.`i3` > 0
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`i1` = `test`.`t2`.`i2` and `test`.`t3`.`i3` > 0
SELECT * FROM t1
WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
i1
diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result
index 5971fa30e89..6e397ddd754 100644
--- a/mysql-test/main/subselect_sj_jcl6.result
+++ b/mysql-test/main/subselect_sj_jcl6.result
@@ -3575,8 +3575,8 @@ SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
GROUP BY a HAVING a != 'z';
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t range idx_a idx_a 4 NULL 3 Using where; Using index
-1 PRIMARY t1 ref idx_a idx_a 4 test.t.a 1 Using index
-1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+1 PRIMARY t1 ref idx_a idx_a 4 test.t.a 1 Using index; FirstMatch(t)
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
GROUP BY a HAVING a != 'z';
a
diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result
index b99b8678b1a..a257c16b865 100644
--- a/mysql-test/main/system_mysql_db_fix50030.result
+++ b/mysql-test/main/system_mysql_db_fix50030.result
@@ -166,14 +166,14 @@ show create table servers;
Table Create Table
servers CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL DEFAULT '',
- `Host` char(64) NOT NULL DEFAULT '',
+ `Host` varchar(2048) NOT NULL DEFAULT '',
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0,
`Socket` char(64) NOT NULL DEFAULT '',
`Wrapper` char(64) NOT NULL DEFAULT '',
- `Owner` char(64) NOT NULL DEFAULT '',
+ `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table'
show create table proc;
diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result
index 8e48c2accb7..fde130839d4 100644
--- a/mysql-test/main/system_mysql_db_fix50117.result
+++ b/mysql-test/main/system_mysql_db_fix50117.result
@@ -146,14 +146,14 @@ show create table servers;
Table Create Table
servers CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL DEFAULT '',
- `Host` char(64) NOT NULL DEFAULT '',
+ `Host` varchar(2048) NOT NULL DEFAULT '',
`Db` char(64) NOT NULL DEFAULT '',
`Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0,
`Socket` char(64) NOT NULL DEFAULT '',
`Wrapper` char(64) NOT NULL DEFAULT '',
- `Owner` char(64) NOT NULL DEFAULT '',
+ `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`)
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table'
show create table proc;
diff --git a/mysql-test/main/system_mysql_db_fix50568.result b/mysql-test/main/system_mysql_db_fix50568.result
new file mode 100644
index 00000000000..763fcb866d0
--- /dev/null
+++ b/mysql-test/main/system_mysql_db_fix50568.result
@@ -0,0 +1,297 @@
+use test;
+CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) DEFAULT 0 NOT NULL, plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, authentication_string TEXT NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
+CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';
+CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
+CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url text not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url text not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
+CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
+CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+Warnings:
+Warning 1280 Name 'Name' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+Warnings:
+Warning 1280 Name 'TzId' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+Warnings:
+Warning 1280 Name 'TzIdTranTime' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, `Offset` int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+Warnings:
+Warning 1280 Name 'TzIdTrTId' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+Warnings:
+Warning 1280 Name 'TranTime' ignored for PRIMARY key.
+CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( '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', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
+CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('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','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
+CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
+show tables;
+Tables_in_db
+column_stats
+columns_priv
+db
+event
+func
+general_log
+global_priv
+gtid_slave_pos
+help_category
+help_keyword
+help_relation
+help_topic
+host
+index_stats
+innodb_index_stats
+innodb_table_stats
+ndb_binlog_index
+plugin
+proc
+procs_priv
+proxies_priv
+roles_mapping
+servers
+slow_log
+table_stats
+tables_priv
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+transaction_registry
+user
+show create table db;
+Table Create Table
+db CREATE TABLE `db` (
+ `Host` char(255) NOT NULL DEFAULT '',
+ `Db` char(64) NOT NULL DEFAULT '',
+ `User` char(128) NOT NULL DEFAULT '',
+ `Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ `Delete_history_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
+ PRIMARY KEY (`Host`,`Db`,`User`),
+ KEY `User` (`User`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges'
+show create table user;
+View Create View character_set_client collation_connection
+user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `test`.`global_priv`.`Host` AS `Host`,`test`.`global_priv`.`User` AS `User`,if(json_value(`test`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci
+show create table func;
+Table Create Table
+func CREATE TABLE `func` (
+ `name` char(64) NOT NULL DEFAULT '',
+ `ret` tinyint(1) NOT NULL DEFAULT 0,
+ `dl` char(128) NOT NULL DEFAULT '',
+ `type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
+ PRIMARY KEY (`name`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions'
+show create table global_priv;
+Table Create Table
+global_priv CREATE TABLE `global_priv` (
+ `Host` char(255) NOT NULL DEFAULT '',
+ `User` char(128) NOT NULL DEFAULT '',
+ `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)),
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges'
+show create table tables_priv;
+Table Create Table
+tables_priv CREATE TABLE `tables_priv` (
+ `Host` char(255) NOT NULL DEFAULT '',
+ `Db` char(64) NOT NULL DEFAULT '',
+ `User` char(128) NOT NULL DEFAULT '',
+ `Table_name` char(64) NOT NULL DEFAULT '',
+ `Grantor` varchar(384) NOT NULL DEFAULT '',
+ `Timestamp` timestamp NULL DEFAULT NULL,
+ `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
+ `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
+ PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
+ KEY `Grantor` (`Grantor`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Table privileges'
+show create table columns_priv;
+Table Create Table
+columns_priv CREATE TABLE `columns_priv` (
+ `Host` char(255) NOT NULL DEFAULT '',
+ `Db` char(64) NOT NULL DEFAULT '',
+ `User` char(128) NOT NULL DEFAULT '',
+ `Table_name` char(64) NOT NULL DEFAULT '',
+ `Column_name` char(64) NOT NULL DEFAULT '',
+ `Timestamp` timestamp NULL DEFAULT NULL,
+ `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
+ PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Column privileges'
+show create table procs_priv;
+Table Create Table
+procs_priv CREATE TABLE `procs_priv` (
+ `Host` char(60) NOT NULL DEFAULT '',
+ `Db` char(64) NOT NULL DEFAULT '',
+ `User` char(128) NOT NULL DEFAULT '',
+ `Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
+ `Routine_type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL,
+ `Grantor` varchar(384) NOT NULL DEFAULT '',
+ `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
+ `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
+ KEY `Grantor` (`Grantor`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Procedure privileges'
+show create table servers;
+Table Create Table
+servers CREATE TABLE `servers` (
+ `Server_name` char(64) NOT NULL DEFAULT '',
+ `Host` varchar(2048) NOT NULL DEFAULT '',
+ `Db` char(64) NOT NULL DEFAULT '',
+ `Username` char(128) NOT NULL DEFAULT '',
+ `Password` char(64) NOT NULL DEFAULT '',
+ `Port` int(4) NOT NULL DEFAULT 0,
+ `Socket` char(64) NOT NULL DEFAULT '',
+ `Wrapper` char(64) NOT NULL DEFAULT '',
+ `Owner` varchar(512) NOT NULL DEFAULT '',
+ PRIMARY KEY (`Server_name`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='MySQL Foreign Servers table'
+show create table proc;
+Table Create Table
+proc CREATE TABLE `proc` (
+ `db` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
+ `name` char(64) NOT NULL DEFAULT '',
+ `type` enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL,
+ `specific_name` char(64) NOT NULL DEFAULT '',
+ `language` enum('SQL') NOT NULL DEFAULT 'SQL',
+ `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
+ `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
+ `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
+ `param_list` blob NOT NULL,
+ `returns` longblob NOT NULL,
+ `body` longblob NOT NULL,
+ `definer` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
+ `created` timestamp NULL DEFAULT NULL,
+ `modified` timestamp NULL DEFAULT NULL,
+ `sql_mode` set('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','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') NOT NULL DEFAULT '',
+ `comment` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL,
+ `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
+ `collation_connection` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
+ `db_collation` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
+ `body_utf8` longblob DEFAULT NULL,
+ `aggregate` enum('NONE','GROUP') NOT NULL DEFAULT 'NONE',
+ PRIMARY KEY (`db`,`name`,`type`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Stored Procedures'
+show create table event;
+Table Create Table
+event CREATE TABLE `event` (
+ `db` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
+ `name` char(64) NOT NULL DEFAULT '',
+ `body` longblob NOT NULL,
+ `definer` varchar(384) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
+ `execute_at` datetime DEFAULT NULL,
+ `interval_value` int(11) DEFAULT NULL,
+ `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
+ `created` timestamp NOT NULL,
+ `modified` timestamp NOT NULL,
+ `last_executed` datetime DEFAULT NULL,
+ `starts` datetime DEFAULT NULL,
+ `ends` datetime DEFAULT NULL,
+ `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
+ `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
+ `sql_mode` set('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','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') NOT NULL DEFAULT '',
+ `comment` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '',
+ `originator` int(10) unsigned NOT NULL,
+ `time_zone` char(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'SYSTEM',
+ `character_set_client` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
+ `collation_connection` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
+ `db_collation` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
+ `body_utf8` longblob DEFAULT NULL,
+ PRIMARY KEY (`db`,`name`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Events'
+show create table general_log;
+Table Create Table
+general_log CREATE TABLE `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='General log'
+show create table slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Slow log'
+show create table table_stats;
+Table Create Table
+table_stats CREATE TABLE `table_stats` (
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `cardinality` bigint(21) unsigned DEFAULT NULL,
+ PRIMARY KEY (`db_name`,`table_name`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Tables'
+show create table column_stats;
+Table Create Table
+column_stats CREATE TABLE `column_stats` (
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `column_name` varchar(64) NOT NULL,
+ `min_value` varbinary(255) DEFAULT NULL,
+ `max_value` varbinary(255) DEFAULT NULL,
+ `nulls_ratio` decimal(12,4) DEFAULT NULL,
+ `avg_length` decimal(12,4) DEFAULT NULL,
+ `avg_frequency` decimal(12,4) DEFAULT NULL,
+ `hist_size` tinyint(3) unsigned DEFAULT NULL,
+ `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') DEFAULT NULL,
+ `histogram` longblob DEFAULT NULL,
+ PRIMARY KEY (`db_name`,`table_name`,`column_name`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
+show create table index_stats;
+Table Create Table
+index_stats CREATE TABLE `index_stats` (
+ `db_name` varchar(64) NOT NULL,
+ `table_name` varchar(64) NOT NULL,
+ `index_name` varchar(64) NOT NULL,
+ `prefix_arity` int(11) unsigned NOT NULL,
+ `avg_frequency` decimal(12,4) DEFAULT NULL,
+ PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`)
+) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Indexes'
+DROP VIEW user;
+DROP TABLE db, host, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, event, proxies_priv, general_log, slow_log, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv, ndb_binlog_index;
+show tables;
+Tables_in_test
diff --git a/mysql-test/main/system_mysql_db_fix50568.test b/mysql-test/main/system_mysql_db_fix50568.test
new file mode 100644
index 00000000000..3429f8c5478
--- /dev/null
+++ b/mysql-test/main/system_mysql_db_fix50568.test
@@ -0,0 +1,99 @@
+# Embedded server doesn't support external clients
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
+# to the location of mysql_fix_privilege_tables.sql
+if (!$MYSQL_FIX_PRIVILEGE_TABLES)
+{
+ skip Test needs MYSQL_FIX_PRIVILEGE_TABLES;
+}
+
+#
+# This is the test for mysql_fix_privilege_tables
+# It checks that a system tables from mysql 5.5.68
+# can be upgraded to current system table format
+#
+# Note: If this test fails, don't be confused about the errors reported
+# by mysql-test-run This shows warnings generated by
+# mysql_fix_system_tables which should be ignored.
+# Instead, concentrate on the errors in r/system_mysql_db.reject
+
+use test;
+
+# create system tables as in mysql-5.5.68
+CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+
+CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+
+CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) DEFAULT 0 NOT NULL, plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, authentication_string TEXT NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+
+CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
+
+
+CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';
+
+
+CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
+
+
+CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+
+CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+
+
+CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url text not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+
+
+CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url text not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
+
+
+CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+
+
+CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
+
+
+CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+
+
+CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+
+
+CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+
+
+CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, `Offset` int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+
+
+CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+
+CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( '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', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
+
+CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+
+
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('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','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+
+
+CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
+
+CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
+
+
+-- disable_result_log
+# Run the mysql_fix_privilege_tables.sql using "mysql --force"
+--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
+-- enable_result_log
+
+# Dump the tables that should be compared
+-- source include/system_db_struct.inc
+
+# Drop all tables created by this test
+DROP VIEW user;
+DROP TABLE db, host, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, event, proxies_priv, general_log, slow_log, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv, ndb_binlog_index;
+
+# check that we dropped all system tables
+show tables;
+
+# End of 4.1 tests
diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result
index 86479c843c2..6d8dd6826e8 100644
--- a/mysql-test/main/table_value_constr.result
+++ b/mysql-test/main/table_value_constr.result
@@ -3156,5 +3156,124 @@ INSERT INTO t1 (VALUES (IGNORE) UNION VALUES (IGNORE));
ERROR HY000: 'ignore' is not allowed in this context
DROP TABLE t1;
#
+# MDEV-28603: VIEW with table value constructor used as single-value
+# subquery contains subquery as its first element
+#
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+create table t2 (b int);
+insert into t2 values (1), (2);
+create view v as select (values ((select * from t1 where a > 5))) as m from t2;
+select (values ((select * from t1 where a > 5))) as m from t2;
+m
+7
+7
+select * from v;
+m
+7
+7
+with cte as ( select (values ((select * from t1 where a > 5))) as m from t2 ) select * from cte;
+m
+7
+7
+explain select (values ((select * from t1 where a > 5))) as m from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
+explain select * from v;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+5 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2
+3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+4 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
+explain with cte as ( select (values ((select * from t1 where a > 5))) as m from t2 ) select * from cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+5 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2
+3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
+4 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
+prepare stmt from "select (values ((select * from t1 where a > 5))) as m from t2";
+execute stmt;
+m
+7
+7
+execute stmt;
+m
+7
+7
+deallocate prepare stmt;
+prepare stmt from "select * from v";
+execute stmt;
+m
+7
+7
+execute stmt;
+m
+7
+7
+deallocate prepare stmt;
+prepare stmt from "with cte as ( select (values ((select * from t1 where a > 5))) as m from t2 ) select * from cte";
+execute stmt;
+m
+7
+7
+execute stmt;
+m
+7
+7
+deallocate prepare stmt;
+show create view v;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci
+drop view v;
+prepare stmt from "create view v as select (values ((select * from t1 where a > 5))) as m from t2";
+execute stmt;
+show create view v;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci
+select * from v;
+m
+7
+7
+drop view v;
+execute stmt;
+show create view v;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci
+select * from v;
+m
+7
+7
+deallocate prepare stmt;
+prepare stmt from "show create view v";
+execute stmt;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci
+execute stmt;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5))) AS `m` from `t2` latin1 latin1_swedish_ci
+deallocate prepare stmt;
+drop view v;
+create view v as select (values ((select * from t1 where a > 5
+union
+select * from t1 where a > 7))) as m from t2;
+select (values ((select * from t1 where a > 5
+union
+select * from t1 where a > 7))) as m from t2;
+m
+7
+7
+select * from v;
+m
+7
+7
+show create view v;
+View Create View character_set_client collation_connection
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select (values ((select `t1`.`a` from `t1` where `t1`.`a` > 5 union select `t1`.`a` from `t1` where `t1`.`a` > 7))) AS `m` from `t2` latin1 latin1_swedish_ci
+drop view v;
+drop table t1,t2;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test
index ade90400b63..ac623eaaf0b 100644
--- a/mysql-test/main/table_value_constr.test
+++ b/mysql-test/main/table_value_constr.test
@@ -1761,5 +1761,79 @@ INSERT INTO t1 (VALUES (IGNORE) UNION VALUES (IGNORE));
DROP TABLE t1;
--echo #
+--echo # MDEV-28603: VIEW with table value constructor used as single-value
+--echo # subquery contains subquery as its first element
+--echo #
+
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+create table t2 (b int);
+insert into t2 values (1), (2);
+
+let $q=
+select (values ((select * from t1 where a > 5))) as m from t2;
+
+eval create view v as $q;
+
+eval $q;
+eval select * from v;
+eval with cte as ( $q ) select * from cte;
+
+eval explain $q;
+eval explain select * from v;
+eval explain with cte as ( $q ) select * from cte;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval prepare stmt from "select * from v";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval prepare stmt from "with cte as ( $q ) select * from cte";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+show create view v;
+
+drop view v;
+
+eval prepare stmt from "create view v as $q";
+execute stmt;
+show create view v;
+select * from v;
+drop view v;
+execute stmt;
+show create view v;
+select * from v;
+deallocate prepare stmt;
+
+prepare stmt from "show create view v";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop view v;
+
+let $q=
+select (values ((select * from t1 where a > 5
+ union
+ select * from t1 where a > 7))) as m from t2;
+
+eval create view v as $q;
+
+eval $q;
+eval select * from v;
+
+show create view v;
+
+drop view v;
+drop table t1,t2;
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result
index 96f3c568446..0c351bcb3cd 100644
--- a/mysql-test/main/type_datetime.result
+++ b/mysql-test/main/type_datetime.result
@@ -545,7 +545,7 @@ select * from t1
where id in (select id from t1 as x1 where (t1.cur_date is null));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1)
+1 PRIMARY x1 ALL NULL NULL NULL NULL 2 50.00 Using where; FirstMatch(t1)
Warnings:
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0
@@ -557,7 +557,7 @@ select * from t2
where id in (select id from t2 as x1 where (t2.cur_date is null));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t2)
+1 PRIMARY x1 ALL NULL NULL NULL NULL 2 50.00 Using where; FirstMatch(t2)
Warnings:
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0
diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result
index 40746345bdf..a863eaea686 100644
--- a/mysql-test/main/type_time.result
+++ b/mysql-test/main/type_time.result
@@ -2420,5 +2420,31 @@ SET @@global.mysql56_temporal_format=default;
DROP PROCEDURE p1;
SET timestamp=DEFAULT;
#
+# MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!?
+#
+SET @@time_zone='+00:00';
+SET timestamp=1234567;
+SELECT CURRENT_TIMESTAMP;
+CURRENT_TIMESTAMP
+1970-01-15 06:56:07
+SELECT UNIX_TIMESTAMP(CURRENT_TIME());
+UNIX_TIMESTAMP(CURRENT_TIME())
+1234567
+SELECT UNIX_TIMESTAMP(TIME'06:56:07');
+UNIX_TIMESTAMP(TIME'06:56:07')
+1234567
+SELECT UNIX_TIMESTAMP(TIME'10:20:30');
+UNIX_TIMESTAMP(TIME'10:20:30')
+1246830
+CREATE OR REPLACE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30');
+SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+UNIX_TIMESTAMP(a)
+1234567
+1246830
+DROP TABLE t1;
+SET @@time_zone=DEFAULT;
+SET TIMESTAMP=DEFAULT;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test
index 0f67223238c..9ed5c3a73dc 100644
--- a/mysql-test/main/type_time.test
+++ b/mysql-test/main/type_time.test
@@ -1567,5 +1567,24 @@ DROP PROCEDURE p1;
SET timestamp=DEFAULT;
--echo #
+--echo # MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!?
+--echo #
+
+SET @@time_zone='+00:00';
+SET timestamp=1234567;
+SELECT CURRENT_TIMESTAMP;
+SELECT UNIX_TIMESTAMP(CURRENT_TIME());
+SELECT UNIX_TIMESTAMP(TIME'06:56:07');
+SELECT UNIX_TIMESTAMP(TIME'10:20:30');
+CREATE OR REPLACE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES (TIME'06:56:07'),('10:20:30');
+SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+SET @@time_zone=DEFAULT;
+SET TIMESTAMP=DEFAULT;
+
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result
index c6c55da229e..8dda69e4e78 100644
--- a/mysql-test/main/update.result
+++ b/mysql-test/main/update.result
@@ -735,6 +735,35 @@ ERROR 22007: Incorrect datetime value: '19' for column `test`.`t1`.`i1` at row 1
DROP TABLE t1,t2;
# End of MariaDB 10.2 tests
#
+# MDEV-20773: UPDATE with LIKE predicate over non-indexed column
+# of VARCHAR type
+#
+create table t1 (a1 varchar(30), a2 varchar(30) collate utf8_bin);
+insert into t1 values
+('aa','zzz'), ('b','xxaa'), ('ccc','yyy'), ('ddd','xxb');
+analyze table t1 persistent for all;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+explain extended
+update t1 set a1 = 'u'
+ where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 50.00 Using where
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 50.00 Using where
+Warnings:
+Note 1003 /* select#1 */ update `test`.`t1` set `test`.`t1`.`a1` = 'u' where `test`.`t1`.`a2` like 'xx%'
+update t1 set a1 = 'u'
+ where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c');
+select * from t1;
+a1 a2
+aa zzz
+u xxaa
+ccc yyy
+u xxb
+drop table t1;
+# End of MariaDB 10.4 tests
+#
# MDEV-29189: Second execution of SF using UPDATE?DELETE
# after reported error by the first execution
#
diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test
index 88fea88f120..c10c1b82a50 100644
--- a/mysql-test/main/update.test
+++ b/mysql-test/main/update.test
@@ -678,6 +678,29 @@ DROP TABLE t1,t2;
--echo # End of MariaDB 10.2 tests
--echo #
+--echo # MDEV-20773: UPDATE with LIKE predicate over non-indexed column
+--echo # of VARCHAR type
+--echo #
+
+create table t1 (a1 varchar(30), a2 varchar(30) collate utf8_bin);
+insert into t1 values
+ ('aa','zzz'), ('b','xxaa'), ('ccc','yyy'), ('ddd','xxb');
+analyze table t1 persistent for all;
+
+explain extended
+update t1 set a1 = 'u'
+ where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c');
+
+update t1 set a1 = 'u'
+ where a2 like 'xx%' and exists(select 1 from t1 where t1.a1 < 'c');
+
+select * from t1;
+
+drop table t1;
+
+--echo # End of MariaDB 10.4 tests
+
+--echo #
--echo # MDEV-29189: Second execution of SF using UPDATE?DELETE
--echo # after reported error by the first execution
--echo #
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index b5c5564a7da..9a21c4d5c0a 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -6959,6 +6959,24 @@ create algorithm=merge view v as
select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3);
ERROR 42S22: Unknown column 'd' in 'field list'
drop table t1,t2,t3;
+#
+# MDEV-31189: Server crash or assertion failure in upon 2nd
+# execution of PS with views and HAVING
+#
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2);
+CREATE VIEW v1 AS SELECT 1 AS a;
+CREATE VIEW v2 AS SELECT a FROM v1;
+PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)";
+EXECUTE stmt;
+a
+1
+EXECUTE stmt;
+a
+1
+DROP VIEW v1;
+DROP VIEW v2;
+DROP TABLE t;
# End of 10.4 tests
#
# MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index 3b3d1124a09..0892f00e65b 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -6704,6 +6704,25 @@ create algorithm=merge view v as
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-31189: Server crash or assertion failure in upon 2nd
+--echo # execution of PS with views and HAVING
+--echo #
+
+CREATE TABLE t (f INT);
+INSERT INTO t VALUES (1),(2); # Optional, fails either way
+CREATE VIEW v1 AS SELECT 1 AS a;
+CREATE VIEW v2 AS SELECT a FROM v1;
+
+PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)";
+EXECUTE stmt;
+EXECUTE stmt;
+
+# Cleanup
+DROP VIEW v1;
+DROP VIEW v2;
+DROP TABLE t;
+
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl
index 07aac0f63b0..245e5d42ed2 100755
--- a/mysql-test/mariadb-test-run.pl
+++ b/mysql-test/mariadb-test-run.pl
@@ -145,7 +145,6 @@ my $opt_start_exit;
my $start_only;
my $file_wsrep_provider;
my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
-my $test_name_for_report;
our @global_suppressions;
@@ -187,6 +186,7 @@ my @DEFAULT_SUITES= qw(
compat/mssql-
compat/maxdb-
encryption-
+ events-
federated-
funcs_1-
funcs_2-
@@ -201,6 +201,7 @@ my @DEFAULT_SUITES= qw(
json-
maria-
mariabackup-
+ merge-
multi_source-
optimizer_unfixed_bugs-
parts-
@@ -402,6 +403,11 @@ sub main {
mtr_report("Collecting tests...");
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
+ if (@$tests == 0) {
+ mtr_report("No tests to run...");
+ exit 0;
+ }
+
mark_time_used('collect');
mysql_install_db(default_mysqld(), "$opt_vardir/install.db") unless using_extern();
@@ -516,13 +522,13 @@ sub main {
}
if ( not @$completed ) {
- if ($test_name_for_report)
- {
- my $tinfo = My::Test->new(name => $test_name_for_report);
- $tinfo->{result}= 'MTR_RES_FAILED';
- $tinfo->{comment}=' ';
- mtr_report_test($tinfo);
- }
+ my $test_name= mtr_grab_file($path_testlog);
+ $test_name =~ s/^CURRENT_TEST:\s//;
+ chomp($test_name);
+ my $tinfo = My::Test->new(name => $test_name);
+ $tinfo->{result}= 'MTR_RES_FAILED';
+ $tinfo->{comment}=' ';
+ mtr_report_test($tinfo);
mtr_error("Test suite aborted");
}
@@ -3749,8 +3755,8 @@ sub resfile_report_test ($) {
sub run_testcase ($$) {
my ($tinfo, $server_socket)= @_;
my $print_freq=20;
- $test_name_for_report= $tinfo->{name};
- mtr_verbose("Running test:", $test_name_for_report);
+
+ mtr_verbose("Running test:", $tinfo->{name});
$ENV{'MTR_TEST_NAME'} = $tinfo->{name};
resfile_report_test($tinfo) if $opt_resfile;
@@ -5139,10 +5145,12 @@ sub mysqld_start ($$) {
if (!$rc)
{
# Report failure about the last test case before exit
- my $tinfo = My::Test->new(name => $test_name_for_report);
+ my $test_name= mtr_grab_file($path_current_testlog);
+ $test_name =~ s/^CURRENT_TEST:\s//;
+ my $tinfo = My::Test->new(name => $test_name);
$tinfo->{result}= 'MTR_RES_FAILED';
$tinfo->{failures}= 1;
- $tinfo->{logfile}=get_log_from_proc($mysqld->{'proc'}, $test_name_for_report);
+ $tinfo->{logfile}=get_log_from_proc($mysqld->{'proc'}, $tinfo->{name});
report_option('verbose', 1);
mtr_report_test($tinfo);
}
@@ -5961,7 +5969,7 @@ Misc options
phases of test execution.
stress=ARGS Run stress test, providing options to
mysql-stress-test.pl. Options are separated by comma.
- xml-report=<file> Output jUnit xml file of the results.
+ xml-report=<file> Output xml file of the results.
tail-lines=N Number of lines of the result to include in a failure
report.
diff --git a/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYD b/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYD
new file mode 100644
index 00000000000..77a281667b5
--- /dev/null
+++ b/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYD
Binary files differ
diff --git a/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYI b/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYI
new file mode 100644
index 00000000000..20fc1b97c00
--- /dev/null
+++ b/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.MYI
Binary files differ
diff --git a/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.frm b/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.frm
new file mode 100644
index 00000000000..1eb8ac15133
--- /dev/null
+++ b/mysql-test/std_data/ctype_upgrade/mariadb100428_ucs2_general_ci.frm
Binary files differ
diff --git a/mysql-test/std_data/rpl/master-bin-seq_10.3.36.000001 b/mysql-test/std_data/rpl/master-bin-seq_10.3.36.000001
new file mode 100644
index 00000000000..0fa163d0484
--- /dev/null
+++ b/mysql-test/std_data/rpl/master-bin-seq_10.3.36.000001
Binary files differ
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result
index 9148f0e8c2b..294e96e5997 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result
@@ -1,3 +1,7 @@
+#
+# MDEV-30698 Cover missing test cases for mariadb-binlog options
+# --raw [and] --flashback
+#
CREATE TABLE t1 (a int);
FLUSH LOGS;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/binlog/r/flashback.result b/mysql-test/suite/binlog/r/flashback.result
index 2eac49397a9..ec767f62152 100644
--- a/mysql-test/suite/binlog/r/flashback.result
+++ b/mysql-test/suite/binlog/r/flashback.result
@@ -702,6 +702,10 @@ include/assert.inc [Table t1 should have 0 rows.]
# 6- Rows must be present upon restoring from flashback
include/assert.inc [Table t1 should have six rows.]
DROP TABLE t1;
+#
+# MDEV-30698 Cover missing test cases for mariadb-binlog options
+# --raw [and] --flashback
+#
SET binlog_format=statement;
Warnings:
Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test
index 8ec3856dcb5..793aa8a0607 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test
@@ -5,6 +5,7 @@
# respective log file specified by --result-file, and shown on-disk. This test
# ensures that the log files on disk, created by mariadb-binlog, have the most
# up-to-date events from the master.
+# Option --raw works only with --read-from-remote-server, otherwise returns error.
#
# Methodology:
# On the master, rotate to a newly active binlog file and write an event to
@@ -20,6 +21,14 @@
--source include/linux.inc
--source include/have_log_bin.inc
+--echo #
+--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options
+--echo # --raw [and] --flashback
+--echo #
+# Test --raw format without -R (--read-from-remote-server)
+--error 1 # Error 1 operation not permitted
+--exec $MYSQL_BINLOG --raw --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --stop-never --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001
+
# Create newly active log
CREATE TABLE t1 (a int);
FLUSH LOGS;
diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc
index 52ce4741eaa..f3801070851 100644
--- a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc
+++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc
@@ -20,7 +20,9 @@ connect(con1,localhost,root,,);
--source include/show_binary_logs.inc
INSERT INTO t1 VALUES (1, REPEAT("x", 1));
INSERT INTO t2 VALUES (1, REPEAT("x", 1));
-if (`SELECT $case = "B"`)
+--let $is_case_B=`SELECT $case = "B"`
+
+if ($is_case_B)
{
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait-binlog_truncate_multi_engine.test
@@ -39,12 +41,12 @@ if (`SELECT $debug_sync_action != ""`)
send COMMIT;
--connection default
-if (`SELECT $case = "B"`)
+if ($is_case_B)
{
--source include/wait_until_disconnected.inc
--source include/start_mysqld.inc
}
-if (`SELECT $case != "B"`)
+if (!$is_case_B)
{
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
--echo List of binary logs after rotation
diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test
index 76379f35dae..7c58b56c935 100644
--- a/mysql-test/suite/binlog/t/flashback.test
+++ b/mysql-test/suite/binlog/t/flashback.test
@@ -364,6 +364,14 @@ FLUSH LOGS;
DROP TABLE t1;
+--echo #
+--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options
+--echo # --raw [and] --flashback
+--echo #
+
+--error 1 # --raw mode and --flashback mode are not allowed
+--exec $MYSQL_BINLOG -vv -B --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000003> $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_8.sql
+
## Clear
SET binlog_format=statement;
--error ER_FLASHBACK_NOT_SUPPORTED
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.cnf b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.cnf
index 73c9ad655bf..73c9ad655bf 100644
--- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.cnf
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.cnf
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result
index a628d0d409b..35b44be02cf 100644
--- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result
@@ -9,6 +9,7 @@ include/start_slave.inc
connection server_1;
connection server_2;
include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
#####################################################
# Part 1: unencrypted master
#####################################################
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test
index d36086da73b..e05994f1943 100644
--- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test
@@ -1,14 +1,19 @@
#
-# TODO: write here what the test checks after MDEV-11288 is fixed
-#
-# The test starts with unencrypted master.
+# The test starts with unencrypted master.
# It stops replication, generates a few statement and row events
-# on the master, then restarts the server with encrypted binlog,
-# generates some more events and restarts it back without encryption
+# on the master, then restarts the server with encrypted binlog,
+# generates some more events and restarts it back without encryption
# (no encryption plugin).
-# Then it resumes replication and checks what happens when the server
-# tries to feed the binary logs (included the encrypted ones)
-# to the slave.
+# Then it resumes replication and should error with
+# ER_MASTER_FATAL_ERROR_READING_BINLOG because the encrypted binlog is
+# sent and unable to be decrypted.
+#
+# Note this variation of encrypted_master_switch_to_unencrypted tests
+# using MASTER_USE_GTID=NO. In contrast to the GTID variant of this
+# test, at part 3 (the error case), the master will scan binlogs
+# starting from the first one (which is unencrypted initially, so
+# replication is okay) and continue until the slave encounters the
+# first encrypted event, which causes the slave to error.
#
--source include/have_binlog_format_mixed.inc
@@ -34,6 +39,7 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
--connection server_2
--disable_connect_log
--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
--enable_connect_log
--echo #####################################################
@@ -48,7 +54,7 @@ CREATE TABLE table1_no_encryption (
pk INT AUTO_INCREMENT PRIMARY KEY,
ts TIMESTAMP NULL,
b BLOB
-) ENGINE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
@@ -81,7 +87,7 @@ CREATE TABLE table2_to_encrypt (
pk INT AUTO_INCREMENT PRIMARY KEY,
ts TIMESTAMP NULL,
b BLOB
-) ENGINE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
@@ -108,7 +114,7 @@ CREATE TABLE table3_no_encryption (
pk INT AUTO_INCREMENT PRIMARY KEY,
ts TIMESTAMP NULL,
b BLOB
-) ENGINE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
@@ -120,7 +126,7 @@ INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
--connection server_2
start slave;
-# The slave should be able to synchronize with master up to
+# The slave should be able to synchronize with master up to
# the previously saved position (when the log was still unencrypted)
--sync_with_master
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.cnf b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.cnf
new file mode 100644
index 00000000000..ad1b8b44c24
--- /dev/null
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.cnf
@@ -0,0 +1,8 @@
+!include my.cnf
+
+[mysqld.1]
+encrypt-binlog=0
+skip-file-key-management
+
+[mysqld.2]
+gtid-domain-id=1
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result
new file mode 100644
index 00000000000..16ea30557e7
--- /dev/null
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result
@@ -0,0 +1,84 @@
+#################
+# Initialization
+#################
+include/rpl_init.inc [topology=1->2]
+connection server_2;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS;
+call mtr.add_suppression(" Got fatal error 1236 from master when reading data from binary log: 'Could not set up decryption for binlog.'");
+#####################################################
+# Part 1: unencrypted master
+#####################################################
+connection server_1;
+CREATE TABLE table1_no_encryption (
+pk INT AUTO_INCREMENT PRIMARY KEY,
+ts TIMESTAMP NULL,
+b BLOB
+) ENGINE=MyISAM;
+INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
+INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
+FLUSH BINARY LOGS;
+SET binlog_format=ROW;
+INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
+INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
+NOT FOUND /table1_no_encryption/ in master-bin.0*
+#####################################################
+# Part 2: restart master, now with binlog encryption
+#####################################################
+connection default;
+connection server_1;
+CREATE TABLE table2_to_encrypt (
+pk INT AUTO_INCREMENT PRIMARY KEY,
+ts TIMESTAMP NULL,
+b BLOB
+) ENGINE=MyISAM;
+INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
+INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
+FLUSH BINARY LOGS;
+SET binlog_format=ROW;
+INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
+INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
+NOT FOUND /table2_to_encrypt/ in master-bin.0*
+#####################################################
+# Part 3: restart master again without encryption
+#####################################################
+connection default;
+connection server_1;
+CREATE TABLE table3_no_encryption (
+pk INT AUTO_INCREMENT PRIMARY KEY,
+ts TIMESTAMP NULL,
+b BLOB
+) ENGINE=MyISAM;
+INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
+INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
+INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
+#####################################################
+# Check: resume replication and check how it goes
+#####################################################
+connection server_2;
+start slave;
+include/wait_for_slave_io_error.inc [errno=1236]
+# Ensuring slave was unable to replicate any transactions..
+# ..success
+SHOW TABLES;
+Tables_in_test
+include/stop_slave.inc
+reset slave;
+##########
+# Cleanup
+##########
+connection server_1;
+reset master;
+SELECT COUNT(*) FROM table1_no_encryption;
+COUNT(*)
+8
+SELECT COUNT(*) FROM table2_to_encrypt;
+COUNT(*)
+8
+SELECT COUNT(*) FROM table3_no_encryption;
+COUNT(*)
+4
+DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption;
+connection server_2;
+include/start_slave.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test
new file mode 100644
index 00000000000..f882e8f3440
--- /dev/null
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test
@@ -0,0 +1,154 @@
+#
+# The test starts with unencrypted master.
+# It stops replication, generates a few statement and row events
+# on the master, then restarts the server with encrypted binlog,
+# generates some more events and restarts it back without encryption
+# (no encryption plugin).
+# Then it resumes replication and should error with
+# ER_MASTER_FATAL_ERROR_READING_BINLOG because the encrypted binlog is
+# sent and unable to be decrypted.
+#
+# Note this variation of encrypted_master_switch_to_unencrypted tests
+# using MASTER_USE_GTID=SLAVE_POS. encrypted_master_switch_to_unencrypted
+# was the original test which only used binlog coordinates. When tested
+# using MASTER_USE_GTID=Slave_Pos, the master optimizes the detection of
+# an undecryptable binlog. I.e, the master will initially look for a
+# Gtid_list_log_event, but fail to decrypt it and fail immediately in
+# part 3.
+#
+
+--source include/have_binlog_format_mixed.inc
+
+--echo #################
+--echo # Initialization
+--echo #################
+
+--let $rpl_topology= 1->2
+--source include/rpl_init.inc
+
+--enable_connect_log
+
+# We stop replication because we want it to happen after the switch
+
+--connection server_2
+--disable_connect_log
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS;
+--enable_connect_log
+call mtr.add_suppression(" Got fatal error 1236 from master when reading data from binary log: 'Could not set up decryption for binlog.'");
+
+--echo #####################################################
+--echo # Part 1: unencrypted master
+--echo #####################################################
+
+--connection server_1
+
+CREATE TABLE table1_no_encryption (
+ pk INT AUTO_INCREMENT PRIMARY KEY,
+ ts TIMESTAMP NULL,
+ b BLOB
+) ENGINE=MyISAM;
+
+INSERT INTO table1_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
+INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
+FLUSH BINARY LOGS;
+SET binlog_format=ROW;
+INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
+INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
+
+# Make sure that binary logs are not encrypted
+
+--let SEARCH_RANGE = 500000
+--let SEARCH_FILE= master-bin.0*
+--let SEARCH_PATTERN= table1_no_encryption
+--source include/search_pattern_in_file.inc
+
+--echo #####################################################
+--echo # Part 2: restart master, now with binlog encryption
+--echo #####################################################
+
+--let $rpl_server_parameters= --encrypt-binlog=1 --plugin-load-add=$FILE_KEY_MANAGEMENT_SO --file-key-management --loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
+
+--let $rpl_server_number= 1
+--source restart_server.inc
+
+CREATE TABLE table2_to_encrypt (
+ pk INT AUTO_INCREMENT PRIMARY KEY,
+ ts TIMESTAMP NULL,
+ b BLOB
+) ENGINE=MyISAM;
+
+INSERT INTO table2_to_encrypt VALUES (NULL,NOW(),'data_to_encrypt');
+INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
+FLUSH BINARY LOGS;
+SET binlog_format=ROW;
+INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
+INSERT INTO table2_to_encrypt SELECT NULL,NOW(),b FROM table2_to_encrypt;
+
+# Make sure that binary logs are encrypted
+
+--let SEARCH_FILE= master-bin.0*
+--let SEARCH_PATTERN= table2_to_encrypt
+--source include/search_pattern_in_file.inc
+
+--echo #####################################################
+--echo # Part 3: restart master again without encryption
+--echo #####################################################
+
+--let $rpl_server_parameters= --encrypt-binlog=0
+--let $rpl_server_number= 1
+--source restart_server.inc
+
+CREATE TABLE table3_no_encryption (
+ pk INT AUTO_INCREMENT PRIMARY KEY,
+ ts TIMESTAMP NULL,
+ b BLOB
+) ENGINE=MyISAM;
+
+INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
+INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
+INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
+
+--echo #####################################################
+--echo # Check: resume replication and check how it goes
+--echo #####################################################
+
+--connection server_2
+start slave;
+# Make slave to try to synchronize. It shouldn't work, the slave IO thread is
+# expected to abort with an error
+--let $slave_io_errno= 1236
+--source include/wait_for_slave_io_error.inc
+
+--echo # Ensuring slave was unable to replicate any transactions..
+--let $gsp= `SELECT @@global.gtid_slave_pos`
+if (`SELECT strcmp("$gsp","")`)
+{
+ die Slave without encryption configured should fail to read encrypted binlog;
+}
+--echo # ..success
+
+--sorted_result
+SHOW TABLES;
+
+--disable_connect_log
+--source include/stop_slave.inc
+--enable_connect_log
+reset slave;
+
+--echo ##########
+--echo # Cleanup
+--echo ##########
+
+--connection server_1
+reset master;
+
+SELECT COUNT(*) FROM table1_no_encryption;
+SELECT COUNT(*) FROM table2_to_encrypt;
+SELECT COUNT(*) FROM table3_no_encryption;
+DROP TABLE table1_no_encryption, table2_to_encrypt, table3_no_encryption;
+
+--connection server_2
+--disable_connect_log
+--source include/start_slave.inc
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test
index c2a7ec9d27a..25849c111a7 100644
--- a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test
+++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.test
@@ -1,2 +1,2 @@
--let $binlog_limit= 5,1
---source suite/rpl/include/rpl_binlog_errors.inc
+--source suite/rpl/t/rpl_binlog_errors.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test b/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test
index acbe0d59a5e..406af58c03b 100644
--- a/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test
+++ b/mysql-test/suite/binlog_encryption/rpl_cant_read_event_incident.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_cant_read_event_incident.inc
+--source suite/rpl/t/rpl_cant_read_event_incident.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.test b/mysql-test/suite/binlog_encryption/rpl_checksum.test
index ca8cdc06726..a2abd019e24 100644
--- a/mysql-test/suite/binlog_encryption/rpl_checksum.test
+++ b/mysql-test/suite/binlog_encryption/rpl_checksum.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_checksum.inc
+--source suite/rpl/t/rpl_checksum.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test b/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test
index 8fa44136fc2..56fb2be0ce3 100644
--- a/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test
+++ b/mysql-test/suite/binlog_encryption/rpl_checksum_cache.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_checksum_cache.inc
+--source suite/rpl/t/rpl_checksum_cache.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.test b/mysql-test/suite/binlog_encryption/rpl_corruption.test
index 1abf2c882ec..f6ba2944398 100644
--- a/mysql-test/suite/binlog_encryption/rpl_corruption.test
+++ b/mysql-test/suite/binlog_encryption/rpl_corruption.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_corruption.inc
+--source suite/rpl/t/rpl_corruption.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
index 99eda3b61a0..07ef909d8a6 100644
--- a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
+++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
@@ -564,3 +564,27 @@ a
connection server_1;
DROP TABLE t1;
include/rpl_end.inc
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-10134 Add full support for DEFAULT
+#
+CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600));
+ERROR HY000: Function or expression 'binlog_gtid_pos()' cannot be used in the DEFAULT clause of `a`
+#
+# End of 10.2 tests
+#
+#
+# Start of 10.3 tests
+#
+#
+# MDEV-13967 Parameter data type control for Item_long_func
+#
+SELECT MASTER_GTID_WAIT(ROW(1,1),'str');
+ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
+SELECT MASTER_GTID_WAIT('str',ROW(1,1));
+ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test
index b9f5a18a588..b183c1d4b4e 100644
--- a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test
+++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_gtid_basic.inc
+--source suite/rpl/t/rpl_gtid_basic.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_incident.test b/mysql-test/suite/binlog_encryption/rpl_incident.test
index b6d2a24a71e..5a707774f3c 100644
--- a/mysql-test/suite/binlog_encryption/rpl_incident.test
+++ b/mysql-test/suite/binlog_encryption/rpl_incident.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_incident.inc
+--source suite/rpl/t/rpl_incident.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test
index 872b8cd3598..532db963e63 100644
--- a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test
+++ b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_init_slave_errors.inc
+--source suite/rpl/t/rpl_init_slave_errors.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test b/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test
index 9e0bb9598bf..35ad09647a6 100644
--- a/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test
+++ b/mysql-test/suite/binlog_encryption/rpl_loaddata_local.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_loaddata_local.inc
+--source suite/rpl/t/rpl_loaddata_local.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_loadfile.test b/mysql-test/suite/binlog_encryption/rpl_loadfile.test
index 84e6ecd7a0d..235c4a3d29e 100644
--- a/mysql-test/suite/binlog_encryption/rpl_loadfile.test
+++ b/mysql-test/suite/binlog_encryption/rpl_loadfile.test
@@ -1,4 +1,4 @@
---source suite/rpl/include/rpl_loadfile.inc
+--source suite/rpl/t/rpl_loadfile.test
--let $datadir= `SELECT @@datadir`
diff --git a/mysql-test/suite/binlog_encryption/rpl_packet.test b/mysql-test/suite/binlog_encryption/rpl_packet.test
index 43637314236..28beae1a91c 100644
--- a/mysql-test/suite/binlog_encryption/rpl_packet.test
+++ b/mysql-test/suite/binlog_encryption/rpl_packet.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_packet.inc
+--source suite/rpl/t/rpl_packet.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.test b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.test
index 8a26778c8f2..0c3e5386930 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.test
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_parallel_ignored_errors.inc
+--source suite/rpl/t/rpl_parallel_ignored_errors.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test
index 7bdfaaf9adb..e342e4d61ff 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel_show_binlog_events_purge_logs.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
+--source suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_relayrotate.test b/mysql-test/suite/binlog_encryption/rpl_relayrotate.test
index e52f5159fcc..a8dabdc3e8d 100644
--- a/mysql-test/suite/binlog_encryption/rpl_relayrotate.test
+++ b/mysql-test/suite/binlog_encryption/rpl_relayrotate.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_relayrotate.inc
+--source suite/rpl/t/rpl_relayrotate.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_semi_sync.test b/mysql-test/suite/binlog_encryption/rpl_semi_sync.test
index dfc68b699c0..2e0907cce30 100644
--- a/mysql-test/suite/binlog_encryption/rpl_semi_sync.test
+++ b/mysql-test/suite/binlog_encryption/rpl_semi_sync.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_semi_sync.inc
+--source suite/rpl/t/rpl_semi_sync.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_skip_replication.test b/mysql-test/suite/binlog_encryption/rpl_skip_replication.test
index 40992586c7c..11c5b33b362 100644
--- a/mysql-test/suite/binlog_encryption/rpl_skip_replication.test
+++ b/mysql-test/suite/binlog_encryption/rpl_skip_replication.test
@@ -1,2 +1,2 @@
--let $use_remote_mysqlbinlog= 1
---source suite/rpl/include/rpl_skip_replication.inc
+--source suite/rpl/t/rpl_skip_replication.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_special_charset.test b/mysql-test/suite/binlog_encryption/rpl_special_charset.test
index eb697204860..c74f8915798 100644
--- a/mysql-test/suite/binlog_encryption/rpl_special_charset.test
+++ b/mysql-test/suite/binlog_encryption/rpl_special_charset.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_special_charset.inc
+--source suite/rpl/t/rpl_special_charset.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test b/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test
index 0dab68a4b08..1e3992dc5d9 100644
--- a/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test
+++ b/mysql-test/suite/binlog_encryption/rpl_sporadic_master.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_sporadic_master.inc
+--source suite/rpl/t/rpl_sporadic_master.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_ssl.test b/mysql-test/suite/binlog_encryption/rpl_ssl.test
index 9a4788c1d2d..fb30d83ab5e 100644
--- a/mysql-test/suite/binlog_encryption/rpl_ssl.test
+++ b/mysql-test/suite/binlog_encryption/rpl_ssl.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_ssl.inc
+--source suite/rpl/t/rpl_ssl.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test
index 45d18a25410..d5a08bde969 100644
--- a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test
+++ b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_stm_relay_ign_space.inc
+--source suite/rpl/t/rpl_stm_relay_ign_space.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test
index 2a16d90f9ad..c65cc202ba2 100644
--- a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_switch_stm_row_mixed.inc
+--source suite/rpl/t/rpl_switch_stm_row_mixed.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_sync.test b/mysql-test/suite/binlog_encryption/rpl_sync.test
index 8dbd6ff254b..1ff72228565 100644
--- a/mysql-test/suite/binlog_encryption/rpl_sync.test
+++ b/mysql-test/suite/binlog_encryption/rpl_sync.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_sync_test.inc
+--source suite/rpl/t/rpl_sync.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test
index 30f5f247c23..5a9a79bad42 100644
--- a/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test
+++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_default_to_default.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_temporal_format_default_to_default.inc
+--source suite/rpl/t/rpl_temporal_format_default_to_default.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test
index 68afb4148ef..b9576b30f92 100644
--- a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test
+++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mariadb53_to_mysql56.test
@@ -3,4 +3,4 @@
--let $force_master_mysql56_temporal_format=false;
--let $force_slave_mysql56_temporal_format=true;
---source suite/rpl/include/rpl_temporal_format_default_to_default.inc
+--source suite/rpl/t/rpl_temporal_format_default_to_default.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test
index 96d928fcf08..7d09942814e 100644
--- a/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test
+++ b/mysql-test/suite/binlog_encryption/rpl_temporal_format_mysql56_to_mariadb53.test
@@ -1,4 +1,4 @@
--let $force_master_mysql56_temporal_format=true;
--let $force_slave_mysql56_temporal_format=false;
---source suite/rpl/include/rpl_temporal_format_default_to_default.inc
+--source suite/rpl/t/rpl_temporal_format_default_to_default.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_typeconv.test b/mysql-test/suite/binlog_encryption/rpl_typeconv.test
index fe56a148256..6761cddfb87 100644
--- a/mysql-test/suite/binlog_encryption/rpl_typeconv.test
+++ b/mysql-test/suite/binlog_encryption/rpl_typeconv.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_typeconv.inc
+--source suite/rpl/t/rpl_typeconv.test
diff --git a/mysql-test/suite/encryption/r/import_4k.result b/mysql-test/suite/encryption/r/import_4k.result
new file mode 100644
index 00000000000..959e2498e00
--- /dev/null
+++ b/mysql-test/suite/encryption/r/import_4k.result
@@ -0,0 +1,10 @@
+set @save_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug;
+set global innodb_limit_optimistic_insert_debug=3;
+create table t1 (a INT PRIMARY KEY) engine=InnoDB ENCRYPTED=YES;
+insert into t1 select * from seq_1_to_6000;
+flush table t1 for export;
+unlock tables;
+alter table t1 discard tablespace;
+alter table t1 import tablespace;
+set global innodb_limit_optimistic_insert_debug=@save_limit;
+drop table t1;
diff --git a/mysql-test/suite/encryption/t/import_4k.opt b/mysql-test/suite/encryption/t/import_4k.opt
new file mode 100644
index 00000000000..e5b58602036
--- /dev/null
+++ b/mysql-test/suite/encryption/t/import_4k.opt
@@ -0,0 +1 @@
+--innodb-page-size=4k
diff --git a/mysql-test/suite/encryption/t/import_4k.test b/mysql-test/suite/encryption/t/import_4k.test
new file mode 100644
index 00000000000..aef7c702d12
--- /dev/null
+++ b/mysql-test/suite/encryption/t/import_4k.test
@@ -0,0 +1,20 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+--source include/have_example_key_management_plugin.inc
+--source include/have_debug.inc
+
+set @save_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug;
+set global innodb_limit_optimistic_insert_debug=3;
+create table t1 (a INT PRIMARY KEY) engine=InnoDB ENCRYPTED=YES;
+insert into t1 select * from seq_1_to_6000;
+flush table t1 for export;
+--let $datadir= `select @@datadir`
+--copy_file $datadir/test/t1.ibd $datadir/t1.ibd
+--copy_file $datadir/test/t1.cfg $datadir/t1.cfg
+unlock tables;
+alter table t1 discard tablespace;
+--move_file $datadir/t1.ibd $datadir/test/t1.ibd
+--move_file $datadir/t1.cfg $datadir/test/t1.cfg
+alter table t1 import tablespace;
+set global innodb_limit_optimistic_insert_debug=@save_limit;
+drop table t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
index 2a16d90f9ad..c65cc202ba2 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
@@ -1 +1 @@
---source suite/rpl/include/rpl_switch_stm_row_mixed.inc
+--source suite/rpl/t/rpl_switch_stm_row_mixed.test
diff --git a/mysql-test/suite/events/disabled.def b/mysql-test/suite/events/disabled.def
new file mode 100644
index 00000000000..d895d7d221e
--- /dev/null
+++ b/mysql-test/suite/events/disabled.def
@@ -0,0 +1,12 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+events_time_zone : Test is not predictable as it depends on precise timing.
diff --git a/mysql-test/main/events_1.result b/mysql-test/suite/events/events_1.result
index 2f2a951158c..2f2a951158c 100644
--- a/mysql-test/main/events_1.result
+++ b/mysql-test/suite/events/events_1.result
diff --git a/mysql-test/main/events_1.test b/mysql-test/suite/events/events_1.test
index ba8a2059e2d..ba8a2059e2d 100644
--- a/mysql-test/main/events_1.test
+++ b/mysql-test/suite/events/events_1.test
diff --git a/mysql-test/main/events_2.result b/mysql-test/suite/events/events_2.result
index 1753fa41ad0..1753fa41ad0 100644
--- a/mysql-test/main/events_2.result
+++ b/mysql-test/suite/events/events_2.result
diff --git a/mysql-test/main/events_2.test b/mysql-test/suite/events/events_2.test
index cd0d908b870..cd0d908b870 100644
--- a/mysql-test/main/events_2.test
+++ b/mysql-test/suite/events/events_2.test
diff --git a/mysql-test/main/events_bugs-master.opt b/mysql-test/suite/events/events_bugs-master.opt
index f93413a61e5..f93413a61e5 100644
--- a/mysql-test/main/events_bugs-master.opt
+++ b/mysql-test/suite/events/events_bugs-master.opt
diff --git a/mysql-test/main/events_bugs.result b/mysql-test/suite/events/events_bugs.result
index 0615dac53b1..0615dac53b1 100644
--- a/mysql-test/main/events_bugs.result
+++ b/mysql-test/suite/events/events_bugs.result
diff --git a/mysql-test/main/events_bugs.test b/mysql-test/suite/events/events_bugs.test
index fe744de86c9..fe744de86c9 100644
--- a/mysql-test/main/events_bugs.test
+++ b/mysql-test/suite/events/events_bugs.test
diff --git a/mysql-test/main/events_embedded.result b/mysql-test/suite/events/events_embedded.result
index 1a02188f2df..1a02188f2df 100644
--- a/mysql-test/main/events_embedded.result
+++ b/mysql-test/suite/events/events_embedded.result
diff --git a/mysql-test/main/events_embedded.test b/mysql-test/suite/events/events_embedded.test
index c607573b2dc..c607573b2dc 100644
--- a/mysql-test/main/events_embedded.test
+++ b/mysql-test/suite/events/events_embedded.test
diff --git a/mysql-test/main/events_grant.result b/mysql-test/suite/events/events_grant.result
index 5952097a8d2..5952097a8d2 100644
--- a/mysql-test/main/events_grant.result
+++ b/mysql-test/suite/events/events_grant.result
diff --git a/mysql-test/main/events_grant.test b/mysql-test/suite/events/events_grant.test
index 2fe39a6cf2d..2fe39a6cf2d 100644
--- a/mysql-test/main/events_grant.test
+++ b/mysql-test/suite/events/events_grant.test
diff --git a/mysql-test/main/events_logs_tests-master.opt b/mysql-test/suite/events/events_logs_tests-master.opt
index 73d26b7260d..73d26b7260d 100644
--- a/mysql-test/main/events_logs_tests-master.opt
+++ b/mysql-test/suite/events/events_logs_tests-master.opt
diff --git a/mysql-test/main/events_logs_tests.result b/mysql-test/suite/events/events_logs_tests.result
index d332767a9f1..d332767a9f1 100644
--- a/mysql-test/main/events_logs_tests.result
+++ b/mysql-test/suite/events/events_logs_tests.result
diff --git a/mysql-test/main/events_logs_tests.test b/mysql-test/suite/events/events_logs_tests.test
index f7445352079..f7445352079 100644
--- a/mysql-test/main/events_logs_tests.test
+++ b/mysql-test/suite/events/events_logs_tests.test
diff --git a/mysql-test/main/events_microsec.result b/mysql-test/suite/events/events_microsec.result
index 2a9f3587706..2a9f3587706 100644
--- a/mysql-test/main/events_microsec.result
+++ b/mysql-test/suite/events/events_microsec.result
diff --git a/mysql-test/main/events_microsec.test b/mysql-test/suite/events/events_microsec.test
index 3e9abf6ec56..3e9abf6ec56 100644
--- a/mysql-test/main/events_microsec.test
+++ b/mysql-test/suite/events/events_microsec.test
diff --git a/mysql-test/main/events_restart-master.opt b/mysql-test/suite/events/events_restart-master.opt
index f93413a61e5..f93413a61e5 100644
--- a/mysql-test/main/events_restart-master.opt
+++ b/mysql-test/suite/events/events_restart-master.opt
diff --git a/mysql-test/main/events_restart.result b/mysql-test/suite/events/events_restart.result
index 58401c7be80..58401c7be80 100644
--- a/mysql-test/main/events_restart.result
+++ b/mysql-test/suite/events/events_restart.result
diff --git a/mysql-test/main/events_restart.test b/mysql-test/suite/events/events_restart.test
index 6f7c01d81c2..6f7c01d81c2 100644
--- a/mysql-test/main/events_restart.test
+++ b/mysql-test/suite/events/events_restart.test
diff --git a/mysql-test/main/events_scheduling.result b/mysql-test/suite/events/events_scheduling.result
index 262caea3d7f..262caea3d7f 100644
--- a/mysql-test/main/events_scheduling.result
+++ b/mysql-test/suite/events/events_scheduling.result
diff --git a/mysql-test/main/events_scheduling.test b/mysql-test/suite/events/events_scheduling.test
index 5f16f8bea6a..5f16f8bea6a 100644
--- a/mysql-test/main/events_scheduling.test
+++ b/mysql-test/suite/events/events_scheduling.test
diff --git a/mysql-test/main/events_slowlog.result b/mysql-test/suite/events/events_slowlog.result
index be0a1e78d2a..be0a1e78d2a 100644
--- a/mysql-test/main/events_slowlog.result
+++ b/mysql-test/suite/events/events_slowlog.result
diff --git a/mysql-test/main/events_slowlog.test b/mysql-test/suite/events/events_slowlog.test
index 9679714dba3..9679714dba3 100644
--- a/mysql-test/main/events_slowlog.test
+++ b/mysql-test/suite/events/events_slowlog.test
diff --git a/mysql-test/main/events_stress.result b/mysql-test/suite/events/events_stress.result
index 1a91ff0f528..1a91ff0f528 100644
--- a/mysql-test/main/events_stress.result
+++ b/mysql-test/suite/events/events_stress.result
diff --git a/mysql-test/main/events_stress.test b/mysql-test/suite/events/events_stress.test
index 080707f029f..080707f029f 100644
--- a/mysql-test/main/events_stress.test
+++ b/mysql-test/suite/events/events_stress.test
diff --git a/mysql-test/main/events_time_zone.result b/mysql-test/suite/events/events_time_zone.result
index 155a9d155af..155a9d155af 100644
--- a/mysql-test/main/events_time_zone.result
+++ b/mysql-test/suite/events/events_time_zone.result
diff --git a/mysql-test/main/events_time_zone.test b/mysql-test/suite/events/events_time_zone.test
index 5291eb96e6b..5291eb96e6b 100644
--- a/mysql-test/main/events_time_zone.test
+++ b/mysql-test/suite/events/events_time_zone.test
diff --git a/mysql-test/main/events_trans.result b/mysql-test/suite/events/events_trans.result
index a7b268fe2a7..a7b268fe2a7 100644
--- a/mysql-test/main/events_trans.result
+++ b/mysql-test/suite/events/events_trans.result
diff --git a/mysql-test/main/events_trans.test b/mysql-test/suite/events/events_trans.test
index cc83fa6e578..cc83fa6e578 100644
--- a/mysql-test/main/events_trans.test
+++ b/mysql-test/suite/events/events_trans.test
diff --git a/mysql-test/main/events_trans_notembedded.result b/mysql-test/suite/events/events_trans_notembedded.result
index 324e28ddb62..324e28ddb62 100644
--- a/mysql-test/main/events_trans_notembedded.result
+++ b/mysql-test/suite/events/events_trans_notembedded.result
diff --git a/mysql-test/main/events_trans_notembedded.test b/mysql-test/suite/events/events_trans_notembedded.test
index 3cf823bf713..3cf823bf713 100644
--- a/mysql-test/main/events_trans_notembedded.test
+++ b/mysql-test/suite/events/events_trans_notembedded.test
diff --git a/mysql-test/suite/galera/galera_2x2nodes.cnf b/mysql-test/suite/galera/galera_2x2nodes.cnf
new file mode 100644
index 00000000000..922906eac6f
--- /dev/null
+++ b/mysql-test/suite/galera/galera_2x2nodes.cnf
@@ -0,0 +1,77 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+loose-innodb
+log-bin=mysqld-bin
+log-slave-updates
+binlog-format=row
+innodb-autoinc-lock-mode=2
+default-storage-engine=innodb
+wsrep_gtid_mode=1
+gtid_ignore_duplicates
+auto_increment_increment=3
+
+wsrep-provider=@ENV.WSREP_PROVIDER
+# enforce read-committed characteristics across the cluster
+# wsrep-causal-reads=ON
+wsrep-sync-wait=15
+
+[mysqld.1]
+wsrep-on=1
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address=gcomm://
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
+wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+
+[mysqld.2]
+wsrep-on=1
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
+wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
+
+[mysqld.3]
+wsrep-on=1
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address=gcomm://
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
+wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+
+[mysqld.4]
+wsrep-on=1
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.3.#galera_port'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
+wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port'
+wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
+wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_MYPORT_4= @mysqld.4.port
+NODE_MYSOCK_4= @mysqld.4.socket
+
+
diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc
index 56118df84f9..28a1b0f368c 100644
--- a/mysql-test/suite/galera/include/kill_galera.inc
+++ b/mysql-test/suite/galera/include/kill_galera.inc
@@ -6,8 +6,8 @@ if (!$kill_signal)
}
# Write file to make mysql-test-run.pl expect the crash, but don't start it
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
# Kill the connected server
diff --git a/mysql-test/suite/galera/include/shutdown_mysqld.inc b/mysql-test/suite/galera/include/shutdown_mysqld.inc
index 54bba1318e7..793be8d76ac 100644
--- a/mysql-test/suite/galera/include/shutdown_mysqld.inc
+++ b/mysql-test/suite/galera/include/shutdown_mysqld.inc
@@ -8,8 +8,8 @@ if ($rpl_inited)
}
# Write file to make mysql-test-run.pl expect the "crash", but don't start it
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
# Send shutdown to the connected server
diff --git a/mysql-test/suite/galera/r/MDEV-30804.result b/mysql-test/suite/galera/r/MDEV-30804.result
new file mode 100644
index 00000000000..2bf323d19f8
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-30804.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (a INT) ENGINE=Aria;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t VALUES ('1');
+INSERT INTO t1 VALUES ('1');
+COMMIT;
+ERROR HY000: Transactional commit not supported by involved engine(s)
+DROP TABLE t;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-30955.result b/mysql-test/suite/galera/r/MDEV-30955.result
new file mode 100644
index 00000000000..2a090cb58bc
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-30955.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (a CHAR(1) KEY);
+START TRANSACTION;
+HANDLER t OPEN;
+disconnect node_1;
+connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+DROP TABLE t;
+BACKUP STAGE START;
+START TRANSACTION;
+disconnect node_1;
+connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+HANDLER t2 OPEN;
+connection node_2;
+INSERT INTO t1 VALUES(1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/r/galera_query_cache_invalidate.result b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result
new file mode 100644
index 00000000000..98438b3b527
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result
@@ -0,0 +1,119 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_2;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+connection node_4;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+connection node_3;
+CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;;
+START SLAVE;
+include/wait_for_slave_to_start.inc
+connection node_1;
+CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
+SET AUTOCOMMIT=1;
+INSERT INTO t1 VALUES (4000000, 'foobar');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+50001
+connection node_3;
+connection node_1;
+# node_1
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_2;
+# node_2
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_3;
+# node_3
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_4;
+# node_4
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_1;
+# node_1 insert new
+INSERT INTO t1 values (5000000, 'foobar');
+connection node_3;
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_2;
+# node_2
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_3;
+# node_3
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_4;
+# node_4
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_2;
+# node_3 different query same table
+SELECT id, msg FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_4;
+# node_6 different query same table
+SELECT id, msg FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_1;
+drop table t1;
+connection node_3;
+connection node_3;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_1;
+SET SESSION WSREP_ON=OFF;
+RESET MASTER;
+SET SESSION WSREP_ON=ON;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result
index 7276cb8dbde..da669e6774e 100644
--- a/mysql-test/suite/galera/r/galera_sequences.result
+++ b/mysql-test/suite/galera/r/galera_sequences.result
@@ -1,6 +1,11 @@
connection node_2;
connection node_1;
connection node_1;
+CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure");
+connection node_2;
+CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+connection node_1;
CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
SHOW CREATE SEQUENCE seq;
Table Create Table
@@ -47,6 +52,58 @@ NEXT VALUE FOR Seq1_1
3001
connection node_1;
DROP SEQUENCE Seq1_1;
-CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+connection node_1;
+CREATE TABLE t2 (d CHAR(1)KEY);
+SET SESSION autocommit=0;
+INSERT INTO t2 VALUES(1);
+CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB;
+CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB;
+COMMIT;
+SET SESSION AUTOCOMMIT=1;
+SHOW CREATE TABLE seq1;
+Table Create Table
+seq1 CREATE TEMPORARY TABLE `seq1` (
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
+ `increment` bigint(21) NOT NULL COMMENT 'increment value',
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
+) ENGINE=InnoDB SEQUENCE=1
connection node_2;
-CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+SHOW CREATE SEQUENCE seq1;
+ERROR 42S02: Table 'test.seq1' doesn't exist
+SHOW CREATE SEQUENCE seq2;
+Table Create Table
+seq2 CREATE SEQUENCE `seq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+connection node_1;
+SET SESSION autocommit=1;
+DROP SEQUENCE seq1;
+DROP SEQUENCE seq2;
+DROP TABLE t2;
+SET SESSION AUTOCOMMIT=0;
+SET SESSION wsrep_OSU_method='RSU';
+CREATE TABLE t1(c1 VARCHAR(10));
+INSERT INTO t1 (c1) VALUES('');
+create temporary sequence sq1 NOCACHE engine=innodb;
+create sequence sq2 NOCACHE engine=innodb;
+COMMIT;
+SHOW CREATE SEQUENCE sq1;
+Table Create Table
+sq1 CREATE SEQUENCE `sq1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+SHOW CREATE SEQUENCE sq2;
+Table Create Table
+sq2 CREATE SEQUENCE `sq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+connection node_2;
+SHOW CREATE SEQUENCE sq1;
+ERROR 42S02: Table 'test.sq1' doesn't exist
+SHOW CREATE SEQUENCE sq2;
+ERROR 42S02: Table 'test.sq2' doesn't exist
+connection node_1;
+SET SESSION AUTOCOMMIT=1;
+DROP TABLE t1;
+DROP SEQUENCE sq1;
+DROP SEQUENCE sq2;
+SET SESSION wsrep_OSU_method='TOI';
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result b/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result
index 39fd748314c..91c07ba6681 100644
--- a/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result
+++ b/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result
@@ -89,11 +89,8 @@ connection node_1;
SET GLOBAL wsrep_sync_wait=15;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=Aria;
CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
-COMMIT;
connection node_2;
SET GLOBAL wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
@@ -103,6 +100,7 @@ SELECT COUNT(*) AS EXPECT_1 FROM t2;
EXPECT_1
1
connection node_1;
+SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (2);
INSERT INTO t2 VALUES (2);
@@ -129,6 +127,7 @@ INSERT INTO t1 VALUES (1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
connection node_1;
COMMIT;
+ERROR HY000: Transactional commit not supported by involved engine(s)
DROP TABLE t1,t2;
connection node_1;
CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB;
diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
index 56c2c995402..50667b0a4fa 100644
--- a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
+++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
@@ -20,17 +20,25 @@ DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
INSERT INTO t1 (f1) VALUES (3);
connection node_1a;
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
-connection node_1;
+connection node_1a;
+SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
+SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
SET DEBUG_SYNC = 'RESET';
+SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
@@ -64,6 +72,8 @@ SET SESSION wsrep_retry_autocommit = 64;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
INSERT INTO t1 VALUES (5);
+connection node_2;
+connection node_1;
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
diff --git a/mysql-test/suite/galera/r/mdev-26175.result b/mysql-test/suite/galera/r/mdev-26175.result
new file mode 100644
index 00000000000..f84244fe916
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-26175.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET sql_mode="no_zero_date";
+SET GLOBAL wsrep_max_ws_rows=1;
+CREATE TABLE t2 (a INT);
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0);
+INSERT INTO t1 VALUES (0),(1);
+ERROR HY000: wsrep_max_ws_rows exceeded
+SELECT * FROM t1;
+a
+SELECT * FROM t2;
+a
+connection node_2;
+SELECT * FROM t1;
+a
+SELECT * FROM t2;
+a
+connection node_1;
+SET sql_mode=DEFAULT;
+SET GLOBAL wsrep_max_ws_rows=DEFAULT;
+DROP TRIGGER tgr;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/t/MDEV-30804.cnf b/mysql-test/suite/galera/t/MDEV-30804.cnf
new file mode 100644
index 00000000000..9dbd81f758d
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-30804.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+
+[mysqld.2]
+log-bin
diff --git a/mysql-test/suite/galera/t/MDEV-30804.test b/mysql-test/suite/galera/t/MDEV-30804.test
new file mode 100644
index 00000000000..561953a0578
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-30804.test
@@ -0,0 +1,21 @@
+#
+# Test that transaction requiring two-phase commit and involving
+# storage engines not supporting it rolls back with a message.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_aria.inc
+
+CREATE TABLE t (a INT) ENGINE=Aria;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+
+START TRANSACTION;
+INSERT INTO t VALUES ('1');
+INSERT INTO t1 VALUES ('1');
+
+--error ER_ERROR_DURING_COMMIT
+COMMIT;
+
+DROP TABLE t;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MDEV-30955.test b/mysql-test/suite/galera/t/MDEV-30955.test
new file mode 100644
index 00000000000..18577120e83
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-30955.test
@@ -0,0 +1,70 @@
+#
+# MDEV-30955
+# Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE,
+# table->s->db.str, table->s->table_name.str, MDL_SHARED)'
+# failed in close_thread_table()
+#
+
+--source include/galera_cluster.inc
+
+#
+# Test 1: Assertion thd->mdl_context.is_lock_owner()
+# failed in close_thread_table()
+#
+CREATE TABLE t (a CHAR(1) KEY);
+START TRANSACTION;
+HANDLER t OPEN;
+
+#
+# If bug is present the transaction will be aborted
+# through Wsrep_client_service::bf_rollback() and
+# release explicit locks too early. Later, during
+# THD::cleanup(), table t will be closed and the
+# THD is expected to be owner of the MDL lock that
+# was just released.
+#
+--disconnect node_1
+
+--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
+DROP TABLE t;
+
+
+#
+# Test 2: Similar issue reproduces also with BACKUP STAGE locks.
+# See comments in MDEV-25037
+#
+
+BACKUP STAGE START;
+START TRANSACTION;
+--disconnect node_1
+--connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+
+#
+# Test 3: Assertion `!thd->mdl_context.has_locks()' failed
+# in do_command()
+#
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
+
+--let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+HANDLER t2 OPEN;
+
+--connection node_2
+INSERT INTO t1 VALUES(1);
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'
+--source include/wait_condition.inc
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
index c535ac455b9..b36a0de57b6 100644
--- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
+++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
@@ -35,8 +35,8 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
--connection node_2
# Write file to make mysql-test-run.pl expect the crash, but don't start it
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf b/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf
new file mode 100644
index 00000000000..49269422a35
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.cnf
@@ -0,0 +1,25 @@
+!include ../galera_2x2nodes.cnf
+
+[mysqld.1]
+wsrep_gtid_domain_id=1
+server-id=11
+query_cache_type=1
+query_cache_size=15M
+
+[mysqld.2]
+wsrep_gtid_domain_id=1
+server-id=12
+query_cache_type=1
+query_cache_size=15M
+
+[mysqld.3]
+wsrep_gtid_domain_id=2
+server-id=13
+query_cache_type=1
+query_cache_size=15M
+
+[mysqld.4]
+wsrep_gtid_domain_id=2
+server-id=21
+query_cache_type=1
+query_cache_size=15M
diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test
new file mode 100644
index 00000000000..d72d8a9ba40
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test
@@ -0,0 +1,120 @@
+--source include/big_test.inc
+--source include/force_restart.inc
+--source include/galera_cluster.inc
+--source include/have_sequence.inc
+
+#
+# MDEV-28641 : Query cache entries not invalidated on slave of a Galera cluster
+#
+# We use two 2-node galera clusters as follows
+#
+# A(1) <-> B(2) {Galera cluster 1}
+# | {Async replication}
+# D(3) <-> E(4) {Galera cluster 2}
+#
+# Normal asyncronous replication is used between nodes 1 and 3
+# so that node_1 is master and node_3 a slave.
+#
+# In this test we can't test is some query fast or slow but we can
+# test does all nodes see all rows (this is not true before fix)
+#
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+
+--connection node_2
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+--connection node_4
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+
+--connection node_3
+
+--replace_result $NODE_MYPORT_1 NODE_MYPORT_1
+--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos;
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+--connection node_1
+
+CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
+--disable_query_log
+INSERT INTO t1 SELECT seq, md5(rand()) from seq_1_to_50000;
+COMMIT;
+--enable_query_log
+SET AUTOCOMMIT=1;
+INSERT INTO t1 VALUES (4000000, 'foobar');
+SELECT COUNT(*) FROM t1;
+--sync_slave_with_master node_3
+
+#
+# All nodes should see one row and first query is slow and second fast
+#
+--connection node_1
+--echo # node_1
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+--connection node_2
+--echo # node_2
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+--connection node_3
+--echo # node_3
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+--connection node_4
+--echo # node_4
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+#
+# Insert a new row in master, this should cause query cache
+# invalidation
+#
+--connection node_1
+--echo # node_1 insert new
+INSERT INTO t1 values (5000000, 'foobar');
+--sync_slave_with_master node_3
+
+#
+# All nodes should see 2 rows
+#
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+
+--connection node_2
+--echo # node_2
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+--connection node_3
+--echo # node_3
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+--connection node_4
+--echo # node_4
+SELECT * FROM t1 WHERE msg='foobar';
+SELECT * FROM t1 WHERE msg='foobar';
+
+--connection node_2
+--echo # node_3 different query same table
+SELECT id, msg FROM t1 WHERE msg='foobar';
+
+--connection node_4
+--echo # node_6 different query same table
+SELECT id, msg FROM t1 WHERE msg='foobar';
+
+#
+# Cleanup
+#
+--connection node_1
+drop table t1;
+--sync_slave_with_master node_3
+
+--connection node_3
+STOP SLAVE;
+RESET SLAVE ALL;
+
+--connection node_1
+SET SESSION WSREP_ON=OFF;
+RESET MASTER;
+SET SESSION WSREP_ON=ON;
+
+--source include/galera_end.inc
+--echo # End of test
diff --git a/mysql-test/suite/galera/t/galera_sequences.cnf b/mysql-test/suite/galera/t/galera_sequences.cnf
new file mode 100644
index 00000000000..98e724fb2d0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sequences.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test
index d469cc73516..613823d83e9 100644
--- a/mysql-test/suite/galera/t/galera_sequences.test
+++ b/mysql-test/suite/galera/t/galera_sequences.test
@@ -1,10 +1,18 @@
--source include/galera_cluster.inc
+--source include/have_innodb.inc
#
# MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster
#
--connection node_1
+CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+CALL mtr.add_suppression("WSREP: CREATE TABLE isolation failure");
+--connection node_2
+
+CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+
+--connection node_1
CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
SHOW CREATE SEQUENCE seq;
@@ -45,8 +53,48 @@ select NEXT VALUE FOR Seq1_1;
--connection node_1
DROP SEQUENCE Seq1_1;
-CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+#
+# MDEV-24045 : Assertion client_state_.mode() != wsrep::client_state::m_toi failed in int wsrep::transaction::before_commit()
+#
+--connection node_1
+CREATE TABLE t2 (d CHAR(1)KEY);
+SET SESSION autocommit=0;
+INSERT INTO t2 VALUES(1);
+CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB;
+CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB;
+COMMIT;
+SET SESSION AUTOCOMMIT=1;
+SHOW CREATE TABLE seq1;
--connection node_2
-
-CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
+--error ER_NO_SUCH_TABLE
+SHOW CREATE SEQUENCE seq1;
+SHOW CREATE SEQUENCE seq2;
+--connection node_1
+SET SESSION autocommit=1;
+DROP SEQUENCE seq1;
+DROP SEQUENCE seq2;
+DROP TABLE t2;
+#
+# Case2
+#
+SET SESSION AUTOCOMMIT=0;
+SET SESSION wsrep_OSU_method='RSU';
+CREATE TABLE t1(c1 VARCHAR(10));
+INSERT INTO t1 (c1) VALUES('');
+create temporary sequence sq1 NOCACHE engine=innodb;
+create sequence sq2 NOCACHE engine=innodb;
+COMMIT;
+SHOW CREATE SEQUENCE sq1;
+SHOW CREATE SEQUENCE sq2;
+--connection node_2
+--error ER_NO_SUCH_TABLE
+SHOW CREATE SEQUENCE sq1;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE SEQUENCE sq2;
+--connection node_1
+SET SESSION AUTOCOMMIT=1;
+DROP TABLE t1;
+DROP SEQUENCE sq1;
+DROP SEQUENCE sq2;
+SET SESSION wsrep_OSU_method='TOI';
diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test
index c3bc53ee17f..ac9a79e6196 100644
--- a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test
+++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test
@@ -85,18 +85,15 @@ SELECT * FROM t1;
DROP TABLE t1;
#
-# Transaction
+# Preparation for next tests
#
--connection node_1
SET GLOBAL wsrep_sync_wait=15;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=Aria;
CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
-COMMIT;
--connection node_2
SET GLOBAL wsrep_sync_wait=15;
@@ -108,6 +105,7 @@ SELECT COUNT(*) AS EXPECT_1 FROM t2;
#
--connection node_1
+SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (2);
INSERT INTO t2 VALUES (2);
@@ -138,6 +136,8 @@ INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1);
--connection node_1
+
+--error ER_ERROR_DURING_COMMIT
COMMIT;
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
index bd10e448e06..c58eba1410e 100644
--- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
+++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
@@ -25,6 +25,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
+--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+--source include/wait_condition.inc
TRUNCATE TABLE t1;
--connection node_1
@@ -44,6 +46,7 @@ DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
--send INSERT INTO t1 (f1) VALUES (3)
@@ -51,14 +54,21 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
+--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+--source include/wait_condition.inc
TRUNCATE TABLE t1;
+--connection node_1a
+SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
+SELECT COUNT(*) FROM t1;
+SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
+
--connection node_1
---error 0,ER_LOCK_DEADLOCK
--reap
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'RESET';
+SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
@@ -79,6 +89,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2
+--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+--source include/wait_condition.inc
TRUNCATE TABLE t1;
--connection node_1a
@@ -114,6 +126,11 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
--send INSERT INTO t1 VALUES (5)
+--connection node_2
+--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
+--source include/wait_condition.inc
+
+--connection node_1
--disable_query_log
--disable_result_log
--let $count = 64
diff --git a/mysql-test/suite/galera/t/mdev-26175.test b/mysql-test/suite/galera/t/mdev-26175.test
new file mode 100644
index 00000000000..1a3f1153e03
--- /dev/null
+++ b/mysql-test/suite/galera/t/mdev-26175.test
@@ -0,0 +1,27 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# MDEV-26175 : Assertion `! thd->in_sub_stmt' failed in bool trans_rollback_stmt(THD*)
+#
+--connection node_1
+SET sql_mode="no_zero_date";
+SET GLOBAL wsrep_max_ws_rows=1;
+CREATE TABLE t2 (a INT);
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0);
+
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES (0),(1);
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--connection node_2
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--connection node_1
+SET sql_mode=DEFAULT;
+SET GLOBAL wsrep_max_ws_rows=DEFAULT;
+DROP TRIGGER tgr;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
index 9f99adbd711..cd7a892f4c9 100644
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@ -55,7 +55,7 @@ wsrep-on=1
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
-wsrep_cluster_address='gcomm://
+wsrep_cluster_address=gcomm://
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
index eb7f5603452..ab8b62b969a 100644
--- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
@@ -15,8 +15,8 @@
--connection node_2
SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal";
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/galera_sr/r/MDEV-30838.result b/mysql-test/suite/galera_sr/r/MDEV-30838.result
new file mode 100644
index 00000000000..6997b9c4d5d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/MDEV-30838.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
+INSERT INTO t1 VALUES(2);
+ERROR HY000: Error while appending streaming replication fragment
+COMMIT;
+SELECT * FROM t1;
+f1
+SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
+DROP TABLE t1;
+CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
diff --git a/mysql-test/suite/galera_sr/r/MDEV-30862.result b/mysql-test/suite/galera_sr/r/MDEV-30862.result
new file mode 100644
index 00000000000..43da77f24df
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/MDEV-30862.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+SET autocommit=0;
+SET SESSION wsrep_trx_fragment_size=1;
+CREATE TABLE t2 SELECT seq FROM seq_1_to_50;
+ERROR 42000: CREATE TABLE AS SELECT is not supported with streaming replication
+CREATE TABLE t1 (f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES(DEFAULT);
+CREATE TABLE t2 SELECT * FROM t1;
+ERROR 42000: CREATE TABLE AS SELECT is not supported with streaming replication
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/MDEV-30838.test b/mysql-test/suite/galera_sr/t/MDEV-30838.test
new file mode 100644
index 00000000000..39ca7d2a375
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/MDEV-30838.test
@@ -0,0 +1,18 @@
+#
+# MDEV-30838 - Assertion `m_thd == _current_thd()' failed in
+# virtual int Wsrep_client_service::bf_rollback()
+#
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+SET SESSION wsrep_trx_fragment_size=1;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 VALUES(2);
+COMMIT;
+SELECT * FROM t1;
+SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
+DROP TABLE t1;
+CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
diff --git a/mysql-test/suite/galera_sr/t/MDEV-30862.test b/mysql-test/suite/galera_sr/t/MDEV-30862.test
new file mode 100644
index 00000000000..6be77b4d71b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/MDEV-30862.test
@@ -0,0 +1,24 @@
+#
+# MDEV-30862 Assertion `mode_ == m_high_priority' failed in
+# void wsrep::client_state::after_applying()
+#
+
+--source include/galera_cluster.inc
+--source include/have_sequence.inc
+
+SET autocommit=0;
+SET SESSION wsrep_trx_fragment_size=1;
+--error ER_NOT_ALLOWED_COMMAND
+CREATE TABLE t2 SELECT seq FROM seq_1_to_50;
+
+
+#
+# Same test without using seq
+#
+CREATE TABLE t1 (f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES(DEFAULT);
+--error ER_NOT_ALLOWED_COMMAND
+CREATE TABLE t2 SELECT * FROM t1;
+
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/r/gcol_rollback.result b/mysql-test/suite/gcol/r/gcol_rollback.result
index 5ee94d3ef44..0bbf034122b 100644
--- a/mysql-test/suite/gcol/r/gcol_rollback.result
+++ b/mysql-test/suite/gcol/r/gcol_rollback.result
@@ -79,10 +79,29 @@ a b c d
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml_done';
connection con1;
-disconnect con1;
connection default;
SELECT * FROM t;
a b d
9 10 29
DROP TABLE t;
SET DEBUG_SYNC = 'RESET';
+#
+# MDEV-30597 Assertion `flag == 1' failed in
+# row_build_index_entry_low
+#
+CREATE TABLE t1 (
+col1 INT PRIMARY KEY, col_text TEXT,
+col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499))
+) ENGINE = InnoDB ROW_FORMAT = Compact;
+connection con1;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+INSERT INTO t1 (col1) VALUES (1) ;
+DELETE FROM t1 WHERE col1 = 1;
+ALTER TABLE t1 ADD UNIQUE INDEX (col_text_g(9));
+BEGIN;
+INSERT INTO t1 (col1) VALUES (1);
+ROLLBACK;
+disconnect con1;
+DROP TABLE t1;
+# End of 10.4 tests
diff --git a/mysql-test/suite/gcol/t/gcol_rollback.test b/mysql-test/suite/gcol/t/gcol_rollback.test
index ba88dda45d7..888e6be861e 100644
--- a/mysql-test/suite/gcol/t/gcol_rollback.test
+++ b/mysql-test/suite/gcol/t/gcol_rollback.test
@@ -103,7 +103,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml_done';
connection con1;
reap;
-disconnect con1;
connection default;
SELECT * FROM t;
@@ -111,5 +110,27 @@ SELECT * FROM t;
DROP TABLE t;
SET DEBUG_SYNC = 'RESET';
+--echo #
+--echo # MDEV-30597 Assertion `flag == 1' failed in
+--echo # row_build_index_entry_low
+--echo #
+CREATE TABLE t1 (
+col1 INT PRIMARY KEY, col_text TEXT,
+col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499))
+) ENGINE = InnoDB ROW_FORMAT = Compact;
+connection con1;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+INSERT INTO t1 (col1) VALUES (1) ;
+DELETE FROM t1 WHERE col1 = 1;
+ALTER TABLE t1 ADD UNIQUE INDEX (col_text_g(9));
+BEGIN;
+INSERT INTO t1 (col1) VALUES (1);
+ROLLBACK;
+disconnect con1;
+DROP TABLE t1;
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+
+--echo # End of 10.4 tests
diff --git a/mysql-test/suite/innodb/r/default_row_format_alter.result b/mysql-test/suite/innodb/r/default_row_format_alter.result
index 42cbab8a5f2..33936b59003 100644
--- a/mysql-test/suite/innodb/r/default_row_format_alter.result
+++ b/mysql-test/suite/innodb/r/default_row_format_alter.result
@@ -129,5 +129,25 @@ SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
Dynamic
DROP TABLE t1;
+#
+# MDEV-31025 Redundant table alter fails when fixed column
+# stored externally
+#
+set @old_sql_mode = @@sql_mode;
+SET @@sql_mode='';
+CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255),
+c4 char(255), c5 char(255), c6 char(255),
+c7 char(255), c8 char(255), primary key(pk)
+)Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT;
+INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255));
+ALTER TABLE t1 FORCE;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT LENGTH(c) FROM t1;
+LENGTH(c)
+1020
+DROP TABLE t1;
+set @@sql_mode = @old_sql_mode;
# End of 10.4 tests
SET GLOBAL innodb_default_row_format = @row_format;
diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result
index 99f11548420..32964be46d4 100644
--- a/mysql-test/suite/innodb/r/full_crc32_import.result
+++ b/mysql-test/suite/innodb/r/full_crc32_import.result
@@ -177,6 +177,17 @@ UNLOCK TABLES;
SET GLOBAL innodb_compression_algorithm=0;
ALTER TABLE t1 FORCE;
ALTER TABLE t1 DISCARD TABLESPACE;
+# Display the discarded table name by using SPACE and PAGE_NO
+# column in INNODB_SYS_INDEXES and discard doesn't affect the
+# SPACE in INNODB_SYS_TABLES
+SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE
+FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t
+WHERE t.TABLE_ID IN (
+SELECT i.TABLE_ID FROM
+INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE
+i.PAGE_NO IS NULL and i.SPACE IS NULL);
+NAME SYS_TABLE_SPACE_RANGE
+test/t1 1
db.opt
t1.frm
restore: t1 .ibd and .cfg files
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result
index 819ca949c88..2733809e0bd 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522.result
@@ -64,16 +64,24 @@ a b c
# Done restarting server
# List before t1 DISCARD
db.opt
+t1.cfg.sav
t1.frm
t1.ibd
+t1.ibd.sav
+t2.cfg.sav
t2.frm
t2.ibd
+t2.ibd.sav
ALTER TABLE t1 DISCARD TABLESPACE;
# List after t1 DISCARD
db.opt
+t1.cfg.sav
t1.frm
+t1.ibd.sav
+t2.cfg.sav
t2.frm
t2.ibd
+t2.ibd.sav
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB;
SELECT COUNT(*) FROM t1;
@@ -91,10 +99,14 @@ a b c
638 Cavalry ..asdasdfaeraf
db.opt
t1.cfg
+t1.cfg.sav
t1.frm
t1.ibd
+t1.ibd.sav
+t2.cfg.sav
t2.frm
t2.ibd
+t2.ibd.sav
SELECT COUNT(*) FROM t1;
COUNT(*)
640
@@ -113,7 +125,9 @@ ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 DISCARD TABLESPACE;
# List after t2 DISCARD
db.opt
+t2.cfg.sav
t2.frm
+t2.ibd.sav
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT)
ALTER TABLE t2 IMPORT TABLESPACE;
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result
index d9f5e4dfeed..fa17487df97 100644
--- a/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result
@@ -2,13 +2,11 @@ CREATE TABLE tab5 (col1 int auto_increment primary key,
col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab5(col2(10));
CREATE INDEX idx2 ON tab5(col3(10));
-SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100;
SET GLOBAL innodb_buffer_pool_dump_pct=100;
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
-SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool1;
SET GLOBAL innodb_buffer_pool_dump_pct=1;
SELECT @@global.innodb_buffer_pool_dump_pct;
@@global.innodb_buffer_pool_dump_pct
@@ -18,5 +16,4 @@ FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT;
-SET GLOBAL innodb_buffer_pool_filename=DEFAULT;
DROP TABLE tab5;
diff --git a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result
index 5f29fad8a1c..3ce1d3a1d53 100644
--- a/mysql-test/suite/innodb/r/innodb_ctype_utf8.result
+++ b/mysql-test/suite/innodb/r/innodb_ctype_utf8.result
@@ -283,3 +283,101 @@ DROP TABLE t1;
#
# End of 10.2 tests
#
+#
+# Start of 10.4 tests
+#
+SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci;
+#
+# MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations
+#
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a TEXT COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a TEXT COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a VARCHAR(2000) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(2000) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+ERROR 23000: Duplicate entry 'ß ' for key 'a'
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)))',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+EXECUTE IMMEDIATE REPLACE(
+'CREATE TABLE t1 ( '
+ ' a CHAR(20) COLLATE <COLLATION>,'
+ 'UNIQUE(a(3)) USING HASH)',
+'<COLLATION>', @@collation_connection);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci DEFAULT NULL,
+ UNIQUE KEY `a` (`a`(3)) USING HASH
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 VALUES ('ss ');
+INSERT INTO t1 VALUES (_utf8mb3 0xC39F20)/*SZ+SPACE*/;
+DROP TABLE t1;
+#
+# End 10.4 tests
+#
diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
index b51a7fb3f6d..8cc2a11545f 100644
--- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
+++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result
@@ -151,8 +151,8 @@ trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NUL
trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back
trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint
trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list
-trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used
-trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached
+trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of undo slots used
+trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of undo slots cached
trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current rollback segment size in pages
purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of delete-marked rows purged
purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of purges on updates of existing records and updates on delete marked record with externally stored field
diff --git a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
index 32d87b4668a..6932b8f2292 100644
--- a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
+++ b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
@@ -25,27 +25,6 @@ select @@innodb_ft_server_stopword_table;
@@innodb_ft_server_stopword_table
NULL
drop table user_stopword_1, user_stopword_2;
-select @@innodb_buffer_pool_filename;
-@@innodb_buffer_pool_filename
-ib_buffer_pool
-set @blah='hello';
-set global innodb_buffer_pool_filename = @blah;
-select @@innodb_buffer_pool_filename;
-@@innodb_buffer_pool_filename
-hello
-set global innodb_buffer_pool_filename="bye";
-select @@innodb_buffer_pool_filename;
-@@innodb_buffer_pool_filename
-bye
-set global innodb_buffer_pool_filename=NULL;
-ERROR 42000: Variable 'innodb_buffer_pool_filename' can't be set to the value of 'NULL'
-select @@innodb_buffer_pool_filename;
-@@innodb_buffer_pool_filename
-bye
-set global innodb_buffer_pool_filename=default;
-select @@innodb_buffer_pool_filename;
-@@innodb_buffer_pool_filename
-ib_buffer_pool
CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
(opening_line)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/instant_alter_crash.result b/mysql-test/suite/innodb/r/instant_alter_crash.result
index f0fedcc7673..7855aa24264 100644
--- a/mysql-test/suite/innodb/r/instant_alter_crash.result
+++ b/mysql-test/suite/innodb/r/instant_alter_crash.result
@@ -206,3 +206,27 @@ Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t1,t2;
db.opt
+#
+# MDEV-26198 Assertion `0' failed in row_log_table_apply_op during
+# ADD PRIMARY KEY or OPTIMIZE TABLE
+#
+CREATE TABLE t1(f1 year default null, f2 year default null,
+f3 text, f4 year default null, f5 year default null,
+f6 year default null, f7 year default null,
+f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1);
+ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE;
+set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish";
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE;
+connect con1,localhost,root,,,;
+SET DEBUG_SYNC="now WAIT_FOR con1_insert";
+INSERT IGNORE INTO t1 (f3) VALUES ( 'b' );
+INSERT IGNORE INTO t1 (f3) VALUES ( 'l' );
+SET DEBUG_SYNC="now SIGNAL con1_finish";
+connection default;
+disconnect con1;
+SET DEBUG_SYNC=RESET;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result b/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result
new file mode 100644
index 00000000000..09c1cf57497
--- /dev/null
+++ b/mysql-test/suite/innodb/r/sql_mode_pad_char_to_full_length.result
@@ -0,0 +1,51 @@
+SET default_storage_engine=InnoDB;
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+#
+#
+# MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+#
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+SET sql_mode='';
+CREATE TABLE t1 (a INT,b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+SET sql_mode='pad_char_to_full_length';
+INSERT INTO t1 VALUES (0,0);
+DELETE FROM t1;
+DROP TABLE t1;
+SET sql_mode='';
+CREATE OR REPLACE TABLE t1 (a CHAR(20),b CHAR(20));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) DEFAULT NULL,
+ `b` char(20) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+CREATE UNIQUE INDEX bi USING HASH ON t1 (b);
+INSERT INTO t1 VALUES (0,0);
+SET sql_mode='pad_char_to_full_length';
+DELETE FROM t1;
+DROP TABLE t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test
index e0e294ae4f0..164ff877b62 100644
--- a/mysql-test/suite/innodb/t/alter_crash.test
+++ b/mysql-test/suite/innodb/t/alter_crash.test
@@ -51,8 +51,8 @@ let $MYSQLD_DATADIR= `select @@datadir`;
let datadir= `select @@datadir`;
# These are from include/shutdown_mysqld.inc and allow to call start_mysqld.inc
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--echo #
--echo # Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE
diff --git a/mysql-test/suite/innodb/t/default_row_format_alter.test b/mysql-test/suite/innodb/t/default_row_format_alter.test
index f5dd246efb5..5f2170454f3 100644
--- a/mysql-test/suite/innodb/t/default_row_format_alter.test
+++ b/mysql-test/suite/innodb/t/default_row_format_alter.test
@@ -150,6 +150,23 @@ ALTER TABLE t1 DROP b;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
+--echo #
+--echo # MDEV-31025 Redundant table alter fails when fixed column
+--echo # stored externally
+--echo #
+set @old_sql_mode = @@sql_mode;
+SET @@sql_mode='';
+CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255),
+ c4 char(255), c5 char(255), c6 char(255),
+ c7 char(255), c8 char(255), primary key(pk)
+ )Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT;
+INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255));
+ALTER TABLE t1 FORCE;
+CHECK TABLE t1;
+SELECT LENGTH(c) FROM t1;
+DROP TABLE t1;
+set @@sql_mode = @old_sql_mode;
+
--echo # End of 10.4 tests
SET GLOBAL innodb_default_row_format = @row_format;
diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test
index c50e3899fc8..b79fd95471b 100644
--- a/mysql-test/suite/innodb/t/full_crc32_import.test
+++ b/mysql-test/suite/innodb/t/full_crc32_import.test
@@ -199,6 +199,16 @@ SET GLOBAL innodb_compression_algorithm=0;
ALTER TABLE t1 FORCE;
ALTER TABLE t1 DISCARD TABLESPACE;
+--echo # Display the discarded table name by using SPACE and PAGE_NO
+--echo # column in INNODB_SYS_INDEXES and discard doesn't affect the
+--echo # SPACE in INNODB_SYS_TABLES
+SELECT t.NAME, t.SPACE BETWEEN 1 and 0xFFFFFFEF as SYS_TABLE_SPACE_RANGE
+FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t
+WHERE t.TABLE_ID IN (
+ SELECT i.TABLE_ID FROM
+ INFORMATION_SCHEMA.INNODB_SYS_INDEXES i WHERE
+ i.PAGE_NO IS NULL and i.SPACE IS NULL);
+
--list_files $MYSQLD_DATADIR/test
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
diff --git a/mysql-test/suite/innodb/t/import_tablespace_race.test b/mysql-test/suite/innodb/t/import_tablespace_race.test
index 10ffe061ed1..aca0b5df06d 100644
--- a/mysql-test/suite/innodb/t/import_tablespace_race.test
+++ b/mysql-test/suite/innodb/t/import_tablespace_race.test
@@ -37,8 +37,8 @@ ALTER TABLE t NOWAIT ADD INDEX (c);
FLUSH TABLE t FOR EXPORT;
--let $create= query_get_value(SHOW CREATE TABLE t, Create Table, 1)
---copy_file $datadir/test/t.cfg $MYSQL_TMP_DIR/t.cfg
---copy_file $datadir/test/t.ibd $MYSQL_TMP_DIR/t.ibd
+--copy_file $datadir/test/t.cfg $datadir/test/t.cfg.sav
+--copy_file $datadir/test/t.ibd $datadir/test/t.ibd.sav
UNLOCK TABLES;
DROP TABLE t;
@@ -47,8 +47,8 @@ eval $create;
--enable_query_log
ALTER TABLE t DISCARD TABLESPACE;
---move_file $MYSQL_TMP_DIR/t.cfg $datadir/test/t.cfg
---move_file $MYSQL_TMP_DIR/t.ibd $datadir/test/t.ibd
+--move_file $datadir/test/t.cfg.sav $datadir/test/t.cfg
+--move_file $datadir/test/t.ibd.sav $datadir/test/t.ibd
ALTER TABLE t IMPORT TABLESPACE;
# Cleanup
diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
index ab6e1586897..0ae116f58f0 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
@@ -29,8 +29,8 @@ call mtr.add_suppression("InnoDB could not find key no 1 with name f2 from dict
let datadir= `select @@datadir`;
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
SET debug_dbug='+d,innodb_alter_commit_crash_before_commit';
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index e970bd842e2..2c3c95487f0 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -39,8 +39,8 @@ let $strerrfix=/ (\(.+\))//;
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES(1),(2),(3);
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo wait > $_expect_file_name
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test
index c5c61ded651..873cf6b3a23 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522.test
@@ -11,7 +11,6 @@ call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1`
FLUSH TABLES;
-let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`;
@@ -41,10 +40,10 @@ CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
FLUSH TABLE t1, t2 FOR EXPORT;
--echo # List before copying files
--list_files $MYSQLD_DATADIR/test
---copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
---copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
---move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg
---copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd
+--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t1.cfg.sav
+--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1.ibd.sav
+--move_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_DATADIR/test/t2.cfg.sav
+--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t2.ibd.sav
UNLOCK TABLES;
INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
SELECT COUNT(*) FROM t1;
@@ -58,8 +57,8 @@ SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
ALTER TABLE t1 DISCARD TABLESPACE;
--echo # List after t1 DISCARD
--list_files $MYSQLD_DATADIR/test
---copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
---copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
+--copy_file $MYSQLD_DATADIR/test/t1.cfg.sav $MYSQLD_DATADIR/test/t1.cfg
+--copy_file $MYSQLD_DATADIR/test/t1.ibd.sav $MYSQLD_DATADIR/test/t1.ibd
ALTER TABLE t1 IMPORT TABLESPACE;
ALTER TABLE t1 ENGINE InnoDB;
SELECT COUNT(*) FROM t1;
@@ -70,15 +69,15 @@ SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
DROP TABLE t1;
---remove_file $MYSQLD_TMPDIR/t1.cfg
---remove_file $MYSQLD_TMPDIR/t1.ibd
+--remove_file $MYSQLD_DATADIR/test/t1.cfg.sav
+--remove_file $MYSQLD_DATADIR/test/t1.ibd.sav
ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 DISCARD TABLESPACE;
--echo # List after t2 DISCARD
--list_files $MYSQLD_DATADIR/test
---move_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
---move_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
+--move_file $MYSQLD_DATADIR/test/t2.ibd.sav $MYSQLD_DATADIR/test/t2.ibd
+--move_file $MYSQLD_DATADIR/test/t2.cfg.sav $MYSQLD_DATADIR/test/t2.cfg
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t2 IMPORT TABLESPACE;
--remove_file $MYSQLD_DATADIR/test/t2.cfg
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test
index a7a414d61da..381091165ef 100644
--- a/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test
@@ -15,7 +15,6 @@ col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab5(col2(10));
CREATE INDEX idx2 ON tab5(col3(10));
-SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool100;
SET GLOBAL innodb_buffer_pool_dump_pct=100;
#***********************************************************
@@ -58,8 +57,7 @@ AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc
---file_exists $MYSQLD_DATADIR/ib_buffer_pool100
-SET GLOBAL innodb_buffer_pool_filename=ib_buffer_pool1;
+--move_file $MYSQLD_DATADIR/ib_buffer_pool $MYSQLD_DATADIR/ib_buffer_pool100
SET GLOBAL innodb_buffer_pool_dump_pct=1;
SELECT @@global.innodb_buffer_pool_dump_pct;
@@ -83,17 +81,15 @@ AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc
---file_exists $MYSQLD_DATADIR/ib_buffer_pool1
+--file_exists $MYSQLD_DATADIR/ib_buffer_pool
perl;
-my $size1 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool1";
+my $size1 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool";
my $size100 = -s "$ENV{MYSQLD_DATADIR}/ib_buffer_pool100";
die "$size100<=$size1\n" unless $size100 > $size1;
EOF
SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT;
-SET GLOBAL innodb_buffer_pool_filename=DEFAULT;
--remove_file $MYSQLD_DATADIR/ib_buffer_pool100
---remove_file $MYSQLD_DATADIR/ib_buffer_pool1
DROP TABLE tab5;
diff --git a/mysql-test/suite/innodb/t/innodb_ctype_utf8.test b/mysql-test/suite/innodb/t/innodb_ctype_utf8.test
index c3abaa99731..99b79253215 100644
--- a/mysql-test/suite/innodb/t/innodb_ctype_utf8.test
+++ b/mysql-test/suite/innodb/t/innodb_ctype_utf8.test
@@ -23,3 +23,15 @@ let $coll_pad='utf8_bin';
--echo #
--echo # End of 10.2 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+SET NAMES utf8mb3 COLLATE utf8mb3_unicode_nopad_ci;
+--source include/ctype_nopad_prefix_unique.inc
+
+--echo #
+--echo # End 10.4 tests
+--echo #
diff --git a/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
index 2e1391355b9..4383e26877d 100644
--- a/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
+++ b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
@@ -25,24 +25,6 @@ select @@innodb_ft_server_stopword_table;
drop table user_stopword_1, user_stopword_2;
-#Test innodb_buffer_pool_filename (global variable)
-
-select @@innodb_buffer_pool_filename;
-
-set @blah='hello';
-set global innodb_buffer_pool_filename = @blah;
-select @@innodb_buffer_pool_filename;
-
-set global innodb_buffer_pool_filename="bye";
-select @@innodb_buffer_pool_filename;
-
---error ER_WRONG_VALUE_FOR_VAR
-set global innodb_buffer_pool_filename=NULL;
-select @@innodb_buffer_pool_filename;
-
-set global innodb_buffer_pool_filename=default;
-select @@innodb_buffer_pool_filename;
-
#Test innodb_ft_aux_table (global variable)
CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
diff --git a/mysql-test/suite/innodb/t/instant_alter_crash.test b/mysql-test/suite/innodb/t/instant_alter_crash.test
index 0bd983a2b4c..37cdb2862ad 100644
--- a/mysql-test/suite/innodb/t/instant_alter_crash.test
+++ b/mysql-test/suite/innodb/t/instant_alter_crash.test
@@ -236,3 +236,29 @@ CHECK TABLE t2;
DROP TABLE t1,t2;
--list_files $MYSQLD_DATADIR/test
+
+--echo #
+--echo # MDEV-26198 Assertion `0' failed in row_log_table_apply_op during
+--echo # ADD PRIMARY KEY or OPTIMIZE TABLE
+--echo #
+CREATE TABLE t1(f1 year default null, f2 year default null,
+ f3 text, f4 year default null, f5 year default null,
+ f6 year default null, f7 year default null,
+ f8 year default null)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES(1, 1, 1, 1, 1, 1, 1, 1);
+ALTER TABLE t1 ADD COLUMN f9 year default null, ALGORITHM=INPLACE;
+set DEBUG_SYNC="row_log_table_apply1_before SIGNAL con1_insert WAIT_FOR con1_finish";
+send ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ADD COLUMN f10 YEAR DEFAULT NULL, ALGORITHM=INPLACE;
+
+connect(con1,localhost,root,,,);
+SET DEBUG_SYNC="now WAIT_FOR con1_insert";
+INSERT IGNORE INTO t1 (f3) VALUES ( 'b' );
+INSERT IGNORE INTO t1 (f3) VALUES ( 'l' );
+SET DEBUG_SYNC="now SIGNAL con1_finish";
+
+connection default;
+reap;
+disconnect con1;
+SET DEBUG_SYNC=RESET;
+CHECK TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/purge_thread_shutdown.test b/mysql-test/suite/innodb/t/purge_thread_shutdown.test
index 447f1fd3804..53b375b80fd 100644
--- a/mysql-test/suite/innodb/t/purge_thread_shutdown.test
+++ b/mysql-test/suite/innodb/t/purge_thread_shutdown.test
@@ -12,8 +12,8 @@ select user,state from information_schema.processlist order by 2;
set global debug_dbug='+d,only_kill_system_threads';
set global innodb_fast_shutdown=0;
-let $_server_id= `SELECT @@server_id`;
-let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect;
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
exec echo "wait" > $_expect_file_name;
send shutdown;
diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test
index 5be076c6198..a1e45b37f9c 100644
--- a/mysql-test/suite/innodb/t/restart.test
+++ b/mysql-test/suite/innodb/t/restart.test
@@ -4,6 +4,7 @@
let datadir= `select @@datadir`;
let page_size= `select @@innodb_page_size`;
+let tmp_in_vardir=$MYSQLTEST_VARDIR/tmp;
--echo #
--echo # MDEV-15333 MariaDB (still) slow start
@@ -27,19 +28,19 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace for test/td
CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--replace_result $tmp_in_vardir MYSQL_TMP_DIR
eval CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
-STATS_PERSISTENT=0 DATA DIRECTORY='$MYSQL_TMP_DIR';
+STATS_PERSISTENT=0 DATA DIRECTORY='$tmp_in_vardir';
--source include/shutdown_mysqld.inc
--move_file $datadir/test/tr.ibd $datadir/test/tr0.ibd
--move_file $datadir/test/tc.ibd $datadir/test/tc0.ibd
---move_file $MYSQL_TMP_DIR/test/td.ibd $datadir/test/td0.ibd
+--move_file $tmp_in_vardir/test/td.ibd $datadir/test/td0.ibd
# TODO: test that MariaDB does not even attempt to open the files
#--mkdir $datadir/test/tr.ibd
#--mkdir $datadir/test/tc.ibd
-#--mkdir $MYSQL_TMP_DIR/test/td.ibd
+#--mkdir $tmp_in_vardir/test/td.ibd
perl;
die unless open OUT, ">", "$ENV{datadir}/test/tr.ibd";
@@ -48,7 +49,7 @@ close OUT or die;
die unless open OUT, ">", "$ENV{datadir}/test/tc.ibd";
print OUT "bar " x $ENV{page_size};
close OUT or die;
-die unless open OUT, ">", "$ENV{MYSQL_TMP_DIR}/test/td.ibd";
+die unless open OUT, ">", "$ENV{tmp_in_vardir}/test/td.ibd";
print OUT "Xyz " x $ENV{page_size};
close OUT or die;
die unless open ISL, "+<", "$ENV{datadir}/test/td.isl";
@@ -75,14 +76,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
# TODO: test that MariaDB does not even attempt to open the files
#--rmdir $datadir/test/tr.ibd
#--rmdir $datadir/test/tc.ibd
-#--rmdir $MYSQL_TMP_DIR/test/td.ibd
+#--rmdir $tmp_in_vardir/test/td.ibd
--remove_file $datadir/test/tr.ibd
--remove_file $datadir/test/tc.ibd
---remove_file $MYSQL_TMP_DIR/test/td.ibd
+--remove_file $tmp_in_vardir/test/td.ibd
--move_file $datadir/test/tr0.ibd $datadir/test/tr.ibd
--move_file $datadir/test/tc0.ibd $datadir/test/tc.ibd
---move_file $datadir/test/td0.ibd $MYSQL_TMP_DIR/test/td.ibd
+--move_file $datadir/test/td0.ibd $tmp_in_vardir/test/td.ibd
--source include/start_mysqld.inc
SELECT * FROM tr;
@@ -118,8 +119,6 @@ SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig;
--echo #
--let MYSQLD_DATADIR= `SELECT @@datadir`
---let SERVER_ID= `SELECT @@server_id`
---let EXPECT_FILE_NAME= $MYSQLTEST_VARDIR/tmp/mysqld.$SERVER_ID.expect
--source include/shutdown_mysqld.inc
@@ -154,13 +153,13 @@ if ($MTR_COMBINATION_64K)
}
--error 1
-exec $MYSQLD --no-defaults --skip-networking --innodb_data_file_path=ibdata1:$ibdata_size --innodb-page-size=$page_size --datadir=$MYSQLD_DATADIR --log-error=$MYSQL_TMP_DIR/attempted_start.err;
+exec $MYSQLD --no-defaults --skip-networking --innodb_data_file_path=ibdata1:$ibdata_size --innodb-page-size=$page_size --datadir=$MYSQLD_DATADIR --log-error=$tmp_in_vardir/attempted_start.err;
-let SEARCH_FILE= $MYSQL_TMP_DIR/attempted_start.err;
+let SEARCH_FILE= $tmp_in_vardir/attempted_start.err;
let SEARCH_PATTERN= InnoDB: MySQL-8\.0 tablespace in \./ibdata1;
source include/search_pattern_in_file.inc;
---remove_file $MYSQL_TMP_DIR/attempted_start.err
+--remove_file $tmp_in_vardir/attempted_start.err
--remove_file $MYSQLD_DATADIR/ibdata1
--move_file $MYSQLD_DATADIR/ibdata1.bak $MYSQLD_DATADIR/ibdata1
diff --git a/mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test b/mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test
new file mode 100644
index 00000000000..ba286c744d9
--- /dev/null
+++ b/mysql-test/suite/innodb/t/sql_mode_pad_char_to_full_length.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+
+SET default_storage_engine=InnoDB;
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
+--echo #
+
+--source include/sql_mode_pad_char_to_full_length.inc
+
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
index 6f3f293f2a2..a374f9e1bba 100644
--- a/mysql-test/suite/innodb/t/temporary_table.test
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -11,8 +11,8 @@
--source include/no_valgrind_without_big.inc
--disable_query_log
-call mtr.add_suppression("Can't create/write to file '/dev/null/nonexistent/ib");
call mtr.add_suppression("Can't create/write to file '' \\\(Errcode: 20 \"Not a directory\"\\\)");
+call mtr.add_suppression("Can't create/write to file '/dev/null/.*/ib");
call mtr.add_suppression("InnoDB: Unable to create temporary file");
call mtr.add_suppression("last file in setting innodb_temp_data_file_path");
call mtr.add_suppression("The table 't1' is full");
@@ -135,7 +135,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
# We cannot use include/restart_mysqld.inc in this particular test,
# because SHOW STATUS would fail due to unwritable (nonexistent) tmpdir.
--source include/shutdown_mysqld.inc
---exec echo "restart: --tmpdir=/dev/null/nonexistent --skip-innodb-fast-shutdown" > $_expect_file_name
+--exec echo "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" > $_expect_file_name
--enable_reconnect
--disable_result_log
--disable_query_log
diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result
index 2335982816b..bc47511b046 100644
--- a/mysql-test/suite/innodb_fts/r/concurrent_insert.result
+++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result
@@ -19,7 +19,7 @@ INSERT INTO t2 VALUES('mariadb');
connection default;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
-SET DEBUG_SYNC= 'fts_sync_end
+SET DEBUG_SYNC= 'fts_instrument_sync_request
SIGNAL drop_index_start WAIT_FOR sync_op';
INSERT INTO t1 VALUES('Keyword');
connect con1,localhost,root,,,;
diff --git a/mysql-test/suite/innodb_fts/r/sync.result b/mysql-test/suite/innodb_fts/r/sync.result
index 74a5d2f13fb..928efffdb21 100644
--- a/mysql-test/suite/innodb_fts/r/sync.result
+++ b/mysql-test/suite/innodb_fts/r/sync.result
@@ -11,19 +11,19 @@ INSERT INTO t1(title) VALUES('database');
connection con1;
SET @old_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
-SET DEBUG_SYNC= 'fts_sync_end SIGNAL written WAIT_FOR selected';
+SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
INSERT INTO t1(title) VALUES('mysql database');
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR written';
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
-SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
-WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 2 3 2 2 0
database 2 3 2 3 6
mysql 1 3 2 1 0
mysql 1 3 2 3 0
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
FTS_DOC_ID title
@@ -59,7 +59,7 @@ INSERT INTO t1(title) VALUES('mysql');
INSERT INTO t1(title) VALUES('database');
connection con1;
SET debug_dbug = '+d,fts_instrument_sync_debug';
-SET DEBUG_SYNC= 'fts_sync_end SIGNAL written WAIT_FOR inserted';
+SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
INSERT INTO t1(title) VALUES('mysql database');
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR written';
@@ -70,14 +70,14 @@ SET debug_dbug = @old_dbug;
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
-database 4 4 1 4 6
-mysql 4 4 1 4 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
database 2 3 2 2 0
database 2 3 2 3 6
-mysql 1 3 2 1 0
-mysql 1 3 2 3 0
+database 4 4 1 4 6
+mysql 1 4 3 1 0
+mysql 1 4 3 3 0
+mysql 1 4 3 4 0
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
FTS_DOC_ID title
diff --git a/mysql-test/suite/innodb_fts/r/sync_block.result b/mysql-test/suite/innodb_fts/r/sync_block.result
new file mode 100644
index 00000000000..65bee127e80
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/sync_block.result
@@ -0,0 +1,83 @@
+SET @old_log_output = @@global.log_output;
+SET @old_slow_query_log = @@global.slow_query_log;
+SET @old_general_log = @@global.general_log;
+SET @old_long_query_time = @@global.long_query_time;
+SET @old_debug = @@global.debug_dbug;
+SET GLOBAL log_output = 'TABLE';
+SET GLOBAL general_log = 1;
+SET GLOBAL slow_query_log = 1;
+SET GLOBAL long_query_time = 1;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection default;
+# Case 1: Sync blocks DML(insert) on the same table.
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+FULLTEXT(title)
+) ENGINE = InnoDB;
+connection con1;
+SET GLOBAL debug_dbug='+d,fts_instrument_sync_debug,fts_instrument_sync_sleep';
+SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue';
+INSERT INTO t1(title) VALUES('mysql database');
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR begin';
+SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
+connection default;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection con1;
+/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
+connection con2;
+/* conneciton con2 */ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
+FTS_DOC_ID title
+connection default;
+# make con1 & con2 show up in mysql.slow_log
+SELECT SLEEP(2);
+SLEEP(2)
+0
+# slow log results should only contain INSERT INTO t1.
+SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
+sql_text
+INSERT INTO t1(title) VALUES('mysql database')
+SET GLOBAL debug_dbug = @old_debug;
+TRUNCATE TABLE mysql.slow_log;
+DROP TABLE t1;
+# Case 2: Sync blocks DML(insert) on other tables.
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+FULLTEXT(title)
+) ENGINE = InnoDB;
+CREATE TABLE t2(id INT);
+connection con1;
+SET GLOBAL debug_dbug='+d,fts_instrument_sync_request,fts_instrument_sync_sleep';
+SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue';
+INSERT INTO t1(title) VALUES('mysql database');
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR begin';
+INSERT INTO t2 VALUES(1);
+connection default;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection con1;
+/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
+connection con2;
+/* conneciton con2 */ INSERT INTO t2 VALUES(1);
+connection default;
+SET DEBUG_SYNC = 'RESET';
+# make con1 & con2 show up in mysql.slow_log
+SELECT SLEEP(2);
+SLEEP(2)
+0
+# slow log results should be empty here.
+SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
+sql_text
+SET GLOBAL debug_dbug = @old_debug;
+TRUNCATE TABLE mysql.slow_log;
+DROP TABLE t1,t2;
+disconnect con1;
+disconnect con2;
+# Restore slow log settings.
+SET GLOBAL log_output = @old_log_output;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
+SET GLOBAL long_query_time = @old_long_query_time;
diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test
index b6991f6e503..9b4d9517b1a 100644
--- a/mysql-test/suite/innodb_fts/t/concurrent_insert.test
+++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test
@@ -31,7 +31,7 @@ INSERT INTO t2 VALUES('mariadb');
connection default;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
-SET DEBUG_SYNC= 'fts_sync_end
+SET DEBUG_SYNC= 'fts_instrument_sync_request
SIGNAL drop_index_start WAIT_FOR sync_op';
send INSERT INTO t1 VALUES('Keyword');
diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test
index 49663f20b8a..168309a5c92 100644
--- a/mysql-test/suite/innodb_fts/t/sync.test
+++ b/mysql-test/suite/innodb_fts/t/sync.test
@@ -27,7 +27,7 @@ connection con1;
SET @old_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
-SET DEBUG_SYNC= 'fts_sync_end SIGNAL written WAIT_FOR selected';
+SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
send INSERT INTO t1(title) VALUES('mysql database');
@@ -74,7 +74,7 @@ connection con1;
SET debug_dbug = '+d,fts_instrument_sync_debug';
-SET DEBUG_SYNC= 'fts_sync_end SIGNAL written WAIT_FOR inserted';
+SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
send INSERT INTO t1(title) VALUES('mysql database');
@@ -104,7 +104,8 @@ disconnect con1;
DROP TABLE t1;
--echo # Case 3: Test insert crash recovery
---let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
diff --git a/mysql-test/suite/innodb_fts/t/sync_block.test b/mysql-test/suite/innodb_fts/t/sync_block.test
new file mode 100644
index 00000000000..895d2ba8a59
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/sync_block.test
@@ -0,0 +1,124 @@
+#
+# BUG#22516559 MYSQL INSTANCE STALLS WHEN SYNCING FTS INDEX
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_log_bin.inc
+--source include/count_sessions.inc
+
+SET @old_log_output = @@global.log_output;
+SET @old_slow_query_log = @@global.slow_query_log;
+SET @old_general_log = @@global.general_log;
+SET @old_long_query_time = @@global.long_query_time;
+SET @old_debug = @@global.debug_dbug;
+
+SET GLOBAL log_output = 'TABLE';
+SET GLOBAL general_log = 1;
+SET GLOBAL slow_query_log = 1;
+SET GLOBAL long_query_time = 1;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connection default;
+
+--echo # Case 1: Sync blocks DML(insert) on the same table.
+CREATE TABLE t1 (
+ FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ FULLTEXT(title)
+) ENGINE = InnoDB;
+
+connection con1;
+
+SET GLOBAL debug_dbug='+d,fts_instrument_sync_debug,fts_instrument_sync_sleep';
+
+SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue';
+
+send INSERT INTO t1(title) VALUES('mysql database');
+
+connection con2;
+
+SET DEBUG_SYNC= 'now WAIT_FOR begin';
+
+send SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
+
+connection default;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+
+connection con1;
+--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
+--reap
+
+connection con2;
+--echo /* conneciton con2 */ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
+--reap
+
+connection default;
+-- echo # make con1 & con2 show up in mysql.slow_log
+SELECT SLEEP(2);
+-- echo # slow log results should only contain INSERT INTO t1.
+SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
+
+SET GLOBAL debug_dbug = @old_debug;
+TRUNCATE TABLE mysql.slow_log;
+
+DROP TABLE t1;
+
+--echo # Case 2: Sync blocks DML(insert) on other tables.
+CREATE TABLE t1 (
+ FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ FULLTEXT(title)
+) ENGINE = InnoDB;
+
+CREATE TABLE t2(id INT);
+
+connection con1;
+
+SET GLOBAL debug_dbug='+d,fts_instrument_sync_request,fts_instrument_sync_sleep';
+
+SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue';
+
+send INSERT INTO t1(title) VALUES('mysql database');
+
+connection con2;
+
+SET DEBUG_SYNC= 'now WAIT_FOR begin';
+
+send INSERT INTO t2 VALUES(1);
+
+connection default;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+
+connection con1;
+--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
+--reap
+
+connection con2;
+--echo /* conneciton con2 */ INSERT INTO t2 VALUES(1);
+--reap
+
+connection default;
+SET DEBUG_SYNC = 'RESET';
+-- echo # make con1 & con2 show up in mysql.slow_log
+SELECT SLEEP(2);
+-- echo # slow log results should be empty here.
+SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
+
+SET GLOBAL debug_dbug = @old_debug;
+TRUNCATE TABLE mysql.slow_log;
+
+DROP TABLE t1,t2;
+
+disconnect con1;
+disconnect con2;
+
+--source include/wait_until_count_sessions.inc
+
+-- echo # Restore slow log settings.
+SET GLOBAL log_output = @old_log_output;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
+SET GLOBAL long_query_time = @old_long_query_time;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_optimize.result b/mysql-test/suite/innodb_gis/r/rtree_optimize.result
new file mode 100644
index 00000000000..4abdb5f2cf4
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/r/rtree_optimize.result
@@ -0,0 +1,44 @@
+CREATE TABLE t (
+id INT AUTO_INCREMENT,
+c BINARY(226) DEFAULT '',
+s POINT NOT NULL,
+PRIMARY KEY(id,c)
+) ENGINE=InnoDB;
+INSERT INTO t (s) VALUES
+(POINTFromText('POINT(0.78 0.72)')),(POINTFromText('POINT(0.44 0.21)')),
+(POINTFromText('POINT(0.93 0.56)')),(POINTFromText('POINT(0.57 0.21)')),
+(POINTFromText('POINT(0.12 0.65)')),(POINTFromText('POINT(0.20 0.96)')),
+(POINTFromText('POINT(0.99 0.71)')),(POINTFromText('POINT(0.27 0.23)')),
+(POINTFromText('POINT(0.68 0.14)')),(POINTFromText('POINT(0.20 0.05)')),
+(POINTFromText('POINT(0.47 0.57)')),(POINTFromText('POINT(0.89 0.79)')),
+(POINTFromText('POINT(0.09 0.57)')),(POINTFromText('POINT(0.58 0.52)')),
+(POINTFromText('POINT(0.73 0.32)')),(POINTFromText('POINT(0.87 0.35)')),
+(POINTFromText('POINT(0.60 0.12)')),(POINTFromText('POINT(0.14 0.17)')),
+(POINTFromText('POINT(0.76 0.29)')),(POINTFromText('POINT(0.60 0.35)')),
+(POINTFromText('POINT(0.48 0.69)')),(POINTFromText('POINT(0.79 0.45)')),
+(POINTFromText('POINT(0.85 0.11)')),(POINTFromText('POINT(0.59 0.99)')),
+(POINTFromText('POINT(0.95 0.18)')),(POINTFromText('POINT(0.78 0.49)')),
+(POINTFromText('POINT(0.11 0.22)')),(POINTFromText('POINT(0.26 0.85)')),
+(POINTFromText('POINT(0.28 0.10)')),(POINTFromText('POINT(0.45 0.25)')),
+(POINTFromText('POINT(0.70 0.40)')),(POINTFromText('POINT(0.65 0.86)')),
+(POINTFromText('POINT(0.69 0.98)')),(POINTFromText('POINT(0.56 0.11)')),
+(POINTFromText('POINT(0.94 0.59)')),(POINTFromText('POINT(0.19 0.94)')),
+(POINTFromText('POINT(0.82 0.85)')),(POINTFromText('POINT(0.74 0.07)')),
+(POINTFromText('POINT(0.33 0.48)')),(POINTFromText('POINT(0.37 0.37)')),
+(POINTFromText('POINT(0.40 0.08)')),(POINTFromText('POINT(0.45 0.74)')),
+(POINTFromText('POINT(0.57 0.07)')),(POINTFromText('POINT(0.36 0.11)')),
+(POINTFromText('POINT(0.94 0.60)')),(POINTFromText('POINT(0.75 0.76)')),
+(POINTFromText('POINT(0.92 0.56)')),(POINTFromText('POINT(0.88 0.52)')),
+(POINTFromText('POINT(0.49 0.24)')),(POINTFromText('POINT(0.96 0.08)')),
+(POINTFromText('POINT(0.93 0.99)')),(POINTFromText('POINT(0.88 0.31)')),
+(POINTFromText('POINT(0.93 0.78)')),(POINTFromText('POINT(0.62 0.50)')),
+(POINTFromText('POINT(0.54 0.53)')),(POINTFromText('POINT(0.66 0.83)')),
+(POINTFromText('POINT(0.21 0.87)')),(POINTFromText('POINT(0.42 0.28)')),
+(POINTFromText('POINT(0.80 0.84)')),(POINTFromText('POINT(0.39 0.68)')),
+(POINTFromText('POINT(0.05 0.24)')),(POINTFromText('POINT(0.05 0.58)'));
+ALTER TABLE t ADD SPATIAL INDEX(s);
+OPTIMIZE TABLE t;
+Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
+test.t optimize status OK
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_optimize.test b/mysql-test/suite/innodb_gis/t/rtree_optimize.test
new file mode 100644
index 00000000000..c3de282da27
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/t/rtree_optimize.test
@@ -0,0 +1,44 @@
+--source include/have_innodb.inc
+
+CREATE TABLE t (
+ id INT AUTO_INCREMENT,
+ c BINARY(226) DEFAULT '',
+ s POINT NOT NULL,
+ PRIMARY KEY(id,c)
+) ENGINE=InnoDB;
+INSERT INTO t (s) VALUES
+ (POINTFromText('POINT(0.78 0.72)')),(POINTFromText('POINT(0.44 0.21)')),
+ (POINTFromText('POINT(0.93 0.56)')),(POINTFromText('POINT(0.57 0.21)')),
+ (POINTFromText('POINT(0.12 0.65)')),(POINTFromText('POINT(0.20 0.96)')),
+ (POINTFromText('POINT(0.99 0.71)')),(POINTFromText('POINT(0.27 0.23)')),
+ (POINTFromText('POINT(0.68 0.14)')),(POINTFromText('POINT(0.20 0.05)')),
+ (POINTFromText('POINT(0.47 0.57)')),(POINTFromText('POINT(0.89 0.79)')),
+ (POINTFromText('POINT(0.09 0.57)')),(POINTFromText('POINT(0.58 0.52)')),
+ (POINTFromText('POINT(0.73 0.32)')),(POINTFromText('POINT(0.87 0.35)')),
+ (POINTFromText('POINT(0.60 0.12)')),(POINTFromText('POINT(0.14 0.17)')),
+ (POINTFromText('POINT(0.76 0.29)')),(POINTFromText('POINT(0.60 0.35)')),
+ (POINTFromText('POINT(0.48 0.69)')),(POINTFromText('POINT(0.79 0.45)')),
+ (POINTFromText('POINT(0.85 0.11)')),(POINTFromText('POINT(0.59 0.99)')),
+ (POINTFromText('POINT(0.95 0.18)')),(POINTFromText('POINT(0.78 0.49)')),
+ (POINTFromText('POINT(0.11 0.22)')),(POINTFromText('POINT(0.26 0.85)')),
+ (POINTFromText('POINT(0.28 0.10)')),(POINTFromText('POINT(0.45 0.25)')),
+ (POINTFromText('POINT(0.70 0.40)')),(POINTFromText('POINT(0.65 0.86)')),
+ (POINTFromText('POINT(0.69 0.98)')),(POINTFromText('POINT(0.56 0.11)')),
+ (POINTFromText('POINT(0.94 0.59)')),(POINTFromText('POINT(0.19 0.94)')),
+ (POINTFromText('POINT(0.82 0.85)')),(POINTFromText('POINT(0.74 0.07)')),
+ (POINTFromText('POINT(0.33 0.48)')),(POINTFromText('POINT(0.37 0.37)')),
+ (POINTFromText('POINT(0.40 0.08)')),(POINTFromText('POINT(0.45 0.74)')),
+ (POINTFromText('POINT(0.57 0.07)')),(POINTFromText('POINT(0.36 0.11)')),
+ (POINTFromText('POINT(0.94 0.60)')),(POINTFromText('POINT(0.75 0.76)')),
+ (POINTFromText('POINT(0.92 0.56)')),(POINTFromText('POINT(0.88 0.52)')),
+ (POINTFromText('POINT(0.49 0.24)')),(POINTFromText('POINT(0.96 0.08)')),
+ (POINTFromText('POINT(0.93 0.99)')),(POINTFromText('POINT(0.88 0.31)')),
+ (POINTFromText('POINT(0.93 0.78)')),(POINTFromText('POINT(0.62 0.50)')),
+ (POINTFromText('POINT(0.54 0.53)')),(POINTFromText('POINT(0.66 0.83)')),
+ (POINTFromText('POINT(0.21 0.87)')),(POINTFromText('POINT(0.42 0.28)')),
+ (POINTFromText('POINT(0.80 0.84)')),(POINTFromText('POINT(0.39 0.68)')),
+ (POINTFromText('POINT(0.05 0.24)')),(POINTFromText('POINT(0.05 0.58)'));
+ALTER TABLE t ADD SPATIAL INDEX(s);
+OPTIMIZE TABLE t;
+# Cleanup
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result
index ea42e7ea784..f898e1a978e 100644
--- a/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result
+++ b/mysql-test/suite/innodb_i_s/innodb_sys_indexes.result
@@ -6,7 +6,7 @@ INNODB_SYS_INDEXES CREATE TEMPORARY TABLE `INNODB_SYS_INDEXES` (
`TABLE_ID` bigint(21) unsigned NOT NULL,
`TYPE` int(11) NOT NULL,
`N_FIELDS` int(11) NOT NULL,
- `PAGE_NO` int(11) NOT NULL,
- `SPACE` int(11) NOT NULL,
+ `PAGE_NO` int(11),
+ `SPACE` int(11),
`MERGE_THRESHOLD` int(11) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
diff --git a/mysql-test/suite/maria/aria_log_dir_path.result b/mysql-test/suite/maria/aria_log_dir_path.result
new file mode 100644
index 00000000000..0a4201544a5
--- /dev/null
+++ b/mysql-test/suite/maria/aria_log_dir_path.result
@@ -0,0 +1,29 @@
+#
+# MDEV-30971 Add a new system variable aria_data_home_dir
+#
+# restart: --loose-aria-log-file-size=8388608 --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1
+SET @@global.aria_log_purge_type=external;
+SHOW VARIABLES LIKE 'aria_log_file_size';
+Variable_name Value
+aria_log_file_size 8388608
+SELECT @@aria_log_dir_path;
+@@aria_log_dir_path
+MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+SHOW ENGINE aria logs;
+Type Name Status
+Aria aria_log.00000001 in use
+CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
+BEGIN NOT ATOMIC
+FOR id IN 0..9 DO
+INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
+END FOR;
+END;
+$$
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+SHOW ENGINE aria logs;
+Type Name Status
+Aria aria_log.00000001 free
+Aria aria_log.00000002 in use
+DROP TABLE t1;
+# restart
diff --git a/mysql-test/suite/maria/aria_log_dir_path.test b/mysql-test/suite/maria/aria_log_dir_path.test
new file mode 100644
index 00000000000..bc0a31a76b9
--- /dev/null
+++ b/mysql-test/suite/maria/aria_log_dir_path.test
@@ -0,0 +1,65 @@
+--source include/have_maria.inc
+--let $datadir= `SELECT @@datadir`
+
+--echo #
+--echo # MDEV-30971 Add a new system variable aria_data_home_dir
+--echo #
+
+--let $ARIA_LOGDIR=$MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1
+--mkdir $ARIA_LOGDIR
+--let $restart_parameters=--loose-aria-log-file-size=8388608 --loose-aria-log-dir-path=$ARIA_LOGDIR
+--source include/restart_mysqld.inc
+
+#
+# Test that:
+# - aria_log_dir_path is set to a non-default directory.
+# - New Aria log files are created in the non-default directory.
+# - The contents of the log directory (according to "file_exists" commands)
+# is in sync with the "SHOW ENGINE aria logs" ouput.
+#
+
+# Prevent automatic purge
+SET @@global.aria_log_purge_type=external;
+
+SHOW VARIABLES LIKE 'aria_log_file_size';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+SELECT @@aria_log_dir_path;
+
+
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+--file_exists $ARIA_LOGDIR/aria_log_control
+--file_exists $ARIA_LOGDIR/aria_log.00000001
+--error 1
+--file_exists $ARIA_LOGDIR/aria_log.00000002
+--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/
+SHOW ENGINE aria logs;
+
+
+CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ FOR id IN 0..9 DO
+ INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+--file_exists $ARIA_LOGDIR/aria_log_control
+--file_exists $ARIA_LOGDIR/aria_log.00000001
+--file_exists $ARIA_LOGDIR/aria_log.00000002
+--error 1
+--file_exists $ARIA_LOGDIR/aria_log.00000003
+--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/
+SHOW ENGINE aria logs;
+
+DROP TABLE t1;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+--remove_file $ARIA_LOGDIR/aria_log_control
+--remove_file $ARIA_LOGDIR/aria_log.00000001
+--remove_file $ARIA_LOGDIR/aria_log.00000002
+--rmdir $ARIA_LOGDIR
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index ad69d5f2050..fcdd08382a0 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -311,6 +311,7 @@ aria_encrypt_tables #
aria_force_start_after_recovery_failures #
aria_group_commit #
aria_group_commit_interval #
+aria_log_dir_path #
aria_log_file_size #
aria_log_purge_type #
aria_max_sort_file_size #
diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path.result b/mysql-test/suite/mariabackup/aria_log_dir_path.result
new file mode 100644
index 00000000000..1a877321bbe
--- /dev/null
+++ b/mysql-test/suite/mariabackup/aria_log_dir_path.result
@@ -0,0 +1,41 @@
+#
+# MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used
+#
+# Restart mariadbd with the test specific parameters
+# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path
+# Create and populate an Aria table (and Aria logs)
+CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
+BEGIN NOT ATOMIC
+FOR id IN 0..9 DO
+INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
+END FOR;
+END;
+$$
+# Testing aria log files before --backup
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+SHOW ENGINE aria logs;
+Type Name Status
+Aria aria_log.00000001 free
+Aria aria_log.00000002 in use
+# mariadb-backup --backup
+# mariadb-backup --prepare
+# shutdown server
+# remove datadir
+# remove aria-log-dir-path
+# mariadb-backup --copy-back
+# with parameters: --defaults-file=MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=MYSQLTEST_VARDIR/mysqld.1/data/ --target-dir=MYSQLTEST_VARDIR/tmp/backup --parallel=2 --throttle=1 --aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path
+# starting server
+# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path
+# Check that the table is there after --copy-back
+SELECT COUNT(*) from t1;
+COUNT(*)
+10
+DROP TABLE t1;
+# Testing aria log files after --copy-back
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+SHOW ENGINE aria logs;
+Type Name Status
+Aria aria_log.00000001 free
+Aria aria_log.00000002 in use
+# Restarting mariadbd with default parameters
+# restart
diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path.test b/mysql-test/suite/mariabackup/aria_log_dir_path.test
new file mode 100644
index 00000000000..0178cd4eae5
--- /dev/null
+++ b/mysql-test/suite/mariabackup/aria_log_dir_path.test
@@ -0,0 +1,105 @@
+--source include/have_maria.inc
+
+--echo #
+--echo # MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used
+--echo #
+
+--let $datadir=`SELECT @@datadir`
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+
+if ($ARIA_LOGDIR_MARIADB == '')
+{
+ --let $ARIA_LOGDIR_MARIADB=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path
+}
+
+if ($ARIA_LOGDIR_FS == '')
+{
+ --let $ARIA_LOGDIR_FS=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path
+}
+
+--let $server_parameters=--aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=$ARIA_LOGDIR_MARIADB
+
+
+--echo # Restart mariadbd with the test specific parameters
+--mkdir $ARIA_LOGDIR_FS
+--let $restart_parameters=$server_parameters
+--source include/restart_mysqld.inc
+
+
+--echo # Create and populate an Aria table (and Aria logs)
+CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ FOR id IN 0..9 DO
+ INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+
+--echo # Testing aria log files before --backup
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+--file_exists $ARIA_LOGDIR_FS/aria_log_control
+--file_exists $ARIA_LOGDIR_FS/aria_log.00000001
+--file_exists $ARIA_LOGDIR_FS/aria_log.00000002
+--error 1
+--file_exists $ARIA_LOGDIR_FS/aria_log.00000003
+--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/
+SHOW ENGINE aria logs;
+
+
+--echo # mariadb-backup --backup
+--disable_result_log
+--mkdir $targetdir
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir
+--enable_result_log
+
+
+--echo # mariadb-backup --prepare
+--disable_result_log
+--exec $XTRABACKUP --prepare --target-dir=$targetdir
+--enable_result_log
+
+
+--echo # shutdown server
+--disable_result_log
+--source include/shutdown_mysqld.inc
+--echo # remove datadir
+--rmdir $datadir
+--echo # remove aria-log-dir-path
+--rmdir $ARIA_LOGDIR_FS
+
+--echo # mariadb-backup --copy-back
+--let $mariadb_backup_parameters=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$datadir --target-dir=$targetdir --parallel=2 --throttle=1 --aria-log-dir-path=$ARIA_LOGDIR_MARIADB
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec echo "# with parameters: $mariadb_backup_parameters"
+--exec $XTRABACKUP $mariadb_backup_parameters
+
+--echo # starting server
+--let $restart_parameters=$server_parameters
+--source include/start_mysqld.inc
+--enable_result_log
+--rmdir $targetdir
+
+
+--echo # Check that the table is there after --copy-back
+SELECT COUNT(*) from t1;
+DROP TABLE t1;
+
+
+--echo # Testing aria log files after --copy-back
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+--file_exists $ARIA_LOGDIR_FS/aria_log_control
+--file_exists $ARIA_LOGDIR_FS/aria_log.00000001
+--file_exists $ARIA_LOGDIR_FS/aria_log.00000002
+--error 1
+--file_exists $ARIA_LOGDIR_FS/aria_log.00000003
+--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/
+SHOW ENGINE aria logs;
+
+
+--echo # Restarting mariadbd with default parameters
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+--rmdir $ARIA_LOGDIR_FS
diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path_rel.result b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.result
new file mode 100644
index 00000000000..7fef26096e0
--- /dev/null
+++ b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.result
@@ -0,0 +1,41 @@
+#
+# MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used
+#
+# Restart mariadbd with the test specific parameters
+# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=../../tmp/backup_aria_log_dir_path_rel
+# Create and populate an Aria table (and Aria logs)
+CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
+BEGIN NOT ATOMIC
+FOR id IN 0..9 DO
+INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
+END FOR;
+END;
+$$
+# Testing aria log files before --backup
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+SHOW ENGINE aria logs;
+Type Name Status
+Aria aria_log.00000001 free
+Aria aria_log.00000002 in use
+# mariadb-backup --backup
+# mariadb-backup --prepare
+# shutdown server
+# remove datadir
+# remove aria-log-dir-path
+# mariadb-backup --copy-back
+# with parameters: --defaults-file=MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=MYSQLTEST_VARDIR/mysqld.1/data/ --target-dir=MYSQLTEST_VARDIR/tmp/backup --parallel=2 --throttle=1 --aria-log-dir-path=../../tmp/backup_aria_log_dir_path_rel
+# starting server
+# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=../../tmp/backup_aria_log_dir_path_rel
+# Check that the table is there after --copy-back
+SELECT COUNT(*) from t1;
+COUNT(*)
+10
+DROP TABLE t1;
+# Testing aria log files after --copy-back
+SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
+SHOW ENGINE aria logs;
+Type Name Status
+Aria aria_log.00000001 free
+Aria aria_log.00000002 in use
+# Restarting mariadbd with default parameters
+# restart
diff --git a/mysql-test/suite/mariabackup/aria_log_dir_path_rel.test b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.test
new file mode 100644
index 00000000000..c8169959929
--- /dev/null
+++ b/mysql-test/suite/mariabackup/aria_log_dir_path_rel.test
@@ -0,0 +1,4 @@
+--let $ARIA_LOGDIR_MARIADB=../../tmp/backup_aria_log_dir_path_rel
+--let $ARIA_LOGDIR_FS=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path_rel
+
+--source aria_log_dir_path.test
diff --git a/mysql-test/suite/mariabackup/include/restart_and_restore.inc b/mysql-test/suite/mariabackup/include/restart_and_restore.inc
index 2d1e5493957..aa26d28efba 100644
--- a/mysql-test/suite/mariabackup/include/restart_and_restore.inc
+++ b/mysql-test/suite/mariabackup/include/restart_and_restore.inc
@@ -4,5 +4,5 @@ echo # shutdown server;
echo # remove datadir;
rmdir $_datadir;
echo # xtrabackup move back;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2 --throttle=1;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2 --throttle=1 $backup_opts;
--source include/start_mysqld.inc
diff --git a/mysql-test/suite/mariabackup/partial_exclude.result b/mysql-test/suite/mariabackup/partial_exclude.result
index a31197b9e9d..f57a5f63e68 100644
--- a/mysql-test/suite/mariabackup/partial_exclude.result
+++ b/mysql-test/suite/mariabackup/partial_exclude.result
@@ -8,8 +8,15 @@ CREATE DATABASE db2;
USE db2;
CREATE TABLE t1(i INT) ENGINE INNODB;
USE test;
+BEGIN;
+INSERT INTO db2.t1 VALUES(20);
+INSERT INTO test.t1 VALUES(20);
+INSERT INTO test.t2 VALUES(20);
# xtrabackup backup
+COMMIT;
t1.new
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db2;
+NOT FOUND /Operating system error number/ in backup.log
+NOT FOUND /Could not find a valid tablespace file for/ in backup.log
diff --git a/mysql-test/suite/mariabackup/partial_exclude.test b/mysql-test/suite/mariabackup/partial_exclude.test
index 3642a2c6f46..6a1ae13b512 100644
--- a/mysql-test/suite/mariabackup/partial_exclude.test
+++ b/mysql-test/suite/mariabackup/partial_exclude.test
@@ -19,6 +19,11 @@ CREATE TABLE t1(i INT) ENGINE INNODB;
USE test;
+BEGIN;
+INSERT INTO db2.t1 VALUES(20);
+INSERT INTO test.t1 VALUES(20);
+INSERT INTO test.t2 VALUES(20);
+
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
@@ -26,6 +31,8 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables-exclude=test.*2" "--databases-exclude=db2" --target-dir=$targetdir;
--enable_result_log
+COMMIT;
+
# check that only t1 table is in backup (t2 is excluded)
list_files $targetdir/test *.new;
list_files $targetdir/test *.ibd;
@@ -47,4 +54,17 @@ DROP DATABASE db2;
rmdir $MYSQLD_DATADIR/db3;
rmdir $MYSQLD_DATADIR/db4;
rmdir $MYSQLD_DATADIR/db5;
+
+--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --export --prepare --target-dir="$targetdir" > $backup_log;
+--enable_result_log
+
+--let SEARCH_FILE=$backup_log
+--let SEARCH_PATTERN=Operating system error number
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=Could not find a valid tablespace file for
+--source include/search_pattern_in_file.inc
+--remove_file $backup_log
+
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/relative_path.opt b/mysql-test/suite/mariabackup/relative_path.opt
new file mode 100644
index 00000000000..3e3c33e44f8
--- /dev/null
+++ b/mysql-test/suite/mariabackup/relative_path.opt
@@ -0,0 +1 @@
+--innodb-undo-tablespaces=2
diff --git a/mysql-test/suite/mariabackup/relative_path.result b/mysql-test/suite/mariabackup/relative_path.result
new file mode 100644
index 00000000000..7aa0c6968f3
--- /dev/null
+++ b/mysql-test/suite/mariabackup/relative_path.result
@@ -0,0 +1,20 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+# xtrabackup backup
+# xtrabackup prepare
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart
+SELECT * FROM t;
+i
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/relative_path.test b/mysql-test/suite/mariabackup/relative_path.test
new file mode 100644
index 00000000000..bd25a217e71
--- /dev/null
+++ b/mysql-test/suite/mariabackup/relative_path.test
@@ -0,0 +1,35 @@
+--source include/have_innodb.inc
+
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log
+
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backup_log 2>&1;
+--enable_result_log
+
+echo # xtrabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+
+# If MDEV-28187 is not fixed, the following tries to copy backup to data
+# directory will fail, because their destination path will be the same as
+# their source path
+
+--let $backup_opts=--innodb_undo_directory=./
+--source include/restart_and_restore.inc
+
+--let $backup_opts=--innodb_log_group_home_dir=./
+--source include/restart_and_restore.inc
+
+--let $backup_opts=--innodb_data_home_dir=./
+--source include/restart_and_restore.inc
+
+--enable_result_log
+
+SELECT * FROM t;
+DROP TABLE t;
+rmdir $targetdir;
diff --git a/mysql-test/suite/merge/alter_table.result b/mysql-test/suite/merge/alter_table.result
new file mode 100644
index 00000000000..5adf610e5c0
--- /dev/null
+++ b/mysql-test/suite/merge/alter_table.result
@@ -0,0 +1,22 @@
+#
+# BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns
+#
+create table t1 ( a varchar(10) not null primary key ) engine=myisam;
+create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
+flush tables;
+alter table t1 modify a varchar(10);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` varchar(10) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`)
+flush tables;
+alter table t1 modify a varchar(10) not null;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` varchar(10) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci UNION=(`t1`)
+drop table if exists t1, t2;
diff --git a/mysql-test/suite/merge/alter_table.test b/mysql-test/suite/merge/alter_table.test
new file mode 100644
index 00000000000..da56772bf60
--- /dev/null
+++ b/mysql-test/suite/merge/alter_table.test
@@ -0,0 +1,12 @@
+--echo #
+--echo # BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns
+--echo #
+create table t1 ( a varchar(10) not null primary key ) engine=myisam;
+create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
+flush tables;
+alter table t1 modify a varchar(10);
+show create table t2;
+flush tables;
+alter table t1 modify a varchar(10) not null;
+show create table t2;
+drop table if exists t1, t2;
diff --git a/mysql-test/main/merge.result b/mysql-test/suite/merge/merge.result
index 7144fd1d349..d0df8334949 100644
--- a/mysql-test/main/merge.result
+++ b/mysql-test/suite/merge/merge.result
@@ -3962,6 +3962,20 @@ SELECT DISTINCT f FROM tm WHERE f IN (47, 126, 97, 48, 73, 0);
f
DROP TABLE tm, t1, t2;
#
+# MDEV-30786 SIGFPE in cost_group_min_max on EXP
+#
+SET use_stat_tables='preferably';
+CREATE TABLE t1 (a INT,b INT,KEY i1 (a),KEY i2 (b)) ENGINE=MRG_MyISAM;
+ANALYZE LOCAL TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze note The storage engine for the table doesn't support analyze
+EXPLAIN SELECT DISTINCT a FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL i1 5 NULL 1 Using index for group-by
+drop table t1;
+set use_stat_tables=default;
+#
# End of 11.0 tests
#
#
diff --git a/mysql-test/main/merge.test b/mysql-test/suite/merge/merge.test
index f8f421994e9..f35a41a06b2 100644
--- a/mysql-test/main/merge.test
+++ b/mysql-test/suite/merge/merge.test
@@ -2919,6 +2919,16 @@ SELECT DISTINCT f FROM tm WHERE f IN (47, 126, 97, 48, 73, 0);
DROP TABLE tm, t1, t2;
--echo #
+--echo # MDEV-30786 SIGFPE in cost_group_min_max on EXP
+--echo #
+SET use_stat_tables='preferably';
+CREATE TABLE t1 (a INT,b INT,KEY i1 (a),KEY i2 (b)) ENGINE=MRG_MyISAM;
+ANALYZE LOCAL TABLE t1;
+EXPLAIN SELECT DISTINCT a FROM t1;
+drop table t1;
+set use_stat_tables=default;
+
+--echo #
--echo # End of 11.0 tests
--echo #
--echo #
diff --git a/mysql-test/main/merge_debug.result b/mysql-test/suite/merge/merge_debug.result
index 36cf254f87e..36cf254f87e 100644
--- a/mysql-test/main/merge_debug.result
+++ b/mysql-test/suite/merge/merge_debug.result
diff --git a/mysql-test/main/merge_debug.test b/mysql-test/suite/merge/merge_debug.test
index 4141042c261..4141042c261 100644
--- a/mysql-test/main/merge_debug.test
+++ b/mysql-test/suite/merge/merge_debug.test
diff --git a/mysql-test/main/merge_innodb.result b/mysql-test/suite/merge/merge_innodb.result
index 5aa344a9391..5aa344a9391 100644
--- a/mysql-test/main/merge_innodb.result
+++ b/mysql-test/suite/merge/merge_innodb.result
diff --git a/mysql-test/main/merge_innodb.test b/mysql-test/suite/merge/merge_innodb.test
index 9f87f241d00..9f87f241d00 100644
--- a/mysql-test/main/merge_innodb.test
+++ b/mysql-test/suite/merge/merge_innodb.test
diff --git a/mysql-test/main/merge_mmap-master.opt b/mysql-test/suite/merge/merge_mmap-master.opt
index 9606fb57187..9606fb57187 100644
--- a/mysql-test/main/merge_mmap-master.opt
+++ b/mysql-test/suite/merge/merge_mmap-master.opt
diff --git a/mysql-test/main/merge_mmap.result b/mysql-test/suite/merge/merge_mmap.result
index 8e655a0491b..8e655a0491b 100644
--- a/mysql-test/main/merge_mmap.result
+++ b/mysql-test/suite/merge/merge_mmap.result
diff --git a/mysql-test/main/merge_mmap.test b/mysql-test/suite/merge/merge_mmap.test
index 01c3896bd02..01c3896bd02 100644
--- a/mysql-test/main/merge_mmap.test
+++ b/mysql-test/suite/merge/merge_mmap.test
diff --git a/mysql-test/suite/perfschema/r/digest_view.result b/mysql-test/suite/perfschema/r/digest_view.result
index 3fd7a090459..9b9f31dcde9 100644
--- a/mysql-test/suite/perfschema/r/digest_view.result
+++ b/mysql-test/suite/perfschema/r/digest_view.result
@@ -191,17 +191,17 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
-test 333a53e537d74bf74dd28c78ad5b23dd EXPLAIN SELECT * FROM `test` . `v1` 1
-test 1fb578da66e6583bae8e64061486f1b1 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
-test 923bca939a55826e231e1335016ba418 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
-test 6fa6d75432fd499d1c7d6f964c8310a2 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
-test 3421da1ec8ecb8cac97e12a0609f73cb EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
-test c2f68fd41bfbf3acd52eb5e7306b0c00 SELECT * FROM `test` . `v1` 1
-test dd68812cbe4c1ed5a38921222981f8c5 SELECT * FROM `test` . `v1` WHERE `a` = ? 1
-test 7563bcc32c6d0d872c8d9f0bf7717e6a SELECT * FROM `test` . `v1` WHERE `b` > ? 1
-test 0817c53833dc6adbca581e8fe4c598c7 SELECT `a` , `b` FROM `test` . `v1` 1
-test a5f13903c70812ae08fa8c084e9cd503 SELECT `b` , `a` FROM `test` . `v1` 1
-test 66b14a14f2a42e1335dd28dfad8ea084 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test 78b80220002834f612d11b0663f64d59 EXPLAIN SELECT * FROM `test` . `v1` 1
+test 9649c572f7c7b927e314d31620294e34 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
+test 304c0393779f7b183065e7b577f1be26 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
+test 6e400ce1796d40cfefa45333d6e5895c EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
+test 36c8726233a5c621742d35107d72e5e0 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
+test 0aeb23572eed79a9e05cafe0e9cd1909 SELECT * FROM `test` . `v1` 1
+test 28bd92caf5c189316fab14a67b622203 SELECT * FROM `test` . `v1` WHERE `a` = ? 1
+test 637dba52704594bc4275ba3f37b8f851 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
+test fd8e83e523b0eec97a94eef612154591 SELECT `a` , `b` FROM `test` . `v1` 1
+test c58ed156113959965ebf619b6dd3a8b2 SELECT `b` , `a` FROM `test` . `v1` 1
+test 4d9d22440ce86533e3fac764ab259bbd TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN SELECT * from test.v1;
@@ -248,19 +248,19 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
-test 98531b331031b84ddfbb2de8b601a704 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
-test 5352d7d117e97fecd312e354e9e290ce DROP TABLE `test` . `v1` 1
-test 333a53e537d74bf74dd28c78ad5b23dd EXPLAIN SELECT * FROM `test` . `v1` 2
-test 1fb578da66e6583bae8e64061486f1b1 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
-test 923bca939a55826e231e1335016ba418 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
-test 6fa6d75432fd499d1c7d6f964c8310a2 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
-test 3421da1ec8ecb8cac97e12a0609f73cb EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
-test c2f68fd41bfbf3acd52eb5e7306b0c00 SELECT * FROM `test` . `v1` 2
-test dd68812cbe4c1ed5a38921222981f8c5 SELECT * FROM `test` . `v1` WHERE `a` = ? 2
-test 7563bcc32c6d0d872c8d9f0bf7717e6a SELECT * FROM `test` . `v1` WHERE `b` > ? 2
-test 21c19dd7ef5b894f3e32d0585cb3007f SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
-test 0817c53833dc6adbca581e8fe4c598c7 SELECT `a` , `b` FROM `test` . `v1` 2
-test a5f13903c70812ae08fa8c084e9cd503 SELECT `b` , `a` FROM `test` . `v1` 2
-test 66b14a14f2a42e1335dd28dfad8ea084 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test 4ccb56972e9c19941d4928d31502e796 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
+test a087be31e6440102676ef0171b8b2734 DROP TABLE `test` . `v1` 1
+test 78b80220002834f612d11b0663f64d59 EXPLAIN SELECT * FROM `test` . `v1` 2
+test 9649c572f7c7b927e314d31620294e34 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
+test 304c0393779f7b183065e7b577f1be26 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
+test 6e400ce1796d40cfefa45333d6e5895c EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
+test 36c8726233a5c621742d35107d72e5e0 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
+test 0aeb23572eed79a9e05cafe0e9cd1909 SELECT * FROM `test` . `v1` 2
+test 28bd92caf5c189316fab14a67b622203 SELECT * FROM `test` . `v1` WHERE `a` = ? 2
+test 637dba52704594bc4275ba3f37b8f851 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
+test 765bf27a2d45249dcc6377bcc02e1c4b SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
+test fd8e83e523b0eec97a94eef612154591 SELECT `a` , `b` FROM `test` . `v1` 2
+test c58ed156113959965ebf619b6dd3a8b2 SELECT `b` , `a` FROM `test` . `v1` 2
+test 4d9d22440ce86533e3fac764ab259bbd TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;
diff --git a/mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result b/mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result
new file mode 100644
index 00000000000..8f3a17a0fc5
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result
@@ -0,0 +1,41 @@
+SET default_storage_engine=InnoDB;
+SELECT @save_instrument_enabled := ENABLED
+, @save_instrument_timed := TIMED
+FROM performance_schema.setup_instruments
+WHERE NAME = 'wait/lock/table/sql/handler';
+@save_instrument_enabled := ENABLED @save_instrument_timed := TIMED
+YES YES
+SELECT @save_consumer_enabled := ENABLED
+FROM performance_schema.setup_consumers
+WHERE NAME = 'events_waits_current';
+@save_consumer_enabled := ENABLED
+YES
+UPDATE performance_schema.setup_instruments
+SET ENABLED = 'YES', TIMED = 'YES'
+WHERE NAME = 'wait/lock/table/sql/handler';
+UPDATE performance_schema.setup_consumers
+SET ENABLED = 'YES'
+WHERE NAME = 'events_waits_current';
+CREATE TABLE t1 (id1 INT(11), col1 VARCHAR (200));
+INSERT INTO t1 VALUES (1, 'aa');
+INSERT INTO t1 VALUES (2, 'bb');
+connect con1,localhost,root,,test;
+connect con2,localhost,root,,test;
+connection con1;
+START TRANSACTION;
+connection con2;
+START TRANSACTION;
+SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE;
+connection default;
+SELECT event_name FROM performance_schema.events_waits_current
+WHERE event_name LIKE '%wait/lock/table/sql/handler%';
+event_name
+UPDATE performance_schema.setup_instruments
+SET ENABLED = @save_instrument_enabled, TIMED = @save_instrument_timed
+WHERE NAME = 'wait/lock/table/sql/handler';
+UPDATE performance_schema.setup_consumers
+SET ENABLED = @save_consumer_enabled
+WHERE NAME = 'events_waits_current';
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result b/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
index ff554155f33..8772d7bf003 100644
--- a/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
+++ b/mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
####################################
SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
event_name digest digest_text sql_text
-statement/sql/select 96a6bb95edaf100857f09c968aca354b SELECT ? + ? + SELECT ...
-statement/sql/truncate c1d647bb870f2c63c22a16707bb8aee3 TRUNCATE TABLE truncat...
+statement/sql/select be5dd6a08f2e34c86168c154f61cbf8c SELECT ? + ? + SELECT ...
+statement/sql/truncate e2b84d4b47baf073fa24b65f724e9431 TRUNCATE TABLE truncat...
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
index 52ece6d289d..47f4d7ba346 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
@@ -202,10 +202,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -262,10 +260,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -328,10 +324,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -429,10 +423,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -500,10 +492,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -613,10 +603,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 48
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 41 TABLE test t1
+wait/lock/table/sql/handler 78 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -689,10 +677,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 48
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 41 TABLE test t1
+wait/lock/table/sql/handler 78 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -814,10 +800,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 48
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 41 TABLE test t1
+wait/lock/table/sql/handler 78 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -891,10 +875,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -965,10 +947,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1039,10 +1019,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1110,10 +1088,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1180,10 +1156,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1249,10 +1223,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1317,10 +1289,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1387,10 +1357,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1456,10 +1424,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1525,10 +1491,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1594,10 +1558,8 @@ wait/io/table/sql/handler 71
wait/lock/table/sql/handler 56
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1663,10 +1625,8 @@ wait/io/table/sql/handler 0
wait/lock/table/sql/handler 0
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 0 0 0 0 0 0 0
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
index b0ea06f4254..9810d104ed9 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
@@ -211,12 +211,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -279,12 +276,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -353,12 +347,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -462,12 +453,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -541,12 +529,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -662,12 +647,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 24 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 41 TABLE test t1
+wait/lock/table/sql/handler 56 TABLE test t2
+wait/lock/table/sql/handler 78 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -746,12 +728,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 24 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 41 TABLE test t1
+wait/lock/table/sql/handler 56 TABLE test t2
+wait/lock/table/sql/handler 78 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -879,12 +858,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 24 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 41 TABLE test t1
+wait/lock/table/sql/handler 56 TABLE test t2
+wait/lock/table/sql/handler 78 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -964,12 +940,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1046,12 +1019,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1128,12 +1098,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1207,12 +1174,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1285,12 +1249,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1362,12 +1323,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1438,12 +1396,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1516,12 +1471,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1593,12 +1545,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1670,12 +1619,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1747,12 +1693,9 @@ wait/io/table/sql/handler 103
wait/lock/table/sql/handler 84
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 17 11 6 11 2 4 0
@@ -1824,12 +1767,9 @@ wait/io/table/sql/handler 0
wait/lock/table/sql/handler 0
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 21 TABLE test t1
-wait/lock/table/sql/handler 24 TABLE test t1
-wait/io/table/sql/handler 32 TABLE test t2
-wait/lock/table/sql/handler 28 TABLE test t2
-wait/io/table/sql/handler 50 TABLE test t3
-wait/lock/table/sql/handler 32 TABLE test t3
+wait/lock/table/sql/handler 45 TABLE test t1
+wait/lock/table/sql/handler 60 TABLE test t2
+wait/lock/table/sql/handler 82 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 0 0 0 0 0 0 0
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
index 0a6dea739e4..367a8a089eb 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
@@ -202,10 +202,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -262,10 +260,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -328,10 +324,8 @@ wait/io/table/sql/handler 23
wait/lock/table/sql/handler 24
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -429,10 +423,8 @@ wait/io/table/sql/handler 58
wait/lock/table/sql/handler 48
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 18 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 40 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 38 TABLE test t1
+wait/lock/table/sql/handler 68 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 14 9 5 9 2 3 0
@@ -500,10 +492,8 @@ wait/io/table/sql/handler 58
wait/lock/table/sql/handler 48
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 18 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 40 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 38 TABLE test t1
+wait/lock/table/sql/handler 68 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 14 9 5 9 2 3 0
@@ -613,10 +603,8 @@ wait/io/table/sql/handler 106
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 31 TABLE test t1
-wait/lock/table/sql/handler 30 TABLE test t1
-wait/io/table/sql/handler 75 TABLE test t3
-wait/lock/table/sql/handler 42 TABLE test t3
+wait/lock/table/sql/handler 61 TABLE test t1
+wait/lock/table/sql/handler 117 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 25 16 9 16 3 6 0
@@ -689,10 +677,8 @@ wait/io/table/sql/handler 106
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 31 TABLE test t1
-wait/lock/table/sql/handler 30 TABLE test t1
-wait/io/table/sql/handler 75 TABLE test t3
-wait/lock/table/sql/handler 42 TABLE test t3
+wait/lock/table/sql/handler 61 TABLE test t1
+wait/lock/table/sql/handler 117 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 25 16 9 16 3 6 0
@@ -814,10 +800,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 96
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 40 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 56 TABLE test t3
+wait/lock/table/sql/handler 87 TABLE test t1
+wait/lock/table/sql/handler 176 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -891,10 +875,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -965,10 +947,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1039,10 +1019,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1110,10 +1088,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1180,10 +1156,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1249,10 +1223,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1317,10 +1289,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1387,10 +1357,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1456,10 +1424,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1525,10 +1491,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1594,10 +1558,8 @@ wait/io/table/sql/handler 167
wait/lock/table/sql/handler 104
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1663,10 +1625,8 @@ wait/io/table/sql/handler 0
wait/lock/table/sql/handler 0
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 0 0 0 0 0 0 0
diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
index c2eda2b8f23..ed1ac9d979b 100644
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
@@ -211,12 +211,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -279,12 +276,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -353,12 +347,9 @@ wait/io/table/sql/handler 33
wait/lock/table/sql/handler 36
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 8 TABLE test t1
-wait/lock/table/sql/handler 10 TABLE test t1
-wait/io/table/sql/handler 10 TABLE test t2
-wait/lock/table/sql/handler 12 TABLE test t2
-wait/io/table/sql/handler 15 TABLE test t3
-wait/lock/table/sql/handler 14 TABLE test t3
+wait/lock/table/sql/handler 18 TABLE test t1
+wait/lock/table/sql/handler 22 TABLE test t2
+wait/lock/table/sql/handler 29 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 6 4 2 4 1 1 0
@@ -462,12 +453,9 @@ wait/io/table/sql/handler 84
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 18 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 26 TABLE test t2
-wait/lock/table/sql/handler 24 TABLE test t2
-wait/io/table/sql/handler 40 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 38 TABLE test t1
+wait/lock/table/sql/handler 50 TABLE test t2
+wait/lock/table/sql/handler 68 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 14 9 5 9 2 3 0
@@ -541,12 +529,9 @@ wait/io/table/sql/handler 84
wait/lock/table/sql/handler 72
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 18 TABLE test t1
-wait/lock/table/sql/handler 20 TABLE test t1
-wait/io/table/sql/handler 26 TABLE test t2
-wait/lock/table/sql/handler 24 TABLE test t2
-wait/io/table/sql/handler 40 TABLE test t3
-wait/lock/table/sql/handler 28 TABLE test t3
+wait/lock/table/sql/handler 38 TABLE test t1
+wait/lock/table/sql/handler 50 TABLE test t2
+wait/lock/table/sql/handler 68 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 14 9 5 9 2 3 0
@@ -662,12 +647,9 @@ wait/io/table/sql/handler 154
wait/lock/table/sql/handler 108
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 31 TABLE test t1
-wait/lock/table/sql/handler 30 TABLE test t1
-wait/io/table/sql/handler 48 TABLE test t2
-wait/lock/table/sql/handler 36 TABLE test t2
-wait/io/table/sql/handler 75 TABLE test t3
-wait/lock/table/sql/handler 42 TABLE test t3
+wait/lock/table/sql/handler 61 TABLE test t1
+wait/lock/table/sql/handler 84 TABLE test t2
+wait/lock/table/sql/handler 117 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 25 16 9 16 3 6 0
@@ -746,12 +728,9 @@ wait/io/table/sql/handler 154
wait/lock/table/sql/handler 108
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 31 TABLE test t1
-wait/lock/table/sql/handler 30 TABLE test t1
-wait/io/table/sql/handler 48 TABLE test t2
-wait/lock/table/sql/handler 36 TABLE test t2
-wait/io/table/sql/handler 75 TABLE test t3
-wait/lock/table/sql/handler 42 TABLE test t3
+wait/lock/table/sql/handler 61 TABLE test t1
+wait/lock/table/sql/handler 84 TABLE test t2
+wait/lock/table/sql/handler 117 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 25 16 9 16 3 6 0
@@ -879,12 +858,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 144
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 40 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 48 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 56 TABLE test t3
+wait/lock/table/sql/handler 87 TABLE test t1
+wait/lock/table/sql/handler 124 TABLE test t2
+wait/lock/table/sql/handler 176 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -964,12 +940,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1046,12 +1019,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1128,12 +1098,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1207,12 +1174,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1285,12 +1249,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1362,12 +1323,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1438,12 +1396,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1516,12 +1471,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1593,12 +1545,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1670,12 +1619,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1747,12 +1693,9 @@ wait/io/table/sql/handler 243
wait/lock/table/sql/handler 156
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 39 25 14 25 4 10 0
@@ -1824,12 +1767,9 @@ wait/io/table/sql/handler 0
wait/lock/table/sql/handler 0
execute dump_waits_history;
event_name count(event_name) object_type object_schema object_name
-wait/io/table/sql/handler 47 TABLE test t1
-wait/lock/table/sql/handler 44 TABLE test t1
-wait/io/table/sql/handler 76 TABLE test t2
-wait/lock/table/sql/handler 52 TABLE test t2
-wait/io/table/sql/handler 120 TABLE test t3
-wait/lock/table/sql/handler 60 TABLE test t3
+wait/lock/table/sql/handler 91 TABLE test t1
+wait/lock/table/sql/handler 128 TABLE test t2
+wait/lock/table/sql/handler 180 TABLE test t3
execute dump_waits_index_io;
object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete
TABLE test t1 NULL 0 0 0 0 0 0 0
diff --git a/mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test b/mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test
new file mode 100644
index 00000000000..d9330ee5a9d
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test
@@ -0,0 +1,62 @@
+#
+# proper event name wait/lock/table/sql/handler recorded in
+# PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. Before this fix, it was
+# labeled as wait/io/table/sql/handler.
+#
+
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+--source include/not_embedded.inc
+
+SET default_storage_engine=InnoDB;
+
+SELECT @save_instrument_enabled := ENABLED
+, @save_instrument_timed := TIMED
+FROM performance_schema.setup_instruments
+WHERE NAME = 'wait/lock/table/sql/handler';
+
+SELECT @save_consumer_enabled := ENABLED
+FROM performance_schema.setup_consumers
+WHERE NAME = 'events_waits_current';
+
+UPDATE performance_schema.setup_instruments
+SET ENABLED = 'YES', TIMED = 'YES'
+WHERE NAME = 'wait/lock/table/sql/handler';
+
+UPDATE performance_schema.setup_consumers
+SET ENABLED = 'YES'
+WHERE NAME = 'events_waits_current';
+
+CREATE TABLE t1 (id1 INT(11), col1 VARCHAR (200));
+INSERT INTO t1 VALUES (1, 'aa');
+INSERT INTO t1 VALUES (2, 'bb');
+
+connect (con1,localhost,root,,test);
+connect (con2,localhost,root,,test);
+
+connection con1;
+START TRANSACTION;
+let $wait_condition=
+ SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE;
+--source include/wait_condition.inc
+
+connection con2;
+START TRANSACTION;
+send SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE;
+
+connection default;
+SELECT event_name FROM performance_schema.events_waits_current
+WHERE event_name LIKE '%wait/lock/table/sql/handler%';
+
+# clean up
+UPDATE performance_schema.setup_instruments
+SET ENABLED = @save_instrument_enabled, TIMED = @save_instrument_timed
+WHERE NAME = 'wait/lock/table/sql/handler';
+
+UPDATE performance_schema.setup_consumers
+SET ENABLED = @save_consumer_enabled
+WHERE NAME = 'events_waits_current';
+
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/period/r/overlaps.result b/mysql-test/suite/period/r/overlaps.result
index 3ed8e1a0014..78b1ac18b8d 100644
--- a/mysql-test/suite/period/r/overlaps.result
+++ b/mysql-test/suite/period/r/overlaps.result
@@ -351,3 +351,101 @@ primary key(id, p without overlaps)
) engine=heap partition by hash(id);
update t set id = 1;
drop table t, t1;
+#
+# MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci
+#
+CREATE TABLE t1 (
+datetime_column_name_1 DATETIME(6) NOT NULL,
+datetime_column_name_2 DATETIME(6) NOT NULL,
+text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+TRUNCATE TABLE t1;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+DROP TABLE t1;
+CREATE TABLE `t1` (
+datetime_column_name_1 DATETIME(6) NOT NULL,
+datetime_column_name_2 DATETIME(6) NOT NULL,
+text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def');
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def ');
+SELECT *, LENGTH(text_column_name) FROM t1;
+datetime_column_name_1 datetime_column_name_2 text_column_name LENGTH(text_column_name)
+2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 3
+2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 4
+2000-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 def 5
+DROP TABLE t1;
+CREATE TABLE t1 (
+datetime_column_name_1 DATETIME(6) NOT NULL,
+datetime_column_name_2 DATETIME(6) NOT NULL,
+text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+UNIQUE KEY index_name (text_column_name(3),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
+TRUNCATE TABLE t1;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
+DROP TABLE t1;
+CREATE TABLE t1 (
+datetime_column_name_1 DATETIME(6) NOT NULL,
+datetime_column_name_2 DATETIME(6) NOT NULL,
+char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+UNIQUE KEY index_name (char_column_name(191),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
+TRUNCATE TABLE t1;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
+DROP TABLE t1;
+CREATE TABLE t1 (
+datetime_column_name_1 DATETIME(6) NOT NULL,
+datetime_column_name_2 DATETIME(6) NOT NULL,
+char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+UNIQUE KEY index_name (char_column_name(3),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
+TRUNCATE TABLE t1;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+ERROR 23000: Duplicate entry 'abc-2001-01-01 00:00:00.000000-2000-01-01 00:00:00.000000' for key 'index_name'
+DROP TABLE t1;
diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test
index 6cd78769d4a..4611aa15ddd 100644
--- a/mysql-test/suite/period/t/overlaps.test
+++ b/mysql-test/suite/period/t/overlaps.test
@@ -344,3 +344,113 @@ create or replace table t (id int, s date, e date, period for p(s,e),
update t set id = 1;
drop table t, t1;
+
+--echo #
+--echo # MDEV-30415 PERIOD false positive overlap wtih utf8mb4_unicode_nopad_ci
+--echo #
+
+# The originally reported script with a TEXT column (slightly modified)
+CREATE TABLE t1 (
+ datetime_column_name_1 DATETIME(6) NOT NULL,
+ datetime_column_name_2 DATETIME(6) NOT NULL,
+ text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+ UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+TRUNCATE TABLE t1;
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+DROP TABLE t1;
+
+
+# The script reported by Alice with a TEXT column
+CREATE TABLE `t1` (
+ datetime_column_name_1 DATETIME(6) NOT NULL,
+ datetime_column_name_2 DATETIME(6) NOT NULL,
+ text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+ UNIQUE KEY index_name (text_column_name(191),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+INSERT INTO t1 VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def');
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def'),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def '),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'def ');
+--sorted_result
+SELECT *, LENGTH(text_column_name) FROM t1;
+DROP TABLE t1;
+
+
+# A TEXT column with a short prefix
+CREATE TABLE t1 (
+ datetime_column_name_1 DATETIME(6) NOT NULL,
+ datetime_column_name_2 DATETIME(6) NOT NULL,
+ text_column_name TEXT COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+ UNIQUE KEY index_name (text_column_name(3),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+--error ER_DUP_ENTRY
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+TRUNCATE TABLE t1;
+--error ER_DUP_ENTRY
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, text_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+DROP TABLE t1;
+
+
+# A CHAR with a long prefix
+CREATE TABLE t1 (
+ datetime_column_name_1 DATETIME(6) NOT NULL,
+ datetime_column_name_2 DATETIME(6) NOT NULL,
+ char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+ UNIQUE KEY index_name (char_column_name(191),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+--error ER_DUP_ENTRY
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+TRUNCATE TABLE t1;
+--error ER_DUP_ENTRY
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+DROP TABLE t1;
+
+
+# A CHAR column with a short prefix
+CREATE TABLE t1 (
+ datetime_column_name_1 DATETIME(6) NOT NULL,
+ datetime_column_name_2 DATETIME(6) NOT NULL,
+ char_column_name CHAR(255) COLLATE utf8mb4_unicode_nopad_ci NOT NULL,
+ PERIOD FOR period_name (datetime_column_name_1, datetime_column_name_2),
+ UNIQUE KEY index_name (char_column_name(3),period_name WITHOUT OVERLAPS)
+) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_nopad_ci;
+--error ER_DUP_ENTRY
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc'),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc ');
+TRUNCATE TABLE t1;
+--error ER_DUP_ENTRY
+INSERT INTO t1 (datetime_column_name_1, datetime_column_name_2, char_column_name)
+VALUES
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc '),
+ ('2000-01-01 00:00:00.000000', '2001-01-01 00:00:00.000000', 'abc');
+DROP TABLE t1;
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_install.result b/mysql-test/suite/plugins/r/feedback_plugin_install.result
index c7f7a5c79f3..d2291f20b4f 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_install.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_install.result
@@ -11,6 +11,6 @@ FEEDBACK version 1.1
FEEDBACK_HTTP_PROXY
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
-FEEDBACK_URL http://mariadb.org/feedback_plugin/post
+FEEDBACK_URL http://feedback.mariadb.org/rest/v1/post
FEEDBACK_USER_INFO mysql-test
uninstall plugin feedback;
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index f31c7325ca1..23376c684dd 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -13,7 +13,7 @@ FEEDBACK version 1.1
FEEDBACK_HTTP_PROXY
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
-FEEDBACK_URL http://mariadb.org/feedback_plugin/post
+FEEDBACK_URL http://feedback.mariadb.org/rest/v1/post
FEEDBACK_USER_INFO mysql-test
SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK
WHERE VARIABLE_NAME LIKE 'Collation used %'
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index b10ea915a4f..1f7539978c8 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -13,7 +13,7 @@ FEEDBACK version 1.1
FEEDBACK_HTTP_PROXY
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
-FEEDBACK_URL http://mariadb.org/feedback_plugin/post
+FEEDBACK_URL http://feedback.mariadb.org/rest/v1/post
FEEDBACK_USER_INFO mysql-test
SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK
WHERE VARIABLE_NAME LIKE 'Collation used %'
@@ -42,5 +42,5 @@ VARIABLE_VALUE>0 VARIABLE_NAME
deallocate prepare stmt;
set global sql_mode=ONLY_FULL_GROUP_BY;
# restart
-feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
+feedback plugin: report to 'http://feedback.mariadb.org/rest/v1/post' was sent
feedback plugin: server replied 'ok'
diff --git a/mysql-test/suite/plugins/r/locales.result b/mysql-test/suite/plugins/r/locales.result
index a6848fb8486..de71d9548f7 100644
--- a/mysql-test/suite/plugins/r/locales.result
+++ b/mysql-test/suite/plugins/r/locales.result
@@ -57,7 +57,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU
53 uk_UA Ukrainian - Ukraine 8 9 , . ukrainian
54 ur_PK Urdu - Pakistan 6 6 . , english
55 vi_VN Vietnamese - Vietnam 16 11 , . english
-56 zh_CN Chinese - Peoples Republic of China 3 3 . , english
+56 zh_CN Chinese - Peoples Republic of China 3 3 . , chinese
57 zh_TW Chinese - Taiwan 3 2 . , english
58 ar_DZ Arabic - Algeria 6 8 . , english
59 ar_EG Arabic - Egypt 6 8 . , english
@@ -171,7 +171,7 @@ Id Name Description Error_Message_Language
53 uk_UA Ukrainian - Ukraine ukrainian
54 ur_PK Urdu - Pakistan english
55 vi_VN Vietnamese - Vietnam english
-56 zh_CN Chinese - Peoples Republic of China english
+56 zh_CN Chinese - Peoples Republic of China chinese
57 zh_TW Chinese - Taiwan english
58 ar_DZ Arabic - Algeria english
59 ar_EG Arabic - Egypt english
diff --git a/mysql-test/suite/roles/role_grant_propagate.result b/mysql-test/suite/roles/role_grant_propagate.result
index 7804b7b7a3c..111fd4dbc28 100644
--- a/mysql-test/suite/roles/role_grant_propagate.result
+++ b/mysql-test/suite/roles/role_grant_propagate.result
@@ -163,5 +163,18 @@ drop role student;
drop role admin;
drop database crm;
#
+# MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns
+#
+create table t1 ( pk int, i int);
+create role a;
+grant select (i), update (pk) on t1 to a;
+revoke update (pk) on t1 from a;
+show grants for a;
+Grants for a
+GRANT USAGE ON *.* TO `a`
+GRANT SELECT (`i`) ON `test`.`t1` TO `a`
+drop role a;
+drop table t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/suite/roles/role_grant_propagate.test b/mysql-test/suite/roles/role_grant_propagate.test
index bf20bc00809..02d451f0afd 100644
--- a/mysql-test/suite/roles/role_grant_propagate.test
+++ b/mysql-test/suite/roles/role_grant_propagate.test
@@ -197,5 +197,16 @@ drop role admin;
drop database crm;
--echo #
+--echo # MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns
+--echo #
+create table t1 ( pk int, i int);
+create role a;
+grant select (i), update (pk) on t1 to a;
+revoke update (pk) on t1 from a;
+show grants for a;
+drop role a;
+drop table t1;
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc
deleted file mode 100644
index ab95c9b4ee3..00000000000
--- a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc
+++ /dev/null
@@ -1,443 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-# Usage:
-# --let $binlog_limit= X[,Y] # optional
-#
-# Semantics of the value is the same as in include/show_binlog_events.inc
-# which the script calls as a part of the test flow.
-# The goal is to print the event demonstrating the triggered error,
-# so normally Y should be 1 (print the exact event only);
-# however, depending on test-specific server options, the offset X
-# can be different.
-#
-
-# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
-# when generating new name.
-#
-# WHY
-# ===
-#
-# We want to check whether error is reported or not when
-# new_file_impl fails (this may happen when rotation is not
-# possible because there is some problem finding an
-# unique filename).
-#
-# HOW
-# ===
-#
-# Test cases are documented inline.
-
--- source include/have_innodb.inc
--- source include/have_debug.inc
--- source include/master-slave.inc
-
--- echo #######################################################################
--- echo ####################### PART 1: MASTER TESTS ##########################
--- echo #######################################################################
-
-
-### ACTION: stopping slave as it is not needed for the first part of
-### the test
-
--- connection slave
--- source include/stop_slave.inc
--- connection master
-
-call mtr.add_suppression("Can't generate a unique log-filename");
-call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
-call mtr.add_suppression("Error writing file .*");
-call mtr.add_suppression("Could not use master-bin for logging");
-
-SET @old_debug= @@global.debug_dbug;
-
-### ACTION: create a large file (> 4096 bytes) that will be later used
-### in LOAD DATA INFILE to check binlog errors in its vacinity
--- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data
--- let $MYSQLD_DATADIR= `select @@datadir`
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file'
-
-### ACTION: create a small file (< 4096 bytes) that will be later used
-### in LOAD DATA INFILE to check for absence of binlog errors
-### when file loading this file does not force flushing and
-### rotating the binary log
--- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data
--- let $MYSQLD_DATADIR= `select @@datadir`
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2'
-
-RESET MASTER;
-
--- echo ###################### TEST #1
-
-### ASSERTION: no problem flushing logs (should show two binlogs)
-FLUSH LOGS;
--- echo # assert: must show two binlogs
--- source include/show_binary_logs.inc
-
--- echo ###################### TEST #2
-
-### ASSERTION: check that FLUSH LOGS actually fails and reports
-### failure back to the user if find_uniq_filename fails
-### (should show just one binlog)
-
-RESET MASTER;
-SET @@global.debug_dbug="d,error_unique_log_filename";
--- error ER_NO_UNIQUE_LOGFILE
-FLUSH LOGS;
--- echo # assert: must show one binlog
--- source include/show_binary_logs.inc
-
-### ACTION: clean up and move to next test
-SET @@global.debug_dbug=@old_debug;
-RESET MASTER;
-
--- echo ###################### TEST #3
-
-### ACTION: create some tables (t1, t2, t4) and insert some values in
-### table t1
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
-CREATE TABLE t4 (a VARCHAR(16384));
-INSERT INTO t1 VALUES (1);
-RESET MASTER;
-
-### ASSERTION: we force rotation of the binary log because it exceeds
-### the max_binlog_size option (should show two binary
-### logs)
-
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
-
-# shows two binary logs
--- echo # assert: must show two binlog
--- source include/show_binary_logs.inc
-
-# clean up the table and the binlog to be used in next part of test
-SET @@global.debug_dbug=@old_debug;
-DELETE FROM t2;
-RESET MASTER;
-
--- echo ###################### TEST #4
-
-### ASSERTION: load the big file into a transactional table and check
-### that it reports error. The table will contain the
-### changes performed despite the fact that it reported an
-### error.
-
-SET @@global.debug_dbug="d,error_unique_log_filename";
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- error ER_NO_UNIQUE_LOGFILE
--- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
-
-# show table
--- echo # assert: must show one entry
-SELECT count(*) FROM t2;
-
-# clean up the table and the binlog to be used in next part of test
-SET @@global.debug_dbug=@old_debug;
-DELETE FROM t2;
-RESET MASTER;
-
--- echo ###################### TEST #5
-
-### ASSERTION: load the small file into a transactional table and
-### check that it succeeds
-
-SET @@global.debug_dbug="d,error_unique_log_filename";
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2
-
-# show table
--- echo # assert: must show one entry
-SELECT count(*) FROM t2;
-
-# clean up the table and the binlog to be used in next part of test
-SET @@global.debug_dbug=@old_debug;
-DELETE FROM t2;
-RESET MASTER;
-
--- echo ###################### TEST #6
-
-### ASSERTION: check that even if one is using a transactional table
-### and explicit transactions (no autocommit) if rotation
-### fails we get the error. Transaction is not rolledback
-### because rotation happens after the commit.
-
-SET @@global.debug_dbug="d,error_unique_log_filename";
-SET AUTOCOMMIT=0;
-INSERT INTO t2 VALUES ('muse');
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
-INSERT INTO t2 VALUES ('muse');
--- error ER_NO_UNIQUE_LOGFILE
-COMMIT;
-
-### ACTION: Show the contents of the table after the test
--- echo # assert: must show three entries
-SELECT count(*) FROM t2;
-
-### ACTION: clean up and move to the next test
-SET AUTOCOMMIT= 1;
-SET @@global.debug_dbug=@old_debug;
-DELETE FROM t2;
-RESET MASTER;
-
--- echo ###################### TEST #7
-
-### ASSERTION: check that on a non-transactional table, if rotation
-### fails then an error is reported and an incident event
-### is written to the current binary log.
-
-SET @@global.debug_dbug="d,error_unique_log_filename";
-
-# Disable logging Annotate_rows events to preserve events count.
-let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`;
-SET @@binlog_annotate_row_events= 0;
-
-SELECT count(*) FROM t4;
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- error ER_NO_UNIQUE_LOGFILE
--- eval LOAD DATA INFILE '$load_file' INTO TABLE t4
-
--- echo # assert: must show 1 entry
-SELECT count(*) FROM t4;
-
--- echo ### check that the incident event is written to the current log
-SET @@global.debug_dbug=@old_debug;
-if (!$binlog_limit)
-{
- -- let $binlog_limit= 4,1
-}
--- source include/show_binlog_events.inc
-
-# clean up and move to next test
-DELETE FROM t4;
-
---disable_query_log
-eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved;
---enable_query_log
-
-RESET MASTER;
-
--- echo ###################### TEST #8
-
-### ASSERTION: check that statements end up in error but they succeed
-### on changing the data.
-
-SET @@global.debug_dbug="d,error_unique_log_filename";
--- echo # must show 0 entries
-SELECT count(*) FROM t4;
-SELECT count(*) FROM t2;
-
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- error ER_NO_UNIQUE_LOGFILE
--- eval LOAD DATA INFILE '$load_file' INTO TABLE t4
--- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--- error ER_NO_UNIQUE_LOGFILE
--- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
--- error ER_NO_UNIQUE_LOGFILE
-INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc');
-
--- echo # INFO: Count(*) Before Offending DELETEs
--- echo # assert: must show 1 entry
-SELECT count(*) FROM t4;
--- echo # assert: must show 4 entries
-SELECT count(*) FROM t2;
-
--- error ER_NO_UNIQUE_LOGFILE
-DELETE FROM t4;
--- error ER_NO_UNIQUE_LOGFILE
-DELETE FROM t2;
-
--- echo # INFO: Count(*) After Offending DELETEs
--- echo # assert: must show zero entries
-SELECT count(*) FROM t4;
-SELECT count(*) FROM t2;
-
-# remove fault injection
-SET @@global.debug_dbug=@old_debug;
-
--- echo ###################### TEST #9
-
-### ASSERTION: check that if we disable binlogging, then statements
-### succeed.
-SET @@global.debug_dbug="d,error_unique_log_filename";
-SET SQL_LOG_BIN=0;
-INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
-INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
--- echo # assert: must show four entries
-SELECT count(*) FROM t2;
-SELECT count(*) FROM t4;
-DELETE FROM t2;
-DELETE FROM t4;
--- echo # assert: must show zero entries
-SELECT count(*) FROM t2;
-SELECT count(*) FROM t4;
-SET SQL_LOG_BIN=1;
-SET @@global.debug_dbug=@old_debug;
-
--- echo ###################### TEST #10
-
-### ASSERTION: check that error is reported if there is a failure
-### while registering the index file and the binary log
-### file or failure to write the rotate event.
-
-call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
-call mtr.add_suppression("Could not use .*");
-
-RESET MASTER;
-SHOW WARNINGS;
-
-# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
-SET @@global.debug_dbug="d,fault_injection_registering_index";
--- replace_regex /\.[\\\/]master/master/
--- error ER_CANT_OPEN_FILE
-FLUSH LOGS;
-SET @@global.debug_dbug=@old_debug;
-
--- error ER_NO_BINARY_LOGGING
-SHOW BINARY LOGS;
-
-# issue some statements and check that they don't fail
-CREATE TABLE t5 (a INT);
-INSERT INTO t4 VALUES ('bbbbb');
-INSERT INTO t2 VALUES ('aaaaa');
-DELETE FROM t4;
-DELETE FROM t2;
-DROP TABLE t5;
-flush tables;
-
--- echo ###################### TEST #11
-
-### ASSERTION: check that error is reported if there is a failure
-### while opening the index file and the binary log file or
-### failure to write the rotate event.
-
-# restart the server so that we have binlog again
---let $rpl_server_number= 1
---source include/rpl_restart_server.inc
-
-# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
-SET @@global.debug_dbug="d,fault_injection_openning_index";
--- replace_regex /\.[\\\/]master/master/
--- error ER_CANT_OPEN_FILE
-FLUSH LOGS;
-SET @@global.debug_dbug=@old_debug;
-
--- error ER_FLUSH_MASTER_BINLOG_CLOSED
-RESET MASTER;
-
-# issue some statements and check that they don't fail
-CREATE TABLE t5 (a INT);
-INSERT INTO t4 VALUES ('bbbbb');
-INSERT INTO t2 VALUES ('aaaaa');
-DELETE FROM t4;
-DELETE FROM t2;
-DROP TABLE t5;
-flush tables;
-
-# restart the server so that we have binlog again
---let $rpl_server_number= 1
---source include/rpl_restart_server.inc
-
--- echo ###################### TEST #12
-
-### ASSERTION: check that error is reported if there is a failure
-### while writing the rotate event when creating a new log
-### file.
-
-# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl
-SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
--- error ER_ERROR_ON_WRITE
-FLUSH LOGS;
-SET @@global.debug_dbug=@old_debug;
-
--- error ER_FLUSH_MASTER_BINLOG_CLOSED
-RESET MASTER;
-
-# issue some statements and check that they don't fail
-CREATE TABLE t5 (a INT);
-INSERT INTO t4 VALUES ('bbbbb');
-INSERT INTO t2 VALUES ('aaaaa');
-DELETE FROM t4;
-DELETE FROM t2;
-DROP TABLE t5;
-flush tables;
-
-# restart the server so that we have binlog again
---let $rpl_server_number= 1
---source include/rpl_restart_server.inc
-
-## clean up
-DROP TABLE t1, t2, t4;
-RESET MASTER;
-
-# restart slave again
--- connection slave
--- source include/start_slave.inc
--- connection master
-
--- echo #######################################################################
--- echo ####################### PART 2: SLAVE TESTS ###########################
--- echo #######################################################################
-
-### setup
---source include/rpl_reset.inc
--- connection slave
-
-# Slave tests rely on logic of non-gtid mode
---source include/stop_slave.inc
-CHANGE MASTER TO MASTER_USE_GTID=NO;
---source include/start_slave.inc
-
-# slave suppressions
-
-call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
-call mtr.add_suppression("Error writing file .*");
-call mtr.add_suppression("Could not use .*");
-call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
-call mtr.add_suppression("Can't generate a unique log-filename .*");
--- echo ###################### TEST #13
-
-#### ASSERTION: check against unique log filename error
--- let $io_thd_injection_fault_flag= error_unique_log_filename
--- let $slave_io_errno= 1595
--- let $show_slave_io_error= 1
--- source include/io_thd_fault_injection.inc
-
--- echo ###################### TEST #14
-
-#### ASSERTION: check against rotate failing
--- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event
--- let $slave_io_errno= 1595
--- let $show_slave_io_error= 1
--- source include/io_thd_fault_injection.inc
-
--- echo ###################### TEST #15
-
-#### ASSERTION: check against relay log open failure
--- let $io_thd_injection_fault_flag= fault_injection_registering_index
--- let $slave_io_errno= 1595
--- let $show_slave_io_error= 1
--- source include/io_thd_fault_injection.inc
-
--- echo ###################### TEST #16
-
-#### ASSERTION: check against relay log index open failure
--- let $io_thd_injection_fault_flag= fault_injection_openning_index
--- let $slave_io_errno= 1595
--- let $show_slave_io_error= 1
--- source include/io_thd_fault_injection.inc
-
-### clean up
--- source include/stop_slave_sql.inc
-RESET SLAVE;
-RESET MASTER;
---remove_file $load_file
---remove_file $load_file2
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc b/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc
deleted file mode 100644
index 7c1d0ea25e2..00000000000
--- a/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-#
-# Bug#11747416 : 32228 A disk full makes binary log corrupt.
-#
-#
-# The test demonstrates reading from binlog error propagation to slave
-# and reporting there.
-# Conditions for the bug include a crash at time of the last event to
-# the binlog was written partly. With the fixes the event is not sent out
-# any longer, but rather the dump thread sends out a sound error message.
-#
-# Crash is not simulated. A binlog with partly written event in its end is installed
-# and replication is started from it.
-#
-
---source include/have_binlog_format_mixed.inc
---source include/master-slave.inc
-
---connection slave
---source include/stop_slave.inc
-CHANGE MASTER TO MASTER_USE_GTID=NO;
---source include/start_slave.inc
-
-# Make sure the slave is stopped while we are messing with master.
-# Otherwise we get occasional failures as the slave manages to re-connect
-# to the newly started master and we get extra events applied, causing
-# conflicts.
---source include/stop_slave.inc
-
---connection master
-call mtr.add_suppression("Error in Log_event::read_log_event()");
---let $datadir= `SELECT @@datadir`
-
---let $rpl_server_number= 1
---source include/rpl_stop_server.inc
-
---remove_file $datadir/master-bin.000001
---copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001
-
---let $rpl_server_number= 1
---source include/rpl_start_server.inc
-
---source include/wait_until_connected_again.inc
-
-# evidence of the partial binlog
---error ER_ERROR_WHEN_EXECUTING_COMMAND
-show binlog events;
-
---connection slave
-call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
---let $master_use_gtid_option= No
---source include/reset_slave.inc
-start slave;
-
-# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
---let $slave_param=Last_IO_Errno
---let $slave_param_value=1236
---source include/wait_for_slave_param.inc
-
---let $slave_field_result_replace= / at [0-9]*/ at XXX/
---let $status_items= Last_IO_Errno, Last_IO_Error
---source include/show_slave_status.inc
-
-#
-# Cleanup
-#
-
---connection master
-reset master;
-
---connection slave
-stop slave;
-reset slave;
-# Table was created from binlog, it may not be created if SQL thread is running
-# slowly and IO thread reaches incident before SQL thread applies it.
---disable_warnings
-drop table if exists t;
---enable_warnings
-reset master;
-
---echo End of the tests
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_checksum.inc b/mysql-test/suite/rpl/include/rpl_checksum.inc
deleted file mode 100644
index fc765744b3f..00000000000
--- a/mysql-test/suite/rpl/include/rpl_checksum.inc
+++ /dev/null
@@ -1,342 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-# WL2540 replication events checksum
-# Testing configuration parameters
-
---source include/have_debug.inc
---source include/have_binlog_format_mixed.inc
---source include/master-slave.inc
-
---connection slave
---source include/stop_slave.inc
-CHANGE MASTER TO MASTER_USE_GTID=NO;
---source include/start_slave.inc
-
---connection master
-call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log');
-call mtr.add_suppression('Replication event checksum verification failed');
-# due to C failure simulation
-call mtr.add_suppression('Relay log write failure: could not queue event from master');
-call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them');
-
-# A. read/write access to the global vars:
-# binlog_checksum master_verify_checksum slave_sql_verify_checksum
-
-connection master;
-
-set @master_save_binlog_checksum= @@global.binlog_checksum;
-set @save_master_verify_checksum = @@global.master_verify_checksum;
-
-select @@global.binlog_checksum as 'must be CRC32 because of the command line option';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.binlog_checksum as 'no session var';
-
-select @@global.master_verify_checksum as 'must be zero because of default';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.master_verify_checksum as 'no session var';
-
-connection slave;
-
-set @slave_save_binlog_checksum= @@global.binlog_checksum;
-set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum;
-
-select @@global.slave_sql_verify_checksum as 'must be one because of default';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.slave_sql_verify_checksum as 'no session var';
-
-connection master;
-
-source include/show_binary_logs.inc;
-set @@global.binlog_checksum = NONE;
-select @@global.binlog_checksum;
---echo *** must be rotations seen ***
-source include/show_binary_logs.inc;
-
-set @@global.binlog_checksum = default;
-select @@global.binlog_checksum;
-
-# testing lack of side-effects in non-effective update of binlog_checksum:
-set @@global.binlog_checksum = CRC32;
-select @@global.binlog_checksum;
-set @@global.binlog_checksum = CRC32;
-
-set @@global.master_verify_checksum = 0;
-set @@global.master_verify_checksum = default;
-
---error ER_WRONG_VALUE_FOR_VAR
-set @@global.binlog_checksum = ADLER32;
---error ER_WRONG_VALUE_FOR_VAR
-set @@global.master_verify_checksum = 2; # the var is of bool type
-
-connection slave;
-
-set @@global.slave_sql_verify_checksum = 0;
-set @@global.slave_sql_verify_checksum = default;
---error ER_WRONG_VALUE_FOR_VAR
-set @@global.slave_sql_verify_checksum = 2; # the var is of bool type
-
-#
-# B. Old Slave to New master conditions
-#
-# while master does not send a checksum-ed binlog the Old Slave can
-# work with the New Master
-
-connection master;
-
-set @@global.binlog_checksum = NONE;
-create table t1 (a int);
-
-# testing that binlog rotation preserves opt_binlog_checksum value
-flush logs;
-flush logs;
--- source include/wait_for_binlog_checkpoint.inc
-flush logs;
-
-sync_slave_with_master;
-#connection slave;
-# checking that rotation on the slave side leaves slave stable
-flush logs;
-flush logs;
-flush logs;
-select count(*) as zero from t1;
-
-source include/stop_slave.inc;
-
-connection master;
-set @@global.binlog_checksum = CRC32;
--- source include/wait_for_binlog_checkpoint.inc
-insert into t1 values (1) /* will not be applied on slave due to simulation */;
-
-# instruction to the dump thread
-
-connection slave;
-set @saved_dbug = @@global.debug_dbug;
-set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
-start slave;
---let $slave_io_errno= 1236
---let $show_slave_io_error= 1
-source include/wait_for_slave_io_error.inc;
-
-select count(*) as zero from t1;
-
-set @@global.debug_dbug = @saved_dbug;
-
-connection slave;
-source include/start_slave.inc;
-
-#
-# C. checksum failure simulations
-#
-
-# C1. Failure by a client thread
-connection master;
-set @@global.master_verify_checksum = 1;
-set @save_dbug = @@session.debug_dbug;
-set @@session.debug_dbug='d,simulate_checksum_test_failure';
---error ER_ERROR_WHEN_EXECUTING_COMMAND
-show binlog events;
-SET debug_dbug= @save_dbug;
-set @@global.master_verify_checksum = default;
-
-#connection master;
-sync_slave_with_master;
-
-connection slave;
-source include/stop_slave.inc;
-
-connection master;
-create table t2 (a int);
-let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1);
-
-connection slave;
-
-# C2. Failure by IO thread
-# instruction to io thread
-set @saved_dbug = @@global.debug_dbug;
-set @@global.debug_dbug='d,simulate_checksum_test_failure';
-start slave io_thread;
-# When the checksum error is detected, the slave sets error code 1913
-# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
-# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
-# So we usually get 1595, but it is occasionally possible to get 1913.
---let $slave_io_errno= 1595,1913
---let $show_slave_io_error= 0
-source include/wait_for_slave_io_error.inc;
-set @@global.debug_dbug = @saved_dbug;
-
-# to make IO thread re-read it again w/o the failure
-start slave io_thread;
-let $slave_param= Read_Master_Log_Pos;
-let $slave_param_value= $pos_master;
-source include/wait_for_slave_param.inc;
-
-# C3. Failure by SQL thread
-# instruction to sql thread;
-set @@global.slave_sql_verify_checksum = 1;
-
-set @@global.debug_dbug='d,simulate_checksum_test_failure';
-
-start slave sql_thread;
---let $slave_sql_errno= 1593
---let $show_slave_sql_error= 1
-source include/wait_for_slave_sql_error.inc;
-
-# resuming SQL thread to parse out the event w/o the failure
-
-set @@global.debug_dbug = @saved_dbug;
-source include/start_slave.inc;
-
-connection master;
-sync_slave_with_master;
-
-#connection slave;
-select count(*) as 'must be zero' from t2;
-
-#
-# D. Reset slave, Change-Master, Binlog & Relay-log rotations with
-# random value on binlog_checksum on both master and slave
-#
-connection slave;
-stop slave;
---let $master_use_gtid_option= No
---source include/reset_slave.inc
-
-# randomize slave server's own checksum policy
-set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE");
-flush logs;
-
-connection master;
-set @@global.binlog_checksum= CRC32;
-reset master;
-flush logs;
-create table t3 (a int, b char(5));
-
-connection slave;
-source include/start_slave.inc;
-
-connection master;
-sync_slave_with_master;
-
-#connection slave;
-select count(*) as 'must be zero' from t3;
-source include/stop_slave.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
-eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
-
-connection master;
-flush logs;
-reset master;
-insert into t3 value (1, @@global.binlog_checksum);
-
-connection slave;
-source include/start_slave.inc;
-flush logs;
-
-connection master;
-sync_slave_with_master;
-
-#connection slave;
-select count(*) as 'must be one' from t3;
-
-connection master;
-set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE");
-insert into t3 value (1, @@global.binlog_checksum);
-sync_slave_with_master;
-
-#connection slave;
-
-#clean-up
-
-connection master;
-drop table t1, t2, t3;
-set @@global.binlog_checksum = @master_save_binlog_checksum;
-set @@global.master_verify_checksum = @save_master_verify_checksum;
-
-#
-# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540
-#
-# Sanity check that verifies that no assertions are triggered because
-# of old FD events (generated by versions prior to server released with
-# checksums feature)
-#
-# There is no need for query log, if something wrong this should trigger
-# an assertion
-
---disable_query_log
-
-BINLOG '
-MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
-';
-
---enable_query_log
-
-#connection slave;
-sync_slave_with_master;
-
-
---echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters ***
-
---connection master
-
---source include/wait_for_binlog_checkpoint.inc
-CREATE TABLE t4 (a INT PRIMARY KEY);
-INSERT INTO t4 VALUES (1);
-
-SET sql_log_bin=0;
-CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename");
-SET sql_log_bin=1;
-SET @old_dbug= @@GLOBAL.debug_dbug;
-SET debug_dbug= '+d,binlog_inject_new_name_error';
---error ER_NO_UNIQUE_LOGFILE
-FLUSH LOGS;
-SET debug_dbug= @old_dbug;
-
-INSERT INTO t4 VALUES (2);
-
---connection slave
---let $slave_sql_errno= 1590
---source include/wait_for_slave_sql_error.inc
-
-# Search the error log for the error message.
-# The bug was that 4 garbage bytes were output in the middle of the error
-# message; by searching for a pattern that spans that location, we can
-# catch the error.
-let $log_error_= `SELECT @@GLOBAL.log_error`;
-if(!$log_error_)
-{
- # MySQL Server on windows is started with --console and thus
- # does not know the location of its .err log, use default location
- let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
-}
---let SEARCH_FILE= $log_error_
---let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590
---source include/search_pattern_in_file.inc
-
-SELECT * FROM t4 ORDER BY a;
-STOP SLAVE IO_THREAD;
-SET sql_slave_skip_counter= 1;
---source include/start_slave.inc
-
---connection master
---save_master_pos
-
---connection slave
---sync_with_master
-SELECT * FROM t4 ORDER BY a;
-
-
---connection slave
-set @@global.binlog_checksum = @slave_save_binlog_checksum;
-set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum;
-
---echo End of tests
-
---connection master
-DROP TABLE t4;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_checksum_cache.inc b/mysql-test/suite/rpl/include/rpl_checksum_cache.inc
deleted file mode 100644
index e04f618b81e..00000000000
--- a/mysql-test/suite/rpl/include/rpl_checksum_cache.inc
+++ /dev/null
@@ -1,261 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
--- source include/have_innodb.inc
--- source include/master-slave.inc
-
---disable_warnings
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t2 set data=repeat.*'a', @act_size.*");
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*");
---enable_warnings
-
-connection master;
-set @save_binlog_cache_size = @@global.binlog_cache_size;
-set @save_binlog_checksum = @@global.binlog_checksum;
-set @save_master_verify_checksum = @@global.master_verify_checksum;
-set @@global.binlog_cache_size = 4096;
-set @@global.binlog_checksum = CRC32;
-set @@global.master_verify_checksum = 1;
-
-# restart slave to force the dump thread to verify events (on master side)
-connection slave;
-source include/stop_slave.inc;
-source include/start_slave.inc;
-
-connection master;
-
-#
-# Testing a critical part of checksum handling dealing with transaction cache.
-# The cache's buffer size is set to be less than the transaction's footprint
-# in binlog.
-#
-# To verify combined buffer-by-buffer read out of the file and fixing crc per event
-# there are the following parts:
-#
-# 1. the event size is much less than the cache's buffer
-# 2. the event size is bigger than the cache's buffer
-# 3. the event size if approximately the same as the cache's buffer
-# 4. all in above
-
-#
-# 1. the event size is much less than the cache's buffer
-#
-
-flush status;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# parameter to ensure the test slightly varies binlog content
-# between different invocations
-#
-let $deviation_size=32;
-eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb;
-
-# Now we are going to create transaction which is long enough so its
-# transaction binlog will be flushed to disk...
-
-delimiter |;
-create procedure test.p_init (n int, size int)
-begin
- while n > 0 do
- select round(RAND() * size) into @act_size;
- set @data = repeat('a', @act_size);
- insert into t1 values(n, @data );
- set n= n-1;
- end while;
-end|
-
-delimiter ;|
-
-let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s
-
-begin;
---disable_warnings
-# todo: check if it is really so.
-#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
-eval call test.p_init($1, $deviation_size);
---enable_warnings
-commit;
-
-show status like "binlog_cache_use";
---echo *** binlog_cache_disk_use must be non-zero ***
-show status like "binlog_cache_disk_use";
-
-sync_slave_with_master;
-
-let $diff_tables=master:test.t1, slave:test.t1;
-source include/diff_tables.inc;
-
-# undoing changes with verifying the above once again
-connection master;
-
-begin;
-delete from t1;
-commit;
-
-sync_slave_with_master;
-
-
-#
-# 2. the event size is bigger than the cache's buffer
-#
-connection master;
-
-flush status;
-let $t2_data_size= `select 3 * @@global.binlog_cache_size`;
-let $t2_aver_size= `select 2 * @@global.binlog_cache_size`;
-let $t2_max_rand= `select 1 * @@global.binlog_cache_size`;
-
-eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb;
-let $1=100;
---disable_query_log
-begin;
-while ($1)
-{
- eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size;
- set @data = repeat('a', @act_size);
- insert into t2 set data = @data;
- dec $1;
-}
-commit;
---enable_query_log
-show status like "binlog_cache_use";
---echo *** binlog_cache_disk_use must be non-zero ***
-show status like "binlog_cache_disk_use";
-
-sync_slave_with_master;
-
-let $diff_tables=master:test.t2, slave:test.t2;
-source include/diff_tables.inc;
-
-# undoing changes with verifying the above once again
-connection master;
-
-begin;
-delete from t2;
-commit;
-
-sync_slave_with_master;
-
-#
-# 3. the event size if approximately the same as the cache's buffer
-#
-
-connection master;
-
-flush status;
-let $t3_data_size= `select 2 * @@global.binlog_cache_size`;
-let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`;
-let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`;
-
-eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb;
-
-let $1= 300;
---disable_query_log
-begin;
-while ($1)
-{
- eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size;
- insert into t3 set data= repeat('a', @act_size);
- dec $1;
-}
-commit;
---enable_query_log
-show status like "binlog_cache_use";
---echo *** binlog_cache_disk_use must be non-zero ***
-show status like "binlog_cache_disk_use";
-
-sync_slave_with_master;
-
-let $diff_tables=master:test.t3, slave:test.t3;
-source include/diff_tables.inc;
-
-# undoing changes with verifying the above once again
-connection master;
-
-begin;
-delete from t3;
-commit;
-
-sync_slave_with_master;
-
-
-#
-# 4. all in above
-#
-
-connection master;
-flush status;
-
-delimiter |;
-eval create procedure test.p1 (n int)
-begin
- while n > 0 do
- case (select (round(rand()*100) % 3) + 1)
- when 1 then
- select round(RAND() * $deviation_size) into @act_size;
- set @data = repeat('a', @act_size);
- insert into t1 values(n, @data);
- when 2 then
- begin
- select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size;
- insert into t2 set data=repeat('a', @act_size);
- end;
- when 3 then
- begin
- select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size;
- insert into t3 set data= repeat('a', @act_size);
- end;
- end case;
- set n= n-1;
- end while;
-end|
-delimiter ;|
-
-let $1= 1000;
-set autocommit= 0;
-begin;
---disable_warnings
-eval call test.p1($1);
---enable_warnings
-commit;
-
-show status like "binlog_cache_use";
---echo *** binlog_cache_disk_use must be non-zero ***
-show status like "binlog_cache_disk_use";
-
-sync_slave_with_master;
-
-let $diff_tables=master:test.t1, slave:test.t1;
-source include/diff_tables.inc;
-
-let $diff_tables=master:test.t2, slave:test.t2;
-source include/diff_tables.inc;
-
-let $diff_tables=master:test.t3, slave:test.t3;
-source include/diff_tables.inc;
-
-
-connection master;
-
-begin;
-delete from t1;
-delete from t2;
-delete from t3;
-commit;
-
-drop table t1, t2, t3;
-set @@global.binlog_cache_size = @save_binlog_cache_size;
-set @@global.binlog_checksum = @save_binlog_checksum;
-set @@global.master_verify_checksum = @save_master_verify_checksum;
-drop procedure test.p_init;
-drop procedure test.p1;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_corruption.inc b/mysql-test/suite/rpl/include/rpl_corruption.inc
deleted file mode 100644
index cd2a1cc7ef2..00000000000
--- a/mysql-test/suite/rpl/include/rpl_corruption.inc
+++ /dev/null
@@ -1,181 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-############################################################
-# Purpose: WL#5064 Testing with corrupted events.
-# The test emulates the corruption at the vary stages
-# of replication:
-# - in binlog file
-# - in network
-# - in relay log
-############################################################
-
-#
-# The tests intensively utilize @@global.debug. Note,
-# Bug#11765758 - 58754,
-# @@global.debug is read by the slave threads through dbug-interface.
-# Hence, before a client thread set @@global.debug we have to ensure that:
-# (a) the slave threads are stopped, or (b) the slave threads are in
-# sync and waiting.
-
---source include/have_debug.inc
---source include/master-slave.inc
-
---connection slave
---source include/stop_slave.inc
-CHANGE MASTER TO MASTER_USE_GTID=NO;
---source include/start_slave.inc
---connection master
-
-# Block legal errors for MTR
-call mtr.add_suppression('Found invalid event in binary log');
-call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master');
-call mtr.add_suppression('event read from binlog did not pass crc check');
-call mtr.add_suppression('Replication event checksum verification failed');
-call mtr.add_suppression('Event crc check failed! Most likely there is event corruption');
-call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593');
-
-SET @old_master_verify_checksum = @@master_verify_checksum;
-
-# Creating test table/data and set corruption position for testing
---echo # 1. Creating test table/data and set corruption position for testing
---connection master
---echo * insert/update/delete rows in table t1 *
-# Corruption algorithm modifies only the first event and
-# then will be reset. To avoid checking always the first event
-# from binlog (usually it is FD) we randomly execute different
-# statements and set position for corruption inside events.
-
-CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
---disable_query_log
-let $i=`SELECT 3+CEILING(10*RAND())`;
-let $j=1;
-let $pos=0;
-while ($i) {
- eval INSERT INTO t1 VALUES ($j, 'a', NULL);
- if (`SELECT RAND() > 0.7`)
- {
- eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j;
- }
- if (`SELECT RAND() > 0.8`)
- {
- eval DELETE FROM t1 WHERE a = $j;
- }
- if (!$pos) {
- let $pos= query_get_value(SHOW MASTER STATUS, Position, 1);
- --sync_slave_with_master
- --source include/stop_slave.inc
- --disable_query_log
- --connection master
- }
- dec $i;
- inc $j;
-}
---enable_query_log
-
-
-# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing
---echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS
-SET @saved_dbug = @@global.debug_dbug;
-SET @@global.debug_dbug="d,corrupt_read_log_event_char";
---echo SHOW BINLOG EVENTS;
---disable_query_log
-send_eval SHOW BINLOG EVENTS FROM $pos;
---enable_query_log
---error ER_ERROR_WHEN_EXECUTING_COMMAND
-reap;
-
-SET @@global.debug_dbug=@saved_dbug;
-
-# Emulate corruption on master with crc checking on master
---echo # 3. Master read a corrupted event from binlog and send the error to slave
-
-# We have a rare but nasty potential race here: if the dump thread on
-# the master for the _old_ slave connection has not yet discovered
-# that the slave has disconnected, we will inject the corrupt event on
-# the wrong connection, and the test will fail
-# (+d,corrupt_read_log_event2 corrupts only one event).
-# So kill any lingering dump thread (we need to kill; otherwise dump thread
-# could manage to send all events down the socket before seeing it close, and
-# hang forever waiting for new binlog events to be created).
-let $id= `select id from information_schema.processlist where command = "Binlog Dump"`;
-if ($id)
-{
- --disable_query_log
- --error 0,1094
- eval kill $id;
- --enable_query_log
-}
-let $wait_condition=
- SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump';
---source include/wait_condition.inc
-
-SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
---connection slave
-START SLAVE IO_THREAD;
-let $slave_io_errno= 1236;
---let $slave_timeout= 10
---source include/wait_for_slave_io_error.inc
---connection master
-SET @@global.debug_dbug=@saved_dbug;
-
-# Emulate corruption on master without crc checking on master
---echo # 4. Master read a corrupted event from binlog and send it to slave
---connection master
-SET GLOBAL master_verify_checksum=0;
-SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
---connection slave
-START SLAVE IO_THREAD;
-# When the checksum error is detected, the slave sets error code 1743
-# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
-# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
-# So we usually get 1595, but it is occasionally possible to get 1743.
-let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
---source include/wait_for_slave_io_error.inc
---connection master
-SET @@global.debug_dbug=@saved_dbug;
-SET GLOBAL master_verify_checksum=1;
-
-# Emulate corruption in network
---echo # 5. Slave. Corruption in network
---connection slave
-SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
-SET @@global.debug_dbug="d,corrupt_queue_event";
-START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
---source include/wait_for_slave_io_error.inc
-SET @@global.debug_dbug=@saved_dbug_slave;
-
-# Emulate corruption in relay log
---echo # 6. Slave. Corruption in relay log
-
-SET @@global.debug_dbug="d,corrupt_read_log_event_char";
-
-START SLAVE SQL_THREAD;
-let $slave_sql_errno= 1593;
---source include/wait_for_slave_sql_error.inc
-
-SET @@global.debug_dbug=@saved_dbug_slave;
-
-# Start normal replication and compare same table on master
-# and slave
---echo # 7. Seek diff for tables on master and slave
---connection slave
---source include/start_slave.inc
---connection master
---sync_slave_with_master
-let $diff_tables= master:test.t1, slave:test.t1;
---source include/diff_tables.inc
-
-# Clean up
---echo # 8. Clean up
---connection master
-set @@global.debug_dbug = @saved_dbug;
-SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
-DROP TABLE t1;
---sync_slave_with_master
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_gtid_basic.inc b/mysql-test/suite/rpl/include/rpl_gtid_basic.inc
deleted file mode 100644
index 68a5d05ffe9..00000000000
--- a/mysql-test/suite/rpl/include/rpl_gtid_basic.inc
+++ /dev/null
@@ -1,572 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
---source include/have_innodb.inc
---let $rpl_topology=1->2->3->4
---source include/rpl_init.inc
-
-# Set up a 4-deep replication topology, then test various fail-overs
-# using GTID.
-#
-# A -> B -> C -> D
-
-connection server_1;
---source include/wait_for_binlog_checkpoint.inc
---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
---echo *** GTID position should be empty here ***
---replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS>
-eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
-
-CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
-CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1, "m1");
-INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4");
-INSERT INTO t2 VALUES (1, "i1");
-BEGIN;
-INSERT INTO t2 VALUES (2, "i2"), (3, "i3");
-INSERT INTO t2 VALUES (4, "i4");
-COMMIT;
-save_master_pos;
-source include/wait_for_binlog_checkpoint.inc;
---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
---let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos`
---echo *** GTID position should be non-empty here ***
---replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS> $gtid_pos_server_1 <GTID_POS_SERVER_1>
-eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
-
-connection server_2;
-sync_with_master;
-source include/wait_for_binlog_checkpoint.inc;
---let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
---let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
---echo *** GTID position should be the same as on server_1 ***
---replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS> $gtid_pos_server_1 <GTID_POS_SERVER_1>
-eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-
-connection server_3;
-sync_with_master;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-
-connection server_4;
-sync_with_master;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-
---echo *** Now take out D, let it fall behind a bit, and then test re-attaching it to A ***
-connection server_4;
---source include/stop_slave.inc
-
-connection server_1;
-INSERT INTO t1 VALUES (5, "m1a");
-INSERT INTO t2 VALUES (5, "i1a");
-save_master_pos;
-
-connection server_4;
---replace_result $MASTER_MYPORT MASTER_PORT
-eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
- MASTER_USE_GTID=CURRENT_POS;
---source include/start_slave.inc
-sync_with_master;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
---echo *** Now move B to D (C is still replicating from B) ***
-connection server_2;
---source include/stop_slave.inc
---replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4
-eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4,
- MASTER_USE_GTID=CURRENT_POS;
---source include/start_slave.inc
-
-connection server_4;
-UPDATE t2 SET b="j1a" WHERE a=5;
-save_master_pos;
-
-connection server_2;
-sync_with_master;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
---echo *** Now move C to D, after letting it fall a little behind ***
-connection server_3;
---source include/stop_slave.inc
-
-connection server_1;
-INSERT INTO t2 VALUES (6, "i6b");
-INSERT INTO t2 VALUES (7, "i7b");
---source include/save_master_gtid.inc
-
-connection server_3;
---replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4
-eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4,
- MASTER_USE_GTID=CURRENT_POS;
---source include/start_slave.inc
---source include/sync_with_master_gtid.inc
-SELECT * FROM t2 ORDER BY a;
-
---echo *** Now change everything back to what it was, to make rpl_end.inc happy
-# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled.
-connection server_2;
-# We need to sync up server_2 before switching. If it happened to have reached
-# the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to
-# server_1, which is (deliberately) missing that transaction.
---source include/sync_with_master_gtid.inc
---source include/stop_slave.inc
---replace_result $MASTER_MYPORT MASTER_MYPORT
-eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT;
---source include/start_slave.inc
---source include/wait_for_slave_to_start.inc
-
-connection server_3;
---source include/stop_slave.inc
---replace_result $SLAVE_MYPORT SLAVE_MYPORT
-eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT;
---source include/start_slave.inc
---source include/sync_with_master_gtid.inc
-
-connection server_4;
---source include/stop_slave.inc
---replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
-eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3;
---source include/start_slave.inc
-
-connection server_1;
-DROP TABLE t1,t2;
---source include/save_master_gtid.inc
-
---echo *** A few more checks for BINLOG_GTID_POS function ***
---let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1)
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-SELECT BINLOG_GTID_POS();
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-SELECT BINLOG_GTID_POS('a');
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-SELECT BINLOG_GTID_POS('a',1,NULL);
-SELECT BINLOG_GTID_POS(1,'a');
-SELECT BINLOG_GTID_POS(NULL,NULL);
-SELECT BINLOG_GTID_POS('',1);
-SELECT BINLOG_GTID_POS('a',1);
-eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1);
-eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
-eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
-eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
-
-
---echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
---connection server_2
---source include/sync_with_master_gtid.inc
---source include/stop_slave.inc
-
---connection server_1
-SET @old_state= @@GLOBAL.gtid_binlog_state;
-
---error ER_BINLOG_MUST_BE_EMPTY
-SET GLOBAL gtid_binlog_state = '';
-RESET MASTER;
-SET GLOBAL gtid_binlog_state = '';
-FLUSH LOGS;
---source include/show_binary_logs.inc
-SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30';
---source include/show_binary_logs.inc
---let $binlog_file= master-bin.000001
---let $binlog_start= 4
---source include/show_binlog_events.inc
-#SELECT @@GLOBAL.gtid_binlog_pos;
-#SELECT @@GLOBAL.gtid_binlog_state;
---error ER_BINLOG_MUST_BE_EMPTY
-SET GLOBAL gtid_binlog_state = @old_state;
-RESET MASTER;
-SET GLOBAL gtid_binlog_state = @old_state;
-
-# Check that slave can reconnect again, despite the RESET MASTER, as we
-# restored the state.
-
-CREATE TABLE t1 (a INT PRIMARY KEY);
-SET gtid_seq_no=100;
-INSERT INTO t1 VALUES (1);
---source include/save_master_gtid.inc
-
---connection server_2
---source include/start_slave.inc
-# We cannot just use sync_with_master as we've done RESET MASTER, so
-# slave old-style position is wrong.
-# So sync on gtid position instead.
---source include/sync_with_master_gtid.inc
-
-SELECT * FROM t1;
-# Check that the IO gtid position in SHOW SLAVE STATUS is also correct.
---let $status_items= Gtid_IO_Pos
---source include/show_slave_status.inc
-
---echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() ***
-
---connection server_1
-DROP TABLE t1;
-CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
---save_master_pos
-
---connection server_2
---sync_with_master
---source include/stop_slave.inc
-
---connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
-SELECT @@last_gtid;
-SET gtid_seq_no=110;
-SELECT @@last_gtid;
-BEGIN;
-SELECT @@last_gtid;
-INSERT INTO t1 VALUES (2);
-SELECT @@last_gtid;
-COMMIT;
-SELECT @@last_gtid;
---let $pos= `SELECT @@gtid_binlog_pos`
-
---connect (s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-eval SET @pos= '$pos';
-# Check NULL argument.
-SELECT master_gtid_wait(NULL);
-# Check empty argument returns immediately.
-SELECT master_gtid_wait('', NULL);
-# Check this gets counted
-SHOW STATUS LIKE 'Master_gtid_wait_count';
-SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
-SHOW STATUS LIKE 'Master_gtid_wait_time';
-# Let's check that we get a timeout
-SELECT master_gtid_wait(@pos, 0.5);
-SELECT * FROM t1 ORDER BY a;
-# Now actually wait until the slave reaches the position
-send SELECT master_gtid_wait(@pos);
-
---connection server_2
---source include/start_slave.inc
-
---connection s1
-reap;
-SELECT * FROM t1 ORDER BY a;
-
-# Test waiting on a domain that does not exist yet.
---source include/stop_slave.inc
-
---connection server_1
-SET gtid_domain_id= 1;
-INSERT INTO t1 VALUES (3);
---let $pos= `SELECT @@gtid_binlog_pos`
-
---connection s1
---replace_result $pos POS
-eval SET @pos= '$pos';
-SELECT master_gtid_wait(@pos, 0);
-SELECT * FROM t1 WHERE a >= 3;
-send SELECT master_gtid_wait(@pos, -1);
-
---connection server_2
---source include/start_slave.inc
-
---connection s1
-reap;
-SELECT * FROM t1 WHERE a >= 3;
-# Waiting for only part of the position.
-SELECT master_gtid_wait('1-1-1', 0);
-
-# Now test a lot of parallel master_gtid_wait() calls, completing in different
-# order, and some of which time out or get killed on the way.
-
---connection s1
-send SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110');
-
---connect (s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-# This will time out. No event 0-1-1000 exists
-send SELECT master_gtid_wait('0-1-1000', 0.5);
-
---connect (s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-# This one we will kill
---let $kill1_id= `SELECT connection_id()`
-send SELECT master_gtid_wait('0-1-2000');
-
---connect (s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-send SELECT master_gtid_wait('2-1-10');
-
---connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-send SELECT master_gtid_wait('2-1-6', 1);
-
-# This one we will kill also.
---connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
---let $kill2_id= `SELECT connection_id()`
-send SELECT master_gtid_wait('2-1-5');
-
---connect (s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-send SELECT master_gtid_wait('2-1-10');
-
---connect (s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-send SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110');
-
---connect (s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-send SELECT master_gtid_wait('2-1-2');
-
---connection server_2
-# This one completes immediately.
-SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
-SHOW STATUS LIKE 'Master_gtid_wait_count';
-SELECT master_gtid_wait('1-1-1');
-SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
-SHOW STATUS LIKE 'Master_gtid_wait_count';
-let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1);
---replace_result $wait_time MASTER_GTID_WAIT_TIME
-eval SET @a= $wait_time;
-SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected"))
- AS Master_gtid_wait_time_as_expected;
-
-
---connect (s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-send SELECT master_gtid_wait('0-1-109');
-
---connection server_2
-# This one should time out.
-SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
-SHOW STATUS LIKE 'Master_gtid_wait_count';
-SELECT master_gtid_wait('2-1-2', 0.5);
-SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
-SHOW STATUS LIKE 'Master_gtid_wait_count';
-let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1);
---replace_result $wait_time MASTER_GTID_WAIT_TIME
-eval SET @a= $wait_time;
-# We expect a wait time of just a bit over 0.5 seconds. But thread scheduling
-# and timer inaccuracies could introduce significant jitter. So allow a
-# generous interval.
-SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected;
-
---replace_result $kill1_id KILL_ID
-eval KILL QUERY $kill1_id;
---connection s3
---error ER_QUERY_INTERRUPTED
-reap;
-
---connection server_1
-SET gtid_domain_id=2;
-SET gtid_seq_no=2;
-INSERT INTO t1 VALUES (4);
-
---connection s9
-reap;
-
---connection server_2
---replace_result $kill2_id KILL_ID
-eval KILL CONNECTION $kill2_id;
-
---connection s6
---error 2013,ER_CONNECTION_KILLED
-reap;
-
---connection server_1
-SET gtid_domain_id=1;
-SET gtid_seq_no=4;
-INSERT INTO t1 VALUES (5);
-SET gtid_domain_id=2;
-SET gtid_seq_no=5;
-INSERT INTO t1 VALUES (6);
-
---connection s8
-reap;
---connection s1
-reap;
---connection s2
-reap;
---connection s5
-reap;
---connection s10
-reap;
-
---connection server_1
-SET gtid_domain_id=2;
-SET gtid_seq_no=10;
-INSERT INTO t1 VALUES (7);
-
---connection s4
-reap;
---connection s7
-reap;
-
-
---echo *** Test gtid_slave_pos when used with GTID ***
-
---connection server_2
---source include/stop_slave.inc
-
---connection server_1
-SET gtid_domain_id=2;
-SET gtid_seq_no=1000;
-INSERT INTO t1 VALUES (10);
-INSERT INTO t1 VALUES (11);
---save_master_pos
-
---connection server_2
-SET sql_slave_skip_counter= 1;
---source include/start_slave.inc
---sync_with_master
-SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
-SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
---source include/stop_slave.inc
-
---connection server_1
-SET gtid_domain_id=2;
-SET gtid_seq_no=1010;
-INSERT INTO t1 VALUES (12);
-INSERT INTO t1 VALUES (13);
---save_master_pos
-
---connection server_2
-SET sql_slave_skip_counter= 2;
---source include/start_slave.inc
---sync_with_master
-SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
-SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
---source include/stop_slave.inc
-
---connection server_1
-SET gtid_domain_id=2;
-SET gtid_seq_no=1020;
-INSERT INTO t1 VALUES (14);
-INSERT INTO t1 VALUES (15);
-INSERT INTO t1 VALUES (16);
---save_master_pos
-
---connection server_2
-SET sql_slave_skip_counter= 3;
---source include/start_slave.inc
---sync_with_master
-SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
-SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
---source include/stop_slave.inc
-
---connection server_1
-SET gtid_domain_id=2;
-SET gtid_seq_no=1030;
-# Disable logging Annotate_rows events to preserve events count.
-let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`;
-SET @@binlog_annotate_row_events= 0;
-INSERT INTO t1 VALUES (17);
-INSERT INTO t1 VALUES (18);
-INSERT INTO t1 VALUES (19);
-eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved;
---save_master_pos
-
---connection server_2
-SET sql_slave_skip_counter= 5;
---source include/start_slave.inc
---sync_with_master
-SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
-SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
-
---source include/stop_slave.inc
-
---connection server_1
-SET gtid_domain_id=3;
-SET gtid_seq_no=100;
-CREATE TABLE t2 (a INT PRIMARY KEY);
-DROP TABLE t2;
-SET gtid_domain_id=2;
-SET gtid_seq_no=1040;
-INSERT INTO t1 VALUES (20);
---save_master_pos
-
---connection server_2
-SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode;
-SET GLOBAL slave_ddl_exec_mode=STRICT;
-SET sql_slave_skip_counter=1;
-START SLAVE UNTIL master_gtid_pos="3-1-100";
---let $master_pos=3-1-100
---source include/sync_with_master_gtid.inc
---source include/wait_for_slave_to_stop.inc
---error ER_NO_SUCH_TABLE
-SELECT * FROM t2;
-SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
-# Start the slave again, it should fail on the DROP TABLE as the table is not there.
-SET sql_log_bin=0;
-CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051");
-SET sql_log_bin=1;
-START SLAVE;
---let $slave_sql_errno=1051
---source include/wait_for_slave_sql_error.inc
-SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
-STOP SLAVE IO_THREAD;
-SET sql_slave_skip_counter=2;
---source include/start_slave.inc
---sync_with_master
-
-SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
-SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
-
-SET GLOBAL slave_ddl_exec_mode= @saved_mode;
-
-
---echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. ***
-
-# Create an out-of-order binlog on server 2.
-# Let server 3 replicate to an out-of-order point, stop it, restart it,
-# and check that it replicates correctly despite the out-of-order.
-
---connection server_1
-SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
-INSERT INTO t1 VALUES (31);
---save_master_pos
-
---connection server_2
---sync_with_master
-SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
-INSERT INTO t1 VALUES (32);
-
---connection server_1
-INSERT INTO t1 VALUES (33);
---save_master_pos
-
---connection server_2
---sync_with_master
---save_master_pos
-
---connection server_3
---sync_with_master
---source include/stop_slave.inc
-
---connection server_1
-INSERT INTO t1 VALUES (34);
---save_master_pos
-
---connection server_2
---sync_with_master
---save_master_pos
-
---connection server_3
---source include/start_slave.inc
---sync_with_master
-SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
---save_master_pos
-
---connection server_4
---sync_with_master
-SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
-
-
-# Clean up.
---connection server_1
-DROP TABLE t1;
-
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_incident.inc b/mysql-test/suite/rpl/include/rpl_incident.inc
deleted file mode 100644
index 75d28d6a6c6..00000000000
--- a/mysql-test/suite/rpl/include/rpl_incident.inc
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
---source include/have_debug.inc
---source include/master-slave.inc
-
-SET @old_binlog_checksum=@@binlog_checksum;
-SET GLOBAL BINLOG_CHECKSUM=none;
-connection slave;
-SET @old_binlog_checksum=@@binlog_checksum;
-SET GLOBAL BINLOG_CHECKSUM=none;
-connection master;
-
---echo **** On Master ****
-CREATE TABLE t1 (a INT);
-
-INSERT INTO t1 VALUES (1),(2),(3);
-SELECT * FROM t1;
-
-set @saved_dbug = @@global.debug_dbug;
-SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
-
-# This will generate an incident log event and store it in the binary
-# log before the replace statement.
-REPLACE INTO t1 VALUES (4);
---save_master_pos
-SELECT * FROM t1;
-
-set @@global.debug_dbug = @saved_dbug;
-
-connection slave;
-# Wait until SQL thread stops with error LOST_EVENT on master
-call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
-let $slave_sql_errno= 1590;
-let $show_slave_sql_error= 1;
-source include/wait_for_slave_sql_error.inc;
-
-# The 4 should not be inserted into the table, since the incident log
-# event should have stop the slave.
---echo **** On Slave ****
-SELECT * FROM t1;
-
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
---sync_with_master
-
-# Now, we should have inserted the row into the table and the slave
-# should be running. We should also have rotated to a new binary log.
-
-SELECT * FROM t1;
-source include/check_slave_is_running.inc;
-
-connection master;
-SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
-DROP TABLE t1;
---sync_slave_with_master
-SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_init_slave_errors.inc b/mysql-test/suite/rpl/include/rpl_init_slave_errors.inc
deleted file mode 100644
index 46673ea4764..00000000000
--- a/mysql-test/suite/rpl/include/rpl_init_slave_errors.inc
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-######################################################################
-# Some errors that cause the slave SQL thread to stop are not shown in
-# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
-# is only in the server's error log.
-#
-# Two failures and their respective reporting are verified:
-#
-# 1 - Failures during slave thread initialization
-# 2 - Failures while processing queries passed through the init_slave
-# option.
-#
-# In order to check the first type of failure, we inject a fault in the
-# SQL/IO Threads through SET GLOBAL debug.
-#
-# To check the second type, we set @@global.init_slave to an invalid
-# command thus preventing the initialization of the SQL Thread.
-#
-# Obs:
-# 1 - Note that testing failures while initializing the relay log position
-# is hard as the same function is called before the code reaches the point
-# that we want to test.
-#
-# 2 - This test does not target failures that are reported while applying
-# events such as duplicate keys, errors while reading the relay-log.bin*,
-# etc. Such errors are already checked on other tests.
-######################################################################
-
-######################################################################
-# Configuring the Environment
-######################################################################
-source include/have_debug.inc;
-source include/have_log_bin.inc;
-source include/master-slave.inc;
-
-connection slave;
-
---disable_warnings
-stop slave;
---enable_warnings
-reset slave;
-
-######################################################################
-# Injecting faults in the threads' initialization
-######################################################################
-connection slave;
-
-# Set debug flags on slave to force errors to occur
-set @saved_dbug = @@global.debug_dbug;
-SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
-
-start slave;
-
-#
-# slave is going to stop because of emulated failures
-# but there won't be any crashes nor asserts hit.
-#
-# 1593 = ER_SLAVE_FATAL_ERROR
---let $slave_sql_errno= 1593
---let $show_slave_sql_error= 1
---source include/wait_for_slave_sql_error.inc
-
-call mtr.add_suppression("Failed during slave.* thread initialization");
-
-set @@global.debug_dbug = @saved_dbug;
-
-######################################################################
-# Injecting faults in the init_slave option
-######################################################################
-connection slave;
-
-reset slave;
-
-SET GLOBAL init_slave= "garbage";
-
-start slave;
-# 1064 = ER_PARSE_ERROR
---let $slave_sql_errno= 1064
---let $show_slave_sql_error= 1
---source include/wait_for_slave_sql_error.inc
-
-######################################################################
-# Clean up
-######################################################################
-SET GLOBAL init_slave= "";
-
-# Clean up Last_SQL_Error
---source include/stop_slave_io.inc
-RESET SLAVE;
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_loadfile.inc b/mysql-test/suite/rpl/include/rpl_loadfile.inc
deleted file mode 100644
index 9cd64530690..00000000000
--- a/mysql-test/suite/rpl/include/rpl_loadfile.inc
+++ /dev/null
@@ -1,120 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-#############################################################################
-# TEST: To test the LOAD_FILE() in rbr #
-#############################################################################
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
-
-# Includes
--- source include/have_binlog_format_mixed_or_row.inc
--- source include/master-slave.inc
-
--- source suite/rpl/include/rpl_loadfile.test
-
-# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE
-#
-# DESCRIPTION
-#
-# Problem: when using load_file string function and mixed binlogging format
-# there was no switch to row based binlogging format. This leads
-# to scenarios on which the slave replicates the statement and it
-# will try to load the file from local file system, which in most
-# likely it will not exist.
-#
-# Solution:
-# Marking this function as unsafe for statement format, makes the
-# statement using it to be logged in row based format. As such, data
-# replicated from the master, becomes the content of the loaded file.
-# Consequently, the slave receives the necessary data to complete
-# the load_file instruction correctly.
-#
-# IMPLEMENTATION
-#
-# The test is implemented as follows:
-#
-# On Master,
-# i) write to file the desired content.
-# ii) create table and stored procedure with load_file
-# iii) stop slave
-# iii) execute load_file
-# iv) remove file
-#
-# On Slave,
-# v) start slave
-# vi) sync it with master so that it gets the updates from binlog (which
-# should have bin logged in row format).
-#
-# If the the binlog format does not change to row, then the assertion
-# done in the following step fails. This happens because tables differ
-# since the file does not exist anymore, meaning that when slave
-# attempts to execute LOAD_FILE statement it inserts NULL on table
-# instead of the same contents that the master loaded when it executed
-# the procedure (which was executed when file existed).
-#
-# vii) assert that the contents of master and slave
-# table are the same
-
---source include/rpl_reset.inc
-
-connection master;
-let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT repeat('x',20) INTO OUTFILE '$file'
-
-disable_warnings;
-DROP TABLE IF EXISTS t1;
-enable_warnings;
-
-CREATE TABLE t1 (t text);
-DELIMITER |;
-CREATE PROCEDURE p(file varchar(4096))
- BEGIN
- INSERT INTO t1 VALUES (LOAD_FILE(file));
- END|
-DELIMITER ;|
-
-# stop slave before issuing the load_file on master
-connection slave;
-source include/stop_slave.inc;
-
-connection master;
-
-# test: check that logging falls back to rbr.
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval CALL p('$file')
-
-# test: remove the file from the filesystem and assert that slave still
-# gets the loaded file
-remove_file $file;
-
-# now that the file is removed it is safe (regarding what we want to test)
-# to start slave
-connection slave;
-source include/start_slave.inc;
-
-connection master;
-sync_slave_with_master;
-
-# assertion: assert that the slave got the updates even
-# if the file was removed before the slave started,
-# meaning that contents were indeed transfered
-# through binlog (in row format)
-let $diff_tables= master:t1, slave:t1;
-source include/diff_tables.inc;
-
-# CLEAN UP
---connection master
-DROP TABLE t1;
-DROP PROCEDURE p;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_packet.inc b/mysql-test/suite/rpl/include/rpl_packet.inc
deleted file mode 100644
index cbde486bcbb..00000000000
--- a/mysql-test/suite/rpl/include/rpl_packet.inc
+++ /dev/null
@@ -1,184 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-# ==== Purpose ====
-#
-# Check replication protocol packet size handling
-#
-# ==== Related bugs ====
-# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
-# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
-# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
-# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
-
-# max-out size db name
-source include/have_binlog_format_row.inc;
-source include/master-slave.inc;
-
-call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153");
-call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
-let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
-disable_warnings;
-eval drop database if exists $db;
-enable_warnings;
-eval create database $db;
-
-connection master;
-let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
-let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
-let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
-SET @@global.max_allowed_packet=1024;
-SET @@global.net_buffer_length=1024;
-
-sync_slave_with_master;
-# Restart slave for setting to take effect
-source include/stop_slave.inc;
-source include/start_slave.inc;
-
-# Reconnect to master for new setting to take effect
-disconnect master;
-
-# alas, can't use eval here; if db name changed apply the change here
-connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);
-
-connection master;
-select @@net_buffer_length, @@max_allowed_packet;
-
-create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
-
-INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
-sync_slave_with_master;
-
-eval select count(*) from `$db`.`t1` /* must be 1 */;
-
-SHOW STATUS LIKE 'Slave_running';
-select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
-connection master;
-eval drop database $db;
-sync_slave_with_master;
-
-#
-# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
-#
-# Check that a situation when the size of event on the master is greater than
-# max_allowed_packet on the slave does not lead to infinite re-transmits.
-
-connection master;
-
-# Change the max packet size on master
-
-SET @@global.max_allowed_packet=4096;
-SET @@global.net_buffer_length=4096;
-
-# Restart slave for new setting to take effect
-connection slave;
-source include/stop_slave.inc;
-source include/start_slave.inc;
-
-# Reconnect to master for new setting to take effect
-disconnect master;
-connect (master, localhost, root);
-connection master;
-
-CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
-
-sync_slave_with_master;
-
-connection master;
-
-INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
-
-
-#
-# Bug#42914: The slave I/O thread must stop after trying to read the above
-# event, However there is no Last_IO_Error report.
-#
-
-# The slave I/O thread must stop after trying to read the above event
-connection slave;
-# 1153 = ER_NET_PACKET_TOO_LARGE
---let $slave_io_errno= 1153
---let $show_slave_io_error= 1
---source include/wait_for_slave_io_error.inc
-
-# TODO: this is needed because of BUG#55790. Remove once that is fixed.
---source include/stop_slave_sql.inc
-
-#
-# Bug#42914: On the master, if a binary log event is larger than
-# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG
-# is sent to a slave when it requests a dump from the master, thus leading the
-# I/O thread to stop. However, there is no Last_IO_Error reported.
-#
-
---let $rpl_only_running_threads= 1
---source include/rpl_reset.inc
---connection master
-DROP TABLE t1;
---sync_slave_with_master
-
-
-connection master;
-CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
-sync_slave_with_master;
-
-connection master;
-INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
-
-connection slave;
-# The slave I/O thread must stop after receiving
-# 1153 = ER_NET_PACKET_TOO_LARGE
---let $slave_io_errno= 1153
---let $show_slave_io_error= 1
---source include/wait_for_slave_io_error.inc
-
-# Remove the bad binlog and clear error status on slave.
-STOP SLAVE;
-RESET SLAVE;
---connection master
-RESET MASTER;
-
-
-#
-# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
-#
-# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
-# BINLOG EVENTS was issued. To verify that this bug is fixed, we
-# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
-# never changes. We turn off the result log because we don't care
-# about the contents of the binlog.
-
---disable_result_log
-SET @max_allowed_packet_0= @@session.max_allowed_packet;
-SHOW BINLOG EVENTS;
-SET @max_allowed_packet_1= @@session.max_allowed_packet;
-SHOW BINLOG EVENTS;
-SET @max_allowed_packet_2= @@session.max_allowed_packet;
---enable_result_log
-if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
-{
- --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
- --source include/show_rpl_debug_info.inc
- SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
- --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
-}
-
-
---echo ==== clean up ====
-connection master;
-DROP TABLE t1;
-eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
-eval SET @@global.net_buffer_length= $old_net_buffer_length;
-eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet;
-# slave is stopped
-connection slave;
-DROP TABLE t1;
-
-# Clear Last_IO_Error
-RESET SLAVE;
-
---source include/rpl_end.inc
-# End of tests
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
deleted file mode 100644
index 493385f1ae3..00000000000
--- a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
+++ /dev/null
@@ -1,115 +0,0 @@
-# ==== Purpose ====
-#
-# Test verifies that, in parallel replication, transaction failure notification
-# is propagated to all the workers. Workers should abort the execution of
-# transaction event groups, whose event positions are higher than the failing
-# transaction group.
-#
-# ==== Implementation ====
-#
-# Steps:
-# 0 - Create a table t1 on master which has a primary key. Enable parallel
-# replication on slave with slave_parallel_mode='optimistic' and
-# slave_parallel_threads=3.
-# 1 - On slave start a transaction and execute a local INSERT statement
-# which will insert value 32. This is done to block the INSERT coming
-# from master.
-# 2 - On master execute an INSERT statement with value 32, so that it is
-# blocked on slave.
-# 3 - On slave enable a debug sync point such that it holds the worker thread
-# execution as soon as work is scheduled to it.
-# 4 - INSERT value 33 on master. It will be held on slave by other worker
-# thread due to debug simulation.
-# 5 - INSERT value 34 on master.
-# 6 - On slave, enusre that INSERT 34 has reached a state where it waits for
-# its prior transactions to commit.
-# 7 - Commit the local INSERT 32 on slave server so that first worker will
-# error out.
-# 8 - Now send a continue signal to second worker processing 33. It should
-# wakeup and propagate the error to INSERT 34.
-# 9 - Upon slave stop due to error, check that no rows are found after the
-# failed INSERT 32.
-#
-# ==== References ====
-#
-# MDEV-20645: Replication consistency is broken as workers miss the error
-# notification from an earlier failed group.
-#
-
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/have_debug_sync.inc
---source include/have_binlog_format_statement.inc
---source include/master-slave.inc
-
---enable_connect_log
---connection server_2
---source include/stop_slave.inc
-SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
-SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
-SET @old_debug= @@GLOBAL.debug_dbug;
-SET GLOBAL slave_parallel_mode='optimistic';
-SET GLOBAL slave_parallel_threads= 3;
-CHANGE MASTER TO master_use_gtid=slave_pos;
-CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
---source include/start_slave.inc
-
---connection server_1
-ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
-CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB;
-# MDEV-515 takes X-lock on the table for the first insert.
-# So concurrent insert won't happen on the table
-INSERT INTO t1 VALUES(1);
---source include/save_master_gtid.inc
-
---connection server_2
---source include/sync_with_master_gtid.inc
-
---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
-BEGIN;
-INSERT INTO t1 VALUES (32);
-
---connection server_1
-INSERT INTO t1 VALUES (32);
-
---connection server_2
---let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE info like "INSERT INTO t1 VALUES (32)"
---source include/wait_condition.inc
-SET GLOBAL debug_dbug="+d,hold_worker_on_schedule";
-SET debug_sync="debug_sync_action SIGNAL reached_pause WAIT_FOR continue_worker";
-
---connection server_1
-SET gtid_seq_no=100;
-INSERT INTO t1 VALUES (33);
-
---connection server_2
-SET debug_sync='now WAIT_FOR reached_pause';
-
---connection server_1
-INSERT INTO t1 VALUES (34);
-
---connection server_2
---let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit"
---source include/wait_condition.inc
---connection con_temp2
-COMMIT;
-
-# Clean up.
---connection server_2
---source include/stop_slave.inc
---let $assert_cond= COUNT(*) = 0 FROM t1 WHERE a>32
---let $assert_text= table t1 should have zero rows where a>32
---source include/assert.inc
-SELECT * FROM t1 WHERE a>32;
-DELETE FROM t1 WHERE a=32;
-
-SET GLOBAL slave_parallel_threads=@old_parallel_threads;
-SET GLOBAL slave_parallel_mode=@old_parallel_mode;
-SET GLOBAL debug_dbug=@old_debug;
-SET DEBUG_SYNC= 'RESET';
---source include/start_slave.inc
-
---connection server_1
-DROP TABLE t1;
---disable_connect_log
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc b/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
deleted file mode 100644
index cddc9286bd2..00000000000
--- a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
-#
-# The function mysql_show_binlog_events has a local stack variable
-# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
-# this variable goes out of scope and is destroyed before clean
-# thd->current_linfo.
-#
-# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
-# that with the fix local variable linfo is valid along all
-# mysql_show_binlog_events function scope.
-#
---source include/have_debug.inc
---source include/have_debug_sync.inc
---source include/master-slave.inc
-
---connection slave
-SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
---send SHOW BINLOG EVENTS
-
---connection slave1
-SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
-FLUSH LOGS;
-SET DEBUG_SYNC= 'now SIGNAL end';
-
---connection slave
---disable_result_log
---reap
---enable_result_log
-SET DEBUG_SYNC= 'RESET';
-
---connection master
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_relayrotate.inc b/mysql-test/suite/rpl/include/rpl_relayrotate.inc
deleted file mode 100644
index 4de554d3143..00000000000
--- a/mysql-test/suite/rpl/include/rpl_relayrotate.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-#######################################################
-# Wrapper for rpl_relayrotate.test to allow multi #
-# Engines to reuse test code. By JBM 2006-02-15 #
-#######################################################
--- source include/have_innodb.inc
-# Slow test, don't run during staging part
--- source include/not_staging.inc
--- source include/master-slave.inc
-
-let $engine_type=innodb;
--- source suite/rpl/include/rpl_relayrotate.test
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_semi_sync.inc b/mysql-test/suite/rpl/include/rpl_semi_sync.inc
deleted file mode 100644
index 720ec059350..00000000000
--- a/mysql-test/suite/rpl/include/rpl_semi_sync.inc
+++ /dev/null
@@ -1,532 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-source include/not_embedded.inc;
-source include/have_innodb.inc;
-source include/master-slave.inc;
-
-let $engine_type= InnoDB;
-
-# Suppress warnings that might be generated during the test
-connection master;
-call mtr.add_suppression("Timeout waiting for reply of binlog");
-call mtr.add_suppression("Read semi-sync reply");
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
-call mtr.add_suppression("mysqld: Got an error reading communication packets");
-connection slave;
-# While 'Current_Pos' exists as an option for Using_Gtd, keeping these
-# events in the binlog will update gtid_binlog_pos, and the later calls to
-# set `@@global.gtid_slave_pos= ""` will provide warning messages with
-# inconsistent GTID values because the seq_nos are non-deterministic with
-# the masters events coming in concurrently
-set sql_log_bin=0;
-call mtr.add_suppression("Master server does not support semi-sync");
-call mtr.add_suppression("Semi-sync slave .* reply");
-call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
-set sql_log_bin=1;
-connection master;
-
-# wait for dying connections (if any) to disappear
-let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed';
---source include/wait_condition.inc
-
-# After fix of BUG#45848, semi-sync slave should not create any extra
-# connections on master, save the count of connections before start
-# semi-sync slave for comparison below.
-let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
-
---echo #
---echo # Uninstall semi-sync plugins on master and slave
---echo #
-connection slave;
-source include/stop_slave.inc;
---source include/reset_slave.inc
-set global rpl_semi_sync_master_enabled= 0;
-set global rpl_semi_sync_slave_enabled= 0;
-
-connection master;
-reset master;
-set global rpl_semi_sync_master_enabled= 0;
-set global rpl_semi_sync_slave_enabled= 0;
-
---echo #
---echo # Main test of semi-sync replication start here
---echo #
-
-connection master;
-
-set global rpl_semi_sync_master_timeout= 60000; # 60s
-
-echo [ default state of semi-sync on master should be OFF ];
-show variables like 'rpl_semi_sync_master_enabled';
-
-echo [ enable semi-sync on master ];
-set global rpl_semi_sync_master_enabled = 1;
-show variables like 'rpl_semi_sync_master_enabled';
-
-echo [ status of semi-sync on master should be ON even without any semi-sync slaves ];
-show status like 'Rpl_semi_sync_master_clients';
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
---echo #
---echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed
---echo # BUG#45673 Semisynch reports correct operation even if no slave is connected
---echo #
-
-# BUG#45672 When semi-sync is enabled on master, it would allocate
-# transaction node even without semi-sync slave connected, and would
-# finally result in transaction node allocation error.
-#
-# Semi-sync master will pre-allocate 'max_connections' transaction
-# nodes, so here we do more than that much transactions to check if it
-# will fail or not.
-# select @@global.max_connections + 1;
-let $i= `select @@global.max_connections + 1`;
-disable_query_log;
-eval create table t1 (a int) engine=$engine_type;
-while ($i)
-{
- eval insert into t1 values ($i);
- dec $i;
-}
-drop table t1;
-enable_query_log;
-
-# BUG#45673
-echo [ status of semi-sync on master should be OFF ];
-show status like 'Rpl_semi_sync_master_clients';
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-# reset master to make sure the following test will start with a clean environment
-reset master;
-
-connection slave;
-
-echo [ default state of semi-sync on slave should be OFF ];
-show variables like 'rpl_semi_sync_slave_enabled';
-
-echo [ enable semi-sync on slave ];
-set global rpl_semi_sync_slave_enabled = 1;
-show variables like 'rpl_semi_sync_slave_enabled';
-source include/start_slave.inc;
-
-connection master;
-
-# NOTE: Rpl_semi_sync_master_client will only be updated when
-# semi-sync slave has started binlog dump request
-let $status_var= Rpl_semi_sync_master_clients;
-let $status_var_value= 1;
-source include/wait_for_status_var.inc;
-
-echo [ initial master state after the semi-sync slave connected ];
-show status like 'Rpl_semi_sync_master_clients';
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-replace_result $engine_type ENGINE_TYPE;
-eval create table t1(a int) engine = $engine_type;
-
-echo [ master state after CREATE TABLE statement ];
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-# After fix of BUG#45848, semi-sync slave should not create any extra
-# connections on master.
-let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
-replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE;
-eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0';
-
-echo [ insert records to table ];
-insert t1 values (10);
-insert t1 values (9);
-insert t1 values (8);
-insert t1 values (7);
-insert t1 values (6);
-insert t1 values (5);
-insert t1 values (4);
-insert t1 values (3);
-insert t1 values (2);
-insert t1 values (1);
-
-echo [ master status after inserts ];
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-sync_slave_with_master;
-
-echo [ slave status after replicated inserts ];
-show status like 'Rpl_semi_sync_slave_status';
-
-select count(distinct a) from t1;
-select min(a) from t1;
-select max(a) from t1;
-
---echo
---echo # BUG#50157
---echo # semi-sync replication crashes when replicating a transaction which
---echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ;
-
-connection master;
-SET SESSION AUTOCOMMIT= 0;
-CREATE TABLE t2(c1 INT) ENGINE=innodb;
-sync_slave_with_master;
-
-connection master;
-BEGIN;
---echo
---echo # Even though it is in a transaction, this statement is binlogged into binlog
---echo # file immediately.
---disable_warnings
-CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1;
---enable_warnings
---echo
---echo # These statements will not be binlogged until the transaction is committed
-INSERT INTO t2 VALUES(11);
-INSERT INTO t2 VALUES(22);
-COMMIT;
-
-DROP TABLE t2, t3;
-SET SESSION AUTOCOMMIT= 1;
-sync_slave_with_master;
-
-
---echo #
---echo # Test semi-sync master will switch OFF after one transaction
---echo # timeout waiting for slave reply.
---echo #
-connection slave;
-source include/stop_slave.inc;
-
-connection master;
---source include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
-
-# The first semi-sync check should be on because after slave stop,
-# there are no transactions on the master.
-echo [ master status should be ON ];
-
-let $status_var= Rpl_semi_sync_master_status;
-let $status_var_value= ON;
-source include/wait_for_status_var.inc;
-
-let $status_var= Rpl_semi_sync_master_clients;
-let $status_var_value= 0;
-source include/wait_for_status_var.inc;
-
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-echo [ semi-sync replication of these transactions will fail ];
-insert into t1 values (500);
-
-# Wait for the semi-sync replication of this transaction to timeout
-let $status_var= Rpl_semi_sync_master_status;
-let $status_var_value= OFF;
-source include/wait_for_status_var.inc;
-
-# The second semi-sync check should be off because one transaction
-# times out during waiting.
-echo [ master status should be OFF ];
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-# Semi-sync status on master is now OFF, so all these transactions
-# will be replicated asynchronously.
-delete from t1 where a=10;
-delete from t1 where a=9;
-delete from t1 where a=8;
-delete from t1 where a=7;
-delete from t1 where a=6;
-delete from t1 where a=5;
-delete from t1 where a=4;
-delete from t1 where a=3;
-delete from t1 where a=2;
-delete from t1 where a=1;
-
-insert into t1 values (100);
-
-echo [ master status should be OFF ];
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
---echo #
---echo # Test semi-sync status on master will be ON again when slave catches up
---echo #
-
-# Save the master position for later use.
-save_master_pos;
-
-connection slave;
-
-echo [ slave status should be OFF ];
-show status like 'Rpl_semi_sync_slave_status';
-source include/start_slave.inc;
-sync_with_master;
-
-echo [ slave status should be ON ];
-show status like 'Rpl_semi_sync_slave_status';
-
-select count(distinct a) from t1;
-select min(a) from t1;
-select max(a) from t1;
-
-connection master;
-
-# The master semi-sync status should be on again after slave catches up.
-echo [ master status should be ON again after slave catches up ];
-
-let $status_var= Rpl_semi_sync_master_status;
-let $status_var_value= ON;
-source include/wait_for_status_var.inc;
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-show status like 'Rpl_semi_sync_master_clients';
-
---echo #
---echo # Test disable/enable master semi-sync on the fly.
---echo #
-
-drop table t1;
-sync_slave_with_master;
-
-source include/stop_slave.inc;
-
---echo #
---echo # Flush status
---echo #
-connection master;
-echo [ Semi-sync master status variables before FLUSH STATUS ];
-SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
-SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
-# Do not write the FLUSH STATUS to binlog, to make sure we'll get a
-# clean status after this.
-FLUSH NO_WRITE_TO_BINLOG STATUS;
-echo [ Semi-sync master status variables after FLUSH STATUS ];
-SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
-SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
-
-connection master;
-
-source include/show_master_logs.inc;
-show variables like 'rpl_semi_sync_master_enabled';
-
-echo [ disable semi-sync on the fly ];
-set global rpl_semi_sync_master_enabled=0;
-show variables like 'rpl_semi_sync_master_enabled';
-show status like 'Rpl_semi_sync_master_status';
-
-echo [ enable semi-sync on the fly ];
-set global rpl_semi_sync_master_enabled=1;
-show variables like 'rpl_semi_sync_master_enabled';
-show status like 'Rpl_semi_sync_master_status';
-
---echo #
---echo # Test RESET MASTER/SLAVE
---echo #
-
-connection slave;
-
-source include/start_slave.inc;
-
-connection master;
-
-replace_result $engine_type ENGINE_TYPE;
-eval create table t1 (a int) engine = $engine_type;
-drop table t1;
-
-sync_slave_with_master;
-
-echo [ test reset master ];
-connection master;
-
-reset master;
-
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
-connection slave;
-
-source include/stop_slave.inc;
---source include/reset_slave.inc
-
-# Kill the dump thread on master for previous slave connection and
---source include/kill_binlog_dump_threads.inc
-
-connection slave;
-source include/start_slave.inc;
-
-connection master;
-
-# Wait for dump thread to start, Rpl_semi_sync_master_clients will be
-# 1 after dump thread started.
-let $status_var= Rpl_semi_sync_master_clients;
-let $status_var_value= 1;
-source include/wait_for_status_var.inc;
-
-replace_result $engine_type ENGINE_TYPE;
-eval create table t1 (a int) engine = $engine_type;
-insert into t1 values (1);
-insert into t1 values (2), (3);
-
-sync_slave_with_master;
-
-select * from t1;
-
-connection master;
-
-echo [ master semi-sync status should be ON ];
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
---echo #
---echo # Start semi-sync replication without SUPER privilege
---echo #
-connection slave;
-source include/stop_slave.inc;
---source include/reset_slave.inc
-connection master;
-reset master;
-
-# Kill the dump thread on master for previous slave connection and wait for it to exit
---source include/kill_binlog_dump_threads.inc
-
-# Do not binlog the following statement because it will generate
-# different events for ROW and STATEMENT format
-set sql_log_bin=0;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
-flush privileges;
-set sql_log_bin=1;
-connection slave;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
-flush privileges;
-change master to master_user='rpl',master_password='rpl_password';
-source include/start_slave.inc;
-show status like 'Rpl_semi_sync_slave_status';
-connection master;
-
-# Wait for the semi-sync binlog dump thread to start
-let $status_var= Rpl_semi_sync_master_clients;
-let $status_var_value= 1;
-source include/wait_for_status_var.inc;
-echo [ master semi-sync should be ON ];
-show status like 'Rpl_semi_sync_master_clients';
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-insert into t1 values (4);
-insert into t1 values (5);
-echo [ master semi-sync should be ON ];
-show status like 'Rpl_semi_sync_master_clients';
-show status like 'Rpl_semi_sync_master_status';
-show status like 'Rpl_semi_sync_master_no_tx';
-show status like 'Rpl_semi_sync_master_yes_tx';
-
---echo #
---echo # Test semi-sync slave connect to non-semi-sync master
---echo #
-
-# Disable semi-sync on master
-connection slave;
-source include/stop_slave.inc;
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-
-connection master;
-
-# Kill the dump thread on master for previous slave connection and wait for it to exit
---source include/kill_binlog_dump_threads.inc
-
-echo [ Semi-sync status on master should be ON ];
-let $status_var= Rpl_semi_sync_master_clients;
-let $status_var_value= 0;
-source include/wait_for_status_var.inc;
-show status like 'Rpl_semi_sync_master_status';
-let $status_var= Rpl_semi_sync_master_status;
-let $status_var_value= ON;
-source include/wait_for_status_var.inc;
-set global rpl_semi_sync_master_enabled= 0;
-
-connection slave;
-SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
-source include/start_slave.inc;
-connection master;
-insert into t1 values (8);
-let $status_var= Rpl_semi_sync_master_clients;
-let $status_var_value= 1;
-source include/wait_for_status_var.inc;
-echo [ master semi-sync clients should be 1, status should be OFF ];
-show status like 'Rpl_semi_sync_master_clients';
-show status like 'Rpl_semi_sync_master_status';
-sync_slave_with_master;
-show status like 'Rpl_semi_sync_slave_status';
-
-# Uninstall semi-sync plugin on master
-connection slave;
-source include/stop_slave.inc;
-connection master;
-set global rpl_semi_sync_master_enabled= 0;
-
-connection slave;
-SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
-source include/start_slave.inc;
-
-connection master;
-insert into t1 values (10);
-sync_slave_with_master;
-
---echo #
---echo # Test non-semi-sync slave connect to semi-sync master
---echo #
-
-connection master;
-set global rpl_semi_sync_master_timeout= 5000; # 5s
-set global rpl_semi_sync_master_enabled= 1;
-
-connection slave;
-source include/stop_slave.inc;
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-
-echo [ uninstall semi-sync slave plugin ];
-set global rpl_semi_sync_slave_enabled= 0;
-
-echo [ reinstall semi-sync slave plugin and disable semi-sync ];
-SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-source include/start_slave.inc;
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-
---echo #
---echo # Clean up
---echo #
-
-connection slave;
-source include/stop_slave.inc;
-set global rpl_semi_sync_slave_enabled= 0;
-
-connection master;
-set global rpl_semi_sync_master_enabled= 0;
-
-connection slave;
-change master to master_user='root',master_password='';
-source include/start_slave.inc;
-
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-connection master;
-drop user rpl@127.0.0.1;
-flush privileges;
-set global rpl_semi_sync_master_timeout= default;
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_skip_replication.inc b/mysql-test/suite/rpl/include/rpl_skip_replication.inc
deleted file mode 100644
index d1044c4bf51..00000000000
--- a/mysql-test/suite/rpl/include/rpl_skip_replication.inc
+++ /dev/null
@@ -1,408 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it.
-#
-# Usage:
-#
-# --let $use_remote_mysqlbinlog= 1 # optional
-# --source suite/rpl/include/rpl_skip_replication.inc
-#
-# The script uses MYSQLBINLOG to verify certain results.
-# By default, it uses binary logs directly. If it is undesirable,
-# this behavior can be overridden by setting $use_remote_binlog
-# as shown above.
-# The value will be unset after every execution of the script,
-# so if it is needed, it should be set explicitly before each call.
-#
-
---source include/have_innodb.inc
---source include/master-slave.inc
-
---connection slave
---source include/stop_slave.inc
-CHANGE MASTER TO MASTER_USE_GTID=NO;
---source include/start_slave.inc
---connection master
-
-connection slave;
-# Test that SUPER is required to change @@replicate_events_marked_for_skip.
-CREATE USER 'nonsuperuser'@'127.0.0.1';
-GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE,
- SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1';
-connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,);
-connection nonpriv;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
-disconnect nonpriv;
-connection slave;
-DROP USER'nonsuperuser'@'127.0.0.1';
-
-SELECT @@global.replicate_events_marked_for_skip;
---error ER_SLAVE_MUST_STOP
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
-SELECT @@global.replicate_events_marked_for_skip;
-STOP SLAVE;
---error ER_GLOBAL_VARIABLE
-SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER;
-SELECT @@global.replicate_events_marked_for_skip;
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
-SELECT @@global.replicate_events_marked_for_skip;
-START SLAVE;
-
-connection master;
-SELECT @@skip_replication;
---error ER_LOCAL_VARIABLE
-SET GLOBAL skip_replication=1;
-SELECT @@skip_replication;
-
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
-CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb;
-INSERT INTO t1(a) VALUES (1);
-INSERT INTO t2(a) VALUES (1);
-
-
-# Test that master-side filtering works.
-SET skip_replication=1;
-
-CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
-INSERT INTO t1(a) VALUES (2);
-INSERT INTO t2(a) VALUES (2);
-
-# Inject a rotate event in the binlog stream sent to slave (otherwise we will
-# fail sync_slave_with_master as the last event on the master is not present
-# on the slave).
-FLUSH NO_WRITE_TO_BINLOG LOGS;
-
-sync_slave_with_master;
-connection slave;
-SHOW TABLES;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-connection master;
-DROP TABLE t3;
-
-FLUSH NO_WRITE_TO_BINLOG LOGS;
-sync_slave_with_master;
-
-
-# Test that slave-side filtering works.
-connection slave;
-STOP SLAVE;
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
-START SLAVE;
-
-connection master;
-SET skip_replication=1;
-CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
-INSERT INTO t1(a) VALUES (3);
-INSERT INTO t2(a) VALUES (3);
-
-# Inject a rotate event in the binlog stream sent to slave (otherwise we will
-# fail sync_slave_with_master as the last event on the master is not present
-# on the slave).
-FLUSH NO_WRITE_TO_BINLOG LOGS;
-
-sync_slave_with_master;
-connection slave;
-SHOW TABLES;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-connection master;
-DROP TABLE t3;
-
-FLUSH NO_WRITE_TO_BINLOG LOGS;
-sync_slave_with_master;
-connection slave;
-STOP SLAVE;
-SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
-START SLAVE;
-
-
-# Test that events with @@skip_replication=1 are not filtered when filtering is
-# not set on slave.
-connection master;
-SET skip_replication=1;
-CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
-INSERT INTO t3(a) VALUES(2);
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t3;
-connection master;
-DROP TABLE t3;
-
-#
-# Test that the slave will preserve the @@skip_replication flag in its
-# own binlog.
-#
-
-TRUNCATE t1;
-sync_slave_with_master;
-connection slave;
-RESET MASTER;
-
-connection master;
-SET skip_replication=0;
-INSERT INTO t1 VALUES (1,0);
-SET skip_replication=1;
-INSERT INTO t1 VALUES (2,0);
-SET skip_replication=0;
-INSERT INTO t1 VALUES (3,0);
-
-sync_slave_with_master;
-connection slave;
-# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have
-# applied all events.
-SELECT * FROM t1 ORDER by a;
-
-STOP SLAVE;
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
-let $SLAVE_DATADIR= `select @@datadir`;
-
-connection master;
-TRUNCATE t1;
-
-# Now apply the slave binlog to the master, to check that both the slave
-# and mysqlbinlog will preserve the @@skip_replication flag.
-
---let $mysqlbinlog_args= $SLAVE_DATADIR/slave-bin.000001
-if ($use_remote_mysqlbinlog)
-{
- --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$SLAVE_MYPORT -uroot slave-bin.000001
- --let $use_remote_mysqlbinlog= 0
-}
---exec $MYSQL_BINLOG $mysqlbinlog_args > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog
-
-# The master should have all three events.
-SELECT * FROM t1 ORDER by a;
-
-# The slave should be missing event 2, which is marked with the
-# @@skip_replication flag.
-
-connection slave;
-START SLAVE;
-
-connection master;
-sync_slave_with_master;
-
-connection slave;
-SELECT * FROM t1 ORDER by a;
-
-#
-# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication
-# events.
-#
-
-connection master;
-TRUNCATE t1;
-
-sync_slave_with_master;
-connection slave;
-STOP SLAVE;
-# We will skip two INSERTs (in addition to any skipped due to
-# @@skip_replication). Since from 5.5 every statement is wrapped in
-# BEGIN ... END, we need to skip 6 events for this.
-SET GLOBAL sql_slave_skip_counter=6;
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
-START SLAVE;
-
-connection master;
-# Need to fix @@binlog_format to get consistent event count.
-SET @old_binlog_format= @@binlog_format;
-SET binlog_format= statement;
-SET skip_replication=0;
-INSERT INTO t1 VALUES (1,5);
-SET skip_replication=1;
-INSERT INTO t1 VALUES (2,5);
-SET skip_replication=0;
-INSERT INTO t1 VALUES (3,5);
-INSERT INTO t1 VALUES (4,5);
-SET binlog_format= @old_binlog_format;
-
-sync_slave_with_master;
-connection slave;
-
-# The slave should have skipped the first three inserts (number 1 and 3 due
-# to @@sql_slave_skip_counter=2, number 2 due to
-# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4
-# should be left.
-SELECT * FROM t1;
-
-
-#
-# Check that BINLOG statement preserves the @@skip_replication flag.
-#
-connection slave;
-# Need row @@binlog_format for BINLOG statements containing row events.
---source include/stop_slave.inc
-SET @old_slave_binlog_format= @@global.binlog_format;
-SET GLOBAL binlog_format= row;
---source include/start_slave.inc
-
-connection master;
-TRUNCATE t1;
-
-SET @old_binlog_format= @@binlog_format;
-SET binlog_format= row;
-# Format description log event.
-BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAA371saA==';
-# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1
-BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC
-wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA=';
-# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0
-BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC
-wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
-SET binlog_format= @old_binlog_format;
-
-SELECT * FROM t1 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-# Slave should have only the second insert, the first should be ignored due to
-# the @@skip_replication flag.
-SELECT * FROM t1 ORDER by a;
-
---source include/stop_slave.inc
-SET GLOBAL binlog_format= @old_slave_binlog_format;
---source include/start_slave.inc
-
-
-# Test that it is not possible to change @@skip_replication inside a
-# transaction or statement, thereby replicating only parts of statements
-# or transactions.
-connection master;
-SET skip_replication=0;
-
-BEGIN;
---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET skip_replication=0;
---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET skip_replication=1;
-ROLLBACK;
-SET skip_replication=1;
-BEGIN;
---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET skip_replication=0;
---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET skip_replication=1;
-COMMIT;
-SET autocommit=0;
-INSERT INTO t2(a) VALUES(100);
---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET skip_replication=1;
-ROLLBACK;
-SET autocommit=1;
-
-SET skip_replication=1;
---delimiter |
-CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END|
-CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END|
-CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END|
---delimiter ;
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SELECT foo(0);
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SELECT baz(0);
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET @a= foo(1);
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-SET @a= baz(1);
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-UPDATE t2 SET b=foo(0);
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-UPDATE t2 SET b=baz(0);
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-INSERT INTO t1 VALUES (101, foo(1));
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
-INSERT INTO t1 VALUES (101, baz(0));
-SELECT @@skip_replication;
-CALL bar(0);
-SELECT @@skip_replication;
-CALL bar(1);
-SELECT @@skip_replication;
-DROP FUNCTION foo;
-DROP PROCEDURE bar;
-DROP FUNCTION baz;
-
-
-# Test that master-side filtering happens on the master side, and that
-# slave-side filtering happens on the slave.
-
-# First test that events do not reach the slave when master-side filtering
-# is configured. Do this by replicating first with only the IO thread running
-# and master-side filtering; then change to no filtering and start the SQL
-# thread. This should still skip the events, as master-side filtering
-# means the events never reached the slave.
-connection master;
-SET skip_replication= 0;
-TRUNCATE t1;
-sync_slave_with_master;
-connection slave;
-STOP SLAVE;
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
-START SLAVE IO_THREAD;
-connection master;
-SET skip_replication= 1;
-INSERT INTO t1(a) VALUES (1);
-SET skip_replication= 0;
-INSERT INTO t1(a) VALUES (2);
---source include/save_master_pos.inc
-connection slave;
---source include/sync_io_with_master.inc
-STOP SLAVE IO_THREAD;
-SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
-START SLAVE;
-connection master;
-sync_slave_with_master;
-connection slave;
-# Now only the second insert of (2) should be visible, as the first was
-# filtered on the master, so even though the SQL thread ran without skipping
-# events, it will never see the event in the first place.
-SELECT * FROM t1;
-
-# Now tests that when slave-side filtering is configured, events _do_ reach
-# the slave.
-connection master;
-SET skip_replication= 0;
-TRUNCATE t1;
-sync_slave_with_master;
-connection slave;
-STOP SLAVE;
-SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
-START SLAVE IO_THREAD;
-connection master;
-SET skip_replication= 1;
-INSERT INTO t1(a) VALUES (1);
-SET skip_replication= 0;
-INSERT INTO t1(a) VALUES (2);
---source include/save_master_pos.inc
-connection slave;
---source include/sync_io_with_master.inc
-STOP SLAVE IO_THREAD;
-SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
-START SLAVE;
-connection master;
-sync_slave_with_master;
-connection slave;
-# Now both inserts should be visible. Since filtering was configured to be
-# slave-side, the event is in the relay log, and when the SQL thread ran we
-# had disabled filtering again.
-SELECT * FROM t1 ORDER BY a;
-
-
-# Clean up.
-connection master;
-SET skip_replication=0;
-DROP TABLE t1,t2;
-connection slave;
-STOP SLAVE;
-SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
-START SLAVE;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_special_charset.inc b/mysql-test/suite/rpl/include/rpl_special_charset.inc
deleted file mode 100644
index 641aa483d32..00000000000
--- a/mysql-test/suite/rpl/include/rpl_special_charset.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-################################################################################
-# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS
-# Problem: IO thread fails to connect to master if servers are configured with
-# special character sets like utf16, utf32, ucs2.
-#
-# Analysis: MySQL server does not support few special character sets like
-# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
-# When IO thread is trying to connect to Master, it sets server's character
-# set as client's character set. When Slave server is started with these
-# special character sets, IO thread (a connection to Master) fails because
-# of the above said reason.
-#
-# Fix: If server's character set is not supported as client's character set,
-# then set default's client character set(latin1) as client's character set.
-###############################################################################
---source include/master-slave.inc
-call mtr.add_suppression("'utf16' can not be used as client character set");
-CREATE TABLE t1(i VARCHAR(20));
-INSERT INTO t1 VALUES (0xFFFF);
---sync_slave_with_master
---let diff_tables=master:t1, slave:t1
---source include/diff_tables.inc
-# Cleanup
---connection master
-DROP TABLE t1;
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_sporadic_master.inc b/mysql-test/suite/rpl/include/rpl_sporadic_master.inc
deleted file mode 100644
index ad4c44cbf74..00000000000
--- a/mysql-test/suite/rpl/include/rpl_sporadic_master.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-# test to see if replication can continue when master sporadically fails on
-# COM_BINLOG_DUMP and additionally limits the number of events per dump
-
-source include/master-slave.inc;
-
-create table t2(n int);
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (NULL),(NULL);
-truncate table t1;
-# We have to use 4 in the following to make this test work with all table types
-insert into t1 values (4),(NULL);
-sync_slave_with_master;
---source include/stop_slave.inc
---source include/start_slave.inc
-connection master;
-insert into t1 values (NULL),(NULL);
-flush logs;
-truncate table t1;
-insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
-sync_slave_with_master;
-select * from t1 ORDER BY n;
-connection master;
-drop table t1,t2;
-sync_slave_with_master;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_ssl.inc b/mysql-test/suite/rpl/include/rpl_ssl.inc
deleted file mode 100644
index 59a2af9f137..00000000000
--- a/mysql-test/suite/rpl/include/rpl_ssl.inc
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-source include/have_ssl_communication.inc;
-source include/master-slave.inc;
-source include/no_valgrind_without_big.inc;
-
-# create a user for replication that requires ssl encryption
-connection master;
-create user replssl@localhost;
-grant replication slave on *.* to replssl@localhost require ssl;
-create table t1 (t int auto_increment, KEY(t));
-
-sync_slave_with_master;
-
-# Set slave to use SSL for connection to master
-stop slave;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-eval change master to
- master_user='replssl',
- master_password='',
- master_ssl=1,
- master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
- master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
- master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
-start slave;
-
-# Switch to master and insert one record, then sync it to slave
-connection master;
-insert into t1 values(1);
-sync_slave_with_master;
-
-# The record should now be on slave
-select * from t1;
-
-# The slave is synced and waiting/reading from master
-# SHOW SLAVE STATUS will show "Waiting for master to send event"
-let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key;
-source include/show_slave_status.inc;
-source include/check_slave_is_running.inc;
-
-# Stop the slave, as reported in bug#21871 it would hang
-STOP SLAVE;
-
-select * from t1;
-
-# Do the same thing a number of times
-disable_query_log;
-disable_result_log;
-# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows
-# After discussions with Engineering, I'm disabling this part of the test to avoid it causing
-# red trees.
-disable_parsing;
-let $i= 100;
-while ($i)
-{
- start slave;
- connection master;
- insert into t1 values (NULL);
- select * from t1; # Some variance
- connection slave;
- select * from t1; # Some variance
- stop slave;
- dec $i;
-}
-enable_parsing;
-START SLAVE;
-enable_query_log;
-enable_result_log;
-connection master;
-# INSERT one more record to make sure
-# the sync has something to do
-insert into t1 values (NULL);
-let $master_count= `select count(*) from t1`;
-
-sync_slave_with_master;
---source include/wait_for_slave_to_start.inc
-source include/show_slave_status.inc;
-source include/check_slave_is_running.inc;
-
-let $slave_count= `select count(*) from t1`;
-
-if ($slave_count != $master_count)
-{
- echo master and slave differed in number of rows;
- echo master: $master_count;
- echo slave: $slave_count;
-
- connection master;
- select count(*) t1;
- select * from t1;
- connection slave;
- select count(*) t1;
- select * from t1;
- query_vertical show slave status;
-}
-
-connection master;
-drop user replssl@localhost;
-drop table t1;
-sync_slave_with_master;
-
---source include/stop_slave.inc
-CHANGE MASTER TO
- master_user = 'root',
- master_ssl = 0,
- master_ssl_ca = '',
- master_ssl_cert = '',
- master_ssl_key = '';
-
---echo End of 5.0 tests
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc b/mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc
deleted file mode 100644
index 654a5d47cb9..00000000000
--- a/mysql-test/suite/rpl/include/rpl_stm_relay_ign_space.inc
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-#
-# BUG#12400313 / BUG#64503 test case
-#
-#
-# Description
-# -----------
-#
-# This test case starts the slave server with:
-# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096
-#
-# Then it issues some queries that will cause the slave to reach
-# relay-log-space-limit. We lock the table so that the SQL thread is
-# not able to purge the log and then we issue some more statements.
-#
-# The purpose is to show that the IO thread will honor the limits
-# while the SQL thread is not able to purge the relay logs, which did
-# not happen before this patch. In addition we assert that while
-# ignoring the limit (SQL thread needs to rotate before purging), the
-# IO thread does not do it in an uncontrolled manner.
-
---source include/have_binlog_format_statement.inc
---source include/have_innodb.inc
---source include/master-slave.inc
-
---disable_query_log
-CREATE TABLE t1 (c1 TEXT) engine=InnoDB;
-
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-
---sync_slave_with_master
-
-# wait for the SQL thread to sleep
---let $show_statement= SHOW PROCESSLIST
---let $field= State
---let $condition= = 'Slave has read all relay log; waiting for more updates'
---source include/wait_show_condition.inc
-
-# now the io thread has set rli->ignore_space_limit
-# lets lock the table so that once the SQL thread awakes
-# it blocks there and does not set rli->ignore_space_limit
-# back to zero
-LOCK TABLE t1 WRITE;
-
-# now issue more statements that will overflow the
-# rli->log_space_limit (in this case ~10K)
---connection master
-
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
-
---connection slave
-
-# ASSERT that the IO thread waits for the SQL thread to release some
-# space before continuing
---let $show_statement= SHOW PROCESSLIST
---let $field= State
---let $condition= LIKE 'Waiting for %'
-# before the patch (IO would have transfered everything)
-#--let $condition= = 'Waiting for master to send event'
-# after the patch (now it waits for space to be freed)
-#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space'
---source include/wait_show_condition.inc
-
-# without the patch we can uncomment the following two lines and
-# watch the IO thread synchronize with the master, thus writing
-# relay logs way over the space limit
-#--connection master
-#--source include/sync_slave_io_with_master.inc
-
-## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge
---let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1)
---let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1)
---let $assert_text= Assert that relay log space is close to the limit
---let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15
---source include/assert.inc
-
-# unlock the table and let SQL thread continue applying events
-UNLOCK TABLES;
-
---connection master
---sync_slave_with_master
---let $diff_tables=master:test.t1,slave:test.t1
---source include/diff_tables.inc
-
---connection master
-DROP TABLE t1;
---enable_query_log
---sync_slave_with_master
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc b/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc
deleted file mode 100644
index d814a257711..00000000000
--- a/mysql-test/suite/rpl/include/rpl_switch_stm_row_mixed.inc
+++ /dev/null
@@ -1,633 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-#
-# rpl_switch_stm_row_mixed tests covers
-#
-# - Master is switching explicitly between STATEMENT, ROW, and MIXED
-# binlog format showing when it is possible and when not.
-# - Master switching from MIXED to RBR implicitly listing all use
-# cases, e.g a query invokes SYS_GUID(), thereafter to serve as the
-# definition of MIXED binlog format
-# - correctness of execution
-
-
--- source include/have_binlog_format_mixed_or_row.inc
--- source include/master-slave.inc
-
-# Since this test generates row-based events in the binary log, the
-# slave SQL thread cannot be in STATEMENT mode to execute this test,
-# so we only execute it for MIXED and ROW as default value of
-# BINLOG_FORMAT.
-
-connection slave;
-
-connection master;
---disable_warnings
-drop database if exists mysqltest1;
-create database mysqltest1;
---enable_warnings
-use mysqltest1;
-
-# Save binlog format
-set @my_binlog_format= @@global.binlog_format;
-
-# play with switching
-set session binlog_format=mixed;
-show session variables like "binlog_format%";
-set session binlog_format=statement;
-show session variables like "binlog_format%";
-set session binlog_format=row;
-show session variables like "binlog_format%";
-
-set global binlog_format=DEFAULT;
-show global variables like "binlog_format%";
-set global binlog_format=MIXED;
-show global variables like "binlog_format%";
-set global binlog_format=STATEMENT;
-show global variables like "binlog_format%";
-set global binlog_format=ROW;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-
-CREATE TABLE t1 (a varchar(100));
-
-prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
-set @string="emergency_1_";
-insert into t1 values("work_2_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(SYS_GUID(),"work_3_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_4_",SYS_GUID()));
-insert into t1 select "yesterday_5_";
-
-# verify that temp tables prevent a switch to SBR
-create temporary table tmp(a char(100));
-insert into tmp values("see_6_");
---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
-set binlog_format=statement;
-insert into t1 select * from tmp;
-drop temporary table tmp;
-
-# Now we go to SBR
-set binlog_format=statement;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-set global binlog_format=statement;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select ?';
-set @string="emergency_7_";
-insert into t1 values("work_8_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values("work_9_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values("for_10_");
-insert into t1 select "yesterday_11_";
-
-# test statement (is not default after wl#3368)
-set binlog_format=statement;
-select @@global.binlog_format, @@session.binlog_format;
-set global binlog_format=statement;
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select ?';
-set @string="emergency_12_";
-insert into t1 values("work_13_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values("work_14_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values("for_15_");
-insert into t1 select "yesterday_16_";
-
-# and now the mixed mode
-
-set global binlog_format=mixed;
-select @@global.binlog_format, @@session.binlog_format;
-set binlog_format=default;
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
-set @string="emergency_17_";
-insert into t1 values("work_18_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(SYS_GUID(),"work_19_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_20_",SYS_GUID()));
-insert into t1 select "yesterday_21_";
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(SYS_GUID(),"work_22_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_23_",SYS_GUID()));
-insert into t1 select "yesterday_24_";
-
-# Test of CREATE TABLE SELECT
-
-create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' ');
-create table t3 select 1 union select SYS_GUID();
---disable_warnings
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3);
---enable_warnings
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-# what if SYS_GUID() is first:
---disable_warnings
-insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
---enable_warnings
-
-# inside a stored procedure
-
-delimiter |;
-create procedure foo()
-begin
-insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",SYS_GUID()));
-insert into t1 select "yesterday_27_";
-end|
-create procedure foo2()
-begin
-insert into t1 values(concat("emergency_28_",SYS_GUID()));
-insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",SYS_GUID()));
-set session binlog_format=row; # accepted for stored procs
-insert into t1 values("more work_31_");
-set session binlog_format=mixed;
-end|
-create function foo3() returns bigint unsigned
-begin
- set session binlog_format=row; # rejected for stored funcs
- insert into t1 values("alarm");
- return 100;
-end|
-create procedure foo4(x varchar(100))
-begin
-insert into t1 values(concat("work_250_",x));
-insert into t1 select "yesterday_270_";
-end|
-delimiter ;|
-call foo();
-call foo2();
-call foo4("hello");
-call foo4(SYS_GUID());
-call foo4("world");
-
-# test that can't SET in a stored function
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
-select foo3();
-select * from t1 where a="alarm";
-
-# Tests of stored functions/triggers/views for BUG#20930 "Mixed
-# binlogging mode does not work with stored functions, triggers,
-# views"
-
-# Function which calls procedure
-drop function foo3;
-delimiter |;
-create function foo3() returns bigint unsigned
-begin
- insert into t1 values("foo3_32_");
- call foo();
- return 100;
-end|
-delimiter ;|
-insert into t2 select foo3();
-
-prepare stmt1 from 'insert into t2 select foo3()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# Test if stored function calls stored function which calls procedure
-# which requires row-based.
-
-delimiter |;
-create function foo4() returns bigint unsigned
-begin
- insert into t2 select foo3();
- return 100;
-end|
-delimiter ;|
-select foo4();
-
-prepare stmt1 from 'select foo4()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# A simple stored function
-delimiter |;
-create function foo5() returns bigint unsigned
-begin
- insert into t2 select SYS_GUID();
- return 100;
-end|
-delimiter ;|
-select foo5();
-
-prepare stmt1 from 'select foo5()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# A simple stored function where SYS_GUID() is in the argument
-delimiter |;
-create function foo6(x varchar(100)) returns bigint unsigned
-begin
- insert into t2 select x;
- return 100;
-end|
-delimiter ;|
-select foo6("foo6_1_");
-select foo6(concat("foo6_2_",SYS_GUID()));
-
-prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-
-# Test of views using SYS_GUID()
-
-create view v1 as select SYS_GUID();
-create table t11 (data varchar(255));
-insert into t11 select * from v1;
-# Test of querying INFORMATION_SCHEMA which parses the view's body,
-# to verify that it binlogs statement-based (is not polluted by
-# the parsing of the view's body).
-insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
-prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# Test of triggers with SYS_GUID()
-delimiter |;
-create trigger t11_bi before insert on t11 for each row
-begin
- set NEW.data = concat(NEW.data,SYS_GUID());
-end|
-delimiter ;|
-insert into t11 values("try_560_");
-
-# Test that INSERT DELAYED works in mixed mode (BUG#20649)
-insert delayed into t2 values("delay_1_");
-insert delayed into t2 values(concat("delay_2_",SYS_GUID()));
-insert delayed into t2 values("delay_6_");
-
-# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
-# replicate fine in statement-based ; we test that in mixed mode it
-# works).
-insert delayed into t2 values(rand());
-set @a=2.345;
-insert delayed into t2 values(@a);
-
-# With INSERT DELAYED, rows are written to the binlog after they are
-# written to the table. Therefore, it is not enough to wait until the
-# rows make it to t2 on the master (the rows may not be in the binlog
-# at that time, and may still not be in the binlog when
-# sync_slave_with_master is later called). Instead, we wait until the
-# rows make it to t2 on the slave. We first call
-# sync_slave_with_master, so that we are sure that t2 has been created
-# on the slave.
-sync_slave_with_master;
-let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2;
---source include/wait_condition.inc
-connection master;
-
-# If you want to do manual testing of the mixed mode regarding UDFs (not
-# testable automatically as quite platform- and compiler-dependent),
-# you just need to set the variable below to 1, and to
-# "make udf_example.so" in sql/, and to copy sql/udf_example.so to
-# MYSQL_TEST_DIR/lib/mysql.
-let $you_want_to_test_UDF=0;
-if ($you_want_to_test_UDF)
-{
- CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
- prepare stmt1 from 'insert into t1 select metaphon(?)';
- set @string="emergency_133_";
- insert into t1 values("work_134_");
- execute stmt1 using @string;
- deallocate prepare stmt1;
- prepare stmt1 from 'insert into t1 select ?';
- insert into t1 values(metaphon("work_135_"));
- execute stmt1 using @string;
- deallocate prepare stmt1;
- insert into t1 values(metaphon("for_136_"));
- insert into t1 select "yesterday_137_";
- create table t6 select metaphon("for_138_");
- create table t7 select 1 union select metaphon("for_139_");
- create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3);
- create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-}
-
-create table t20 select * from t1; # save for comparing later
-create table t21 select * from t2;
-create table t22 select * from t3;
-drop table t1,t2,t3;
-
-# This tests the fix to
-# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog
-# We verify that under the mixed binlog mode, a stored function
-# modifying at least two tables having an auto_increment column,
-# is binlogged row-based. Indeed in statement-based binlogging,
-# only the auto_increment value generated for the first table
-# is recorded in the binlog, the value generated for the 2nd table
-# lacking.
-
-create table t1 (a int primary key auto_increment, b varchar(100));
-create table t2 (a int primary key auto_increment, b varchar(100));
-create table t3 (b varchar(100));
-delimiter |;
-create function f (x varchar(100)) returns int deterministic
-begin
- insert into t1 values(null,x);
- insert into t2 values(null,x);
- return 1;
-end|
-delimiter ;|
-select f("try_41_");
-# Two operations which compensate each other except that their net
-# effect is that they advance the auto_increment counter of t2 on slave:
-sync_slave_with_master;
-use mysqltest1;
-insert into t2 values(2,null),(3,null),(4,null);
-delete from t2 where a>=2;
-
-connection master;
-# this is the call which didn't replicate well
-select f("try_42_");
-sync_slave_with_master;
-
-# now use prepared statement and test again, just to see that the RBB
-# mode isn't set at PREPARE but at EXECUTE.
-
-insert into t2 values(3,null),(4,null);
-delete from t2 where a>=3;
-
-connection master;
-prepare stmt1 from 'select f(?)';
-set @string="try_43_";
-insert into t1 values(null,"try_44_"); # should be SBB
-execute stmt1 using @string; # should be RBB
-deallocate prepare stmt1;
-sync_slave_with_master;
-
-# verify that if only one table has auto_inc, it does not trigger RBB
-# (we'll check in binlog further below)
-
-connection master;
-create table t12 select * from t1; # save for comparing later
-drop table t1;
-create table t1 (a int, b varchar(100), key(a));
-select f("try_45_");
-
-# restore table's key
-create table t13 select * from t1;
-drop table t1;
-create table t1 (a int primary key auto_increment, b varchar(100));
-
-# now test if it's two functions, each of them inserts in one table
-
-drop function f;
-# we need a unique key to have sorting of rows by mysqldump
-create table t14 (unique (a)) select * from t2;
-truncate table t2;
-delimiter |;
-create function f1 (x varchar(100)) returns int deterministic
-begin
- insert into t1 values(null,x);
- return 1;
-end|
-create function f2 (x varchar(100)) returns int deterministic
-begin
- insert into t2 values(null,x);
- return 1;
-end|
-delimiter ;|
-select f1("try_46_"),f2("try_47_");
-
-sync_slave_with_master;
-insert into t2 values(2,null),(3,null),(4,null);
-delete from t2 where a>=2;
-
-connection master;
-# Test with SELECT and INSERT
-select f1("try_48_"),f2("try_49_");
-insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
-sync_slave_with_master;
-
-# verify that if f2 does only read on an auto_inc table, this does not
-# switch to RBB
-connection master;
-drop function f2;
-delimiter |;
-create function f2 (x varchar(100)) returns int deterministic
-begin
- declare y int;
- insert into t1 values(null,x);
- set y = (select count(*) from t2);
- return y;
-end|
-delimiter ;|
-select f1("try_53_"),f2("try_54_");
-sync_slave_with_master;
-
-# And now, a normal statement with a trigger (no stored functions)
-
-connection master;
-drop function f2;
-delimiter |;
-create trigger t1_bi before insert on t1 for each row
-begin
- insert into t2 values(null,"try_55_");
-end|
-delimiter ;|
-insert into t1 values(null,"try_56_");
-# and now remove one auto_increment and verify SBB
-alter table t1 modify a int, drop primary key;
-insert into t1 values(null,"try_57_");
-sync_slave_with_master;
-
-# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
-# Slave used to have only 2 rows instead of 3.
-connection master;
-CREATE TEMPORARY TABLE t15 SELECT SYS_GUID();
-create table t16 like t15;
-INSERT INTO t16 SELECT * FROM t15;
-# we'll verify that this one is done RBB
-insert into t16 values("try_65_");
-drop table t15;
-# we'll verify that this one is done SBB
-insert into t16 values("try_66_");
-sync_slave_with_master;
-
-# and now compare:
-
-connection master;
-
-# first check that data on master is sensible
-select count(*) from t1;
-select count(*) from t2;
-select count(*) from t3;
-select count(*) from t4;
-select count(*) from t5;
-select count(*) from t11;
-select count(*) from t20;
-select count(*) from t21;
-select count(*) from t22;
-select count(*) from t12;
-select count(*) from t13;
-select count(*) from t14;
-select count(*) from t16;
-if ($you_want_to_test_UDF)
-{
- select count(*) from t6;
- select count(*) from t7;
- select count(*) from t8;
- select count(*) from t9;
-}
-
-sync_slave_with_master;
-
-#
-# Bug#20863 If binlog format is changed between update and unlock of
-# tables, wrong binlog
-#
-
-connection master;
-DROP TABLE IF EXISTS t11;
-SET SESSION BINLOG_FORMAT=STATEMENT;
-CREATE TABLE t11 (song VARCHAR(255));
-LOCK TABLES t11 WRITE;
-SET SESSION BINLOG_FORMAT=ROW;
-INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
-SET SESSION BINLOG_FORMAT=STATEMENT;
-INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
-UNLOCK TABLES;
-
---query_vertical SELECT * FROM t11
-sync_slave_with_master;
-USE mysqltest1;
---query_vertical SELECT * FROM t11
-
-connection master;
-DROP TABLE IF EXISTS t12;
-SET SESSION BINLOG_FORMAT=MIXED;
-CREATE TABLE t12 (data LONG);
-LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(SYS_GUID());
-UNLOCK TABLES;
-sync_slave_with_master;
-
-#
-# BUG#28086: SBR of USER() becomes corrupted on slave
-#
-
-connection master;
-
-# Just to get something that is non-trivial, albeit still simple, we
-# stuff the result of USER() and CURRENT_USER() into a variable.
---delimiter $$
-CREATE FUNCTION my_user()
- RETURNS CHAR(64)
-BEGIN
- DECLARE user CHAR(64);
- SELECT USER() INTO user;
- RETURN user;
-END $$
---delimiter ;
-
---delimiter $$
-CREATE FUNCTION my_current_user()
- RETURNS CHAR(64)
-BEGIN
- DECLARE user CHAR(64);
- SELECT CURRENT_USER() INTO user;
- RETURN user;
-END $$
---delimiter ;
-
-DROP TABLE IF EXISTS t13;
-CREATE TABLE t13 (data CHAR(64));
-INSERT INTO t13 VALUES (USER());
-INSERT INTO t13 VALUES (my_user());
-INSERT INTO t13 VALUES (CURRENT_USER());
-INSERT INTO t13 VALUES (my_current_user());
-
-sync_slave_with_master;
-
-# as we're using SYS_GUID we don't SELECT but use "diff" like in rpl_row_UUID
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
-
-# Let's compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching
-
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
-
-connection master;
-
-# Now test that mysqlbinlog works fine on a binlog generated by the
-# mixed mode
-
-# BUG#11312 "DELIMITER is not written to the binary log that causes
-# syntax error" makes that mysqlbinlog will fail if we pass it the
-# text of queries; this forces us to use --base64-output here.
-
-# BUG#20929 "BINLOG command causes invalid free plus assertion
-# failure" makes mysqld segfault when receiving --base64-output
-
-# So I can't enable this piece of test
-# SIGH
-
-if ($enable_when_11312_or_20929_fixed)
-{
---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
-drop database mysqltest1;
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
-# the old mysqldump output on slave is the same as what it was on
-# master before restoring on master.
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
-}
-
-drop database mysqltest1;
-sync_slave_with_master;
-
-connection master;
-# Restore binlog format setting
-set global binlog_format =@my_binlog_format;
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_sync_test.inc b/mysql-test/suite/rpl/include/rpl_sync_test.inc
deleted file mode 100644
index 1e2ec2ca83b..00000000000
--- a/mysql-test/suite/rpl/include/rpl_sync_test.inc
+++ /dev/null
@@ -1,159 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
-########################################################################################
-# This test verifies the options --sync-relay-log-info and --relay-log-recovery by
-# crashing the slave in two different situations:
-# (case-1) - Corrupt the relay log with changes which were not processed by
-# the SQL Thread and crashes it.
-# (case-2) - Corrupt the master.info with wrong coordinates and crashes it.
-#
-# Case 1:
-# 1 - Stops the SQL Thread
-# 2 - Inserts new records into the master.
-# 3 - Corrupts the relay-log.bin* which most likely has such changes.
-# 4 - Crashes the slave
-# 5 - Verifies if the slave is sync with the master which means that the information
-# loss was circumvented by the recovery process.
-#
-# Case 2:
-# 1 - Stops the SQL/IO Threads
-# 2 - Inserts new records into the master.
-# 3 - Corrupts the master.info with wrong coordinates.
-# 4 - Crashes the slave
-# 5 - Verifies if the slave is sync with the master which means that the information
-# loss was circumvented by the recovery process.
-########################################################################################
-
-########################################################################################
-# Configuring the environment
-########################################################################################
---echo =====Configuring the enviroment=======;
---source include/not_embedded.inc
---source include/not_valgrind.inc
---source include/have_debug.inc
---source include/have_innodb.inc
---source include/not_crashrep.inc
---source include/master-slave.inc
-
-call mtr.add_suppression('Attempting backtrace');
-call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
-# Use innodb so we do not get "table should be repaired" issues.
-ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
-flush tables;
-CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
-
-insert into t1(a) values(1);
-insert into t1(a) values(2);
-insert into t1(a) values(3);
-
-########################################################################################
-# Case 1: Corrupt a relay-log.bin*
-########################################################################################
---echo =====Inserting data on the master but without the SQL Thread being running=======;
-sync_slave_with_master;
-
-connection slave;
-let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
---replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR
---copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup
---source include/stop_slave_sql.inc
-
-connection master;
-insert into t1(a) values(4);
-insert into t1(a) values(5);
-insert into t1(a) values(6);
-
---echo =====Removing relay log files and crashing/recoverying the slave=======;
-connection slave;
---source include/stop_slave_io.inc
-
-let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1);
-
---let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file
-perl;
-$file= $ENV{'FILE_TO_CORRUPT'};
-open(FILE, ">$file") || die "Unable to open $file.";
-truncate(FILE,0);
-print FILE "failure";
-close ($file);
-EOF
-
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
-SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
---error 2013
-FLUSH LOGS;
-
---let $rpl_server_number= 2
---source include/rpl_reconnect.inc
-
---echo =====Dumping and comparing tables=======;
---source include/start_slave.inc
-
-connection master;
-sync_slave_with_master;
-
-let $diff_tables=master:t1,slave:t1;
-source include/diff_tables.inc;
-
-########################################################################################
-# Case 2: Corrupt a master.info
-########################################################################################
---echo =====Corrupting the master.info=======;
-connection slave;
---source include/stop_slave.inc
-
-connection master;
-FLUSH LOGS;
-
-insert into t1(a) values(7);
-insert into t1(a) values(8);
-insert into t1(a) values(9);
-
-connection slave;
-let MYSQLD_SLAVE_DATADIR=`select @@datadir`;
-
---perl
-use strict;
-use warnings;
-my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup";
-my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info";
-open(FILE, "<", $src) or die;
-my @content= <FILE>;
-close FILE;
-open(FILE, ">", $dst) or die;
-binmode FILE;
-print FILE @content;
-close FILE;
-EOF
-
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
-SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
---error 2013
-FLUSH LOGS;
-
---let $rpl_server_number= 2
---source include/rpl_reconnect.inc
-
---echo =====Dumping and comparing tables=======;
---source include/start_slave.inc
-
-connection master;
-sync_slave_with_master;
-
-let $diff_tables=master:t1,slave:t1;
-source include/diff_tables.inc;
-
-########################################################################################
-# Clean up
-########################################################################################
---echo =====Clean up=======;
-connection master;
-drop table t1;
-
---remove_file $MYSQLD_SLAVE_DATADIR/master.backup
---source include/rpl_end.inc
-
diff --git a/mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc b/mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc
deleted file mode 100644
index 6728ff55d6f..00000000000
--- a/mysql-test/suite/rpl/include/rpl_temporal_format_default_to_default.inc
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
---source include/master-slave.inc
-
-if ($force_master_mysql56_temporal_format)
-{
- connection master;
- eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format;
-}
-
-if ($force_slave_mysql56_temporal_format)
-{
- connection slave;
- eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format;
-}
-
-connection master;
-SELECT @@global.mysql56_temporal_format AS on_master;
-connection slave;
-SELECT @@global.mysql56_temporal_format AS on_slave;
-connection master;
-
-CREATE TABLE t1
-(
- c0 TIME(0),
- c1 TIME(1),
- c2 TIME(2),
- c3 TIME(3),
- c4 TIME(4),
- c5 TIME(5),
- c6 TIME(6)
-);
-CREATE TABLE t2
-(
- c0 TIMESTAMP(0),
- c1 TIMESTAMP(1),
- c2 TIMESTAMP(2),
- c3 TIMESTAMP(3),
- c4 TIMESTAMP(4),
- c5 TIMESTAMP(5),
- c6 TIMESTAMP(6)
-);
-
-CREATE TABLE t3
-(
- c0 DATETIME(0),
- c1 DATETIME(1),
- c2 DATETIME(2),
- c3 DATETIME(3),
- c4 DATETIME(4),
- c5 DATETIME(5),
- c6 DATETIME(6)
-);
-INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
-INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
-INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
-SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
-sync_slave_with_master;
-
-connection slave;
---query_vertical SELECT * FROM t1;
---query_vertical SELECT * FROM t2;
---query_vertical SELECT * FROM t3;
-SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
-
-connection master;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-
-connection slave;
-SET @@global.mysql56_temporal_format=DEFAULT;
-connection master;
-SET @@global.mysql56_temporal_format=DEFAULT;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/include/rpl_typeconv.inc b/mysql-test/suite/rpl/include/rpl_typeconv.inc
deleted file mode 100644
index 9e566258882..00000000000
--- a/mysql-test/suite/rpl/include/rpl_typeconv.inc
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently rpl and binlog_encryption suite).
-# Please check all dependent tests after modifying it
-#
-
---source include/have_binlog_format_row.inc
---source include/master-slave.inc
-
-connection slave;
-set @saved_slave_type_conversions = @@global.slave_type_conversions;
-CREATE TABLE type_conversions (
- TestNo INT AUTO_INCREMENT PRIMARY KEY,
- Source TEXT,
- Target TEXT,
- Flags TEXT,
- On_Master LONGTEXT,
- On_Slave LONGTEXT,
- Expected LONGTEXT,
- Compare INT,
- Error TEXT);
-
-SELECT @@global.slave_type_conversions;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
-SELECT @@global.slave_type_conversions;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
-SELECT @@global.slave_type_conversions;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
-SELECT @@global.slave_type_conversions;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
-SELECT @@global.slave_type_conversions;
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
-SELECT @@global.slave_type_conversions;
-
-# Checking strict interpretation of type conversions
-connection slave;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
-source suite/rpl/include/type_conversions.test;
-
-# Checking lossy integer type conversions
-connection slave;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
-source suite/rpl/include/type_conversions.test;
-
-# Checking non-lossy integer type conversions
-connection slave;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
-source suite/rpl/include/type_conversions.test;
-
-# Checking all type conversions
-connection slave;
-SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
-source suite/rpl/include/type_conversions.test;
-
-connection slave;
---echo **** Result of conversions ****
-disable_query_log;
-SELECT RPAD(Source, 15, ' ') AS Source_Type,
- RPAD(Target, 15, ' ') AS Target_Type,
- RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags,
- IF(Compare IS NULL AND Error IS NOT NULL, '<Correct error>',
- IF(Compare, '<Correct value>',
- CONCAT("'", On_Slave, "' != '", Expected, "'")))
- AS Value_On_Slave
- FROM type_conversions;
-enable_query_log;
-DROP TABLE type_conversions;
-
-call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
-
-connection master;
-DROP TABLE t1;
-sync_slave_with_master;
-
-set global slave_type_conversions = @saved_slave_type_conversions;
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddata_local.result
index f0d24df2cb2..f0d24df2cb2 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_local.result
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result
new file mode 100644
index 00000000000..48672651c36
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic_error_stop.result
@@ -0,0 +1,81 @@
+include/rpl_init.inc [topology=1->2]
+call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit");
+call mtr.add_suppression("Slave: Duplicate entry '99'");
+connection server_1;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1,1);
+INSERT INTO t1 VALUES(2,1);
+INSERT INTO t1 VALUES(3,1);
+INSERT INTO t1 VALUES(4,1);
+connection server_2;
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+include/stop_slave.inc
+SET @old_debug_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug = "d,hold_worker2_favor_worker3";
+SET GLOBAL slave_parallel_threads=4;
+CHANGE MASTER TO master_use_gtid=slave_pos;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET GLOBAL slave_parallel_mode='optimistic';
+connection server_1;
+SET @@gtid_seq_no = 2001;
+BEGIN;
+UPDATE t1 SET b = 11 WHERE a = 4;
+UPDATE t1 SET b = 11 WHERE a = 3;
+UPDATE t1 SET a = 99 WHERE a = 1;
+COMMIT;
+UPDATE t1 SET b = 2 WHERE a = 2;
+UPDATE t1 SET b = 3 WHERE a = 3;
+DROP TABLE IF EXISTS phantom_1;
+Warnings:
+Note 1051 Unknown table 'test.phantom_1'
+include/save_master_gtid.inc
+connect slave_local_0, 127.0.0.1, root,, test, $SLAVE_MYPORT,;
+begin;
+UPDATE t1 set b = 11 where a = 4;
+connect slave_local_1, 127.0.0.1, root,, test, $SLAVE_MYPORT,;
+begin;
+INSERT INTO t1 VALUES (99, 11);
+connect slave_local_2, 127.0.0.1, root,, test, $SLAVE_MYPORT,;
+begin;
+UPDATE t1 SET b = 12 WHERE a = 2;
+connect slave_local_3, 127.0.0.1, root,, test, $SLAVE_MYPORT,;
+begin;
+UPDATE t1 SET b = 13 WHERE a = 3;
+connection server_2;
+include/start_slave.inc
+# W4 is waiting to start its DROP
+connection slave_local_3;
+rollback;
+connection slave_local_0;
+rollback;
+SELECT count(*) = 0 as "W3 undid its commit state" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%";
+W3 undid its commit state
+1
+connection slave_local_2;
+rollback;
+connection slave_local_1;
+commit;
+SELECT COUNT(*) = 1 as "W4 remains with the same status" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit%";
+W4 remains with the same status
+1
+# Slave_SQL_Running YES = Yes
+# while W2 is held back ...
+SET DEBUG_SYNC = 'now SIGNAL cont_worker2';
+include/wait_for_slave_sql_error.inc [errno=1062]
+DELETE FROM t1 WHERE a=99;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+connection server_2;
+include/stop_slave.inc
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+SET @@global.debug_dbug = @old_debug_dbug;
+SET debug_sync = RESET;
+include/start_slave.inc
+connection server_1;
+DROP TABLE t1;
+include/save_master_gtid.inc
+connection server_2;
+include/sync_with_master_gtid.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_seq.result b/mysql-test/suite/rpl/r/rpl_parallel_seq.result
new file mode 100644
index 00000000000..ae4041f470d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_seq.result
@@ -0,0 +1,85 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+# MDEV-29621 the sequence engine binlog_row_image-full events
+# MDL-deadlock on the parallel slave.
+connection master;
+CREATE SEQUENCE s1;
+SET @@session.binlog_row_image=FULL;
+SET @@session.debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id=7;
+SET @@gtid_seq_no=100;
+SELECT NEXT VALUE FOR s1;
+NEXT VALUE FOR s1
+1
+INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
+SET @@session.debug_dbug="";
+connection slave;
+SET @@global.slave_parallel_threads=2;
+SET @@global.slave_parallel_mode=optimistic;
+SET @@global.debug_dbug="+d,hold_worker_on_schedule";
+include/start_slave.inc
+SET DEBUG_SYNC = 'now SIGNAL continue_worker';
+connection master;
+DROP SEQUENCE s1;
+connection slave;
+include/stop_slave.inc
+# Simulate buggy 10.3.36 master to prove the parallel applier
+# does not deadlock now at replaying the above master load.
+connection master;
+include/rpl_stop_server.inc [server_number=1]
+include/rpl_start_server.inc [server_number=1]
+connection slave;
+RESET MASTER;
+SET @@global.gtid_slave_pos="";
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos;
+START SLAVE UNTIL MASTER_GTID_POS='0-1-102';
+SET DEBUG_SYNC = 'now SIGNAL continue_worker';
+# Normal stop is expected
+include/wait_for_slave_to_stop.inc
+# MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order
+# The test proves ALTER-SEQUENCE binlogs first before the following transaction does so.
+connection slave;
+include/stop_slave.inc
+Warnings:
+Note 1255 Slave already has been stopped
+RESET MASTER;
+SET @@global.gtid_slave_pos="";
+SET @@global.gtid_strict_mode=1;
+connection master;
+RESET MASTER;
+CREATE TABLE ti (a INT) ENGINE=innodb;
+CREATE SEQUENCE s2 ENGINE=innodb;
+SET @@gtid_seq_no=100;
+ALTER SEQUENCE s2 restart with 1;
+INSERT INTO ti SET a=1;
+include/save_master_gtid.inc
+SELECT @@global.gtid_binlog_state "Master gtid state";
+Master gtid state
+0-1-101
+connection slave;
+include/start_slave.inc
+SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
+@@global.gtid_binlog_state no 100,101 yet in both
+0-1-2 0-1-2
+SET DEBUG_SYNC = 'now SIGNAL continue_worker';
+# Normal sync with master proves the fixes correct
+include/sync_with_master_gtid.inc
+SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
+@@global.gtid_binlog_state all through 101 have been committed
+0-1-101 0-1-101
+connection slave;
+include/stop_slave.inc
+SET debug_sync = RESET;
+SET @@global.slave_parallel_threads= 0;
+SET @@global.slave_parallel_mode= optimistic;
+SET @@global.debug_dbug = "";
+SET @@global.gtid_strict_mode=0;
+include/start_slave.inc
+connection master;
+DROP SEQUENCE s2;
+DROP TABLE ti;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result b/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result
index a0ea06afa89..c303abc672c 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_wait_point.result
@@ -7,8 +7,6 @@ SET @@global.rpl_semi_sync_master_timeout = 60000;
SET @@global.rpl_semi_sync_master_wait_no_slave = 1;
# It's okay to see "Killed" but we should not see "Timeout" in the log.
call mtr.add_suppression("Killed waiting for reply of binlog");
-call mtr.add_suppression("Run function 'after_commit' in plugin 'rpl_semi_sync_master' failed");
-call mtr.add_suppression("Run function 'after_sync' in plugin 'rpl_semi_sync_master' failed");
#
# Test wait point = AFTER_COMMIT
#
diff --git a/mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result b/mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result
new file mode 100644
index 00000000000..f3fecbda349
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_xa_prepare_gtid_fail.result
@@ -0,0 +1,51 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+change master to master_use_gtid=slave_pos;
+set @@global.slave_parallel_threads= 4;
+set @@global.slave_parallel_mode= optimistic;
+set @@global.gtid_strict_mode=ON;
+set sql_log_bin= 0;
+alter table mysql.gtid_slave_pos engine=innodb;
+call mtr.add_suppression("Deadlock found.*");
+set sql_log_bin= 1;
+include/start_slave.inc
+connection master;
+create table t1 (a int primary key, b int) engine=innodb;
+insert t1 values (1,1);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+set @@global.innodb_lock_wait_timeout= 1;
+connection master;
+set @@session.gtid_seq_no=100;
+xa start '1';
+update t1 set b=b+10 where a=1;
+xa end '1';
+xa prepare '1';
+xa commit '1';
+include/save_master_gtid.inc
+connection slave;
+connection slave1;
+BEGIN;
+SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=100 FOR UPDATE;
+domain_id sub_id server_id seq_no
+connection slave;
+include/start_slave.inc
+include/wait_for_slave_sql_error.inc [errno=1942,1213]
+connection slave1;
+ROLLBACK;
+# Cleanup
+connection master;
+drop table t1;
+connection slave;
+include/stop_slave.inc
+set @@global.gtid_slave_pos= "0-1-100";
+set @@global.slave_parallel_threads= 0;
+set @@global.gtid_strict_mode= 0;
+set @@global.innodb_lock_wait_timeout= 50;
+include/start_slave.inc
+include/rpl_end.inc
+# End of rpl_xa_prepare_gtid_fail.test
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test
index 30faaf79613..ab95c9b4ee3 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test
@@ -1 +1,443 @@
---source include/rpl_binlog_errors.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+# Usage:
+# --let $binlog_limit= X[,Y] # optional
+#
+# Semantics of the value is the same as in include/show_binlog_events.inc
+# which the script calls as a part of the test flow.
+# The goal is to print the event demonstrating the triggered error,
+# so normally Y should be 1 (print the exact event only);
+# however, depending on test-specific server options, the offset X
+# can be different.
+#
+
+# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
+# when generating new name.
+#
+# WHY
+# ===
+#
+# We want to check whether error is reported or not when
+# new_file_impl fails (this may happen when rotation is not
+# possible because there is some problem finding an
+# unique filename).
+#
+# HOW
+# ===
+#
+# Test cases are documented inline.
+
+-- source include/have_innodb.inc
+-- source include/have_debug.inc
+-- source include/master-slave.inc
+
+-- echo #######################################################################
+-- echo ####################### PART 1: MASTER TESTS ##########################
+-- echo #######################################################################
+
+
+### ACTION: stopping slave as it is not needed for the first part of
+### the test
+
+-- connection slave
+-- source include/stop_slave.inc
+-- connection master
+
+call mtr.add_suppression("Can't generate a unique log-filename");
+call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
+call mtr.add_suppression("Error writing file .*");
+call mtr.add_suppression("Could not use master-bin for logging");
+
+SET @old_debug= @@global.debug_dbug;
+
+### ACTION: create a large file (> 4096 bytes) that will be later used
+### in LOAD DATA INFILE to check binlog errors in its vacinity
+-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data
+-- let $MYSQLD_DATADIR= `select @@datadir`
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file'
+
+### ACTION: create a small file (< 4096 bytes) that will be later used
+### in LOAD DATA INFILE to check for absence of binlog errors
+### when file loading this file does not force flushing and
+### rotating the binary log
+-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data
+-- let $MYSQLD_DATADIR= `select @@datadir`
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2'
+
+RESET MASTER;
+
+-- echo ###################### TEST #1
+
+### ASSERTION: no problem flushing logs (should show two binlogs)
+FLUSH LOGS;
+-- echo # assert: must show two binlogs
+-- source include/show_binary_logs.inc
+
+-- echo ###################### TEST #2
+
+### ASSERTION: check that FLUSH LOGS actually fails and reports
+### failure back to the user if find_uniq_filename fails
+### (should show just one binlog)
+
+RESET MASTER;
+SET @@global.debug_dbug="d,error_unique_log_filename";
+-- error ER_NO_UNIQUE_LOGFILE
+FLUSH LOGS;
+-- echo # assert: must show one binlog
+-- source include/show_binary_logs.inc
+
+### ACTION: clean up and move to next test
+SET @@global.debug_dbug=@old_debug;
+RESET MASTER;
+
+-- echo ###################### TEST #3
+
+### ACTION: create some tables (t1, t2, t4) and insert some values in
+### table t1
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a VARCHAR(16384)) Engine=InnoDB;
+CREATE TABLE t4 (a VARCHAR(16384));
+INSERT INTO t1 VALUES (1);
+RESET MASTER;
+
+### ASSERTION: we force rotation of the binary log because it exceeds
+### the max_binlog_size option (should show two binary
+### logs)
+
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
+
+# shows two binary logs
+-- echo # assert: must show two binlog
+-- source include/show_binary_logs.inc
+
+# clean up the table and the binlog to be used in next part of test
+SET @@global.debug_dbug=@old_debug;
+DELETE FROM t2;
+RESET MASTER;
+
+-- echo ###################### TEST #4
+
+### ASSERTION: load the big file into a transactional table and check
+### that it reports error. The table will contain the
+### changes performed despite the fact that it reported an
+### error.
+
+SET @@global.debug_dbug="d,error_unique_log_filename";
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- error ER_NO_UNIQUE_LOGFILE
+-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
+
+# show table
+-- echo # assert: must show one entry
+SELECT count(*) FROM t2;
+
+# clean up the table and the binlog to be used in next part of test
+SET @@global.debug_dbug=@old_debug;
+DELETE FROM t2;
+RESET MASTER;
+
+-- echo ###################### TEST #5
+
+### ASSERTION: load the small file into a transactional table and
+### check that it succeeds
+
+SET @@global.debug_dbug="d,error_unique_log_filename";
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2
+
+# show table
+-- echo # assert: must show one entry
+SELECT count(*) FROM t2;
+
+# clean up the table and the binlog to be used in next part of test
+SET @@global.debug_dbug=@old_debug;
+DELETE FROM t2;
+RESET MASTER;
+
+-- echo ###################### TEST #6
+
+### ASSERTION: check that even if one is using a transactional table
+### and explicit transactions (no autocommit) if rotation
+### fails we get the error. Transaction is not rolledback
+### because rotation happens after the commit.
+
+SET @@global.debug_dbug="d,error_unique_log_filename";
+SET AUTOCOMMIT=0;
+INSERT INTO t2 VALUES ('muse');
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
+INSERT INTO t2 VALUES ('muse');
+-- error ER_NO_UNIQUE_LOGFILE
+COMMIT;
+
+### ACTION: Show the contents of the table after the test
+-- echo # assert: must show three entries
+SELECT count(*) FROM t2;
+
+### ACTION: clean up and move to the next test
+SET AUTOCOMMIT= 1;
+SET @@global.debug_dbug=@old_debug;
+DELETE FROM t2;
+RESET MASTER;
+
+-- echo ###################### TEST #7
+
+### ASSERTION: check that on a non-transactional table, if rotation
+### fails then an error is reported and an incident event
+### is written to the current binary log.
+
+SET @@global.debug_dbug="d,error_unique_log_filename";
+
+# Disable logging Annotate_rows events to preserve events count.
+let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`;
+SET @@binlog_annotate_row_events= 0;
+
+SELECT count(*) FROM t4;
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- error ER_NO_UNIQUE_LOGFILE
+-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4
+
+-- echo # assert: must show 1 entry
+SELECT count(*) FROM t4;
+
+-- echo ### check that the incident event is written to the current log
+SET @@global.debug_dbug=@old_debug;
+if (!$binlog_limit)
+{
+ -- let $binlog_limit= 4,1
+}
+-- source include/show_binlog_events.inc
+
+# clean up and move to next test
+DELETE FROM t4;
+
+--disable_query_log
+eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved;
+--enable_query_log
+
+RESET MASTER;
+
+-- echo ###################### TEST #8
+
+### ASSERTION: check that statements end up in error but they succeed
+### on changing the data.
+
+SET @@global.debug_dbug="d,error_unique_log_filename";
+-- echo # must show 0 entries
+SELECT count(*) FROM t4;
+SELECT count(*) FROM t2;
+
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- error ER_NO_UNIQUE_LOGFILE
+-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4
+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+-- error ER_NO_UNIQUE_LOGFILE
+-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
+-- error ER_NO_UNIQUE_LOGFILE
+INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc');
+
+-- echo # INFO: Count(*) Before Offending DELETEs
+-- echo # assert: must show 1 entry
+SELECT count(*) FROM t4;
+-- echo # assert: must show 4 entries
+SELECT count(*) FROM t2;
+
+-- error ER_NO_UNIQUE_LOGFILE
+DELETE FROM t4;
+-- error ER_NO_UNIQUE_LOGFILE
+DELETE FROM t2;
+
+-- echo # INFO: Count(*) After Offending DELETEs
+-- echo # assert: must show zero entries
+SELECT count(*) FROM t4;
+SELECT count(*) FROM t2;
+
+# remove fault injection
+SET @@global.debug_dbug=@old_debug;
+
+-- echo ###################### TEST #9
+
+### ASSERTION: check that if we disable binlogging, then statements
+### succeed.
+SET @@global.debug_dbug="d,error_unique_log_filename";
+SET SQL_LOG_BIN=0;
+INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
+INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
+-- echo # assert: must show four entries
+SELECT count(*) FROM t2;
+SELECT count(*) FROM t4;
+DELETE FROM t2;
+DELETE FROM t4;
+-- echo # assert: must show zero entries
+SELECT count(*) FROM t2;
+SELECT count(*) FROM t4;
+SET SQL_LOG_BIN=1;
+SET @@global.debug_dbug=@old_debug;
+
+-- echo ###################### TEST #10
+
+### ASSERTION: check that error is reported if there is a failure
+### while registering the index file and the binary log
+### file or failure to write the rotate event.
+
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
+call mtr.add_suppression("Could not use .*");
+
+RESET MASTER;
+SHOW WARNINGS;
+
+# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
+SET @@global.debug_dbug="d,fault_injection_registering_index";
+-- replace_regex /\.[\\\/]master/master/
+-- error ER_CANT_OPEN_FILE
+FLUSH LOGS;
+SET @@global.debug_dbug=@old_debug;
+
+-- error ER_NO_BINARY_LOGGING
+SHOW BINARY LOGS;
+
+# issue some statements and check that they don't fail
+CREATE TABLE t5 (a INT);
+INSERT INTO t4 VALUES ('bbbbb');
+INSERT INTO t2 VALUES ('aaaaa');
+DELETE FROM t4;
+DELETE FROM t2;
+DROP TABLE t5;
+flush tables;
+
+-- echo ###################### TEST #11
+
+### ASSERTION: check that error is reported if there is a failure
+### while opening the index file and the binary log file or
+### failure to write the rotate event.
+
+# restart the server so that we have binlog again
+--let $rpl_server_number= 1
+--source include/rpl_restart_server.inc
+
+# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
+SET @@global.debug_dbug="d,fault_injection_openning_index";
+-- replace_regex /\.[\\\/]master/master/
+-- error ER_CANT_OPEN_FILE
+FLUSH LOGS;
+SET @@global.debug_dbug=@old_debug;
+
+-- error ER_FLUSH_MASTER_BINLOG_CLOSED
+RESET MASTER;
+
+# issue some statements and check that they don't fail
+CREATE TABLE t5 (a INT);
+INSERT INTO t4 VALUES ('bbbbb');
+INSERT INTO t2 VALUES ('aaaaa');
+DELETE FROM t4;
+DELETE FROM t2;
+DROP TABLE t5;
+flush tables;
+
+# restart the server so that we have binlog again
+--let $rpl_server_number= 1
+--source include/rpl_restart_server.inc
+
+-- echo ###################### TEST #12
+
+### ASSERTION: check that error is reported if there is a failure
+### while writing the rotate event when creating a new log
+### file.
+
+# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl
+SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
+-- error ER_ERROR_ON_WRITE
+FLUSH LOGS;
+SET @@global.debug_dbug=@old_debug;
+
+-- error ER_FLUSH_MASTER_BINLOG_CLOSED
+RESET MASTER;
+
+# issue some statements and check that they don't fail
+CREATE TABLE t5 (a INT);
+INSERT INTO t4 VALUES ('bbbbb');
+INSERT INTO t2 VALUES ('aaaaa');
+DELETE FROM t4;
+DELETE FROM t2;
+DROP TABLE t5;
+flush tables;
+
+# restart the server so that we have binlog again
+--let $rpl_server_number= 1
+--source include/rpl_restart_server.inc
+
+## clean up
+DROP TABLE t1, t2, t4;
+RESET MASTER;
+
+# restart slave again
+-- connection slave
+-- source include/start_slave.inc
+-- connection master
+
+-- echo #######################################################################
+-- echo ####################### PART 2: SLAVE TESTS ###########################
+-- echo #######################################################################
+
+### setup
+--source include/rpl_reset.inc
+-- connection slave
+
+# Slave tests rely on logic of non-gtid mode
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
+# slave suppressions
+
+call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
+call mtr.add_suppression("Error writing file .*");
+call mtr.add_suppression("Could not use .*");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
+call mtr.add_suppression("Can't generate a unique log-filename .*");
+-- echo ###################### TEST #13
+
+#### ASSERTION: check against unique log filename error
+-- let $io_thd_injection_fault_flag= error_unique_log_filename
+-- let $slave_io_errno= 1595
+-- let $show_slave_io_error= 1
+-- source include/io_thd_fault_injection.inc
+
+-- echo ###################### TEST #14
+
+#### ASSERTION: check against rotate failing
+-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event
+-- let $slave_io_errno= 1595
+-- let $show_slave_io_error= 1
+-- source include/io_thd_fault_injection.inc
+
+-- echo ###################### TEST #15
+
+#### ASSERTION: check against relay log open failure
+-- let $io_thd_injection_fault_flag= fault_injection_registering_index
+-- let $slave_io_errno= 1595
+-- let $show_slave_io_error= 1
+-- source include/io_thd_fault_injection.inc
+
+-- echo ###################### TEST #16
+
+#### ASSERTION: check against relay log index open failure
+-- let $io_thd_injection_fault_flag= fault_injection_openning_index
+-- let $slave_io_errno= 1595
+-- let $show_slave_io_error= 1
+-- source include/io_thd_fault_injection.inc
+
+### clean up
+-- source include/stop_slave_sql.inc
+RESET SLAVE;
+RESET MASTER;
+--remove_file $load_file
+--remove_file $load_file2
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_index.test b/mysql-test/suite/rpl/t/rpl_binlog_index.test
index 95c49c3d574..6112affb3c4 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_index.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_index.test
@@ -17,10 +17,6 @@
# BUG#12133 master.index file keeps mysqld from starting if bin log has been moved
# BUG#42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move
-source include/master-slave.inc;
-# There is no need to run this test case on all binlog format
-source include/have_binlog_format_row.inc;
-
# Since this test relies heavily on filesystem operations (like
# moving files around, backslashes and so forth) we avoid messing
# around with windows access violations for not cluttering the
@@ -28,6 +24,10 @@ source include/have_binlog_format_row.inc;
# it is not 100% compliant.
--source include/not_windows.inc
+source include/master-slave.inc;
+# There is no need to run this test case on all binlog format
+source include/have_binlog_format_row.inc;
+
connection master;
--let $master_datadir= `select @@datadir`
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
index 573c1d111fc..7c1d0ea25e2 100644
--- a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
@@ -1 +1,88 @@
---source include/rpl_cant_read_event_incident.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+#
+# Bug#11747416 : 32228 A disk full makes binary log corrupt.
+#
+#
+# The test demonstrates reading from binlog error propagation to slave
+# and reporting there.
+# Conditions for the bug include a crash at time of the last event to
+# the binlog was written partly. With the fixes the event is not sent out
+# any longer, but rather the dump thread sends out a sound error message.
+#
+# Crash is not simulated. A binlog with partly written event in its end is installed
+# and replication is started from it.
+#
+
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
+# Make sure the slave is stopped while we are messing with master.
+# Otherwise we get occasional failures as the slave manages to re-connect
+# to the newly started master and we get extra events applied, causing
+# conflicts.
+--source include/stop_slave.inc
+
+--connection master
+call mtr.add_suppression("Error in Log_event::read_log_event()");
+--let $datadir= `SELECT @@datadir`
+
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+--remove_file $datadir/master-bin.000001
+--copy_file $MYSQL_TEST_DIR/std_data/bug11747416_32228_binlog.000001 $datadir/master-bin.000001
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+--source include/wait_until_connected_again.inc
+
+# evidence of the partial binlog
+--error ER_ERROR_WHEN_EXECUTING_COMMAND
+show binlog events;
+
+--connection slave
+call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
+start slave;
+
+# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
+--let $slave_param=Last_IO_Errno
+--let $slave_param_value=1236
+--source include/wait_for_slave_param.inc
+
+--let $slave_field_result_replace= / at [0-9]*/ at XXX/
+--let $status_items= Last_IO_Errno, Last_IO_Error
+--source include/show_slave_status.inc
+
+#
+# Cleanup
+#
+
+--connection master
+reset master;
+
+--connection slave
+stop slave;
+reset slave;
+# Table was created from binlog, it may not be created if SQL thread is running
+# slowly and IO thread reaches incident before SQL thread applies it.
+--disable_warnings
+drop table if exists t;
+--enable_warnings
+reset master;
+
+--echo End of the tests
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test
index 0edf8fda7f3..fc765744b3f 100644
--- a/mysql-test/suite/rpl/t/rpl_checksum.test
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test
@@ -1 +1,342 @@
---source include/rpl_checksum.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+# WL2540 replication events checksum
+# Testing configuration parameters
+
+--source include/have_debug.inc
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
+--connection master
+call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log');
+call mtr.add_suppression('Replication event checksum verification failed');
+# due to C failure simulation
+call mtr.add_suppression('Relay log write failure: could not queue event from master');
+call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them');
+
+# A. read/write access to the global vars:
+# binlog_checksum master_verify_checksum slave_sql_verify_checksum
+
+connection master;
+
+set @master_save_binlog_checksum= @@global.binlog_checksum;
+set @save_master_verify_checksum = @@global.master_verify_checksum;
+
+select @@global.binlog_checksum as 'must be CRC32 because of the command line option';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.binlog_checksum as 'no session var';
+
+select @@global.master_verify_checksum as 'must be zero because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.master_verify_checksum as 'no session var';
+
+connection slave;
+
+set @slave_save_binlog_checksum= @@global.binlog_checksum;
+set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum;
+
+select @@global.slave_sql_verify_checksum as 'must be one because of default';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.slave_sql_verify_checksum as 'no session var';
+
+connection master;
+
+source include/show_binary_logs.inc;
+set @@global.binlog_checksum = NONE;
+select @@global.binlog_checksum;
+--echo *** must be rotations seen ***
+source include/show_binary_logs.inc;
+
+set @@global.binlog_checksum = default;
+select @@global.binlog_checksum;
+
+# testing lack of side-effects in non-effective update of binlog_checksum:
+set @@global.binlog_checksum = CRC32;
+select @@global.binlog_checksum;
+set @@global.binlog_checksum = CRC32;
+
+set @@global.master_verify_checksum = 0;
+set @@global.master_verify_checksum = default;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set @@global.binlog_checksum = ADLER32;
+--error ER_WRONG_VALUE_FOR_VAR
+set @@global.master_verify_checksum = 2; # the var is of bool type
+
+connection slave;
+
+set @@global.slave_sql_verify_checksum = 0;
+set @@global.slave_sql_verify_checksum = default;
+--error ER_WRONG_VALUE_FOR_VAR
+set @@global.slave_sql_verify_checksum = 2; # the var is of bool type
+
+#
+# B. Old Slave to New master conditions
+#
+# while master does not send a checksum-ed binlog the Old Slave can
+# work with the New Master
+
+connection master;
+
+set @@global.binlog_checksum = NONE;
+create table t1 (a int);
+
+# testing that binlog rotation preserves opt_binlog_checksum value
+flush logs;
+flush logs;
+-- source include/wait_for_binlog_checkpoint.inc
+flush logs;
+
+sync_slave_with_master;
+#connection slave;
+# checking that rotation on the slave side leaves slave stable
+flush logs;
+flush logs;
+flush logs;
+select count(*) as zero from t1;
+
+source include/stop_slave.inc;
+
+connection master;
+set @@global.binlog_checksum = CRC32;
+-- source include/wait_for_binlog_checkpoint.inc
+insert into t1 values (1) /* will not be applied on slave due to simulation */;
+
+# instruction to the dump thread
+
+connection slave;
+set @saved_dbug = @@global.debug_dbug;
+set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
+start slave;
+--let $slave_io_errno= 1236
+--let $show_slave_io_error= 1
+source include/wait_for_slave_io_error.inc;
+
+select count(*) as zero from t1;
+
+set @@global.debug_dbug = @saved_dbug;
+
+connection slave;
+source include/start_slave.inc;
+
+#
+# C. checksum failure simulations
+#
+
+# C1. Failure by a client thread
+connection master;
+set @@global.master_verify_checksum = 1;
+set @save_dbug = @@session.debug_dbug;
+set @@session.debug_dbug='d,simulate_checksum_test_failure';
+--error ER_ERROR_WHEN_EXECUTING_COMMAND
+show binlog events;
+SET debug_dbug= @save_dbug;
+set @@global.master_verify_checksum = default;
+
+#connection master;
+sync_slave_with_master;
+
+connection slave;
+source include/stop_slave.inc;
+
+connection master;
+create table t2 (a int);
+let $pos_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+connection slave;
+
+# C2. Failure by IO thread
+# instruction to io thread
+set @saved_dbug = @@global.debug_dbug;
+set @@global.debug_dbug='d,simulate_checksum_test_failure';
+start slave io_thread;
+# When the checksum error is detected, the slave sets error code 1913
+# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
+# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
+# So we usually get 1595, but it is occasionally possible to get 1913.
+--let $slave_io_errno= 1595,1913
+--let $show_slave_io_error= 0
+source include/wait_for_slave_io_error.inc;
+set @@global.debug_dbug = @saved_dbug;
+
+# to make IO thread re-read it again w/o the failure
+start slave io_thread;
+let $slave_param= Read_Master_Log_Pos;
+let $slave_param_value= $pos_master;
+source include/wait_for_slave_param.inc;
+
+# C3. Failure by SQL thread
+# instruction to sql thread;
+set @@global.slave_sql_verify_checksum = 1;
+
+set @@global.debug_dbug='d,simulate_checksum_test_failure';
+
+start slave sql_thread;
+--let $slave_sql_errno= 1593
+--let $show_slave_sql_error= 1
+source include/wait_for_slave_sql_error.inc;
+
+# resuming SQL thread to parse out the event w/o the failure
+
+set @@global.debug_dbug = @saved_dbug;
+source include/start_slave.inc;
+
+connection master;
+sync_slave_with_master;
+
+#connection slave;
+select count(*) as 'must be zero' from t2;
+
+#
+# D. Reset slave, Change-Master, Binlog & Relay-log rotations with
+# random value on binlog_checksum on both master and slave
+#
+connection slave;
+stop slave;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
+
+# randomize slave server's own checksum policy
+set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE");
+flush logs;
+
+connection master;
+set @@global.binlog_checksum= CRC32;
+reset master;
+flush logs;
+create table t3 (a int, b char(5));
+
+connection slave;
+source include/start_slave.inc;
+
+connection master;
+sync_slave_with_master;
+
+#connection slave;
+select count(*) as 'must be zero' from t3;
+source include/stop_slave.inc;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
+
+connection master;
+flush logs;
+reset master;
+insert into t3 value (1, @@global.binlog_checksum);
+
+connection slave;
+source include/start_slave.inc;
+flush logs;
+
+connection master;
+sync_slave_with_master;
+
+#connection slave;
+select count(*) as 'must be one' from t3;
+
+connection master;
+set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE");
+insert into t3 value (1, @@global.binlog_checksum);
+sync_slave_with_master;
+
+#connection slave;
+
+#clean-up
+
+connection master;
+drop table t1, t2, t3;
+set @@global.binlog_checksum = @master_save_binlog_checksum;
+set @@global.master_verify_checksum = @save_master_verify_checksum;
+
+#
+# BUG#58564: flush_read_lock fails in mysql-trunk-bugfixing after merging with WL#2540
+#
+# Sanity check that verifies that no assertions are triggered because
+# of old FD events (generated by versions prior to server released with
+# checksums feature)
+#
+# There is no need for query log, if something wrong this should trigger
+# an assertion
+
+--disable_query_log
+
+BINLOG '
+MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
+';
+
+--enable_query_log
+
+#connection slave;
+sync_slave_with_master;
+
+
+--echo *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters ***
+
+--connection master
+
+--source include/wait_for_binlog_checkpoint.inc
+CREATE TABLE t4 (a INT PRIMARY KEY);
+INSERT INTO t4 VALUES (1);
+
+SET sql_log_bin=0;
+CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename");
+SET sql_log_bin=1;
+SET @old_dbug= @@GLOBAL.debug_dbug;
+SET debug_dbug= '+d,binlog_inject_new_name_error';
+--error ER_NO_UNIQUE_LOGFILE
+FLUSH LOGS;
+SET debug_dbug= @old_dbug;
+
+INSERT INTO t4 VALUES (2);
+
+--connection slave
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error.inc
+
+# Search the error log for the error message.
+# The bug was that 4 garbage bytes were output in the middle of the error
+# message; by searching for a pattern that spans that location, we can
+# catch the error.
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!$log_error_)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
+}
+--let SEARCH_FILE= $log_error_
+--let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590
+--source include/search_pattern_in_file.inc
+
+SELECT * FROM t4 ORDER BY a;
+STOP SLAVE IO_THREAD;
+SET sql_slave_skip_counter= 1;
+--source include/start_slave.inc
+
+--connection master
+--save_master_pos
+
+--connection slave
+--sync_with_master
+SELECT * FROM t4 ORDER BY a;
+
+
+--connection slave
+set @@global.binlog_checksum = @slave_save_binlog_checksum;
+set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum;
+
+--echo End of tests
+
+--connection master
+DROP TABLE t4;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test
index 59b338d2556..e04f618b81e 100644
--- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test
+++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test
@@ -1 +1,261 @@
---source include/rpl_checksum_cache.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+-- source include/have_innodb.inc
+-- source include/master-slave.inc
+
+--disable_warnings
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t2 set data=repeat.*'a', @act_size.*");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. .*Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*");
+--enable_warnings
+
+connection master;
+set @save_binlog_cache_size = @@global.binlog_cache_size;
+set @save_binlog_checksum = @@global.binlog_checksum;
+set @save_master_verify_checksum = @@global.master_verify_checksum;
+set @@global.binlog_cache_size = 4096;
+set @@global.binlog_checksum = CRC32;
+set @@global.master_verify_checksum = 1;
+
+# restart slave to force the dump thread to verify events (on master side)
+connection slave;
+source include/stop_slave.inc;
+source include/start_slave.inc;
+
+connection master;
+
+#
+# Testing a critical part of checksum handling dealing with transaction cache.
+# The cache's buffer size is set to be less than the transaction's footprint
+# in binlog.
+#
+# To verify combined buffer-by-buffer read out of the file and fixing crc per event
+# there are the following parts:
+#
+# 1. the event size is much less than the cache's buffer
+# 2. the event size is bigger than the cache's buffer
+# 3. the event size if approximately the same as the cache's buffer
+# 4. all in above
+
+#
+# 1. the event size is much less than the cache's buffer
+#
+
+flush status;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# parameter to ensure the test slightly varies binlog content
+# between different invocations
+#
+let $deviation_size=32;
+eval create table t1 (a int PRIMARY KEY, b CHAR($deviation_size)) engine=innodb;
+
+# Now we are going to create transaction which is long enough so its
+# transaction binlog will be flushed to disk...
+
+delimiter |;
+create procedure test.p_init (n int, size int)
+begin
+ while n > 0 do
+ select round(RAND() * size) into @act_size;
+ set @data = repeat('a', @act_size);
+ insert into t1 values(n, @data );
+ set n= n-1;
+ end while;
+end|
+
+delimiter ;|
+
+let $1 = 4000; # PB2 can run it slow to time out on following sync_slave_with_master:s
+
+begin;
+--disable_warnings
+# todo: check if it is really so.
+#+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
+eval call test.p_init($1, $deviation_size);
+--enable_warnings
+commit;
+
+show status like "binlog_cache_use";
+--echo *** binlog_cache_disk_use must be non-zero ***
+show status like "binlog_cache_disk_use";
+
+sync_slave_with_master;
+
+let $diff_tables=master:test.t1, slave:test.t1;
+source include/diff_tables.inc;
+
+# undoing changes with verifying the above once again
+connection master;
+
+begin;
+delete from t1;
+commit;
+
+sync_slave_with_master;
+
+
+#
+# 2. the event size is bigger than the cache's buffer
+#
+connection master;
+
+flush status;
+let $t2_data_size= `select 3 * @@global.binlog_cache_size`;
+let $t2_aver_size= `select 2 * @@global.binlog_cache_size`;
+let $t2_max_rand= `select 1 * @@global.binlog_cache_size`;
+
+eval create table t2(a int auto_increment primary key, data VARCHAR($t2_data_size)) ENGINE=Innodb;
+let $1=100;
+--disable_query_log
+begin;
+while ($1)
+{
+ eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size;
+ set @data = repeat('a', @act_size);
+ insert into t2 set data = @data;
+ dec $1;
+}
+commit;
+--enable_query_log
+show status like "binlog_cache_use";
+--echo *** binlog_cache_disk_use must be non-zero ***
+show status like "binlog_cache_disk_use";
+
+sync_slave_with_master;
+
+let $diff_tables=master:test.t2, slave:test.t2;
+source include/diff_tables.inc;
+
+# undoing changes with verifying the above once again
+connection master;
+
+begin;
+delete from t2;
+commit;
+
+sync_slave_with_master;
+
+#
+# 3. the event size if approximately the same as the cache's buffer
+#
+
+connection master;
+
+flush status;
+let $t3_data_size= `select 2 * @@global.binlog_cache_size`;
+let $t3_aver_size= `select (9 * @@global.binlog_cache_size) / 10`;
+let $t3_max_rand= `select (2 * @@global.binlog_cache_size) / 10`;
+
+eval create table t3(a int auto_increment primary key, data VARCHAR($t3_data_size)) engine=innodb;
+
+let $1= 300;
+--disable_query_log
+begin;
+while ($1)
+{
+ eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size;
+ insert into t3 set data= repeat('a', @act_size);
+ dec $1;
+}
+commit;
+--enable_query_log
+show status like "binlog_cache_use";
+--echo *** binlog_cache_disk_use must be non-zero ***
+show status like "binlog_cache_disk_use";
+
+sync_slave_with_master;
+
+let $diff_tables=master:test.t3, slave:test.t3;
+source include/diff_tables.inc;
+
+# undoing changes with verifying the above once again
+connection master;
+
+begin;
+delete from t3;
+commit;
+
+sync_slave_with_master;
+
+
+#
+# 4. all in above
+#
+
+connection master;
+flush status;
+
+delimiter |;
+eval create procedure test.p1 (n int)
+begin
+ while n > 0 do
+ case (select (round(rand()*100) % 3) + 1)
+ when 1 then
+ select round(RAND() * $deviation_size) into @act_size;
+ set @data = repeat('a', @act_size);
+ insert into t1 values(n, @data);
+ when 2 then
+ begin
+ select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size;
+ insert into t2 set data=repeat('a', @act_size);
+ end;
+ when 3 then
+ begin
+ select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size;
+ insert into t3 set data= repeat('a', @act_size);
+ end;
+ end case;
+ set n= n-1;
+ end while;
+end|
+delimiter ;|
+
+let $1= 1000;
+set autocommit= 0;
+begin;
+--disable_warnings
+eval call test.p1($1);
+--enable_warnings
+commit;
+
+show status like "binlog_cache_use";
+--echo *** binlog_cache_disk_use must be non-zero ***
+show status like "binlog_cache_disk_use";
+
+sync_slave_with_master;
+
+let $diff_tables=master:test.t1, slave:test.t1;
+source include/diff_tables.inc;
+
+let $diff_tables=master:test.t2, slave:test.t2;
+source include/diff_tables.inc;
+
+let $diff_tables=master:test.t3, slave:test.t3;
+source include/diff_tables.inc;
+
+
+connection master;
+
+begin;
+delete from t1;
+delete from t2;
+delete from t3;
+commit;
+
+drop table t1, t2, t3;
+set @@global.binlog_cache_size = @save_binlog_cache_size;
+set @@global.binlog_checksum = @save_binlog_checksum;
+set @@global.master_verify_checksum = @save_master_verify_checksum;
+drop procedure test.p_init;
+drop procedure test.p1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_corruption.test b/mysql-test/suite/rpl/t/rpl_corruption.test
index e51d1c65e95..cd2a1cc7ef2 100644
--- a/mysql-test/suite/rpl/t/rpl_corruption.test
+++ b/mysql-test/suite/rpl/t/rpl_corruption.test
@@ -1 +1,181 @@
---source include/rpl_corruption.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+############################################################
+# Purpose: WL#5064 Testing with corrupted events.
+# The test emulates the corruption at the vary stages
+# of replication:
+# - in binlog file
+# - in network
+# - in relay log
+############################################################
+
+#
+# The tests intensively utilize @@global.debug. Note,
+# Bug#11765758 - 58754,
+# @@global.debug is read by the slave threads through dbug-interface.
+# Hence, before a client thread set @@global.debug we have to ensure that:
+# (a) the slave threads are stopped, or (b) the slave threads are in
+# sync and waiting.
+
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
+# Block legal errors for MTR
+call mtr.add_suppression('Found invalid event in binary log');
+call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master');
+call mtr.add_suppression('event read from binlog did not pass crc check');
+call mtr.add_suppression('Replication event checksum verification failed');
+call mtr.add_suppression('Event crc check failed! Most likely there is event corruption');
+call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593');
+
+SET @old_master_verify_checksum = @@master_verify_checksum;
+
+# Creating test table/data and set corruption position for testing
+--echo # 1. Creating test table/data and set corruption position for testing
+--connection master
+--echo * insert/update/delete rows in table t1 *
+# Corruption algorithm modifies only the first event and
+# then will be reset. To avoid checking always the first event
+# from binlog (usually it is FD) we randomly execute different
+# statements and set position for corruption inside events.
+
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
+--disable_query_log
+let $i=`SELECT 3+CEILING(10*RAND())`;
+let $j=1;
+let $pos=0;
+while ($i) {
+ eval INSERT INTO t1 VALUES ($j, 'a', NULL);
+ if (`SELECT RAND() > 0.7`)
+ {
+ eval UPDATE t1 SET c = REPEAT('a', 20) WHERE a = $j;
+ }
+ if (`SELECT RAND() > 0.8`)
+ {
+ eval DELETE FROM t1 WHERE a = $j;
+ }
+ if (!$pos) {
+ let $pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+ --sync_slave_with_master
+ --source include/stop_slave.inc
+ --disable_query_log
+ --connection master
+ }
+ dec $i;
+ inc $j;
+}
+--enable_query_log
+
+
+# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing
+--echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS
+SET @saved_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
+--echo SHOW BINLOG EVENTS;
+--disable_query_log
+send_eval SHOW BINLOG EVENTS FROM $pos;
+--enable_query_log
+--error ER_ERROR_WHEN_EXECUTING_COMMAND
+reap;
+
+SET @@global.debug_dbug=@saved_dbug;
+
+# Emulate corruption on master with crc checking on master
+--echo # 3. Master read a corrupted event from binlog and send the error to slave
+
+# We have a rare but nasty potential race here: if the dump thread on
+# the master for the _old_ slave connection has not yet discovered
+# that the slave has disconnected, we will inject the corrupt event on
+# the wrong connection, and the test will fail
+# (+d,corrupt_read_log_event2 corrupts only one event).
+# So kill any lingering dump thread (we need to kill; otherwise dump thread
+# could manage to send all events down the socket before seeing it close, and
+# hang forever waiting for new binlog events to be created).
+let $id= `select id from information_schema.processlist where command = "Binlog Dump"`;
+if ($id)
+{
+ --disable_query_log
+ --error 0,1094
+ eval kill $id;
+ --enable_query_log
+}
+let $wait_condition=
+ SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump';
+--source include/wait_condition.inc
+
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
+--connection slave
+START SLAVE IO_THREAD;
+let $slave_io_errno= 1236;
+--let $slave_timeout= 10
+--source include/wait_for_slave_io_error.inc
+--connection master
+SET @@global.debug_dbug=@saved_dbug;
+
+# Emulate corruption on master without crc checking on master
+--echo # 4. Master read a corrupted event from binlog and send it to slave
+--connection master
+SET GLOBAL master_verify_checksum=0;
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
+--connection slave
+START SLAVE IO_THREAD;
+# When the checksum error is detected, the slave sets error code 1743
+# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately
+# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io().
+# So we usually get 1595, but it is occasionally possible to get 1743.
+let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
+--source include/wait_for_slave_io_error.inc
+--connection master
+SET @@global.debug_dbug=@saved_dbug;
+SET GLOBAL master_verify_checksum=1;
+
+# Emulate corruption in network
+--echo # 5. Slave. Corruption in network
+--connection slave
+SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_queue_event";
+START SLAVE IO_THREAD;
+let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
+--source include/wait_for_slave_io_error.inc
+SET @@global.debug_dbug=@saved_dbug_slave;
+
+# Emulate corruption in relay log
+--echo # 6. Slave. Corruption in relay log
+
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
+
+START SLAVE SQL_THREAD;
+let $slave_sql_errno= 1593;
+--source include/wait_for_slave_sql_error.inc
+
+SET @@global.debug_dbug=@saved_dbug_slave;
+
+# Start normal replication and compare same table on master
+# and slave
+--echo # 7. Seek diff for tables on master and slave
+--connection slave
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+let $diff_tables= master:test.t1, slave:test.t1;
+--source include/diff_tables.inc
+
+# Clean up
+--echo # 8. Clean up
+--connection master
+set @@global.debug_dbug = @saved_dbug;
+SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
+DROP TABLE t1;
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
index 004003ea524..5975c6f03c3 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
@@ -1,4 +1,575 @@
---source include/rpl_gtid_basic.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+--source include/have_innodb.inc
+--let $rpl_topology=1->2->3->4
+--source include/rpl_init.inc
+
+# Set up a 4-deep replication topology, then test various fail-overs
+# using GTID.
+#
+# A -> B -> C -> D
+
+connection server_1;
+--source include/wait_for_binlog_checkpoint.inc
+--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
+--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
+--echo *** GTID position should be empty here ***
+--replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS>
+eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
+CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, "m1");
+INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4");
+INSERT INTO t2 VALUES (1, "i1");
+BEGIN;
+INSERT INTO t2 VALUES (2, "i2"), (3, "i3");
+INSERT INTO t2 VALUES (4, "i4");
+COMMIT;
+save_master_pos;
+source include/wait_for_binlog_checkpoint.inc;
+--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
+--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
+--let $gtid_pos_server_1 = `SELECT @@gtid_binlog_pos`
+--echo *** GTID position should be non-empty here ***
+--replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS> $gtid_pos_server_1 <GTID_POS_SERVER_1>
+eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
+
+connection server_2;
+sync_with_master;
+source include/wait_for_binlog_checkpoint.inc;
+--let $binlog_file = query_get_value(SHOW MASTER STATUS,File,1)
+--let $binlog_pos = query_get_value(SHOW MASTER STATUS,Position,1)
+--echo *** GTID position should be the same as on server_1 ***
+--replace_result $binlog_file <BINLOG_FILE> $binlog_pos <BINLOG_POS> $gtid_pos_server_1 <GTID_POS_SERVER_1>
+eval SELECT BINLOG_GTID_POS('$binlog_file',$binlog_pos);
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+
+connection server_3;
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+save_master_pos;
+
+connection server_4;
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+
+--echo *** Now take out D, let it fall behind a bit, and then test re-attaching it to A ***
+connection server_4;
+--source include/stop_slave.inc
+
+connection server_1;
+INSERT INTO t1 VALUES (5, "m1a");
+INSERT INTO t2 VALUES (5, "i1a");
+save_master_pos;
+
+connection server_4;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
+ MASTER_USE_GTID=CURRENT_POS;
+--source include/start_slave.inc
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+--echo *** Now move B to D (C is still replicating from B) ***
+connection server_2;
+--source include/stop_slave.inc
+--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4,
+ MASTER_USE_GTID=CURRENT_POS;
+--source include/start_slave.inc
+
+connection server_4;
+UPDATE t2 SET b="j1a" WHERE a=5;
+save_master_pos;
+
+connection server_2;
+sync_with_master;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+--echo *** Now move C to D, after letting it fall a little behind ***
+connection server_3;
+--source include/stop_slave.inc
+
+connection server_1;
+INSERT INTO t2 VALUES (6, "i6b");
+INSERT INTO t2 VALUES (7, "i7b");
+--source include/save_master_gtid.inc
+
+connection server_3;
+--replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4,
+ MASTER_USE_GTID=CURRENT_POS;
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+SELECT * FROM t2 ORDER BY a;
+
+--echo *** Now change everything back to what it was, to make rpl_end.inc happy
+# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled.
+connection server_2;
+# We need to sync up server_2 before switching. If it happened to have reached
+# the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to
+# server_1, which is (deliberately) missing that transaction.
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT;
+--source include/start_slave.inc
+--source include/wait_for_slave_to_start.inc
+
+connection server_3;
+--source include/stop_slave.inc
+--replace_result $SLAVE_MYPORT SLAVE_MYPORT
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT;
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+connection server_4;
+--source include/stop_slave.inc
+--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3;
+--source include/start_slave.inc
+
+connection server_1;
+DROP TABLE t1,t2;
+--source include/save_master_gtid.inc
+
+--echo *** A few more checks for BINLOG_GTID_POS function ***
+--let $valid_binlog_name = query_get_value(SHOW BINARY LOGS,Log_name,1)
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT BINLOG_GTID_POS();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT BINLOG_GTID_POS('a');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT BINLOG_GTID_POS('a',1,NULL);
+SELECT BINLOG_GTID_POS(1,'a');
+SELECT BINLOG_GTID_POS(NULL,NULL);
+SELECT BINLOG_GTID_POS('',1);
+SELECT BINLOG_GTID_POS('a',1);
+eval SELECT BINLOG_GTID_POS('$valid_binlog_name',-1);
+eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
+eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
+eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);
+
+
+--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
+--connection server_2
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+
+--connection server_1
+SET @old_state= @@GLOBAL.gtid_binlog_state;
+
+--error ER_BINLOG_MUST_BE_EMPTY
+SET GLOBAL gtid_binlog_state = '';
+RESET MASTER;
+SET GLOBAL gtid_binlog_state = '';
+FLUSH LOGS;
+--source include/show_binary_logs.inc
+SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30';
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000001
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+#SELECT @@GLOBAL.gtid_binlog_pos;
+#SELECT @@GLOBAL.gtid_binlog_state;
+--error ER_BINLOG_MUST_BE_EMPTY
+SET GLOBAL gtid_binlog_state = @old_state;
+RESET MASTER;
+SET GLOBAL gtid_binlog_state = @old_state;
+
+# Check that slave can reconnect again, despite the RESET MASTER, as we
+# restored the state.
+
+CREATE TABLE t1 (a INT PRIMARY KEY);
+SET gtid_seq_no=100;
+INSERT INTO t1 VALUES (1);
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/start_slave.inc
+# We cannot just use sync_with_master as we've done RESET MASTER, so
+# slave old-style position is wrong.
+# So sync on gtid position instead.
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t1;
+# Check that the IO gtid position in SHOW SLAVE STATUS is also correct.
+--let $status_items= Gtid_IO_Pos
+--source include/show_slave_status.inc
+
+--echo *** Test @@LAST_GTID and MASTER_GTID_WAIT() ***
+
+--connection server_1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--source include/stop_slave.inc
+
+--connect (m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
+SELECT @@last_gtid;
+SET gtid_seq_no=110;
+SELECT @@last_gtid;
+BEGIN;
+SELECT @@last_gtid;
+INSERT INTO t1 VALUES (2);
+SELECT @@last_gtid;
+COMMIT;
+SELECT @@last_gtid;
+--let $pos= `SELECT @@gtid_binlog_pos`
+
+--connect (s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+eval SET @pos= '$pos';
+# Check NULL argument.
+SELECT master_gtid_wait(NULL);
+# Check empty argument returns immediately.
+SELECT master_gtid_wait('', NULL);
+# Check this gets counted
+SHOW STATUS LIKE 'Master_gtid_wait_count';
+SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
+SHOW STATUS LIKE 'Master_gtid_wait_time';
+# Let's check that we get a timeout
+SELECT master_gtid_wait(@pos, 0.5);
+SELECT * FROM t1 ORDER BY a;
+# Now actually wait until the slave reaches the position
+send SELECT master_gtid_wait(@pos);
+
+--connection server_2
+--source include/start_slave.inc
+
+--connection s1
+reap;
+SELECT * FROM t1 ORDER BY a;
+
+# Test waiting on a domain that does not exist yet.
+--source include/stop_slave.inc
+
+--connection server_1
+SET gtid_domain_id= 1;
+INSERT INTO t1 VALUES (3);
+--let $pos= `SELECT @@gtid_binlog_pos`
+
+--connection s1
+--replace_result $pos POS
+eval SET @pos= '$pos';
+SELECT master_gtid_wait(@pos, 0);
+SELECT * FROM t1 WHERE a >= 3;
+send SELECT master_gtid_wait(@pos, -1);
+
+--connection server_2
+--source include/start_slave.inc
+
+--connection s1
+reap;
+SELECT * FROM t1 WHERE a >= 3;
+# Waiting for only part of the position.
+SELECT master_gtid_wait('1-1-1', 0);
+
+# Now test a lot of parallel master_gtid_wait() calls, completing in different
+# order, and some of which time out or get killed on the way.
+
+--connection s1
+send SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110');
+
+--connect (s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+# This will time out. No event 0-1-1000 exists
+send SELECT master_gtid_wait('0-1-1000', 0.5);
+
+--connect (s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+# This one we will kill
+--let $kill1_id= `SELECT connection_id()`
+send SELECT master_gtid_wait('0-1-2000');
+
+--connect (s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+send SELECT master_gtid_wait('2-1-10');
+
+--connect (s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+send SELECT master_gtid_wait('2-1-6', 1);
+
+# This one we will kill also.
+--connect (s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+--let $kill2_id= `SELECT connection_id()`
+send SELECT master_gtid_wait('2-1-5');
+
+--connect (s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+send SELECT master_gtid_wait('2-1-10');
+
+--connect (s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+send SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110');
+
+--connect (s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+send SELECT master_gtid_wait('2-1-2');
+
+--connection server_2
+# This one completes immediately.
+SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
+SHOW STATUS LIKE 'Master_gtid_wait_count';
+SELECT master_gtid_wait('1-1-1');
+SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
+SHOW STATUS LIKE 'Master_gtid_wait_count';
+let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1);
+--replace_result $wait_time MASTER_GTID_WAIT_TIME
+eval SET @a= $wait_time;
+SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected"))
+ AS Master_gtid_wait_time_as_expected;
+
+
+--connect (s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+send SELECT master_gtid_wait('0-1-109');
+
+--connection server_2
+# This one should time out.
+SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
+SHOW STATUS LIKE 'Master_gtid_wait_count';
+SELECT master_gtid_wait('2-1-2', 0.5);
+SHOW STATUS LIKE 'Master_gtid_wait_timeouts';
+SHOW STATUS LIKE 'Master_gtid_wait_count';
+let $wait_time = query_get_value(SHOW STATUS LIKE 'Master_gtid_wait_time', Value, 1);
+--replace_result $wait_time MASTER_GTID_WAIT_TIME
+eval SET @a= $wait_time;
+# We expect a wait time of just a bit over 0.5 seconds. But thread scheduling
+# and timer inaccuracies could introduce significant jitter. So allow a
+# generous interval.
+SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected;
+
+--replace_result $kill1_id KILL_ID
+eval KILL QUERY $kill1_id;
+--connection s3
+--error ER_QUERY_INTERRUPTED
+reap;
+
+--connection server_1
+SET gtid_domain_id=2;
+SET gtid_seq_no=2;
+INSERT INTO t1 VALUES (4);
+
+--connection s9
+reap;
+
+--connection server_2
+--replace_result $kill2_id KILL_ID
+eval KILL CONNECTION $kill2_id;
+
+--connection s6
+--error 2013,ER_CONNECTION_KILLED
+reap;
+
+--connection server_1
+SET gtid_domain_id=1;
+SET gtid_seq_no=4;
+INSERT INTO t1 VALUES (5);
+SET gtid_domain_id=2;
+SET gtid_seq_no=5;
+INSERT INTO t1 VALUES (6);
+
+--connection s8
+reap;
+--connection s1
+reap;
+--connection s2
+reap;
+--connection s5
+reap;
+--connection s10
+reap;
+
+--connection server_1
+SET gtid_domain_id=2;
+SET gtid_seq_no=10;
+INSERT INTO t1 VALUES (7);
+
+--connection s4
+reap;
+--connection s7
+reap;
+
+
+--echo *** Test gtid_slave_pos when used with GTID ***
+
+--connection server_2
+--source include/stop_slave.inc
+
+--connection server_1
+SET gtid_domain_id=2;
+SET gtid_seq_no=1000;
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (11);
+--save_master_pos
+
+--connection server_2
+SET sql_slave_skip_counter= 1;
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+--source include/stop_slave.inc
+
+--connection server_1
+SET gtid_domain_id=2;
+SET gtid_seq_no=1010;
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+--save_master_pos
+
+--connection server_2
+SET sql_slave_skip_counter= 2;
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+--source include/stop_slave.inc
+
+--connection server_1
+SET gtid_domain_id=2;
+SET gtid_seq_no=1020;
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (15);
+INSERT INTO t1 VALUES (16);
+--save_master_pos
+
+--connection server_2
+SET sql_slave_skip_counter= 3;
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+--source include/stop_slave.inc
+
+--connection server_1
+SET gtid_domain_id=2;
+SET gtid_seq_no=1030;
+# Disable logging Annotate_rows events to preserve events count.
+let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`;
+SET @@binlog_annotate_row_events= 0;
+INSERT INTO t1 VALUES (17);
+INSERT INTO t1 VALUES (18);
+INSERT INTO t1 VALUES (19);
+eval SET @@binlog_annotate_row_events= $binlog_annotate_row_events_saved;
+--save_master_pos
+
+--connection server_2
+SET sql_slave_skip_counter= 5;
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 10 ORDER BY a;
+SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+
+--source include/stop_slave.inc
+
+--connection server_1
+SET gtid_domain_id=3;
+SET gtid_seq_no=100;
+CREATE TABLE t2 (a INT PRIMARY KEY);
+DROP TABLE t2;
+SET gtid_domain_id=2;
+SET gtid_seq_no=1040;
+INSERT INTO t1 VALUES (20);
+--save_master_pos
+
+--connection server_2
+SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode;
+SET GLOBAL slave_ddl_exec_mode=STRICT;
+SET sql_slave_skip_counter=1;
+START SLAVE UNTIL master_gtid_pos="3-1-100";
+--let $master_pos=3-1-100
+--source include/sync_with_master_gtid.inc
+--source include/wait_for_slave_to_stop.inc
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t2;
+SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+# Start the slave again, it should fail on the DROP TABLE as the table is not there.
+SET sql_log_bin=0;
+CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051");
+SET sql_log_bin=1;
+START SLAVE;
+--let $slave_sql_errno=1051
+--source include/wait_for_slave_sql_error.inc
+SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+STOP SLAVE IO_THREAD;
+SET sql_slave_skip_counter=2;
+--source include/start_slave.inc
+--sync_with_master
+
+SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
+SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status;
+
+SET GLOBAL slave_ddl_exec_mode= @saved_mode;
+
+
+--echo *** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. ***
+
+# Create an out-of-order binlog on server 2.
+# Let server 3 replicate to an out-of-order point, stop it, restart it,
+# and check that it replicates correctly despite the out-of-order.
+
+--connection server_1
+SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
+INSERT INTO t1 VALUES (31);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+SET gtid_domain_id= @@GLOBAL.gtid_domain_id;
+INSERT INTO t1 VALUES (32);
+
+--connection server_1
+INSERT INTO t1 VALUES (33);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--save_master_pos
+
+--connection server_3
+--sync_with_master
+--source include/stop_slave.inc
+
+--connection server_1
+INSERT INTO t1 VALUES (34);
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--save_master_pos
+
+--connection server_3
+--source include/start_slave.inc
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+--save_master_pos
+
+--connection server_4
+--sync_with_master
+SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
+
+
+# Clean up.
+--connection server_1
+DROP TABLE t1;
+
+
+--source include/rpl_end.inc
--echo #
--echo # Start of 10.2 tests
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
index 7fb457f6d7f..9760d4df00c 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
@@ -2,10 +2,10 @@ if (`SELECT $PS_PROTOCOL != 0`)
{
--skip Test temporarily disabled for ps-protocol
}
+--source include/no_valgrind_without_big.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--source include/have_innodb.inc
---source include/no_valgrind_without_big.inc
--echo *** Test normal shutdown/restart of slave server configured as a GTID slave. ***
diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test
index 4bb6477ca98..75d28d6a6c6 100644
--- a/mysql-test/suite/rpl/t/rpl_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_incident.test
@@ -1 +1,61 @@
---source include/rpl_incident.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+SET @old_binlog_checksum=@@binlog_checksum;
+SET GLOBAL BINLOG_CHECKSUM=none;
+connection slave;
+SET @old_binlog_checksum=@@binlog_checksum;
+SET GLOBAL BINLOG_CHECKSUM=none;
+connection master;
+
+--echo **** On Master ****
+CREATE TABLE t1 (a INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+
+set @saved_dbug = @@global.debug_dbug;
+SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
+
+# This will generate an incident log event and store it in the binary
+# log before the replace statement.
+REPLACE INTO t1 VALUES (4);
+--save_master_pos
+SELECT * FROM t1;
+
+set @@global.debug_dbug = @saved_dbug;
+
+connection slave;
+# Wait until SQL thread stops with error LOST_EVENT on master
+call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
+let $slave_sql_errno= 1590;
+let $show_slave_sql_error= 1;
+source include/wait_for_slave_sql_error.inc;
+
+# The 4 should not be inserted into the table, since the incident log
+# event should have stop the slave.
+--echo **** On Slave ****
+SELECT * FROM t1;
+
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+--sync_with_master
+
+# Now, we should have inserted the row into the table and the slave
+# should be running. We should also have rotated to a new binary log.
+
+SELECT * FROM t1;
+source include/check_slave_is_running.inc;
+
+connection master;
+SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
+DROP TABLE t1;
+--sync_slave_with_master
+SET GLOBAL BINLOG_CHECKSUM=@old_binlog_checksum;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test
index 6f6ab7e8d7c..46673ea4764 100644
--- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test
@@ -1 +1,96 @@
---source include/rpl_init_slave_errors.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+######################################################################
+# Some errors that cause the slave SQL thread to stop are not shown in
+# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
+# is only in the server's error log.
+#
+# Two failures and their respective reporting are verified:
+#
+# 1 - Failures during slave thread initialization
+# 2 - Failures while processing queries passed through the init_slave
+# option.
+#
+# In order to check the first type of failure, we inject a fault in the
+# SQL/IO Threads through SET GLOBAL debug.
+#
+# To check the second type, we set @@global.init_slave to an invalid
+# command thus preventing the initialization of the SQL Thread.
+#
+# Obs:
+# 1 - Note that testing failures while initializing the relay log position
+# is hard as the same function is called before the code reaches the point
+# that we want to test.
+#
+# 2 - This test does not target failures that are reported while applying
+# events such as duplicate keys, errors while reading the relay-log.bin*,
+# etc. Such errors are already checked on other tests.
+######################################################################
+
+######################################################################
+# Configuring the Environment
+######################################################################
+source include/have_debug.inc;
+source include/have_log_bin.inc;
+source include/master-slave.inc;
+
+connection slave;
+
+--disable_warnings
+stop slave;
+--enable_warnings
+reset slave;
+
+######################################################################
+# Injecting faults in the threads' initialization
+######################################################################
+connection slave;
+
+# Set debug flags on slave to force errors to occur
+set @saved_dbug = @@global.debug_dbug;
+SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
+
+start slave;
+
+#
+# slave is going to stop because of emulated failures
+# but there won't be any crashes nor asserts hit.
+#
+# 1593 = ER_SLAVE_FATAL_ERROR
+--let $slave_sql_errno= 1593
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
+
+call mtr.add_suppression("Failed during slave.* thread initialization");
+
+set @@global.debug_dbug = @saved_dbug;
+
+######################################################################
+# Injecting faults in the init_slave option
+######################################################################
+connection slave;
+
+reset slave;
+
+SET GLOBAL init_slave= "garbage";
+
+start slave;
+# 1064 = ER_PARSE_ERROR
+--let $slave_sql_errno= 1064
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
+
+######################################################################
+# Clean up
+######################################################################
+SET GLOBAL init_slave= "";
+
+# Clean up Last_SQL_Error
+--source include/stop_slave_io.inc
+RESET SLAVE;
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test b/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test
index 9c804d8206a..a27a50d0fc4 100644
--- a/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test
+++ b/mysql-test/suite/rpl/t/rpl_lcase_tblnames_rewrite_db.test
@@ -15,8 +15,8 @@
#
# (iii) master and slave tables do not differ
#
--- source include/master-slave.inc
-- source include/not_windows.inc
+-- source include/master-slave.inc
SET SQL_LOG_BIN=0;
CREATE DATABASE B37656;
diff --git a/mysql-test/suite/rpl/include/rpl_loaddata_local.inc b/mysql-test/suite/rpl/t/rpl_loaddata_local.test
index 20962d74e98..20962d74e98 100644
--- a/mysql-test/suite/rpl/include/rpl_loaddata_local.inc
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_local.test
diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
deleted file mode 100644
index 712041467ab..00000000000
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
+++ /dev/null
@@ -1 +0,0 @@
---source include/rpl_loaddata_local.inc
diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test
index 10fecf1f653..9cd64530690 100644
--- a/mysql-test/suite/rpl/t/rpl_loadfile.test
+++ b/mysql-test/suite/rpl/t/rpl_loadfile.test
@@ -1 +1,120 @@
---source include/rpl_loadfile.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+#############################################################################
+# Original Author: JBM #
+# Original Date: Aug/18/2005 #
+#############################################################################
+# TEST: To test the LOAD_FILE() in rbr #
+#############################################################################
+# Change Author: JBM
+# Change Date: 2006-01-16
+##########
+
+# Includes
+-- source include/have_binlog_format_mixed_or_row.inc
+-- source include/master-slave.inc
+
+-- source suite/rpl/include/rpl_loadfile.test
+
+# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE
+#
+# DESCRIPTION
+#
+# Problem: when using load_file string function and mixed binlogging format
+# there was no switch to row based binlogging format. This leads
+# to scenarios on which the slave replicates the statement and it
+# will try to load the file from local file system, which in most
+# likely it will not exist.
+#
+# Solution:
+# Marking this function as unsafe for statement format, makes the
+# statement using it to be logged in row based format. As such, data
+# replicated from the master, becomes the content of the loaded file.
+# Consequently, the slave receives the necessary data to complete
+# the load_file instruction correctly.
+#
+# IMPLEMENTATION
+#
+# The test is implemented as follows:
+#
+# On Master,
+# i) write to file the desired content.
+# ii) create table and stored procedure with load_file
+# iii) stop slave
+# iii) execute load_file
+# iv) remove file
+#
+# On Slave,
+# v) start slave
+# vi) sync it with master so that it gets the updates from binlog (which
+# should have bin logged in row format).
+#
+# If the the binlog format does not change to row, then the assertion
+# done in the following step fails. This happens because tables differ
+# since the file does not exist anymore, meaning that when slave
+# attempts to execute LOAD_FILE statement it inserts NULL on table
+# instead of the same contents that the master loaded when it executed
+# the procedure (which was executed when file existed).
+#
+# vii) assert that the contents of master and slave
+# table are the same
+
+--source include/rpl_reset.inc
+
+connection master;
+let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT repeat('x',20) INTO OUTFILE '$file'
+
+disable_warnings;
+DROP TABLE IF EXISTS t1;
+enable_warnings;
+
+CREATE TABLE t1 (t text);
+DELIMITER |;
+CREATE PROCEDURE p(file varchar(4096))
+ BEGIN
+ INSERT INTO t1 VALUES (LOAD_FILE(file));
+ END|
+DELIMITER ;|
+
+# stop slave before issuing the load_file on master
+connection slave;
+source include/stop_slave.inc;
+
+connection master;
+
+# test: check that logging falls back to rbr.
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval CALL p('$file')
+
+# test: remove the file from the filesystem and assert that slave still
+# gets the loaded file
+remove_file $file;
+
+# now that the file is removed it is safe (regarding what we want to test)
+# to start slave
+connection slave;
+source include/start_slave.inc;
+
+connection master;
+sync_slave_with_master;
+
+# assertion: assert that the slave got the updates even
+# if the file was removed before the slave started,
+# meaning that contents were indeed transfered
+# through binlog (in row format)
+let $diff_tables= master:t1, slave:t1;
+source include/diff_tables.inc;
+
+# CLEAN UP
+--connection master
+DROP TABLE t1;
+DROP PROCEDURE p;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mdev12179.test b/mysql-test/suite/rpl/t/rpl_mdev12179.test
index c8b9e665747..aa0d05211ff 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev12179.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev12179.test
@@ -1,7 +1,7 @@
+--source include/no_valgrind_without_big.inc
--source include/have_innodb.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
---source include/no_valgrind_without_big.inc
--connection server_2
call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase");
diff --git a/mysql-test/suite/rpl/t/rpl_mdev382.test b/mysql-test/suite/rpl/t/rpl_mdev382.test
index 093b7b92413..84e3c84982d 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev382.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev382.test
@@ -1,7 +1,7 @@
+--source include/not_windows.inc #unix shell escaping used for mysqlbinlog
--source include/have_innodb.inc
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
---source include/not_windows.inc #unix shell escaping used for mysqlbinlog
# MDEV-382: multiple SQL injections in replication code.
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index 1bf99c2366b..cbde486bcbb 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -1 +1,184 @@
---source include/rpl_packet.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+# ==== Purpose ====
+#
+# Check replication protocol packet size handling
+#
+# ==== Related bugs ====
+# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
+# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
+# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
+# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
+
+# max-out size db name
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153");
+call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
+let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+disable_warnings;
+eval drop database if exists $db;
+enable_warnings;
+eval create database $db;
+
+connection master;
+let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
+let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
+let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
+SET @@global.max_allowed_packet=1024;
+SET @@global.net_buffer_length=1024;
+
+sync_slave_with_master;
+# Restart slave for setting to take effect
+source include/stop_slave.inc;
+source include/start_slave.inc;
+
+# Reconnect to master for new setting to take effect
+disconnect master;
+
+# alas, can't use eval here; if db name changed apply the change here
+connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);
+
+connection master;
+select @@net_buffer_length, @@max_allowed_packet;
+
+create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
+sync_slave_with_master;
+
+eval select count(*) from `$db`.`t1` /* must be 1 */;
+
+SHOW STATUS LIKE 'Slave_running';
+select * from information_schema.session_status where variable_name= 'SLAVE_RUNNING';
+connection master;
+eval drop database $db;
+sync_slave_with_master;
+
+#
+# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
+#
+# Check that a situation when the size of event on the master is greater than
+# max_allowed_packet on the slave does not lead to infinite re-transmits.
+
+connection master;
+
+# Change the max packet size on master
+
+SET @@global.max_allowed_packet=4096;
+SET @@global.net_buffer_length=4096;
+
+# Restart slave for new setting to take effect
+connection slave;
+source include/stop_slave.inc;
+source include/start_slave.inc;
+
+# Reconnect to master for new setting to take effect
+disconnect master;
+connect (master, localhost, root);
+connection master;
+
+CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+
+sync_slave_with_master;
+
+connection master;
+
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
+
+
+#
+# Bug#42914: The slave I/O thread must stop after trying to read the above
+# event, However there is no Last_IO_Error report.
+#
+
+# The slave I/O thread must stop after trying to read the above event
+connection slave;
+# 1153 = ER_NET_PACKET_TOO_LARGE
+--let $slave_io_errno= 1153
+--let $show_slave_io_error= 1
+--source include/wait_for_slave_io_error.inc
+
+# TODO: this is needed because of BUG#55790. Remove once that is fixed.
+--source include/stop_slave_sql.inc
+
+#
+# Bug#42914: On the master, if a binary log event is larger than
+# max_allowed_packet, the error message ER_MASTER_FATAL_ERROR_READING_BINLOG
+# is sent to a slave when it requests a dump from the master, thus leading the
+# I/O thread to stop. However, there is no Last_IO_Error reported.
+#
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_reset.inc
+--connection master
+DROP TABLE t1;
+--sync_slave_with_master
+
+
+connection master;
+CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
+sync_slave_with_master;
+
+connection master;
+INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
+
+connection slave;
+# The slave I/O thread must stop after receiving
+# 1153 = ER_NET_PACKET_TOO_LARGE
+--let $slave_io_errno= 1153
+--let $show_slave_io_error= 1
+--source include/wait_for_slave_io_error.inc
+
+# Remove the bad binlog and clear error status on slave.
+STOP SLAVE;
+RESET SLAVE;
+--connection master
+RESET MASTER;
+
+
+#
+# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
+#
+# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
+# BINLOG EVENTS was issued. To verify that this bug is fixed, we
+# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
+# never changes. We turn off the result log because we don't care
+# about the contents of the binlog.
+
+--disable_result_log
+SET @max_allowed_packet_0= @@session.max_allowed_packet;
+SHOW BINLOG EVENTS;
+SET @max_allowed_packet_1= @@session.max_allowed_packet;
+SHOW BINLOG EVENTS;
+SET @max_allowed_packet_2= @@session.max_allowed_packet;
+--enable_result_log
+if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
+{
+ --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
+ --source include/show_rpl_debug_info.inc
+ SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
+ --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
+}
+
+
+--echo ==== clean up ====
+connection master;
+DROP TABLE t1;
+eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
+eval SET @@global.net_buffer_length= $old_net_buffer_length;
+eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet;
+# slave is stopped
+connection slave;
+DROP TABLE t1;
+
+# Clear Last_IO_Error
+RESET SLAVE;
+
+--source include/rpl_end.inc
+# End of tests
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
index 90f09a76546..493385f1ae3 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
@@ -1 +1,115 @@
---source include/rpl_parallel_ignored_errors.inc
+# ==== Purpose ====
+#
+# Test verifies that, in parallel replication, transaction failure notification
+# is propagated to all the workers. Workers should abort the execution of
+# transaction event groups, whose event positions are higher than the failing
+# transaction group.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Create a table t1 on master which has a primary key. Enable parallel
+# replication on slave with slave_parallel_mode='optimistic' and
+# slave_parallel_threads=3.
+# 1 - On slave start a transaction and execute a local INSERT statement
+# which will insert value 32. This is done to block the INSERT coming
+# from master.
+# 2 - On master execute an INSERT statement with value 32, so that it is
+# blocked on slave.
+# 3 - On slave enable a debug sync point such that it holds the worker thread
+# execution as soon as work is scheduled to it.
+# 4 - INSERT value 33 on master. It will be held on slave by other worker
+# thread due to debug simulation.
+# 5 - INSERT value 34 on master.
+# 6 - On slave, enusre that INSERT 34 has reached a state where it waits for
+# its prior transactions to commit.
+# 7 - Commit the local INSERT 32 on slave server so that first worker will
+# error out.
+# 8 - Now send a continue signal to second worker processing 33. It should
+# wakeup and propagate the error to INSERT 34.
+# 9 - Upon slave stop due to error, check that no rows are found after the
+# failed INSERT 32.
+#
+# ==== References ====
+#
+# MDEV-20645: Replication consistency is broken as workers miss the error
+# notification from an earlier failed group.
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+
+--enable_connect_log
+--connection server_2
+--source include/stop_slave.inc
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET @old_debug= @@GLOBAL.debug_dbug;
+SET GLOBAL slave_parallel_mode='optimistic';
+SET GLOBAL slave_parallel_threads= 3;
+CHANGE MASTER TO master_use_gtid=slave_pos;
+CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
+--source include/start_slave.inc
+
+--connection server_1
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(1);
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,)
+BEGIN;
+INSERT INTO t1 VALUES (32);
+
+--connection server_1
+INSERT INTO t1 VALUES (32);
+
+--connection server_2
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE info like "INSERT INTO t1 VALUES (32)"
+--source include/wait_condition.inc
+SET GLOBAL debug_dbug="+d,hold_worker_on_schedule";
+SET debug_sync="debug_sync_action SIGNAL reached_pause WAIT_FOR continue_worker";
+
+--connection server_1
+SET gtid_seq_no=100;
+INSERT INTO t1 VALUES (33);
+
+--connection server_2
+SET debug_sync='now WAIT_FOR reached_pause';
+
+--connection server_1
+INSERT INTO t1 VALUES (34);
+
+--connection server_2
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit"
+--source include/wait_condition.inc
+--connection con_temp2
+COMMIT;
+
+# Clean up.
+--connection server_2
+--source include/stop_slave.inc
+--let $assert_cond= COUNT(*) = 0 FROM t1 WHERE a>32
+--let $assert_text= table t1 should have zero rows where a>32
+--source include/assert.inc
+SELECT * FROM t1 WHERE a>32;
+DELETE FROM t1 WHERE a=32;
+
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL debug_dbug=@old_debug;
+SET DEBUG_SYNC= 'RESET';
+--source include/start_slave.inc
+
+--connection server_1
+DROP TABLE t1;
+--disable_connect_log
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test
new file mode 100644
index 00000000000..27f38d47bdb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_error_stop.test
@@ -0,0 +1,180 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--let $rpl_topology=1->2
+--source include/rpl_init.inc
+
+call mtr.add_suppression("Slave: Commit failed due to failure of an earlier commit");
+call mtr.add_suppression("Slave: Duplicate entry '99'");
+
+--connection server_1
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1,1); # hit a dup entry on slave
+INSERT INTO t1 VALUES(2,1); # races to "win" the last exit
+INSERT INTO t1 VALUES(3,1);
+INSERT INTO t1 VALUES(4,1); # make W3 race over W1
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+--source include/stop_slave.inc
+SET @old_debug_dbug = @@global.debug_dbug;
+# In a group of W1,W2,W3 of the same batch W2 simulates slowness.
+SET @@global.debug_dbug = "d,hold_worker2_favor_worker3";
+SET GLOBAL slave_parallel_threads=4;
+CHANGE MASTER TO master_use_gtid=slave_pos;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET GLOBAL slave_parallel_mode='optimistic';
+
+# MDEV-30780 optimistic parallel slave hangs after hit an error
+# Test workers hang scenario to prove it's no more neither
+# out-of-order access to the active gco list.
+#
+# The test provides how to reproduce on the OLD version, false by default.
+# That branch approximates the original hang with an assert that
+# confirms the OLD version indeed could access already reclaimed gco.
+--let $old_version_regression=0
+
+
+--connection server_1
+
+# Let W1,W2,W3,W4 parallel workers that are going to execute
+# the following transaction.
+# W1 holds on with the 1st statement
+# then crashes W3 with the 2nd into retry,
+# finally hits with the 3rd a dup entry, on slave.
+SET @@gtid_seq_no = 2001;
+BEGIN;
+ UPDATE t1 SET b = 11 WHERE a = 4;
+ UPDATE t1 SET b = 11 WHERE a = 3;
+ UPDATE t1 SET a = 99 WHERE a = 1;
+COMMIT;
+# In the buggy version W2 races to "win" the exit last (of W1..3)
+# and by that to access last a gco struct, garbage-collected.
+UPDATE t1 SET b = 2 WHERE a = 2;
+# W3 garbage-collects the gco struct in the buggy version.
+UPDATE t1 SET b = 3 WHERE a = 3;
+# W4 resides in following "singleton" batch to a W2 replacement
+# in the buggy version to allow W3 reclaim the batch's gco.
+DROP TABLE IF EXISTS phantom_1;
+
+--source include/save_master_gtid.inc
+
+--connect (slave_local_0, 127.0.0.1, root,, test, $SLAVE_MYPORT,)
+begin;
+ UPDATE t1 set b = 11 where a = 4;
+--connect (slave_local_1, 127.0.0.1, root,, test, $SLAVE_MYPORT,)
+begin;
+ INSERT INTO t1 VALUES (99, 11);
+
+--connect (slave_local_2, 127.0.0.1, root,, test, $SLAVE_MYPORT,)
+begin;
+ UPDATE t1 SET b = 12 WHERE a = 2;
+
+--connect (slave_local_3, 127.0.0.1, root,, test, $SLAVE_MYPORT,)
+begin;
+ UPDATE t1 SET b = 13 WHERE a = 3;
+
+--connection server_2
+--source include/start_slave.inc
+
+--echo # W4 is waiting to start its DROP
+
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit%"
+--source include/wait_condition.inc
+
+--connection slave_local_3
+# make W3 to set E.cc <- 1
+ rollback;
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%"
+--source include/wait_condition.inc
+
+--connection slave_local_0
+# make W3 into retry and delay it to let W1 hit a dupicate error first,
+# see 'commit' by slave_local_1.
+ rollback;
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "debug sync point: now"
+--source include/wait_condition.inc
+SELECT count(*) = 0 as "W3 undid its commit state" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%";
+
+
+--connection slave_local_2
+ rollback;
+# wait for W2 to start committing E.cc <- 2
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state like "Waiting for prior transaction to commit"
+--source include/wait_condition.inc
+
+--connection slave_local_1
+
+# W1 errors out
+# A. to alert W3
+# B. W3 will *not* wake up W4 in the fixed version, having to wait for W2 demise.
+# C. W2 will notify W3 that releases W4 as it would do in normal cases.
+commit;
+
+if (!$old_version_regression)
+{
+# A. In the fixed version show-processlist W4 is still in the ordered waiting
+SELECT COUNT(*) = 1 as "W4 remains with the same status" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit%";
+--let $status= query_get_value("show slave status", Slave_SQL_Running, 1)
+--echo # Slave_SQL_Running YES = $status
+
+# B. In the fixed version W3 is waiting for W2,...
+--let $wait_condition= SELECT count(*) = 1 as "W4 is waiting" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%"
+--source include/wait_condition.inc
+--echo # while W2 is held back ...
+--let $wait_condition= SELECT count(*) = 1 as "W2 simulates slowness" FROM information_schema.processlist WHERE state LIKE "debug sync point: now"
+--source include/wait_condition.inc
+
+# C. # ...until NOW.
+SET DEBUG_SYNC = 'now SIGNAL cont_worker2';
+
+}
+
+# To reproduce the hang on the OLD version ...
+if ($old_version_regression)
+{
+ # replace the actual fixes block with checking W3,W4 have actually committed,
+ # followed by signaling to W2 like on behalf of W4 which would end up in the hang.
+ --let $wait_condition= SELECT COUNT(*) = 0 as "W4 has moved on" FROM information_schema.processlist WHERE state like "Waiting for prior transaction to start commit"
+ --source include/wait_condition.inc
+ --let $wait_condition= SELECT count(*) = 0 as "W3 does not wait on W2" FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit%"
+--source include/wait_condition.inc
+
+ --let $wait_condition= SELECT count(*) = 1 as "W2 simulates slowness" FROM information_schema.processlist WHERE state LIKE "debug sync point: now"
+ --source include/wait_condition.inc
+
+ # Like above, but signaling is done after W4 is done to violate the commit order
+ # that must fire a debug assert.
+ SET DEBUG_SYNC = 'now SIGNAL cont_worker2';
+}
+
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
+
+# Restore the slave data and resume with replication
+DELETE FROM t1 WHERE a=99;
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+#
+# Clean up.
+#
+--connection server_2
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+SET @@global.debug_dbug = @old_debug_dbug;
+SET debug_sync = RESET;
+--source include/start_slave.inc
+
+--connection server_1
+DROP TABLE t1;
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test
new file mode 100644
index 00000000000..2a4fd96ff34
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test
@@ -0,0 +1,131 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+
+--echo # MDEV-29621 the sequence engine binlog_row_image-full events
+--echo # MDL-deadlock on the parallel slave.
+--connection master
+CREATE SEQUENCE s1;
+SET @@session.binlog_row_image=FULL;
+SET @@session.debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id=7;
+SET @@gtid_seq_no=100;
+SELECT NEXT VALUE FOR s1;
+INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
+SET @@session.debug_dbug="";
+
+--connection slave
+--let $slave_parallel_threads=`select @@global.slave_parallel_threads`
+--let $slave_parallel_mode=`select @@global.slave_parallel_mode`
+SET @@global.slave_parallel_threads=2;
+SET @@global.slave_parallel_mode=optimistic;
+SET @@global.debug_dbug="+d,hold_worker_on_schedule";
+--source include/start_slave.inc
+
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit"
+--source include/wait_condition.inc
+SET DEBUG_SYNC = 'now SIGNAL continue_worker';
+
+--connection master
+DROP SEQUENCE s1;
+--sync_slave_with_master
+--source include/stop_slave.inc
+
+--echo # Simulate buggy 10.3.36 master to prove the parallel applier
+--echo # does not deadlock now at replaying the above master load.
+--connection master
+--let $datadir= `SELECT @@datadir`
+
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+--remove_file $datadir/master-bin.000001
+--copy_file $MYSQL_TEST_DIR/std_data/rpl/master-bin-seq_10.3.36.000001 $datadir/master-bin.000001
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+--source include/wait_until_connected_again.inc
+--save_master_pos
+
+--connection slave
+RESET MASTER;
+SET @@global.gtid_slave_pos="";
+
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos;
+
+START SLAVE UNTIL MASTER_GTID_POS='0-1-102';
+
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
+--source include/wait_condition.inc
+SET DEBUG_SYNC = 'now SIGNAL continue_worker';
+
+--echo # Normal stop is expected
+--source include/wait_for_slave_to_stop.inc
+
+--echo # MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order
+--echo # The test proves ALTER-SEQUENCE binlogs first before the following transaction does so.
+
+--connection slave
+--source include/stop_slave.inc
+RESET MASTER;
+SET @@global.gtid_slave_pos="";
+--let $slave_gtid_strict_mode=`select @@global.gtid_strict_mode`
+SET @@global.gtid_strict_mode=1;
+--connection master
+RESET MASTER;
+
+# Load from master
+CREATE TABLE ti (a INT) ENGINE=innodb;
+CREATE SEQUENCE s2 ENGINE=innodb;
+
+SET @@gtid_seq_no=100;
+ALTER SEQUENCE s2 restart with 1;
+INSERT INTO ti SET a=1;
+--source include/save_master_gtid.inc
+SELECT @@global.gtid_binlog_state "Master gtid state";
+
+--connection slave
+--source include/start_slave.inc
+
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
+--source include/wait_condition.inc
+
+SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
+
+# DEBUG_DBUG extension point of hold_worker_on_schedule is reused
+# (gets deployed) in Sql_cmd_alter_sequence::execute.
+SET DEBUG_SYNC = 'now SIGNAL continue_worker';
+
+--echo # Normal sync with master proves the fixes correct
+--source include/sync_with_master_gtid.inc
+
+SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
+
+#
+# MDEV-29621/MDEV-31077 clean up.
+#
+--connection slave
+--source include/stop_slave.inc
+
+SET debug_sync = RESET;
+--eval SET @@global.slave_parallel_threads= $slave_parallel_threads
+--eval SET @@global.slave_parallel_mode= $slave_parallel_mode
+ SET @@global.debug_dbug = "";
+--eval SET @@global.gtid_strict_mode=$slave_gtid_strict_mode
+--source include/start_slave.inc
+
+--connection master
+DROP SEQUENCE s2;
+DROP TABLE ti;
+
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
index 8c8892d5370..cddc9286bd2 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test
@@ -1 +1,38 @@
---source include/rpl_parallel_show_binlog_events_purge_logs.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
+#
+# The function mysql_show_binlog_events has a local stack variable
+# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
+# this variable goes out of scope and is destroyed before clean
+# thd->current_linfo.
+#
+# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
+# that with the fix local variable linfo is valid along all
+# mysql_show_binlog_events function scope.
+#
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/master-slave.inc
+
+--connection slave
+SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
+--send SHOW BINLOG EVENTS
+
+--connection slave1
+SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
+FLUSH LOGS;
+SET DEBUG_SYNC= 'now SIGNAL end';
+
+--connection slave
+--disable_result_log
+--reap
+--enable_result_log
+SET DEBUG_SYNC= 'RESET';
+
+--connection master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate.test b/mysql-test/suite/rpl/t/rpl_relayrotate.test
index 720739e14c0..4de554d3143 100644
--- a/mysql-test/suite/rpl/t/rpl_relayrotate.test
+++ b/mysql-test/suite/rpl/t/rpl_relayrotate.test
@@ -1 +1,18 @@
---source include/rpl_relayrotate.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+#######################################################
+# Wrapper for rpl_relayrotate.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+#######################################################
+-- source include/have_innodb.inc
+# Slow test, don't run during staging part
+-- source include/not_staging.inc
+-- source include/master-slave.inc
+
+let $engine_type=innodb;
+-- source suite/rpl/include/rpl_relayrotate.test
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test b/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test
index 44c04dd62d3..7decd130a43 100644
--- a/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test
+++ b/mysql-test/suite/rpl/t/rpl_row_lcase_tblnames.test
@@ -3,10 +3,10 @@
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
#
--- source include/master-slave.inc
--- source include/have_innodb.inc
-- source include/not_windows.inc
+-- source include/have_innodb.inc
-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
-- let $engine=InnoDB
-- source include/rpl_lower_case_table_names.test
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 5c17bcb2344..720ec059350 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -1 +1,532 @@
---source include/rpl_semi_sync.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+source include/not_embedded.inc;
+source include/have_innodb.inc;
+source include/master-slave.inc;
+
+let $engine_type= InnoDB;
+
+# Suppress warnings that might be generated during the test
+connection master;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+call mtr.add_suppression("Read semi-sync reply");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+call mtr.add_suppression("mysqld: Got an error reading communication packets");
+connection slave;
+# While 'Current_Pos' exists as an option for Using_Gtd, keeping these
+# events in the binlog will update gtid_binlog_pos, and the later calls to
+# set `@@global.gtid_slave_pos= ""` will provide warning messages with
+# inconsistent GTID values because the seq_nos are non-deterministic with
+# the masters events coming in concurrently
+set sql_log_bin=0;
+call mtr.add_suppression("Master server does not support semi-sync");
+call mtr.add_suppression("Semi-sync slave .* reply");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin=1;
+connection master;
+
+# wait for dying connections (if any) to disappear
+let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed';
+--source include/wait_condition.inc
+
+# After fix of BUG#45848, semi-sync slave should not create any extra
+# connections on master, save the count of connections before start
+# semi-sync slave for comparison below.
+let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
+
+--echo #
+--echo # Uninstall semi-sync plugins on master and slave
+--echo #
+connection slave;
+source include/stop_slave.inc;
+--source include/reset_slave.inc
+set global rpl_semi_sync_master_enabled= 0;
+set global rpl_semi_sync_slave_enabled= 0;
+
+connection master;
+reset master;
+set global rpl_semi_sync_master_enabled= 0;
+set global rpl_semi_sync_slave_enabled= 0;
+
+--echo #
+--echo # Main test of semi-sync replication start here
+--echo #
+
+connection master;
+
+set global rpl_semi_sync_master_timeout= 60000; # 60s
+
+echo [ default state of semi-sync on master should be OFF ];
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ enable semi-sync on master ];
+set global rpl_semi_sync_master_enabled = 1;
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ status of semi-sync on master should be ON even without any semi-sync slaves ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed
+--echo # BUG#45673 Semisynch reports correct operation even if no slave is connected
+--echo #
+
+# BUG#45672 When semi-sync is enabled on master, it would allocate
+# transaction node even without semi-sync slave connected, and would
+# finally result in transaction node allocation error.
+#
+# Semi-sync master will pre-allocate 'max_connections' transaction
+# nodes, so here we do more than that much transactions to check if it
+# will fail or not.
+# select @@global.max_connections + 1;
+let $i= `select @@global.max_connections + 1`;
+disable_query_log;
+eval create table t1 (a int) engine=$engine_type;
+while ($i)
+{
+ eval insert into t1 values ($i);
+ dec $i;
+}
+drop table t1;
+enable_query_log;
+
+# BUG#45673
+echo [ status of semi-sync on master should be OFF ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+# reset master to make sure the following test will start with a clean environment
+reset master;
+
+connection slave;
+
+echo [ default state of semi-sync on slave should be OFF ];
+show variables like 'rpl_semi_sync_slave_enabled';
+
+echo [ enable semi-sync on slave ];
+set global rpl_semi_sync_slave_enabled = 1;
+show variables like 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+
+connection master;
+
+# NOTE: Rpl_semi_sync_master_client will only be updated when
+# semi-sync slave has started binlog dump request
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+
+echo [ initial master state after the semi-sync slave connected ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1(a int) engine = $engine_type;
+
+echo [ master state after CREATE TABLE statement ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+# After fix of BUG#45848, semi-sync slave should not create any extra
+# connections on master.
+let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
+replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE;
+eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0';
+
+echo [ insert records to table ];
+insert t1 values (10);
+insert t1 values (9);
+insert t1 values (8);
+insert t1 values (7);
+insert t1 values (6);
+insert t1 values (5);
+insert t1 values (4);
+insert t1 values (3);
+insert t1 values (2);
+insert t1 values (1);
+
+echo [ master status after inserts ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+sync_slave_with_master;
+
+echo [ slave status after replicated inserts ];
+show status like 'Rpl_semi_sync_slave_status';
+
+select count(distinct a) from t1;
+select min(a) from t1;
+select max(a) from t1;
+
+--echo
+--echo # BUG#50157
+--echo # semi-sync replication crashes when replicating a transaction which
+--echo # include 'CREATE TEMPORARY TABLE `MyISAM_t` SELECT * FROM `Innodb_t` ;
+
+connection master;
+SET SESSION AUTOCOMMIT= 0;
+CREATE TABLE t2(c1 INT) ENGINE=innodb;
+sync_slave_with_master;
+
+connection master;
+BEGIN;
+--echo
+--echo # Even though it is in a transaction, this statement is binlogged into binlog
+--echo # file immediately.
+--disable_warnings
+CREATE TEMPORARY TABLE t3 SELECT c1 FROM t2 where 1=1;
+--enable_warnings
+--echo
+--echo # These statements will not be binlogged until the transaction is committed
+INSERT INTO t2 VALUES(11);
+INSERT INTO t2 VALUES(22);
+COMMIT;
+
+DROP TABLE t2, t3;
+SET SESSION AUTOCOMMIT= 1;
+sync_slave_with_master;
+
+
+--echo #
+--echo # Test semi-sync master will switch OFF after one transaction
+--echo # timeout waiting for slave reply.
+--echo #
+connection slave;
+source include/stop_slave.inc;
+
+connection master;
+--source include/kill_binlog_dump_threads.inc
+set global rpl_semi_sync_master_timeout= 5000;
+
+# The first semi-sync check should be on because after slave stop,
+# there are no transactions on the master.
+echo [ master status should be ON ];
+
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= ON;
+source include/wait_for_status_var.inc;
+
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 0;
+source include/wait_for_status_var.inc;
+
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+echo [ semi-sync replication of these transactions will fail ];
+insert into t1 values (500);
+
+# Wait for the semi-sync replication of this transaction to timeout
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= OFF;
+source include/wait_for_status_var.inc;
+
+# The second semi-sync check should be off because one transaction
+# times out during waiting.
+echo [ master status should be OFF ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+# Semi-sync status on master is now OFF, so all these transactions
+# will be replicated asynchronously.
+delete from t1 where a=10;
+delete from t1 where a=9;
+delete from t1 where a=8;
+delete from t1 where a=7;
+delete from t1 where a=6;
+delete from t1 where a=5;
+delete from t1 where a=4;
+delete from t1 where a=3;
+delete from t1 where a=2;
+delete from t1 where a=1;
+
+insert into t1 values (100);
+
+echo [ master status should be OFF ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Test semi-sync status on master will be ON again when slave catches up
+--echo #
+
+# Save the master position for later use.
+save_master_pos;
+
+connection slave;
+
+echo [ slave status should be OFF ];
+show status like 'Rpl_semi_sync_slave_status';
+source include/start_slave.inc;
+sync_with_master;
+
+echo [ slave status should be ON ];
+show status like 'Rpl_semi_sync_slave_status';
+
+select count(distinct a) from t1;
+select min(a) from t1;
+select max(a) from t1;
+
+connection master;
+
+# The master semi-sync status should be on again after slave catches up.
+echo [ master status should be ON again after slave catches up ];
+
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= ON;
+source include/wait_for_status_var.inc;
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+show status like 'Rpl_semi_sync_master_clients';
+
+--echo #
+--echo # Test disable/enable master semi-sync on the fly.
+--echo #
+
+drop table t1;
+sync_slave_with_master;
+
+source include/stop_slave.inc;
+
+--echo #
+--echo # Flush status
+--echo #
+connection master;
+echo [ Semi-sync master status variables before FLUSH STATUS ];
+SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
+SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
+# Do not write the FLUSH STATUS to binlog, to make sure we'll get a
+# clean status after this.
+FLUSH NO_WRITE_TO_BINLOG STATUS;
+echo [ Semi-sync master status variables after FLUSH STATUS ];
+SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
+SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
+
+connection master;
+
+source include/show_master_logs.inc;
+show variables like 'rpl_semi_sync_master_enabled';
+
+echo [ disable semi-sync on the fly ];
+set global rpl_semi_sync_master_enabled=0;
+show variables like 'rpl_semi_sync_master_enabled';
+show status like 'Rpl_semi_sync_master_status';
+
+echo [ enable semi-sync on the fly ];
+set global rpl_semi_sync_master_enabled=1;
+show variables like 'rpl_semi_sync_master_enabled';
+show status like 'Rpl_semi_sync_master_status';
+
+--echo #
+--echo # Test RESET MASTER/SLAVE
+--echo #
+
+connection slave;
+
+source include/start_slave.inc;
+
+connection master;
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1 (a int) engine = $engine_type;
+drop table t1;
+
+sync_slave_with_master;
+
+echo [ test reset master ];
+connection master;
+
+reset master;
+
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+connection slave;
+
+source include/stop_slave.inc;
+--source include/reset_slave.inc
+
+# Kill the dump thread on master for previous slave connection and
+--source include/kill_binlog_dump_threads.inc
+
+connection slave;
+source include/start_slave.inc;
+
+connection master;
+
+# Wait for dump thread to start, Rpl_semi_sync_master_clients will be
+# 1 after dump thread started.
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+
+replace_result $engine_type ENGINE_TYPE;
+eval create table t1 (a int) engine = $engine_type;
+insert into t1 values (1);
+insert into t1 values (2), (3);
+
+sync_slave_with_master;
+
+select * from t1;
+
+connection master;
+
+echo [ master semi-sync status should be ON ];
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Start semi-sync replication without SUPER privilege
+--echo #
+connection slave;
+source include/stop_slave.inc;
+--source include/reset_slave.inc
+connection master;
+reset master;
+
+# Kill the dump thread on master for previous slave connection and wait for it to exit
+--source include/kill_binlog_dump_threads.inc
+
+# Do not binlog the following statement because it will generate
+# different events for ROW and STATEMENT format
+set sql_log_bin=0;
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
+flush privileges;
+set sql_log_bin=1;
+connection slave;
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
+flush privileges;
+change master to master_user='rpl',master_password='rpl_password';
+source include/start_slave.inc;
+show status like 'Rpl_semi_sync_slave_status';
+connection master;
+
+# Wait for the semi-sync binlog dump thread to start
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+echo [ master semi-sync should be ON ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+insert into t1 values (4);
+insert into t1 values (5);
+echo [ master semi-sync should be ON ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+show status like 'Rpl_semi_sync_master_no_tx';
+show status like 'Rpl_semi_sync_master_yes_tx';
+
+--echo #
+--echo # Test semi-sync slave connect to non-semi-sync master
+--echo #
+
+# Disable semi-sync on master
+connection slave;
+source include/stop_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+connection master;
+
+# Kill the dump thread on master for previous slave connection and wait for it to exit
+--source include/kill_binlog_dump_threads.inc
+
+echo [ Semi-sync status on master should be ON ];
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 0;
+source include/wait_for_status_var.inc;
+show status like 'Rpl_semi_sync_master_status';
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= ON;
+source include/wait_for_status_var.inc;
+set global rpl_semi_sync_master_enabled= 0;
+
+connection slave;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+connection master;
+insert into t1 values (8);
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 1;
+source include/wait_for_status_var.inc;
+echo [ master semi-sync clients should be 1, status should be OFF ];
+show status like 'Rpl_semi_sync_master_clients';
+show status like 'Rpl_semi_sync_master_status';
+sync_slave_with_master;
+show status like 'Rpl_semi_sync_slave_status';
+
+# Uninstall semi-sync plugin on master
+connection slave;
+source include/stop_slave.inc;
+connection master;
+set global rpl_semi_sync_master_enabled= 0;
+
+connection slave;
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+source include/start_slave.inc;
+
+connection master;
+insert into t1 values (10);
+sync_slave_with_master;
+
+--echo #
+--echo # Test non-semi-sync slave connect to semi-sync master
+--echo #
+
+connection master;
+set global rpl_semi_sync_master_timeout= 5000; # 5s
+set global rpl_semi_sync_master_enabled= 1;
+
+connection slave;
+source include/stop_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+echo [ uninstall semi-sync slave plugin ];
+set global rpl_semi_sync_slave_enabled= 0;
+
+echo [ reinstall semi-sync slave plugin and disable semi-sync ];
+SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+source include/start_slave.inc;
+SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
+
+--echo #
+--echo # Clean up
+--echo #
+
+connection slave;
+source include/stop_slave.inc;
+set global rpl_semi_sync_slave_enabled= 0;
+
+connection master;
+set global rpl_semi_sync_master_enabled= 0;
+
+connection slave;
+change master to master_user='root',master_password='';
+source include/start_slave.inc;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+connection master;
+drop user rpl@127.0.0.1;
+flush privileges;
+set global rpl_semi_sync_master_timeout= default;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
index 7a7e1c1e074..d4df9b4041b 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
@@ -1,7 +1,7 @@
+source include/no_valgrind_without_big.inc;
source include/not_embedded.inc;
source include/have_innodb.inc;
source include/master-slave.inc;
-source include/no_valgrind_without_big.inc;
let $engine_type= InnoDB;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test
index dcff4030fdb..5eae91a55f2 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_point.test
@@ -23,8 +23,6 @@ SET @@global.rpl_semi_sync_master_wait_no_slave = 1;
--echo # It's okay to see "Killed" but we should not see "Timeout" in the log.
call mtr.add_suppression("Killed waiting for reply of binlog");
-call mtr.add_suppression("Run function 'after_commit' in plugin 'rpl_semi_sync_master' failed");
-call mtr.add_suppression("Run function 'after_sync' in plugin 'rpl_semi_sync_master' failed");
--echo #
--echo # Test wait point = AFTER_COMMIT
diff --git a/mysql-test/suite/rpl/t/rpl_skip_replication.test b/mysql-test/suite/rpl/t/rpl_skip_replication.test
index 66fdbb8915a..d1044c4bf51 100644
--- a/mysql-test/suite/rpl/t/rpl_skip_replication.test
+++ b/mysql-test/suite/rpl/t/rpl_skip_replication.test
@@ -1 +1,408 @@
---source include/rpl_skip_replication.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it.
+#
+# Usage:
+#
+# --let $use_remote_mysqlbinlog= 1 # optional
+# --source suite/rpl/include/rpl_skip_replication.inc
+#
+# The script uses MYSQLBINLOG to verify certain results.
+# By default, it uses binary logs directly. If it is undesirable,
+# this behavior can be overridden by setting $use_remote_binlog
+# as shown above.
+# The value will be unset after every execution of the script,
+# so if it is needed, it should be set explicitly before each call.
+#
+
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
+connection slave;
+# Test that SUPER is required to change @@replicate_events_marked_for_skip.
+CREATE USER 'nonsuperuser'@'127.0.0.1';
+GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE,
+ SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1';
+connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,);
+connection nonpriv;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
+disconnect nonpriv;
+connection slave;
+DROP USER'nonsuperuser'@'127.0.0.1';
+
+SELECT @@global.replicate_events_marked_for_skip;
+--error ER_SLAVE_MUST_STOP
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
+SELECT @@global.replicate_events_marked_for_skip;
+STOP SLAVE;
+--error ER_GLOBAL_VARIABLE
+SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER;
+SELECT @@global.replicate_events_marked_for_skip;
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
+SELECT @@global.replicate_events_marked_for_skip;
+START SLAVE;
+
+connection master;
+SELECT @@skip_replication;
+--error ER_LOCAL_VARIABLE
+SET GLOBAL skip_replication=1;
+SELECT @@skip_replication;
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb;
+INSERT INTO t1(a) VALUES (1);
+INSERT INTO t2(a) VALUES (1);
+
+
+# Test that master-side filtering works.
+SET skip_replication=1;
+
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
+INSERT INTO t1(a) VALUES (2);
+INSERT INTO t2(a) VALUES (2);
+
+# Inject a rotate event in the binlog stream sent to slave (otherwise we will
+# fail sync_slave_with_master as the last event on the master is not present
+# on the slave).
+FLUSH NO_WRITE_TO_BINLOG LOGS;
+
+sync_slave_with_master;
+connection slave;
+SHOW TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connection master;
+DROP TABLE t3;
+
+FLUSH NO_WRITE_TO_BINLOG LOGS;
+sync_slave_with_master;
+
+
+# Test that slave-side filtering works.
+connection slave;
+STOP SLAVE;
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
+START SLAVE;
+
+connection master;
+SET skip_replication=1;
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
+INSERT INTO t1(a) VALUES (3);
+INSERT INTO t2(a) VALUES (3);
+
+# Inject a rotate event in the binlog stream sent to slave (otherwise we will
+# fail sync_slave_with_master as the last event on the master is not present
+# on the slave).
+FLUSH NO_WRITE_TO_BINLOG LOGS;
+
+sync_slave_with_master;
+connection slave;
+SHOW TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connection master;
+DROP TABLE t3;
+
+FLUSH NO_WRITE_TO_BINLOG LOGS;
+sync_slave_with_master;
+connection slave;
+STOP SLAVE;
+SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
+START SLAVE;
+
+
+# Test that events with @@skip_replication=1 are not filtered when filtering is
+# not set on slave.
+connection master;
+SET skip_replication=1;
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam;
+INSERT INTO t3(a) VALUES(2);
+sync_slave_with_master;
+connection slave;
+SELECT * FROM t3;
+connection master;
+DROP TABLE t3;
+
+#
+# Test that the slave will preserve the @@skip_replication flag in its
+# own binlog.
+#
+
+TRUNCATE t1;
+sync_slave_with_master;
+connection slave;
+RESET MASTER;
+
+connection master;
+SET skip_replication=0;
+INSERT INTO t1 VALUES (1,0);
+SET skip_replication=1;
+INSERT INTO t1 VALUES (2,0);
+SET skip_replication=0;
+INSERT INTO t1 VALUES (3,0);
+
+sync_slave_with_master;
+connection slave;
+# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have
+# applied all events.
+SELECT * FROM t1 ORDER by a;
+
+STOP SLAVE;
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
+let $SLAVE_DATADIR= `select @@datadir`;
+
+connection master;
+TRUNCATE t1;
+
+# Now apply the slave binlog to the master, to check that both the slave
+# and mysqlbinlog will preserve the @@skip_replication flag.
+
+--let $mysqlbinlog_args= $SLAVE_DATADIR/slave-bin.000001
+if ($use_remote_mysqlbinlog)
+{
+ --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$SLAVE_MYPORT -uroot slave-bin.000001
+ --let $use_remote_mysqlbinlog= 0
+}
+--exec $MYSQL_BINLOG $mysqlbinlog_args > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog
+
+# The master should have all three events.
+SELECT * FROM t1 ORDER by a;
+
+# The slave should be missing event 2, which is marked with the
+# @@skip_replication flag.
+
+connection slave;
+START SLAVE;
+
+connection master;
+sync_slave_with_master;
+
+connection slave;
+SELECT * FROM t1 ORDER by a;
+
+#
+# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication
+# events.
+#
+
+connection master;
+TRUNCATE t1;
+
+sync_slave_with_master;
+connection slave;
+STOP SLAVE;
+# We will skip two INSERTs (in addition to any skipped due to
+# @@skip_replication). Since from 5.5 every statement is wrapped in
+# BEGIN ... END, we need to skip 6 events for this.
+SET GLOBAL sql_slave_skip_counter=6;
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
+START SLAVE;
+
+connection master;
+# Need to fix @@binlog_format to get consistent event count.
+SET @old_binlog_format= @@binlog_format;
+SET binlog_format= statement;
+SET skip_replication=0;
+INSERT INTO t1 VALUES (1,5);
+SET skip_replication=1;
+INSERT INTO t1 VALUES (2,5);
+SET skip_replication=0;
+INSERT INTO t1 VALUES (3,5);
+INSERT INTO t1 VALUES (4,5);
+SET binlog_format= @old_binlog_format;
+
+sync_slave_with_master;
+connection slave;
+
+# The slave should have skipped the first three inserts (number 1 and 3 due
+# to @@sql_slave_skip_counter=2, number 2 due to
+# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4
+# should be left.
+SELECT * FROM t1;
+
+
+#
+# Check that BINLOG statement preserves the @@skip_replication flag.
+#
+connection slave;
+# Need row @@binlog_format for BINLOG statements containing row events.
+--source include/stop_slave.inc
+SET @old_slave_binlog_format= @@global.binlog_format;
+SET GLOBAL binlog_format= row;
+--source include/start_slave.inc
+
+connection master;
+TRUNCATE t1;
+
+SET @old_binlog_format= @@binlog_format;
+SET binlog_format= row;
+# Format description log event.
+BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAA371saA==';
+# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1
+BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC
+wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA=';
+# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0
+BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC
+wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
+SET binlog_format= @old_binlog_format;
+
+SELECT * FROM t1 ORDER BY a;
+sync_slave_with_master;
+connection slave;
+# Slave should have only the second insert, the first should be ignored due to
+# the @@skip_replication flag.
+SELECT * FROM t1 ORDER by a;
+
+--source include/stop_slave.inc
+SET GLOBAL binlog_format= @old_slave_binlog_format;
+--source include/start_slave.inc
+
+
+# Test that it is not possible to change @@skip_replication inside a
+# transaction or statement, thereby replicating only parts of statements
+# or transactions.
+connection master;
+SET skip_replication=0;
+
+BEGIN;
+--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET skip_replication=0;
+--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET skip_replication=1;
+ROLLBACK;
+SET skip_replication=1;
+BEGIN;
+--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET skip_replication=0;
+--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET skip_replication=1;
+COMMIT;
+SET autocommit=0;
+INSERT INTO t2(a) VALUES(100);
+--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET skip_replication=1;
+ROLLBACK;
+SET autocommit=1;
+
+SET skip_replication=1;
+--delimiter |
+CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END|
+CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END|
+CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END|
+--delimiter ;
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SELECT foo(0);
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SELECT baz(0);
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET @a= foo(1);
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+SET @a= baz(1);
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+UPDATE t2 SET b=foo(0);
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+UPDATE t2 SET b=baz(0);
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+INSERT INTO t1 VALUES (101, foo(1));
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION
+INSERT INTO t1 VALUES (101, baz(0));
+SELECT @@skip_replication;
+CALL bar(0);
+SELECT @@skip_replication;
+CALL bar(1);
+SELECT @@skip_replication;
+DROP FUNCTION foo;
+DROP PROCEDURE bar;
+DROP FUNCTION baz;
+
+
+# Test that master-side filtering happens on the master side, and that
+# slave-side filtering happens on the slave.
+
+# First test that events do not reach the slave when master-side filtering
+# is configured. Do this by replicating first with only the IO thread running
+# and master-side filtering; then change to no filtering and start the SQL
+# thread. This should still skip the events, as master-side filtering
+# means the events never reached the slave.
+connection master;
+SET skip_replication= 0;
+TRUNCATE t1;
+sync_slave_with_master;
+connection slave;
+STOP SLAVE;
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER;
+START SLAVE IO_THREAD;
+connection master;
+SET skip_replication= 1;
+INSERT INTO t1(a) VALUES (1);
+SET skip_replication= 0;
+INSERT INTO t1(a) VALUES (2);
+--source include/save_master_pos.inc
+connection slave;
+--source include/sync_io_with_master.inc
+STOP SLAVE IO_THREAD;
+SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
+START SLAVE;
+connection master;
+sync_slave_with_master;
+connection slave;
+# Now only the second insert of (2) should be visible, as the first was
+# filtered on the master, so even though the SQL thread ran without skipping
+# events, it will never see the event in the first place.
+SELECT * FROM t1;
+
+# Now tests that when slave-side filtering is configured, events _do_ reach
+# the slave.
+connection master;
+SET skip_replication= 0;
+TRUNCATE t1;
+sync_slave_with_master;
+connection slave;
+STOP SLAVE;
+SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE;
+START SLAVE IO_THREAD;
+connection master;
+SET skip_replication= 1;
+INSERT INTO t1(a) VALUES (1);
+SET skip_replication= 0;
+INSERT INTO t1(a) VALUES (2);
+--source include/save_master_pos.inc
+connection slave;
+--source include/sync_io_with_master.inc
+STOP SLAVE IO_THREAD;
+SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
+START SLAVE;
+connection master;
+sync_slave_with_master;
+connection slave;
+# Now both inserts should be visible. Since filtering was configured to be
+# slave-side, the event is in the relay log, and when the SQL thread ran we
+# had disabled filtering again.
+SELECT * FROM t1 ORDER BY a;
+
+
+# Clean up.
+connection master;
+SET skip_replication=0;
+DROP TABLE t1,t2;
+connection slave;
+STOP SLAVE;
+SET GLOBAL replicate_events_marked_for_skip=REPLICATE;
+START SLAVE;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_special_charset.test b/mysql-test/suite/rpl/t/rpl_special_charset.test
index fa19a17b1e4..641aa483d32 100644
--- a/mysql-test/suite/rpl/t/rpl_special_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_special_charset.test
@@ -1 +1,32 @@
---source include/rpl_special_charset.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+################################################################################
+# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS
+# Problem: IO thread fails to connect to master if servers are configured with
+# special character sets like utf16, utf32, ucs2.
+#
+# Analysis: MySQL server does not support few special character sets like
+# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
+# When IO thread is trying to connect to Master, it sets server's character
+# set as client's character set. When Slave server is started with these
+# special character sets, IO thread (a connection to Master) fails because
+# of the above said reason.
+#
+# Fix: If server's character set is not supported as client's character set,
+# then set default's client character set(latin1) as client's character set.
+###############################################################################
+--source include/master-slave.inc
+call mtr.add_suppression("'utf16' can not be used as client character set");
+CREATE TABLE t1(i VARCHAR(20));
+INSERT INTO t1 VALUES (0xFFFF);
+--sync_slave_with_master
+--let diff_tables=master:t1, slave:t1
+--source include/diff_tables.inc
+# Cleanup
+--connection master
+DROP TABLE t1;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_sporadic_master.test b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
index 397756af396..ad4c44cbf74 100644
--- a/mysql-test/suite/rpl/t/rpl_sporadic_master.test
+++ b/mysql-test/suite/rpl/t/rpl_sporadic_master.test
@@ -1 +1,32 @@
---source include/rpl_sporadic_master.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+# test to see if replication can continue when master sporadically fails on
+# COM_BINLOG_DUMP and additionally limits the number of events per dump
+
+source include/master-slave.inc;
+
+create table t2(n int);
+create table t1(n int not null auto_increment primary key);
+insert into t1 values (NULL),(NULL);
+truncate table t1;
+# We have to use 4 in the following to make this test work with all table types
+insert into t1 values (4),(NULL);
+sync_slave_with_master;
+--source include/stop_slave.inc
+--source include/start_slave.inc
+connection master;
+insert into t1 values (NULL),(NULL);
+flush logs;
+truncate table t1;
+insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
+sync_slave_with_master;
+select * from t1 ORDER BY n;
+connection master;
+drop table t1,t2;
+sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_ssl.test b/mysql-test/suite/rpl/t/rpl_ssl.test
index c4a534b9294..0420a6c8c2d 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl.test
@@ -1 +1,116 @@
---source include/rpl_ssl.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+source include/no_valgrind_without_big.inc;
+source include/have_ssl_communication.inc;
+source include/master-slave.inc;
+
+# create a user for replication that requires ssl encryption
+connection master;
+create user replssl@localhost;
+grant replication slave on *.* to replssl@localhost require ssl;
+create table t1 (t int auto_increment, KEY(t));
+
+sync_slave_with_master;
+
+# Set slave to use SSL for connection to master
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to
+ master_user='replssl',
+ master_password='',
+ master_ssl=1,
+ master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+
+# Switch to master and insert one record, then sync it to slave
+connection master;
+insert into t1 values(1);
+sync_slave_with_master;
+
+# The record should now be on slave
+select * from t1;
+
+# The slave is synced and waiting/reading from master
+# SHOW SLAVE STATUS will show "Waiting for master to send event"
+let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key;
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
+
+# Stop the slave, as reported in bug#21871 it would hang
+STOP SLAVE;
+
+select * from t1;
+
+# Do the same thing a number of times
+disable_query_log;
+disable_result_log;
+# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows
+# After discussions with Engineering, I'm disabling this part of the test to avoid it causing
+# red trees.
+disable_parsing;
+let $i= 100;
+while ($i)
+{
+ start slave;
+ connection master;
+ insert into t1 values (NULL);
+ select * from t1; # Some variance
+ connection slave;
+ select * from t1; # Some variance
+ stop slave;
+ dec $i;
+}
+enable_parsing;
+START SLAVE;
+enable_query_log;
+enable_result_log;
+connection master;
+# INSERT one more record to make sure
+# the sync has something to do
+insert into t1 values (NULL);
+let $master_count= `select count(*) from t1`;
+
+sync_slave_with_master;
+--source include/wait_for_slave_to_start.inc
+source include/show_slave_status.inc;
+source include/check_slave_is_running.inc;
+
+let $slave_count= `select count(*) from t1`;
+
+if ($slave_count != $master_count)
+{
+ echo master and slave differed in number of rows;
+ echo master: $master_count;
+ echo slave: $slave_count;
+
+ connection master;
+ select count(*) t1;
+ select * from t1;
+ connection slave;
+ select count(*) t1;
+ select * from t1;
+ query_vertical show slave status;
+}
+
+connection master;
+drop user replssl@localhost;
+drop table t1;
+sync_slave_with_master;
+
+--source include/stop_slave.inc
+CHANGE MASTER TO
+ master_user = 'root',
+ master_ssl = 0,
+ master_ssl_ca = '',
+ master_ssl_cert = '',
+ master_ssl_key = '';
+
+--echo End of 5.0 tests
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test
index 619b57994c2..3809cd89e4a 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test
@@ -3,10 +3,10 @@
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
#
+-- source include/not_windows.inc
+-- source include/have_innodb.inc
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc
--- source include/have_innodb.inc
--- source include/not_windows.inc
-- let $engine=InnoDB
-- source include/rpl_lower_case_table_names.test
diff --git a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test
index b4e53358712..654a5d47cb9 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test
@@ -1 +1,107 @@
---source include/rpl_stm_relay_ign_space.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+#
+# BUG#12400313 / BUG#64503 test case
+#
+#
+# Description
+# -----------
+#
+# This test case starts the slave server with:
+# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096
+#
+# Then it issues some queries that will cause the slave to reach
+# relay-log-space-limit. We lock the table so that the SQL thread is
+# not able to purge the log and then we issue some more statements.
+#
+# The purpose is to show that the IO thread will honor the limits
+# while the SQL thread is not able to purge the relay logs, which did
+# not happen before this patch. In addition we assert that while
+# ignoring the limit (SQL thread needs to rotate before purging), the
+# IO thread does not do it in an uncontrolled manner.
+
+--source include/have_binlog_format_statement.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--disable_query_log
+CREATE TABLE t1 (c1 TEXT) engine=InnoDB;
+
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+
+--sync_slave_with_master
+
+# wait for the SQL thread to sleep
+--let $show_statement= SHOW PROCESSLIST
+--let $field= State
+--let $condition= = 'Slave has read all relay log; waiting for more updates'
+--source include/wait_show_condition.inc
+
+# now the io thread has set rli->ignore_space_limit
+# lets lock the table so that once the SQL thread awakes
+# it blocks there and does not set rli->ignore_space_limit
+# back to zero
+LOCK TABLE t1 WRITE;
+
+# now issue more statements that will overflow the
+# rli->log_space_limit (in this case ~10K)
+--connection master
+
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+
+--connection slave
+
+# ASSERT that the IO thread waits for the SQL thread to release some
+# space before continuing
+--let $show_statement= SHOW PROCESSLIST
+--let $field= State
+--let $condition= LIKE 'Waiting for %'
+# before the patch (IO would have transfered everything)
+#--let $condition= = 'Waiting for master to send event'
+# after the patch (now it waits for space to be freed)
+#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space'
+--source include/wait_show_condition.inc
+
+# without the patch we can uncomment the following two lines and
+# watch the IO thread synchronize with the master, thus writing
+# relay logs way over the space limit
+#--connection master
+#--source include/sync_slave_io_with_master.inc
+
+## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge
+--let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1)
+--let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1)
+--let $assert_text= Assert that relay log space is close to the limit
+--let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15
+--source include/assert.inc
+
+# unlock the table and let SQL thread continue applying events
+UNLOCK TABLES;
+
+--connection master
+--sync_slave_with_master
+--let $diff_tables=master:test.t1,slave:test.t1
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t1;
+--enable_query_log
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
index 2625508515b..d814a257711 100644
--- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
@@ -1 +1,633 @@
---source include/rpl_switch_stm_row_mixed.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+#
+# rpl_switch_stm_row_mixed tests covers
+#
+# - Master is switching explicitly between STATEMENT, ROW, and MIXED
+# binlog format showing when it is possible and when not.
+# - Master switching from MIXED to RBR implicitly listing all use
+# cases, e.g a query invokes SYS_GUID(), thereafter to serve as the
+# definition of MIXED binlog format
+# - correctness of execution
+
+
+-- source include/have_binlog_format_mixed_or_row.inc
+-- source include/master-slave.inc
+
+# Since this test generates row-based events in the binary log, the
+# slave SQL thread cannot be in STATEMENT mode to execute this test,
+# so we only execute it for MIXED and ROW as default value of
+# BINLOG_FORMAT.
+
+connection slave;
+
+connection master;
+--disable_warnings
+drop database if exists mysqltest1;
+create database mysqltest1;
+--enable_warnings
+use mysqltest1;
+
+# Save binlog format
+set @my_binlog_format= @@global.binlog_format;
+
+# play with switching
+set session binlog_format=mixed;
+show session variables like "binlog_format%";
+set session binlog_format=statement;
+show session variables like "binlog_format%";
+set session binlog_format=row;
+show session variables like "binlog_format%";
+
+set global binlog_format=DEFAULT;
+show global variables like "binlog_format%";
+set global binlog_format=MIXED;
+show global variables like "binlog_format%";
+set global binlog_format=STATEMENT;
+show global variables like "binlog_format%";
+set global binlog_format=ROW;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+
+CREATE TABLE t1 (a varchar(100));
+
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
+set @string="emergency_1_";
+insert into t1 values("work_2_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(SYS_GUID(),"work_3_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_4_",SYS_GUID()));
+insert into t1 select "yesterday_5_";
+
+# verify that temp tables prevent a switch to SBR
+create temporary table tmp(a char(100));
+insert into tmp values("see_6_");
+--error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
+set binlog_format=statement;
+insert into t1 select * from tmp;
+drop temporary table tmp;
+
+# Now we go to SBR
+set binlog_format=statement;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+set global binlog_format=statement;
+show global variables like "binlog_format%";
+show session variables like "binlog_format%";
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_7_";
+insert into t1 values("work_8_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_9_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values("for_10_");
+insert into t1 select "yesterday_11_";
+
+# test statement (is not default after wl#3368)
+set binlog_format=statement;
+select @@global.binlog_format, @@session.binlog_format;
+set global binlog_format=statement;
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select ?';
+set @string="emergency_12_";
+insert into t1 values("work_13_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values("work_14_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values("for_15_");
+insert into t1 select "yesterday_16_";
+
+# and now the mixed mode
+
+set global binlog_format=mixed;
+select @@global.binlog_format, @@session.binlog_format;
+set binlog_format=default;
+select @@global.binlog_format, @@session.binlog_format;
+
+prepare stmt1 from 'insert into t1 select concat(SYS_GUID(),?)';
+set @string="emergency_17_";
+insert into t1 values("work_18_");
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(SYS_GUID(),"work_19_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_20_",SYS_GUID()));
+insert into t1 select "yesterday_21_";
+
+prepare stmt1 from 'insert into t1 select ?';
+insert into t1 values(concat(SYS_GUID(),"work_22_"));
+execute stmt1 using @string;
+deallocate prepare stmt1;
+
+insert into t1 values(concat("for_23_",SYS_GUID()));
+insert into t1 select "yesterday_24_";
+
+# Test of CREATE TABLE SELECT
+
+create table t2 ENGINE=MyISAM select rpad(SYS_GUID(),100,' ');
+create table t3 select 1 union select SYS_GUID();
+--disable_warnings
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
+create table t4 select * from t1 where 3 in (select 1 union select 2 union select SYS_GUID() union select 3);
+--enable_warnings
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
+create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+# what if SYS_GUID() is first:
+--disable_warnings
+insert ignore into t5 select SYS_GUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+--enable_warnings
+
+# inside a stored procedure
+
+delimiter |;
+create procedure foo()
+begin
+insert into t1 values("work_25_");
+insert into t1 values(concat("for_26_",SYS_GUID()));
+insert into t1 select "yesterday_27_";
+end|
+create procedure foo2()
+begin
+insert into t1 values(concat("emergency_28_",SYS_GUID()));
+insert into t1 values("work_29_");
+insert into t1 values(concat("for_30_",SYS_GUID()));
+set session binlog_format=row; # accepted for stored procs
+insert into t1 values("more work_31_");
+set session binlog_format=mixed;
+end|
+create function foo3() returns bigint unsigned
+begin
+ set session binlog_format=row; # rejected for stored funcs
+ insert into t1 values("alarm");
+ return 100;
+end|
+create procedure foo4(x varchar(100))
+begin
+insert into t1 values(concat("work_250_",x));
+insert into t1 select "yesterday_270_";
+end|
+delimiter ;|
+call foo();
+call foo2();
+call foo4("hello");
+call foo4(SYS_GUID());
+call foo4("world");
+
+# test that can't SET in a stored function
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
+select foo3();
+select * from t1 where a="alarm";
+
+# Tests of stored functions/triggers/views for BUG#20930 "Mixed
+# binlogging mode does not work with stored functions, triggers,
+# views"
+
+# Function which calls procedure
+drop function foo3;
+delimiter |;
+create function foo3() returns bigint unsigned
+begin
+ insert into t1 values("foo3_32_");
+ call foo();
+ return 100;
+end|
+delimiter ;|
+insert into t2 select foo3();
+
+prepare stmt1 from 'insert into t2 select foo3()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# Test if stored function calls stored function which calls procedure
+# which requires row-based.
+
+delimiter |;
+create function foo4() returns bigint unsigned
+begin
+ insert into t2 select foo3();
+ return 100;
+end|
+delimiter ;|
+select foo4();
+
+prepare stmt1 from 'select foo4()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# A simple stored function
+delimiter |;
+create function foo5() returns bigint unsigned
+begin
+ insert into t2 select SYS_GUID();
+ return 100;
+end|
+delimiter ;|
+select foo5();
+
+prepare stmt1 from 'select foo5()';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# A simple stored function where SYS_GUID() is in the argument
+delimiter |;
+create function foo6(x varchar(100)) returns bigint unsigned
+begin
+ insert into t2 select x;
+ return 100;
+end|
+delimiter ;|
+select foo6("foo6_1_");
+select foo6(concat("foo6_2_",SYS_GUID()));
+
+prepare stmt1 from 'select foo6(concat("foo6_3_",SYS_GUID()))';
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+
+# Test of views using SYS_GUID()
+
+create view v1 as select SYS_GUID();
+create table t11 (data varchar(255));
+insert into t11 select * from v1;
+# Test of querying INFORMATION_SCHEMA which parses the view's body,
+# to verify that it binlogs statement-based (is not polluted by
+# the parsing of the view's body).
+insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
+prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
+execute stmt1;
+execute stmt1;
+deallocate prepare stmt1;
+
+# Test of triggers with SYS_GUID()
+delimiter |;
+create trigger t11_bi before insert on t11 for each row
+begin
+ set NEW.data = concat(NEW.data,SYS_GUID());
+end|
+delimiter ;|
+insert into t11 values("try_560_");
+
+# Test that INSERT DELAYED works in mixed mode (BUG#20649)
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",SYS_GUID()));
+insert delayed into t2 values("delay_6_");
+
+# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
+# replicate fine in statement-based ; we test that in mixed mode it
+# works).
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+
+# With INSERT DELAYED, rows are written to the binlog after they are
+# written to the table. Therefore, it is not enough to wait until the
+# rows make it to t2 on the master (the rows may not be in the binlog
+# at that time, and may still not be in the binlog when
+# sync_slave_with_master is later called). Instead, we wait until the
+# rows make it to t2 on the slave. We first call
+# sync_slave_with_master, so that we are sure that t2 has been created
+# on the slave.
+sync_slave_with_master;
+let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2;
+--source include/wait_condition.inc
+connection master;
+
+# If you want to do manual testing of the mixed mode regarding UDFs (not
+# testable automatically as quite platform- and compiler-dependent),
+# you just need to set the variable below to 1, and to
+# "make udf_example.so" in sql/, and to copy sql/udf_example.so to
+# MYSQL_TEST_DIR/lib/mysql.
+let $you_want_to_test_UDF=0;
+if ($you_want_to_test_UDF)
+{
+ CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
+ prepare stmt1 from 'insert into t1 select metaphon(?)';
+ set @string="emergency_133_";
+ insert into t1 values("work_134_");
+ execute stmt1 using @string;
+ deallocate prepare stmt1;
+ prepare stmt1 from 'insert into t1 select ?';
+ insert into t1 values(metaphon("work_135_"));
+ execute stmt1 using @string;
+ deallocate prepare stmt1;
+ insert into t1 values(metaphon("for_136_"));
+ insert into t1 select "yesterday_137_";
+ create table t6 select metaphon("for_138_");
+ create table t7 select 1 union select metaphon("for_139_");
+ create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3);
+ create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
+}
+
+create table t20 select * from t1; # save for comparing later
+create table t21 select * from t2;
+create table t22 select * from t3;
+drop table t1,t2,t3;
+
+# This tests the fix to
+# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog
+# We verify that under the mixed binlog mode, a stored function
+# modifying at least two tables having an auto_increment column,
+# is binlogged row-based. Indeed in statement-based binlogging,
+# only the auto_increment value generated for the first table
+# is recorded in the binlog, the value generated for the 2nd table
+# lacking.
+
+create table t1 (a int primary key auto_increment, b varchar(100));
+create table t2 (a int primary key auto_increment, b varchar(100));
+create table t3 (b varchar(100));
+delimiter |;
+create function f (x varchar(100)) returns int deterministic
+begin
+ insert into t1 values(null,x);
+ insert into t2 values(null,x);
+ return 1;
+end|
+delimiter ;|
+select f("try_41_");
+# Two operations which compensate each other except that their net
+# effect is that they advance the auto_increment counter of t2 on slave:
+sync_slave_with_master;
+use mysqltest1;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+
+connection master;
+# this is the call which didn't replicate well
+select f("try_42_");
+sync_slave_with_master;
+
+# now use prepared statement and test again, just to see that the RBB
+# mode isn't set at PREPARE but at EXECUTE.
+
+insert into t2 values(3,null),(4,null);
+delete from t2 where a>=3;
+
+connection master;
+prepare stmt1 from 'select f(?)';
+set @string="try_43_";
+insert into t1 values(null,"try_44_"); # should be SBB
+execute stmt1 using @string; # should be RBB
+deallocate prepare stmt1;
+sync_slave_with_master;
+
+# verify that if only one table has auto_inc, it does not trigger RBB
+# (we'll check in binlog further below)
+
+connection master;
+create table t12 select * from t1; # save for comparing later
+drop table t1;
+create table t1 (a int, b varchar(100), key(a));
+select f("try_45_");
+
+# restore table's key
+create table t13 select * from t1;
+drop table t1;
+create table t1 (a int primary key auto_increment, b varchar(100));
+
+# now test if it's two functions, each of them inserts in one table
+
+drop function f;
+# we need a unique key to have sorting of rows by mysqldump
+create table t14 (unique (a)) select * from t2;
+truncate table t2;
+delimiter |;
+create function f1 (x varchar(100)) returns int deterministic
+begin
+ insert into t1 values(null,x);
+ return 1;
+end|
+create function f2 (x varchar(100)) returns int deterministic
+begin
+ insert into t2 values(null,x);
+ return 1;
+end|
+delimiter ;|
+select f1("try_46_"),f2("try_47_");
+
+sync_slave_with_master;
+insert into t2 values(2,null),(3,null),(4,null);
+delete from t2 where a>=2;
+
+connection master;
+# Test with SELECT and INSERT
+select f1("try_48_"),f2("try_49_");
+insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+sync_slave_with_master;
+
+# verify that if f2 does only read on an auto_inc table, this does not
+# switch to RBB
+connection master;
+drop function f2;
+delimiter |;
+create function f2 (x varchar(100)) returns int deterministic
+begin
+ declare y int;
+ insert into t1 values(null,x);
+ set y = (select count(*) from t2);
+ return y;
+end|
+delimiter ;|
+select f1("try_53_"),f2("try_54_");
+sync_slave_with_master;
+
+# And now, a normal statement with a trigger (no stored functions)
+
+connection master;
+drop function f2;
+delimiter |;
+create trigger t1_bi before insert on t1 for each row
+begin
+ insert into t2 values(null,"try_55_");
+end|
+delimiter ;|
+insert into t1 values(null,"try_56_");
+# and now remove one auto_increment and verify SBB
+alter table t1 modify a int, drop primary key;
+insert into t1 values(null,"try_57_");
+sync_slave_with_master;
+
+# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
+# Slave used to have only 2 rows instead of 3.
+connection master;
+CREATE TEMPORARY TABLE t15 SELECT SYS_GUID();
+create table t16 like t15;
+INSERT INTO t16 SELECT * FROM t15;
+# we'll verify that this one is done RBB
+insert into t16 values("try_65_");
+drop table t15;
+# we'll verify that this one is done SBB
+insert into t16 values("try_66_");
+sync_slave_with_master;
+
+# and now compare:
+
+connection master;
+
+# first check that data on master is sensible
+select count(*) from t1;
+select count(*) from t2;
+select count(*) from t3;
+select count(*) from t4;
+select count(*) from t5;
+select count(*) from t11;
+select count(*) from t20;
+select count(*) from t21;
+select count(*) from t22;
+select count(*) from t12;
+select count(*) from t13;
+select count(*) from t14;
+select count(*) from t16;
+if ($you_want_to_test_UDF)
+{
+ select count(*) from t6;
+ select count(*) from t7;
+ select count(*) from t8;
+ select count(*) from t9;
+}
+
+sync_slave_with_master;
+
+#
+# Bug#20863 If binlog format is changed between update and unlock of
+# tables, wrong binlog
+#
+
+connection master;
+DROP TABLE IF EXISTS t11;
+SET SESSION BINLOG_FORMAT=STATEMENT;
+CREATE TABLE t11 (song VARCHAR(255));
+LOCK TABLES t11 WRITE;
+SET SESSION BINLOG_FORMAT=ROW;
+INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
+SET SESSION BINLOG_FORMAT=STATEMENT;
+INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
+UNLOCK TABLES;
+
+--query_vertical SELECT * FROM t11
+sync_slave_with_master;
+USE mysqltest1;
+--query_vertical SELECT * FROM t11
+
+connection master;
+DROP TABLE IF EXISTS t12;
+SET SESSION BINLOG_FORMAT=MIXED;
+CREATE TABLE t12 (data LONG);
+LOCK TABLES t12 WRITE;
+INSERT INTO t12 VALUES(SYS_GUID());
+UNLOCK TABLES;
+sync_slave_with_master;
+
+#
+# BUG#28086: SBR of USER() becomes corrupted on slave
+#
+
+connection master;
+
+# Just to get something that is non-trivial, albeit still simple, we
+# stuff the result of USER() and CURRENT_USER() into a variable.
+--delimiter $$
+CREATE FUNCTION my_user()
+ RETURNS CHAR(64)
+BEGIN
+ DECLARE user CHAR(64);
+ SELECT USER() INTO user;
+ RETURN user;
+END $$
+--delimiter ;
+
+--delimiter $$
+CREATE FUNCTION my_current_user()
+ RETURNS CHAR(64)
+BEGIN
+ DECLARE user CHAR(64);
+ SELECT CURRENT_USER() INTO user;
+ RETURN user;
+END $$
+--delimiter ;
+
+DROP TABLE IF EXISTS t13;
+CREATE TABLE t13 (data CHAR(64));
+INSERT INTO t13 VALUES (USER());
+INSERT INTO t13 VALUES (my_user());
+INSERT INTO t13 VALUES (CURRENT_USER());
+INSERT INTO t13 VALUES (my_current_user());
+
+sync_slave_with_master;
+
+# as we're using SYS_GUID we don't SELECT but use "diff" like in rpl_row_UUID
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
+
+# Let's compare. Note: If they match test will pass, if they do not match
+# the test will show that the diff statement failed and not reject file
+# will be created. You will need to go to the mysql-test dir and diff
+# the files your self to see what is not matching
+
+diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
+
+connection master;
+
+# Now test that mysqlbinlog works fine on a binlog generated by the
+# mixed mode
+
+# BUG#11312 "DELIMITER is not written to the binary log that causes
+# syntax error" makes that mysqlbinlog will fail if we pass it the
+# text of queries; this forces us to use --base64-output here.
+
+# BUG#20929 "BINLOG command causes invalid free plus assertion
+# failure" makes mysqld segfault when receiving --base64-output
+
+# So I can't enable this piece of test
+# SIGH
+
+if ($enable_when_11312_or_20929_fixed)
+{
+--exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
+drop database mysqltest1;
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
+# the old mysqldump output on slave is the same as what it was on
+# master before restoring on master.
+diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
+}
+
+drop database mysqltest1;
+sync_slave_with_master;
+
+connection master;
+# Restore binlog format setting
+set global binlog_format =@my_binlog_format;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test
index bdb0d8ec4cc..1e2ec2ca83b 100644
--- a/mysql-test/suite/rpl/t/rpl_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_sync.test
@@ -1,2 +1,159 @@
---source include/rpl_sync_test.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+########################################################################################
+# This test verifies the options --sync-relay-log-info and --relay-log-recovery by
+# crashing the slave in two different situations:
+# (case-1) - Corrupt the relay log with changes which were not processed by
+# the SQL Thread and crashes it.
+# (case-2) - Corrupt the master.info with wrong coordinates and crashes it.
+#
+# Case 1:
+# 1 - Stops the SQL Thread
+# 2 - Inserts new records into the master.
+# 3 - Corrupts the relay-log.bin* which most likely has such changes.
+# 4 - Crashes the slave
+# 5 - Verifies if the slave is sync with the master which means that the information
+# loss was circumvented by the recovery process.
+#
+# Case 2:
+# 1 - Stops the SQL/IO Threads
+# 2 - Inserts new records into the master.
+# 3 - Corrupts the master.info with wrong coordinates.
+# 4 - Crashes the slave
+# 5 - Verifies if the slave is sync with the master which means that the information
+# loss was circumvented by the recovery process.
+########################################################################################
+
+########################################################################################
+# Configuring the environment
+########################################################################################
+--echo =====Configuring the enviroment=======;
+--source include/not_embedded.inc
+--source include/not_valgrind.inc
+--source include/have_debug.inc
+--source include/have_innodb.inc
+--source include/not_crashrep.inc
+--source include/master-slave.inc
+
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+# Use innodb so we do not get "table should be repaired" issues.
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+flush tables;
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
+
+insert into t1(a) values(1);
+insert into t1(a) values(2);
+insert into t1(a) values(3);
+
+########################################################################################
+# Case 1: Corrupt a relay-log.bin*
+########################################################################################
+--echo =====Inserting data on the master but without the SQL Thread being running=======;
+sync_slave_with_master;
+
+connection slave;
+let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR
+--copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup
+--source include/stop_slave_sql.inc
+
+connection master;
+insert into t1(a) values(4);
+insert into t1(a) values(5);
+insert into t1(a) values(6);
+
+--echo =====Removing relay log files and crashing/recoverying the slave=======;
+connection slave;
+--source include/stop_slave_io.inc
+
+let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1);
+
+--let FILE_TO_CORRUPT= $MYSQLD_SLAVE_DATADIR/$file
+perl;
+$file= $ENV{'FILE_TO_CORRUPT'};
+open(FILE, ">$file") || die "Unable to open $file.";
+truncate(FILE,0);
+print FILE "failure";
+close ($file);
+EOF
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
+--error 2013
+FLUSH LOGS;
+
+--let $rpl_server_number= 2
+--source include/rpl_reconnect.inc
+
+--echo =====Dumping and comparing tables=======;
+--source include/start_slave.inc
+
+connection master;
+sync_slave_with_master;
+
+let $diff_tables=master:t1,slave:t1;
+source include/diff_tables.inc;
+
+########################################################################################
+# Case 2: Corrupt a master.info
+########################################################################################
+--echo =====Corrupting the master.info=======;
+connection slave;
+--source include/stop_slave.inc
+
+connection master;
+FLUSH LOGS;
+
+insert into t1(a) values(7);
+insert into t1(a) values(8);
+insert into t1(a) values(9);
+
+connection slave;
+let MYSQLD_SLAVE_DATADIR=`select @@datadir`;
+
+--perl
+use strict;
+use warnings;
+my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup";
+my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info";
+open(FILE, "<", $src) or die;
+my @content= <FILE>;
+close FILE;
+open(FILE, ">", $dst) or die;
+binmode FILE;
+print FILE @content;
+close FILE;
+EOF
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
+--error 2013
+FLUSH LOGS;
+
+--let $rpl_server_number= 2
+--source include/rpl_reconnect.inc
+
+--echo =====Dumping and comparing tables=======;
+--source include/start_slave.inc
+
+connection master;
+sync_slave_with_master;
+
+let $diff_tables=master:t1,slave:t1;
+source include/diff_tables.inc;
+
+########################################################################################
+# Clean up
+########################################################################################
+--echo =====Clean up=======;
+connection master;
+drop table t1;
+
+--remove_file $MYSQLD_SLAVE_DATADIR/master.backup
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test b/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test
index d976ae3757b..6728ff55d6f 100644
--- a/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test
+++ b/mysql-test/suite/rpl/t/rpl_temporal_format_default_to_default.test
@@ -1 +1,82 @@
---source include/rpl_temporal_format_default_to_default.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+--source include/master-slave.inc
+
+if ($force_master_mysql56_temporal_format)
+{
+ connection master;
+ eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format;
+}
+
+if ($force_slave_mysql56_temporal_format)
+{
+ connection slave;
+ eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format;
+}
+
+connection master;
+SELECT @@global.mysql56_temporal_format AS on_master;
+connection slave;
+SELECT @@global.mysql56_temporal_format AS on_slave;
+connection master;
+
+CREATE TABLE t1
+(
+ c0 TIME(0),
+ c1 TIME(1),
+ c2 TIME(2),
+ c3 TIME(3),
+ c4 TIME(4),
+ c5 TIME(5),
+ c6 TIME(6)
+);
+CREATE TABLE t2
+(
+ c0 TIMESTAMP(0),
+ c1 TIMESTAMP(1),
+ c2 TIMESTAMP(2),
+ c3 TIMESTAMP(3),
+ c4 TIMESTAMP(4),
+ c5 TIMESTAMP(5),
+ c6 TIMESTAMP(6)
+);
+
+CREATE TABLE t3
+(
+ c0 DATETIME(0),
+ c1 DATETIME(1),
+ c2 DATETIME(2),
+ c3 DATETIME(3),
+ c4 DATETIME(4),
+ c5 DATETIME(5),
+ c6 DATETIME(6)
+);
+INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
+INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
+INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
+SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
+sync_slave_with_master;
+
+connection slave;
+--query_vertical SELECT * FROM t1;
+--query_vertical SELECT * FROM t2;
+--query_vertical SELECT * FROM t3;
+SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+connection slave;
+SET @@global.mysql56_temporal_format=DEFAULT;
+connection master;
+SET @@global.mysql56_temporal_format=DEFAULT;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test
index c2517086258..9e566258882 100644
--- a/mysql-test/suite/rpl/t/rpl_typeconv.test
+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test
@@ -1 +1,78 @@
---source include/rpl_typeconv.inc
+#
+# This include file is used by more than one test suite
+# (currently rpl and binlog_encryption suite).
+# Please check all dependent tests after modifying it
+#
+
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+connection slave;
+set @saved_slave_type_conversions = @@global.slave_type_conversions;
+CREATE TABLE type_conversions (
+ TestNo INT AUTO_INCREMENT PRIMARY KEY,
+ Source TEXT,
+ Target TEXT,
+ Flags TEXT,
+ On_Master LONGTEXT,
+ On_Slave LONGTEXT,
+ Expected LONGTEXT,
+ Compare INT,
+ Error TEXT);
+
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+SELECT @@global.slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+SELECT @@global.slave_type_conversions;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY,NONEXISTING_BIT';
+SELECT @@global.slave_type_conversions;
+
+# Checking strict interpretation of type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+source suite/rpl/include/type_conversions.test;
+
+# Checking lossy integer type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+source suite/rpl/include/type_conversions.test;
+
+# Checking non-lossy integer type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
+source suite/rpl/include/type_conversions.test;
+
+# Checking all type conversions
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
+source suite/rpl/include/type_conversions.test;
+
+connection slave;
+--echo **** Result of conversions ****
+disable_query_log;
+SELECT RPAD(Source, 15, ' ') AS Source_Type,
+ RPAD(Target, 15, ' ') AS Target_Type,
+ RPAD(Flags, 25, ' ') AS All_Type_Conversion_Flags,
+ IF(Compare IS NULL AND Error IS NOT NULL, '<Correct error>',
+ IF(Compare, '<Correct value>',
+ CONCAT("'", On_Slave, "' != '", Expected, "'")))
+ AS Value_On_Slave
+ FROM type_conversions;
+enable_query_log;
+DROP TABLE type_conversions;
+
+call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+set global slave_type_conversions = @saved_slave_type_conversions;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test b/mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test
new file mode 100644
index 00000000000..8042b355754
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_xa_prepare_gtid_fail.test
@@ -0,0 +1,106 @@
+#
+# When handling the replication of an XA PREPARE, the commit phase is
+# bifurcated. First, the prepare is handled by the relevant storage engines.
+# Then second,the GTID slave state is updated as a separate autocommit
+# transaction. If the second stage fails, i.e. we are unable to update the
+# GTID slave state, then the slave should immediately quit in error, without
+# retry.
+#
+# This tests validates the above behavior by simulating a deadlock on the
+# GTID slave state table during the second part of XA PREPARE's commit, to
+# ensure that the appropriate error is reported and the transaction was never
+# retried.
+#
+#
+# References
+# MDEV-31038: Parallel Replication Breaks if XA PREPARE Fails Updating Slave
+# GTID State
+#
+source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
+source include/have_innodb.inc;
+
+--connection slave
+--source include/stop_slave.inc
+
+--let $save_par_thds= `SELECT @@global.slave_parallel_threads`
+--let $save_strict_mode= `SELECT @@global.gtid_strict_mode`
+--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout`
+
+change master to master_use_gtid=slave_pos;
+set @@global.slave_parallel_threads= 4;
+set @@global.slave_parallel_mode= optimistic;
+set @@global.gtid_strict_mode=ON;
+
+set sql_log_bin= 0;
+alter table mysql.gtid_slave_pos engine=innodb;
+call mtr.add_suppression("Deadlock found.*");
+set sql_log_bin= 1;
+--source include/start_slave.inc
+
+--connection master
+let $datadir= `select @@datadir`;
+create table t1 (a int primary key, b int) engine=innodb;
+insert t1 values (1,1);
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+set @@global.innodb_lock_wait_timeout= 1;
+
+--let $retried_tx_initial= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1)
+
+--connection master
+--let $gtid_domain_id=`SELECT @@GLOBAL.gtid_domain_id`
+--let $gtid_server_id=`SELECT @@GLOBAL.server_id`
+--let $xap_seq_no=100
+--eval set @@session.gtid_seq_no=$xap_seq_no
+xa start '1';
+update t1 set b=b+10 where a=1;
+xa end '1';
+xa prepare '1';
+--let $new_gtid= `SELECT @@global.gtid_binlog_pos`
+xa commit '1';
+--source include/save_master_gtid.inc
+
+
+--connection slave
+
+#--eval set statement sql_log_bin=0 for insert into mysql.gtid_slave_pos values ($gtid_domain_id, 5, $gtid_server_id, $xap_seq_no)
+
+--connection slave1
+BEGIN;
+--eval SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=$xap_seq_no FOR UPDATE
+
+--connection slave
+--source include/start_slave.inc
+
+--let $slave_sql_errno= 1942,1213
+--source include/wait_for_slave_sql_error.inc
+
+--let $retried_tx_test= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1)
+if ($retried_tx_initial != $retried_tx_test)
+{
+ --echo Transaction was retried when a failed XA PREPARE slave GTID update should lead to immediate slave stop without retry
+ --die Transaction was retried when a failed XA PREPARE slave GTID update should lead to immediate slave stop without retry
+}
+
+--connection slave1
+ROLLBACK;
+
+--echo # Cleanup
+
+--connection master
+drop table t1;
+
+--connection slave
+--source include/stop_slave.inc
+--eval set @@global.gtid_slave_pos= "$new_gtid"
+--eval set @@global.slave_parallel_threads= $save_par_thds
+--eval set @@global.gtid_strict_mode= $save_strict_mode
+--eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout
+--source include/start_slave.inc
+
+--source include/rpl_end.inc
+--echo # End of rpl_xa_prepare_gtid_fail.test
diff --git a/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result b/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result
new file mode 100644
index 00000000000..8563b024a75
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result
@@ -0,0 +1,36 @@
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+COUNT(@@GLOBAL.aria_log_dir_path)
+1
+SET @@GLOBAL.aria_log_dir_path=1;
+ERROR HY000: Variable 'aria_log_dir_path' is a read only variable
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+COUNT(@@GLOBAL.aria_log_dir_path)
+1
+SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='aria_log_dir_path';
+@@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
+1
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+COUNT(@@GLOBAL.aria_log_dir_path)
+1
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='aria_log_dir_path';
+COUNT(VARIABLE_VALUE)
+1
+SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path;
+@@aria_log_dir_path = @@GLOBAL.aria_log_dir_path
+1
+SELECT COUNT(@@aria_log_dir_path);
+COUNT(@@aria_log_dir_path)
+1
+SELECT COUNT(@@local.aria_log_dir_path);
+ERROR HY000: Variable 'aria_log_dir_path' is a GLOBAL variable
+SELECT COUNT(@@SESSION.aria_log_dir_path);
+ERROR HY000: Variable 'aria_log_dir_path' is a GLOBAL variable
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+COUNT(@@GLOBAL.aria_log_dir_path)
+1
+SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path;
+ERROR 42S22: Unknown column 'aria_log_dir_path' in 'field list'
diff --git a/mysql-test/suite/sys_vars/r/character_set_client_basic.result b/mysql-test/suite/sys_vars/r/character_set_client_basic.result
index d62d88027c7..14c8bcfd058 100644
--- a/mysql-test/suite/sys_vars/r/character_set_client_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_client_basic.result
@@ -500,5 +500,16 @@ res
#
SET GLOBAL character_set_client=2;
ERROR 42000: Unknown character set: '2'
+#
+# MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+#
+SET @@pseudo_slave_mode=1;
+SET character_set_client=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_client';
+Variable_name Value
+character_set_client latin2
+SET @@pseudo_slave_mode=0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_client = @global_start_value;
SET @@session.character_set_client = @session_start_value;
diff --git a/mysql-test/suite/sys_vars/r/character_set_connection_basic.result b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result
index e356d62ed2b..bbb4f4e5f75 100644
--- a/mysql-test/suite/sys_vars/r/character_set_connection_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result
@@ -494,5 +494,21 @@ SELECT @@session.character_set_connection =
WHERE VARIABLE_NAME='character_set_connection') AS res;
res
1
+#
+# MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+#
+SET character_set_connection=2/*latin2_czech_cs*/;
+ERROR 42000: Unknown character set: '2'
+SET @@pseudo_slave_mode=1;
+SET character_set_connection=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_connection';
+Variable_name Value
+character_set_connection latin2
+SHOW VARIABLES LIKE 'collation_connection';
+Variable_name Value
+collation_connection latin2_general_ci
+SET @@pseudo_slave_mode=0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_connection = @global_start_value;
SET @@global.character_set_client = @save_character_set_client;
diff --git a/mysql-test/suite/sys_vars/r/character_set_results_basic.result b/mysql-test/suite/sys_vars/r/character_set_results_basic.result
index d1c6a52ba17..1346c8b42ca 100644
--- a/mysql-test/suite/sys_vars/r/character_set_results_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_results_basic.result
Binary files differ
diff --git a/mysql-test/suite/sys_vars/r/character_set_server_basic.result b/mysql-test/suite/sys_vars/r/character_set_server_basic.result
index e0a13c729fe..7445be6aef1 100644
--- a/mysql-test/suite/sys_vars/r/character_set_server_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_server_basic.result
@@ -486,5 +486,21 @@ SELECT @@session.character_set_server =
WHERE VARIABLE_NAME='character_set_server') AS res;
res
1
+#
+# MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+#
+SET character_set_server=2/*latin2_czech_cs*/;
+ERROR 42000: Unknown character set: '2'
+SET @@pseudo_slave_mode=1;
+SET character_set_server=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_server';
+Variable_name Value
+character_set_server latin2
+SHOW VARIABLES LIKE 'collation_server';
+Variable_name Value
+collation_server latin2_general_ci
+SET @@pseudo_slave_mode=0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_server = @global_start_value;
SET @@session.character_set_server = @session_start_value;
diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
index 80bd2d7af5f..66399f61535 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
@@ -1,60 +1,60 @@
set @@global.optimizer_switch=@@optimizer_switch;
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on
set global optimizer_switch=4101;
set session optimizer_switch=2058;
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
set global optimizer_switch="index_merge_sort_union=on";
set session optimizer_switch="index_merge=off";
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+optimizer_switch index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
set session optimizer_switch="default";
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=off,not_null_range_scan=off,hash_join_cardinality=off
set optimizer_switch = replace(@@optimizer_switch, '=off', '=on');
Warnings:
Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
select @@optimizer_switch;
@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=on,hash_join_cardinality=on
set global optimizer_switch=1.1;
ERROR 42000: Incorrect argument type to variable 'optimizer_switch'
set global optimizer_switch=1e1;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result
index 8cec099d28c..181c0de74df 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_aria.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result
@@ -85,6 +85,18 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ARIA_LOG_DIR_PATH
+SESSION_VALUE NULL
+DEFAULT_VALUE DATADIR
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT Path to the directory where to store transactional log
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE
SESSION_VALUE NULL
DEFAULT_VALUE 1073741824
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index e6518f060f1..a2bf4415ba1 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -149,7 +149,7 @@ NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
-READ_ONLY NO
+READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_BUFFER_POOL_LOAD_ABORT
SESSION_VALUE NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 02658d1b365..88d3bb1789e 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -112,6 +112,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ARIA_LOG_DIR_PATH
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT Path to the directory where to store transactional log
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -665,13 +675,13 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME CORE_FILE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT write a core-file on crashes
+VARIABLE_COMMENT Write core on crashes
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
-COMMAND_LINE_ARGUMENT NULL
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME DATADIR
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
@@ -2479,7 +2489,7 @@ VARIABLE_COMMENT Fine-tune the optimizer behavior
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,default
+ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,hash_join_cardinality,default
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index d0deace1cce..a37735fa769 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -112,6 +112,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME ARIA_LOG_DIR_PATH
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT Path to the directory where to store transactional log
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
@@ -675,13 +685,13 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME CORE_FILE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT write a core-file on crashes
+VARIABLE_COMMENT Write core on crashes
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
-COMMAND_LINE_ARGUMENT NULL
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME DATADIR
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
@@ -2649,7 +2659,7 @@ VARIABLE_COMMENT Fine-tune the optimizer behavior
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,default
+ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,condition_pushdown_from_having,not_null_range_scan,hash_join_cardinality,default
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE
diff --git a/mysql-test/suite/sys_vars/t/all_vars.test b/mysql-test/suite/sys_vars/t/all_vars.test
index 06edc04d25c..41c89a4bed9 100644
--- a/mysql-test/suite/sys_vars/t/all_vars.test
+++ b/mysql-test/suite/sys_vars/t/all_vars.test
@@ -12,8 +12,6 @@ eval INSTALL PLUGIN federated SONAME "$HA_FEDERATEDX_SO";
eval INSTALL PLUGIN oqgraph SONAME "$HA_OQGRAPH_SO";
eval INSTALL PLUGIN sphinx SONAME "$HA_SPHINX_SO";
eval INSTALL PLUGIN innodb SONAME "$HA_INNODB_SO";
-eval INSTALL PLUGIN rpl_semi_sync_master SONAME "$SEMISYNC_MASTER_SO";
-eval INSTALL PLUGIN rpl_semi_sync_slave SONAME "$SEMISYNC_SLAVE_SO";
--enable_abort_on_error
--enable_result_log
--enable_query_log
diff --git a/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test
new file mode 100644
index 00000000000..f09705e6f0d
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test
@@ -0,0 +1,35 @@
+--source include/have_maria.inc
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.aria_log_dir_path=1;
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+
+
+SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='aria_log_dir_path';
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='aria_log_dir_path';
+
+
+SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path;
+
+
+SELECT COUNT(@@aria_log_dir_path);
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.aria_log_dir_path);
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.aria_log_dir_path);
+
+SELECT COUNT(@@GLOBAL.aria_log_dir_path);
+
+--Error ER_BAD_FIELD_ERROR
+SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path;
diff --git a/mysql-test/suite/sys_vars/t/character_set_client_basic.test b/mysql-test/suite/sys_vars/t/character_set_client_basic.test
index 09f758a0316..44c0d240a9d 100644
--- a/mysql-test/suite/sys_vars/t/character_set_client_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_client_basic.test
@@ -350,6 +350,15 @@ SELECT @@session.character_set_client =
--error ER_UNKNOWN_CHARACTER_SET
SET GLOBAL character_set_client=2;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+SET @@pseudo_slave_mode=1;
+SET character_set_client=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_client';
+SET @@pseudo_slave_mode=0;
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
index 3d9094fca04..46bdfcb52e2 100644
--- a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
@@ -275,6 +275,19 @@ SELECT @@session.character_set_connection =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_connection') AS res;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_connection=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_connection=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_connection';
+SHOW VARIABLES LIKE 'collation_connection';
+SET @@pseudo_slave_mode=0;
+
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_results_basic.test b/mysql-test/suite/sys_vars/t/character_set_results_basic.test
index 617332b9780..41090be6657 100644
--- a/mysql-test/suite/sys_vars/t/character_set_results_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_results_basic.test
@@ -272,6 +272,18 @@ SELECT @@session.character_set_results =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_results') AS res;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_results=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_results=2;
+SHOW VARIABLES LIKE 'character_set_results';
+SET @@pseudo_slave_mode=0;
+
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_server_basic.test b/mysql-test/suite/sys_vars/t/character_set_server_basic.test
index b2f4788fdae..929dbfaf143 100644
--- a/mysql-test/suite/sys_vars/t/character_set_server_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_server_basic.test
@@ -266,6 +266,18 @@ SELECT @@session.character_set_server =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_server') AS res;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_server=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_server=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_server';
+SHOW VARIABLES LIKE 'collation_server';
+SET @@pseudo_slave_mode=0;
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.test b/mysql-test/suite/sys_vars/t/sysvars_aria.test
index b01e39eebf5..b042f1010f4 100644
--- a/mysql-test/suite/sys_vars/t/sysvars_aria.test
+++ b/mysql-test/suite/sys_vars/t/sysvars_aria.test
@@ -2,7 +2,11 @@
--source include/have_aria_used_for_temp_tables.inc
--source include/word_size.inc
+let datadir=`select @@datadir`;
+
--vertical_results
+
+--replace_result $datadir DATADIR
select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables
where variable_name like 'aria%'
order by variable_name;
diff --git a/mysql-test/suite/sysschema/r/optimizer_switch.result b/mysql-test/suite/sysschema/r/optimizer_switch.result
index 017276fc4b8..4193bf0739e 100644
--- a/mysql-test/suite/sysschema/r/optimizer_switch.result
+++ b/mysql-test/suite/sysschema/r/optimizer_switch.result
@@ -8,6 +8,7 @@ derived_with_keys on
exists_to_in on
extended_keys on
firstmatch on
+hash_join_cardinality on
index_condition_pushdown on
index_merge on
index_merge_intersection on
diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result
index 3681b25f592..a49ec025dff 100644
--- a/mysql-test/suite/versioning/r/delete_history.result
+++ b/mysql-test/suite/versioning/r/delete_history.result
@@ -168,6 +168,8 @@ x
explain extended delete history from t1 before system_time '2039-01-01 23:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 100.00 Using where
+Warnings:
+Note 1003 delete from `test`.`t1` FOR SYSTEM_TIME BEFORE TIMESTAMP '2039-01-01 23:00' using dual where `test`.`t1`.`row_end` < '2039-01-01 23:00' and is_history(`test`.`t1`.`row_end`)
create or replace procedure p() delete history from t1 before system_time '2039-01-01 23:00';
call p;
select * from t1;
diff --git a/mysql-test/suite/versioning/r/rpl.result b/mysql-test/suite/versioning/r/rpl.result
index a6ac9aad3ca..542e52f8606 100644
--- a/mysql-test/suite/versioning/r/rpl.result
+++ b/mysql-test/suite/versioning/r/rpl.result
@@ -165,6 +165,30 @@ update t1 set i = 0;
connection slave;
connection master;
drop table t1;
+# check versioned -> versioned replication without any keys on duplicate records
+connection master;
+create table t1 (a INT) with system versioning;
+insert into t1 values (1);
+insert into t1 values (1);
+delete from t1;
+connection slave;
+include/diff_tables.inc [master:test.t1,slave:test.t1]
+connection master;
+drop table t1;
+connection slave;
+# check unversioned -> versioned replication with non-unique keys on duplicate records
+connection master;
+set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b));
+connection slave;
+set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b)) with system versioning;
+connection master;
+insert into t1 values (1,1);
+insert into t1 values (1,1);
+delete from t1;
+connection slave;
+include/diff_tables.inc [master:test.t1,slave:test.t1]
+connection master;
+drop table t1;
#
# MDEV-17554 Auto-create new partition for system versioned tables
# with history partitioned by INTERVAL/LIMIT
diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test
index 16e6af75dba..765d444f638 100644
--- a/mysql-test/suite/versioning/t/rpl.test
+++ b/mysql-test/suite/versioning/t/rpl.test
@@ -135,6 +135,40 @@ sync_slave_with_master;
connection master;
drop table t1;
+
+#
+# MDEV-30430: Enabling system versioning on tables without primary key breaks replication
+# Note that bugs are only present with row binlog format
+#
+--echo # check versioned -> versioned replication without any keys on duplicate records
+connection master;
+create table t1 (a INT) with system versioning;
+insert into t1 values (1);
+insert into t1 values (1);
+delete from t1;
+sync_slave_with_master;
+--let $diff_tables= master:test.t1,slave:test.t1
+--source include/diff_tables.inc
+connection master;
+drop table t1;
+sync_slave_with_master;
+
+--echo # check unversioned -> versioned replication with non-unique keys on duplicate records
+connection master;
+set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b));
+connection slave;
+set statement sql_log_bin=0 for create table t1 (a INT NOT NULL, b INT, INDEX(a,b)) with system versioning;
+connection master;
+insert into t1 values (1,1);
+insert into t1 values (1,1);
+delete from t1;
+sync_slave_with_master;
+--let $diff_tables= master:test.t1,slave:test.t1
+--source include/diff_tables.inc
+
+connection master;
+drop table t1;
+
--echo #
--echo # MDEV-17554 Auto-create new partition for system versioned tables
--echo # with history partitioned by INTERVAL/LIMIT