summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:39:13 +0000
commit86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch)
tree28c9e526ea739c6f9b89e36115e1e2698bddf981 /mysql-test/suite
parentReleasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff)
downloadmariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz
mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite')
-rw-r--r--mysql-test/suite/binlog/r/binlog_gis_user_var_stm.result12
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw_flush.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_show_binlog_events_invalid_offset_silent.result21
-rw-r--r--mysql-test/suite/binlog/t/binlog_gis_user_var_stm.test15
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_show_binlog_events_invalid_offset_silent.test53
-rw-r--r--mysql-test/suite/binlog/t/flashback.test16
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result2
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test3
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result2
-rw-r--r--mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test3
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_gtid_basic.result7
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result3
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.result1
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_semi_sync.result13
-rw-r--r--mysql-test/suite/compat/oracle/r/func_concat.result38
-rw-r--r--mysql-test/suite/compat/oracle/r/func_decode.result12
-rw-r--r--mysql-test/suite/compat/oracle/r/func_pad.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/func_qualified.result2547
-rw-r--r--mysql-test/suite/compat/oracle/r/func_regexp_replace.result34
-rw-r--r--mysql-test/suite/compat/oracle/r/func_replace.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/func_substr.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/func_trim.result6
-rw-r--r--mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result112
-rw-r--r--mysql-test/suite/compat/oracle/r/parser.result16
-rw-r--r--mysql-test/suite/compat/oracle/r/ps.result4
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result2
-rw-r--r--mysql-test/suite/compat/oracle/r/vcol_innodb.result54
-rw-r--r--mysql-test/suite/compat/oracle/t/column_compression.test2
-rw-r--r--mysql-test/suite/compat/oracle/t/func_qualified.test248
-rw-r--r--mysql-test/suite/compat/oracle/t/func_regexp_replace.test26
-rw-r--r--mysql-test/suite/compat/oracle/t/mysqldump_restore_func_qualified.test50
-rw-r--r--mysql-test/suite/compat/oracle/t/vcol_innodb.test47
-rw-r--r--mysql-test/suite/encryption/r/corrupted_during_recovery.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result16
-rw-r--r--mysql-test/suite/encryption/r/innodb_encryption_discard_import.result67
-rw-r--r--mysql-test/suite/encryption/r/tempfiles_encrypted.result13
-rw-r--r--mysql-test/suite/encryption/t/corrupted_during_recovery.test2
-rw-r--r--mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test12
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_discard_import.test60
-rw-r--r--mysql-test/suite/engines/funcs/r/db_use_error.result2
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_until.result4
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id1.result2
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_session_var.result11
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_slave_status.result1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id1.test2
-rw-r--r--mysql-test/suite/federated/update.result36
-rw-r--r--mysql-test/suite/federated/update.test32
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result16
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result16
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result2
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result150
-rw-r--r--mysql-test/suite/funcs_1/t/storedproc.test211
-rw-r--r--mysql-test/suite/funcs_1/views/views_master.inc9
-rw-r--r--mysql-test/suite/galera/disabled.def15
-rw-r--r--mysql-test/suite/galera/r/MDEV-22232.result27
-rw-r--r--mysql-test/suite/galera/r/MDEV-27806.result52
-rw-r--r--mysql-test/suite/galera/r/MDEV-31272.result36
-rw-r--r--mysql-test/suite/galera/r/MDEV-32549.result24
-rw-r--r--mysql-test/suite/galera/r/MDEV-32938.result21
-rw-r--r--mysql-test/suite/galera/r/MW-388.result2
-rw-r--r--mysql-test/suite/galera/r/MW-86-wait1.result4
-rw-r--r--mysql-test/suite/galera/r/MW-86-wait8.result4
-rw-r--r--mysql-test/suite/galera/r/galera_as_master.result2
-rw-r--r--mysql-test/suite/galera/r/galera_bf_lock_wait.result20
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result14
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result21
-rw-r--r--mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result21
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_autocommit.result5
-rw-r--r--mysql-test/suite/galera/r/galera_var_retry_autocommit.result5
-rw-r--r--mysql-test/suite/galera/suite.pm6
-rw-r--r--mysql-test/suite/galera/t/MDEV-22232.test72
-rw-r--r--mysql-test/suite/galera/t/MDEV-27806.opt1
-rw-r--r--mysql-test/suite/galera/t/MDEV-27806.test51
-rw-r--r--mysql-test/suite/galera/t/MDEV-27862.test3
-rw-r--r--mysql-test/suite/galera/t/MDEV-31272.combinations5
-rw-r--r--mysql-test/suite/galera/t/MDEV-31272.test58
-rw-r--r--mysql-test/suite/galera/t/MDEV-32549.test28
-rw-r--r--mysql-test/suite/galera/t/MDEV-32938.test57
-rw-r--r--mysql-test/suite/galera/t/galera_as_master.test6
-rw-r--r--mysql-test/suite/galera/t/galera_bf_lock_wait.test14
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test14
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf20
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test61
-rw-r--r--mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf17
-rw-r--r--mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test60
-rw-r--r--mysql-test/suite/galera/t/galera_log_output_csv.test4
-rw-r--r--mysql-test/suite/galera/t/galera_myisam_autocommit.test4
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache.test3
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait.test4
-rw-r--r--mysql-test/suite/galera/t/galera_restart_replica.test2
-rw-r--r--mysql-test/suite/galera_3nodes/disabled.def12
-rw-r--r--mysql-test/suite/galera_3nodes/r/MDEV-29171.result1
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result219
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_var_node_address.result (renamed from mysql-test/suite/galera/r/galera_var_node_address.result)20
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result16
-rw-r--r--mysql-test/suite/galera_3nodes/t/MDEV-29171.test12
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf35
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test346
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_var_node_address.cnf (renamed from mysql-test/suite/galera/t/galera_var_node_address.cnf)4
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_var_node_address.test (renamed from mysql-test/suite/galera/t/galera_var_node_address.test)20
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test21
-rw-r--r--mysql-test/suite/galera_3nodes_sr/disabled.def2
-rw-r--r--mysql-test/suite/galera_3nodes_sr/r/GCF-832.result2
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-336.test5
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/GCF-832.test2
-rw-r--r--mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test2
-rw-r--r--mysql-test/suite/galera_sr/disabled.def4
-rw-r--r--mysql-test/suite/galera_sr/r/MDEV-27615.result2
-rw-r--r--mysql-test/suite/galera_sr/r/MDEV-28971.result17
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_cc_master.result30
-rw-r--r--mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result16
-rw-r--r--mysql-test/suite/galera_sr/t/MDEV-27615.test3
-rw-r--r--mysql-test/suite/galera_sr/t/MDEV-28971.test20
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_cc_master.test26
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test3
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test4
-rw-r--r--mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc6
-rw-r--r--mysql-test/suite/gcol/r/gcol_bugfixes.result38
-rw-r--r--mysql-test/suite/gcol/r/gcol_partition_innodb.result5
-rw-r--r--mysql-test/suite/gcol/r/gcol_purge.result2
-rw-r--r--mysql-test/suite/gcol/r/gcol_update.result3
-rw-r--r--mysql-test/suite/gcol/r/innodb_prefix_index_check.result29
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_debug.result3
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_purge.result3
-rw-r--r--mysql-test/suite/gcol/t/gcol_bugfixes.test35
-rw-r--r--mysql-test/suite/gcol/t/gcol_partition_innodb.test7
-rw-r--r--mysql-test/suite/gcol/t/gcol_purge.test2
-rw-r--r--mysql-test/suite/gcol/t/gcol_update.test5
-rw-r--r--mysql-test/suite/gcol/t/innodb_prefix_index_check.test43
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_debug.test6
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_purge.test5
-rw-r--r--mysql-test/suite/innodb/include/crc32.pl23
-rw-r--r--mysql-test/suite/innodb/include/innodb-util.pl19
-rw-r--r--mysql-test/suite/innodb/r/add_foreign_key.result31
-rw-r--r--mysql-test/suite/innodb/r/alter_kill.result1
-rw-r--r--mysql-test/suite/innodb/r/alter_table.result14
-rw-r--r--mysql-test/suite/innodb/r/cascade_lock_wait.result76
-rw-r--r--mysql-test/suite/innodb/r/corrupted_during_recovery.result2
-rw-r--r--mysql-test/suite/innodb/r/dml_purge.result3
-rw-r--r--mysql-test/suite/innodb/r/doublewrite.result256
-rw-r--r--mysql-test/suite/innodb/r/doublewrite_debug.result94
-rw-r--r--mysql-test/suite/innodb/r/fk_col_alter.result13
-rw-r--r--mysql-test/suite/innodb/r/fk_drop_alter.result44
-rw-r--r--mysql-test/suite/innodb/r/foreign-keys.result7
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result31
-rw-r--r--mysql-test/suite/innodb/r/full_crc32_import.result3
-rw-r--r--mysql-test/suite/innodb/r/ibuf_not_empty.result1
-rw-r--r--mysql-test/suite/innodb/r/import_update_stats.result72
-rw-r--r--mysql-test/suite/innodb/r/index_length.result23
-rw-r--r--mysql-test/suite/innodb/r/index_merge_threshold.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb-16k.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb-32k.result21
-rw-r--r--mysql-test/suite/innodb/r/innodb-64k.result20
-rw-r--r--mysql-test/suite/innodb/r/innodb-ac-non-locking-select.result62
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-tempfile.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result56
-rw-r--r--mysql-test/suite/innodb/r/innodb-blob.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-debug.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online-fk.result67
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online.result31
-rw-r--r--mysql-test/suite/innodb/r/innodb-lock-inherit-read_commited.result121
-rw-r--r--mysql-test/suite/innodb/r/innodb-read-view.result41
-rw-r--r--mysql-test/suite/innodb/r/innodb-system-table-view.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb-table-online.result36
-rw-r--r--mysql-test/suite/innodb/r/innodb-truncate.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-1.result14
-rw-r--r--mysql-test/suite/innodb/r/innodb.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug12902967.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_i_s_innodb_locks.resultbin0 -> 5451 bytes
-rw-r--r--mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result90
-rw-r--r--mysql-test/suite/innodb/r/innodb_information_schema_tables.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result16
-rw-r--r--mysql-test/suite/innodb/r/innodb_scrub.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_auto_recalc.result44
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_auto_recalc_ddl.result34
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_auto_recalc_lots.result202
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_auto_recalc_on_nonexistent.result60
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_external_pages.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_fetch.result24
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_flag_global,off.rdiff34
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_flag_global.result207
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_persistent.result28
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_sample_pages.result29
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_table_flag_auto_recalc.result82
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_table_flag_sample_pages.result95
-rw-r--r--mysql-test/suite/innodb/r/innodb_ut_format_name.result5
-rw-r--r--mysql-test/suite/innodb/r/instant_alter.result3
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_bugs.result28
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_crash.result6
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff4
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_debug.result4
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_purge.result2
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_rollback.result1
-rw-r--r--mysql-test/suite/innodb/r/lock_move_wait_lock_race.result3
-rw-r--r--mysql-test/suite/innodb/r/log_file_name.result1
-rw-r--r--mysql-test/suite/innodb/r/mem_pressure.result25
-rw-r--r--mysql-test/suite/innodb/r/no_pad.result46
-rw-r--r--mysql-test/suite/innodb/r/page_id_innochecksum.result2
-rw-r--r--mysql-test/suite/innodb/r/page_reorganize.result2
-rw-r--r--mysql-test/suite/innodb/r/purge.result3
-rw-r--r--mysql-test/suite/innodb/r/purge_secondary.result4
-rw-r--r--mysql-test/suite/innodb/r/purge_thread_shutdown.result27
-rw-r--r--mysql-test/suite/innodb/r/read_only_recovery.result2
-rw-r--r--mysql-test/suite/innodb/r/records_in_range,4k.rdiff8
-rw-r--r--mysql-test/suite/innodb/r/records_in_range,8k.rdiff8
-rw-r--r--mysql-test/suite/innodb/r/records_in_range.result1275
-rw-r--r--mysql-test/suite/innodb/r/row_format_redundant.result3
-rw-r--r--mysql-test/suite/innodb/r/scrub_debug.result2
-rw-r--r--mysql-test/suite/innodb/r/table_flags.result12
-rw-r--r--mysql-test/suite/innodb/r/tablespace_per_table_not_windows.result128
-rw-r--r--mysql-test/suite/innodb/r/tablespace_per_table_windows.result48
-rw-r--r--mysql-test/suite/innodb/r/truncate_crash.result2
-rw-r--r--mysql-test/suite/innodb/r/truncate_foreign.result9
-rw-r--r--mysql-test/suite/innodb/r/trx_id_future.result2
-rw-r--r--mysql-test/suite/innodb/r/undo_log.result3
-rw-r--r--mysql-test/suite/innodb/t/add_foreign_key.test38
-rw-r--r--mysql-test/suite/innodb/t/alter_kill.test1
-rw-r--r--mysql-test/suite/innodb/t/alter_table.test15
-rw-r--r--mysql-test/suite/innodb/t/cascade_lock_wait.test45
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.test2
-rw-r--r--mysql-test/suite/innodb/t/dml_purge.test5
-rw-r--r--mysql-test/suite/innodb/t/doublewrite.test429
-rw-r--r--mysql-test/suite/innodb/t/doublewrite_debug.combinations7
-rw-r--r--mysql-test/suite/innodb/t/doublewrite_debug.test170
-rw-r--r--mysql-test/suite/innodb/t/fk_col_alter.test14
-rw-r--r--mysql-test/suite/innodb/t/fk_drop_alter.test35
-rw-r--r--mysql-test/suite/innodb/t/foreign-keys.test4
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test41
-rw-r--r--mysql-test/suite/innodb/t/full_crc32_import.test4
-rw-r--r--mysql-test/suite/innodb/t/ibuf_not_empty.test1
-rw-r--r--mysql-test/suite/innodb/t/import_update_stats.test80
-rw-r--r--mysql-test/suite/innodb/t/index_length.test23
-rw-r--r--mysql-test/suite/innodb/t/index_merge_threshold.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-16k.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-32k.test14
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k.test13
-rw-r--r--mysql-test/suite/innodb/t/innodb-ac-non-locking-select.test117
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-tempfile.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test26
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online-fk.test45
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online.test33
-rw-r--r--mysql-test/suite/innodb/t/innodb-lock-inherit-read_commited.test110
-rw-r--r--mysql-test/suite/innodb/t/innodb-read-view.test48
-rw-r--r--mysql-test/suite/innodb/t/innodb-system-table-view.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-table-online.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb-truncate.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-1.test21
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test47
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug12902967.test25
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery.test10
-rw-r--r--mysql-test/suite/innodb/t/innodb_i_s_innodb_locks.test169
-rw-r--r--mysql-test/suite/innodb/t/innodb_i_s_innodb_trx.test95
-rw-r--r--mysql-test/suite/innodb/t/innodb_information_schema_tables.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_information_schema_tables.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test14
-rw-r--r--mysql-test/suite/innodb/t/innodb_scrub.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc.test48
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.test49
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.test45
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.test88
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_external_pages.test79
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_fetch.opt7
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_fetch.test15
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_flag_global.combinations4
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_flag_global.test91
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_flag_global_analyze.inc13
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_persistent.test41
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_sample_pages.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_sample_pages.test53
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_table_flag_auto_recalc.test83
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_table_flag_sample_pages.test103
-rw-r--r--mysql-test/suite/innodb/t/innodb_ut_format_name.test17
-rw-r--r--mysql-test/suite/innodb/t/instant_alter.test4
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_bugs.test32
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_crash.test2
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_debug.test7
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_purge.test2
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_rollback.test2
-rw-r--r--mysql-test/suite/innodb/t/lock_move_wait_lock_race.test3
-rw-r--r--mysql-test/suite/innodb/t/log_file_name.test5
-rw-r--r--mysql-test/suite/innodb/t/mdev-14846.test2
-rw-r--r--mysql-test/suite/innodb/t/mem_pressure.test44
-rw-r--r--mysql-test/suite/innodb/t/no_pad.test46
-rw-r--r--mysql-test/suite/innodb/t/page_id_innochecksum.test2
-rw-r--r--mysql-test/suite/innodb/t/purge.test5
-rw-r--r--mysql-test/suite/innodb/t/purge_secondary.test7
-rw-r--r--mysql-test/suite/innodb/t/purge_thread_shutdown.test43
-rw-r--r--mysql-test/suite/innodb/t/read_only_recovery.test2
-rw-r--r--mysql-test/suite/innodb/t/records_in_range.test432
-rw-r--r--mysql-test/suite/innodb/t/row_format_redundant.opt2
-rw-r--r--mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test2
-rw-r--r--mysql-test/suite/innodb/t/scrub_debug.test2
-rw-r--r--mysql-test/suite/innodb/t/table_flags.opt1
-rw-r--r--mysql-test/suite/innodb/t/table_flags.test2
-rw-r--r--mysql-test/suite/innodb/t/tablespace_per_table_not_windows.opt1
-rw-r--r--mysql-test/suite/innodb/t/tablespace_per_table_not_windows.test162
-rw-r--r--mysql-test/suite/innodb/t/tablespace_per_table_windows.opt1
-rw-r--r--mysql-test/suite/innodb/t/tablespace_per_table_windows.test77
-rw-r--r--mysql-test/suite/innodb/t/truncate_crash.test2
-rw-r--r--mysql-test/suite/innodb/t/truncate_foreign.test10
-rw-r--r--mysql-test/suite/innodb/t/trx_id_future.test2
-rw-r--r--mysql-test/suite/innodb/t/undo_log.test5
-rw-r--r--mysql-test/suite/innodb/t/undo_space_dblwr.opt1
-rw-r--r--mysql-test/suite/innodb_fts/r/crash_recovery.result2
-rw-r--r--mysql-test/suite/innodb_fts/r/foreign_key_check.result27
-rw-r--r--mysql-test/suite/innodb_fts/r/foreign_key_update.result34
-rw-r--r--mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result2
-rw-r--r--mysql-test/suite/innodb_fts/r/index_table.result265
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result5
-rw-r--r--mysql-test/suite/innodb_fts/r/limit_union.result157
-rw-r--r--mysql-test/suite/innodb_fts/r/misc.result1878
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_1.result922
-rw-r--r--mysql-test/suite/innodb_fts/r/opt.result1654
-rw-r--r--mysql-test/suite/innodb_fts/r/phrase.result84
-rw-r--r--mysql-test/suite/innodb_fts/r/result_cache_limit.result31
-rw-r--r--mysql-test/suite/innodb_fts/r/savepoint.result318
-rw-r--r--mysql-test/suite/innodb_fts/r/subexpr.result105
-rw-r--r--mysql-test/suite/innodb_fts/t/crash_recovery.test2
-rw-r--r--mysql-test/suite/innodb_fts/t/foreign_key_check.test41
-rw-r--r--mysql-test/suite/innodb_fts/t/foreign_key_update.test34
-rw-r--r--mysql-test/suite/innodb_fts/t/index_table.opt2
-rw-r--r--mysql-test/suite/innodb_fts/t/index_table.test121
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test2
-rw-r--r--mysql-test/suite/innodb_fts/t/limit_union.test143
-rw-r--r--mysql-test/suite/innodb_fts/t/misc.test1511
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_1.test894
-rw-r--r--mysql-test/suite/innodb_fts/t/opt.opt1
-rw-r--r--mysql-test/suite/innodb_fts/t/opt.test1086
-rw-r--r--mysql-test/suite/innodb_fts/t/phrase.opt2
-rw-r--r--mysql-test/suite/innodb_fts/t/phrase.test39
-rw-r--r--mysql-test/suite/innodb_fts/t/result_cache_limit.test52
-rw-r--r--mysql-test/suite/innodb_fts/t/savepoint.test475
-rw-r--r--mysql-test/suite/innodb_fts/t/subexpr.test58
-rw-r--r--mysql-test/suite/innodb_gis/r/check_rtree.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rollback.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_add_index.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_compress.result8
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_create_inplace.result36
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_purge.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_undo.result12
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_add_index.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_compress.test6
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_create_inplace.opt1
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_create_inplace.test38
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_purge.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_undo.test4
-rw-r--r--mysql-test/suite/innodb_zip/include/innodb_dml_ops.inc82
-rw-r--r--mysql-test/suite/innodb_zip/r/blob.result2
-rw-r--r--mysql-test/suite/innodb_zip/r/innochecksum_3.result2
-rw-r--r--mysql-test/suite/innodb_zip/r/restart.result37
-rw-r--r--mysql-test/suite/innodb_zip/t/blob.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/restart.opt7
-rw-r--r--mysql-test/suite/mariabackup/backup_grants.result5
-rw-r--r--mysql-test/suite/mariabackup/backup_grants.test23
-rw-r--r--mysql-test/suite/mariabackup/full_backup.result8
-rw-r--r--mysql-test/suite/mariabackup/full_backup.test9
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff2
-rw-r--r--mysql-test/suite/mariabackup/slave_provision_nolock.cnf13
-rw-r--r--mysql-test/suite/mariabackup/slave_provision_nolock.result48
-rw-r--r--mysql-test/suite/mariabackup/slave_provision_nolock.test170
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.result3
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.test3
-rw-r--r--mysql-test/suite/multi_source/gtid_slave_pos.result3
-rw-r--r--mysql-test/suite/multi_source/gtid_slave_pos.test4
-rw-r--r--mysql-test/suite/multi_source/mdev-9544.test1
-rw-r--r--mysql-test/suite/parts/r/partition_alter_innodb.result3
-rw-r--r--mysql-test/suite/parts/r/partition_purge.result2
-rw-r--r--mysql-test/suite/parts/t/partition_alter_innodb.test3
-rw-r--r--mysql-test/suite/parts/t/partition_purge.test2
-rw-r--r--mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc6
-rw-r--r--mysql-test/suite/perfschema/r/digest_view.result50
-rw-r--r--mysql-test/suite/perfschema/r/mdl_func.result1
-rw-r--r--mysql-test/suite/perfschema/r/misc_session_status.result20
-rw-r--r--mysql-test/suite/perfschema/r/rpl_threads.result6
-rw-r--r--mysql-test/suite/perfschema/r/start_server_low_digest_sql_length.result4
-rw-r--r--mysql-test/suite/perfschema/t/mdl_func.test8
-rw-r--r--mysql-test/suite/perfschema/t/misc_session_status.test20
-rw-r--r--mysql-test/suite/perfschema/t/rpl_threads.test6
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff12
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff12
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff12
-rw-r--r--mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff12
-rw-r--r--mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff11
-rw-r--r--mysql-test/suite/plugins/r/compression.result7
-rw-r--r--mysql-test/suite/plugins/r/sql_error_log.result1
-rw-r--r--mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result41
-rw-r--r--mysql-test/suite/plugins/r/test_sql_service.result2
-rw-r--r--mysql-test/suite/plugins/t/compression.combinations5
-rw-r--r--mysql-test/suite/plugins/t/compression.test4
-rw-r--r--mysql-test/suite/plugins/t/sql_error_log_withdbinfo.opt1
-rw-r--r--mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test49
-rw-r--r--mysql-test/suite/plugins/t/test_sql_service.test8
-rw-r--r--mysql-test/suite/roles/set_default_role_for.result2
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid.result6
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid.test1
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt1
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result85
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test78
-rw-r--r--mysql-test/suite/rpl/include/mdev-31448_conservative.inc7
-rw-r--r--mysql-test/suite/rpl/include/mdev-31448_optimistic.inc7
-rw-r--r--mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc1
-rw-r--r--mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test5
-rw-r--r--mysql-test/suite/rpl/include/rpl_change_master_demote.inc11
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_29322.inc11
-rw-r--r--mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc5
-rw-r--r--mysql-test/suite/rpl/include/rpl_start_stop_slave.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_stop_middle_group.test7
-rw-r--r--mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result3
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup.result4
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup_lsu_off.result4
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result38
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result51
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master_demote.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_circular_semi_sync.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_connection.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result66
-rw-r--r--mysql-test/suite/rpl/r/rpl_delayed_slave.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_fail_register.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_gis_user_var.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_basic.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_errorlog.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result78
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_startpos.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_invoked_features.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev_17614.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_kill.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_corruption.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_idempotency.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_event.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result48
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result35
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_session_var.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_session_var2.result69
-rw-r--r--mysql-test/suite/rpl/r/rpl_set_statement_default_master.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_status.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_ssl1.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_1.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_2.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_3.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_4.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_5.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_6.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_7.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_8.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_using_gtid_default.result3
-rw-r--r--mysql-test/suite/rpl/r/semisync_future-7591.result2
-rw-r--r--mysql-test/suite/rpl/t/create_or_replace.inc7
-rw-r--r--mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test7
-rw-r--r--mysql-test/suite/rpl/t/parallel_backup_xa.inc2
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test61
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_checksum.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_semi_sync.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_connection.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test121
-rw-r--r--mysql-test/suite/rpl/t/rpl_delayed_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_fail_register.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_gis_user_var.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_basic.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_errorlog.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf28
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test109
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_startpos.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_stop_start.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev_17614.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_retry.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_corruption.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_idempotency.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test10
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_event.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf12
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test122
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test73
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var2-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var2-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var2.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_set_statement_default_master.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_ssl1.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_1.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_2.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_3.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_4.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_5.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_6.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_7.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_8.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary_errors.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_using_gtid_default.test3
-rw-r--r--mysql-test/suite/rpl/t/semisync_future-7591.test2
-rw-r--r--mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test3
-rw-r--r--mysql-test/suite/s3/amazon.result10
-rw-r--r--mysql-test/suite/s3/amazon.test18
-rw-r--r--mysql-test/suite/s3/debug.result32
-rw-r--r--mysql-test/suite/s3/debug.test34
-rw-r--r--mysql-test/suite/sql_sequence/alter.result58
-rw-r--r--mysql-test/suite/sql_sequence/alter.test45
-rw-r--r--mysql-test/suite/sys_vars/r/debug_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/old_mode_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/old_passwords_func.result6
-rw-r--r--mysql-test/suite/sys_vars/r/pseudo_slave_mode_notembedded.result14
-rw-r--r--mysql-test/suite/sys_vars/r/secure_auth_basic.result20
-rw-r--r--mysql-test/suite/sys_vars/r/secure_auth_func.result6
-rw-r--r--mysql-test/suite/sys_vars/r/secure_auth_grant.result6
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_debug.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff161
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result14
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff177
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff1465
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result16
-rw-r--r--mysql-test/suite/sys_vars/t/old_mode_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/pseudo_slave_mode_notembedded.test20
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_star.test4
-rw-r--r--mysql-test/suite/vcol/r/partition.result22
-rw-r--r--mysql-test/suite/vcol/r/vcol_keys_myisam.result37
-rw-r--r--mysql-test/suite/vcol/r/vcol_syntax.result10
-rw-r--r--mysql-test/suite/vcol/t/partition.test21
-rw-r--r--mysql-test/suite/vcol/t/vcol_keys_myisam.test29
-rw-r--r--mysql-test/suite/vcol/t/vcol_syntax.test10
-rw-r--r--mysql-test/suite/versioning/r/alter.result64
-rw-r--r--mysql-test/suite/versioning/r/delete_history.result4
-rw-r--r--mysql-test/suite/versioning/r/select.result11
-rw-r--r--mysql-test/suite/versioning/t/alter.test67
-rw-r--r--mysql-test/suite/versioning/t/delete_history.test4
-rw-r--r--mysql-test/suite/versioning/t/select.test12
-rw-r--r--mysql-test/suite/wsrep/disabled.def4
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-22443.result3
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-23092.result13
-rw-r--r--mysql-test/suite/wsrep/r/mdev_6832.result11
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result44
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-22443.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-22443.test12
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23092.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23092.test22
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.test17
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf12
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test38
606 files changed, 26188 insertions, 2144 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_gis_user_var_stm.result b/mysql-test/suite/binlog/r/binlog_gis_user_var_stm.result
new file mode 100644
index 00000000..e467c9c8
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_gis_user_var_stm.result
@@ -0,0 +1,12 @@
+SET @g0= POINT(1,1);
+SET @g1= Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)));
+CREATE TABLE t1 AS SELECT @g0 AS g0, @g1 AS g1;
+DROP TABLE t1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # User var # # @`g0`=/*point*/_binary X'000000000101000000000000000000F03F000000000000F03F' COLLATE binary
+master-bin.000001 # User var # # @`g1`=/*polygon*/_binary X'0000000001030000000100000004000000000000000000000000000000000000000000000000003E4000000000000000000000000000003E400000000000003E4000000000000000000000000000000000' COLLATE binary
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 AS SELECT @g0 AS g0, @g1 AS g1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
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 294e96e5..d6977880 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,4 @@
+RESET MASTER;
#
# MDEV-30698 Cover missing test cases for mariadb-binlog options
# --raw [and] --flashback
diff --git a/mysql-test/suite/binlog/r/binlog_show_binlog_events_invalid_offset_silent.result b/mysql-test/suite/binlog/r/binlog_show_binlog_events_invalid_offset_silent.result
new file mode 100644
index 00000000..ec86cc8e
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_show_binlog_events_invalid_offset_silent.result
@@ -0,0 +1,21 @@
+#
+# Initialize test data
+set @save_master_verify_checksum = @@global.master_verify_checksum;
+set @@global.master_verify_checksum = 1;
+create table t1 (a int);
+insert into t1 values (1);
+insert into t1 values (2);
+SHOW BINLOG EVENTS FROM invalid_pos;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
+include/assert_grep.inc [Ensure the client error is not in the server log]
+SHOW BINLOG EVENTS FROM 500;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
+include/assert_grep.inc [Ensure the client error is not in the server log]
+SHOW BINLOG EVENTS FROM 498;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
+include/assert_grep.inc [Ensure the client error is not in the server log]
+include/assert_grep.inc [Ensure there is not a specific checksum failure error]
+#
+# Cleanup
+set @@global.master_verify_checksum = @save_master_verify_checksum;
+drop table t1;
diff --git a/mysql-test/suite/binlog/t/binlog_gis_user_var_stm.test b/mysql-test/suite/binlog/t/binlog_gis_user_var_stm.test
new file mode 100644
index 00000000..7e789cd7
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_gis_user_var_stm.test
@@ -0,0 +1,15 @@
+--source include/not_embedded.inc
+--source include/have_binlog_format_statement.inc
+--source include/have_geometry.inc
+
+--disable_query_log
+reset master; # get rid of previous tests binlog
+--enable_query_log
+
+SET @g0= POINT(1,1);
+SET @g1= Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)));
+CREATE TABLE t1 AS SELECT @g0 AS g0, @g1 AS g1;
+DROP TABLE t1;
+
+--let $binlog_file = LAST
+source include/show_binlog_events.inc;
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 252a8577..539a8fe5 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw_flush.test
@@ -20,6 +20,8 @@
--source include/linux.inc
--source include/have_log_bin.inc
+# Test needs to reset the binlog as it is checking specific GTID.
+RESET MASTER;
--echo #
--echo # MDEV-30698 Cover missing test cases for mariadb-binlog options
@@ -35,7 +37,7 @@ FLUSH LOGS;
INSERT INTO t1 VALUES (1);
# Read binlog data from master to intermediary result file
---let TIMEOUT=1
+--let TIMEOUT=5
--echo # timeout TIMEOUT MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=MASTER_MYPORT --stop-never --result-file=MYSQLTEST_VARDIR/tmp/ master-bin.000001
--error 124 # Error 124 means timeout was reached
--exec timeout $TIMEOUT $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --stop-never --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001
diff --git a/mysql-test/suite/binlog/t/binlog_show_binlog_events_invalid_offset_silent.test b/mysql-test/suite/binlog/t/binlog_show_binlog_events_invalid_offset_silent.test
new file mode 100644
index 00000000..d3b31596
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_show_binlog_events_invalid_offset_silent.test
@@ -0,0 +1,53 @@
+#
+# Ensure that calling SHOW BINLOG EVENTS FROM <offset> with an invalid offset
+# will not result in error messages in the server log. That is, this call is a
+# read operation for a user, and if it fails due to invalid usage, that is not
+# a server error, but only one to report to the user.
+#
+# References:
+# MDEV-32628: Cryptic ERROR message & inconsistent behavior on incorrect
+# SHOW BINLOG EVENTS FROM ...
+#
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # Initialize test data
+set @save_master_verify_checksum = @@global.master_verify_checksum;
+set @@global.master_verify_checksum = 1;
+create table t1 (a int);
+insert into t1 values (1);
+--let $middle_binlog_pos= query_get_value(SHOW BINARY LOGS, File_size, 1)
+insert into t1 values (2);
+
+--let $assert_text= Ensure the client error is not in the server log
+--let $assert_select= Error in Log_event
+--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_count= 0
+--let $assert_only_after = CURRENT_TEST:
+
+
+# Pre MDEV-32628, this would write an event truncated error in the logs
+--let $invalid_pos= `SELECT $middle_binlog_pos - 1`
+--replace_result $invalid_pos invalid_pos
+--error 1220
+--eval SHOW BINLOG EVENTS FROM $invalid_pos
+--source include/assert_grep.inc
+
+# Pre MDEV-32628, this would write an event too big error in the logs
+--error 1220
+SHOW BINLOG EVENTS FROM 500;
+--source include/assert_grep.inc
+
+
+# Pre MDEV-32628, this would write a checksum verification failed error in the logs
+--error 1220
+SHOW BINLOG EVENTS FROM 498;
+--source include/assert_grep.inc
+--let $assert_text= Ensure there is not a specific checksum failure error
+--let $assert_select= Replication event checksum verification failed while reading from a log file
+--source include/assert_grep.inc
+
+--echo #
+--echo # Cleanup
+set @@global.master_verify_checksum = @save_master_verify_checksum;
+drop table t1;
diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test
index 7c58b56c..8daf3f43 100644
--- a/mysql-test/suite/binlog/t/flashback.test
+++ b/mysql-test/suite/binlog/t/flashback.test
@@ -1,4 +1,4 @@
---source include/have_log_bin.inc
+--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--echo #
@@ -101,7 +101,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_1.sql
--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_1.sql;"
SELECT * FROM t1;
@@ -126,7 +126,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_2.sql
--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_2.sql;"
SELECT * FROM t1;
@@ -160,7 +160,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_3.sql
--exec $MYSQL_BINLOG -B -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_3.sql;"
SELECT * FROM t1;
@@ -202,7 +202,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_4.sql
--exec $MYSQL_BINLOG -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_4.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_4.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_4.sql;"
SELECT * FROM t1;
SELECT * FROM t2;
@@ -247,7 +247,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_5.sql
--exec $MYSQL_BINLOG -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_5.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_5.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_5.sql;"
SELECT * FROM t1;
@@ -323,7 +323,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --database=world --table=city -vv $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_original_6.sql
--exec $MYSQL_BINLOG --database=world --table=city -B $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_6.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_6.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_6.sql;"
SELECT * FROM world.city;
@@ -355,7 +355,7 @@ FLUSH LOGS;
--source include/assert.inc
--exec $MYSQL_BINLOG -vv -B --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002> $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_7.sql
---exec $MYSQL -e "SET binlog_format= ROW; source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_7.sql;"
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_row_flashback_7.sql;"
--echo # 6- Rows must be present upon restoring from flashback
--let $assert_cond= COUNT(*) = 6 FROM t1
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result
index 35b44be0..903704ac 100644
--- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.result
@@ -68,7 +68,7 @@ include/wait_for_slave_io_error.inc [errno=1236]
SHOW TABLES;
Tables_in_test
table1_no_encryption
-include/stop_slave.inc
+include/stop_slave_sql.inc
include/reset_slave.inc
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test
index e05994f1..97d81d2a 100644
--- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test
+++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_coords.test
@@ -143,7 +143,8 @@ start slave;
SHOW TABLES;
--disable_connect_log
---source include/stop_slave.inc
+# IO thread is stopped, stop SQL thread only
+--source include/stop_slave_sql.inc
--enable_connect_log
--let $master_use_gtid_option= No
--source include/reset_slave.inc
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
index 16ea3055..c6835ff9 100644
--- 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
@@ -62,7 +62,7 @@ include/wait_for_slave_io_error.inc [errno=1236]
# ..success
SHOW TABLES;
Tables_in_test
-include/stop_slave.inc
+include/stop_slave_sql.inc
reset slave;
##########
# Cleanup
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
index f882e8f3..9991fb9b 100644
--- 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
@@ -132,7 +132,8 @@ if (`SELECT strcmp("$gsp","")`)
SHOW TABLES;
--disable_connect_log
---source include/stop_slave.inc
+# IO thread is stopped, wait for SQL thread to be stopped
+--source include/stop_slave_sql.inc
--enable_connect_log
reset slave;
diff --git a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
index 2bdfe0b1..fde37036 100644
--- a/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
+++ b/mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
@@ -188,6 +188,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+SET sql_log_bin= 0;
+CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
+SELECT BINLOG_GTID_POS(@binlog_file, 4);
+BINLOG_GTID_POS(@binlog_file, 4)
+NULL
+DROP TABLE t1;
+SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc
diff --git a/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result
index e94e097f..dbaceb65 100644
--- a/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result
+++ b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result
@@ -197,7 +197,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result
index ce11b814..57654d15 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result
@@ -36,7 +36,8 @@ connection server_2;
connection con_temp2;
COMMIT;
connection server_2;
-include/stop_slave.inc
+include/wait_for_slave_sql_error.inc [errno=1062]
+include/stop_slave_io.inc
include/assert.inc [table t1 should have zero rows where a>32]
SELECT * FROM t1 WHERE a>32;
a
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.result b/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.result
index e9d04c02..c9094c8b 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.result
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.result
@@ -38,7 +38,6 @@ connection con2;
SET debug_sync='RESET';
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
-include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
a b
110 1
diff --git a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result
index edd5e774..03e3443b 100644
--- a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result
+++ b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result
@@ -7,7 +7,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
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;
@@ -28,7 +27,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -163,11 +162,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -317,6 +320,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -359,6 +364,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/compat/oracle/r/func_concat.result b/mysql-test/suite/compat/oracle/r/func_concat.result
index 392d5797..17ca4be0 100644
--- a/mysql-test/suite/compat/oracle/r/func_concat.result
+++ b/mysql-test/suite/compat/oracle/r/func_concat.result
@@ -3,12 +3,12 @@ EXPLAIN EXTENDED SELECT 'a'||'b'||'c';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(concat_operator_oracle('a','b'),'c') AS "'a'||'b'||'c'"
+Note 1003 select concat(concat('a','b'),'c') AS "'a'||'b'||'c'"
EXPLAIN EXTENDED SELECT CONCAT('a'||'b'||'c');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(concat_operator_oracle(concat_operator_oracle('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
+Note 1003 select concat(concat(concat('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
SELECT '' || '';
'' || ''
@@ -211,14 +211,14 @@ SET sql_mode=ORACLE;
CREATE VIEW v1 AS SELECT 'foo'||NULL||'bar' AS test;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select concat(concat('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
SELECT * FROM v1;
test
foobar
SET sql_mode=DEFAULT;
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 concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select oracle_schema.concat(oracle_schema.concat('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
SELECT * FROM v1;
test
foobar
@@ -234,7 +234,7 @@ NULL
SET sql_mode=ORACLE;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select mariadb_schema.concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
SELECT * FROM v1;
test
NULL
@@ -268,12 +268,12 @@ EXPLAIN EXTENDED SELECT -1<<1||1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select -1 << concat_operator_oracle(1,1) AS "a"
+Note 1003 select -1 << concat(1,1) AS "a"
EXPLAIN EXTENDED SELECT -1||0<<1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(-1,0) << 1 AS "a"
+Note 1003 select concat(-1,0) << 1 AS "a"
SELECT -1+1||1 AS a FROM DUAL;
a
01
@@ -284,12 +284,12 @@ EXPLAIN EXTENDED SELECT -1+1||1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(-1 + 1,1) AS "a"
+Note 1003 select concat(-1 + 1,1) AS "a"
EXPLAIN EXTENDED SELECT -1||0+1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(-1,0) + 1 AS "a"
+Note 1003 select concat(-1,0) + 1 AS "a"
SELECT 1*1||-1 AS a FROM DUAL;
a
1-1
@@ -300,12 +300,12 @@ EXPLAIN EXTENDED SELECT 1*1||-1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(1 * 1,-1) AS "a"
+Note 1003 select concat(1 * 1,-1) AS "a"
EXPLAIN EXTENDED SELECT 1||1*-1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(1,1 * -1) AS "a"
+Note 1003 select concat(1,1 * -1) AS "a"
SELECT -1^1||1 AS a FROM DUAL;
a
184467440737095516141
@@ -316,12 +316,12 @@ EXPLAIN EXTENDED SELECT -1^1||1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(-1 ^ 1,1) AS "a"
+Note 1003 select concat(-1 ^ 1,1) AS "a"
EXPLAIN EXTENDED SELECT -1||0^1 AS a FROM DUAL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select concat_operator_oracle(-1,0 ^ 1) AS "a"
+Note 1003 select concat(-1,0 ^ 1) AS "a"
#
# MDEV-17359 Concatenation operator || in like expression failed in sql_mode=ORACLE
#
@@ -332,7 +332,7 @@ EXPLAIN EXTENDED SELECT 'abc' LIKE '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 No tables used
Warnings:
-Note 1003 select 'abc' like concat_operator_oracle('a','%') AS "'abc' LIKE 'a'||'%'"
+Note 1003 select 'abc' like concat('a','%') AS "'abc' LIKE 'a'||'%'"
SELECT 'x' FROM DUAL WHERE 11 LIKE 1||1;
x
x
@@ -353,7 +353,7 @@ EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord;
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; Using filesort
Warnings:
-Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like <cache>(concat_operator_oracle('%','b')) order by "test"."t1"."ord"
+Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like <cache>(concat('%','b')) order by "test"."t1"."ord"
SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
c1
abc
@@ -361,7 +361,7 @@ EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord;
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; Using filesort
Warnings:
-Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat_operator_oracle(concat_operator_oracle("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
+Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat(concat("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord"
SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
x
x
@@ -369,7 +369,7 @@ EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%';
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 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like 'aa%'
+Note 1003 select 'x' AS "x" from "test"."t1" where concat("test"."t1"."c1","test"."t1"."c2") like 'aa%'
SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
x
x
@@ -377,7 +377,7 @@ EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1;
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 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like concat_operator_oracle("test"."t1"."c2","test"."t1"."c1")
+Note 1003 select 'x' AS "x" from "test"."t1" where concat("test"."t1"."c1","test"."t1"."c2") like concat("test"."t1"."c2","test"."t1"."c1")
CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord;
SELECT * FROM v1;
c1 c2 c1 LIKE c2||'_'
@@ -388,6 +388,6 @@ EXPLAIN EXTENDED SELECT * FROM v1;
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 filesort
Warnings:
-Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat_operator_oracle("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from "test"."t1" order by "test"."t1"."ord"
+Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from "test"."t1" order by "test"."t1"."ord"
DROP VIEW v1;
DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/r/func_decode.result b/mysql-test/suite/compat/oracle/r/func_decode.result
index 2809e971..afbba204 100644
--- a/mysql-test/suite/compat/oracle/r/func_decode.result
+++ b/mysql-test/suite/compat/oracle/r/func_decode.result
@@ -28,7 +28,7 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
+Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
CREATE TABLE decode (decode int);
DROP TABLE decode;
#
@@ -46,22 +46,22 @@ EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select decode_oracle(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
+Note 1003 select decode(12,10,'x10',11,'x11') AS "DECODE(12,10,'x10',11,'x11')"
EXPLAIN EXTENDED SELECT DECODE(12,10,'x10',11,'x11','def');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
+Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE(12,10,'x10',11,'x11','def')"
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select decode_oracle(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
+Note 1003 select decode(12,10,'x10',11,'x11') AS "DECODE_ORACLE(12,10,'x10',11,'x11')"
EXPLAIN EXTENDED SELECT DECODE_ORACLE(12,10,'x10',11,'x11','def');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select decode_oracle(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
+Note 1003 select decode(12,10,'x10',11,'x11','def') AS "DECODE_ORACLE(12,10,'x10',11,'x11','def')"
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS
SELECT
@@ -72,7 +72,7 @@ DECODE_ORACLE(a,1,'x1',NULL,'xNULL','xELSE') AS d4
FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode_oracle("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode_oracle("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select decode("t1"."a",1,'x1',NULL,'xNULL') AS "d1",decode("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d2",decode("t1"."a",1,'x1',NULL,'xNULL') AS "d3",decode("t1"."a",1,'x1',NULL,'xNULL','xELSE') AS "d4" from "t1" latin1 latin1_swedish_ci
DROP VIEW v1;
DROP TABLE t1;
SELECT DECODE(TIME'10:20:31','10:20:31','then1','10:20:32','then2','def');
diff --git a/mysql-test/suite/compat/oracle/r/func_pad.result b/mysql-test/suite/compat/oracle/r/func_pad.result
index ca7d52cd..63952959 100644
--- a/mysql-test/suite/compat/oracle/r/func_pad.result
+++ b/mysql-test/suite/compat/oracle/r/func_pad.result
@@ -44,11 +44,11 @@ EXPLAIN EXTENDED SELECT RPAD('a',0,'.'), LPAD('a',0,'.'), LPAD(c1,c2,c3), LPAD(c
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using filesort
Warnings:
-Note 1003 select rpad_oracle('a',0,'.') AS "RPAD('a',0,'.')",lpad_oracle('a',0,'.') AS "LPAD('a',0,'.')",lpad_oracle("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "LPAD(c1,c2,c3)",lpad_oracle("test"."t1"."c1","test"."t1"."c2") AS "LPAD(c1,c2)",rpad_oracle("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "RPAD(c1,c2,c3)",rpad_oracle("test"."t1"."c1","test"."t1"."c2") AS "RPAD(c1,c2)" from "test"."t1" order by "test"."t1"."ord"
+Note 1003 select rpad('a',0,'.') AS "RPAD('a',0,'.')",lpad('a',0,'.') AS "LPAD('a',0,'.')",lpad("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "LPAD(c1,c2,c3)",lpad("test"."t1"."c1","test"."t1"."c2") AS "LPAD(c1,c2)",rpad("test"."t1"."c1","test"."t1"."c2","test"."t1"."c3") AS "RPAD(c1,c2,c3)",rpad("test"."t1"."c1","test"."t1"."c2") AS "RPAD(c1,c2)" from "test"."t1" order by "test"."t1"."ord"
CREATE VIEW v1 AS SELECT RPAD('a',0,'.') AS "C1", LPAD('a',0,'.') AS "C2", LPAD(c1,c2,c3) AS "C3", LPAD(c1,c2) AS "C4", RPAD(c1,c2,c3) AS "C5", RPAD(c1,c2) AS "C6" FROM t1 ORDER BY ord;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select rpad_oracle('a',0,'.') AS "C1",lpad_oracle('a',0,'.') AS "C2",lpad_oracle("t1"."c1","t1"."c2","t1"."c3") AS "C3",lpad_oracle("t1"."c1","t1"."c2") AS "C4",rpad_oracle("t1"."c1","t1"."c2","t1"."c3") AS "C5",rpad_oracle("t1"."c1","t1"."c2") AS "C6" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select rpad('a',0,'.') AS "C1",lpad('a',0,'.') AS "C2",lpad("t1"."c1","t1"."c2","t1"."c3") AS "C3",lpad("t1"."c1","t1"."c2") AS "C4",rpad("t1"."c1","t1"."c2","t1"."c3") AS "C5",rpad("t1"."c1","t1"."c2") AS "C6" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
SELECT * FROM v1;
C1 C2 C3 C4 C5 C6
NULL NULL NULL a NULL a
diff --git a/mysql-test/suite/compat/oracle/r/func_qualified.result b/mysql-test/suite/compat/oracle/r/func_qualified.result
new file mode 100644
index 00000000..4750a625
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/func_qualified.result
@@ -0,0 +1,2547 @@
+#
+# MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE
+#
+SET sql_mode=DEFAULT;
+SELECT decode_oracle(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'decode_oracle'
+SELECT DECODE_ORACLE(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE_ORACLE'
+SET sql_mode=ORACLE;
+SELECT decode_oracle(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'decode_oracle'
+SELECT DECODE_ORACLE(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE_ORACLE'
+SET sql_mode=DEFAULT;
+SELECT decode(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'decode'
+SELECT DECODE(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
+SET sql_mode=ORACLE;
+SELECT decode(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'decode'
+SELECT DECODE(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
+SELECT mariadb_schema.decode(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'decode'
+SELECT mariadb_schema.DECODE(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
+SELECT mariadb_schema.decode_oracle(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'decode_oracle'
+SELECT mariadb_schema.DECODE_ORACLE(1);
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE_ORACLE'
+SET sql_mode=DEFAULT;
+SELECT unknown.TRIM(1);
+ERROR 42000: FUNCTION unknown.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT unknown.trim(1);
+ERROR 42000: FUNCTION unknown.trim does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT oracle_schema.TRIM();
+ERROR HY000: Function 'TRIM' is not defined
+SELECT oracle_schema.TRIM('a','b');
+ERROR HY000: Function 'TRIM' is not defined
+SELECT oracle_schema.TRIM('a','b','c','d');
+ERROR HY000: Function 'TRIM' is not defined
+SELECT unknown.SUBSTR('a',1,2);
+ERROR 42000: FUNCTION unknown.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT unknown.substr('a',1,2);
+ERROR 42000: FUNCTION unknown.substr does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT unknown.SUBSTRING('a',1,2);
+ERROR 42000: FUNCTION unknown.SUBSTRING does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT unknown.substring('a',1,2);
+ERROR 42000: FUNCTION unknown.substring does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT unknown.REPLACE('a','b','c');
+ERROR 42000: FUNCTION unknown.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT unknown.replace('a','b','c');
+ERROR 42000: FUNCTION unknown.replace does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT oracle_schema.REPLACE();
+ERROR HY000: Function 'REPLACE' is not defined
+SELECT oracle_schema.REPLACE('a');
+ERROR HY000: Function 'REPLACE' is not defined
+SELECT oracle_schema.REPLACE('a','b');
+ERROR HY000: Function 'REPLACE' is not defined
+SELECT oracle_schema.REPLACE('a','b','c','d');
+ERROR HY000: Function 'REPLACE' is not defined
+SET sql_mode=DEFAULT;
+CREATE PROCEDURE p1(sqlmode TEXT, qualifier TEXT, expr TEXT)
+BEGIN
+DECLARE query TEXT DEFAULT 'SELECT $(QUALIFIER)$(EXPR)';
+DECLARE errmsg TEXT DEFAULT NULL;
+DECLARE CONTINUE HANDLER FOR 1064, 1128, 1305, 1582, 1630
+BEGIN
+GET DIAGNOSTICS CONDITION 1 errmsg = MESSAGE_TEXT;
+END;
+SET sql_mode=sqlmode;
+SET query=REPLACE(query, '$(QUALIFIER)', qualifier);
+SET query=REPLACE(query, '$(EXPR)', expr);
+SET query= CONCAT('EXPLAIN EXTENDED ', query);
+SELECT CONCAT('sql_mode=''',sqlmode,'''', ' ',
+'qualifier=''',qualifier,'''') AS `----------`;
+SELECT query;
+EXECUTE IMMEDIATE query;
+IF errmsg IS NOT NULL THEN
+SELECT CONCAT('ERROR: ', errmsg) AS errmsg;
+ELSE
+SHOW WARNINGS;
+END IF;
+END;
+$$
+CREATE PROCEDURE p2(sqlmode TEXT, expr TEXT)
+BEGIN
+CALL p1(sqlmode, '', expr);
+CALL p1(sqlmode, 'unknown_schema.', expr);
+CALL p1(sqlmode, 'mariadb_schema.', expr);
+CALL p1(sqlmode, 'maxdb_schema.', expr);
+CALL p1(sqlmode, 'oracle_schema.', expr);
+END;
+$$
+CREATE PROCEDURE p3(expr TEXT)
+BEGIN
+CALL p2('', expr);
+CALL p2('ORACLE', expr);
+END;
+$$
+CALL p3('CONCAT(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT CONCAT('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS `CONCAT('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.CONCAT('a')
+errmsg
+ERROR: FUNCTION unknown_schema.CONCAT does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.CONCAT('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS `mariadb_schema.CONCAT('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.CONCAT('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS `maxdb_schema.CONCAT('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.CONCAT('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.concat('a') AS `oracle_schema.CONCAT('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT CONCAT('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS "CONCAT('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.CONCAT('a')
+errmsg
+ERROR: FUNCTION unknown_schema.CONCAT does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.CONCAT('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.concat('a') AS "mariadb_schema.CONCAT('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.CONCAT('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.concat('a') AS "maxdb_schema.CONCAT('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.CONCAT('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS "oracle_schema.CONCAT('a')"
+Warnings:
+Note 1003 select concat('a') AS "oracle_schema.CONCAT('a')"
+CALL p3('DECODE(''1'',''2'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT DECODE('1','2')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode('1','2') AS `DECODE('1','2')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.DECODE('1','2')
+errmsg
+ERROR: FUNCTION unknown_schema.DECODE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.DECODE('1','2')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode('1','2') AS `mariadb_schema.DECODE('1','2')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.DECODE('1','2')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode('1','2') AS `maxdb_schema.DECODE('1','2')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.DECODE('1','2')
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT DECODE('1','2')
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.DECODE('1','2')
+errmsg
+ERROR: FUNCTION unknown_schema.DECODE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.DECODE('1','2')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.decode('1','2') AS "mariadb_schema.DECODE('1','2')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.DECODE('1','2')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.decode('1','2') AS "maxdb_schema.DECODE('1','2')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.DECODE('1','2')
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+CALL p3('DECODE(1,1,10)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT DECODE(1,1,10)
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.DECODE(1,1,10)
+errmsg
+ERROR: FUNCTION unknown_schema.DECODE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.DECODE(1,1,10)
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.DECODE(1,1,10)
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.DECODE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.decode(1,1,10) AS `oracle_schema.DECODE(1,1,10)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT DECODE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode(1,1,10) AS "DECODE(1,1,10)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.DECODE(1,1,10)
+errmsg
+ERROR: FUNCTION unknown_schema.DECODE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.DECODE(1,1,10)
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.DECODE(1,1,10)
+errmsg
+ERROR: Incorrect parameter count in the call to native function 'DECODE'
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.DECODE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode(1,1,10) AS "oracle_schema.DECODE(1,1,10)"
+Warnings:
+Note 1003 select decode(1,1,10) AS "oracle_schema.DECODE(1,1,10)"
+CALL p3('LTRIM(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LTRIM('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS `LTRIM('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LTRIM('a')
+errmsg
+ERROR: FUNCTION unknown_schema.LTRIM does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LTRIM('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS `mariadb_schema.LTRIM('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LTRIM('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS `maxdb_schema.LTRIM('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LTRIM('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.ltrim('a') AS `oracle_schema.LTRIM('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LTRIM('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS "LTRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LTRIM('a')
+errmsg
+ERROR: FUNCTION unknown_schema.LTRIM does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LTRIM('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.ltrim('a') AS "mariadb_schema.LTRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LTRIM('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.ltrim('a') AS "maxdb_schema.LTRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LTRIM('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS "oracle_schema.LTRIM('a')"
+Warnings:
+Note 1003 select ltrim('a') AS "oracle_schema.LTRIM('a')"
+CALL p3('RTRIM(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RTRIM('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS `RTRIM('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RTRIM('a')
+errmsg
+ERROR: FUNCTION unknown_schema.RTRIM does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RTRIM('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS `mariadb_schema.RTRIM('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RTRIM('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS `maxdb_schema.RTRIM('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RTRIM('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.rtrim('a') AS `oracle_schema.RTRIM('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RTRIM('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS "RTRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RTRIM('a')
+errmsg
+ERROR: FUNCTION unknown_schema.RTRIM does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RTRIM('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.rtrim('a') AS "mariadb_schema.RTRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RTRIM('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.rtrim('a') AS "maxdb_schema.RTRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RTRIM('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS "oracle_schema.RTRIM('a')"
+Warnings:
+Note 1003 select rtrim('a') AS "oracle_schema.RTRIM('a')"
+CALL p3('LPAD(''a'',3)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS `LPAD('a',3)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LPAD('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.LPAD does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS `mariadb_schema.LPAD('a',3)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS `maxdb_schema.LPAD('a',3)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.lpad('a',3) AS `oracle_schema.LPAD('a',3)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS "LPAD('a',3)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LPAD('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.LPAD does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.lpad('a',3) AS "mariadb_schema.LPAD('a',3)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.lpad('a',3) AS "maxdb_schema.LPAD('a',3)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS "oracle_schema.LPAD('a',3)"
+Warnings:
+Note 1003 select lpad('a',3) AS "oracle_schema.LPAD('a',3)"
+CALL p3('LPAD(''a'',3, '' '')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3,' ') AS `LPAD('a',3, ' ')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LPAD('a',3, ' ')
+errmsg
+ERROR: FUNCTION unknown_schema.LPAD does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3,' ') AS `mariadb_schema.LPAD('a',3, ' ')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3,' ') AS `maxdb_schema.LPAD('a',3, ' ')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.lpad('a',3,' ') AS `oracle_schema.LPAD('a',3, ' ')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3,' ') AS "LPAD('a',3, ' ')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LPAD('a',3, ' ')
+errmsg
+ERROR: FUNCTION unknown_schema.LPAD does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.lpad('a',3,' ') AS "mariadb_schema.LPAD('a',3, ' ')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.lpad('a',3,' ') AS "maxdb_schema.LPAD('a',3, ' ')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3,' ') AS "oracle_schema.LPAD('a',3, ' ')"
+Warnings:
+Note 1003 select lpad('a',3,' ') AS "oracle_schema.LPAD('a',3, ' ')"
+CALL p3('RPAD(''a'',3)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS `RPAD('a',3)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RPAD('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.RPAD does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS `mariadb_schema.RPAD('a',3)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS `maxdb_schema.RPAD('a',3)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.rpad('a',3) AS `oracle_schema.RPAD('a',3)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS "RPAD('a',3)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RPAD('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.RPAD does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.rpad('a',3) AS "mariadb_schema.RPAD('a',3)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.rpad('a',3) AS "maxdb_schema.RPAD('a',3)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RPAD('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS "oracle_schema.RPAD('a',3)"
+Warnings:
+Note 1003 select rpad('a',3) AS "oracle_schema.RPAD('a',3)"
+CALL p3('RPAD(''a'',3, '' '')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3,' ') AS `RPAD('a',3, ' ')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RPAD('a',3, ' ')
+errmsg
+ERROR: FUNCTION unknown_schema.RPAD does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3,' ') AS `mariadb_schema.RPAD('a',3, ' ')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3,' ') AS `maxdb_schema.RPAD('a',3, ' ')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.rpad('a',3,' ') AS `oracle_schema.RPAD('a',3, ' ')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3,' ') AS "RPAD('a',3, ' ')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RPAD('a',3, ' ')
+errmsg
+ERROR: FUNCTION unknown_schema.RPAD does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.rpad('a',3,' ') AS "mariadb_schema.RPAD('a',3, ' ')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.rpad('a',3,' ') AS "maxdb_schema.RPAD('a',3, ' ')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RPAD('a',3, ' ')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3,' ') AS "oracle_schema.RPAD('a',3, ' ')"
+Warnings:
+Note 1003 select rpad('a',3,' ') AS "oracle_schema.RPAD('a',3, ' ')"
+CALL p3('REPLACE()');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE()
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE()
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE()
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE()
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE()
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE()
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE()
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE()
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE()
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE()
+errmsg
+ERROR: Function 'REPLACE' is not defined
+CALL p3('REPLACE(''a'',''b'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE('a','b')
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE('a','b')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE('a','b')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE('a','b')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE('a','b')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE('a','b')
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE('a','b')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE('a','b')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE('a','b')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE('a','b')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+CALL p3('REPLACE(''a'',''b'',''c'',''d'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE('a','b','c','d')
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''d')' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE('a','b','c','d')
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''d')' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE('a','b','c','d')
+errmsg
+ERROR: Function 'REPLACE' is not defined
+CALL p3('REPLACE(''a'',''b'',''c'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS `REPLACE('a','b','c')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE('a','b','c')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS `mariadb_schema.REPLACE('a','b','c')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS `maxdb_schema.REPLACE('a','b','c')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.replace('a','b','c') AS `oracle_schema.REPLACE('a','b','c')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS "REPLACE('a','b','c')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE('a','b','c')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.replace('a','b','c') AS "mariadb_schema.REPLACE('a','b','c')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.replace('a','b','c') AS "maxdb_schema.REPLACE('a','b','c')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS "oracle_schema.REPLACE('a','b','c')"
+Warnings:
+Note 1003 select replace('a','b','c') AS "oracle_schema.REPLACE('a','b','c')"
+CALL p3('SUBSTR()');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR()
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR()
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR()
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR()
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR()
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR()
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR()
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR()
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR()
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR()
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+CALL p3('SUBSTR(''a'',1,2,3)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR('a',1,2,3)
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '3)' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR('a',1,2,3)
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '3)' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR('a',1,2,3)
+errmsg
+ERROR: Function 'SUBSTR' is not defined
+CALL p3('SUBSTR(''a'',1,2)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS `SUBSTR('a',1,2)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR('a',1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS `mariadb_schema.SUBSTR('a',1,2)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS `maxdb_schema.SUBSTR('a',1,2)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1,2) AS `oracle_schema.SUBSTR('a',1,2)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "SUBSTR('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR('a',1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1,2) AS "mariadb_schema.SUBSTR('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1,2) AS "maxdb_schema.SUBSTR('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "oracle_schema.SUBSTR('a',1,2)"
+Warnings:
+Note 1003 select substr('a',1,2) AS "oracle_schema.SUBSTR('a',1,2)"
+CALL p3('SUBSTR(''a'' FROM 1)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS `SUBSTR('a' FROM 1)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR('a' FROM 1)
+errmsg
+ERROR: Function 'unknown_schema.SUBSTR' is not defined
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS `mariadb_schema.SUBSTR('a' FROM 1)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS `maxdb_schema.SUBSTR('a' FROM 1)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1) AS `oracle_schema.SUBSTR('a' FROM 1)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS "SUBSTR('a' FROM 1)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR('a' FROM 1)
+errmsg
+ERROR: Function 'unknown_schema.SUBSTR' is not defined
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1) AS "mariadb_schema.SUBSTR('a' FROM 1)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1) AS "maxdb_schema.SUBSTR('a' FROM 1)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS "oracle_schema.SUBSTR('a' FROM 1)"
+Warnings:
+Note 1003 select substr('a',1) AS "oracle_schema.SUBSTR('a' FROM 1)"
+CALL p3('SUBSTRING(''a'',1,2)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS `SUBSTRING('a',1,2)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTRING('a',1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTRING does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS `mariadb_schema.SUBSTRING('a',1,2)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS `maxdb_schema.SUBSTRING('a',1,2)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1,2) AS `oracle_schema.SUBSTRING('a',1,2)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "SUBSTRING('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTRING('a',1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTRING does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1,2) AS "mariadb_schema.SUBSTRING('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1,2) AS "maxdb_schema.SUBSTRING('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTRING('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "oracle_schema.SUBSTRING('a',1,2)"
+Warnings:
+Note 1003 select substr('a',1,2) AS "oracle_schema.SUBSTRING('a',1,2)"
+CALL p3('SUBSTRING(''a'' FROM 1)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS `SUBSTRING('a' FROM 1)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTRING('a' FROM 1)
+errmsg
+ERROR: Function 'unknown_schema.SUBSTRING' is not defined
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS `mariadb_schema.SUBSTRING('a' FROM 1)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS `maxdb_schema.SUBSTRING('a' FROM 1)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1) AS `oracle_schema.SUBSTRING('a' FROM 1)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS "SUBSTRING('a' FROM 1)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTRING('a' FROM 1)
+errmsg
+ERROR: Function 'unknown_schema.SUBSTRING' is not defined
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1) AS "mariadb_schema.SUBSTRING('a' FROM 1)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.substr('a',1) AS "maxdb_schema.SUBSTRING('a' FROM 1)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTRING('a' FROM 1)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1) AS "oracle_schema.SUBSTRING('a' FROM 1)"
+Warnings:
+Note 1003 select substr('a',1) AS "oracle_schema.SUBSTRING('a' FROM 1)"
+CALL p3('TRIM()');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM()
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM()
+errmsg
+ERROR: FUNCTION unknown_schema.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM()
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM()
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM()
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM()
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM()
+errmsg
+ERROR: FUNCTION unknown_schema.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM()
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM()
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM()
+errmsg
+ERROR: Function 'TRIM' is not defined
+CALL p3('TRIM(1,2)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM(1,2)
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2)' at line 1
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM(1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM(1,2)
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM(1,2)
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM(1,2)
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM(1,2)
+errmsg
+ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2)' at line 1
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM(1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM(1,2)
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM(1,2)
+errmsg
+ERROR: Function 'TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM(1,2)
+errmsg
+ERROR: Function 'TRIM' is not defined
+CALL p3('TRIM(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM('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 No tables used
+Level Code Message
+Note 1003 select trim('a') AS `TRIM('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM('a')
+errmsg
+ERROR: FUNCTION unknown_schema.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM('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 No tables used
+Level Code Message
+Note 1003 select trim('a') AS `mariadb_schema.TRIM('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM('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 No tables used
+Level Code Message
+Note 1003 select trim('a') AS `maxdb_schema.TRIM('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.trim('a') AS `oracle_schema.TRIM('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM('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 No tables used
+Level Code Message
+Note 1003 select trim('a') AS "TRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM('a')
+errmsg
+ERROR: FUNCTION unknown_schema.TRIM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.trim('a') AS "mariadb_schema.TRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM('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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.trim('a') AS "maxdb_schema.TRIM('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM('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 No tables used
+Level Code Message
+Note 1003 select trim('a') AS "oracle_schema.TRIM('a')"
+Warnings:
+Note 1003 select trim('a') AS "oracle_schema.TRIM('a')"
+CALL p3('TRIM(BOTH '' '' FROM ''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select trim(both ' ' from 'a') AS `TRIM(BOTH ' ' FROM 'a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM(BOTH ' ' FROM 'a')
+errmsg
+ERROR: Function 'unknown_schema.TRIM' is not defined
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select trim(both ' ' from 'a') AS `mariadb_schema.TRIM(BOTH ' ' FROM 'a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select trim(both ' ' from 'a') AS `maxdb_schema.TRIM(BOTH ' ' FROM 'a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.trim(both ' ' from 'a') AS `oracle_schema.TRIM(BOTH ' ' FROM 'a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select trim(both ' ' from 'a') AS "TRIM(BOTH ' ' FROM 'a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.TRIM(BOTH ' ' FROM 'a')
+errmsg
+ERROR: Function 'unknown_schema.TRIM' is not defined
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.trim(both ' ' from 'a') AS "mariadb_schema.TRIM(BOTH ' ' FROM 'a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select mariadb_schema.trim(both ' ' from 'a') AS "maxdb_schema.TRIM(BOTH ' ' FROM 'a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.TRIM(BOTH ' ' FROM '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 No tables used
+Level Code Message
+Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')"
+Warnings:
+Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')"
+CALL p3('REGEXP_REPLACE(''test'',''t'','''')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select regexp_replace('test','t','') AS `REGEXP_REPLACE('test','t','')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REGEXP_REPLACE('test','t','')
+errmsg
+ERROR: FUNCTION unknown_schema.REGEXP_REPLACE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select regexp_replace('test','t','') AS `mariadb_schema.REGEXP_REPLACE('test','t','')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select regexp_replace('test','t','') AS `maxdb_schema.REGEXP_REPLACE('test','t','')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.regexp_replace('test','t','') AS `oracle_schema.REGEXP_REPLACE('test','t','')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select regexp_replace('test','t','') AS "REGEXP_REPLACE('test','t','')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REGEXP_REPLACE('test','t','')
+errmsg
+ERROR: FUNCTION unknown_schema.REGEXP_REPLACE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.regexp_replace('test','t','') AS "mariadb_schema.REGEXP_REPLACE('test','t','')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select mariadb_schema.regexp_replace('test','t','') AS "maxdb_schema.REGEXP_REPLACE('test','t','')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REGEXP_REPLACE('test','t','')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select regexp_replace('test','t','') AS "oracle_schema.REGEXP_REPLACE('test','t','')"
+Warnings:
+Note 1003 select regexp_replace('test','t','') AS "oracle_schema.REGEXP_REPLACE('test','t','')"
+CALL p3('CONCAT_OPERATOR_ORACLE(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.concat('a') AS `CONCAT_OPERATOR_ORACLE('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.CONCAT_OPERATOR_ORACLE('a')
+errmsg
+ERROR: FUNCTION unknown_schema.CONCAT_OPERATOR_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.concat('a') AS `mariadb_schema.CONCAT_OPERATOR_ORACLE('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.concat('a') AS `maxdb_schema.CONCAT_OPERATOR_ORACLE('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.concat('a') AS `oracle_schema.CONCAT_OPERATOR_ORACLE('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS "CONCAT_OPERATOR_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.CONCAT_OPERATOR_ORACLE('a')
+errmsg
+ERROR: FUNCTION unknown_schema.CONCAT_OPERATOR_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS "mariadb_schema.CONCAT_OPERATOR_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS "maxdb_schema.CONCAT_OPERATOR_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.CONCAT_OPERATOR_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select concat('a') AS "oracle_schema.CONCAT_OPERATOR_ORACLE('a')"
+Warnings:
+Note 1003 select concat('a') AS "oracle_schema.CONCAT_OPERATOR_ORACLE('a')"
+CALL p3('DECODE_ORACLE(1,1,10)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.decode(1,1,10) AS `DECODE_ORACLE(1,1,10)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.DECODE_ORACLE(1,1,10)
+errmsg
+ERROR: FUNCTION unknown_schema.DECODE_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.decode(1,1,10) AS `mariadb_schema.DECODE_ORACLE(1,1,10)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.decode(1,1,10) AS `maxdb_schema.DECODE_ORACLE(1,1,10)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.decode(1,1,10) AS `oracle_schema.DECODE_ORACLE(1,1,10)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode(1,1,10) AS "DECODE_ORACLE(1,1,10)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.DECODE_ORACLE(1,1,10)
+errmsg
+ERROR: FUNCTION unknown_schema.DECODE_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode(1,1,10) AS "mariadb_schema.DECODE_ORACLE(1,1,10)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode(1,1,10) AS "maxdb_schema.DECODE_ORACLE(1,1,10)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.DECODE_ORACLE(1,1,10)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select decode(1,1,10) AS "oracle_schema.DECODE_ORACLE(1,1,10)"
+Warnings:
+Note 1003 select decode(1,1,10) AS "oracle_schema.DECODE_ORACLE(1,1,10)"
+CALL p3('LTRIM_ORACLE(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.ltrim('a') AS `LTRIM_ORACLE('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LTRIM_ORACLE('a')
+errmsg
+ERROR: FUNCTION unknown_schema.LTRIM_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.ltrim('a') AS `mariadb_schema.LTRIM_ORACLE('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.ltrim('a') AS `maxdb_schema.LTRIM_ORACLE('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.ltrim('a') AS `oracle_schema.LTRIM_ORACLE('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS "LTRIM_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LTRIM_ORACLE('a')
+errmsg
+ERROR: FUNCTION unknown_schema.LTRIM_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS "mariadb_schema.LTRIM_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS "maxdb_schema.LTRIM_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select ltrim('a') AS "oracle_schema.LTRIM_ORACLE('a')"
+Warnings:
+Note 1003 select ltrim('a') AS "oracle_schema.LTRIM_ORACLE('a')"
+CALL p3('RTRIM_ORACLE(''a'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.rtrim('a') AS `RTRIM_ORACLE('a')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RTRIM_ORACLE('a')
+errmsg
+ERROR: FUNCTION unknown_schema.RTRIM_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.rtrim('a') AS `mariadb_schema.RTRIM_ORACLE('a')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.rtrim('a') AS `maxdb_schema.RTRIM_ORACLE('a')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select oracle_schema.rtrim('a') AS `oracle_schema.RTRIM_ORACLE('a')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS "RTRIM_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RTRIM_ORACLE('a')
+errmsg
+ERROR: FUNCTION unknown_schema.RTRIM_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS "mariadb_schema.RTRIM_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS "maxdb_schema.RTRIM_ORACLE('a')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RTRIM_ORACLE('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 No tables used
+Level Code Message
+Note 1003 select rtrim('a') AS "oracle_schema.RTRIM_ORACLE('a')"
+Warnings:
+Note 1003 select rtrim('a') AS "oracle_schema.RTRIM_ORACLE('a')"
+CALL p3('LPAD_ORACLE(''a'',3)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.lpad('a',3) AS `LPAD_ORACLE('a',3)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LPAD_ORACLE('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.LPAD_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.lpad('a',3) AS `mariadb_schema.LPAD_ORACLE('a',3)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.lpad('a',3) AS `maxdb_schema.LPAD_ORACLE('a',3)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.lpad('a',3) AS `oracle_schema.LPAD_ORACLE('a',3)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS "LPAD_ORACLE('a',3)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.LPAD_ORACLE('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.LPAD_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS "mariadb_schema.LPAD_ORACLE('a',3)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS "maxdb_schema.LPAD_ORACLE('a',3)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.LPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select lpad('a',3) AS "oracle_schema.LPAD_ORACLE('a',3)"
+Warnings:
+Note 1003 select lpad('a',3) AS "oracle_schema.LPAD_ORACLE('a',3)"
+CALL p3('RPAD_ORACLE(''a'',3)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.rpad('a',3) AS `RPAD_ORACLE('a',3)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RPAD_ORACLE('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.RPAD_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.rpad('a',3) AS `mariadb_schema.RPAD_ORACLE('a',3)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.rpad('a',3) AS `maxdb_schema.RPAD_ORACLE('a',3)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.rpad('a',3) AS `oracle_schema.RPAD_ORACLE('a',3)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS "RPAD_ORACLE('a',3)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.RPAD_ORACLE('a',3)
+errmsg
+ERROR: FUNCTION unknown_schema.RPAD_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS "mariadb_schema.RPAD_ORACLE('a',3)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS "maxdb_schema.RPAD_ORACLE('a',3)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.RPAD_ORACLE('a',3)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select rpad('a',3) AS "oracle_schema.RPAD_ORACLE('a',3)"
+Warnings:
+Note 1003 select rpad('a',3) AS "oracle_schema.RPAD_ORACLE('a',3)"
+CALL p3('REPLACE_ORACLE(''a'',''b'',''c'')');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.replace('a','b','c') AS `REPLACE_ORACLE('a','b','c')`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE_ORACLE('a','b','c')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.replace('a','b','c') AS `mariadb_schema.REPLACE_ORACLE('a','b','c')`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.replace('a','b','c') AS `maxdb_schema.REPLACE_ORACLE('a','b','c')`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.replace('a','b','c') AS `oracle_schema.REPLACE_ORACLE('a','b','c')`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS "REPLACE_ORACLE('a','b','c')"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.REPLACE_ORACLE('a','b','c')
+errmsg
+ERROR: FUNCTION unknown_schema.REPLACE_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS "mariadb_schema.REPLACE_ORACLE('a','b','c')"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS "maxdb_schema.REPLACE_ORACLE('a','b','c')"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.REPLACE_ORACLE('a','b','c')
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select replace('a','b','c') AS "oracle_schema.REPLACE_ORACLE('a','b','c')"
+Warnings:
+Note 1003 select replace('a','b','c') AS "oracle_schema.REPLACE_ORACLE('a','b','c')"
+CALL p3('SUBSTR_ORACLE(''a'',1,2)');
+----------
+sql_mode='' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1,2) AS `SUBSTR_ORACLE('a',1,2)`
+----------
+sql_mode='' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR_ORACLE('a',1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR_ORACLE does not exist
+----------
+sql_mode='' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1,2) AS `mariadb_schema.SUBSTR_ORACLE('a',1,2)`
+----------
+sql_mode='' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1,2) AS `maxdb_schema.SUBSTR_ORACLE('a',1,2)`
+----------
+sql_mode='' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select oracle_schema.substr('a',1,2) AS `oracle_schema.SUBSTR_ORACLE('a',1,2)`
+----------
+sql_mode='ORACLE' qualifier=''
+query
+EXPLAIN EXTENDED SELECT SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "SUBSTR_ORACLE('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='unknown_schema.'
+query
+EXPLAIN EXTENDED SELECT unknown_schema.SUBSTR_ORACLE('a',1,2)
+errmsg
+ERROR: FUNCTION unknown_schema.SUBSTR_ORACLE does not exist
+----------
+sql_mode='ORACLE' qualifier='mariadb_schema.'
+query
+EXPLAIN EXTENDED SELECT mariadb_schema.SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "mariadb_schema.SUBSTR_ORACLE('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='maxdb_schema.'
+query
+EXPLAIN EXTENDED SELECT maxdb_schema.SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "maxdb_schema.SUBSTR_ORACLE('a',1,2)"
+----------
+sql_mode='ORACLE' qualifier='oracle_schema.'
+query
+EXPLAIN EXTENDED SELECT oracle_schema.SUBSTR_ORACLE('a',1,2)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select substr('a',1,2) AS "oracle_schema.SUBSTR_ORACLE('a',1,2)"
+Warnings:
+Note 1003 select substr('a',1,2) AS "oracle_schema.SUBSTR_ORACLE('a',1,2)"
+SELECT oracle_schema.SUBSTR_ORACLE('a' FROM 1 FOR 2);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM 1 FOR 2)' at line 1
+SELECT oracle_schema.SUBSTR('a' FROM 1 FOR 2);
+oracle_schema.SUBSTR('a' FROM 1 FOR 2)
+a
+SELECT oracle_schema.TRIM_ORACLE(LEADING ' ' FROM 'a');
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LEADING ' ' FROM 'a')' at line 1
+SELECT oracle_schema.TRIM(LEADING ' ' FROM 'a');
+oracle_schema.TRIM(LEADING ' ' FROM 'a')
+a
+SELECT oracle_schema.TRIM_ORACLE('a');
+ERROR HY000: Function 'TRIM_ORACLE' is not defined
+SELECT oracle_schema.TRIM('a');
+oracle_schema.TRIM('a')
+a
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+SET sql_mode='';
+CREATE VIEW v1 AS SELECT
+concat('a','b'),
+decode('1','2'),
+ltrim('1'),
+rtrim('1'),
+lpad('1','2', 3),
+rpad('1','2', 3),
+replace('1','2','3'),
+substr('a',1,2),
+trim(both 'a' FROM 'b');
+CREATE TABLE kv (v BLOB);
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv;
+SELECT v FROM kv WHERE v RLIKE '^(query|view_body_utf8)=' ORDER BY v;
+v
+query=select concat('a','b') AS `concat('a','b')`,decode('1','2') AS `decode('1','2')`,ltrim('1') AS `ltrim('1')`,rtrim('1') AS `rtrim('1')`,lpad('1','2',3) AS `lpad('1','2', 3)`,rpad('1','2',3) AS `rpad('1','2', 3)`,replace('1','2','3') AS `replace('1','2','3')`,substr('a',1,2) AS `substr('a',1,2)`,trim(both 'a' from 'b') AS `trim(both 'a' FROM 'b')`
+view_body_utf8=select concat('a','b') AS `concat('a','b')`,decode('1','2') AS `decode('1','2')`,ltrim('1') AS `ltrim('1')`,rtrim('1') AS `rtrim('1')`,lpad('1','2',3) AS `lpad('1','2', 3)`,rpad('1','2',3) AS `rpad('1','2', 3)`,replace('1','2','3') AS `replace('1','2','3')`,substr('a',1,2) AS `substr('a',1,2)`,trim(both 'a' from 'b') AS `trim(both 'a' FROM 'b')`
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1' AND TABLE_SCHEMA='test';
+VIEW_DEFINITION
+select concat('a','b') AS `concat('a','b')`,decode('1','2') AS `decode('1','2')`,ltrim('1') AS `ltrim('1')`,rtrim('1') AS `rtrim('1')`,lpad('1','2',3) AS `lpad('1','2', 3)`,rpad('1','2',3) AS `rpad('1','2', 3)`,replace('1','2','3') AS `replace('1','2','3')`,substr('a',1,2) AS `substr('a',1,2)`,trim(both 'a' from 'b') AS `trim(both 'a' FROM 'b')`
+DROP TABLE kv;
+DROP VIEW v1;
+SET sql_mode='ORACLE';
+CREATE VIEW v1 AS SELECT
+concat('a','b'),
+decode('1',2,3),
+ltrim('1'),
+rtrim('1'),
+lpad('1','2', 3),
+rpad('1','2', 3),
+replace('1','2','3'),
+substr('a',1,2),
+trim(both 'a' FROM 'b');
+CREATE TABLE kv (v BLOB);
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv;
+SELECT v FROM kv WHERE v RLIKE '^(query|view_body_utf8)=' ORDER BY v;
+v
+query=select concat_operator_oracle('a','b') AS `concat('a','b')`,decode_oracle('1',2,3) AS `decode('1',2,3)`,ltrim_oracle('1') AS `ltrim('1')`,rtrim_oracle('1') AS `rtrim('1')`,lpad_oracle('1','2',3) AS `lpad('1','2', 3)`,rpad_oracle('1','2',3) AS `rpad('1','2', 3)`,replace_oracle('1','2','3') AS `replace('1','2','3')`,substr_oracle('a',1,2) AS `substr('a',1,2)`,trim_oracle(both 'a' from 'b') AS `trim(both 'a' FROM 'b')`
+view_body_utf8=select oracle_schema.concat('a','b') AS `concat('a','b')`,oracle_schema.decode('1',2,3) AS `decode('1',2,3)`,oracle_schema.ltrim('1') AS `ltrim('1')`,oracle_schema.rtrim('1') AS `rtrim('1')`,oracle_schema.lpad('1','2',3) AS `lpad('1','2', 3)`,oracle_schema.rpad('1','2',3) AS `rpad('1','2', 3)`,oracle_schema.replace('1','2','3') AS `replace('1','2','3')`,oracle_schema.substr('a',1,2) AS `substr('a',1,2)`,oracle_schema.trim(both 'a' from 'b') AS `trim(both 'a' FROM 'b')`
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1' AND TABLE_SCHEMA='test';
+VIEW_DEFINITION
+select oracle_schema.concat('a','b') AS `concat('a','b')`,oracle_schema.decode('1',2,3) AS `decode('1',2,3)`,oracle_schema.ltrim('1') AS `ltrim('1')`,oracle_schema.rtrim('1') AS `rtrim('1')`,oracle_schema.lpad('1','2',3) AS `lpad('1','2', 3)`,oracle_schema.rpad('1','2',3) AS `rpad('1','2', 3)`,oracle_schema.replace('1','2','3') AS `replace('1','2','3')`,oracle_schema.substr('a',1,2) AS `substr('a',1,2)`,oracle_schema.trim(both 'a' from 'b') AS `trim(both 'a' FROM 'b')`
+DROP TABLE kv;
+DROP VIEW v1;
diff --git a/mysql-test/suite/compat/oracle/r/func_regexp_replace.result b/mysql-test/suite/compat/oracle/r/func_regexp_replace.result
new file mode 100644
index 00000000..7d0c5f79
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/func_regexp_replace.result
@@ -0,0 +1,34 @@
+SET sql_mode=ORACLE;
+#
+# MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode
+#
+CREATE TABLE t1 (replacement VARCHAR(10));
+INSERT INTO t1 VALUES (NULL), ('');
+SELECT replacement, REGEXP_REPLACE('abba','a',replacement) FROM t1 ORDER BY replacement;
+replacement REGEXP_REPLACE('abba','a',replacement)
+NULL bb
+ bb
+DROP TABLE t1;
+SELECT REGEXP_REPLACE('abba','a',null);
+REGEXP_REPLACE('abba','a',null)
+bb
+EXPLAIN EXTENDED SELECT REPLACE('abba','a',null) ;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select replace('abba','a',NULL) AS "REPLACE('abba','a',null)"
+CREATE VIEW v1 AS SELECT REPLACE('abba','a',null) ;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE VIEW "v1" AS select replace('abba','a',NULL) AS "REPLACE('abba','a',null)" latin1 latin1_swedish_ci
+SELECT * FROM v1;
+REPLACE('abba','a',null)
+bb
+SET sql_mode=DEFAULT;
+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 oracle_schema.replace('abba','a',NULL) AS `REPLACE('abba','a',null)` latin1 latin1_swedish_ci
+SELECT * FROM v1;
+REPLACE('abba','a',null)
+bb
+DROP VIEW v1;
diff --git a/mysql-test/suite/compat/oracle/r/func_replace.result b/mysql-test/suite/compat/oracle/r/func_replace.result
index 02516096..012db2a7 100644
--- a/mysql-test/suite/compat/oracle/r/func_replace.result
+++ b/mysql-test/suite/compat/oracle/r/func_replace.result
@@ -21,11 +21,11 @@ EXPLAIN EXTENDED SELECT REPLACE('ab','a',null) ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select replace_oracle('ab','a',NULL) AS "REPLACE('ab','a',null)"
+Note 1003 select replace('ab','a',NULL) AS "REPLACE('ab','a',null)"
CREATE VIEW v1 AS SELECT REPLACE('ab','a',null) ;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select replace_oracle('ab','a',NULL) AS "REPLACE('ab','a',null)" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select replace('ab','a',NULL) AS "REPLACE('ab','a',null)" latin1 latin1_swedish_ci
SELECT * FROM v1;
REPLACE('ab','a',null)
b
diff --git a/mysql-test/suite/compat/oracle/r/func_substr.result b/mysql-test/suite/compat/oracle/r/func_substr.result
index 5d9fdd5f..cbb0e74c 100644
--- a/mysql-test/suite/compat/oracle/r/func_substr.result
+++ b/mysql-test/suite/compat/oracle/r/func_substr.result
@@ -76,11 +76,11 @@ EXPLAIN EXTENDED SELECT SUBSTR('abc',2,1) ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select substr_oracle('abc',2,1) AS "SUBSTR('abc',2,1)"
+Note 1003 select substr('abc',2,1) AS "SUBSTR('abc',2,1)"
CREATE VIEW v1 AS SELECT SUBSTR('abc',2,1) ;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select substr_oracle('abc',2,1) AS "SUBSTR('abc',2,1)" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select substr('abc',2,1) AS "SUBSTR('abc',2,1)" latin1 latin1_swedish_ci
SELECT * FROM v1;
SUBSTR('abc',2,1)
b
diff --git a/mysql-test/suite/compat/oracle/r/func_trim.result b/mysql-test/suite/compat/oracle/r/func_trim.result
index bed8dadf..965531db 100644
--- a/mysql-test/suite/compat/oracle/r/func_trim.result
+++ b/mysql-test/suite/compat/oracle/r/func_trim.result
@@ -116,13 +116,13 @@ TRIM(TRAILING 'a' FROM 'abc') ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select trim_oracle('abc') AS "TRIM('abc')",trim_oracle(both 'a' from 'abc') AS "TRIM(BOTH 'a' FROM 'abc')",trim_oracle(leading 'a' from 'abc') AS "TRIM(LEADING 'a' FROM 'abc')",trim_oracle(trailing 'a' from 'abc') AS "TRIM(TRAILING 'a' FROM 'abc')"
+Note 1003 select trim('abc') AS "TRIM('abc')",trim(both 'a' from 'abc') AS "TRIM(BOTH 'a' FROM 'abc')",trim(leading 'a' from 'abc') AS "TRIM(LEADING 'a' FROM 'abc')",trim(trailing 'a' from 'abc') AS "TRIM(TRAILING 'a' FROM 'abc')"
EXPLAIN EXTENDED SELECT RTRIM('abc'),
LTRIM('abc');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select rtrim_oracle('abc') AS "RTRIM('abc')",ltrim_oracle('abc') AS "LTRIM('abc')"
+Note 1003 select rtrim('abc') AS "RTRIM('abc')",ltrim('abc') AS "LTRIM('abc')"
CREATE VIEW v1 AS SELECT ord,TRIM('abc'),RTRIM('abc'),LTRIM('abc'),
'['||c1||']',
TRIM(LEADING 'a' FROM c1),
@@ -133,7 +133,7 @@ RTRIM(c1)
FROM t1 ORDER BY ord ;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE VIEW "v1" AS select "t1"."ord" AS "ord",trim_oracle('abc') AS "TRIM('abc')",rtrim_oracle('abc') AS "RTRIM('abc')",ltrim_oracle('abc') AS "LTRIM('abc')",concat_operator_oracle(concat_operator_oracle('[',"t1"."c1"),']') AS "'['||c1||']'",trim_oracle(leading 'a' from "t1"."c1") AS "TRIM(LEADING 'a' FROM c1)",trim_oracle(trailing 'a' from "t1"."c1") AS "TRIM(TRAILING 'a' FROM c1)",trim_oracle(both 'a' from "t1"."c1") AS "TRIM(BOTH 'a' FROM c1)",ltrim_oracle("t1"."c1") AS "LTRIM(c1)",rtrim_oracle("t1"."c1") AS "RTRIM(c1)" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
+v1 CREATE VIEW "v1" AS select "t1"."ord" AS "ord",trim('abc') AS "TRIM('abc')",rtrim('abc') AS "RTRIM('abc')",ltrim('abc') AS "LTRIM('abc')",concat(concat('[',"t1"."c1"),']') AS "'['||c1||']'",trim(leading 'a' from "t1"."c1") AS "TRIM(LEADING 'a' FROM c1)",trim(trailing 'a' from "t1"."c1") AS "TRIM(TRAILING 'a' FROM c1)",trim(both 'a' from "t1"."c1") AS "TRIM(BOTH 'a' FROM c1)",ltrim("t1"."c1") AS "LTRIM(c1)",rtrim("t1"."c1") AS "RTRIM(c1)" from "t1" order by "t1"."ord" latin1 latin1_swedish_ci
SELECT * FROM v1;
ord TRIM('abc') RTRIM('abc') LTRIM('abc') '['||c1||']' TRIM(LEADING 'a' FROM c1) TRIM(TRAILING 'a' FROM c1) TRIM(BOTH 'a' FROM c1) LTRIM(c1) RTRIM(c1)
1 abc abc abc [abc] bc abc bc abc abc
diff --git a/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result b/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result
new file mode 100644
index 00000000..fd3dd787
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result
@@ -0,0 +1,112 @@
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE
+#
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (
+a0 VARCHAR(64) NOT NULL DEFAULT LTRIM(now()),
+a1 VARCHAR(64) AS (LTRIM(a0)) PERSISTENT,
+b0 VARCHAR(64) NOT NULL DEFAULT LPAD(now(),10),
+b1 VARCHAR(64) AS (LPAD(b0,10)) PERSISTENT
+);
+CREATE VIEW v1 AS SELECT
+LTRIM(now()) AS a0,
+LPAD(now(),10) AS b0;
+SET sql_mode=ORACLE;
+CREATE TABLE t2 (
+a0 VARCHAR(64) NOT NULL DEFAULT LTRIM(now()),
+a1 VARCHAR(64) AS (LTRIM(a0)) PERSISTENT,
+b0 VARCHAR(64) NOT NULL DEFAULT LPAD(now(),10),
+b1 VARCHAR(64) AS (LPAD(b0,10)) PERSISTENT
+);
+CREATE VIEW v2 AS SELECT
+LTRIM(now()) AS a0,
+LPAD(now(),10) AS b0;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `a0` varchar(64) NOT NULL DEFAULT ltrim(current_timestamp()),
+ `a1` varchar(64) GENERATED ALWAYS AS (ltrim(`a0`)) STORED,
+ `b0` varchar(64) NOT NULL DEFAULT lpad(current_timestamp(),10),
+ `b1` varchar(64) GENERATED ALWAYS AS (lpad(`b0`,10)) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t2` (
+ `a0` varchar(64) NOT NULL DEFAULT ltrim_oracle(current_timestamp()),
+ `a1` varchar(64) GENERATED ALWAYS AS (ltrim_oracle(`a0`)) STORED,
+ `b0` varchar(64) NOT NULL DEFAULT lpad_oracle(current_timestamp(),10),
+ `b1` varchar(64) GENERATED ALWAYS AS (lpad_oracle(`b0`,10)) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE VIEW `v1` AS SELECT
+ 1 AS `a0`,
+ 1 AS `b0` */;
+SET character_set_client = @saved_cs_client;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE VIEW `v2` AS SELECT
+ 1 AS `a0`,
+ 1 AS `b0` */;
+SET character_set_client = @saved_cs_client;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select ltrim(current_timestamp()) AS `a0`,lpad(current_timestamp(),10) AS `b0` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v2` AS select oracle_schema.ltrim(current_timestamp()) AS `a0`,oracle_schema.lpad(current_timestamp(),10) AS `b0` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+DROP TABLE t1,t2;
+DROP VIEW v1,v2;
+SET sql_mode=DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a0` varchar(64) NOT NULL DEFAULT ltrim(current_timestamp()),
+ `a1` varchar(64) GENERATED ALWAYS AS (ltrim(`a0`)) STORED,
+ `b0` varchar(64) NOT NULL DEFAULT lpad(current_timestamp(),10),
+ `b1` varchar(64) GENERATED ALWAYS AS (lpad(`b0`,10)) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a0` varchar(64) NOT NULL DEFAULT ltrim_oracle(current_timestamp()),
+ `a1` varchar(64) GENERATED ALWAYS AS (ltrim_oracle(`a0`)) STORED,
+ `b0` varchar(64) NOT NULL DEFAULT lpad_oracle(current_timestamp(),10),
+ `b1` varchar(64) GENERATED ALWAYS AS (lpad_oracle(`b0`,10)) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+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 ltrim(current_timestamp()) AS `a0`,lpad(current_timestamp(),10) AS `b0` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select oracle_schema.ltrim(current_timestamp()) AS `a0`,oracle_schema.lpad(current_timestamp(),10) AS `b0` latin1 latin1_swedish_ci
+DROP TABLE t1,t2;
+DROP VIEW v1, v2;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/suite/compat/oracle/r/parser.result b/mysql-test/suite/compat/oracle/r/parser.result
index 32ea444e..0944b7f3 100644
--- a/mysql-test/suite/compat/oracle/r/parser.result
+++ b/mysql-test/suite/compat/oracle/r/parser.result
@@ -84,7 +84,7 @@ DECLARE history INT; BEGIN history:=10; SELECT history; END
SELECT history FROM t1
SELECT history 'alias' FROM t1
SELECT history()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT history.history()
Error 1630 FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT history DATE FROM t1
@@ -106,7 +106,7 @@ DECLARE next INT; BEGIN next:=10; SELECT next; END
SELECT next FROM t1
SELECT next 'alias' FROM t1
SELECT next()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT next.next()
Error 1630 FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT next DATE FROM t1
@@ -151,7 +151,7 @@ DECLARE previous INT; BEGIN previous:=10; SELECT previous; END
SELECT previous FROM t1
SELECT previous 'alias' FROM t1
SELECT previous()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT previous.previous()
Error 1630 FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT previous DATE FROM t1
@@ -174,7 +174,7 @@ DECLARE system INT; BEGIN system:=10; SELECT system; END
SELECT system FROM t1
SELECT system 'alias' FROM t1
SELECT system()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system.system()
Error 1630 FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system DATE FROM t1
@@ -196,7 +196,7 @@ DECLARE system_time INT; BEGIN system_time:=10; SELECT system_time; END
SELECT system_time FROM t1
SELECT system_time 'alias' FROM t1
SELECT system_time()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system_time.system_time()
Error 1630 FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system_time DATE FROM t1
@@ -264,7 +264,7 @@ DECLARE transaction INT; BEGIN transaction:=10; SELECT transaction; END
SELECT transaction FROM t1
SELECT transaction 'alias' FROM t1
SELECT transaction()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT transaction.transaction()
Error 1630 FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT transaction DATE FROM t1
@@ -308,7 +308,7 @@ DECLARE versioning INT; BEGIN versioning:=10; SELECT versioning; END
SELECT versioning FROM t1
SELECT versioning 'alias' FROM t1
SELECT versioning()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT versioning.versioning()
Error 1630 FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT versioning DATE FROM t1
@@ -330,7 +330,7 @@ DECLARE without INT; BEGIN without:=10; SELECT without; END
SELECT without FROM t1
SELECT without 'alias' FROM t1
SELECT without()
-Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
+Error 1630 FUNCTION test.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT without.without()
Error 1630 FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT without DATE FROM t1
diff --git a/mysql-test/suite/compat/oracle/r/ps.result b/mysql-test/suite/compat/oracle/r/ps.result
index 818c97b0..2d0c4da9 100644
--- a/mysql-test/suite/compat/oracle/r/ps.result
+++ b/mysql-test/suite/compat/oracle/r/ps.result
@@ -178,9 +178,9 @@ EXECUTE IMMEDIATE 'SELECT :1 FROM DUAL' USING 10;
# Testing erroneous and diallowed prepare source
#
EXECUTE IMMEDIATE _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_operator_oracle'
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
PREPARE stmt FROM _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_operator_oracle'
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
EXECUTE IMMEDIATE (SELECT 'SELECT 1');
ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
PREPARE stmt FROM (SELECT 'SELECT 1');
diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
index 31d794c9..93300cc3 100644
--- a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
+++ b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result
@@ -758,7 +758,7 @@ END;
END;
$$
CALL p1();
-ERROR HY000: Illegal mix of collations (latin1_bin,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat_operator_oracle'
+ERROR HY000: Illegal mix of collations (latin1_bin,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat'
DROP PROCEDURE p1;
#
# Non-existing field
diff --git a/mysql-test/suite/compat/oracle/r/vcol_innodb.result b/mysql-test/suite/compat/oracle/r/vcol_innodb.result
new file mode 100644
index 00000000..112d1b4a
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/vcol_innodb.result
@@ -0,0 +1,54 @@
+#
+# MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE
+#
+FLUSH TABLES;
+SET sql_mode='';
+CREATE TABLE t (d INT,b VARCHAR(1),c CHAR(1),g CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b),KEY g(g)) ENGINE=InnoDB;
+INSERT INTO t VALUES (0);
+ERROR 21S01: Column count doesn't match value count at row 1
+SET sql_mode='ORACLE';
+INSERT INTO t SET c=REPEAT (1,0);
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+ALTER TABLE t CHANGE COLUMN a b INT;
+ERROR 42S22: Unknown column 'a' in 't'
+DELETE FROM t;
+SET sql_mode='';
+FLUSH TABLES;
+INSERT INTO t SET c='0';
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+DROP TABLE t;
+FLUSH TABLES;
+SET sql_mode='';
+CREATE TABLE t (a INT(1),d INT(1),b VARCHAR(1),c CHAR(1),vadc INT(1) GENERATED ALWAYS AS ( (a + length (d))) STORED,vbc CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,vbidxc CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b (1),a,d),KEY d (d),KEY a (a),KEY c_renamed (c (1),b (1)),KEY b (b (1),c (1),a),KEY vbidxc (vbidxc),KEY a_2 (a,vbidxc),KEY vbidxc_2 (vbidxc,d)) DEFAULT CHARSET=latin1 ENGINE=InnoDB;
+INSERT INTO t VALUES (0,0,1,0,1,0,1,0,0);
+ERROR 21S01: Column count doesn't match value count at row 1
+SET SESSION sql_mode='ORACLE';
+INSERT INTO t SET c=REPEAT (1,0);
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+Warning 1364 Field 'd' doesn't have a default value
+Warning 1364 Field 'b' doesn't have a default value
+ALTER TABLE t CHANGE COLUMN a b CHAR(1);
+ERROR 42S21: Duplicate column name 'b'
+DELETE FROM t;
+SET SESSION sql_mode=DEFAULT;
+DROP TABLE t;
+SET sql_mode='';
+CREATE TABLE t1 (d INT,b VARCHAR(1),c CHAR(1),g CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b),KEY g(g)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0);
+ERROR 21S01: Column count doesn't match value count at row 1
+SET sql_mode='ORACLE';
+INSERT INTO t1 SET c=REPEAT (1,0);
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+ALTER TABLE t1 CHANGE COLUMN a b INT;
+ERROR 42S22: Unknown column 'a' in 't1'
+DELETE FROM t1;
+SET sql_mode='';
+FLUSH TABLES;
+INSERT INTO t1 SET c='0';
+Warnings:
+Warning 1364 Field 'b' doesn't have a default value
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/column_compression.test b/mysql-test/suite/compat/oracle/t/column_compression.test
index 01d4977b..e8d55000 100644
--- a/mysql-test/suite/compat/oracle/t/column_compression.test
+++ b/mysql-test/suite/compat/oracle/t/column_compression.test
@@ -1,6 +1,6 @@
--source include/have_innodb.inc
--source include/have_csv.inc
---source include/have_normal_bzip.inc
+--source include/have_normal_zlib.inc
SET sql_mode=ORACLE;
diff --git a/mysql-test/suite/compat/oracle/t/func_qualified.test b/mysql-test/suite/compat/oracle/t/func_qualified.test
new file mode 100644
index 00000000..f2c019ec
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/func_qualified.test
@@ -0,0 +1,248 @@
+--let $MYSQLD_DATADIR= `select @@datadir`
+
+--echo #
+--echo # MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE
+--echo #
+
+#
+# Testing that the error message for DECODE preserves
+# the exact letter case as typed by the user
+#
+
+SET sql_mode=DEFAULT;
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT decode_oracle(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DECODE_ORACLE(1);
+
+SET sql_mode=ORACLE;
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT decode_oracle(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DECODE_ORACLE(1);
+
+SET sql_mode=DEFAULT;
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT decode(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DECODE(1);
+
+SET sql_mode=ORACLE;
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT decode(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT DECODE(1);
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT mariadb_schema.decode(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT mariadb_schema.DECODE(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT mariadb_schema.decode_oracle(1);
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT mariadb_schema.DECODE_ORACLE(1);
+
+#
+# Testing that REPLACE, SUBSTR, TRIM print the exact name
+# as typed by the user in "Function .. is not defined"
+#
+
+SET sql_mode=DEFAULT;
+
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.TRIM(1);
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.trim(1);
+
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.TRIM();
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.TRIM('a','b');
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.TRIM('a','b','c','d');
+
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.SUBSTR('a',1,2);
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.substr('a',1,2);
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.SUBSTRING('a',1,2);
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.substring('a',1,2);
+
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.REPLACE('a','b','c');
+--error ER_FUNC_INEXISTENT_NAME_COLLISION
+SELECT unknown.replace('a','b','c');
+
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.REPLACE();
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.REPLACE('a');
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.REPLACE('a','b');
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.REPLACE('a','b','c','d');
+
+#
+# Testing EXPLAIN EXTENDED SELECT
+#
+
+SET sql_mode=DEFAULT;
+DELIMITER $$;
+CREATE PROCEDURE p1(sqlmode TEXT, qualifier TEXT, expr TEXT)
+BEGIN
+ DECLARE query TEXT DEFAULT 'SELECT $(QUALIFIER)$(EXPR)';
+ DECLARE errmsg TEXT DEFAULT NULL;
+ DECLARE CONTINUE HANDLER FOR 1064, 1128, 1305, 1582, 1630
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 errmsg = MESSAGE_TEXT;
+ END;
+
+ SET sql_mode=sqlmode;
+ SET query=REPLACE(query, '$(QUALIFIER)', qualifier);
+ SET query=REPLACE(query, '$(EXPR)', expr);
+ SET query= CONCAT('EXPLAIN EXTENDED ', query);
+ SELECT CONCAT('sql_mode=''',sqlmode,'''', ' ',
+ 'qualifier=''',qualifier,'''') AS `----------`;
+ SELECT query;
+ EXECUTE IMMEDIATE query;
+ IF errmsg IS NOT NULL THEN
+ SELECT CONCAT('ERROR: ', errmsg) AS errmsg;
+ ELSE
+ SHOW WARNINGS;
+ END IF;
+END;
+$$
+CREATE PROCEDURE p2(sqlmode TEXT, expr TEXT)
+BEGIN
+ CALL p1(sqlmode, '', expr);
+ CALL p1(sqlmode, 'unknown_schema.', expr);
+ CALL p1(sqlmode, 'mariadb_schema.', expr);
+ CALL p1(sqlmode, 'maxdb_schema.', expr);
+ CALL p1(sqlmode, 'oracle_schema.', expr);
+END;
+$$
+CREATE PROCEDURE p3(expr TEXT)
+BEGIN
+ CALL p2('', expr);
+ CALL p2('ORACLE', expr);
+END;
+$$
+DELIMITER ;$$
+
+CALL p3('CONCAT(''a'')');
+
+# MariaDB style
+CALL p3('DECODE(''1'',''2'')');
+# Oracle style
+CALL p3('DECODE(1,1,10)');
+
+CALL p3('LTRIM(''a'')');
+CALL p3('RTRIM(''a'')');
+
+CALL p3('LPAD(''a'',3)');
+CALL p3('LPAD(''a'',3, '' '')');
+
+CALL p3('RPAD(''a'',3)');
+CALL p3('RPAD(''a'',3, '' '')');
+
+CALL p3('REPLACE()');
+CALL p3('REPLACE(''a'',''b'')');
+CALL p3('REPLACE(''a'',''b'',''c'',''d'')');
+CALL p3('REPLACE(''a'',''b'',''c'')');
+
+CALL p3('SUBSTR()');
+CALL p3('SUBSTR(''a'',1,2,3)');
+CALL p3('SUBSTR(''a'',1,2)');
+CALL p3('SUBSTR(''a'' FROM 1)');
+
+CALL p3('SUBSTRING(''a'',1,2)');
+CALL p3('SUBSTRING(''a'' FROM 1)');
+
+CALL p3('TRIM()');
+CALL p3('TRIM(1,2)');
+CALL p3('TRIM(''a'')');
+CALL p3('TRIM(BOTH '' '' FROM ''a'')');
+
+CALL p3('REGEXP_REPLACE(''test'',''t'','''')');
+
+# Deprecated compatibility XXX_ORACLE functions.
+# These functions are implemented as simple native functions
+# and have no special grammar rules in sql_yacc.yy.
+# So they support the qualified syntax automatically,
+# which is not absolutely required, but is not harmful.
+
+CALL p3('CONCAT_OPERATOR_ORACLE(''a'')');
+CALL p3('DECODE_ORACLE(1,1,10)');
+CALL p3('LTRIM_ORACLE(''a'')');
+CALL p3('RTRIM_ORACLE(''a'')');
+CALL p3('LPAD_ORACLE(''a'',3)');
+CALL p3('RPAD_ORACLE(''a'',3)');
+CALL p3('REPLACE_ORACLE(''a'',''b'',''c'')');
+CALL p3('SUBSTR_ORACLE(''a'',1,2)');
+
+
+# Deprecated compatibility XXX_ORACLE variants for functions
+# with a special syntax in sql_yacc.yy.
+# These compatibility functions do not support qualified syntax.
+# One should use a qualified variant without the _ORACLE suffix instead.
+
+--error ER_PARSE_ERROR
+SELECT oracle_schema.SUBSTR_ORACLE('a' FROM 1 FOR 2);
+# Use this instead:
+SELECT oracle_schema.SUBSTR('a' FROM 1 FOR 2);
+
+--error ER_PARSE_ERROR
+SELECT oracle_schema.TRIM_ORACLE(LEADING ' ' FROM 'a');
+# Use this instead:
+SELECT oracle_schema.TRIM(LEADING ' ' FROM 'a');
+
+--error ER_FUNCTION_NOT_DEFINED
+SELECT oracle_schema.TRIM_ORACLE('a');
+# Use this instead:
+SELECT oracle_schema.TRIM('a');
+
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+
+
+SET sql_mode='';
+CREATE VIEW v1 AS SELECT
+ concat('a','b'),
+ decode('1','2'),
+ ltrim('1'),
+ rtrim('1'),
+ lpad('1','2', 3),
+ rpad('1','2', 3),
+ replace('1','2','3'),
+ substr('a',1,2),
+ trim(both 'a' FROM 'b');
+CREATE TABLE kv (v BLOB);
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv;
+SELECT v FROM kv WHERE v RLIKE '^(query|view_body_utf8)=' ORDER BY v;
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1' AND TABLE_SCHEMA='test';
+DROP TABLE kv;
+DROP VIEW v1;
+
+SET sql_mode='ORACLE';
+CREATE VIEW v1 AS SELECT
+ concat('a','b'),
+ decode('1',2,3),
+ ltrim('1'),
+ rtrim('1'),
+ lpad('1','2', 3),
+ rpad('1','2', 3),
+ replace('1','2','3'),
+ substr('a',1,2),
+ trim(both 'a' FROM 'b');
+CREATE TABLE kv (v BLOB);
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv;
+SELECT v FROM kv WHERE v RLIKE '^(query|view_body_utf8)=' ORDER BY v;
+SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1' AND TABLE_SCHEMA='test';
+DROP TABLE kv;
+DROP VIEW v1;
diff --git a/mysql-test/suite/compat/oracle/t/func_regexp_replace.test b/mysql-test/suite/compat/oracle/t/func_regexp_replace.test
new file mode 100644
index 00000000..8841d524
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/func_regexp_replace.test
@@ -0,0 +1,26 @@
+SET sql_mode=ORACLE;
+
+--echo #
+--echo # MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode
+--echo #
+
+#SELECT REGEXP_REPLACE(null,'a','b') ;
+#SELECT REGEXP_REPLACE('ab',null,'b') ;
+#SELECT REGEXP_REPLACE('ab','a',null) ;
+#SELECT REGEXP_REPLACE('ab',null,null) ;
+
+CREATE TABLE t1 (replacement VARCHAR(10));
+INSERT INTO t1 VALUES (NULL), ('');
+SELECT replacement, REGEXP_REPLACE('abba','a',replacement) FROM t1 ORDER BY replacement;
+DROP TABLE t1;
+
+SELECT REGEXP_REPLACE('abba','a',null);
+EXPLAIN EXTENDED SELECT REPLACE('abba','a',null) ;
+
+CREATE VIEW v1 AS SELECT REPLACE('abba','a',null) ;
+SHOW CREATE VIEW v1;
+SELECT * FROM v1;
+SET sql_mode=DEFAULT;
+SHOW CREATE VIEW v1;
+SELECT * FROM v1;
+DROP VIEW v1;
diff --git a/mysql-test/suite/compat/oracle/t/mysqldump_restore_func_qualified.test b/mysql-test/suite/compat/oracle/t/mysqldump_restore_func_qualified.test
new file mode 100644
index 00000000..36ab3543
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/mysqldump_restore_func_qualified.test
@@ -0,0 +1,50 @@
+# See comments in mysql-test/main/mysqldump_restore.test
+--source include/not_embedded.inc
+
+let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/mysqldump_func_qualified.sql;
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE
+--echo #
+
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (
+ a0 VARCHAR(64) NOT NULL DEFAULT LTRIM(now()),
+ a1 VARCHAR(64) AS (LTRIM(a0)) PERSISTENT,
+ b0 VARCHAR(64) NOT NULL DEFAULT LPAD(now(),10),
+ b1 VARCHAR(64) AS (LPAD(b0,10)) PERSISTENT
+);
+CREATE VIEW v1 AS SELECT
+ LTRIM(now()) AS a0,
+ LPAD(now(),10) AS b0;
+SET sql_mode=ORACLE;
+CREATE TABLE t2 (
+ a0 VARCHAR(64) NOT NULL DEFAULT LTRIM(now()),
+ a1 VARCHAR(64) AS (LTRIM(a0)) PERSISTENT,
+ b0 VARCHAR(64) NOT NULL DEFAULT LPAD(now(),10),
+ b1 VARCHAR(64) AS (LPAD(b0,10)) PERSISTENT
+);
+CREATE VIEW v2 AS SELECT
+ LTRIM(now()) AS a0,
+ LPAD(now(),10) AS b0;
+--exec $MYSQL_DUMP --skip-extended-insert test --skip-comments --compact t1 t2 v1 v2
+--exec $MYSQL_DUMP --skip-extended-insert test --skip-comments t1 t2 v1 v2 > $mysqldumpfile
+DROP TABLE t1,t2;
+DROP VIEW v1,v2;
+--exec $MYSQL test < $mysqldumpfile
+SET sql_mode=DEFAULT;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+SHOW CREATE VIEW v1;
+SHOW CREATE VIEW v2;
+--remove_file $mysqldumpfile
+DROP TABLE t1,t2;
+DROP VIEW v1, v2;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/suite/compat/oracle/t/vcol_innodb.test b/mysql-test/suite/compat/oracle/t/vcol_innodb.test
new file mode 100644
index 00000000..bd923f9b
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/vcol_innodb.test
@@ -0,0 +1,47 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE
+--echo #
+
+FLUSH TABLES;
+SET sql_mode='';
+CREATE TABLE t (d INT,b VARCHAR(1),c CHAR(1),g CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b),KEY g(g)) ENGINE=InnoDB;
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t VALUES (0);
+SET sql_mode='ORACLE';
+INSERT INTO t SET c=REPEAT (1,0);
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE t CHANGE COLUMN a b INT;
+DELETE FROM t;
+SET sql_mode='';
+FLUSH TABLES;
+INSERT INTO t SET c='0';
+DROP TABLE t;
+FLUSH TABLES;
+
+SET sql_mode='';
+CREATE TABLE t (a INT(1),d INT(1),b VARCHAR(1),c CHAR(1),vadc INT(1) GENERATED ALWAYS AS ( (a + length (d))) STORED,vbc CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,vbidxc CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b (1),a,d),KEY d (d),KEY a (a),KEY c_renamed (c (1),b (1)),KEY b (b (1),c (1),a),KEY vbidxc (vbidxc),KEY a_2 (a,vbidxc),KEY vbidxc_2 (vbidxc,d)) DEFAULT CHARSET=latin1 ENGINE=InnoDB;
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t VALUES (0,0,1,0,1,0,1,0,0);
+SET SESSION sql_mode='ORACLE';
+INSERT INTO t SET c=REPEAT (1,0);
+--error ER_DUP_FIELDNAME
+ALTER TABLE t CHANGE COLUMN a b CHAR(1);
+DELETE FROM t;
+SET SESSION sql_mode=DEFAULT;
+DROP TABLE t;
+
+SET sql_mode='';
+CREATE TABLE t1 (d INT,b VARCHAR(1),c CHAR(1),g CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b),KEY g(g)) ENGINE=InnoDB;
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+INSERT INTO t1 VALUES (0);
+SET sql_mode='ORACLE';
+INSERT INTO t1 SET c=REPEAT (1,0);
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE t1 CHANGE COLUMN a b INT;
+DELETE FROM t1;
+SET sql_mode='';
+FLUSH TABLES;
+INSERT INTO t1 SET c='0';
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/r/corrupted_during_recovery.result b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
index 2b29bf26..7329999d 100644
--- a/mysql-test/suite/encryption/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
@@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(2);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
-ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
+Got one of the listed errors
SELECT * FROM t2;
a
2
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result b/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result
index 541680ae..d86ca6f9 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result
@@ -1,6 +1,8 @@
-SELECT variable_value into @old_encrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) INTO @old_encrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
-SELECT variable_value into @old_decrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) INTO @old_decrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;
@@ -12,11 +14,13 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
8192
-SELECT variable_value > @old_encrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) > @old_encrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
-variable_value > @old_encrypted
+CAST(variable_value AS INT) > @old_encrypted
1
-SELECT variable_value > @old_decrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) > @old_decrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
-variable_value > @old_decrypted
+CAST(variable_value AS INT) > @old_decrypted
1
diff --git a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
index 7ee30423..18082027 100644
--- a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
+++ b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result
@@ -13,11 +13,13 @@ set current_num = current_num + 1;
end while;
end//
commit;
-set autocommit=0;
-call innodb_insert_proc(10000);
+begin;
+set statement unique_checks=0, foreign_key_checks=0 for
+call innodb_insert_proc(100);
commit;
-set autocommit=1;
+DROP PROCEDURE innodb_insert_proc;
# Wait max 10 min for key encryption threads to encrypt all spaces
+FLUSH TABLES t1, t2, t3 FOR EXPORT;
# tablespaces should be now encrypted
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
@@ -25,15 +27,16 @@ NOT FOUND /foobar/ in t1.ibd
NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND
NOT FOUND /barfoo/ in t3.ibd
-# restart
db.opt
+t1.cfg
t1.frm
t1.ibd
+t2.cfg
t2.frm
t2.ibd
+t3.cfg
t3.frm
t3.ibd
-FLUSH TABLES t1, t2, t3 FOR EXPORT;
backup: t1
backup: t2
backup: t3
@@ -55,17 +58,18 @@ restore: t1 .ibd and .cfg files
restore: t2 .ibd and .cfg files
restore: t3 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-SELECT COUNT(1) FROM t1;
-COUNT(1)
-10000
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+100
ALTER TABLE t2 IMPORT TABLESPACE;
-SELECT COUNT(1) FROM t2;
-COUNT(1)
-10000
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+100
ALTER TABLE t3 IMPORT TABLESPACE;
-SELECT COUNT(1) FROM t3;
-COUNT(1)
-10000
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+100
+FLUSH TABLES t1, t2, t3 FOR EXPORT;
# tablespaces should remain encrypted after import
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
@@ -73,8 +77,8 @@ NOT FOUND /foobar/ in t1.ibd
NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND
NOT FOUND /barfoo/ in t3.ibd
-# restart
-ALTER TABLE t1 ENGINE InnoDB;
+UNLOCK TABLES;
+ALTER TABLE t1 FORCE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -82,7 +86,7 @@ t1 CREATE TABLE `t1` (
`a` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes
-ALTER TABLE t2 ENGINE InnoDB;
+ALTER TABLE t2 FORCE;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -90,7 +94,7 @@ t2 CREATE TABLE `t2` (
`a` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-ALTER TABLE t3 ENGINE InnoDB;
+ALTER TABLE t3 FORCE;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
@@ -98,30 +102,17 @@ t3 CREATE TABLE `t3` (
`a` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPRESSED `encrypted`=yes
-# Restarting server
-# restart
-# Done restarting server
# Verify that tables are still usable
-SELECT COUNT(1) FROM t1;
-COUNT(1)
-10000
-SELECT COUNT(1) FROM t2;
-COUNT(1)
-10000
-SELECT COUNT(1) FROM t3;
-COUNT(1)
-10000
-# Tablespaces should be encrypted after restart
+CHECK TABLE t1, t2, t3 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+test.t2 check status OK
+test.t3 check status OK
+FLUSH TABLES t1, t2, t3 FOR EXPORT;
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 ... on expecting NOT FOUND
NOT FOUND /temp/ in t2.ibd
# t3 ... on expecting NOT FOUND
-NOT FOUND /barfoo/ in t3.ibd
-# restart
-# Wait max 10 min for key encryption threads to encrypt all spaces
-# Success!
-# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
-# restart: --innodb_encrypt_tables=0 --innodb_encryption_threads=0
-DROP PROCEDURE innodb_insert_proc;
+UNLOCK TABLES;
DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
index d0dadb6d..6dedcd4b 100644
--- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result
+++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
@@ -4502,6 +4502,19 @@ NULL
DROP FUNCTION f;
DROP TABLE t;
#
+# MDEV-31296: Crash in Item_func::fix_fields when prepared statement
+# with subqueries and window function is executed with
+# sql_mode = ONLY_FULL_GROUP_BY
+#
+CREATE TABLE t1 ( a INT, i INT) ;
+CREATE TABLE t2 ( a INT);
+INSERT INTO t2 VALUES (4000);
+SET SESSION sql_mode = "ONLY_FULL_GROUP_BY";
+EXECUTE IMMEDIATE "SELECT SUM(i) OVER (ORDER BY i) FROM t1 NATURAL JOIN t2";
+SUM(i) OVER (ORDER BY i)
+# Clean up
+DROP TABLE t1, t2;
+#
# End of 10.6 tests
#
#
diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
index e4a31a0b..1240ee1a 100644
--- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
@@ -60,7 +60,7 @@ call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and r
let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
--source include/restart_mysqld.inc
---error ER_TABLE_CORRUPT
+--error ER_NO_SUCH_TABLE_IN_ENGINE,ER_TABLE_CORRUPT
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;
diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test
index d99a55b9..83abb783 100644
--- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test
+++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test
@@ -2,10 +2,12 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
-SELECT variable_value into @old_encrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) INTO @old_encrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
-SELECT variable_value into @old_decrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) INTO @old_decrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
@@ -17,8 +19,10 @@ INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;
-SELECT variable_value > @old_encrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) > @old_encrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
-SELECT variable_value > @old_decrypted FROM information_schema.global_status
+SELECT CAST(variable_value AS INT) > @old_decrypted
+FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
index 22755571..5f02d966 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_discard_import.test
@@ -6,7 +6,6 @@
let MYSQLD_DATADIR = `SELECT @@datadir`;
--let SEARCH_RANGE = 10000000
---let $id = `SELECT RAND()`
--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
--let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd
--let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd
@@ -30,19 +29,18 @@ end//
delimiter ;//
commit;
-set autocommit=0;
-call innodb_insert_proc(10000);
+begin;
+set statement unique_checks=0, foreign_key_checks=0 for
+call innodb_insert_proc(100);
commit;
-set autocommit=1;
+DROP PROCEDURE innodb_insert_proc;
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING <> 0
--source include/wait_condition.inc
-# shutdown so that grep is safe
---source include/shutdown_mysqld.inc
-
+FLUSH TABLES t1, t2, t3 FOR EXPORT;
--echo # tablespaces should be now encrypted
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
@@ -57,11 +55,8 @@ set autocommit=1;
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
---source include/start_mysqld.inc
let MYSQLD_DATADIR =`SELECT @@datadir`;
-
--list_files $MYSQLD_DATADIR/test
-FLUSH TABLES t1, t2, t3 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1","t2","t3");
@@ -80,14 +75,13 @@ ib_restore_tablespaces("test", "t1","t2","t3");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
-SELECT COUNT(1) FROM t1;
+SELECT COUNT(*) FROM t1;
ALTER TABLE t2 IMPORT TABLESPACE;
-SELECT COUNT(1) FROM t2;
+SELECT COUNT(*) FROM t2;
ALTER TABLE t3 IMPORT TABLESPACE;
-SELECT COUNT(1) FROM t3;
+SELECT COUNT(*) FROM t3;
-# shutdown so that grep is safe
---source include/shutdown_mysqld.inc
+FLUSH TABLES t1, t2, t3 FOR EXPORT;
--echo # tablespaces should remain encrypted after import
--let SEARCH_PATTERN=foobar
@@ -103,28 +97,18 @@ SELECT COUNT(1) FROM t3;
-- let SEARCH_FILE=$t3_IBD
-- source include/search_pattern_in_file.inc
---source include/start_mysqld.inc
-
-ALTER TABLE t1 ENGINE InnoDB;
+UNLOCK TABLES;
+ALTER TABLE t1 FORCE;
SHOW CREATE TABLE t1;
-ALTER TABLE t2 ENGINE InnoDB;
+ALTER TABLE t2 FORCE;
SHOW CREATE TABLE t2;
-ALTER TABLE t3 ENGINE InnoDB;
+ALTER TABLE t3 FORCE;
SHOW CREATE TABLE t3;
---echo # Restarting server
--- source include/restart_mysqld.inc
---echo # Done restarting server
-
--echo # Verify that tables are still usable
-SELECT COUNT(1) FROM t1;
-SELECT COUNT(1) FROM t2;
-SELECT COUNT(1) FROM t3;
-
-# shutdown so that grep is safe
---source include/shutdown_mysqld.inc
+CHECK TABLE t1, t2, t3 EXTENDED;
+FLUSH TABLES t1, t2, t3 FOR EXPORT;
---echo # Tablespaces should be encrypted after restart
--let SEARCH_PATTERN=foobar
--echo # t1 yes on expecting NOT FOUND
-- let SEARCH_FILE=$t1_IBD
@@ -136,19 +120,7 @@ SELECT COUNT(1) FROM t3;
--echo # t3 ... on expecting NOT FOUND
--let SEARCH_PATTERN=barfoo
-- let SEARCH_FILE=$t3_IBD
--- source include/search_pattern_in_file.inc
-
---source include/start_mysqld.inc
-
---echo # Wait max 10 min for key encryption threads to encrypt all spaces
---let $wait_timeout= 600
---let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING <> 0
---source include/wait_condition.inc
---echo # Success!
---echo # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
--- let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=0
--- source include/restart_mysqld.inc
+UNLOCK TABLES;
-DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/engines/funcs/r/db_use_error.result b/mysql-test/suite/engines/funcs/r/db_use_error.result
index a7c76e69..bf5ca852 100644
--- a/mysql-test/suite/engines/funcs/r/db_use_error.result
+++ b/mysql-test/suite/engines/funcs/r/db_use_error.result
@@ -10,7 +10,7 @@ performance_schema
sys
test
USE DATABASE nond6;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATABASE nond6' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nond6' at line 1
DROP DATABASE d6;
SHOW DATABASES;
Database
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
index 8ef10bf4..b4e3704c 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
@@ -51,7 +51,9 @@ ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UN
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
-include/stop_slave.inc
+include/wait_for_slave_io_to_start.inc
+include/wait_for_slave_sql_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
include/start_slave.inc
include/rpl_reset.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
index 33d1abb3..b4d0855a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
@@ -15,7 +15,7 @@ insert into t1 values (1);
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1593'
Last_IO_Error = 'Fatal error: The slave I/O thread stops because master and slave have equal MariaDB server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).'
-include/stop_slave.inc
+include/stop_slave_sql.inc
reset slave;
reset master;
drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_session_var.result b/mysql-test/suite/engines/funcs/r/rpl_session_var.result
index 67863583..f9794df3 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_session_var.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_session_var.result
@@ -1,5 +1,16 @@
include/master-slave.inc
[connection master]
+select @@rpl_semi_sync_master_enabled;
+@@rpl_semi_sync_master_enabled
+0
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+@@rpl_semi_sync_slave_enabled
+0
+show status like "rpl_semi_sync_slave_status";
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+connection master;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
diff --git a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
index 1c81cec2..ef122b9c 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
@@ -36,7 +36,6 @@ connection slave;
include/stop_slave.inc
START SLAVE;
include/wait_for_slave_sql_to_start.inc
-include/wait_for_slave_io_to_stop.inc
==== Verify that Slave IO thread stopped with error ====
include/wait_for_slave_io_error.inc [errno=1045]
==== Cleanup (Note that slave IO thread is not running) ====
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
index 1412db46..8f0248eb 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
@@ -25,7 +25,7 @@ insert into t1 values (1);
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
reset slave;
reset master;
drop table t1;
diff --git a/mysql-test/suite/federated/update.result b/mysql-test/suite/federated/update.result
new file mode 100644
index 00000000..1905f80e
--- /dev/null
+++ b/mysql-test/suite/federated/update.result
@@ -0,0 +1,36 @@
+connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
+connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
+connection master;
+CREATE DATABASE federated;
+connection slave;
+CREATE DATABASE federated;
+#
+# MDEV-32984 Update federated table and column privileges
+#
+connection slave;
+create database db1;
+create user my@localhost identified by '1qaz2wsx';
+create table db1.t1 (
+f1 int auto_increment primary key,
+f2 varchar(50),
+f3 varchar(50),
+unique (f2)
+);
+grant insert, select (f1, f2, f3), update (f3) on db1.t1 to my@localhost;
+connection master;
+create table tt1 engine=federated connection='mysql://my:1qaz2wsx@localhost:$SLAVE_MYPORT/db1/t1';
+insert into tt1 (f2,f3) values ('test','123');
+select * from tt1;
+f1 f2 f3
+1 test 123
+update tt1 set f3='123456' where f2='test';
+drop table tt1;
+connection slave;
+drop database db1;
+drop user my@localhost;
+connection master;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+connection slave;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/update.test b/mysql-test/suite/federated/update.test
new file mode 100644
index 00000000..5a0414f1
--- /dev/null
+++ b/mysql-test/suite/federated/update.test
@@ -0,0 +1,32 @@
+source include/federated.inc;
+source have_federatedx.inc;
+
+--echo #
+--echo # MDEV-32984 Update federated table and column privileges
+--echo #
+connection slave;
+create database db1;
+create user my@localhost identified by '1qaz2wsx';
+create table db1.t1 (
+ f1 int auto_increment primary key,
+ f2 varchar(50),
+ f3 varchar(50),
+ unique (f2)
+);
+grant insert, select (f1, f2, f3), update (f3) on db1.t1 to my@localhost;
+
+connection master;
+evalp create table tt1 engine=federated connection='mysql://my:1qaz2wsx@localhost:$SLAVE_MYPORT/db1/t1';
+insert into tt1 (f2,f3) values ('test','123');
+select * from tt1;
+update tt1 set f3='123456' where f2='test';
+
+drop table tt1;
+
+connection slave;
+drop database db1;
+drop user my@localhost;
+
+source include/federated_cleanup.inc;
+
+
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 90d72b45..5bd48cf9 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -22145,9 +22145,9 @@ DELETE FROM t1;
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f1, f2, f3, 'HELLO' AS my_greeting FROM t1;
INSERT INTO v1 SET f1 = 1;
-ERROR HY000: The target table v1 of the INSERT is not insertable-into
SELECT * from t1;
f1 f2 f3 f4
+1 NULL NULL NULL
DELETE FROM t1;
INSERT INTO v1 SET f1 = 1, my_greeting = 'HELLO';
ERROR HY000: The target table v1 of the INSERT is not insertable-into
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 1a363643..be9d2b4c 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -178,9 +178,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 NULL NO tinyint NULL NULL 3 0
def information_schema GEOMETRY_COLUMNS SRID 13 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL
def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select NEVER NULL
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL
-def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL
+def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) select NEVER NULL
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL
-def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL
+def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) select NEVER NULL
def information_schema INDEX_STATISTICS INDEX_NAME 3 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL
def information_schema INDEX_STATISTICS ROWS_READ 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema INDEX_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) select NEVER NULL
@@ -340,9 +340,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NULL NO varchar 64 192
def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL
def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL
def information_schema SESSION_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL
-def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL
+def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) select NEVER NULL
def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL
-def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select NEVER NULL
+def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) select NEVER NULL
def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(5) select NEVER NULL
def information_schema SPATIAL_REF_SYS SRID 1 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL
@@ -729,9 +729,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL
NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2)
NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8mb3 utf8mb3_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8mb3 utf8mb3_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8mb3 utf8mb3_general_ci varchar(192)
@@ -891,9 +891,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8mb3 utf8mb3_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index 676d0ed5..79c43e18 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -178,9 +178,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 NULL NO tinyint NULL NULL 3 0
def information_schema GEOMETRY_COLUMNS SRID 13 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL
def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 NULL NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) NEVER NULL
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL
-def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL
+def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) NEVER NULL
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL
-def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL
+def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) NEVER NULL
def information_schema INDEX_STATISTICS INDEX_NAME 3 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL
def information_schema INDEX_STATISTICS ROWS_READ 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema INDEX_STATISTICS TABLE_NAME 2 NULL NO varchar 192 576 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(192) NEVER NULL
@@ -340,9 +340,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NULL NO varchar 64 192
def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL
def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL
def information_schema SESSION_STATUS VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL
-def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL
+def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) NEVER NULL
def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL
-def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) NEVER NULL
+def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL NO varchar 4096 12288 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(4096) NEVER NULL
def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(5) NEVER NULL
def information_schema SPATIAL_REF_SYS SRID 1 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL
@@ -729,9 +729,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL
NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2)
NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8mb3 utf8mb3_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8mb3 utf8mb3_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8mb3 utf8mb3_general_ci varchar(192)
@@ -891,9 +891,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet
3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8mb3 utf8mb3_general_ci varchar(3)
3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64)
-3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8mb3 utf8mb3_general_ci varchar(2048)
+3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 4096 12288 utf8mb3 utf8mb3_general_ci varchar(4096)
NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5)
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5)
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 417c0e85..8ce1e1c7 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -22147,9 +22147,9 @@ DELETE FROM t1;
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f1, f2, f3, 'HELLO' AS my_greeting FROM t1;
INSERT INTO v1 SET f1 = 1;
-ERROR HY000: The target table v1 of the INSERT is not insertable-into
SELECT * from t1;
f1 f2 f3 f4
+1 NULL NULL NULL
DELETE FROM t1;
INSERT INTO v1 SET f1 = 1, my_greeting = 'HELLO';
ERROR HY000: The target table v1 of the INSERT is not insertable-into
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index efd5ee1c..984ae74f 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -23849,9 +23849,9 @@ DELETE FROM t1;
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f1, f2, f3, 'HELLO' AS my_greeting FROM t1;
INSERT INTO v1 SET f1 = 1;
-ERROR HY000: The target table v1 of the INSERT is not insertable-into
SELECT * from t1;
f1 f2 f3 f4
+1 NULL NULL NULL
DELETE FROM t1;
INSERT INTO v1 SET f1 = 1, my_greeting = 'HELLO';
ERROR HY000: The target table v1 of the INSERT is not insertable-into
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 6b103847..39be8c82 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -2088,9 +2088,11 @@ SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cursor()
SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE database()
-SELECT * from t1 where f2=f1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database()
-SELECT * from t1 where f2=f1' at line 1
+SELECT 1;
+CALL database();
+1
+1
+DROP PROCEDURE database;
CREATE PROCEDURE databases()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'databases()
@@ -2350,6 +2352,12 @@ CREATE PROCEDURE join()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'join()
SELECT * from t1 where f2=f1' at line 1
+CREATE PROCEDURE json_table()
+SELECT 1;
+CALL json_table();
+1
+1
+DROP PROCEDURE json_table;
CREATE PROCEDURE key()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key()
@@ -2470,6 +2478,12 @@ CREATE PROCEDURE natural()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'natural()
SELECT * from t1 where f2=f1' at line 1
+CREATE PROCEDURE nested()
+SELECT 1;
+CALL nested();
+1
+1
+DROP PROCEDURE nested;
CREATE PROCEDURE not()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not()
@@ -2509,6 +2523,12 @@ CREATE PROCEDURE order()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order()
SELECT * from t1 where f2=f1' at line 1
+CREATE PROCEDURE ordinality()
+SELECT 1;
+CALL ordinality;
+1
+1
+DROP PROCEDURE ordinality;
CREATE PROCEDURE out()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out()
@@ -2521,6 +2541,12 @@ CREATE PROCEDURE outfile()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'outfile()
SELECT * from t1 where f2=f1' at line 1
+CREATE PROCEDURE path()
+SELECT 1;
+CALL path();
+1
+1
+DROP PROCEDURE path;
CREATE PROCEDURE precision()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision()
@@ -2602,9 +2628,11 @@ SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rlike()
SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE schema()
-SELECT * from t1 where f2=f1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema()
-SELECT * from t1 where f2=f1' at line 1
+SELECT 1;
+CALL schema();
+1
+1
+DROP PROCEDURE schema;
CREATE PROCEDURE schemas()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schemas()
@@ -4204,9 +4232,6 @@ CREATE PROCEDURE sp1()
database:BEGIN
SELECT @x;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database:BEGIN
-SELECT @x;
-END' at line 2
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
databases:BEGIN
@@ -4737,6 +4762,11 @@ SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
+json_table:BEGIN
+SELECT @x;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
key:BEGIN
SELECT @x;
END//
@@ -4977,6 +5007,11 @@ SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
+nested:BEGIN
+SELECT @x;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
not:BEGIN
SELECT @x;
END//
@@ -5057,6 +5092,11 @@ SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
+ordinality:BEGIN
+SELECT @x;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
out:BEGIN
SELECT @x;
END//
@@ -5081,6 +5121,11 @@ SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
+path:BEGIN
+SELECT @x;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
precision:BEGIN
SELECT @x;
END//
@@ -5253,9 +5298,6 @@ CREATE PROCEDURE sp1()
schema:BEGIN
SELECT @x;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema:BEGIN
-SELECT @x;
-END' at line 2
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
schemas:BEGIN
@@ -7811,8 +7853,6 @@ CREATE PROCEDURE sp1()
BEGIN
declare database char;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database char;
-END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -8278,6 +8318,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
+declare json_table char;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
+BEGIN
declare key char;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key char;
@@ -8488,6 +8533,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
+declare nested char;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
+BEGIN
declare not char;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not char;
@@ -8556,6 +8606,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
+declare ordinality char;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
+BEGIN
declare out char;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out char;
@@ -8577,6 +8632,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
+declare path char;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1()
+BEGIN
declare precision char;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision char;
@@ -8745,11 +8805,7 @@ CREATE PROCEDURE sp1()
BEGIN
declare schema char;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema char;
-END' at line 3
DROP PROCEDURE IF EXISTS sp1;
-Warnings:
-Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1()
BEGIN
declare schemas char;
@@ -9704,11 +9760,7 @@ BEGIN
declare database condition for sqlstate '02000';
declare exit handler for database set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database condition for sqlstate '02000';
-declare exit handler for database se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
-Warnings:
-Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
declare databases condition for sqlstate '02000';
@@ -10372,6 +10424,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare json_table condition for sqlstate '02000';
+declare exit handler for json_table set @var2 = 1;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1( )
+BEGIN
declare key condition for sqlstate '02000';
declare exit handler for key set @var2 = 1;
END//
@@ -10672,6 +10730,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare nested condition for sqlstate '02000';
+declare exit handler for nested set @var2 = 1;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1( )
+BEGIN
declare not condition for sqlstate '02000';
declare exit handler for not set @var2 = 1;
END//
@@ -10768,6 +10832,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare ordinality condition for sqlstate '02000';
+declare exit handler for ordinality set @var2 = 1;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1( )
+BEGIN
declare out condition for sqlstate '02000';
declare exit handler for out set @var2 = 1;
END//
@@ -10798,6 +10868,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare path condition for sqlstate '02000';
+declare exit handler for path set @var2 = 1;
+END//
+DROP PROCEDURE sp1;
+CREATE PROCEDURE sp1( )
+BEGIN
declare precision condition for sqlstate '02000';
declare exit handler for precision set @var2 = 1;
END//
@@ -11021,11 +11097,7 @@ BEGIN
declare schema condition for sqlstate '02000';
declare exit handler for schema set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema condition for sqlstate '02000';
-declare exit handler for schema set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
-Warnings:
-Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
declare schemas condition for sqlstate '02000';
@@ -11974,8 +12046,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare database handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database handler for sqlstate '02000' set @var2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -12571,6 +12642,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare json_table handler for sqlstate '02000' set @var2 = 1;
+END//
+ERROR HY000: Unknown data type: 'handler'
+CREATE PROCEDURE sp1( )
+BEGIN
declare key handler for sqlstate '02000' set @var2 = 1;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key handler for sqlstate '02000' set @var2 = 1;
@@ -12841,6 +12917,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare nested handler for sqlstate '02000' set @var2 = 1;
+END//
+ERROR HY000: Unknown data type: 'handler'
+CREATE PROCEDURE sp1( )
+BEGIN
declare not handler for sqlstate '02000' set @var2 = 1;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not handler for sqlstate '02000' set @var2 = 1;
@@ -12930,6 +13011,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare ordinality handler for sqlstate '02000' set @var2 = 1;
+END//
+ERROR HY000: Unknown data type: 'handler'
+CREATE PROCEDURE sp1( )
+BEGIN
declare out handler for sqlstate '02000' set @var2 = 1;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out handler for sqlstate '02000' set @var2 = 1;
@@ -12957,6 +13043,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
+declare path handler for sqlstate '02000' set @var2 = 1;
+END//
+ERROR HY000: Unknown data type: 'handler'
+CREATE PROCEDURE sp1( )
+BEGIN
declare precision handler for sqlstate '02000' set @var2 = 1;
END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision handler for sqlstate '02000' set @var2 = 1;
@@ -13164,8 +13255,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare schema handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema handler for sqlstate '02000' set @var2 = 1;
-END' at line 3
+ERROR HY000: Unknown data type: 'handler'
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test
index 8712919e..e9c00742 100644
--- a/mysql-test/suite/funcs_1/t/storedproc.test
+++ b/mysql-test/suite/funcs_1/t/storedproc.test
@@ -1102,9 +1102,11 @@ CREATE PROCEDURE current_user()
CREATE PROCEDURE cursor()
SELECT * from t1 where f2=f1;
---error ER_PARSE_ERROR
CREATE PROCEDURE database()
- SELECT * from t1 where f2=f1;
+ SELECT 1;
+
+CALL database();
+DROP PROCEDURE database;
--error ER_PARSE_ERROR
CREATE PROCEDURE databases()
@@ -1367,6 +1369,12 @@ CREATE PROCEDURE iterate()
CREATE PROCEDURE join()
SELECT * from t1 where f2=f1;
+CREATE PROCEDURE json_table()
+ SELECT 1;
+
+CALL json_table();
+DROP PROCEDURE json_table;
+
--error ER_PARSE_ERROR
CREATE PROCEDURE key()
SELECT * from t1 where f2=f1;
@@ -1487,6 +1495,13 @@ CREATE PROCEDURE modifies()
CREATE PROCEDURE natural()
SELECT * from t1 where f2=f1;
+CREATE PROCEDURE nested()
+ SELECT 1;
+
+CALL nested();
+
+DROP PROCEDURE nested;
+
--error ER_PARSE_ERROR
CREATE PROCEDURE not()
SELECT * from t1 where f2=f1;
@@ -1527,6 +1542,13 @@ CREATE PROCEDURE or()
CREATE PROCEDURE order()
SELECT * from t1 where f2=f1;
+CREATE PROCEDURE ordinality()
+ SELECT 1;
+
+CALL ordinality;
+
+DROP PROCEDURE ordinality;
+
--error ER_PARSE_ERROR
CREATE PROCEDURE out()
SELECT * from t1 where f2=f1;
@@ -1539,6 +1561,13 @@ CREATE PROCEDURE outer()
CREATE PROCEDURE outfile()
SELECT * from t1 where f2=f1;
+CREATE PROCEDURE path()
+ SELECT 1;
+
+CALL path();
+
+DROP PROCEDURE path;
+
--error ER_PARSE_ERROR
CREATE PROCEDURE precision()
SELECT * from t1 where f2=f1;
@@ -1619,9 +1648,11 @@ CREATE PROCEDURE right()
CREATE PROCEDURE rlike()
SELECT * from t1 where f2=f1;
---error ER_PARSE_ERROR
CREATE PROCEDURE schema()
- SELECT * from t1 where f2=f1;
+ SELECT 1;
+
+CALL schema();
+DROP PROCEDURE schema;
--error ER_PARSE_ERROR
CREATE PROCEDURE schemas()
@@ -3481,7 +3512,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1()
database:BEGIN
SELECT @x;
@@ -4285,6 +4316,15 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+CREATE PROCEDURE sp1()
+ json_table:BEGIN
+ SELECT @x;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
key:BEGIN
@@ -4645,6 +4685,16 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+ nested:BEGIN
+ SELECT @x;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
not:BEGIN
@@ -4766,6 +4816,16 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+ ordinality:BEGIN
+ SELECT @x;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
out:BEGIN
@@ -4802,6 +4862,16 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+ path:BEGIN
+ SELECT @x;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
precision:BEGIN
@@ -5066,7 +5136,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1()
schema:BEGIN
SELECT @x;
@@ -8938,7 +9008,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1()
BEGIN
declare database char;
@@ -9736,12 +9806,21 @@ BEGIN
declare join char;
END//
delimiter ;//
-
--disable_warnings
DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+BEGIN
+ declare json_table char;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
BEGIN
@@ -10102,6 +10181,16 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+BEGIN
+ declare nested char;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
BEGIN
@@ -10221,6 +10310,16 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+BEGIN
+ declare ordinality char;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
BEGIN
@@ -10257,6 +10356,16 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
+
+CREATE PROCEDURE sp1()
+BEGIN
+ declare path char;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
BEGIN
@@ -10506,7 +10615,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1()
BEGIN
declare schema char;
@@ -11624,7 +11733,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1( )
BEGIN
declare database condition for sqlstate '02000';
@@ -12361,6 +12470,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare json_table condition for sqlstate '02000';
+ declare exit handler for json_table set @var2 = 1;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -12691,6 +12811,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare nested condition for sqlstate '02000';
+ declare exit handler for nested set @var2 = 1;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -12800,6 +12931,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare ordinality condition for sqlstate '02000';
+ declare exit handler for ordinality set @var2 = 1;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -12833,6 +12975,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare path condition for sqlstate '02000';
+ declare exit handler for path set @var2 = 1;
+END//
+delimiter ;//
+
+DROP PROCEDURE sp1;
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -13075,7 +13228,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1( )
BEGIN
declare schema condition for sqlstate '02000';
@@ -14181,7 +14334,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+
CREATE PROCEDURE sp1( )
BEGIN
declare database handler for sqlstate '02000' set @var2 = 1;
@@ -14851,6 +15004,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+--error ER_UNKNOWN_DATA_TYPE
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare json_table handler for sqlstate '02000' set @var2 = 1;
+END//
+delimiter ;//
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -15151,6 +15312,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+--error ER_UNKNOWN_DATA_TYPE
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare nested handler for sqlstate '02000' set @var2 = 1;
+END//
+delimiter ;//
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -15251,6 +15420,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+--error ER_UNKNOWN_DATA_TYPE
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare ordinality handler for sqlstate '02000' set @var2 = 1;
+END//
+delimiter ;//
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -15281,6 +15458,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
+--error ER_UNKNOWN_DATA_TYPE
+CREATE PROCEDURE sp1( )
+BEGIN
+ declare path handler for sqlstate '02000' set @var2 = 1;
+END//
+delimiter ;//
+
+delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
@@ -15511,7 +15696,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
+--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare schema handler for sqlstate '02000' set @var2 = 1;
diff --git a/mysql-test/suite/funcs_1/views/views_master.inc b/mysql-test/suite/funcs_1/views/views_master.inc
index 526e9e34..0e175db4 100644
--- a/mysql-test/suite/funcs_1/views/views_master.inc
+++ b/mysql-test/suite/funcs_1/views/views_master.inc
@@ -3085,8 +3085,10 @@ eval SHOW CREATE VIEW test1.v$level;
# the following line as written as '--eror ER_TOO_MANY_TABLES' and the command
# is successful so assuming no expected error was intended
# --error ER_TOO_MANY_TABLES
+--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$level;
+--enable_ps2_protocol
let $message= The output of following EXPLAIN is deactivated, because the result
differs on some platforms
FIXME Is this a bug ? ;
@@ -3116,16 +3118,20 @@ SELECT f1 as f2, f2 as f1 FROM test2.t1;
CREATE OR REPLACE VIEW test2.v0 AS
SELECT CAST('0001-01-01' AS DATE) as f1, f2 FROM test3.t1;
eval SHOW CREATE VIEW test1.v$toplevel;
+--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
+--enable_ps2_protocol
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
# 2.3.3 UCS2 string instead of common string
CREATE OR REPLACE VIEW test3.v0 AS
SELECT f1 , CONVERT('ßÄäÖöÜü§' USING UCS2) as f2 FROM test1.t1;
eval SHOW CREATE VIEW test1.v$toplevel;
+--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
+--enable_ps2_protocol
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
@@ -3133,8 +3139,10 @@ eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CREATE OR REPLACE VIEW test3.v0 AS
SELECT CONVERT('ßÄäÖöÜü§' USING UCS2) as f1, f2 FROM test1.t1;
eval SHOW CREATE VIEW test1.v$toplevel;
+--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
+--enable_ps2_protocol
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
--enable_result_log
@@ -3479,7 +3487,6 @@ CREATE VIEW v1 AS SELECT f1, f2, f3, 'HELLO' AS my_greeting FROM t1;
# Maybe the SQL standard allows the following INSERT.
# But it would be a very sophisticated DBMS.
---error ER_NON_INSERTABLE_TABLE
INSERT INTO v1 SET f1 = 1;
SELECT * from t1;
DELETE FROM t1;
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 773cde8e..d6b30bba 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -12,12 +12,19 @@
galera_as_slave_ctas : MDEV-28378 timeout
galera_pc_recovery : MDEV-25199 cluster fails to start up
-galera_sst_encrypted : MDEV-29876 Galera test failure on galera_sst_encrypted
-galera_var_node_address : MDEV-20485 Galera test failure
galera_bf_kill_debug : timeout after 900 seconds
galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos'
galera_parallel_simple : timeout related to wsrep_sync_wait
galera_insert_bulk : MDEV-30536 no expected deadlock in galera_insert_bulk test
-versioning_trx_id : MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
-galera_sequences : MDEV-32024
+galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED
+galera_shutdown_nonprim : MDEV-32635 galera_shutdown_nonprim: mysql_shutdown failed
+versioning_trx_id : MDEV-18590 : galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
+galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert()
+galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
+galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
+galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test failed
mdev-31285 : MDEV-25089 Assertion `error.len > 0' failed in galera::ReplicatorSMM::handle_apply_error()
+galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes
+MW-402 : temporarily disabled at the request of Codership
+MDEV-22232 : temporarily disabled at the request of Codership
+galera_desync_overlapped : MDEV-21538 galera_desync_overlapped MTR failed: Result content mismatch
diff --git a/mysql-test/suite/galera/r/MDEV-22232.result b/mysql-test/suite/galera/r/MDEV-22232.result
new file mode 100644
index 00000000..a6a61945
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22232.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1;
+--- CTAS with empty result set ---
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_alter WAIT_FOR bf_abort';
+CREATE TABLE t2 SELECT * FROM t1;
+connection node_1;
+SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
+ALTER TABLE t1 DROP FOREIGN KEY b, ALGORITHM=COPY;
+connection con1;
+ERROR 70100: Query execution was interrupted
+SET DEBUG_SYNC = 'RESET';
+--- CTAS with non-empty result set ---
+INSERT INTO t1 VALUES (10), (20), (30);
+SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_alter WAIT_FOR bf_abort';
+CREATE TABLE t2 SELECT * FROM t1;
+connection node_1;
+SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
+ALTER TABLE t1 DROP FOREIGN KEY b, ALGORITHM=COPY;
+connection con1;
+ERROR 70100: Query execution was interrupted
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+disconnect con1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/MDEV-27806.result b/mysql-test/suite/galera/r/MDEV-27806.result
new file mode 100644
index 00000000..0f7ac79e
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-27806.result
@@ -0,0 +1,52 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE ts1 AS SELECT * FROM t1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000002 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000002 # Query # # use `test`; CREATE TABLE `ts1` (
+ `f1` int(11) NOT NULL
+)
+mysqld-bin.000002 # Annotate_rows # # CREATE TABLE ts1 AS SELECT * FROM t1
+mysqld-bin.000002 # Table_map # # table_id: # (test.ts1)
+mysqld-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000002 # Xid # # COMMIT /* XID */
+connection node_2;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000003 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000003 # Query # # use `test`; CREATE TABLE `ts1` (
+ `f1` int(11) NOT NULL
+)
+mysqld-bin.000003 # Annotate_rows # # CREATE TABLE ts1 AS SELECT * FROM t1
+mysqld-bin.000003 # Table_map # # table_id: # (test.ts1)
+mysqld-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000003 # Xid # # COMMIT /* XID */
+BINLOG_POSITIONS_MATCH
+1
+DROP TABLE t1,ts1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE ts1 AS SELECT * FROM t1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000002 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000002 # Query # # use `test`; CREATE TABLE `ts1` (
+ `f1` int(11) NOT NULL
+)
+mysqld-bin.000002 # Xid # # COMMIT /* XID */
+connection node_2;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000003 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000003 # Query # # use `test`; CREATE TABLE `ts1` (
+ `f1` int(11) NOT NULL
+)
+mysqld-bin.000003 # Query # # COMMIT
+BINLOG_POSITIONS_MATCH
+1
+DROP TABLE t1,ts1;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/MDEV-31272.result b/mysql-test/suite/galera/r/MDEV-31272.result
new file mode 100644
index 00000000..e8469bc7
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-31272.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 int primary key, f2 int);
+INSERT INTO t1 VALUES (1,0);
+BEGIN;
+INSERT INTO t1 VALUES (2,4),(1,1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+COMMIT;
+Writesets replicated (expect 0)
+0
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 0
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 0
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER);
+INSERT INTO t1 VALUES (1,0);
+INSERT INTO t1 VALUES (2,4), (1,1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+Writesets replicated (expect 0)
+0
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 0
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-32549.result b/mysql-test/suite/galera/r/MDEV-32549.result
new file mode 100644
index 00000000..65c81819
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-32549.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) engine=innodb;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) engine=aria;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t2;
+f1
+SAVEPOINT s1;
+ERROR 42000: The storage engine for the table doesn't support SAVEPOINT
+INSERT INTO t1 VALUES (2);
+COMMIT;
+connection node_1;
+SELECT * FROM t1;
+f1
+1
+2
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+connection node_1;
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/r/MDEV-32938.result b/mysql-test/suite/galera/r/MDEV-32938.result
new file mode 100644
index 00000000..5e310eb7
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-32938.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1;
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
+SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter WAIT_FOR bf_abort';
+ALTER TABLE t1 DROP COLUMN c2;
+connection node_1;
+SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
+ALTER TABLE t1 ADD COLUMN c3 INT;
+connection con1;
+ERROR 70100: Query execution was interrupted
+INSERT INTO t1 (c1, c2, c3) VALUES (1, 0, 0);
+connection node_2;
+INSERT INTO t1 (c1, c2, c3) VALUES (2, 0, 0);
+connection node_1;
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+disconnect con1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result
index b16addc5..8dc473fa 100644
--- a/mysql-test/suite/galera/r/MW-388.result
+++ b/mysql-test/suite/galera/r/MW-388.result
@@ -47,4 +47,4 @@ SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync
-ON - current signal: ''
+ON - current signals: ''
diff --git a/mysql-test/suite/galera/r/MW-86-wait1.result b/mysql-test/suite/galera/r/MW-86-wait1.result
index 8ad9c8bf..f70e9e0a 100644
--- a/mysql-test/suite/galera/r/MW-86-wait1.result
+++ b/mysql-test/suite/galera/r/MW-86-wait1.result
@@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug;
connection node_2;
SELECT @@debug_sync;
@@debug_sync
-ON - current signal: ''
+ON - current signals: ''
set debug_sync='RESET';
SET SESSION wsrep_sync_wait = 1;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
@@ -45,4 +45,4 @@ SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait1;
SELECT @@debug_sync;
@@debug_sync
-ON - current signal: ''
+ON - current signals: ''
diff --git a/mysql-test/suite/galera/r/MW-86-wait8.result b/mysql-test/suite/galera/r/MW-86-wait8.result
index 07e59ebb..f2aa34fa 100644
--- a/mysql-test/suite/galera/r/MW-86-wait8.result
+++ b/mysql-test/suite/galera/r/MW-86-wait8.result
@@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug;
connection node_2;
SELECT @@debug_sync;
@@debug_sync
-ON - current signal: ''
+ON - current signals: ''
SET SESSION wsrep_sync_wait = 8;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_1;
@@ -46,4 +46,4 @@ SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait8;
SELECT @@debug_sync;
@@debug_sync
-ON - current signal: ''
+ON - current signals: ''
diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result
index 4aca328b..dd3e0173 100644
--- a/mysql-test/suite/galera/r/galera_as_master.result
+++ b/mysql-test/suite/galera/r/galera_as_master.result
@@ -52,6 +52,8 @@ DROP TABLE t1, t4;
SET SQL_LOG_BIN=OFF;
DROP TABLE t2, t3;
connection node_3;
+BINLOG_POSITIONS_MATCH
+1
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
index 757fbf50..9e5cb2d9 100644
--- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result
+++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
@@ -33,6 +33,26 @@ SET SESSION wsrep_sync_wait=0;
call p1(1000);
connection node_1;
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
+include/assert_grep.inc [BF lock wait long]
connection node_1_p1;
connection node_1_p2;
connection node_2_p1;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
index 76f16791..de891686 100644
--- a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
@@ -100,19 +100,19 @@ Killing server ...
connection node_1;
Killing server ...
connection node_1_insert_simple;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1_insert_multi;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1_insert_transaction;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1_update_simple;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1_insert_1k;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1_insert_1m;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1_insert_10m;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_1;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result b/mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result
new file mode 100644
index 00000000..955d5af7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+connection node_2;
+# Verify that graceful shutdown succeeds...
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+connection node_2;
+# Start node_2 again...
+SELECT * FROM t1;
+f1
+1
+2
+3
+connection node_1;
+include/assert_grep.inc [mariabackup IST completed on joiner]
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result b/mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result
new file mode 100644
index 00000000..51dfa7bc
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+connection node_2;
+# Verify that graceful shutdown succeeds...
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+connection node_2;
+# Start node_2 again...
+SELECT * FROM t1;
+f1
+1
+2
+3
+connection node_1;
+include/assert_grep.inc [rsync IST completed on joiner]
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_myisam_autocommit.result b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
index 6213e8f6..b80af779 100644
--- a/mysql-test/suite/galera/r/galera_myisam_autocommit.result
+++ b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
@@ -1,5 +1,6 @@
connection node_2;
connection node_1;
+SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2), (3);
@@ -22,6 +23,8 @@ COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0
-1
+0
+connection node_1;
DROP TABLE t1;
DROP TABLE t2;
+SET GLOBAL wsrep_mode=DEFAULT;
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 eee740b6..50667b0a 100644
--- a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
+++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
@@ -36,10 +36,7 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
-connection node_1;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-0
+1
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index 2ef45b24..f6caecdc 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -71,13 +71,17 @@ push @::global_suppressions,
sub which($) { return `sh -c "command -v $_[0]"` }
sub skip_combinations {
- my %skip = ();
+ my @combinations;
+
$skip{'include/have_mariabackup.inc'} = 'Need socket statistics utility'
unless which("lsof") || which("sockstat") || which("ss");
$skip{'include/have_stunnel.inc'} = "Need 'stunnel' utility"
unless which("stunnel");
$skip{'include/have_qpress.inc'} = "Need 'qpress' utility"
unless which("qpress");
+ $skip{'../encryption/include/have_file_key_management_plugin.combinations'} = [ 'ctr' ]
+ unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/
+ and $1 ge "1.0.1";
%skip;
}
diff --git a/mysql-test/suite/galera/t/MDEV-22232.test b/mysql-test/suite/galera/t/MDEV-22232.test
new file mode 100644
index 00000000..dbd9ed1e
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-22232.test
@@ -0,0 +1,72 @@
+#
+# MDEV-22232: CTAS execution crashes during replay.
+#
+# There were multiple problems and two failing scenarios with empty result set
+# and with non-empty result set:
+# - CTAS didn't add shared keys for selected tables
+# - Security context wasn't set on the replayer thread
+# - CTAS was retried after failure - now retry disabled
+
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+--source include/have_debug.inc
+
+--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1
+
+# Scenario 1
+--echo --- CTAS with empty result set ---
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+
+# Run CTAS until the resulting table gets created,
+# then it gets BF aborted by ALTER.
+SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_alter WAIT_FOR bf_abort';
+--send
+ CREATE TABLE t2 SELECT * FROM t1;
+
+# Wait for CTAS to reach the table create point,
+# start executing ALTER and BF abort CTAS.
+--connection node_1
+SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
+--disable_result_log
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t1 DROP FOREIGN KEY b, ALGORITHM=COPY;
+--enable_result_log
+
+--connection con1
+# CTAS gets BF aborted.
+--error ER_QUERY_INTERRUPTED
+--reap
+
+# Cleanup
+SET DEBUG_SYNC = 'RESET';
+
+
+# Scenario 2
+--echo --- CTAS with non-empty result set ---
+INSERT INTO t1 VALUES (10), (20), (30);
+
+# Run CTAS until the resulting table gets created,
+# then it gets BF aborted by ALTER.
+SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_alter WAIT_FOR bf_abort';
+--send
+ CREATE TABLE t2 SELECT * FROM t1;
+
+# Wait for CTAS to reach the table create point,
+# start executing ALTER and BF abort CTAS.
+--connection node_1
+SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
+--disable_result_log
+--error ER_ERROR_ON_RENAME
+ALTER TABLE t1 DROP FOREIGN KEY b, ALGORITHM=COPY;
+--enable_result_log
+
+--connection con1
+# CTAS gets BF aborted.
+--error ER_QUERY_INTERRUPTED
+--reap
+
+# Cleanup
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+--disconnect con1
+--source include/galera_end.inc
diff --git a/mysql-test/suite/galera/t/MDEV-27806.opt b/mysql-test/suite/galera/t/MDEV-27806.opt
new file mode 100644
index 00000000..009e761e
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-27806.opt
@@ -0,0 +1 @@
+--log-bin --log-slave-updates --gtid-strict-mode --wsrep_gtid_mode=on
diff --git a/mysql-test/suite/galera/t/MDEV-27806.test b/mysql-test/suite/galera/t/MDEV-27806.test
new file mode 100644
index 00000000..62a0ca48
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-27806.test
@@ -0,0 +1,51 @@
+#
+# MDEV-27806 GTIDs diverge after CTAS
+#
+--source include/galera_cluster.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE ts1 AS SELECT * FROM t1;
+--let binlog_pos= `SELECT @@gtid_binlog_pos`
+
+--let $MASTER_MYPORT=$NODE_MYPORT_1
+--let $binlog_file=LAST
+--let $binlog_limit=8,20
+--source include/show_binlog_events.inc
+
+--connection node_2
+--let $binlog_limit=7,20
+--source include/show_binlog_events.inc
+
+--disable_query_log
+--eval SELECT STRCMP(@@gtid_binlog_pos, "$binlog_pos") = 0 AS BINLOG_POSITIONS_MATCH;
+--enable_query_log
+
+DROP TABLE t1,ts1;
+
+
+#
+# Same as above, with empty CREATE TABLE AS SELECT
+#
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE ts1 AS SELECT * FROM t1;
+--let binlog_pos= `SELECT @@gtid_binlog_pos`
+
+--let $MASTER_MYPORT=$NODE_MYPORT_1
+--let $binlog_file=LAST
+--let $binlog_limit=18,20
+--source include/show_binlog_events.inc
+
+--connection node_2
+--let $binlog_limit=17,20
+--source include/show_binlog_events.inc
+
+--disable_query_log
+--eval SELECT STRCMP(@@gtid_binlog_pos, "$binlog_pos") = 0 AS BINLOG_POSITIONS_MATCH;
+--enable_query_log
+
+DROP TABLE t1,ts1;
+
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/t/MDEV-27862.test b/mysql-test/suite/galera/t/MDEV-27862.test
index d23ce95d..f19d6b5d 100644
--- a/mysql-test/suite/galera/t/MDEV-27862.test
+++ b/mysql-test/suite/galera/t/MDEV-27862.test
@@ -1,6 +1,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--disable_ps2_protocol
+
# NEXTVAL
--connection node_1
@@ -54,3 +56,4 @@ SELECT NEXTVAL(seq_transaction) = 4;
DROP SEQUENCE seq_transaction;
DROP TABLE t1;
+--enable_ps2_protocol
diff --git a/mysql-test/suite/galera/t/MDEV-31272.combinations b/mysql-test/suite/galera/t/MDEV-31272.combinations
new file mode 100644
index 00000000..def4dda7
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-31272.combinations
@@ -0,0 +1,5 @@
+[binlogon]
+log-bin
+log-slave-updates=ON
+
+[binlogoff]
diff --git a/mysql-test/suite/galera/t/MDEV-31272.test b/mysql-test/suite/galera/t/MDEV-31272.test
new file mode 100644
index 00000000..d2c82378
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-31272.test
@@ -0,0 +1,58 @@
+#
+# MDEV-31272: Statement rollback causes empty writeset replication
+#
+
+--source include/galera_cluster.inc
+
+#
+# Case 1: Multi statement transaction
+#
+--connection node_1
+CREATE TABLE t1 (f1 int primary key, f2 int);
+INSERT INTO t1 VALUES (1,0);
+
+--let $replicated_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
+
+BEGIN;
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (2,4),(1,1);
+COMMIT;
+
+--let $replicated_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
+
+--disable_query_log
+--eval SELECT $replicated_new - $replicated_old AS 'Writesets replicated (expect 0)';
+--enable_query_log
+
+--connection node_1
+SELECT * FROM t1;
+--connection node_2
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+
+#
+# Case 2: autocommit statement
+#
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER);
+INSERT INTO t1 VALUES (1,0);
+
+--let $replicated_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
+
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (2,4), (1,1);
+
+--let $replicated_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
+
+--disable_query_log
+--eval SELECT $replicated_new - $replicated_old AS 'Writesets replicated (expect 0)';
+--enable_query_log
+
+--connection node_1
+SELECT * FROM t1;
+--connection node_2
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MDEV-32549.test b/mysql-test/suite/galera/t/MDEV-32549.test
new file mode 100644
index 00000000..a2faa46d
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-32549.test
@@ -0,0 +1,28 @@
+#
+# MDEV-32549: Cluster is inconsitent after savepoint
+# statement is rolled back
+#
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) engine=innodb;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) engine=aria;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t2;
+--error ER_CHECK_NOT_IMPLEMENTED
+SAVEPOINT s1;
+INSERT INTO t1 VALUES (2);
+COMMIT;
+
+--connection node_1
+SELECT * FROM t1;
+
+# If bug is present: only the second INSERT
+# is replicated, causing an inconsistent
+# cluster.
+--connection node_2
+SELECT * FROM t1;
+
+--connection node_1
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/t/MDEV-32938.test b/mysql-test/suite/galera/t/MDEV-32938.test
new file mode 100644
index 00000000..cb41f21a
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-32938.test
@@ -0,0 +1,57 @@
+#
+# MDEV-32938: ALTER command is replicated and successfully applied while being BF-aborted locally.
+#
+# Why it happend:
+# - ALTER went to prepare FK-referenced tables as TOI keys
+# - to do this, it would open the main table with SHARED_HIGH_PRIO MDL lock which disregarded any
+# other locks (including X-lock) waiting in the queue in case someone was already holding a
+# compatible lock type (like any DML operation)
+# - if there was other TOI operation on the same table, it would go through BF-abort cycle to grab
+# the lock for itself
+# - since the initial ALTER had not reached TOI yet, it would loose to real TOI operation and got
+# BF-aborted with its THD marked as killed
+# - then, ALTER would enter TOI and get replicated with no checks that it has already been aborted
+# - after entering TOI mode, it would later find it'd been killed, and complete with an error
+# - at the same time, the command would successfully apply on every other node except the initiator.
+#
+# Fixed by checking killed state on THD before entering TOI.
+#
+
+--source include/galera_cluster.inc
+--source include/have_debug_sync.inc
+--source include/have_debug.inc
+
+--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1
+
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+
+CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
+
+# Run ALTER DROP COLUMN and hang before closing tables on adding FK keys and before entering TOI.
+# Wait until it gets BF-aborted.
+SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter WAIT_FOR bf_abort';
+--send
+ ALTER TABLE t1 DROP COLUMN c2;
+
+--connection node_1
+# Run ALTER ADD COLUMN and BF-abort the previous ALTER DROP COLUMN.
+SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
+ALTER TABLE t1 ADD COLUMN c3 INT;
+
+--connection con1
+# ALTER DROP COLUMN gets BF aborted.
+--error ER_QUERY_INTERRUPTED
+--reap
+
+INSERT INTO t1 (c1, c2, c3) VALUES (1, 0, 0);
+
+--connection node_2
+# ALTER DROP COLUMN must not be replicated.
+INSERT INTO t1 (c1, c2, c3) VALUES (2, 0, 0);
+
+# Cleanup.
+--connection node_1
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+--disconnect con1
+--source include/galera_end.inc
diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test
index 1c439fff..a5554a73 100644
--- a/mysql-test/suite/galera/t/galera_as_master.test
+++ b/mysql-test/suite/galera/t/galera_as_master.test
@@ -52,12 +52,18 @@ DROP TABLE t1, t4;
SET SQL_LOG_BIN=OFF;
DROP TABLE t2, t3;
+--let binlog_pos=`SELECT @@gtid_binlog_pos;`
+
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't4';
--source include/wait_condition.inc
+--disable_query_log
+--eval SELECT STRCMP(@@gtid_binlog_pos, "$binlog_pos") = 0 AS BINLOG_POSITIONS_MATCH;
+--enable_query_log
+
STOP SLAVE;
RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test
index 0562b436..8ef2fee7 100644
--- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test
+++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test
@@ -52,6 +52,12 @@ let $counter=10;
let $sleep_period=10;
echo checking error log for 'BF lock wait long' message for $counter times every $sleep_period seconds ...;
+
+--let assert_text= BF lock wait long
+--let assert_select= BF lock wait long
+--let assert_count= 0
+--let assert_only_after= CURRENT_TEST: galera.galera_bf_lock_wait
+
while($counter > 0)
{
--disable_query_log
@@ -60,9 +66,11 @@ while($counter > 0)
--enable_query_log
--enable_result_log
-# use error 0,1 instead if want test to continue
- --error 1
- exec grep 'BF lock wait long' $MYSQLTEST_VARDIR/log/mysqld.*.err;
+--let assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--source include/assert_grep.inc
+
+--let assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
+--source include/assert_grep.inc
dec $counter;
}
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
index e3921264..b2c38b63 100644
--- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
@@ -142,31 +142,31 @@ SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--connection node_1_insert_simple
---error 2013
+--error 2013, 2026
--reap
--connection node_1_insert_multi
---error 2013
+--error 2013, 2026
--reap
--connection node_1_insert_transaction
---error 2013
+--error 2013, 2026
--reap
--connection node_1_update_simple
---error 2013
+--error 2013, 2026
--reap
--connection node_1_insert_1k
---error 2013
+--error 2013, 2026
--reap
--connection node_1_insert_1m
---error 2013
+--error 2013, 2026
--reap
--connection node_1_insert_10m
---error 2013
+--error 2013, 2026
--reap
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf
new file mode 100644
index 00000000..f2187b83
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf
@@ -0,0 +1,20 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=mariabackup
+wsrep_sst_auth=root:
+
+ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
+ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
+ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
+[sst]
+ssl-mode=VERIFY_CA
+transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=mbstream
diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test
new file mode 100644
index 00000000..4e2d25b1
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test
@@ -0,0 +1,61 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_mariabackup.inc
+
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
+--let $LOG_FILE=$MYSQL_TMP_DIR/galera_node2.log
+--error 0,1
+--remove_file $LOG_FILE
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+
+--connection node_2
+
+--echo # Verify that graceful shutdown succeeds...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+--echo # Start node_2 again...
+--let $restart_noprint=2
+--let $start_mysqld_params=--log-error=$LOG_FILE
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SELECT * FROM t1;
+
+--let $start_mysqld_params=
+--source include/restart_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Confirm that IST took place
+--let $assert_text = mariabackup IST completed on joiner
+--let $assert_select = mariabackup IST completed on joiner
+--let $assert_count = 1
+--let $assert_file = $LOG_FILE
+--let $assert_only_after = Prepared IST receiver for
+--source include/assert_grep.inc
+
+DROP TABLE t1;
+
+--source include/auto_increment_offset_restore.inc
+
+--remove_file $LOG_FILE
diff --git a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf
new file mode 100644
index 00000000..9125f670
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf
@@ -0,0 +1,17 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=rsync
+
+ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
+ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
+ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+
+[sst]
+ssl-mode=VERIFY_CA
diff --git a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test
new file mode 100644
index 00000000..d9f7bb15
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test
@@ -0,0 +1,60 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
+--let $LOG_FILE=$MYSQL_TMP_DIR/galera_node2.log
+--error 0,1
+--remove_file $LOG_FILE
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+
+--connection node_2
+
+--echo # Verify that graceful shutdown succeeds...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+--echo # Start node_2 again...
+--let $restart_noprint=2
+--let $start_mysqld_params=--log-error=$LOG_FILE
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SELECT * FROM t1;
+
+--let $start_mysqld_params=
+--source include/restart_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Confirm that IST took place
+--let $assert_text = rsync IST completed on joiner
+--let $assert_select = rsync IST completed on joiner
+--let $assert_count = 1
+--let $assert_file = $LOG_FILE
+--let $assert_only_after = Prepared IST receiver for
+--source include/assert_grep.inc
+
+DROP TABLE t1;
+
+--source include/auto_increment_offset_restore.inc
+
+--remove_file $LOG_FILE
diff --git a/mysql-test/suite/galera/t/galera_log_output_csv.test b/mysql-test/suite/galera/t/galera_log_output_csv.test
index eeccc953..43f4190c 100644
--- a/mysql-test/suite/galera/t/galera_log_output_csv.test
+++ b/mysql-test/suite/galera/t/galera_log_output_csv.test
@@ -12,13 +12,17 @@ INSERT INTO t1 VALUES (1);
SELECT COUNT(*) > 0 FROM mysql.general_log;
+--disable_ps2_protocol
SELECT 1 = 1 FROM t1;
SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1';
+--enable_ps2_protocol
--connection node_2
+--disable_ps2_protocol
SELECT 2 = 2 FROM t1;
SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1';
+--enable_ps2_protocol
--connection node_1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_myisam_autocommit.test b/mysql-test/suite/galera/t/galera_myisam_autocommit.test
index b01b5dc0..3452a06a 100644
--- a/mysql-test/suite/galera/t/galera_myisam_autocommit.test
+++ b/mysql-test/suite/galera/t/galera_myisam_autocommit.test
@@ -7,6 +7,8 @@
# Without a PK
+SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
+
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
@@ -41,5 +43,7 @@ TRUNCATE TABLE t1;
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM t2;
+--connection node_1
DROP TABLE t1;
DROP TABLE t2;
+SET GLOBAL wsrep_mode=DEFAULT;
diff --git a/mysql-test/suite/galera/t/galera_query_cache.test b/mysql-test/suite/galera/t/galera_query_cache.test
index 900faba0..ec7306e0 100644
--- a/mysql-test/suite/galera/t/galera_query_cache.test
+++ b/mysql-test/suite/galera/t/galera_query_cache.test
@@ -2,6 +2,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--disable_ps2_protocol
+
#
# Ensure that the query cache behaves properly with respect to Galera
#
@@ -65,3 +67,4 @@ SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_
DROP TABLE t1;
+--enable_ps2_protocol
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
index 6d1e21fd..9a4b734e 100644
--- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
+++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
@@ -4,6 +4,8 @@
--source include/have_query_cache.inc
--source include/galera_have_debug_sync.inc
+--disable_ps2_protocol
+
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
@@ -88,3 +90,5 @@ DROP TABLE t1;
--connection node_2a
SET DEBUG_SYNC = "RESET";
+
+--enable_ps2_protocol
diff --git a/mysql-test/suite/galera/t/galera_restart_replica.test b/mysql-test/suite/galera/t/galera_restart_replica.test
index 2cc3a1dc..37cfd9bc 100644
--- a/mysql-test/suite/galera/t/galera_restart_replica.test
+++ b/mysql-test/suite/galera/t/galera_restart_replica.test
@@ -3,9 +3,9 @@
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
#
---source include/big_test.inc
--source include/force_restart.inc
--source include/galera_cluster.inc
+--source include/have_innodb.inc
--source include/have_sequence.inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
index d0e68295..728500f4 100644
--- a/mysql-test/suite/galera_3nodes/disabled.def
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -10,12 +10,12 @@
#
##############################################################################
-galera_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster
-galera_gtid_2_cluster : MDEV-29877 Galera test failure on galera_2_cluster
-galera_ipv6_mariabackup : MDEV-24097
-galera_ipv6_mariabackup_section : MDEV-24097, MDEV-22195
-galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed
-galera_ssl_reload : MDEV-30172 At line 50: mysql_shutdown failed
+galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed
+galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)'
+galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message
+galera_ipv6_mariabackup : temporarily disabled at the request of Codership
+galera_pc_bootstrap : temporarily disabled at the request of Codership
+galera_ipv6_mariabackup_section : temporarily disabled at the request of Codership
# Opensuse/suse/rocky9/rocky84/rhel9/rhel8-ppc64le .. - all same IPv6 isn't configured right or skipping or galera
galera_ipv6_rsync : Can't connect to server on '::1' (115)
galera_ipv6_rsync_section : Can't connect to server on '::1' (115)
diff --git a/mysql-test/suite/galera_3nodes/r/MDEV-29171.result b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result
index 151be86d..371ce006 100644
--- a/mysql-test/suite/galera_3nodes/r/MDEV-29171.result
+++ b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result
@@ -14,6 +14,7 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
@@wsrep_gtid_domain_id @@wsrep_node_name
100 node3
connection node_3;
+connection node_1;
connection node_2;
connection node_1;
connection node_1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result
new file mode 100644
index 00000000..a35f31da
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result
@@ -0,0 +1,219 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+set wsrep_sync_wait=0;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+set wsrep_sync_wait=0;
+connection node_1;
+CREATE PROCEDURE insert_row (IN node varchar(10), IN repeat_count int)
+BEGIN
+DECLARE current_num int;
+SET current_num = 0;
+WHILE current_num < repeat_count do
+INSERT INTO t1(node, name) VALUES (node, UUID());
+SET current_num = current_num + 1;
+END WHILE;
+END|
+CREATE TABLE t1 (id bigint not null primary key auto_increment, node VARCHAR(10), name VARCHAR(64)) ENGINE=innodb;
+# node_1
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2
+connection node_2;
+# node_2
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2
+connection node_3;
+# node_3
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2
+connection node_1;
+CALL insert_row('node1', 500);;
+connection node_2;
+CALL insert_row('node2', 500);;
+connection node_3;
+CALL insert_row('node3', 500);;
+connection node_2;
+# Shutdown node_2, force SST
+connection node_2b;
+# Wait until node_2 leaves cluster
+connection node_1b;
+connection node_1;
+connection node_3;
+connection node_1;
+CALL insert_row('node1', 500);
+connection node_3;
+CALL insert_row('node3', 500);
+CREATE TABLE t2(i int primary key) engine=innodb;
+connection node_2;
+# Restart node_2
+# restart
+connection node_1b;
+# Wait until node_2 is back in cluster
+# node2 has joined
+# GTID in node1
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2503
+connection node_2;
+# GTID in node2
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2503
+connection node_3;
+# GTID in node3
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2503
+# Shutdown node_3
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+# Wait until node_3 leaves cluster
+connection node_1b;
+connection node_1;
+CALL insert_row('node1', 50);
+CREATE TABLE t3(i int primary key) engine=innodb;
+connection node_3;
+# Rejoin node_3
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1b;
+# Wait until node_3 is back in cluster
+# node3 has joined
+connection node_1;
+# GTID in node1
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2554
+connection node_2;
+# GTID in node2
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2554
+connection node_3;
+# GTID in node3
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2554
+# One by one shutdown all nodes
+connection node_3;
+# shutdown node_3
+connection node_2;
+# wait until node_3 is out of cluster
+# shutdown node_2
+connection node_1;
+# wait until node_2 is out of cluster
+# shutdown node_1
+# Bootstrap from node_1
+connection node_1;
+# restart: --wsrep_new_cluster
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2554
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+CALL insert_row('node1', 100);;
+# Restart node_2
+connection node_2;
+# restart
+connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+set wsrep_sync_wait=0;
+connection node_1c;
+# wait until node_1 and node_2 are in cluster
+connection node_2;
+ALTER TABLE t2 ADD COLUMN (k int);
+CALL insert_row('node2', 100);;
+# Restart node_3
+connection node_3;
+# restart
+connection node_1c;
+# wait until all nodes are back in cluster
+after cluster restart
+connection node_2;
+connection node_1;
+connection node_1;
+node1 GTID
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2756
+connection node_2;
+node2 GTID
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2756
+connection node_3;
+node3 GTID
+show variables like 'wsrep_gtid_domain_id';
+Variable_name Value
+wsrep_gtid_domain_id 1111
+show variables like '%gtid_binlog_pos%';
+Variable_name Value
+gtid_binlog_pos 1111-1-2756
+connection node_1;
+table size in node1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2750
+connection node_2;
+table size in node2
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2750
+connection node_3;
+table size in node3
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2750
+connection node_2;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call mtr.add_suppression("Sending JOIN failed:.*");
+call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
+connection node_3;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call mtr.add_suppression("Sending JOIN failed:.*");
+call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
+# cleanup
+connection node_1;
+DROP PROCEDURE insert_row;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+connection node_3;
+connection node_2;
+disconnect node_3;
+disconnect node_2b;
+disconnect node_1b;
+disconnect node_1c;
diff --git a/mysql-test/suite/galera/r/galera_var_node_address.result b/mysql-test/suite/galera_3nodes/r/galera_var_node_address.result
index 6b91a9f3..fe6c2a00 100644
--- a/mysql-test/suite/galera/r/galera_var_node_address.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_var_node_address.result
@@ -1,22 +1,22 @@
connection node_2;
connection node_1;
-call mtr.add_suppression("WSREP: Stray state UUID msg: .*");
-call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*");
-call mtr.add_suppression("WSREP: Sending JOIN failed: .*");
-flush tables;
+connection node_1;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
-4
-connection node_1;
+3
CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
connection node_2;
-set global wsrep_sync_wait=15;
INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
-set global wsrep_sync_wait=15;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
connection node_1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result
index e49a1714..6faafacd 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result
@@ -39,6 +39,9 @@ SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STAT
expect_Disconnected
Disconnected
SET SESSION wsrep_on=ON;
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_3
+3
SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
expect_Primary
Primary
@@ -49,17 +52,11 @@ t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
connection node_2;
-SET SESSION wsrep_on=OFF;
-SET SESSION wsrep_on=ON;
-# restart
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-SELECT COUNT(*) AS expect_0 FROM t1;
-expect_0
-0
CALL mtr.add_suppression("is inconsistent with group");
connection node_3;
SHOW CREATE TABLE t1;
@@ -71,13 +68,16 @@ DROP TABLE t1;
CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'");
connection node_1;
connection node_1;
-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
connection node_2;
-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
+connection node_2;
+# restart
+connection node_1;
diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test
index 33fa4d72..bfb7abf9 100644
--- a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test
+++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test
@@ -4,11 +4,13 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/galera_sst_method.inc
+--source include/force_restart.inc
#
# Initially wsrep gtid domain id is 100
#
+
--connection node_1
select @@wsrep_gtid_domain_id,@@wsrep_node_name;
@@ -26,6 +28,10 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--connection node_3
--source include/shutdown_mysqld.inc
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
@@ -36,6 +42,7 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--source include/wait_condition.inc
--source include/shutdown_mysqld.inc
+--sleep 5
#
# Bootstrap from node_1 and change wsrep_gtid_domain_id to 200
@@ -45,12 +52,11 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--source include/start_mysqld.inc
show variables like 'wsrep_gtid_domain_id';
-
#
# Restart node_2, expect that wsrep_gtid_domain_id has changed to 200
#
--connection node_2
---let $restart_parameters =
+--let $restart_parameters =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
show variables like 'wsrep_gtid_domain_id';
diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf
new file mode 100644
index 00000000..5bd03178
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf
@@ -0,0 +1,35 @@
+!include ../galera_3nodes.cnf
+
+[mysqld.1]
+wsrep-node-name="node1"
+wsrep_gtid_domain_id=1111
+gtid_domain_id=2
+server_id=10999
+wsrep_sst_auth="root:"
+wsrep_sst_method=mariabackup
+log_slave_updates=ON
+log_bin=mariadb-bin-log
+binlog-format=row
+wsrep-gtid-mode=ON
+
+[mysqld.2]
+wsrep-node-name="node2"
+wsrep_gtid_domain_id=1112
+gtid_domain_id=3
+wsrep_sst_auth="root:"
+wsrep_sst_method=mariabackup
+log_slave_updates=ON
+log_bin=mariadb-bin-log
+binlog-format=row
+wsrep-gtid-mode=ON
+
+[mysqld.3]
+wsrep-node-name="node3"
+wsrep_gtid_domain_id=1113
+gtid_domain_id=4
+wsrep_sst_auth="root:"
+wsrep_sst_method=mariabackup
+log_slave_updates=ON
+log_bin=mariadb-bin-log
+binlog-format=row
+wsrep-gtid-mode=ON
diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test
new file mode 100644
index 00000000..f41230bc
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test
@@ -0,0 +1,346 @@
+--source include/galera_cluster.inc
+--source include/big_test.inc
+--source include/force_restart.inc
+
+
+#
+# Testing gtid consistency in 3 node cluster when nodes drop
+# and join back to cluster.
+# The tests verify that wsrep_gtid_domain_id and gtid_binlog_pos
+# remains same across the cluster
+# In the configuration, nodes have different wsrep_gtid_domain_id
+# but all nodes are supposed to receive effective domain id
+# from the bootstrap node (node_1), and use it
+#
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
+set wsrep_sync_wait=0;
+--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
+set wsrep_sync_wait=0;
+
+--connection node_1
+DELIMITER |;
+CREATE PROCEDURE insert_row (IN node varchar(10), IN repeat_count int)
+BEGIN
+ DECLARE current_num int;
+ SET current_num = 0;
+ WHILE current_num < repeat_count do
+ INSERT INTO t1(node, name) VALUES (node, UUID());
+ SET current_num = current_num + 1;
+ END WHILE;
+END|
+DELIMITER ;|
+
+CREATE TABLE t1 (id bigint not null primary key auto_increment, node VARCHAR(10), name VARCHAR(64)) ENGINE=innodb;
+
+#
+# report initial gtid positions after table t1 is created
+#
+--echo # node_1
+show variables like '%gtid_binlog_pos%';
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
+--source include/wait_condition.inc
+
+--echo # node_2
+show variables like '%gtid_binlog_pos%';
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
+--source include/wait_condition.inc
+
+--echo # node_3
+show variables like '%gtid_binlog_pos%';
+
+###########################################
+# scenario: join node 2 by SST
+##########################################
+
+#
+# start concurrent insert load and stop node2 while the load is on
+#
+--connection node_1
+--send CALL insert_row('node1', 500);
+
+--connection node_2
+--send CALL insert_row('node2', 500);
+
+--connection node_3
+--send CALL insert_row('node3', 500);
+
+#
+# stop load to node 2 and shutdown the node, force SST
+#
+--connection node_2
+--reap
+
+--echo # Shutdown node_2, force SST
+--connection node_2b
+--source include/shutdown_mysqld.inc
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--echo # Wait until node_2 leaves cluster
+--connection node_1b
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+#
+# stop the remaining load to node 1 and 3
+#
+--connection node_1
+--reap
+--connection node_3
+--reap
+
+#
+# some more inserts and DDL to nodes 1 and 3
+# while node 2 is absent
+#
+--connection node_1
+CALL insert_row('node1', 500);
+
+--connection node_3
+CALL insert_row('node3', 500);
+
+CREATE TABLE t2(i int primary key) engine=innodb;
+
+#
+# restart node 2, should join by SST
+#
+--connection node_2
+--echo # Restart node_2
+--source include/start_mysqld.inc
+
+--connection node_1b
+--echo # Wait until node_2 is back in cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--echo # node2 has joined
+
+#
+# check gtid positions in all nodes
+#
+--echo # GTID in node1
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+--connection node_2
+--echo # GTID in node2
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+--connection node_3
+--echo # GTID in node3
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+
+###########################################
+# scenario: join node 3 by IST
+##########################################
+
+--echo # Shutdown node_3
+--connection node_3
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+
+--echo # Wait until node_3 leaves cluster
+--connection node_1b
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+#
+# do some inserts and DDL to node 1
+# while node 3 is absent
+#
+--connection node_1
+CALL insert_row('node1', 50);
+
+CREATE TABLE t3(i int primary key) engine=innodb;
+
+#
+# remove isolation in node 3, should join by IST
+#
+--connection node_3
+--echo # Rejoin node_3
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+
+--connection node_1b
+--echo # Wait until node_3 is back in cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--echo # node3 has joined
+
+#
+# check gtid positions in all nodes
+#
+--connection node_1
+--echo # GTID in node1
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+--connection node_2
+--echo # GTID in node2
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+--connection node_3
+--echo # GTID in node3
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+
+###########################################
+# scenario: restart full custer
+##########################################
+
+
+#
+# stop all nodes, one by one
+#
+--echo # One by one shutdown all nodes
+--connection node_3
+--echo # shutdown node_3
+--source include/shutdown_mysqld.inc
+--remove_file $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
+
+--connection node_2
+--echo # wait until node_3 is out of cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--echo # shutdown node_2
+--source include/shutdown_mysqld.inc
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--connection node_1
+--echo # wait until node_2 is out of cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--echo # shutdown node_1
+--source include/shutdown_mysqld.inc
+
+#
+# bootstap cluster in order node1 - node2 - node3
+# send some inserts and DDL after each node started
+#
+--sleep 5
+--echo # Bootstrap from node_1
+--connection node_1
+--let $restart_parameters = --wsrep_new_cluster
+--source include/start_mysqld.inc
+
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+ANALYZE TABLE t2;
+--send CALL insert_row('node1', 100);
+
+--echo # Restart node_2
+--connection node_2
+--let $restart_parameters =
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+#
+# connection node_1b may not be functional anymore, after node was
+# shutdown, open node_1c for controlling node 1 state
+#
+--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1
+set wsrep_sync_wait=0;
+--connection node_1c
+--echo # wait until node_1 and node_2 are in cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_2
+ALTER TABLE t2 ADD COLUMN (k int);
+--send CALL insert_row('node2', 100);
+
+
+--echo # Restart node_3
+--connection node_3
+--let $restart_parameters =
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
+--source include/start_mysqld.inc
+
+--connection node_1c
+--echo # wait until all nodes are back in cluster
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--echo after cluster restart
+
+# stop load for nodes 1 and 2
+--connection node_2
+--reap
+
+--connection node_1
+--reap
+
+#
+# check gtid positions in all nodes
+#
+--connection node_1
+--echo node1 GTID
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+--connection node_2
+--echo node2 GTID
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+--connection node_3
+--echo node3 GTID
+show variables like 'wsrep_gtid_domain_id';
+show variables like '%gtid_binlog_pos%';
+
+#
+# check table size in all nodes
+#
+--connection node_1
+--echo table size in node1
+SELECT COUNT(*) FROM t1;
+
+--connection node_2
+--echo table size in node2
+SELECT COUNT(*) FROM t1;
+
+--connection node_3
+--echo table size in node3
+SELECT COUNT(*) FROM t1;
+
+#
+# cleanups
+#
+--connection node_2
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call mtr.add_suppression("Sending JOIN failed:.*");
+call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
+--connection node_3
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call mtr.add_suppression("Sending JOIN failed:.*");
+call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
+
+--echo # cleanup
+--connection node_1
+
+DROP PROCEDURE insert_row;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'
+--source include/wait_condition.inc
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'
+--source include/wait_condition.inc
+
+--disconnect node_3
+--disconnect node_2b
+--disconnect node_1b
+--disconnect node_1c
diff --git a/mysql-test/suite/galera/t/galera_var_node_address.cnf b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.cnf
index 0de0edaa..aa0c47f1 100644
--- a/mysql-test/suite/galera/t/galera_var_node_address.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.cnf
@@ -1,4 +1,4 @@
-!include ../galera_4nodes.cnf
+!include ../galera_3nodes.cnf
[mysqld.2]
wsrep_node_address=127.0.0.1
@@ -6,5 +6,3 @@ wsrep_node_address=127.0.0.1
[mysqld.3]
wsrep_node_address=localhost
-[mysqld.4]
-wsrep_node_address=lo
diff --git a/mysql-test/suite/galera/t/galera_var_node_address.test b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.test
index 99cb30e7..08c0d2e4 100644
--- a/mysql-test/suite/galera/t/galera_var_node_address.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.test
@@ -6,27 +6,27 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
-call mtr.add_suppression("WSREP: Stray state UUID msg: .*");
-call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*");
-call mtr.add_suppression("WSREP: Sending JOIN failed: .*");
-flush tables;
-
---let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
---connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
--connection node_2
-set global wsrep_sync_wait=15;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
-set global wsrep_sync_wait=15;
-SELECT COUNT(*) FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
--connection node_1
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test
index 70d58cb2..6c7b255b 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test
@@ -59,6 +59,7 @@ SET SESSION wsrep_on=ON;
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
# Confirm that the table is now identical throughout
@@ -67,18 +68,7 @@ SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WH
SHOW CREATE TABLE t1;
--connection node_2
-SET SESSION wsrep_on=OFF;
---let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
---source include/wait_condition.inc
---source include/galera_wait_ready.inc
-SET SESSION wsrep_on=ON;
-
-# restart node so we don't fail on WSREP_START_POSITION internal check
---source include/restart_mysqld.inc
---source include/wait_until_connected_again.inc
-
SHOW CREATE TABLE t1;
-SELECT COUNT(*) AS expect_0 FROM t1;
CALL mtr.add_suppression("is inconsistent with group");
--connection node_3
@@ -89,5 +79,14 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that col
--connection node_1
--source suite/galera/include/galera_sst_restore.inc
+--connection node_2
+# restart node so we don't fail on WSREP_START_POSITION internal check
+--source include/restart_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/disabled.def b/mysql-test/suite/galera_3nodes_sr/disabled.def
index df2277fb..fcaf38a3 100644
--- a/mysql-test/suite/galera_3nodes_sr/disabled.def
+++ b/mysql-test/suite/galera_3nodes_sr/disabled.def
@@ -9,5 +9,3 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-
-galera_sr_kill_slave_after_apply_rollback2 : MDEV-29892 Galera test failure on galera_sr_kill_slave_after_apply_rollback2 \ No newline at end of file
diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result
index 726f7014..9043c668 100644
--- a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result
+++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result
@@ -12,7 +12,7 @@ SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
COMMIT;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
# restart
connection node_1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test
index b8d46db7..ba85aa52 100644
--- a/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test
@@ -1,5 +1,7 @@
--source include/galera_cluster.inc
+--disable_ps2_protocol
+
--connection node_2
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
@@ -45,3 +47,6 @@ CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--source include/galera_wait_ready.inc
+
+
+--enable_ps2_protocol
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 ab8b62b9..5da080a6 100644
--- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
+++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test
@@ -26,7 +26,7 @@ SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
---error 2013
+--error 2013,2026
COMMIT;
--source include/start_mysqld.inc
diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test
index 27674148..18e1f002 100644
--- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test
+++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test
@@ -1,6 +1,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--disable_ps2_protocol
#
# Test the effect of gmcast.isolate on master during an SR transaction
#
@@ -133,3 +134,4 @@ CALL mtr.add_suppression("failed to send SR rollback for");
DROP TABLE t1;
--source ../galera/include/auto_increment_offset_restore.inc
+--enable_ps2_protocol
diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def
index 9cca05eb..73ef1d0d 100644
--- a/mysql-test/suite/galera_sr/disabled.def
+++ b/mysql-test/suite/galera_sr/disabled.def
@@ -10,8 +10,6 @@
#
##############################################################################
-GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill
-galera_sr_cc_master : MDEV-29882 Galera test failure on galera_sr_cc_master
-mysql-wsrep-features#138 : At line 25: query 'DROP TABLE t1' failed: 2013: Lost connection to MySQL server during query
+GCF-1060 : MDEV-32160 GCF-1060 test failure due to wsrep MDL conflict
# Links to below failures in MDEV-30172
MDEV-25718 : timeout related to wsrep_sync_wait and DEBUG_SYNC
diff --git a/mysql-test/suite/galera_sr/r/MDEV-27615.result b/mysql-test/suite/galera_sr/r/MDEV-27615.result
index e3bfd0ed..8965cc8e 100644
--- a/mysql-test/suite/galera_sr/r/MDEV-27615.result
+++ b/mysql-test/suite/galera_sr/r/MDEV-27615.result
@@ -15,7 +15,7 @@ SET DEBUG_SYNC='now WAIT_FOR before_fragment';
SET GLOBAL wsrep_cluster_address = '';
SET DEBUG_SYNC = 'now SIGNAL continue';
connection node_2;
-ERROR HY000: Lost connection to server during query
+Got one of the listed errors
connection node_2a;
SELECT * FROM mysql.wsrep_streaming_log;
node_uuid trx_id seqno flags frag
diff --git a/mysql-test/suite/galera_sr/r/MDEV-28971.result b/mysql-test/suite/galera_sr/r/MDEV-28971.result
new file mode 100644
index 00000000..0826f5e6
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/MDEV-28971.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE SEQUENCE SEQ NOCACHE ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size=1;
+SET collation_connection=utf16_thai_520_w2;
+SET autocommit=0;
+CREATE TABLE t1 (a BLOB UNIQUE);
+INSERT INTO t1 VALUES ('AAF');
+SELECT SETVAL (SEQ, 100);
+ERROR 42000: This version of MariaDB doesn't yet support 'SEQUENCEs with streaming replication in Galera cluster'
+ALTER TABLE t1 ADD CONSTRAINT constraint_1 UNIQUE (a);
+Warnings:
+Note 1831 Duplicate index `constraint_1`. This is deprecated and will be disallowed in a future release
+INSERT INTO t1 VALUES();
+ALTER TABLE t1 ADD KEY(b (50));
+ERROR 42000: Key column 'b' doesn't exist in table
+DROP TABLE t1,SEQ;
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result
index 1f874aca..19466715 100644
--- a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result
+++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result
@@ -13,12 +13,12 @@ INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
+EXPECT_5
5
connection node_1;
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
+EXPECT_5
5
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
@@ -29,8 +29,8 @@ connection node_2;
INSERT INTO t1 VALUES (6);
ERROR HY000: Lost connection to server during query
connection node_1;
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
0
connection node_2a;
connection node_1;
@@ -38,8 +38,8 @@ connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2b;
SELECT * FROM mysql.wsrep_streaming_log;
node_uuid trx_id seqno flags frag
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
0
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -49,18 +49,20 @@ INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
COMMIT;
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
0
connection node_1;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_5 FROM t1;
+EXPECT_5
5
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
0
DROP TABLE t1;
connection node_2b;
CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for");
disconnect node_2;
connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+disconnect node_2a;
+disconnect node_2b;
diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result
index 8ad3ac63..353315d1 100644
--- a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result
+++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result
@@ -26,6 +26,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -91,6 +92,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -156,6 +158,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -221,6 +224,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -286,6 +290,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -351,6 +356,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -416,6 +422,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -481,6 +488,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -546,6 +554,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -611,6 +620,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -676,6 +686,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -741,6 +752,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -806,6 +818,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -871,6 +884,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -936,6 +950,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -1001,6 +1016,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
+connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
diff --git a/mysql-test/suite/galera_sr/t/MDEV-27615.test b/mysql-test/suite/galera_sr/t/MDEV-27615.test
index 121a85fb..8cc425aa 100644
--- a/mysql-test/suite/galera_sr/t/MDEV-27615.test
+++ b/mysql-test/suite/galera_sr/t/MDEV-27615.test
@@ -43,7 +43,8 @@ SET DEBUG_SYNC = 'now SIGNAL continue';
# Disconnect causes connection to node_2 to be closed
#
--connection node_2
---error 2013 # CR_SERVER_LOST
+# CR_SERVER_LOST, CR_SSL_CONNECTION_ERROR
+--error 2013,2026
--reap
diff --git a/mysql-test/suite/galera_sr/t/MDEV-28971.test b/mysql-test/suite/galera_sr/t/MDEV-28971.test
new file mode 100644
index 00000000..d3dbf03b
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/MDEV-28971.test
@@ -0,0 +1,20 @@
+#
+# MDEV-28971 - Assertion `total_length + thd->wsrep_sr().log_position() == saved_pos'
+# failed in int wsrep_write_cache_inc(THD*, IO_CACHE*, size_t*)
+#
+
+--source include/galera_cluster.inc
+
+CREATE SEQUENCE SEQ NOCACHE ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size=1;
+SET collation_connection=utf16_thai_520_w2;
+SET autocommit=0;
+CREATE TABLE t1 (a BLOB UNIQUE);
+INSERT INTO t1 VALUES ('AAF');
+--error ER_NOT_SUPPORTED_YET
+SELECT SETVAL (SEQ, 100);
+ALTER TABLE t1 ADD CONSTRAINT constraint_1 UNIQUE (a);
+INSERT INTO t1 VALUES();
+--error ER_KEY_COLUMN_DOES_NOT_EXIST
+ALTER TABLE t1 ADD KEY(b (50));
+DROP TABLE t1,SEQ;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test
index 6665a6e7..a019a32e 100644
--- a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test
+++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test
@@ -32,10 +32,13 @@ INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
--connection node_1
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+--let $wait_condition = SELECT COUNT(*) = 5 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
#
# Trigger CC . The transaction is aborted and we expect the SR tables to be cleaned up
@@ -56,7 +59,9 @@ SET SESSION wsrep_sync_wait = DEFAULT;
INSERT INTO t1 VALUES (6);
--connection node_1
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
# Restore cluster
@@ -73,8 +78,10 @@ SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2b
--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
+--source include/wait_condition.inc
SELECT * FROM mysql.wsrep_streaming_log;
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
# Repeat transaction to confirm no locks are left from previous transaction
@@ -87,11 +94,13 @@ INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
COMMIT;
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
--connection node_1
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_5 FROM t1;
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1;
@@ -102,3 +111,6 @@ CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for");
--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc
+
+--disconnect node_2a
+--disconnect node_2b
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test
index 63278555..d08cab49 100644
--- a/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test
+++ b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test
@@ -6,6 +6,8 @@
--source include/have_innodb.inc
--source include/big_test.inc
+--disable_ps2_protocol
+
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
@@ -56,3 +58,4 @@ CALL mtr.add_suppression('InnoDB: Resizing redo log from');
CALL mtr.add_suppression('InnoDB: Starting to delete and rewrite log files');
CALL mtr.add_suppression('InnoDB: New log files created, LSN=');
+--enable_ps2_protocol
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test b/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test
index 9b8dae9d..7a6c1bea 100644
--- a/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test
+++ b/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test
@@ -6,6 +6,8 @@
--source include/have_innodb.inc
--source include/big_test.inc
+--disable_ps2_protocol
+
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
@@ -51,3 +53,5 @@ SELECT COUNT(*) = 0 FROM t1;
DROP TABLE ten;
DROP TABLE t1;
+
+--enable_ps2_protocol
diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc
index 7f13afa3..26cdd116 100644
--- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc
+++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc
@@ -46,6 +46,10 @@ SELECT * FROM t1;
SET AUTOCOMMIT=ON;
--send INSERT INTO t1 VALUES (3, 'c')
+--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
+--source include/wait_condition.inc
+
--connection node_2
SELECT * FROM t1;
@@ -54,7 +58,7 @@ SELECT * FROM t1;
--send UPDATE t1 SET f2 = 'a' WHERE f1 = 2
--connection node_1
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER != 'system user' AND STATE = 'Updating';
+--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
--source include/wait_condition.inc
# Will deadlock
diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result
index f124ebe6..5dfa416a 100644
--- a/mysql-test/suite/gcol/r/gcol_bugfixes.result
+++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result
@@ -744,3 +744,41 @@ SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1;
LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc);
INSERT IGNORE INTO t1 (id) VALUES (2);
DROP TABLE t1;
+#
+# MDEV-28566 Assertion `!expr->is_fixed()' failed in bool
+# Virtual_column_info::fix_session_expr(THD*)
+#
+CREATE TABLE t1 (c1 CHAR(1));
+FLUSH TABLES WITH READ LOCK;
+UPDATE t1 SET c1=1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+SELECT * FROM t1;
+c1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 CHAR AS (CONCAT (0,DAYNAME (0))));
+FLUSH TABLES WITH READ LOCK;
+UPDATE t1 SET c1=1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+UPDATE t1 SET c1=1;
+SELECT * FROM t1;
+c1
+DROP TABLE t1;
+CREATE TABLE t1 (a int primary key, c1 CHAR AS (CONCAT (0,DAYNAME (0))));
+insert into t1 (a) values (1);
+FLUSH TABLES WITH READ LOCK;
+UPDATE t1 SET c1=1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UPDATE t1 SET a=2;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+UPDATE t1 SET a=2;
+UPDATE t1 SET c1=1;
+ERROR HY000: The value specified for generated column 'c1' in table 't1' has been ignored
+SELECT * FROM t1;
+a c1
+2 NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '0'
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/r/gcol_partition_innodb.result b/mysql-test/suite/gcol/r/gcol_partition_innodb.result
index 2bff3305..e6252b3d 100644
--- a/mysql-test/suite/gcol/r/gcol_partition_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_partition_innodb.result
@@ -1,4 +1,6 @@
-SET @@session.default_storage_engine = 'InnoDB';
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+SET default_storage_engine = 'InnoDB';
drop table if exists t1;
# Case 1. Partitioning by RANGE based on a non-stored generated column.
CREATE TABLE t1 (
@@ -126,6 +128,7 @@ Warnings:
Warning 1906 The value specified for generated column 'vd' in table 't1' has been ignored
DROP TABLE t1;
InnoDB 0 transactions not purged
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2,t3;
DROP PROCEDURE IF EXISTS p1;
diff --git a/mysql-test/suite/gcol/r/gcol_purge.result b/mysql-test/suite/gcol/r/gcol_purge.result
index e16cf0df..19db34ac 100644
--- a/mysql-test/suite/gcol/r/gcol_purge.result
+++ b/mysql-test/suite/gcol/r/gcol_purge.result
@@ -1,7 +1,7 @@
SET @save_dbug=@@GLOBAL.debug_dbug;
CREATE TABLE t1(f1 INT NOT NULL, f2 int not null,
f3 int generated always as (f2 * 2) VIRTUAL,
-primary key(f1), INDEX (f3))ENGINE=InnoDB;
+primary key(f1), INDEX (f3))ENGINE=InnoDB STATS_PERSISTENT=0;
connect con1,localhost,root,,,;
InnoDB 0 transactions not purged
START TRANSACTION WITH CONSISTENT SNAPSHOT;
diff --git a/mysql-test/suite/gcol/r/gcol_update.result b/mysql-test/suite/gcol/r/gcol_update.result
index 35e0b3e8..54974826 100644
--- a/mysql-test/suite/gcol/r/gcol_update.result
+++ b/mysql-test/suite/gcol/r/gcol_update.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
@@ -37,3 +39,4 @@ InnoDB 0 transactions not purged
disconnect purge_control;
connection default;
drop table t1;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/gcol/r/innodb_prefix_index_check.result b/mysql-test/suite/gcol/r/innodb_prefix_index_check.result
index 01dbe4a6..ea84cd15 100644
--- a/mysql-test/suite/gcol/r/innodb_prefix_index_check.result
+++ b/mysql-test/suite/gcol/r/innodb_prefix_index_check.result
@@ -13,3 +13,32 @@ key(f1,f2(1))
)ENGINE=INNODB;
REPLACE INTO t1(f3) VALUES (1),(1);
DROP TABLE t1;
+#Create and alter table examples for full column index followed by prefix index.
+CREATE TABLE t1(
+f1 VARCHAR(100),
+f2 char(2),
+KEY(f1,f2),
+KEY(f1(5)))ENGINE=INNODB;
+REPLACE INTO t1(f2) VALUES (1),(1);
+ALTER TABLE t1 ADD INDEX(f2,f1);
+DROP TABLE t1;
+#Create and alter table examples for small prefix index followed by large
+#prefix index.
+CREATE TABLE t1(
+f1 VARCHAR(100),
+f2 char(2),
+KEY(f1(5),f2),
+KEY(f1(10)))ENGINE=INNODB;
+REPLACE INTO t1(f2) VALUES (1),(1);
+ALTER TABLE t1 ADD INDEX(f2,f1);
+DROP TABLE t1;
+#Create and alter table examples for prefix index followed by full column
+#index.
+CREATE TABLE t1(
+f1 VARCHAR(100),
+f2 char(2),
+KEY(f1(5),f2),
+KEY(f1))ENGINE=INNODB;
+REPLACE INTO t1(f2) VALUES (1),(1);
+ALTER TABLE t1 ADD INDEX(f2,f1);
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug.result b/mysql-test/suite/gcol/r/innodb_virtual_debug.result
index 3f3e3ea3..e1b87938 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_debug.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_debug.result
@@ -1,4 +1,6 @@
set default_storage_engine=innodb;
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
CREATE TABLE `t` (
`a` VARCHAR(100),
`b` VARCHAR(100),
@@ -145,3 +147,4 @@ DROP TABLE t1;
disconnect con1;
connection default;
SET DEBUG_SYNC=RESET;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_purge.result
index 7951bd0e..3f1c4413 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_purge.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_purge.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
#
# Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION
# ON INDEXED VIRTUAL COLUMNS
@@ -171,3 +173,4 @@ CHECK TABLE t EXTENDED;
Table Op Msg_type Msg_text
test.t check status OK
DROP TABLE t;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test
index 4c1b00a8..1edc9779 100644
--- a/mysql-test/suite/gcol/t/gcol_bugfixes.test
+++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test
@@ -724,3 +724,38 @@ DROP TABLE t1;
--remove_file $datadir/test/load_t1
+--echo #
+--echo # MDEV-28566 Assertion `!expr->is_fixed()' failed in bool
+--echo # Virtual_column_info::fix_session_expr(THD*)
+--echo #
+
+CREATE TABLE t1 (c1 CHAR(1));
+FLUSH TABLES WITH READ LOCK;
+--error ER_CANT_UPDATE_WITH_READLOCK
+UPDATE t1 SET c1=1;
+unlock tables;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 CHAR AS (CONCAT (0,DAYNAME (0))));
+FLUSH TABLES WITH READ LOCK;
+--error ER_CANT_UPDATE_WITH_READLOCK
+UPDATE t1 SET c1=1;
+unlock tables;
+UPDATE t1 SET c1=1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int primary key, c1 CHAR AS (CONCAT (0,DAYNAME (0))));
+insert into t1 (a) values (1);
+FLUSH TABLES WITH READ LOCK;
+--error ER_CANT_UPDATE_WITH_READLOCK
+UPDATE t1 SET c1=1;
+--error ER_CANT_UPDATE_WITH_READLOCK
+UPDATE t1 SET a=2;
+unlock tables;
+UPDATE t1 SET a=2;
+--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
+UPDATE t1 SET c1=1;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/t/gcol_partition_innodb.test b/mysql-test/suite/gcol/t/gcol_partition_innodb.test
index a8765970..6bcd9d27 100644
--- a/mysql-test/suite/gcol/t/gcol_partition_innodb.test
+++ b/mysql-test/suite/gcol/t/gcol_partition_innodb.test
@@ -29,7 +29,9 @@
##### Storage engine to be tested
# Set the session storage engine
--source include/have_innodb.inc
-eval SET @@session.default_storage_engine = 'InnoDB';
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+SET default_storage_engine = 'InnoDB';
##### Workarounds for known open engine specific bugs
# none
@@ -58,6 +60,9 @@ REPLACE INTO t1 SELECT * FROM t1;
DROP TABLE t1;
--source suite/innodb/include/wait_all_purged.inc
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
#------------------------------------------------------------------------------#
# Cleanup
--source suite/gcol/inc/gcol_cleanup.inc
diff --git a/mysql-test/suite/gcol/t/gcol_purge.test b/mysql-test/suite/gcol/t/gcol_purge.test
index cfe20c4a..4ebb37ad 100644
--- a/mysql-test/suite/gcol/t/gcol_purge.test
+++ b/mysql-test/suite/gcol/t/gcol_purge.test
@@ -4,7 +4,7 @@
SET @save_dbug=@@GLOBAL.debug_dbug;
CREATE TABLE t1(f1 INT NOT NULL, f2 int not null,
f3 int generated always as (f2 * 2) VIRTUAL,
- primary key(f1), INDEX (f3))ENGINE=InnoDB;
+ primary key(f1), INDEX (f3))ENGINE=InnoDB STATS_PERSISTENT=0;
connect(con1,localhost,root,,,);
--source ../innodb/include/wait_all_purged.inc
START TRANSACTION WITH CONSISTENT SNAPSHOT;
diff --git a/mysql-test/suite/gcol/t/gcol_update.test b/mysql-test/suite/gcol/t/gcol_update.test
index 2076632f..86474f86 100644
--- a/mysql-test/suite/gcol/t/gcol_update.test
+++ b/mysql-test/suite/gcol/t/gcol_update.test
@@ -1,5 +1,8 @@
--source include/have_innodb.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
connect (purge_control,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
@@ -60,3 +63,5 @@ disconnect purge_control;
connection default;
drop table t1;
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/gcol/t/innodb_prefix_index_check.test b/mysql-test/suite/gcol/t/innodb_prefix_index_check.test
index 4923ead9..5cc46e16 100644
--- a/mysql-test/suite/gcol/t/innodb_prefix_index_check.test
+++ b/mysql-test/suite/gcol/t/innodb_prefix_index_check.test
@@ -20,3 +20,46 @@ REPLACE INTO t1(f3) VALUES (1),(1);
DROP TABLE t1;
+--echo #Create and alter table examples for full column index followed by prefix index.
+
+CREATE TABLE t1(
+f1 VARCHAR(100),
+f2 char(2),
+KEY(f1,f2),
+KEY(f1(5)))ENGINE=INNODB;
+
+REPLACE INTO t1(f2) VALUES (1),(1);
+
+ALTER TABLE t1 ADD INDEX(f2,f1);
+
+DROP TABLE t1;
+
+--echo #Create and alter table examples for small prefix index followed by large
+--echo #prefix index.
+
+CREATE TABLE t1(
+f1 VARCHAR(100),
+f2 char(2),
+KEY(f1(5),f2),
+KEY(f1(10)))ENGINE=INNODB;
+
+REPLACE INTO t1(f2) VALUES (1),(1);
+
+ALTER TABLE t1 ADD INDEX(f2,f1);
+
+DROP TABLE t1;
+
+--echo #Create and alter table examples for prefix index followed by full column
+--echo #index.
+
+CREATE TABLE t1(
+f1 VARCHAR(100),
+f2 char(2),
+KEY(f1(5),f2),
+KEY(f1))ENGINE=INNODB;
+
+REPLACE INTO t1(f2) VALUES (1),(1);
+
+ALTER TABLE t1 ADD INDEX(f2,f1);
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug.test b/mysql-test/suite/gcol/t/innodb_virtual_debug.test
index cd2b8604..c359f3c8 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_debug.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_debug.test
@@ -4,6 +4,10 @@
--source include/count_sessions.inc
set default_storage_engine=innodb;
+# Ensure that the history list length will actually be decremented by purge.
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
CREATE TABLE `t` (
`a` VARCHAR(100),
`b` VARCHAR(100),
@@ -338,4 +342,6 @@ DROP TABLE t1;
connection default;
SET DEBUG_SYNC=RESET;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_purge.test
index 99c7267c..5f3cae34 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_purge.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_purge.test
@@ -1,6 +1,9 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
--echo #
--echo # Bug#21869656 UNDO LOG DOES NOT CONTAIN ENOUGH INFORMATION
--echo # ON INDEXED VIRTUAL COLUMNS
@@ -182,4 +185,6 @@ SET GLOBAL innodb_max_purge_lag_wait=0;
CHECK TABLE t EXTENDED;
DROP TABLE t;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/include/crc32.pl b/mysql-test/suite/innodb/include/crc32.pl
index c2bce09d..b26f1057 100644
--- a/mysql-test/suite/innodb/include/crc32.pl
+++ b/mysql-test/suite/innodb/include/crc32.pl
@@ -31,3 +31,26 @@ sub mycrc32 {
return $crc;
}
+
+
+# Fix the checksum of an InnoDB tablespace page.
+# Inputs:
+# $page A bytestring with the page data.
+# $full_crc32 Checksum type, see get_full_crc32() in innodb-util.pl
+# Returns: the modified page as a bytestring.
+sub fix_page_crc {
+ my ($page, $full_crc32)= @_;
+ my $ps= length($page);
+ my $polynomial = 0x82f63b78; # CRC-32C
+ if ($full_crc32) {
+ my $ck = mycrc32(substr($page, 0, $ps - 4), 0, $polynomial);
+ substr($page, $ps - 4, 4) = pack("N", $ck);
+ } else {
+ my $ck= pack("N",
+ mycrc32(substr($page, 4, 22), 0, $polynomial) ^
+ mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
+ substr($page, 0, 4)= $ck;
+ substr($page, $ps-8, 4)= $ck;
+ }
+ return $page;
+}
diff --git a/mysql-test/suite/innodb/include/innodb-util.pl b/mysql-test/suite/innodb/include/innodb-util.pl
index 241545da..328ce5c7 100644
--- a/mysql-test/suite/innodb/include/innodb-util.pl
+++ b/mysql-test/suite/innodb/include/innodb-util.pl
@@ -124,3 +124,22 @@ sub ib_restore_ibd_files {
ib_restore_ibd_file($tmpd, $datadir, $db, $table);
}
}
+
+# Read the flag whether a tablespace is using full_crc32.
+# Input: filehandle opened on the tablespace.
+sub get_full_crc32 {
+ my ($TBLSPC)= @_;
+ my $old_pos= sysseek($TBLSPC, 0, 1);
+ die "tell() failed on tablespace filehandle: $!\n"
+ unless defined($old_pos);
+ sysseek($TBLSPC, 0, 0)
+ or die "sysseek() failed on tablespace filehandle: $!\n";
+ my $tblspc_hdr;
+ sysread($TBLSPC, $tblspc_hdr, 58)
+ or die "Cannot read tablespace header: $!\n";
+ sysseek($TBLSPC, $old_pos, 0)
+ or die "sysseek() failed on tablespace filehandle: $!\n";
+ my $full_crc32=
+ unpack("N", substr($tblspc_hdr, 54, 4)) & 0x10; # FIL_SPACE_FLAGS
+ return $full_crc32;
+}
diff --git a/mysql-test/suite/innodb/r/add_foreign_key.result b/mysql-test/suite/innodb/r/add_foreign_key.result
new file mode 100644
index 00000000..75177478
--- /dev/null
+++ b/mysql-test/suite/innodb/r/add_foreign_key.result
@@ -0,0 +1,31 @@
+#
+# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE ADD
+# FOREIGN KEY
+#
+CREATE TABLE `parent` (`parent_id` INT, PRIMARY KEY (`parent_id`));
+CREATE TABLE `child1` (`id` INT ,`child1_fk1` INT, `child1_fk2` INT,
+PRIMARY KEY (`id`));
+CREATE TABLE `child2` (`id` INT, `child2_fk1` INT, `child2_fk2` INT,
+PRIMARY KEY (`id`));
+CREATE TABLE `child3` (`id` INT , `child3_fk1` INT, PRIMARY KEY (`id`));
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES
+`parent` (`parent_id`);
+drop table child3, child2, child1, parent;
diff --git a/mysql-test/suite/innodb/r/alter_kill.result b/mysql-test/suite/innodb/r/alter_kill.result
index 86e53343..51814088 100644
--- a/mysql-test/suite/innodb/r/alter_kill.result
+++ b/mysql-test/suite/innodb/r/alter_kill.result
@@ -2,6 +2,7 @@
# Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP
#
SET GLOBAL innodb_file_per_table=1;
+SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB;
connect con1,localhost,root;
CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result
index d39edd3c..192584bc 100644
--- a/mysql-test/suite/innodb/r/alter_table.result
+++ b/mysql-test/suite/innodb/r/alter_table.result
@@ -117,9 +117,20 @@ ERROR 42000: Incorrect column specifier for column 'c'
CREATE TABLE t1 (c DATETIME AUTO_INCREMENT UNIQUE) ENGINE=InnoDB;
ERROR 42000: Incorrect column specifier for column 'c'
#
+# MDEV-31000 Assertion failed on ALTER TABLE...page_compressed=1
+#
+SET @save_file_per_table=@@GLOBAL.innodb_file_per_table;
+SET GLOBAL innodb_file_per_table=0;
+CREATE TABLE t (c INT PRIMARY KEY) ENGINE=INNODB;
+SET GLOBAL innodb_file_per_table=1;
+ALTER TABLE t page_compressed=1;
+SET GLOBAL innodb_file_per_table=@save_file_per_table;
+SELECT space>0 FROM information_schema.innodb_sys_tables WHERE name='test/t';
+space>0
+1
+DROP TABLE t;
# End of 10.4 tests
#
-#
# MDEV-21748 ASAN use-after-poison in PageBulk::insertPage()
#
CREATE TABLE t1 (pk TIMESTAMP PRIMARY KEY, a TIMESTAMP NULL UNIQUE)
@@ -136,3 +147,4 @@ CREATE TABLE t1 (id INT PRIMARY KEY, a YEAR, INDEX(id,a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,NULL),(2,NULL);
UPDATE t1 SET a=0;
DROP TABLE t1;
+# End of 10.5 tests
diff --git a/mysql-test/suite/innodb/r/cascade_lock_wait.result b/mysql-test/suite/innodb/r/cascade_lock_wait.result
new file mode 100644
index 00000000..9cc05df7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/cascade_lock_wait.result
@@ -0,0 +1,76 @@
+create table t1 (f1 int primary key) engine=innodb;
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1)
+on update cascade
+on delete cascade) engine=innodb;
+create table t3 (f1 int primary key,
+constraint c2 foreign key (f1) references t1(f1)
+on update cascade
+on delete cascade) engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`),
+ CONSTRAINT `c1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`),
+ CONSTRAINT `c2` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+insert into t2 values (1);
+insert into t2 values (2);
+insert into t2 values (3);
+insert into t3 values (1);
+insert into t3 values (2);
+insert into t3 values (3);
+select f1 from t1;
+f1
+1
+2
+3
+select f1 from t2;
+f1
+1
+2
+3
+select f1 from t3;
+f1
+1
+2
+3
+set @save_dbug = @@debug_dbug;
+set debug_dbug = '+d,dml_cascade_only_once';
+set debug_dbug = '+d,row_upd_cascade_lock_wait_err';
+update t1 set f1 = 100 where f1 = 2;
+select f1 from t1;
+f1
+1
+3
+100
+select f1 from t2;
+f1
+1
+3
+100
+select f1 from t3;
+f1
+1
+3
+100
+set debug_dbug = @save_dbug;
+drop table t2;
+drop table t3;
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
index d67dc8a6..2cab795f 100644
--- a/mysql-test/suite/innodb/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
@@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(1);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
-ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
+Got one of the listed errors
SELECT * FROM t2;
a
1
diff --git a/mysql-test/suite/innodb/r/dml_purge.result b/mysql-test/suite/innodb/r/dml_purge.result
index 2b345089..1ef8a5ea 100644
--- a/mysql-test/suite/innodb/r/dml_purge.result
+++ b/mysql-test/suite/innodb/r/dml_purge.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
#
# MDEV-12288 Reset DB_TRX_ID when the history is removed,
# to speed up MVCC
@@ -46,3 +48,4 @@ a b c
1 2 NULL
3 -3 NULL
DROP TABLE t1;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/r/doublewrite.result b/mysql-test/suite/innodb/r/doublewrite.result
index ba1965ed..65ff203a 100644
--- a/mysql-test/suite/innodb/r/doublewrite.result
+++ b/mysql-test/suite/innodb/r/doublewrite.result
@@ -1,23 +1,7 @@
#
-# Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY
-# Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST
-# PAGE OF SYSTEM TABLESPACE
+# MDEV-32242 innodb.doublewrite test case always is skipped
#
-SET GLOBAL innodb_fast_shutdown = 0;
-# restart
-show variables like 'innodb_doublewrite';
-Variable_name Value
-innodb_doublewrite ON
-show variables like 'innodb_fil_make_page_dirty_debug';
-Variable_name Value
-innodb_fil_make_page_dirty_debug 0
-show variables like 'innodb_saved_page_number_debug';
-Variable_name Value
-innodb_saved_page_number_debug 0
-connect stop_purge,localhost,root,,;
-START TRANSACTION WITH CONSISTENT SNAPSHOT;
-connection default;
-create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
+create table t1 (f1 int primary key, f2 blob) stats_persistent=0, engine=innodb;
start transaction;
insert into t1 values(1, repeat('#',12));
insert into t1 values(2, repeat('+',12));
@@ -25,195 +9,21 @@ insert into t1 values(3, repeat('/',12));
insert into t1 values(4, repeat('-',12));
insert into t1 values(5, repeat('.',12));
commit work;
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if first page of user
-# tablespace is full of zeroes.
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-begin;
-insert into t1 values (6, repeat('%', 12));
-# Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Make the first page dirty for table t1
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-# Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Kill the server
-disconnect stop_purge;
-# Make the first page (page_no=0) of the user tablespace
-# full of zeroes.
-#
-# MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer.
-# restart
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select f1, f2 from t1;
-f1 f2
-1 ############
-2 ++++++++++++
-3 ////////////
-4 ------------
-5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if first page of user
-# tablespace is corrupted.
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-# Ensure that dirty pages of table t1 is flushed.
-flush tables t1 for export;
-unlock tables;
-set global innodb_log_checkpoint_now=1;
-begin;
-insert into t1 values (6, repeat('%', 12));
-# Make the first page dirty for table t1
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-# Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Kill the server
-# Corrupt the first page (page_no=0) of the user tablespace.
-# restart
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select f1, f2 from t1;
-f1 f2
-1 ############
-2 ++++++++++++
-3 ////////////
-4 ------------
-5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if 2nd page of user
-# tablespace is full of zeroes.
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-# Ensure that dirty pages of table t1 is flushed.
-flush tables t1 for export;
-unlock tables;
-begin;
-insert into t1 values (6, repeat('%', 400));
-# Make the 2nd page dirty for table t1
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-# Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Kill the server
-# Make the 2nd page (page_no=1) of the tablespace all zeroes.
-# restart
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select f1, f2 from t1;
-f1 f2
-1 ############
-2 ++++++++++++
-3 ////////////
-4 ------------
-5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if 2nd page of user
-# tablespace is corrupted.
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-# Ensure that dirty pages of table t1 is flushed.
-flush tables t1 for export;
-unlock tables;
-begin;
-insert into t1 values (6, repeat('%', 400));
-# Make the 2nd page dirty for table t1
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-# Ensure that the dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Kill the server
-# Corrupt the 2nd page (page_no=1) of the user tablespace.
-# restart
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select f1, f2 from t1;
-f1 f2
-1 ############
-2 ++++++++++++
-3 ////////////
-4 ------------
-5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if first page of
-# system tablespace is full of zeroes.
-begin;
-insert into t1 values (6, repeat('%', 400));
-# Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Make the first page dirty for system tablespace
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = 0;
-# Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
-# Kill the server
-# Make the first page (page_no=0) of the system tablespace
-# all zeroes.
-# restart
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select f1, f2 from t1;
-f1 f2
-1 ############
-2 ++++++++++++
-3 ////////////
-4 ------------
-5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if first page of
-# system tablespace is corrupted.
-begin;
-insert into t1 values (6, repeat('%', 400));
-# Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Make the first page dirty for system tablespace
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = 0;
-# Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
-# Kill the server
-# Corrupt the first page (page_no=0) of the system tablespace.
+SET GLOBAL innodb_fast_shutdown = 0;
# restart
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select f1, f2 from t1;
-f1 f2
-1 ############
-2 ++++++++++++
-3 ////////////
-4 ------------
-5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if 2nd page of
-# system tablespace is full of zeroes.
-begin;
-insert into t1 values (6, repeat('%', 400));
-# Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Make the second page dirty for system tablespace
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = 0;
-# Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
+connect dml,localhost,root,,;
+XA START 'x';
+insert into t1 values (6, repeat('%', @@innodb_page_size/2));
+XA END 'x';
+XA PREPARE 'x';
+disconnect dml;
+connection default;
+flush table t1 for export;
# Kill the server
-# Make the 2nd page (page_no=1) of the system tablespace
-# all zeroes.
# restart
+FOUND 1 /InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile/ in mysqld.1.err
+FOUND 1 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=3\]/ in mysqld.1.err
+XA ROLLBACK 'x';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -224,27 +34,21 @@ f1 f2
3 ////////////
4 ------------
5 ............
-# Test End
-# ---------------------------------------------------------------
-# Test Begin: Test if recovery works if 2nd page of
-# system tablespace is corrupted.
-begin;
-insert into t1 values (6, repeat('%', 400));
-# Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-# Make the second page dirty for system tablespace
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = 0;
-# Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
+connect dml,localhost,root,,;
+XA START 'x';
+insert into t1 values (6, repeat('%', @@innodb_page_size/2));
+XA END 'x';
+XA PREPARE 'x';
+disconnect dml;
+connection default;
+flush table t1 for export;
# Kill the server
-# Make the 2nd page (page_no=1) of the system tablespace
-# all zeroes.
# restart
+FOUND 1 /InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile/ in mysqld.1.err
+XA ROLLBACK 'x';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-FOUND 1 /InnoDB: .*test.t1\.ibd/ in mysqld.1.err
select f1, f2 from t1;
f1 f2
1 ############
@@ -253,14 +57,4 @@ f1 f2
4 ------------
5 ............
drop table t1;
-#
-# MDEV-12600 crash during install_db with innodb_page_size=32K
-# and ibdata1=3M
-#
-# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
-SELECT * FROM INFORMATION_SCHEMA.ENGINES
-WHERE engine = 'innodb'
-AND support IN ('YES', 'DEFAULT', 'ENABLED');
-ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
-FOUND 1 /\[ERROR\] InnoDB: Cannot create doublewrite buffer/ in mysqld.1.err
-# restart
+# End of 10.5 tests
diff --git a/mysql-test/suite/innodb/r/doublewrite_debug.result b/mysql-test/suite/innodb/r/doublewrite_debug.result
new file mode 100644
index 00000000..aa141c18
--- /dev/null
+++ b/mysql-test/suite/innodb/r/doublewrite_debug.result
@@ -0,0 +1,94 @@
+#
+# Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY
+# Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST
+# PAGE OF SYSTEM TABLESPACE
+#
+show variables like 'innodb_doublewrite';
+Variable_name Value
+innodb_doublewrite ON
+show variables like 'innodb_fil_make_page_dirty_debug';
+Variable_name Value
+innodb_fil_make_page_dirty_debug 0
+show variables like 'innodb_saved_page_number_debug';
+Variable_name Value
+innodb_saved_page_number_debug 0
+create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
+start transaction;
+insert into t1 values(1, repeat('#',12));
+insert into t1 values(2, repeat('+',12));
+insert into t1 values(3, repeat('/',12));
+insert into t1 values(4, repeat('-',12));
+insert into t1 values(5, repeat('.',12));
+commit work;
+# Test Begin: Test if recovery works if 1st page and 2nd page
+# of system tablespace is full of zeroes.
+SET GLOBAL innodb_fast_shutdown = 0;
+# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
+begin;
+insert into t1 values (6, repeat('%', 400));
+# Make the first page dirty for system tablespace
+set global innodb_saved_page_number_debug = 0;
+set global innodb_fil_make_page_dirty_debug = 0;
+# Make the second page dirty for system tablespace
+set global innodb_saved_page_number_debug = 1;
+set global innodb_fil_make_page_dirty_debug = 0;
+set global innodb_buf_flush_list_now = 1;
+# Kill the server
+# Make the 1st page (page_no=0) and 2nd page (page_no=1)
+# of the system tablespace all zeroes.
+# restart
+FOUND 1 /InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile/ in mysqld.1.err
+FOUND 1 /InnoDB: Recovered page \[page id: space=0, page number=1\]/ in mysqld.1.err
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select f1, f2 from t1;
+f1 f2
+1 ############
+2 ++++++++++++
+3 ////////////
+4 ------------
+5 ............
+# Test End
+# ---------------------------------------------------------------
+# Test Begin: Test if recovery works if 1st page of
+# system tablespace is corrupted and 2nd page as corrupted.
+# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
+begin;
+insert into t1 values (6, repeat('%', 400));
+# Make the first page dirty for system tablespace
+set global innodb_saved_page_number_debug = 0;
+set global innodb_fil_make_page_dirty_debug = 0;
+# Make the second page dirty for system tablespace
+set global innodb_saved_page_number_debug = 1;
+set global innodb_fil_make_page_dirty_debug = 0;
+set global innodb_buf_flush_list_now = 1;
+# Kill the server
+# Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace.
+# restart
+FOUND 2 /InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile/ in mysqld.1.err
+FOUND 2 /InnoDB: Recovered page \[page id: space=0, page number=1\]/ in mysqld.1.err
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select f1, f2 from t1;
+f1 f2
+1 ############
+2 ++++++++++++
+3 ////////////
+4 ------------
+5 ............
+drop table t1;
+# Test End
+# ---------------------------------------------------------------
+#
+# MDEV-12600 crash during install_db with innodb_page_size=32K
+# and ibdata1=3M
+#
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-undo-tablespaces=0 --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+FOUND 1 /\[ERROR\] InnoDB: Cannot create doublewrite buffer/ in mysqld.1.err
+# restart
diff --git a/mysql-test/suite/innodb/r/fk_col_alter.result b/mysql-test/suite/innodb/r/fk_col_alter.result
index 403bef6a..c6fdc323 100644
--- a/mysql-test/suite/innodb/r/fk_col_alter.result
+++ b/mysql-test/suite/innodb/r/fk_col_alter.result
@@ -115,4 +115,17 @@ ALTER TABLE t2 DROP INDEX idx;
ALTER TABLE t2 MODIFY f2 VARCHAR(1023);
SET SESSION FOREIGN_KEY_CHECKS = ON;
DROP TABLE t2, t1;
+#
+# MDEV-32638 MariaDB crashes with foreign_key_checks=0
+# when changing a column and adding a foreign
+# key at the same time
+#
+CREATE TABLE t1(f1 VARCHAR(2) NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,
+f2 VARCHAR(10) NOT NULL DEFAULT '')ENGINE=InnoDB;
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t2 CHANGE COLUMN f2 f3 VARCHAR(20) NOT NULL,
+ADD CONSTRAINT t2_fk FOREIGN KEY(f3) REFERENCES t1(f1);
+DROP TABLE t2, t1;
+SET SESSION FOREIGN_KEY_CHECKS = ON;
# End of 10.4 tests
diff --git a/mysql-test/suite/innodb/r/fk_drop_alter.result b/mysql-test/suite/innodb/r/fk_drop_alter.result
new file mode 100644
index 00000000..414f44f2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/fk_drop_alter.result
@@ -0,0 +1,44 @@
+#
+# MDEV-22230 : Unexpected ER_ERROR_ON_RENAME upon DROP
+# non-existing FOREIGN KEY
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=COPY;
+ERROR 42000: Can't DROP FOREIGN KEY `x`; check that it exists
+ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=INPLACE;
+ERROR 42000: Can't DROP FOREIGN KEY `x`; check that it exists
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, FOREIGN KEY fk_id (a) REFERENCES t1(a))ENGINE=InnoDB;
+CREATE TABLE t3 (a INT, FOREIGN KEY fk_1 (a) REFERENCES t1(a))ENGINE=InnoDB;
+ALTER TABLE t3 DROP FOREIGN KEY IF EXISTS fk_id;
+Warnings:
+Note 1091 Can't DROP FOREIGN KEY `fk_id`; check that it exists
+DROP TABLE t3, t2;
+ALTER TABLE t1 MODIFY COLUMN a VARCHAR(2), DROP FOREIGN KEY IF EXISTS x;
+Warnings:
+Note 1091 Can't DROP FOREIGN KEY `x`; check that it exists
+DROP TABLE t1;
+CREATE DATABASE best;
+CREATE TABLE best.t1(f1 INT, KEY(f1))ENGINE=InnoDB;
+CREATE TABLE best.t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
+CREATE TABLE t1(f1 INT, KEY(f1))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
+ALTER TABLE t2 DROP FOREIGN KEY foo;
+ALTER TABLE t2 DROP FOREIGN KEY foo;
+ERROR 42000: Can't DROP FOREIGN KEY `foo`; check that it exists
+ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS foo;
+Warnings:
+Note 1091 Can't DROP FOREIGN KEY `foo`; check that it exists
+SHOW CREATE TABLE best.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) DEFAULT NULL,
+ KEY `foo` (`f1`),
+ CONSTRAINT `foo` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+ID FOR_NAME REF_NAME N_COLS TYPE
+best/foo best/t2 best/t1 1 0
+DROP TABLE best.t2, best.t1, t2, t1;
+DROP DATABASE best;
diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result
index 503825db..f7f87bd7 100644
--- a/mysql-test/suite/innodb/r/foreign-keys.result
+++ b/mysql-test/suite/innodb/r/foreign-keys.result
@@ -236,3 +236,10 @@ INSERT INTO t2 VALUES('G', 3);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`))
DROP TABLE t2, t1;
SET FOREIGN_KEY_CHECKS=DEFAULT;
+CREATE TABLE t1(a SERIAL) ENGINE=InnoDB ROW_FORMAT=COMPRESSED PAGE_COMPRESSED=1;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+SHOW WARNINGS;
+Level Code Message
+Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=COMPRESSED
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index bfed09d4..808e2270 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -1,3 +1,4 @@
+SET GLOBAL innodb_stats_persistent = 0;
#
# Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
# DICT_CREATE_FOREIGN_CONSTR
@@ -154,6 +155,8 @@ INSERT INTO parent SET a=0;
FLUSH TABLES;
# restart
disconnect incomplete;
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
INSERT INTO child SET a=0;
INSERT INTO child SET a=1;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE CASCADE)
@@ -722,7 +725,9 @@ pk a b
13 0 1
14 0 1
15 1 0
-disconnect con1;
+connection con1;
+COMMIT;
+connection default;
InnoDB 0 transactions not purged
CHECK TABLE t1;
Table Op Msg_type Msg_text
@@ -900,8 +905,29 @@ CONSTRAINT FK_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id)
ALTER TABLE t1 MODIFY id INT unsigned AUTO_INCREMENT;
DROP TABLE t1,t2;
#
-# End of 10.4 tests
+# MDEV-31441 BLOB corruption on UPDATE of PRIMARY KEY with FOREIGN KEY
#
+CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT) ENGINE=InnoDB;
+CREATE TABLE t2 (pk INT PRIMARY KEY, FOREIGN KEY (pk) REFERENCES t1(pk))
+ENGINE=InnoDB;
+SET @blob = REPEAT('A', @@innodb_page_size / 2);
+INSERT INTO t1 SET pk=1, t=@blob;
+INSERT INTO t2 SET pk=1;
+connection con1;
+BEGIN;
+DELETE FROM t2;
+connection default;
+UPDATE t1 SET pk=12;
+connection con1;
+COMMIT;
+disconnect con1;
+connection default;
+UPDATE t1 SET pk=1;
+SELECT pk,t=@blob FROM t1;
+pk t=@blob
+1 1
+DROP TABLE t2, t1;
+# End of 10.4 tests
#
# MDEV-20729 Fix REFERENCES constraint in column definition
#
@@ -1074,3 +1100,4 @@ test.collections check status OK
disconnect con1;
DROP TABLE binaries, collections;
# End of 10.6 tests
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result
index 32964be4..548e69c1 100644
--- a/mysql-test/suite/innodb/r/full_crc32_import.result
+++ b/mysql-test/suite/innodb/r/full_crc32_import.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
FLUSH TABLES;
# Treating compact format as dynamic format after import stmt
CREATE TABLE t1
@@ -200,3 +202,4 @@ a
3
DROP TABLE t1;
SET GLOBAL innodb_compression_algorithm=@save_algo;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result
index 1dc7f032..81ca907b 100644
--- a/mysql-test/suite/innodb/r/ibuf_not_empty.result
+++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result
@@ -14,6 +14,7 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index 'b' contains 990 entries, should be 1024.
test.t1 check error Corrupt
+SET GLOBAL innodb_buf_flush_list_now=ON;
# restart: --innodb-force_recovery=0
SET GLOBAL innodb_fast_shutdown=0;
# restart: --innodb-force_recovery=0
diff --git a/mysql-test/suite/innodb/r/import_update_stats.result b/mysql-test/suite/innodb/r/import_update_stats.result
new file mode 100644
index 00000000..ddf78f18
--- /dev/null
+++ b/mysql-test/suite/innodb/r/import_update_stats.result
@@ -0,0 +1,72 @@
+SET @old_innodb_file_per_table = @@innodb_file_per_table;
+SET GLOBAL innodb_file_per_table = 1;
+SELECT @@innodb_file_per_table;
+@@innodb_file_per_table
+1
+CREATE TABLE t1 (
+col_1 CHAR (255),
+col_2 VARCHAR (255)
+) ENGINE = InnoDB;
+CREATE INDEX idx1 ON t1(col_1);
+CREATE INDEX idx2 ON t1(col_2);
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 0 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 0 NULL NULL YES BTREE NO
+INSERT INTO t1 VALUES ("col1_00001", "col2_00001"), ("col1_00002", "col2_00002");
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE NO
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE NO
+FLUSH TABLES t1 FOR EXPORT;
+backup: t1
+UNLOCK TABLES;
+DROP TABLE t1;
+CREATE TABLE t1 (
+col_1 CHAR (255),
+col_2 VARCHAR (255)
+) ENGINE = InnoDB STATS_PERSISTENT=1;
+CREATE INDEX idx1 ON t1(col_1);
+CREATE INDEX idx2 ON t1(col_2);
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 0 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 0 NULL NULL YES BTREE NO
+INSERT INTO t1 VALUES ("col1_00001", "col2_00001");
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 1 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 1 NULL NULL YES BTREE NO
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 1 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 1 NULL NULL YES BTREE NO
+ALTER TABLE t1 DISCARD TABLESPACE;
+restore: t1 .ibd and .cfg files
+ALTER TABLE t1 IMPORT TABLESPACE;
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE NO
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SHOW INDEXES FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
+t1 1 idx1 1 col_1 A 2 NULL NULL YES BTREE NO
+t1 1 idx2 1 col_2 A 2 NULL NULL YES BTREE NO
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table;
diff --git a/mysql-test/suite/innodb/r/index_length.result b/mysql-test/suite/innodb/r/index_length.result
new file mode 100644
index 00000000..cc92780a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/index_length.result
@@ -0,0 +1,23 @@
+connect stop_purge,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(1024))
+ENGINE=InnoDB STATS_PERSISTENT=1;
+INSERT INTO t1 VALUES (1,REPEAT('b',1024));
+SELECT index_length FROM information_schema.tables
+WHERE table_schema = 'test' AND table_name = 't1';
+index_length
+0
+ALTER TABLE t1 ADD INDEX b (b(800));
+SELECT FLOOR(index_length/@@innodb_page_size) FROM information_schema.tables
+WHERE table_schema = 'test' AND table_name = 't1';
+FLOOR(index_length/@@innodb_page_size)
+1
+ALTER TABLE t1 ADD INDEX ba (b(800),a);
+SELECT FLOOR(index_length/@@innodb_page_size) FROM information_schema.tables
+WHERE table_schema = 'test' AND table_name = 't1';
+FLOOR(index_length/@@innodb_page_size)
+2
+disconnect stop_purge;
+DROP TABLE t1;
+# End of 10.4 tests
diff --git a/mysql-test/suite/innodb/r/index_merge_threshold.result b/mysql-test/suite/innodb/r/index_merge_threshold.result
index 41897b80..83f7ab33 100644
--- a/mysql-test/suite/innodb/r/index_merge_threshold.result
+++ b/mysql-test/suite/innodb/r/index_merge_threshold.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT,
c4 TINYBLOB,c5 BLOB,c6 MEDIUMBLOB,c7 LONGBLOB) ENGINE=InnoDB;
CREATE INDEX index1 ON tab(c1(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51';
@@ -1307,3 +1309,4 @@ name count_reset
index_page_merge_attempts 2
index_page_merge_successful 2
DROP TABLE tab1;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/r/innodb-16k.result b/mysql-test/suite/innodb/r/innodb-16k.result
index 3d62a2f8..a7fbe860 100644
--- a/mysql-test/suite/innodb/r/innodb-16k.result
+++ b/mysql-test/suite/innodb/r/innodb-16k.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
call mtr.add_suppression("InnoDB: Cannot add field .* in table");
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
@@ -505,6 +507,7 @@ INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
InnoDB 0 transactions not purged
SET GLOBAL innodb_compression_level=@save_level;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE tlong;
DROP TABLE tlong2;
diff --git a/mysql-test/suite/innodb/r/innodb-32k.result b/mysql-test/suite/innodb/r/innodb-32k.result
index b64ff332..8742a769 100644
--- a/mysql-test/suite/innodb/r/innodb-32k.result
+++ b/mysql-test/suite/innodb/r/innodb-32k.result
@@ -1,4 +1,25 @@
+SET GLOBAL innodb_stats_persistent = 0;
call mtr.add_suppression("Innodb: Cannot add field.*row size is");
+SET SESSION innodb_strict_mode=ON;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+SET SESSION innodb_strict_mode=OFF;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+DROP TABLE t1;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+Warnings:
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+DROP TABLE t1;
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
diff --git a/mysql-test/suite/innodb/r/innodb-64k.result b/mysql-test/suite/innodb/r/innodb-64k.result
index 75817956..c1724839 100644
--- a/mysql-test/suite/innodb/r/innodb-64k.result
+++ b/mysql-test/suite/innodb/r/innodb-64k.result
@@ -1,4 +1,24 @@
call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
+SET SESSION innodb_strict_mode=ON;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
+SET SESSION innodb_strict_mode=OFF;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+DROP TABLE t1;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+Warnings:
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+SHOW WARNINGS;
+Level Code Message
+Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+DROP TABLE t1;
# Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
diff --git a/mysql-test/suite/innodb/r/innodb-ac-non-locking-select.result b/mysql-test/suite/innodb/r/innodb-ac-non-locking-select.result
new file mode 100644
index 00000000..5d12c107
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-ac-non-locking-select.result
@@ -0,0 +1,62 @@
+CREATE TABLE t1 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(0, "0");
+INSERT INTO t1 VALUES(1, "1");
+INSERT INTO t1 VALUES(2, "2");
+INSERT INTO t1 VALUES(3, "3");
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connect con3,localhost,root,,;
+connect con4,localhost,root,,;
+connect con5,localhost,root,,;
+connect con6,localhost,root,,;
+connection default;
+SET AUTOCOMMIT=0;
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+c1 c2
+0 0
+1 1
+2 2
+3 3
+SELECT * FROM t1 WHERE c1 <= 3;
+c1 c2
+0 0
+1 1
+2 2
+3 3
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR waiting4';
+SET DEBUG_SYNC= 'RESET';
+SELECT trx_state, trx_query, trx_autocommit_non_locking
+FROM INFORMATION_SCHEMA.INNODB_TRX
+WHERE trx_state = 'LOCK WAIT'
+ORDER BY trx_query;
+trx_state trx_query trx_autocommit_non_locking
+LOCK WAIT SELECT COUNT(*) FROM t1 LOCK IN SHARE MODE 0
+LOCK WAIT SELECT COUNT(*) FROM t1 WHERE c1 >= 0 0
+INSERT INTO t1 VALUES(4, '4');
+COMMIT;
+connection con6;
+SELECT * FROM t1 WHERE c1 <= 4;
+c1 c2
+0 0
+1 1
+2 2
+3 3
+XA END '1';
+XA PREPARE '1';
+XA ROLLBACK '1';
+disconnect con6;
+disconnect con2;
+disconnect con3;
+disconnect con5;
+connection con1;
+COUNT(*)
+5
+disconnect con1;
+connection con4;
+COUNT(*)
+5
+disconnect con4;
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
index 4475abab..00a210b8 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
@@ -44,8 +44,6 @@ set DEBUG_SYNC="now WAIT_FOR default_signal";
# restart
disconnect con1;
SHOW KEYS FROM t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
-t1 1 f1 1 f1 A # NULL NULL BTREE NO
DROP TABLE t1;
#
# MDEV-25503 InnoDB hangs on startup during recovery
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index 16c33ee0..edeebac5 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -1090,3 +1090,59 @@ ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
# Cleanup
SET @@SQL_MODE= @OLD_SQL_MODE;
DROP TABLE t1;
+#
+# Bug#20977779 CANNOT IMPORT TABLES CONTAINING PREFIX INDEXES
+#
+CREATE TABLE t1 (c1 VARCHAR(32), c2 VARCHAR(32), c3 VARCHAR(32),
+PRIMARY KEY (c1, c2, c3))
+ENGINE=InnoDB;
+ALTER TABLE t1 ADD INDEX ind1(c1(5), c2, c3);
+ALTER TABLE t1 ADD INDEX ind2(c3, c1(10), c2);
+ALTER TABLE t1 ADD INDEX ind3(c2, c3, c1(20));
+INSERT INTO t1 VALUES ('Test Data -1', 'Test Data -2', 'Test Data -3');
+# Test with 2ndary index having prefix
+FLUSH TABLES test.t1 FOR EXPORT;
+UNLOCK TABLES;
+ALTER TABLE test.t1 DISCARD TABLESPACE;
+ALTER TABLE test.t1 IMPORT TABLESPACE;
+CHECK TABLE test.t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(32) NOT NULL,
+ `c2` varchar(32) NOT NULL,
+ `c3` varchar(32) NOT NULL,
+ PRIMARY KEY (`c1`,`c2`,`c3`),
+ KEY `ind1` (`c1`(5),`c2`,`c3`),
+ KEY `ind2` (`c3`,`c1`(10),`c2`),
+ KEY `ind3` (`c2`,`c3`,`c1`(20))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM test.t1;
+c1 c2 c3
+Test Data -1 Test Data -2 Test Data -3
+# Test with PK & 2ndary index with prefix
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1(5), c2(10), c3(20));
+FLUSH TABLES test.t1 FOR EXPORT;
+UNLOCK TABLES;
+ALTER TABLE test.t1 DISCARD TABLESPACE;
+ALTER TABLE test.t1 IMPORT TABLESPACE;
+CHECK TABLE test.t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(32) NOT NULL,
+ `c2` varchar(32) NOT NULL,
+ `c3` varchar(32) NOT NULL,
+ PRIMARY KEY (`c1`(5),`c2`(10),`c3`(20)),
+ KEY `ind1` (`c1`(5),`c2`,`c3`),
+ KEY `ind2` (`c3`,`c1`(10),`c2`),
+ KEY `ind3` (`c2`,`c3`,`c1`(20))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM test.t1;
+c1 c2 c3
+Test Data -1 Test Data -2 Test Data -3
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result
index 8173d30e..0be1ca5b 100644
--- a/mysql-test/suite/innodb/r/innodb-blob.result
+++ b/mysql-test/suite/innodb/r/innodb-blob.result
@@ -20,8 +20,6 @@ a RIGHT(b,20)
2 bbbbbbbbbbbbbbbbbbbb
connection default;
SET DEBUG='+d,row_ins_extern_checkpoint';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET DEBUG_SYNC='before_row_ins_extern_latch SIGNAL rec_not_blob WAIT_FOR crash';
ROLLBACK;
BEGIN;
@@ -88,8 +86,6 @@ BEGIN;
INSERT INTO t2 VALUES (347);
connection default;
SET DEBUG='+d,row_upd_extern_checkpoint';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET DEBUG_SYNC='before_row_upd_extern SIGNAL have_latch WAIT_FOR crash';
UPDATE t3 SET c=REPEAT('i',3000) WHERE a=2;
connection con2;
@@ -126,8 +122,6 @@ BEGIN;
INSERT INTO t2 VALUES (33101);
connection default;
SET DEBUG='+d,row_upd_extern_checkpoint';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET DEBUG_SYNC='after_row_upd_extern SIGNAL have_latch WAIT_FOR crash';
UPDATE t3 SET c=REPEAT('j',3000) WHERE a=2;
connection con2;
diff --git a/mysql-test/suite/innodb/r/innodb-index-debug.result b/mysql-test/suite/innodb/r/innodb-index-debug.result
index 0995b526..7167a80f 100644
--- a/mysql-test/suite/innodb/r/innodb-index-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-index-debug.result
@@ -92,8 +92,6 @@ ALTER TABLE t1 FORCE, ADD COLUMN k4 int;
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET debug = '+d,row_log_tmpfile_fail';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
INSERT INTO t1 select NULL,'aaa','bbb' from t480;
INSERT INTO t1 select NULL,'aaaa','bbbb' from t480;
SET DEBUG_SYNC= 'now SIGNAL flushed';
diff --git a/mysql-test/suite/innodb/r/innodb-index-online-fk.result b/mysql-test/suite/innodb/r/innodb-index-online-fk.result
index 84e8ea89..4903a6c1 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online-fk.result
@@ -608,3 +608,70 @@ test/e d a 0
test/fw c a 0
DROP TABLE t2;
DROP TABLE t3;
+# Bug #17449901 TABLE DISAPPEARS WHEN ALTERING
+# WITH FOREIGN KEY CHECKS OFF
+create table t1(f1 int,primary key(f1))engine=innodb;
+create table t2(f2 int,f3 int,key t(f2,f3),foreign key(f2) references t1(f1))engine=innodb;
+SET foreign_key_checks=0;
+drop index t on t2;
+drop table t2;
+drop table t1;
+create table t1(f1 int ,primary key(f1))engine=innodb;
+create table t2(f2 int,f3 int, key t(f2),foreign key(f2) references t1(f1))engine=innodb;
+SET foreign_key_checks = 0;
+alter table t2 drop key t,algorithm=inplace;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f2` int(11) DEFAULT NULL,
+ `f3` int(11) DEFAULT NULL,
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+drop table t2;
+drop table t1;
+create table t1(f1 int ,primary key(f1))engine=innodb;
+create table t2(f2 int,f3 int, key t(f2),key t1(f2,f3),
+foreign key(f2) references t1(f1))engine=innodb;
+SET foreign_key_checks = 0;
+alter table t2 drop key t,algorithm=inplace;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f2` int(11) DEFAULT NULL,
+ `f3` int(11) DEFAULT NULL,
+ KEY `t1` (`f2`,`f3`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+drop table t2;
+drop table t1;
+#
+# MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy
+# alter from creating invalid FK structures
+#
+CREATE TABLE t1(f1 INT, KEY(f1),
+FOREIGN KEY(f1) references t1(f1))ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ KEY `f1` (`f1`),
+ CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT, KEY(f1),
+FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ KEY `f1` (`f1`),
+ CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ALTER TABLE t1 DROP KEY f1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result
index e6b69f8f..5a287e58 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result
@@ -1,3 +1,5 @@
+SET GLOBAL innodb_monitor_reset_all=all;
+SET GLOBAL innodb_monitor_reset_all=default;
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table;
SET GLOBAL innodb_file_per_table = on;
@@ -155,6 +157,7 @@ test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE size 1 NULL Number of pages in the
connection con1;
KILL QUERY @id;
ERROR 70100: Query execution was interrupted
+SET GLOBAL innodb_max_purge_lag_wait=0;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done';
CREATE INDEX c2d ON t1(c2);
connection default;
@@ -221,13 +224,13 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1
connection default;
SET @merge_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
connection con1;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done';
@@ -274,13 +277,13 @@ name pos
c2 0
c3 1
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SELECT
(@merge_encrypt_1-@merge_encrypt_0)-
@@ -320,16 +323,16 @@ ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
ddl_log_file_alter_table 1
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
connection con1;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
@@ -405,16 +408,16 @@ ddl_sort_file_alter_table 0
ddl_log_file_alter_table 2
connection default;
SET @merge_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SELECT
(@merge_encrypt_2-@merge_encrypt_1)-
diff --git a/mysql-test/suite/innodb/r/innodb-lock-inherit-read_commited.result b/mysql-test/suite/innodb/r/innodb-lock-inherit-read_commited.result
new file mode 100644
index 00000000..ab0427ca
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-lock-inherit-read_commited.result
@@ -0,0 +1,121 @@
+#
+# Bug #21025880 DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN)
+#
+CREATE TABLE t1 (
+a INT NOT NULL,
+b INT NOT NULL,
+PRIMARY KEY(b),
+UNIQUE KEY(a))
+ENGINE=INNODB;
+SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
+SET GLOBAL innodb_stats_auto_recalc = OFF;
+connect purge_control,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+SET @old_tx_isolation = @@tx_isolation;
+SET GLOBAL tx_isolation = 'READ-COMMITTED';
+SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+connect con1,localhost,root,,;
+INSERT INTO t1 VALUES (1,1),(2,2);
+DELETE FROM t1;
+SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
+con1_locks_done WAIT_FOR con1_go';
+SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
+con1_insert_done WAIT_FOR con1_finish';
+REPLACE INTO t1 VALUES (1,2);
+connect con2,localhost,root,,;
+SET debug_sync = 'now WAIT_FOR con1_locks_done';
+SET debug_sync = 'lock_wait_start SIGNAL con2_blocked
+WAIT_FOR con2_go';
+SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock
+WAIT_FOR con2_finish';
+SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
+REPLACE INTO t1 VALUES (1,3);
+connection default;
+SET debug_sync = 'now WAIT_FOR con2_blocked';
+connection purge_control;
+COMMIT;
+disconnect purge_control;
+connection default;
+InnoDB 0 transactions not purged
+SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
+SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
+SET debug_sync = 'now SIGNAL con1_finish';
+connection con1;
+disconnect con1;
+connection default;
+SET debug_sync = 'now SIGNAL con2_finish';
+connection con2;
+disconnect con2;
+connection default;
+SET DEBUG_SYNC= 'RESET';
+SELECT * FROM t1;
+a b
+1 2
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
+SET GLOBAL tx_isolation = @old_tx_isolation;
+SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
+CREATE TABLE t1 (
+a INT NOT NULL,
+b INT NOT NULL,
+PRIMARY KEY(b),
+UNIQUE KEY(a))
+ENGINE=INNODB;
+SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
+SET GLOBAL innodb_stats_auto_recalc = OFF;
+connect purge_control,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+SET @old_tx_isolation = @@tx_isolation;
+SET GLOBAL tx_isolation = 'READ-COMMITTED';
+SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+connect con1,localhost,root,,;
+INSERT INTO t1 VALUES (1,1),(2,2);
+DELETE FROM t1;
+SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
+con1_locks_done WAIT_FOR con1_go';
+SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
+con1_insert_done WAIT_FOR con1_finish';
+INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2;
+connect con2,localhost,root,,;
+SET debug_sync = 'now WAIT_FOR con1_locks_done';
+SET debug_sync = 'lock_wait_start SIGNAL con2_blocked
+WAIT_FOR con2_go';
+SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock
+WAIT_FOR con2_finish';
+SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
+REPLACE INTO t1 VALUES (1,3);
+connection default;
+SET debug_sync = 'now WAIT_FOR con2_blocked';
+connection purge_control;
+COMMIT;
+disconnect purge_control;
+connection default;
+InnoDB 0 transactions not purged
+SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
+SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
+SET debug_sync = 'now SIGNAL con1_finish';
+connection con1;
+disconnect con1;
+connection default;
+SET debug_sync = 'now SIGNAL con2_finish';
+connection con2;
+disconnect con2;
+connection default;
+SET DEBUG_SYNC= 'RESET';
+SELECT * FROM t1;
+a b
+1 2
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
+SET GLOBAL tx_isolation = @old_tx_isolation;
+SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
diff --git a/mysql-test/suite/innodb/r/innodb-read-view.result b/mysql-test/suite/innodb/r/innodb-read-view.result
index e01d8a11..f3084fbd 100644
--- a/mysql-test/suite/innodb/r/innodb-read-view.result
+++ b/mysql-test/suite/innodb/r/innodb-read-view.result
@@ -9,9 +9,6 @@ INSERT INTO t2 VALUES(1, "b");
INSERT INTO t2 VALUES(2, "c");
INSERT INTO t2 VALUES(3, "d");
connect con1,localhost,root,,;
-connect con2,localhost,root,,;
-connection con1;
-'T1'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t2;
@@ -21,7 +18,6 @@ c1 c2
2 c
3 d
connection default;
-'T2'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t1;
@@ -30,8 +26,7 @@ c1 c2
1 1
2 2
3 3
-connection con2;
-'T3'
+connect con2,localhost,root,,;
SET AUTOCOMMIT=0;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
@@ -48,7 +43,6 @@ c1 c2
2 c
3 d
connection con1;
-'T1'
UPDATE t2 SET c1 = c1 + 100;
SELECT * FROM t2;
c1 c2
@@ -58,7 +52,6 @@ c1 c2
103 d
COMMIT;
connection default;
-'T2'
UPDATE t1 SET c1 = c1 + 100;
SELECT * FROM t1;
c1 c2
@@ -68,42 +61,29 @@ c1 c2
103 3
COMMIT;
connection con2;
-'T3'
SET DEBUG_SYNC='row_search_for_mysql_before_return WAIT_FOR waiting1';
SELECT * FROM t1;;
connection default;
-'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
-'Signalled T3'
connection con2;
-'T3'
c1 c2
0 0
1 1
2 2
3 3
connection con2;
-'T3'
SET DEBUG_SYNC='row_search_for_mysql_before_return WAIT_FOR waiting1';
SELECT * FROM t2;;
connection default;
-'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
-'Signalled T3'
connection con2;
-'T3'
c1 c2
0 a
1 b
2 c
3 d
connection default;
-disconnect con1;
-disconnect con2;
-connect con1,localhost,root,,;
-connect con2,localhost,root,,;
connection con1;
-'T1'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t1;
@@ -113,7 +93,6 @@ c1 c2
102 2
103 3
connection default;
-'T2'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t2;
@@ -131,7 +110,6 @@ c1 c2
203 d
COMMIT;
connection con2;
-'T3'
SET AUTOCOMMIT=0;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
@@ -148,7 +126,6 @@ c1 c2
202 c
203 d
connection con1;
-'T1'
UPDATE t1 SET c1 = c1 + 100;
SELECT * FROM t1;
c1 c2
@@ -158,44 +135,34 @@ c1 c2
203 3
COMMIT;
connection con2;
-'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
SELECT * FROM t1;;
connection con1;
-'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
-'Signalled T3'
connection con2;
-'T3'
c1 c2
100 0
101 1
102 2
103 3
-connection con2;
-'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
SELECT * FROM t2;;
connection default;
-'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
-'Signalled T3'
connection con2;
-'T3'
c1 c2
200 a
201 b
202 c
203 d
-connection default;
-disconnect con1;
disconnect con2;
+connection default;
DROP TABLE t1;
DROP TABLE t2;
#
# Bug 21433768: NON-REPEATABLE READ WITH REPEATABLE READ ISOLATION
#
-connect con1,localhost,root,,;
+connection con1;
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 INT) ENGINE = InnoDB;
INSERT INTO t1 values (1, 0), (2, 0);
SELECT * FROM t1 ORDER BY col1;
@@ -218,5 +185,5 @@ SET DEBUG_SYNC = 'now SIGNAL s2';
connection con1;
disconnect con1;
connection default;
-DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result
index c770d106..ac966d3f 100644
--- a/mysql-test/suite/innodb/r/innodb-system-table-view.result
+++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_table_stats';
SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables
@@ -173,3 +175,4 @@ DROP TABLE parent;
SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary';
SPACE
4294967294
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result
index 9296fded..76811ced 100644
--- a/mysql-test/suite/innodb/r/innodb-table-online.result
+++ b/mysql-test/suite/innodb/r/innodb-table-online.result
@@ -1,3 +1,5 @@
+SET GLOBAL innodb_monitor_reset_all=all;
+SET GLOBAL innodb_monitor_reset_all=default;
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
call mtr.add_suppression("InnoDB: Error: table 'test/t1'");
call mtr.add_suppression("MariaDB is trying to open a table handle but the .ibd file for");
@@ -38,16 +40,10 @@ SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR HY000: Out of memory.
SET SESSION DEBUG = @saved_debug_dbug;
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR HY000: Out of memory.
SET SESSION DEBUG = @saved_debug_dbug;
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
connection default;
SHOW CREATE TABLE t1;
@@ -179,13 +175,13 @@ Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET @merge_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
connection con1;
SHOW CREATE TABLE t1;
@@ -237,13 +233,13 @@ ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
ddl_log_file_alter_table 1
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SELECT
(@merge_encrypt_1-@merge_encrypt_0)-
@@ -263,16 +259,16 @@ ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
ddl_log_file_alter_table 1
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SET GLOBAL innodb_max_purge_lag_wait=0;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done';
@@ -320,16 +316,16 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SET @merge_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SELECT
(@merge_encrypt_2-@merge_encrypt_1)-
diff --git a/mysql-test/suite/innodb/r/innodb-truncate.result b/mysql-test/suite/innodb/r/innodb-truncate.result
index 3bcee0e8..5b7d052b 100644
--- a/mysql-test/suite/innodb/r/innodb-truncate.result
+++ b/mysql-test/suite/innodb/r/innodb-truncate.result
@@ -86,11 +86,10 @@ CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB;
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t3` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t1 RENAME TO t3;
-ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 150 "Foreign key constraint is incorrectly formed")
-ALTER TABLE t1 FORCE;
-TRUNCATE TABLE t1;
-ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `test`.`t1` (`f2`))
-DROP TABLE t2, t1;
+ALTER TABLE t3 FORCE;
+TRUNCATE TABLE t3;
+ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `test`.`t3` (`f2`))
+DROP TABLE t2, t3;
#
# MDEV-24861 Assertion `trx->rsegs.m_redo.rseg' failed
# in innodb_prepare_commit_versioned
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-1.result b/mysql-test/suite/innodb/r/innodb-wl5522-1.result
index 204d6bc8..42c0631d 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-1.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-1.result
@@ -808,6 +808,18 @@ call mtr.add_suppression("InnoDB: unsupported MySQL tablespace");
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MariaDB version
DROP TABLE t1;
-#
# End of 10.3 tests
#
+# MDEV-29972 crash after "Unsupported meta-data version number"
+#
+call mtr.add_suppression("Index for table 't2' is corrupt");
+CREATE TABLE t2 (i INT PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE t2 DISCARD TABLESPACE;
+ALTER TABLE t2 IMPORT TABLESPACE;
+ERROR 42000: This version of MariaDB doesn't yet support 'meta-data version'
+ALTER TABLE t2 IMPORT TABLESPACE;
+ERROR HY000: Index for table 't2' is corrupt; try to repair it
+SELECT * FROM t2;
+ERROR HY000: Tablespace has been discarded for table `t2`
+DROP TABLE t2;
+# End of 10.4 tests
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index 6cd6377f..e9f70621 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -2472,7 +2472,7 @@ INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
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 fa17487d..33adf9ba 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
@@ -3,17 +3,8 @@ 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_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_dump_pct=1;
-SELECT @@global.innodb_buffer_pool_dump_pct;
-@@global.innodb_buffer_pool_dump_pct
-1
-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_dump_pct=DEFAULT;
DROP TABLE tab5;
diff --git a/mysql-test/suite/innodb/r/innodb_bug12902967.result b/mysql-test/suite/innodb/r/innodb_bug12902967.result
deleted file mode 100644
index ddb2e12f..00000000
--- a/mysql-test/suite/innodb/r/innodb_bug12902967.result
+++ /dev/null
@@ -1,6 +0,0 @@
-call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
-# restart
-create table t1 (f1 integer primary key) engine innodb;
-alter table t1 add constraint c1 foreign key (f1) references t1(f1);
-ERROR HY000: Error on rename of '#sql-alter' to './test/t1' (errno: 150 "Foreign key constraint is incorrectly formed")
-drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result
index 05239950..2f1169f4 100644
--- a/mysql-test/suite/innodb/r/innodb_force_recovery.result
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result
@@ -4,9 +4,18 @@ insert into t1 values(1, 2);
insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
# restart: --innodb-force-recovery=4
+SELECT CAST(variable_value AS INTEGER) INTO @read1
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
select * from t1;
f1 f2
1 2
+SELECT CAST(variable_value AS INTEGER) INTO @read2
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
+SELECT @read1>0, @read2>@read1;
+@read1>0 @read2>@read1
+1 1
begin;
insert into t1 values(2, 3);
rollback;
diff --git a/mysql-test/suite/innodb/r/innodb_i_s_innodb_locks.result b/mysql-test/suite/innodb/r/innodb_i_s_innodb_locks.result
new file mode 100644
index 00000000..a410362a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_i_s_innodb_locks.result
Binary files differ
diff --git a/mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result b/mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result
new file mode 100644
index 00000000..99de7d5f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result
@@ -0,0 +1,90 @@
+SET @save_timeout=@@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout=100000000;
+DESCRIBE INFORMATION_SCHEMA.INNODB_TRX;
+Field Type Null Key Default Extra
+trx_id bigint(21) unsigned NO NULL
+trx_state varchar(13) NO NULL
+trx_started datetime NO NULL
+trx_requested_lock_id varchar(81) YES NULL
+trx_wait_started datetime YES NULL
+trx_weight bigint(21) unsigned NO NULL
+trx_mysql_thread_id bigint(21) unsigned NO NULL
+trx_query varchar(1024) YES NULL
+trx_operation_state varchar(64) YES NULL
+trx_tables_in_use bigint(21) unsigned NO NULL
+trx_tables_locked bigint(21) unsigned NO NULL
+trx_lock_structs bigint(21) unsigned NO NULL
+trx_lock_memory_bytes bigint(21) unsigned NO NULL
+trx_rows_locked bigint(21) unsigned NO NULL
+trx_rows_modified bigint(21) unsigned NO NULL
+trx_concurrency_tickets bigint(21) unsigned NO NULL
+trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO NULL
+trx_unique_checks int(1) NO NULL
+trx_foreign_key_checks int(1) NO NULL
+trx_last_foreign_key_error varchar(256) YES NULL
+trx_is_read_only int(1) NO NULL
+trx_autocommit_non_locking int(1) NO NULL
+CREATE TABLE t1 (
+c01 INT,
+c02 INT,
+PRIMARY KEY (c01)
+) ENGINE=INNODB STATS_AUTO_RECALC=0;
+INSERT INTO t1 VALUES
+(1,2),(2,4),(3,6),(4,8);
+CREATE TABLE t2 (
+c01 INT,
+c02 INT,
+PRIMARY KEY (c01),
+FOREIGN KEY fk1 (c02) REFERENCES t1 (c01)
+) ENGINE=INNODB STATS_AUTO_RECALC=0;
+INSERT INTO t2 VALUES
+(1,1),(2,2),(3,3);
+connect con_trx,localhost,root,,;
+connect con_verify_innodb_trx,localhost,root,,;
+connection con_trx;
+SET autocommit=0;
+INSERT INTO t1 VALUES (5,10);
+SELECT * FROM t1 FOR UPDATE;
+c01 c02
+1 2
+2 4
+3 6
+4 8
+5 10
+connection con_verify_innodb_trx;
+SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked,
+trx_rows_locked, trx_rows_modified, trx_concurrency_tickets,
+trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
+FROM INFORMATION_SCHEMA.INNODB_TRX;
+trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks
+RUNNING 3 0 1 6 1 0 REPEATABLE READ 1 1
+connection con_trx;
+ROLLBACK;
+SET FOREIGN_KEY_CHECKS = 0;
+SET UNIQUE_CHECKS = 0;
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
+INSERT INTO t1 VALUES (6,12);
+connection con_verify_innodb_trx;
+SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
+FROM INFORMATION_SCHEMA.INNODB_TRX;
+trx_isolation_level trx_unique_checks trx_foreign_key_checks
+SERIALIZABLE 0 0
+connection con_trx;
+ROLLBACK;
+SET FOREIGN_KEY_CHECKS = 1;
+SET UNIQUE_CHECKS = 1;
+BEGIN;
+INSERT INTO t2 VALUES (4,10);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`))
+disconnect con_trx;
+connection con_verify_innodb_trx;
+SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error
+FROM INFORMATION_SCHEMA.INNODB_TRX;
+trx_state trx_isolation_level trx_last_foreign_key_error
+RUNNING REPEATABLE READ `test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)
+disconnect con_verify_innodb_trx;
+connection default;
+DROP TABLE t2;
+DROP TABLE t1;
+SET GLOBAL innodb_lock_wait_timeout=@save_timeout;
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema_tables.result b/mysql-test/suite/innodb/r/innodb_information_schema_tables.result
index ea713ea6..87ff94a9 100644
--- a/mysql-test/suite/innodb/r/innodb_information_schema_tables.result
+++ b/mysql-test/suite/innodb/r/innodb_information_schema_tables.result
@@ -1,2 +1,3 @@
+FOUND 1 /\[Warning\] InnoDB: innodb_open_files 1000000 should not be greater than the open_files_limit [0-9]+/ in mysqld.1.err
CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index aa8cc118..d142c0e4 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2382,6 +2382,10 @@ key_len NULL
ref NULL
rows 6
Extra Using where
+Warnings:
+Level Note
+Code 1105
+Message Cannot use key `PRIMARY` part[0] for lookup: `test`.`bar`.`c` of type `char` > "2" of type `int`
EXPLAIN SELECT c FROM foo WHERE c>2;;
id 1
select_type SIMPLE
@@ -2393,6 +2397,10 @@ key_len NULL
ref NULL
rows 6
Extra Using where
+Warnings:
+Level Note
+Code 1105
+Message Cannot use key `PRIMARY` part[0] for lookup: `test`.`foo`.`c` of type `char` > "2" of type `int`
EXPLAIN SELECT c FROM foo2 WHERE c>2;;
id 1
select_type SIMPLE
@@ -2404,6 +2412,10 @@ key_len 5
ref NULL
rows 6
Extra Using where; Using index
+Warnings:
+Level Note
+Code 1105
+Message Cannot use key `PRIMARY` part[0] for lookup: `test`.`foo2`.`c` of type `char` > "2" of type `int`
DROP TABLE foo, bar, foo2;
#
# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table
diff --git a/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
index 1e97c21c..1ccf79e4 100644
--- a/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
+++ b/mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
@@ -90,3 +90,19 @@ worklog5743;
col_1_text = REPEAT("a", 3500) col_2_text = REPEAT("o", 3500)
1 1
DROP TABLE worklog5743;
+#
+# MDEV-21245 InnoDB: Using a partial-field key prefix in search
+#
+CREATE TABLE t1 (a VARCHAR(255), KEY k(a)) DEFAULT CHARSET=utf8mb3
+ENGINE=InnoDB;
+INSERT INTO t1 set a='';
+alter table t1 change a a varchar(3000);
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Note 1071 Specified key was too long; max key length is 3072 bytes
+SELECT * FROM t1 WHERE a IN ('');
+a
+
+DROP TABLE t1;
+# End of 10.4 tests
diff --git a/mysql-test/suite/innodb/r/innodb_scrub.result b/mysql-test/suite/innodb/r/innodb_scrub.result
index b4a418ce..475d4e74 100644
--- a/mysql-test/suite/innodb/r/innodb_scrub.result
+++ b/mysql-test/suite/innodb/r/innodb_scrub.result
@@ -1,6 +1,6 @@
CREATE TABLE t1(f1 int auto_increment primary key,
f2 varchar(256),
-f3 text) engine = innodb;
+f3 text) engine = innodb stats_persistent=0;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
FOUND 500500 /unicycle|repairman/ in t1.ibd
diff --git a/mysql-test/suite/innodb/r/innodb_stats_auto_recalc.result b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc.result
new file mode 100644
index 00000000..40eae0a9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc.result
@@ -0,0 +1,44 @@
+CREATE TABLE autorecalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+SELECT n_rows, clustered_index_size FROM mysql.innodb_table_stats WHERE table_name = 'autorecalc';
+n_rows 0
+clustered_index_size 1
+SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'autorecalc';
+index_name PRIMARY
+stat_name n_diff_pfx01
+stat_value 0
+index_name PRIMARY
+stat_name n_leaf_pages
+stat_value 1
+index_name PRIMARY
+stat_name size
+stat_value 1
+INSERT INTO autorecalc VALUES (1);
+INSERT INTO autorecalc VALUES (2);
+SELECT n_rows, clustered_index_size FROM mysql.innodb_table_stats WHERE table_name = 'autorecalc';
+n_rows 2
+clustered_index_size 1
+SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'autorecalc';
+index_name PRIMARY
+stat_name n_diff_pfx01
+stat_value 2
+index_name PRIMARY
+stat_name n_leaf_pages
+stat_value 1
+index_name PRIMARY
+stat_name size
+stat_value 1
+DELETE FROM autorecalc;
+SELECT n_rows, clustered_index_size FROM mysql.innodb_table_stats WHERE table_name = 'autorecalc';
+n_rows 0
+clustered_index_size 1
+SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'autorecalc';
+index_name PRIMARY
+stat_name n_diff_pfx01
+stat_value 0
+index_name PRIMARY
+stat_name n_leaf_pages
+stat_value 1
+index_name PRIMARY
+stat_name size
+stat_value 1
+DROP TABLE autorecalc;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_ddl.result b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_ddl.result
new file mode 100644
index 00000000..8c68fe74
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_ddl.result
@@ -0,0 +1,34 @@
+CREATE TABLE arddl (a INT, b INT, PRIMARY KEY (a)) ENGINE=INNODB;
+INSERT INTO arddl VALUES (1, 10);
+INSERT INTO arddl VALUES (2, 10);
+ALTER TABLE arddl ADD INDEX (b);
+SELECT n_rows FROM mysql.innodb_table_stats WHERE table_name = 'arddl' ORDER BY 1;
+n_rows 2
+SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'arddl' AND index_name = 'PRIMARY' ORDER BY 1, 2, 3;
+index_name PRIMARY
+stat_name n_diff_pfx01
+stat_value 2
+index_name PRIMARY
+stat_name n_leaf_pages
+stat_value 1
+index_name PRIMARY
+stat_name size
+stat_value 1
+DROP TABLE arddl;
+CREATE TABLE arddl (a INT, b INT, PRIMARY KEY (a), KEY (b)) ENGINE=INNODB;
+INSERT INTO arddl VALUES (3, 10);
+INSERT INTO arddl VALUES (4, 10);
+ALTER TABLE arddl DROP INDEX b;
+SELECT n_rows FROM mysql.innodb_table_stats WHERE table_name = 'arddl' ORDER BY 1;
+n_rows 2
+SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'arddl' AND index_name = 'PRIMARY' ORDER BY 1, 2, 3;
+index_name PRIMARY
+stat_name n_diff_pfx01
+stat_value 2
+index_name PRIMARY
+stat_name n_leaf_pages
+stat_value 1
+index_name PRIMARY
+stat_name size
+stat_value 1
+DROP TABLE arddl;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_lots.result b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_lots.result
new file mode 100644
index 00000000..746bce56
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_lots.result
@@ -0,0 +1,202 @@
+SELECT table_name, n_rows FROM mysql.innodb_table_stats WHERE table_name LIKE 'ar_%' ORDER BY table_name;
+table_name n_rows
+ar_1001 0
+ar_1002 0
+ar_1003 0
+ar_1004 0
+ar_1005 0
+ar_1006 0
+ar_1007 0
+ar_1008 0
+ar_1009 0
+ar_1010 0
+ar_1011 0
+ar_1012 0
+ar_1013 0
+ar_1014 0
+ar_1015 0
+ar_1016 0
+ar_1017 0
+ar_1018 0
+ar_1019 0
+ar_1020 0
+ar_1021 0
+ar_1022 0
+ar_1023 0
+ar_1024 0
+ar_1025 0
+ar_1026 0
+ar_1027 0
+ar_1028 0
+ar_1029 0
+ar_1030 0
+ar_1031 0
+ar_1032 0
+ar_1033 0
+ar_1034 0
+ar_1035 0
+ar_1036 0
+ar_1037 0
+ar_1038 0
+ar_1039 0
+ar_1040 0
+ar_1041 0
+ar_1042 0
+ar_1043 0
+ar_1044 0
+ar_1045 0
+ar_1046 0
+ar_1047 0
+ar_1048 0
+ar_1049 0
+ar_1050 0
+ar_1051 0
+ar_1052 0
+ar_1053 0
+ar_1054 0
+ar_1055 0
+ar_1056 0
+ar_1057 0
+ar_1058 0
+ar_1059 0
+ar_1060 0
+ar_1061 0
+ar_1062 0
+ar_1063 0
+ar_1064 0
+ar_1065 0
+ar_1066 0
+ar_1067 0
+ar_1068 0
+ar_1069 0
+ar_1070 0
+ar_1071 0
+ar_1072 0
+ar_1073 0
+ar_1074 0
+ar_1075 0
+ar_1076 0
+ar_1077 0
+ar_1078 0
+ar_1079 0
+ar_1080 0
+ar_1081 0
+ar_1082 0
+ar_1083 0
+ar_1084 0
+ar_1085 0
+ar_1086 0
+ar_1087 0
+ar_1088 0
+ar_1089 0
+ar_1090 0
+ar_1091 0
+ar_1092 0
+ar_1093 0
+ar_1094 0
+ar_1095 0
+ar_1096 0
+ar_1097 0
+ar_1098 0
+ar_1099 0
+ar_1100 0
+ar_1101 0
+ar_1102 0
+ar_1103 0
+ar_1104 0
+ar_1105 0
+ar_1106 0
+ar_1107 0
+ar_1108 0
+ar_1109 0
+ar_1110 0
+ar_1111 0
+ar_1112 0
+ar_1113 0
+ar_1114 0
+ar_1115 0
+ar_1116 0
+ar_1117 0
+ar_1118 0
+ar_1119 0
+ar_1120 0
+ar_1121 0
+ar_1122 0
+ar_1123 0
+ar_1124 0
+ar_1125 0
+ar_1126 0
+ar_1127 0
+ar_1128 0
+ar_1129 0
+ar_1130 0
+ar_1131 0
+ar_1132 0
+ar_1133 0
+ar_1134 0
+ar_1135 0
+ar_1136 0
+ar_1137 0
+ar_1138 0
+ar_1139 0
+ar_1140 0
+ar_1141 0
+ar_1142 0
+ar_1143 0
+ar_1144 0
+ar_1145 0
+ar_1146 0
+ar_1147 0
+ar_1148 0
+ar_1149 0
+ar_1150 0
+ar_1151 0
+ar_1152 0
+ar_1153 0
+ar_1154 0
+ar_1155 0
+ar_1156 0
+ar_1157 0
+ar_1158 0
+ar_1159 0
+ar_1160 0
+ar_1161 0
+ar_1162 0
+ar_1163 0
+ar_1164 0
+ar_1165 0
+ar_1166 0
+ar_1167 0
+ar_1168 0
+ar_1169 0
+ar_1170 0
+ar_1171 0
+ar_1172 0
+ar_1173 0
+ar_1174 0
+ar_1175 0
+ar_1176 0
+ar_1177 0
+ar_1178 0
+ar_1179 0
+ar_1180 0
+ar_1181 0
+ar_1182 0
+ar_1183 0
+ar_1184 0
+ar_1185 0
+ar_1186 0
+ar_1187 0
+ar_1188 0
+ar_1189 0
+ar_1190 0
+ar_1191 0
+ar_1192 0
+ar_1193 0
+ar_1194 0
+ar_1195 0
+ar_1196 0
+ar_1197 0
+ar_1198 0
+ar_1199 0
+ar_1200 0
diff --git a/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_on_nonexistent.result b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_on_nonexistent.result
new file mode 100644
index 00000000..6b239743
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_auto_recalc_on_nonexistent.result
@@ -0,0 +1,60 @@
+Test with default setting
+CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 1
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 3
+SELECT * FROM t;
+FLUSH TABLE t;
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT * FROM t;
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 1
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 3
+DROP TABLE t;
+Test with explicit enable
+CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB STATS_AUTO_RECALC=1;
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 1
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 3
+SELECT * FROM t;
+FLUSH TABLE t;
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT * FROM t;
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 1
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 3
+DROP TABLE t;
+Test with explicit disable
+CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB STATS_AUTO_RECALC=0;
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 1
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 3
+SELECT * FROM t;
+FLUSH TABLE t;
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT * FROM t;
+SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
+COUNT(*) 0
+SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
+COUNT(*) 0
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_external_pages.result b/mysql-test/suite/innodb/r/innodb_stats_external_pages.result
new file mode 100644
index 00000000..52e1e153
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_external_pages.result
@@ -0,0 +1,10 @@
+CREATE TABLE bug18384390 (
+id INT AUTO_INCREMENT PRIMARY KEY,
+txt VARCHAR(10000)
+) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=0;
+INSERT INTO bug18384390 (txt) SELECT REPEAT('0', 10000) FROM seq_1_to_1024;
+set use_stat_tables=never;
+ANALYZE TABLE bug18384390;
+Table Op Msg_type Msg_text
+test.bug18384390 analyze status OK
+DROP TABLE bug18384390;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_fetch.result b/mysql-test/suite/innodb/r/innodb_stats_fetch.result
index d7b7d78e..df6bc4b0 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_fetch.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_fetch.result
@@ -150,3 +150,27 @@ max_data_length 0
index_length 16384
DROP TABLE test_ps_fetch;
set @@use_stat_tables = @save_use_stat_tables;
+#
+# MDEV-28613 LeakSanitizer caused by I_S query using LIMIT ROWS EXAMINED
+#
+CREATE TABLE t1(f1 VARCHAR(255), FULLTEXT(f1))ENGINE=InnoDB;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES LIMIT ROWS EXAMINED 5;
+Warnings:
+Level Warning
+Code 1931
+Message Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES LIMIT ROWS EXAMINED 5;
+Warnings:
+Level Warning
+Code 1931
+Message Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS LIMIT ROWS EXAMINED 5;
+Warnings:
+Level Warning
+Code 1931
+Message Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 5. The query result may be incomplete
+SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS LIMIT ROWS EXAMINED 5;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_flag_global,off.rdiff b/mysql-test/suite/innodb/r/innodb_stats_flag_global,off.rdiff
new file mode 100644
index 00000000..f5b23543
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_flag_global,off.rdiff
@@ -0,0 +1,34 @@
+@@ -18,7 +18,7 @@
+ test.test_ps_flag analyze status OK
+ SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+ cnt_after
+-1
++0
+ DROP TABLE test_ps_flag;
+ CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=default;
+ SHOW CREATE TABLE test_ps_flag;
+@@ -37,7 +37,7 @@
+ test.test_ps_flag analyze status OK
+ SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+ cnt_after
+-1
++0
+ DROP TABLE test_ps_flag;
+ =====
+ === Test ANALYZE behavior after creation with explicit PS=OFF
+@@ -142,7 +142,7 @@
+ test.test_ps_flag analyze status OK
+ SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+ cnt_after
+-1
++0
+ DROP TABLE test_ps_flag;
+ =====
+ === Test ANALYZE behavior after creation with explicit PS=ON,
+@@ -203,5 +203,5 @@
+ test.test_ps_flag analyze status OK
+ SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+ cnt_after
+-1
++0
+ DROP TABLE test_ps_flag;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_flag_global.result b/mysql-test/suite/innodb/r/innodb_stats_flag_global.result
new file mode 100644
index 00000000..8bafb725
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_flag_global.result
@@ -0,0 +1,207 @@
+=====
+=== Test ANALYZE behavior after default creation
+=====
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+DROP TABLE test_ps_flag;
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=default;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+DROP TABLE test_ps_flag;
+=====
+=== Test ANALYZE behavior after creation with explicit PS=OFF
+=====
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+0
+DROP TABLE test_ps_flag;
+=====
+=== Test ANALYZE behavior after creation with explicit PS=ON
+=====
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=1;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+DROP TABLE test_ps_flag;
+=====
+=== Test ANALYZE behavior after creation with explicit PS=OFF,
+=== then ALTER to ON, then ALTER to OFF, then ALTER to default
+=====
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
+ALTER TABLE test_ps_flag STATS_PERSISTENT=1;
+# restart
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+ALTER TABLE test_ps_flag STATS_PERSISTENT=0;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+0
+ALTER TABLE test_ps_flag STATS_PERSISTENT=default;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+DROP TABLE test_ps_flag;
+=====
+=== Test ANALYZE behavior after creation with explicit PS=ON,
+=== then ALTER to OFF, then ALTER to ON, then ALTER to default
+=====
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=1;
+ALTER TABLE test_ps_flag STATS_PERSISTENT=0;
+# restart
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+0
+ALTER TABLE test_ps_flag STATS_PERSISTENT=1;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=1
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+ALTER TABLE test_ps_flag STATS_PERSISTENT=default;
+SHOW CREATE TABLE test_ps_flag;
+Table Create Table
+test_ps_flag CREATE TABLE `test_ps_flag` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_before
+0
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+Table Op Msg_type Msg_text
+test.test_ps_flag analyze status OK
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+cnt_after
+1
+DROP TABLE test_ps_flag;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
index a691ab19..4ce1b59e 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_persistent.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
@@ -8,9 +8,9 @@ CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
+SET STATEMENT use_stat_tables=never FOR
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
-test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
connect con1, localhost, root,,;
START TRANSACTION;
@@ -57,7 +57,7 @@ connection con1;
EXPLAIN SELECT * FROM t2 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref val val 4 const 1 Using index
-InnoDB 0 transactions not purged
+SET GLOBAL innodb_max_purge_lag_wait=0;
# After COMMIT and purge, the DELETE must show up.
EXPLAIN SELECT * FROM t1 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
@@ -89,7 +89,7 @@ COUNT(*)
# ha_innobase::records_in_range() would count the delete-marked records.
EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL val 4 NULL 16 Using index
+1 SIMPLE t1 index NULL val 4 NULL 1 Using index
ROLLBACK;
EXPLAIN SELECT * FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
@@ -103,3 +103,25 @@ DROP TABLE t1,t2;
SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
SET GLOBAL innodb_stats_traditional = @saved_traditional;
SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
+CREATE TABLE bug12429573 (i INTEGER PRIMARY KEY, j INTEGER, KEY(j))
+ENGINE=INNODB STATS_PERSISTENT=1;
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE bug12429573;
+Table Op Msg_type Msg_text
+test.bug12429573 analyze status OK
+SELECT last_update INTO @last FROM mysql.innodb_table_stats
+WHERE table_name = 'bug12429573';
+SELECT * FROM mysql.innodb_index_stats
+WHERE table_name = 'bug12429573' AND last_update!=@last;
+database_name table_name index_name last_update stat_name stat_value sample_size stat_description
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE bug12429573;
+Table Op Msg_type Msg_text
+test.bug12429573 analyze status OK
+SELECT * FROM mysql.innodb_table_stats
+WHERE table_name = 'bug12429573' AND last_update=@last;
+database_name table_name last_update n_rows clustered_index_size sum_of_other_index_sizes
+SELECT * FROM mysql.innodb_index_stats
+WHERE table_name = 'bug12429573' AND last_update=@last;
+database_name table_name index_name last_update stat_name stat_value sample_size stat_description
+DROP TABLE bug12429573;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_sample_pages.result b/mysql-test/suite/innodb/r/innodb_stats_sample_pages.result
new file mode 100644
index 00000000..a24d9aa8
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_sample_pages.result
@@ -0,0 +1,29 @@
+SET GLOBAL innodb_stats_persistent_sample_pages=17;
+CREATE TABLE test_ps_sample_pages_used (
+a VARCHAR(512), PRIMARY KEY (a)
+) ENGINE=INNODB STATS_SAMPLE_PAGES=default;
+BEGIN;
+COMMIT;
+ANALYZE TABLE test_ps_sample_pages_used;
+Table Op Msg_type Msg_text
+test.test_ps_sample_pages_used analyze status Engine-independent statistics collected
+test.test_ps_sample_pages_used analyze status OK
+SELECT stat_name, stat_value FROM mysql.innodb_index_stats
+WHERE table_name='test_ps_sample_pages_used' AND stat_name='n_leaf_pages';
+stat_name stat_value
+n_leaf_pages 37
+SELECT sample_size FROM mysql.innodb_index_stats
+WHERE table_name='test_ps_sample_pages_used' AND stat_name='n_diff_pfx01';
+sample_size
+17
+ALTER TABLE test_ps_sample_pages_used STATS_SAMPLE_PAGES=14;
+ANALYZE TABLE test_ps_sample_pages_used;
+Table Op Msg_type Msg_text
+test.test_ps_sample_pages_used analyze status Engine-independent statistics collected
+test.test_ps_sample_pages_used analyze status OK
+SELECT sample_size FROM mysql.innodb_index_stats
+WHERE table_name='test_ps_sample_pages_used' AND stat_name='n_diff_pfx01';
+sample_size
+14
+DROP TABLE test_ps_sample_pages_used;
+SET GLOBAL innodb_stats_persistent_sample_pages=default;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_table_flag_auto_recalc.result b/mysql-test/suite/innodb/r/innodb_stats_table_flag_auto_recalc.result
new file mode 100644
index 00000000..5585d3f6
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_table_flag_auto_recalc.result
@@ -0,0 +1,82 @@
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options
+ALTER TABLE test_ps_auto_recalc STATS_AUTO_RECALC=1;
+# restart
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_AUTO_RECALC=1
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options stats_auto_recalc=1
+DROP TABLE test_ps_auto_recalc;
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_AUTO_RECALC=default;
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options
+DROP TABLE test_ps_auto_recalc;
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_AUTO_RECALC=0;
+# restart
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_AUTO_RECALC=0
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options stats_auto_recalc=0
+ALTER TABLE test_ps_auto_recalc STATS_AUTO_RECALC=1;
+# restart
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_AUTO_RECALC=1
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options stats_auto_recalc=1
+DROP TABLE test_ps_auto_recalc;
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_AUTO_RECALC=1;
+# restart
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_AUTO_RECALC=1
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options stats_auto_recalc=1
+ALTER TABLE test_ps_auto_recalc STATS_AUTO_RECALC=0;
+# restart
+SHOW CREATE TABLE test_ps_auto_recalc;
+Table test_ps_auto_recalc
+Create Table CREATE TABLE `test_ps_auto_recalc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_AUTO_RECALC=0
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+create_options stats_auto_recalc=0
+DROP TABLE test_ps_auto_recalc;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_table_flag_sample_pages.result b/mysql-test/suite/innodb/r/innodb_stats_table_flag_sample_pages.result
new file mode 100644
index 00000000..b26b0150
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_table_flag_sample_pages.result
@@ -0,0 +1,95 @@
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+create_options
+ALTER TABLE test_ps_sample_pages STATS_SAMPLE_PAGES=12345;
+# restart
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_SAMPLE_PAGES=12345
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+create_options stats_sample_pages=12345
+DROP TABLE test_ps_sample_pages;
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=default;
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+create_options
+DROP TABLE test_ps_sample_pages;
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=-5;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-5' at line 2
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=0;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0' at line 2
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=67000;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '67000' at line 2
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=670000;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '670000' at line 2
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=65536;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '65536' at line 2
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=65535;
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_SAMPLE_PAGES=65535
+DROP TABLE test_ps_sample_pages;
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=1;
+# restart
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_SAMPLE_PAGES=1
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+create_options stats_sample_pages=1
+DROP TABLE test_ps_sample_pages;
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=5678;
+# restart
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_SAMPLE_PAGES=5678
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+create_options stats_sample_pages=5678
+ALTER TABLE test_ps_sample_pages STATS_SAMPLE_PAGES=default;
+# restart
+SHOW CREATE TABLE test_ps_sample_pages;
+Table test_ps_sample_pages
+Create Table CREATE TABLE `test_ps_sample_pages` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+create_options
+DROP TABLE test_ps_sample_pages;
diff --git a/mysql-test/suite/innodb/r/innodb_ut_format_name.result b/mysql-test/suite/innodb/r/innodb_ut_format_name.result
new file mode 100644
index 00000000..41a5b0f7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_ut_format_name.result
@@ -0,0 +1,5 @@
+CREATE TABLE t (c INT) ENGINE=INNODB;
+SET @save_dbug = @@debug_dbug;
+SET debug_dbug = '+d,test_ut_format_name';
+DROP TABLE t;
+SET debug_dbug = @save_dbug;
diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result
index 8670b994..55bb921c 100644
--- a/mysql-test/suite/innodb/r/instant_alter.result
+++ b/mysql-test/suite/innodb/r/instant_alter.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
#
# MDEV-11369: Instant ADD COLUMN for InnoDB
#
@@ -2937,3 +2939,4 @@ index(id, msg)
FLUSH TABLES;
ALTER TABLE mdev28822_100427_innodb ADD i1 INTEGER, ALGORITHM=INSTANT;
DROP TABLE mdev28822_100427_innodb;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result
index feacaa6b..1183618f 100644
--- a/mysql-test/suite/innodb/r/instant_alter_bugs.result
+++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
#
# MDEV-17821 Assertion `!page_rec_is_supremum(rec)' failed
# in btr_pcur_store_position
@@ -491,4 +493,30 @@ DROP TABLE t1;
CREATE TABLE t1 (i int AS (0) STORED, j INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN i INT GENERATED ALWAYS AS (1), DROP COLUMN i;
DROP TABLE t1;
+#
+# MDEV-18322 Assertion "wrong_page_type" on instant ALTER
+#
+BEGIN NOT ATOMIC
+DECLARE c TEXT
+DEFAULT(SELECT CONCAT('CREATE TABLE t1 (c',
+GROUP_CONCAT(seq SEPARATOR ' CHAR(200), c'),
+' CHAR(211)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT')
+FROM seq_1_to_40);
+EXECUTE IMMEDIATE c;
+END;
+$$
+INSERT INTO t1 SET c1=NULL;
+ALTER TABLE t1 ADD c41 INT FIRST;
+ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8123. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+ALTER TABLE t1 ADD c41 INT FIRST;
+ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8123. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+DROP TABLE t1;
# End of 10.4 tests
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+# End of 10.6 tests
diff --git a/mysql-test/suite/innodb/r/instant_alter_crash.result b/mysql-test/suite/innodb/r/instant_alter_crash.result
index c6f7d389..e423afe1 100644
--- a/mysql-test/suite/innodb/r/instant_alter_crash.result
+++ b/mysql-test/suite/innodb/r/instant_alter_crash.result
@@ -3,7 +3,7 @@ FLUSH TABLES;
# MDEV-11369: Instant ADD COLUMN for InnoDB
#
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
-ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ENGINE=InnoDB STATS_PERSISTENT=0 ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES(0,2);
INSERT INTO t2 VALUES(2,1);
@@ -160,7 +160,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `c2` (`c2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 ROW_FORMAT=REDUNDANT
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -168,7 +168,7 @@ t2 CREATE TABLE `t2` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `c2` (`c2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=REDUNDANT
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 ROW_FORMAT=REDUNDANT
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
diff --git a/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff b/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff
index cff4ff18..f442e406 100644
--- a/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff
+++ b/mysql-test/suite/innodb/r/instant_alter_debug,redundant.rdiff
@@ -1,6 +1,8 @@
-@@ -527,4 +527,4 @@
+@@ -527,6 +527,6 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-35
+36
+ SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+ # End of 10.6 tests
diff --git a/mysql-test/suite/innodb/r/instant_alter_debug.result b/mysql-test/suite/innodb/r/instant_alter_debug.result
index 68af5694..d6d49047 100644
--- a/mysql-test/suite/innodb/r/instant_alter_debug.result
+++ b/mysql-test/suite/innodb/r/instant_alter_debug.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
SET @old_instant=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column');
@@ -524,3 +526,5 @@ FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
35
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+# End of 10.6 tests
diff --git a/mysql-test/suite/innodb/r/instant_alter_purge.result b/mysql-test/suite/innodb/r/instant_alter_purge.result
index 61cffc9a..4163bf3f 100644
--- a/mysql-test/suite/innodb/r/instant_alter_purge.result
+++ b/mysql-test/suite/innodb/r/instant_alter_purge.result
@@ -5,7 +5,7 @@ InnoDB 0 transactions not purged
connect prevent_purge,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
-CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 () VALUES ();
ALTER TABLE t1 DROP f2, ADD COLUMN f2 INT;
ALTER TABLE t1 DROP f1;
diff --git a/mysql-test/suite/innodb/r/instant_alter_rollback.result b/mysql-test/suite/innodb/r/instant_alter_rollback.result
index dd427b62..6e84580c 100644
--- a/mysql-test/suite/innodb/r/instant_alter_rollback.result
+++ b/mysql-test/suite/innodb/r/instant_alter_rollback.result
@@ -1,3 +1,4 @@
+SET GLOBAL innodb_stats_persistent = 0;
FLUSH TABLES;
#
# MDEV-11369: Instant ADD COLUMN for InnoDB
diff --git a/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result b/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result
index 572fbc9b..c78102d9 100644
--- a/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result
+++ b/mysql-test/suite/innodb/r/lock_move_wait_lock_race.result
@@ -1,4 +1,5 @@
-CREATE TABLE t (pk int PRIMARY KEY, c varchar(10)) ENGINE=InnoDB;
+CREATE TABLE t (pk int PRIMARY KEY, c varchar(10))
+STATS_PERSISTENT=0 ENGINE=InnoDB;
INSERT INTO t VALUES (10, "0123456789");
connection default;
BEGIN;
diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result
index 76612295..a7f8cc8c 100644
--- a/mysql-test/suite/innodb/r/log_file_name.result
+++ b/mysql-test/suite/innodb/r/log_file_name.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
SET GLOBAL innodb_file_per_table=ON;
FLUSH TABLES;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/mem_pressure.result b/mysql-test/suite/innodb/r/mem_pressure.result
new file mode 100644
index 00000000..b1127db8
--- /dev/null
+++ b/mysql-test/suite/innodb/r/mem_pressure.result
@@ -0,0 +1,25 @@
+#
+# MDEV-24670 avoid OOM by linux kernel co-operative memory management
+#
+set @save_dbug=@@debug_dbug;
+set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug;
+set GLOBAL innodb_max_purge_lag_wait=0;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+SET GLOBAL innodb_limit_optimistic_insert_debug=2;
+SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR
+INSERT INTO t1 SELECT * FROM seq_1_to_1000;
+SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
+DROP TABLE t1;
+SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
+set debug_dbug="d,trigger_garbage_collection";
+SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
+SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
+LESS_DIRTY_IS_GOOD
+1
+FOUND 1 /InnoDB: Memory pressure event freed.*/ in mysqld.1.err
+set debug_dbug=@save_dbug;
+# End of 10.11 tests
diff --git a/mysql-test/suite/innodb/r/no_pad.result b/mysql-test/suite/innodb/r/no_pad.result
index 0c039c30..2af5eb02 100644
--- a/mysql-test/suite/innodb/r/no_pad.result
+++ b/mysql-test/suite/innodb/r/no_pad.result
@@ -5,3 +5,49 @@ ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES ('',2);
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
DROP TABLE t1;
+#
+# MDEV-26743 InnoDB: CHAR+nopad does not work well
+#
+#
+# Basic Latin letter vs equal accented letter
+#
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a CHAR(2), PRIMARY KEY(a)) COLLATE utf8_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES ('a'),('ä');
+ERROR 23000: Duplicate entry 'ä' for key 'PRIMARY'
+DROP TABLE t1;
+#
+# Two letters vs equal (but space padded) expansion
+#
+CREATE TABLE t1 (a CHAR(2), PRIMARY KEY(a)) COLLATE utf8_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES ('ss'),('ß');
+SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
+SELECT HEX(a) FROM t1;
+HEX(a)
+7373
+C39F20
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+#
+# Basic Latin letter (but followed by an ignorable character) vs equal accented letter
+#
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a CHAR(3), PRIMARY KEY(a)) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (CONCAT('a',_utf8mb3 0x01)),('ä');
+SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
+SELECT HEX(a) FROM t1 ORDER BY HEX(a);
+HEX(a)
+610120
+C3A42020
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a CHAR(2), PRIMARY KEY(a)) COLLATE utf8_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (CONCAT('a',_utf8mb3 0x01)),('ä');
+SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
+SELECT HEX(a) FROM t1 ORDER BY HEX(a);
+HEX(a)
+6101
+C3A420
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/page_id_innochecksum.result b/mysql-test/suite/innodb/r/page_id_innochecksum.result
index 7915a7ba..bde986c0 100644
--- a/mysql-test/suite/innodb/r/page_id_innochecksum.result
+++ b/mysql-test/suite/innodb/r/page_id_innochecksum.result
@@ -1,5 +1,5 @@
# Set the environmental variables
-create table t1(f1 int not null)engine=innodb;
+create table t1(f1 int not null)engine=innodb stats_persistent=0;
insert into t1 values(1), (2), (3);
# Change the page offset
FOUND 1 /page id mismatch/ in result.log
diff --git a/mysql-test/suite/innodb/r/page_reorganize.result b/mysql-test/suite/innodb/r/page_reorganize.result
index 20e1600b..fe85926e 100644
--- a/mysql-test/suite/innodb/r/page_reorganize.result
+++ b/mysql-test/suite/innodb/r/page_reorganize.result
@@ -16,8 +16,6 @@ SET @save_dbug = @@debug_dbug;
SET DEBUG_DBUG = '+d,do_page_reorganize,do_lock_reverse_page_reorganize';
insert into t1(f2) values (repeat('+', 100));
SET DEBUG = @save_dbug;
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
commit;
connection con1;
f1
diff --git a/mysql-test/suite/innodb/r/purge.result b/mysql-test/suite/innodb/r/purge.result
index ed14fad7..9284fa18 100644
--- a/mysql-test/suite/innodb/r/purge.result
+++ b/mysql-test/suite/innodb/r/purge.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
# Bug #12429576 - Test an assertion failure on purge.
CREATE TABLE t1_purge (
A int,
@@ -115,4 +117,5 @@ t12963823 CREATE TABLE `t12963823` (
KEY `ndx_p` (`p`(500))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC
InnoDB 0 transactions not purged
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823;
diff --git a/mysql-test/suite/innodb/r/purge_secondary.result b/mysql-test/suite/innodb/r/purge_secondary.result
index 9801e985..70d16f1f 100644
--- a/mysql-test/suite/innodb/r/purge_secondary.result
+++ b/mysql-test/suite/innodb/r/purge_secondary.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
CREATE TABLE t1 (
a SERIAL, b CHAR(255) NOT NULL DEFAULT '', c BOOLEAN DEFAULT false,
l LINESTRING NOT NULL DEFAULT ST_linefromtext('linestring(448 -689,
@@ -167,3 +169,5 @@ page 5: N_RECS=0x0001
UNLOCK TABLES;
DROP TABLE t1;
# End of 10.3 tests
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+# End of 10.6 tests
diff --git a/mysql-test/suite/innodb/r/purge_thread_shutdown.result b/mysql-test/suite/innodb/r/purge_thread_shutdown.result
deleted file mode 100644
index 747fe91c..00000000
--- a/mysql-test/suite/innodb/r/purge_thread_shutdown.result
+++ /dev/null
@@ -1,27 +0,0 @@
-connect con1, localhost, root;
-create table t1 (a int) engine=innodb;
-insert t1 values (1),(2),(3),(4);
-delete from t1 where a=1;
-select user,state from information_schema.processlist order by 2;
-user state
-root
-root Filling schema table
-set global debug_dbug='+d,only_kill_system_threads';
-set global innodb_fast_shutdown=0;
-shutdown;
-connection default;
-disconnect con1;
-select user,state from information_schema.processlist order by 2;
-user state
-root Filling schema table
-set global innodb_fast_shutdown=1;
-select user,state from information_schema.processlist order by 2;
-user state
-root Filling schema table
-delete from t1 where a=3;
-set global innodb_fast_shutdown=0;
-ERROR 42000: Variable 'innodb_fast_shutdown' can't be set to the value of '0'
-kill ID;
-Got one of the listed errors
-# restart
-drop table t1;
diff --git a/mysql-test/suite/innodb/r/read_only_recovery.result b/mysql-test/suite/innodb/r/read_only_recovery.result
index add0da94..2cde5818 100644
--- a/mysql-test/suite/innodb/r/read_only_recovery.result
+++ b/mysql-test/suite/innodb/r/read_only_recovery.result
@@ -37,6 +37,8 @@ SELECT * FROM t;
a
3
SET GLOBAL innodb_max_purge_lag_wait=0;
+INSERT INTO mysql.innodb_index_stats
+SELECT * FROM mysql.innodb_index_stats LIMIT 0;
# restart
SELECT * FROM t;
a
diff --git a/mysql-test/suite/innodb/r/records_in_range,4k.rdiff b/mysql-test/suite/innodb/r/records_in_range,4k.rdiff
new file mode 100644
index 00000000..12b857ec
--- /dev/null
+++ b/mysql-test/suite/innodb/r/records_in_range,4k.rdiff
@@ -0,0 +1,8 @@
+@@ -39,7 +39,7 @@
+ WHERE
+ table_name='records_in_range_test' AND stat_name = 'size';
+ index_name stat_name stat_value
+-PRIMARY size 1
++PRIMARY size 5
+ SET @save_dbug = @@debug_dbug;
+ SET DEBUG_DBUG='+d,print_btr_estimate_n_rows_in_range_return_value';
diff --git a/mysql-test/suite/innodb/r/records_in_range,8k.rdiff b/mysql-test/suite/innodb/r/records_in_range,8k.rdiff
new file mode 100644
index 00000000..bd24af16
--- /dev/null
+++ b/mysql-test/suite/innodb/r/records_in_range,8k.rdiff
@@ -0,0 +1,8 @@
+@@ -39,7 +39,7 @@
+ WHERE
+ table_name='records_in_range_test' AND stat_name = 'size';
+ index_name stat_name stat_value
+-PRIMARY size 1
++PRIMARY size 3
+ SET @save_dbug = @@debug_dbug;
+ SET DEBUG_DBUG='+d,print_btr_estimate_n_rows_in_range_return_value';
diff --git a/mysql-test/suite/innodb/r/records_in_range.result b/mysql-test/suite/innodb/r/records_in_range.result
new file mode 100644
index 00000000..e5a698f5
--- /dev/null
+++ b/mysql-test/suite/innodb/r/records_in_range.result
@@ -0,0 +1,1275 @@
+CREATE TABLE records_in_range_test (
+c1 VARCHAR(16),
+c2 VARCHAR(512),
+PRIMARY KEY (c1)
+) ENGINE=INNODB STATS_PERSISTENT=1;
+INSERT INTO records_in_range_test VALUES
+('ccc', REPEAT('v', 512)),
+('kkk01', REPEAT('v', 512)),
+('kkk02', REPEAT('v', 512)),
+('kkk03', REPEAT('v', 512)),
+('kkk04', REPEAT('v', 512)),
+('kkk05', REPEAT('v', 512)),
+('kkk06', REPEAT('v', 512)),
+('kkk07', REPEAT('v', 512)),
+('kkk08', REPEAT('v', 512)),
+('mmm', REPEAT('v', 512)),
+('nnn', REPEAT('v', 512)),
+('uuu01', REPEAT('v', 512)),
+('uuu02', REPEAT('v', 512)),
+('uuu03', REPEAT('v', 512)),
+('uuu04', REPEAT('v', 512)),
+('uuu05', REPEAT('v', 512)),
+('uuu06', REPEAT('v', 512)),
+('uuu07', REPEAT('v', 512)),
+('uuu08', REPEAT('v', 512)),
+('xxx', REPEAT('v', 512));
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE records_in_range_test;
+Table Op Msg_type Msg_text
+test.records_in_range_test analyze status OK
+SELECT index_name, stat_name, stat_value
+FROM mysql.innodb_index_stats
+WHERE
+table_name='records_in_range_test' AND stat_name = 'n_leaf_pages';
+index_name stat_name stat_value
+PRIMARY n_leaf_pages 1
+SELECT index_name, stat_name, stat_value
+FROM mysql.innodb_index_stats
+WHERE
+table_name='records_in_range_test' AND stat_name = 'size';
+index_name stat_name stat_value
+PRIMARY size 1
+SET @save_dbug = @@debug_dbug;
+SET DEBUG_DBUG='+d,print_btr_estimate_n_rows_in_range_return_value';
+
+In all SELECTs below the number of the records in the range returned
+by COUNT(*) must be the same as the number returned by
+btr_estimate_n_rows_in_range() which can be seen inside the artificial
+warning
+
+Test left-unbounded, right-open intervals
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'aaa';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'ccc';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+Test left-unbounded, right-closed intervals
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'aaa';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'ccc';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'mmm';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'nnn';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'xxx';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+Test left-open, right-unbounded intervals
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+
+Test left-closed, right-unbounded intervals
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+
+Test left-open, right-open intervals
+In some cases here the optimizer is smart enough not to call
+ha_innobase::records_in_range() at all, so we get no warning containing
+the value returned from btr_estimate_n_rows_in_range()
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'bbb';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'ccc';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'eee';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'mmm';
+COUNT(*)
+8
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 8
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'nnn';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'qqq';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'xxx';
+COUNT(*)
+18
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 18
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'zzz';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'mmm';
+COUNT(*)
+8
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 8
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'nnn';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'qqq';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'xxx';
+COUNT(*)
+18
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 18
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'zzz';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'nnn';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'qqq';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'xxx';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'zzz';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'qqq';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'xxx';
+COUNT(*)
+8
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 8
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'zzz';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'xxx';
+COUNT(*)
+8
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 8
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'zzz';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'zzz';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'zzz';
+COUNT(*)
+0
+
+Test left-closed, right-open intervals
+In some cases here the optimizer is smart enough not to call
+ha_innobase::records_in_range() at all, so we get no warning containing
+the value returned from btr_estimate_n_rows_in_range()
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'bbb';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'ccc';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'mmm';
+COUNT(*)
+8
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 8
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'nnn';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'qqq';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'xxx';
+COUNT(*)
+18
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 18
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'zzz';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'nnn';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'qqq';
+COUNT(*)
+2
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 2
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'xxx';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'zzz';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'qqq';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'xxx';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'zzz';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'xxx';
+COUNT(*)
+8
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 8
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'zzz';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'zzz';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'zzz';
+COUNT(*)
+0
+
+Test left-open, right-closed intervals
+In some cases here the optimizer is smart enough not to call
+ha_innobase::records_in_range() at all, so we get no warning containing
+the value returned from btr_estimate_n_rows_in_range()
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'bbb';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'ccc';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'mmm';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'nnn';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'xxx';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'eee';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'qqq';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'zzz';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'qqq';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'zzz';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'nnn';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'qqq';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'xxx';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'zzz';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'qqq';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'xxx';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'zzz';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'xxx';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'zzz';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'zzz';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'zzz';
+COUNT(*)
+0
+
+Test left-closed, right-closed intervals
+In some cases here the optimizer is smart enough not to call
+ha_innobase::records_in_range() at all, so we get no warning containing
+the value returned from btr_estimate_n_rows_in_range()
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'bbb';
+COUNT(*)
+0
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'ccc';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'mmm';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'nnn';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'xxx';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'ccc';
+COUNT(*)
+1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'eee';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'mmm';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'nnn';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'qqq';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'xxx';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'zzz';
+COUNT(*)
+20
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 20
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'mmm';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'nnn';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'qqq';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'xxx';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'zzz';
+COUNT(*)
+19
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 19
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'mmm';
+COUNT(*)
+1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'nnn';
+COUNT(*)
+2
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 2
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'qqq';
+COUNT(*)
+2
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 2
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'xxx';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'zzz';
+COUNT(*)
+11
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 11
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'nnn';
+COUNT(*)
+1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'qqq';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'xxx';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'zzz';
+COUNT(*)
+10
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 10
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'xxx';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'zzz';
+COUNT(*)
+9
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 9
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'xxx';
+COUNT(*)
+1
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'zzz';
+COUNT(*)
+1
+Warnings:
+Warning 1230 btr_estimate_n_rows_in_range(): 1
+
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'bbb';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'ccc';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'eee';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'mmm';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'nnn';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'qqq';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'xxx';
+COUNT(*)
+0
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'zzz';
+COUNT(*)
+0
+SET DEBUG_DBUG = @save_dbug;
+DROP TABLE records_in_range_test;
diff --git a/mysql-test/suite/innodb/r/row_format_redundant.result b/mysql-test/suite/innodb/r/row_format_redundant.result
index d95c37f1..e3356c63 100644
--- a/mysql-test/suite/innodb/r/row_format_redundant.result
+++ b/mysql-test/suite/innodb/r/row_format_redundant.result
@@ -68,9 +68,8 @@ DROP TABLE t1;
Warnings:
Warning 1932 Table 'test.t1' doesn't exist in engine
DROP TABLE t2,t3;
-FOUND 6 /\[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b/ in mysqld.1.err
+FOUND 5 /\[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b/ in mysqld.1.err
# restart
-ib_buffer_pool
ib_logfile0
ibdata1
db.opt
diff --git a/mysql-test/suite/innodb/r/scrub_debug.result b/mysql-test/suite/innodb/r/scrub_debug.result
index 1e60fb73..7b0a9fd5 100644
--- a/mysql-test/suite/innodb/r/scrub_debug.result
+++ b/mysql-test/suite/innodb/r/scrub_debug.result
@@ -4,7 +4,7 @@ SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=1;
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;
CREATE TABLE t1(f1 INT AUTO_INCREMENT PRIMARY KEY,
f2 VARCHAR(256) GENERATED ALWAYS as('repairman'),
-INDEX idx(f2))ENGINE= InnoDB;
+INDEX idx(f2))ENGINE= InnoDB STATS_PERSISTENT=0;
INSERT INTO t1(f1) SELECT seq FROM seq_1_to_50;
FLUSH TABLE t1 FOR EXPORT;
FOUND 108 /repairman/ in t1.ibd
diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result
index 77999035..cc32472f 100644
--- a/mysql-test/suite/innodb/r/table_flags.result
+++ b/mysql-test/suite/innodb/r/table_flags.result
@@ -101,13 +101,9 @@ ERROR 42S02: Table 'test.tc' doesn't exist in engine
SELECT * FROM tc;
ERROR 42S02: Table 'test.tc' doesn't exist in engine
SHOW CREATE TABLE td;
-Table Create Table
-td CREATE TABLE `td` (
- `a` int(11) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC
+ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
SELECT * FROM td;
-a
+ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
SHOW CREATE TABLE tz;
Table Create Table
tz CREATE TABLE `tz` (
@@ -122,8 +118,8 @@ a
42
SHOW CREATE TABLE tp;
ERROR 42S02: Table 'test.tp' doesn't exist in engine
-FOUND 5 /InnoDB: Table test/t[cp] in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=(129|289|3873|1232[13]) SYS_TABLES\.N_COLS=2147483649/ in mysqld.1.err
-FOUND 2 /InnoDB: Table test/tr in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=65 SYS_TABLES\.MIX_LEN=4294967295\b/ in mysqld.1.err
+FOUND 3 /InnoDB: Table test/t[cp] in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=(129|289|3873|1232[13]) SYS_TABLES\.N_COLS=2147483649/ in mysqld.1.err
+FOUND 1 /InnoDB: Table test/tr in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=65 SYS_TABLES\.MIX_LEN=4294967295\b/ in mysqld.1.err
Restoring SYS_TABLES clustered index root page (8)
# restart: with restart_parameters
SHOW CREATE TABLE tr;
diff --git a/mysql-test/suite/innodb/r/tablespace_per_table_not_windows.result b/mysql-test/suite/innodb/r/tablespace_per_table_not_windows.result
new file mode 100644
index 00000000..7b1d0f91
--- /dev/null
+++ b/mysql-test/suite/innodb/r/tablespace_per_table_not_windows.result
@@ -0,0 +1,128 @@
+#
+# Test the limits of a file-per-table tablespace name. MySQL combines
+# the database name with the table name to make a unique table name.
+#
+SET default_storage_engine=InnoDB;
+#
+# MySQL limits each database and tablename identifier to 64 characters
+# of up to 3 bytes per character, corresponding to 192 bytes.
+#
+CREATE DATABASE `this_sixty_five_byte_name_is_too_long____________________________`;
+ERROR 42000: Incorrect database name 'this_sixty_five_byte_name_is_too_long____________________________'
+CREATE DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;
+USE `this_sixty_four_byte_name_is_not_too_long_______________________`;
+#
+# A 64 character tablename can be created in a 64 character database name
+#
+CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________` (a SERIAL);
+#
+# A 65 character tablename is too long.
+#
+CREATE TABLE `test`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL);
+ERROR 42000: Incorrect table name 'this_sixty_five_byte_name_is_too_long____________________________'
+CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL);
+ERROR 42000: Incorrect table name 'this_sixty_five_byte_name_is_too_long____________________________'
+#
+# Non-non-filename-safe characters like '#' are expanded to '@0023'.
+# On many file systems, such as Linux extfs, you can create a database name
+# that expands to up to 255 bytes long.
+# `##################################################_long` is expanded to
+# (50 * 5) + 5 = 255.
+#
+CREATE DATABASE `##################################################_long`;;
+USE `##################################################_long`;
+#
+# This 256-byte name is only one byte longer but fails with an error code
+# from the stat operation.
+# `##################################################_long_` is expanded to
+# (50 * 5) + 6 = 256.
+#
+CREATE DATABASE `##################################################_long_`;
+ERROR HY000: Can't get stat of './##################################################_long_' (Errcode: ## "File name too long")
+#
+# This 300-byte name which is the longest name that gets an error code
+# from the stat operation.
+# `###########################################################_long` is expanded to
+# (59 * 5) + 5 = 300.
+#
+CREATE DATABASE `###########################################################_long`;
+ERROR HY000: Can't get stat of './###########################################################_long' (Errcode: ## "File name too long")
+#
+# This 301-byte name which is only one byte longer but fails with ER_TOO_LONG_IDENT.
+# `###########################################################_long_` is expanded to
+# (59 * 5) + 6 = 301.
+#
+CREATE DATABASE `###########################################################_long_`;
+ERROR 42000: Incorrect database name '###########################################################_long_'
+USE test;
+#
+# An expanded table name is limited to 251 bytes
+#
+CREATE TABLE `test`.`#################################################_long_` (a SERIAL);
+#
+# A 252-byte tablename is too long
+#
+CREATE TABLE `test`.`#################################################_long___` (a SERIAL);
+ERROR HY000: Can't create table `test`.`#################################################_long___` (errno: ## "File name too long")
+CREATE DATABASE twenty_byte_db_name_;
+USE `twenty_byte_db_name_`;
+#
+# A 251 byte expanded table name will fit with a longer database name
+#
+CREATE TABLE `twenty_byte_db_name_`.`#################################################_long_` (a SERIAL);
+#
+# A 252 byte expanded table name is also too long in a longer database name
+#
+CREATE TABLE `twenty_byte_db_name_`.`#################################################_long___` (a SERIAL);
+ERROR HY000: Can't create table `twenty_byte_db_name_`.`#################################################_long___` (errno: ## "File name too long")
+#
+# Another limitation is a 512 byte length to an expanded path that includes
+# the datadir which is './' in this test, the expanded database name,
+# the directory separator '/', the expanded table name, and the file extension.
+# './long_db_name.long_250_byte_table_name.frm'
+# 2+ 255 +1+ 250 +1+3 = 512
+#
+CREATE TABLE `##################################################_long`.`#################################################_long` (a SERIAL);
+CREATE TABLE `##################################################_long`.`#################################################_long_` (a SERIAL);
+ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023_long/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@
+SHOW WARNINGS;
+Level Code Message
+Error 1860 Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023_long/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@
+#
+# Show the successfully created databases and tables
+#
+---- list_files MYSQLD_DATADIR/test
+#################################################_long_.frm
+#################################################_long_.ibd
+db.opt
+---- list_files MYSQLD_DATADIR/this_sixty_four_byte_name_is_not_too_long_______________________
+db.opt
+this_sixty_four_byte_name_is_not_too_long_______________________.frm
+this_sixty_four_byte_name_is_not_too_long_______________________.ibd
+---- list_files MYSQLD_DATADIR/##################################################_long
+#################################################_long.frm
+#################################################_long.ibd
+db.opt
+SELECT name FROM information_schema.innodb_sys_tables WHERE name LIKE '%long%';
+name
+##################################################_long/#################################################_long
+test/#################################################_long_
+this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________
+twenty_byte_db_name_/#################################################_long_
+SELECT name FROM information_schema.innodb_sys_tablespaces WHERE name LIKE '%long%';
+name
+this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________
+test/#################################################_long_
+twenty_byte_db_name_/#################################################_long_
+##################################################_long/#################################################_long
+SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%';
+#
+# Cleanup
+#
+DROP TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________`;
+DROP TABLE `test`.`#################################################_long_`;
+DROP TABLE `twenty_byte_db_name_`.`#################################################_long_`;
+DROP TABLE `##################################################_long`.`#################################################_long`;
+DROP DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;
+DROP DATABASE `##################################################_long`;
+DROP DATABASE `twenty_byte_db_name_`;
diff --git a/mysql-test/suite/innodb/r/tablespace_per_table_windows.result b/mysql-test/suite/innodb/r/tablespace_per_table_windows.result
new file mode 100644
index 00000000..14253baa
--- /dev/null
+++ b/mysql-test/suite/innodb/r/tablespace_per_table_windows.result
@@ -0,0 +1,48 @@
+#
+# Test the limits of a file-per-table tablespace name. MySQL combines
+# the database name with the table name to make a unique table name.
+#
+SET default_storage_engine=InnoDB;
+#
+# MySQL limits each database and tablename identifier to 64 characters
+# of up to 3 bytes per character, corresponding to 192 bytes.
+#
+CREATE DATABASE `this_sixty_five_byte_name_is_too_long____________________________`;
+ERROR 42000: Incorrect database name 'this_sixty_five_byte_name_is_too_long____________________________'
+CREATE DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;
+USE `this_sixty_four_byte_name_is_not_too_long_______________________`;
+#
+# A 64 character tablename can be created in a 64 character database name
+#
+CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________` (a SERIAL);
+#
+# A 65 character tablename is too long.
+#
+CREATE TABLE `test`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL);
+ERROR 42000: Incorrect table name 'this_sixty_five_byte_name_is_too_long____________________________'
+CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL);
+ERROR 42000: Incorrect table name 'this_sixty_five_byte_name_is_too_long____________________________'
+#
+# Show the successfully created database and table
+#
+SHOW CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________`;
+Table Create Table
+this_sixty_four_byte_name_is_not_too_long_______________________ CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+---- list_files MYSQLD_DATADIR/this_sixty_four_byte_name_is_not_too_long_______________________
+db.opt
+this_sixty_four_byte_name_is_not_too_long_______________________.frm
+this_sixty_four_byte_name_is_not_too_long_______________________.ibd
+SELECT name FROM information_schema.innodb_sys_tables WHERE name LIKE '%long%';
+name
+this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________
+SELECT name FROM information_schema.innodb_sys_tablespaces WHERE name LIKE '%long%';
+name
+this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________
+SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%';
+#
+# Cleanup
+#
+DROP DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;
diff --git a/mysql-test/suite/innodb/r/truncate_crash.result b/mysql-test/suite/innodb/r/truncate_crash.result
index 5e7380e3..7df461ec 100644
--- a/mysql-test/suite/innodb/r/truncate_crash.result
+++ b/mysql-test/suite/innodb/r/truncate_crash.result
@@ -1,5 +1,5 @@
FLUSH TABLES;
-CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 VALUES (1),(2);
connect wait,localhost,root,,test;
SET DEBUG_SYNC='before_trx_state_committed_in_memory SIGNAL c WAIT_FOR ever';
diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result
index e587baa5..e001e3ba 100644
--- a/mysql-test/suite/innodb/r/truncate_foreign.result
+++ b/mysql-test/suite/innodb/r/truncate_foreign.result
@@ -77,25 +77,26 @@ DROP TABLE t1;
call mtr.add_suppression("InnoDB: In ALTER TABLE `test`\\.`t1` has or is");
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
-ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a), ALGORITHM=COPY;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (a), ALGORITHM=COPY;
INSERT INTO t1 VALUES (1,1);
+CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB;
LOCK TABLES t1 WRITE;
SET FOREIGN_KEY_CHECKS=1;
TRUNCATE t1;
ERROR HY000: Cannot add foreign key constraint for `t1`
INSERT INTO t1 VALUES (2,2);
-ERROR HY000: Table 't1' was not locked with LOCK TABLES
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`))
SELECT * FROM t1;
pk a
1 1
UNLOCK TABLES;
INSERT INTO t1 VALUES (2,2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`))
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1;
pk a
1 1
2 2
-DROP TABLE t1;
+DROP TABLE t2, t1;
# End of 10.6 tests
diff --git a/mysql-test/suite/innodb/r/trx_id_future.result b/mysql-test/suite/innodb/r/trx_id_future.result
index c9beb17b..487fa82c 100644
--- a/mysql-test/suite/innodb/r/trx_id_future.result
+++ b/mysql-test/suite/innodb/r/trx_id_future.result
@@ -2,7 +2,7 @@
# Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
# IN THE FUTURE
#
-CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
+CREATE TABLE t1(a INT) row_format=redundant engine=innoDB stats_persistent=0;
INSERT INTO t1 VALUES(1);
InnoDB 0 transactions not purged
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
diff --git a/mysql-test/suite/innodb/r/undo_log.result b/mysql-test/suite/innodb/r/undo_log.result
index 6e377951..014b1210 100644
--- a/mysql-test/suite/innodb/r/undo_log.result
+++ b/mysql-test/suite/innodb/r/undo_log.result
@@ -1,3 +1,5 @@
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
SET innodb_strict_mode=OFF;
CREATE TABLE test_tab (
a_str_18 mediumtext,
@@ -154,3 +156,4 @@ ROLLBACK;
InnoDB 0 transactions not purged
DROP TABLE t1;
DROP TABLE t2;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/add_foreign_key.test b/mysql-test/suite/innodb/t/add_foreign_key.test
new file mode 100644
index 00000000..d0febfd6
--- /dev/null
+++ b/mysql-test/suite/innodb/t/add_foreign_key.test
@@ -0,0 +1,38 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE ADD
+--echo # FOREIGN KEY
+--echo #
+
+CREATE TABLE `parent` (`parent_id` INT, PRIMARY KEY (`parent_id`));
+CREATE TABLE `child1` (`id` INT ,`child1_fk1` INT, `child1_fk2` INT,
+PRIMARY KEY (`id`));
+CREATE TABLE `child2` (`id` INT, `child2_fk1` INT, `child2_fk2` INT,
+PRIMARY KEY (`id`));
+CREATE TABLE `child3` (`id` INT , `child3_fk1` INT, PRIMARY KEY (`id`));
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES `parent`
+(`parent_id`);
+
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES `parent`
+(`parent_id`);
+
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES `parent`
+(`parent_id`);
+
+ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES `parent`
+(`parent_id`);
+ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES
+`parent` (`parent_id`);
+ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES
+`parent` (`parent_id`);
+
+drop table child3, child2, child1, parent;
diff --git a/mysql-test/suite/innodb/t/alter_kill.test b/mysql-test/suite/innodb/t/alter_kill.test
index 461e1f47..7d83e7e3 100644
--- a/mysql-test/suite/innodb/t/alter_kill.test
+++ b/mysql-test/suite/innodb/t/alter_kill.test
@@ -26,6 +26,7 @@ call mtr.add_suppression("Table .*bug16720368.* is corrupted");
-- echo #
SET GLOBAL innodb_file_per_table=1;
+SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test
index 67ada081..d293d3a4 100644
--- a/mysql-test/suite/innodb/t/alter_table.test
+++ b/mysql-test/suite/innodb/t/alter_table.test
@@ -121,9 +121,20 @@ CREATE TABLE t1 (c TIMESTAMP AUTO_INCREMENT UNIQUE) ENGINE=InnoDB;
CREATE TABLE t1 (c DATETIME AUTO_INCREMENT UNIQUE) ENGINE=InnoDB;
--echo #
---echo # End of 10.4 tests
+--echo # MDEV-31000 Assertion failed on ALTER TABLE...page_compressed=1
--echo #
+SET @save_file_per_table=@@GLOBAL.innodb_file_per_table;
+SET GLOBAL innodb_file_per_table=0;
+CREATE TABLE t (c INT PRIMARY KEY) ENGINE=INNODB;
+SET GLOBAL innodb_file_per_table=1;
+ALTER TABLE t page_compressed=1;
+SET GLOBAL innodb_file_per_table=@save_file_per_table;
+SELECT space>0 FROM information_schema.innodb_sys_tables WHERE name='test/t';
+DROP TABLE t;
+
+--echo # End of 10.4 tests
+
--echo #
--echo # MDEV-21748 ASAN use-after-poison in PageBulk::insertPage()
--echo #
@@ -141,3 +152,5 @@ CREATE TABLE t1 (id INT PRIMARY KEY, a YEAR, INDEX(id,a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,NULL),(2,NULL);
UPDATE t1 SET a=0;
DROP TABLE t1;
+
+--echo # End of 10.5 tests
diff --git a/mysql-test/suite/innodb/t/cascade_lock_wait.test b/mysql-test/suite/innodb/t/cascade_lock_wait.test
new file mode 100644
index 00000000..4489c9ae
--- /dev/null
+++ b/mysql-test/suite/innodb/t/cascade_lock_wait.test
@@ -0,0 +1,45 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+create table t1 (f1 int primary key) engine=innodb;
+create table t2 (f1 int primary key,
+ constraint c1 foreign key (f1) references t1(f1)
+ on update cascade
+ on delete cascade) engine=innodb;
+create table t3 (f1 int primary key,
+ constraint c2 foreign key (f1) references t1(f1)
+ on update cascade
+ on delete cascade) engine=innodb;
+show create table t1;
+show create table t2;
+show create table t3;
+
+insert into t1 values (1);
+insert into t1 values (2);
+insert into t1 values (3);
+
+insert into t2 values (1);
+insert into t2 values (2);
+insert into t2 values (3);
+
+insert into t3 values (1);
+insert into t3 values (2);
+insert into t3 values (3);
+
+select f1 from t1;
+select f1 from t2;
+select f1 from t3;
+
+set @save_dbug = @@debug_dbug;
+set debug_dbug = '+d,dml_cascade_only_once';
+set debug_dbug = '+d,row_upd_cascade_lock_wait_err';
+update t1 set f1 = 100 where f1 = 2;
+
+select f1 from t1;
+select f1 from t2;
+select f1 from t3;
+
+set debug_dbug = @save_dbug;
+drop table t2;
+drop table t3;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
index f383d9ab..1f410246 100644
--- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
@@ -59,7 +59,7 @@ SELECT * FROM t1;
let $restart_parameters=--innodb_force_recovery=1;
--source include/restart_mysqld.inc
---error ER_TABLE_CORRUPT
+--error ER_NO_SUCH_TABLE_IN_ENGINE,ER_TABLE_CORRUPT
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;
diff --git a/mysql-test/suite/innodb/t/dml_purge.test b/mysql-test/suite/innodb/t/dml_purge.test
index 463ae390..78c6c50a 100644
--- a/mysql-test/suite/innodb/t/dml_purge.test
+++ b/mysql-test/suite/innodb/t/dml_purge.test
@@ -1,5 +1,8 @@
--source include/innodb_page_size.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;
@@ -76,3 +79,5 @@ EOF
UNLOCK TABLES;
SELECT * FROM t1;
DROP TABLE t1;
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test
index d8dac955..d7300990 100644
--- a/mysql-test/suite/innodb/t/doublewrite.test
+++ b/mysql-test/suite/innodb/t/doublewrite.test
@@ -1,17 +1,11 @@
+
--echo #
---echo # Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY
---echo # Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST
---echo # PAGE OF SYSTEM TABLESPACE
+--echo # MDEV-32242 innodb.doublewrite test case always is skipped
--echo #
--source include/innodb_page_size.inc
---source include/have_debug.inc
--source include/not_embedded.inc
-# This test is slow on buildbot.
---source include/big_test.inc
-# Slow shutdown and restart to make sure ibuf merge is finished
-SET GLOBAL innodb_fast_shutdown = 0;
--disable_query_log
call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS");
@@ -22,23 +16,16 @@ call mtr.add_suppression("Plugin 'InnoDB' (init function returned error|registra
call mtr.add_suppression("InnoDB: A bad Space ID was found in datafile");
call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: ");
call mtr.add_suppression("InnoDB: Inconsistent tablespace ID in .*t1\\.ibd");
+call mtr.add_suppression("\\[Warning\\] Found 1 prepared XA transactions");
+call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
--enable_query_log
---source include/restart_mysqld.inc
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;
let ALGO=`select @@innodb_checksum_algorithm`;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
-show variables like 'innodb_doublewrite';
-show variables like 'innodb_fil_make_page_dirty_debug';
-show variables like 'innodb_saved_page_number_debug';
-
-connect (stop_purge,localhost,root,,);
-START TRANSACTION WITH CONSISTENT SNAPSHOT;
-connection default;
-
-create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
+create table t1 (f1 int primary key, f2 blob) stats_persistent=0, engine=innodb;
start transaction;
insert into t1 values(1, repeat('#',12));
@@ -48,35 +35,24 @@ insert into t1 values(4, repeat('-',12));
insert into t1 values(5, repeat('.',12));
commit work;
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if first page of user
---echo # tablespace is full of zeroes.
-
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-
-begin;
-insert into t1 values (6, repeat('%', 12));
---echo # Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-
+# Slow shutdown and restart to make sure ibuf merge is finished
+SET GLOBAL innodb_fast_shutdown = 0;
+let $shutdown_timeout=;
+--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
+connect (dml,localhost,root,,);
+XA START 'x';
+insert into t1 values (6, repeat('%', @@innodb_page_size/2));
+XA END 'x';
+XA PREPARE 'x';
+disconnect dml;
+connection default;
---echo # Make the first page dirty for table t1
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-
---echo # Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
+flush table t1 for export;
---let CLEANUP_IF_CHECKPOINT=drop table t1;
+let $restart_parameters=;
+--let CLEANUP_IF_CHECKPOINT=XA COMMIT 'x';drop table t1;
--source ../include/no_checkpoint_end.inc
-disconnect stop_purge;
-
---echo # Make the first page (page_no=0) of the user tablespace
---echo # full of zeroes.
---echo #
---echo # MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer.
perl;
use IO::Handle;
@@ -90,16 +66,15 @@ my $page_size = $ENV{INNODB_PAGE_SIZE};
my $page;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
open(FILE, "+<", $fname) or die;
+sysseek(FILE, ($page_size/2), 0);
+syswrite(FILE, chr(0) x ($page_size/2));
+sysseek(FILE, 3*$page_size, 0);
sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n";
-my $page1 = $page;
-substr($page1, 34, 4) = pack("N", 0);
-my $polynomial0 = 0x82f63b78; # CRC-32C
-my $ck0 = mycrc32(substr($page1, 0, ($page_size-4)), 0, $polynomial0);
-substr($page1, ($page_size - 4), 4) = pack("N", $ck0);
-sysseek(FILE, 0, 0)||die "Unable to seek $fname\n";
-die unless syswrite(FILE, $page1, $page_size) == $page_size;
+sysseek(FILE, 3*$page_size, 0)||die "Unable to seek $fname\n";
+syswrite(FILE, chr(0) x ($page_size/2));
close FILE;
+# Change the flag offset of page 0 in doublewrite buffer
open(FILE, "+<", "$ENV{MYSQLD_DATADIR}ibdata1")||die "cannot open ibdata1\n";
sysseek(FILE, 6 * $page_size - 190, 0)||die "Unable to seek ibdata1\n";
sysread(FILE, $_, 12) == 12||die "Unable to read TRX_SYS\n";
@@ -112,28 +87,23 @@ for (my $d = $d1; $d < $d2 + 64; $d++)
sysread(FILE, $_, $page_size)==$page_size||die "Cannot read doublewrite\n";
next unless $_ eq $page;
sysseek(FILE, $d * $page_size, 0)||die "Unable to seek ibdata1\n";
- # Write buggy MariaDB 10.1.x FSP_SPACE_FLAGS to the doublewrite buffer
- my($flags) = unpack "x[54]N", $_;
- my $badflags = ($flags & 0x3f);
- my $compression_level=6;
- $badflags |= 1<<6|$compression_level<<7 if ($flags & 1 << 16);
- $badflags |= ($flags & 15 << 6) << 7; # PAGE_SSIZE
-
+ # Write buggy FSP_SPACE_FLAGS to the doublewrite buffer for page
+ my $badflags = 0x0006FFFF;
substr ($_, 54, 4) = pack("N", $badflags);
if ($algo =~ /full_crc32/)
{
- my $ck = mycrc32(substr($_, 0, $page_size - 4), 0, $polynomial);
- substr($_, $page_size - 4, 4) = pack("N", $ck);
+ my $ck = mycrc32(substr($_, 0, $page_size - 4), 0, $polynomial);
+ substr($_, $page_size - 4, 4) = pack("N", $ck);
}
else
{
- # Replace the innodb_checksum_algorithm=crc32 checksum
- my $ck= pack("N",
- mycrc32(substr($_, 4, 22), 0, $polynomial) ^
- mycrc32(substr($_, 38, $page_size - 38 - 8), 0,
- $polynomial));
- substr ($_, 0, 4) = $ck;
- substr ($_, $page_size - 8, 4) = $ck;
+ # Replace the innodb_checksum_algorithm=crc32 checksum
+ my $ck= pack("N",
+ mycrc32(substr($_, 4, 22), 0, $polynomial) ^
+ mycrc32(substr($_, 38, $page_size - 38 - 8), 0,
+ $polynomial));
+ substr ($_, 0, 4) = $ck;
+ substr ($_, $page_size - 8, 4) = $ck;
}
syswrite(FILE, $_, $page_size)==$page_size||die;
close(FILE);
@@ -143,325 +113,42 @@ die "Did not find the page in the doublewrite buffer ($d1,$d2)\n";
EOF
--source include/start_mysqld.inc
-
-check table t1;
-select f1, f2 from t1;
-
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if first page of user
---echo # tablespace is corrupted.
-
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-
---echo # Ensure that dirty pages of table t1 is flushed.
-flush tables t1 for export;
-unlock tables;
-
-set global innodb_log_checkpoint_now=1;
-
-begin;
-insert into t1 values (6, repeat('%', 12));
-
---source ../include/no_checkpoint_start.inc
-
---echo # Make the first page dirty for table t1
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-
---echo # Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---source include/no_checkpoint_end.inc
-
---echo # Corrupt the first page (page_no=0) of the user tablespace.
-perl;
-use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd";
-my $page_size = $ENV{INNODB_PAGE_SIZE};
-open(FILE, "+<", $fname) or die;
-sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n";
-substr($page, 28, 4) = pack("N", 1000);
-sysseek(FILE, 0, 0)||die "Unable to seek $fname\n";
-die unless syswrite(FILE, $page, $page_size) == $page_size;
-close FILE;
-EOF
-
---source include/start_mysqld.inc
-
-check table t1;
-select f1, f2 from t1;
-
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if 2nd page of user
---echo # tablespace is full of zeroes.
-
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-
---echo # Ensure that dirty pages of table t1 is flushed.
-flush tables t1 for export;
-unlock tables;
-
-begin;
-insert into t1 values (6, repeat('%', 400));
-
---source ../include/no_checkpoint_start.inc
-
---echo # Make the 2nd page dirty for table t1
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-
---echo # Ensure that dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---source include/no_checkpoint_end.inc
-
---echo # Make the 2nd page (page_no=1) of the tablespace all zeroes.
-perl;
-use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd";
-open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET);
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
-close FILE;
-EOF
-
---source include/start_mysqld.inc
-
+let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile;
+--source include/search_pattern_in_file.inc
+let SEARCH_PATTERN=InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=3\];
+--source include/search_pattern_in_file.inc
+XA ROLLBACK 'x';
check table t1;
select f1, f2 from t1;
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if 2nd page of user
---echo # tablespace is corrupted.
-
-select space into @space_id from information_schema.innodb_sys_tables
-where name = 'test/t1';
-
---echo # Ensure that dirty pages of table t1 is flushed.
-flush tables t1 for export;
-unlock tables;
-
-begin;
-insert into t1 values (6, repeat('%', 400));
-
--source ../include/no_checkpoint_start.inc
+connect (dml,localhost,root,,);
+XA START 'x';
+insert into t1 values (6, repeat('%', @@innodb_page_size/2));
+XA END 'x';
+XA PREPARE 'x';
+disconnect dml;
+connection default;
---echo # Make the 2nd page dirty for table t1
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = @space_id;
-
---echo # Ensure that the dirty pages of table t1 are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---source include/no_checkpoint_end.inc
-
---echo # Corrupt the 2nd page (page_no=1) of the user tablespace.
-perl;
-use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd";
-open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET);
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
-close FILE;
-EOF
-
---source include/start_mysqld.inc
-
-check table t1;
-select f1, f2 from t1;
-
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if first page of
---echo # system tablespace is full of zeroes.
-
-begin;
-insert into t1 values (6, repeat('%', 400));
-
---echo # Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---echo # Make the first page dirty for system tablespace
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = 0;
-
---echo # Ensure that the dirty page of system tablespace is also flushed.
-# We do this after the transaction starts and all dirty pages have been flushed
-# already. So flushing of this specified dirty page will surely keep the
-# copy in doublewrite buffer, and no more writes to doublewrite buffer would
-# overwrite the copy. Thus, we can safely modify the original page when server
-# is down. So do the following testings.
-set global innodb_buf_flush_list_now = 1;
-
---source include/kill_mysqld.inc
-
---echo # Make the first page (page_no=0) of the system tablespace
---echo # all zeroes.
-perl;
-use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1";
-open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
-close FILE;
-EOF
-
---source include/start_mysqld.inc
-
-check table t1;
-select f1, f2 from t1;
-
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if first page of
---echo # system tablespace is corrupted.
-
-begin;
-insert into t1 values (6, repeat('%', 400));
-
---echo # Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---echo # Make the first page dirty for system tablespace
-set global innodb_saved_page_number_debug = 0;
-set global innodb_fil_make_page_dirty_debug = 0;
-
---echo # Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
-
---source include/kill_mysqld.inc
-
---echo # Corrupt the first page (page_no=0) of the system tablespace.
-perl;
-use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1";
-open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
-close FILE;
-EOF
-
---source include/start_mysqld.inc
-
-check table t1;
-select f1, f2 from t1;
-
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if 2nd page of
---echo # system tablespace is full of zeroes.
-
-begin;
-insert into t1 values (6, repeat('%', 400));
-
---echo # Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---echo # Make the second page dirty for system tablespace
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = 0;
-
---echo # Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
-
---source include/kill_mysqld.inc
-
---echo # Make the 2nd page (page_no=1) of the system tablespace
---echo # all zeroes.
-perl;
-use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1";
-open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET);
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
-close FILE;
-EOF
-
---source include/start_mysqld.inc
-
-check table t1;
-select f1, f2 from t1;
-
---echo # Test End
---echo # ---------------------------------------------------------------
---echo # Test Begin: Test if recovery works if 2nd page of
---echo # system tablespace is corrupted.
-
-begin;
-insert into t1 values (6, repeat('%', 400));
-
---echo # Ensure that all dirty pages in the system are flushed.
-set global innodb_buf_flush_list_now = 1;
-
---echo # Make the second page dirty for system tablespace
-set global innodb_saved_page_number_debug = 1;
-set global innodb_fil_make_page_dirty_debug = 0;
-
---echo # Ensure that the dirty page of system tablespace is also flushed.
-set global innodb_buf_flush_list_now = 1;
+flush table t1 for export;
---source include/kill_mysqld.inc
+let $restart_parameters=;
+--source ../include/no_checkpoint_end.inc
---echo # Make the 2nd page (page_no=1) of the system tablespace
---echo # all zeroes.
+# Zero out the first page in file and try to recover from dblwr
perl;
use IO::Handle;
-my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1";
-open(FILE, "+<", $fname) or die;
-FILE->autoflush(1);
-binmode FILE;
-seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET);
-print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
+open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}test/t1.ibd") or die;
+syswrite(FILE, chr(0) x $ENV{INNODB_PAGE_SIZE});
close FILE;
EOF
--source include/start_mysqld.inc
-
-check table t1;
---let SEARCH_PATTERN= InnoDB: .*test.t1\\.ibd
+let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile;
--source include/search_pattern_in_file.inc
-
+XA ROLLBACK 'x';
+check table t1;
select f1, f2 from t1;
-
drop table t1;
---echo #
---echo # MDEV-12600 crash during install_db with innodb_page_size=32K
---echo # and ibdata1=3M
---echo #
-let bugdir= $MYSQLTEST_VARDIR/tmp/doublewrite;
---mkdir $bugdir
-
-let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
-WHERE engine = 'innodb'
-AND support IN ('YES', 'DEFAULT', 'ENABLED');
-
---let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir
---let $ibd=$ibp --innodb-undo-tablespaces=0
---let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
-
---let $restart_parameters= $ibp
---source include/restart_mysqld.inc
-eval $check_no_innodb;
---let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot create doublewrite buffer
---source include/search_pattern_in_file.inc
---let $restart_parameters=
---source include/restart_mysqld.inc
-
---remove_file $bugdir/ibdata1
---remove_file $bugdir/ibdata2
---remove_file $bugdir/ib_logfile0
---rmdir $bugdir
+--echo # End of 10.5 tests
diff --git a/mysql-test/suite/innodb/t/doublewrite_debug.combinations b/mysql-test/suite/innodb/t/doublewrite_debug.combinations
new file mode 100644
index 00000000..4f52013f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/doublewrite_debug.combinations
@@ -0,0 +1,7 @@
+[strict_crc32]
+--innodb-checksum-algorithm=strict_crc32
+--innodb-use-atomic-writes=0
+
+[strict_full_crc32]
+--innodb-checksum-algorithm=strict_full_crc32
+--innodb-use-atomic-writes=0
diff --git a/mysql-test/suite/innodb/t/doublewrite_debug.test b/mysql-test/suite/innodb/t/doublewrite_debug.test
new file mode 100644
index 00000000..ab7fd8eb
--- /dev/null
+++ b/mysql-test/suite/innodb/t/doublewrite_debug.test
@@ -0,0 +1,170 @@
+--echo #
+--echo # Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY
+--echo # Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST
+--echo # PAGE OF SYSTEM TABLESPACE
+--echo #
+
+--source include/innodb_page_size.inc
+--source include/have_debug.inc
+--source include/not_embedded.inc
+--disable_query_log
+call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
+call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS");
+call mtr.add_suppression("InnoDB: New log files created");
+call mtr.add_suppression("InnoDB: Cannot create doublewrite buffer: the first file in innodb_data_file_path must be at least (3|6|12)M\\.");
+call mtr.add_suppression("InnoDB: Database creation was aborted");
+call mtr.add_suppression("Plugin 'InnoDB' (init function returned error|registration as a STORAGE ENGINE failed)");
+call mtr.add_suppression("InnoDB: A bad Space ID was found in datafile");
+call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: ");
+call mtr.add_suppression("InnoDB: Inconsistent tablespace ID in .*t1\\.ibd");
+call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
+--enable_query_log
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR=`select @@datadir`;
+let ALGO=`select @@innodb_checksum_algorithm`;
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+
+show variables like 'innodb_doublewrite';
+show variables like 'innodb_fil_make_page_dirty_debug';
+show variables like 'innodb_saved_page_number_debug';
+
+create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
+
+start transaction;
+insert into t1 values(1, repeat('#',12));
+insert into t1 values(2, repeat('+',12));
+insert into t1 values(3, repeat('/',12));
+insert into t1 values(4, repeat('-',12));
+insert into t1 values(5, repeat('.',12));
+commit work;
+
+--echo # Test Begin: Test if recovery works if 1st page and 2nd page
+--echo # of system tablespace is full of zeroes.
+
+# Slow shutdown and restart to make sure ibuf merge is finished
+SET GLOBAL innodb_fast_shutdown = 0;
+let $shutdown_timeout=;
+let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
+--source include/restart_mysqld.inc
+--source ../include/no_checkpoint_start.inc
+begin;
+insert into t1 values (6, repeat('%', 400));
+
+--echo # Make the first page dirty for system tablespace
+set global innodb_saved_page_number_debug = 0;
+set global innodb_fil_make_page_dirty_debug = 0;
+
+--echo # Make the second page dirty for system tablespace
+set global innodb_saved_page_number_debug = 1;
+set global innodb_fil_make_page_dirty_debug = 0;
+
+set global innodb_buf_flush_list_now = 1;
+
+--let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint;
+--source ../include/no_checkpoint_end.inc
+
+--echo # Make the 1st page (page_no=0) and 2nd page (page_no=1)
+--echo # of the system tablespace all zeroes.
+perl;
+use IO::Handle;
+my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1";
+open(FILE, "+<", $fname) or die;
+FILE->autoflush(1);
+binmode FILE;
+print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
+seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET);
+print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
+close FILE;
+EOF
+
+let $restart_parameters=;
+--source include/start_mysqld.inc
+
+let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN=InnoDB: Recovered page \[page id: space=0, page number=1\];
+--source include/search_pattern_in_file.inc
+
+check table t1;
+select f1, f2 from t1;
+
+--echo # Test End
+--echo # ---------------------------------------------------------------
+--echo # Test Begin: Test if recovery works if 1st page of
+--echo # system tablespace is corrupted and 2nd page as corrupted.
+
+let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
+--source include/restart_mysqld.inc
+--source ../include/no_checkpoint_start.inc
+begin;
+insert into t1 values (6, repeat('%', 400));
+
+--echo # Make the first page dirty for system tablespace
+set global innodb_saved_page_number_debug = 0;
+set global innodb_fil_make_page_dirty_debug = 0;
+
+--echo # Make the second page dirty for system tablespace
+set global innodb_saved_page_number_debug = 1;
+set global innodb_fil_make_page_dirty_debug = 0;
+
+set global innodb_buf_flush_list_now = 1;
+
+--source ../include/no_checkpoint_end.inc
+
+--echo # Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace.
+perl;
+use IO::Handle;
+my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1";
+open(FILE, "+<", $fname) or die;
+FILE->autoflush(1);
+binmode FILE;
+print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
+seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET);
+print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
+close FILE;
+EOF
+
+let $restart_parameters=;
+--source include/start_mysqld.inc
+
+let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile;
+--source include/search_pattern_in_file.inc
+
+let SEARCH_PATTERN=InnoDB: Recovered page \[page id: space=0, page number=1\];
+--source include/search_pattern_in_file.inc
+
+check table t1;
+select f1, f2 from t1;
+drop table t1;
+let $shutdown_timeout=;
+--echo # Test End
+--echo # ---------------------------------------------------------------
+--echo #
+--echo # MDEV-12600 crash during install_db with innodb_page_size=32K
+--echo # and ibdata1=3M
+--echo #
+let bugdir= $MYSQLTEST_VARDIR/tmp/doublewrite;
+--mkdir $bugdir
+
+let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+
+--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir
+--let $ibp=$ibp --innodb-undo-tablespaces=0
+--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
+
+--let $restart_parameters= $ibp
+--source include/restart_mysqld.inc
+eval $check_no_innodb;
+--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot create doublewrite buffer
+--source include/search_pattern_in_file.inc
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--remove_file $bugdir/ibdata1
+--remove_file $bugdir/ibdata2
+--remove_file $bugdir/ib_logfile0
+--rmdir $bugdir
diff --git a/mysql-test/suite/innodb/t/fk_col_alter.test b/mysql-test/suite/innodb/t/fk_col_alter.test
index 2ed10a95..21fd470e 100644
--- a/mysql-test/suite/innodb/t/fk_col_alter.test
+++ b/mysql-test/suite/innodb/t/fk_col_alter.test
@@ -149,4 +149,18 @@ ALTER TABLE t2 DROP INDEX idx;
ALTER TABLE t2 MODIFY f2 VARCHAR(1023);
SET SESSION FOREIGN_KEY_CHECKS = ON;
DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-32638 MariaDB crashes with foreign_key_checks=0
+--echo # when changing a column and adding a foreign
+--echo # key at the same time
+--echo #
+CREATE TABLE t1(f1 VARCHAR(2) NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,
+ f2 VARCHAR(10) NOT NULL DEFAULT '')ENGINE=InnoDB;
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t2 CHANGE COLUMN f2 f3 VARCHAR(20) NOT NULL,
+ ADD CONSTRAINT t2_fk FOREIGN KEY(f3) REFERENCES t1(f1);
+DROP TABLE t2, t1;
+SET SESSION FOREIGN_KEY_CHECKS = ON;
--echo # End of 10.4 tests
diff --git a/mysql-test/suite/innodb/t/fk_drop_alter.test b/mysql-test/suite/innodb/t/fk_drop_alter.test
new file mode 100644
index 00000000..c79eb873
--- /dev/null
+++ b/mysql-test/suite/innodb/t/fk_drop_alter.test
@@ -0,0 +1,35 @@
+--source include/have_innodb.inc
+--echo #
+--echo # MDEV-22230 : Unexpected ER_ERROR_ON_RENAME upon DROP
+--echo # non-existing FOREIGN KEY
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=COPY;
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t1 DROP FOREIGN KEY x, ALGORITHM=INPLACE;
+# Cleanup
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, FOREIGN KEY fk_id (a) REFERENCES t1(a))ENGINE=InnoDB;
+CREATE TABLE t3 (a INT, FOREIGN KEY fk_1 (a) REFERENCES t1(a))ENGINE=InnoDB;
+ALTER TABLE t3 DROP FOREIGN KEY IF EXISTS fk_id;
+DROP TABLE t3, t2;
+ALTER TABLE t1 MODIFY COLUMN a VARCHAR(2), DROP FOREIGN KEY IF EXISTS x;
+DROP TABLE t1;
+
+CREATE DATABASE best;
+CREATE TABLE best.t1(f1 INT, KEY(f1))ENGINE=InnoDB;
+CREATE TABLE best.t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
+
+CREATE TABLE t1(f1 INT, KEY(f1))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT, FOREIGN KEY foo(f1) REFERENCES t1(f1))ENGINE=InnoDB;
+ALTER TABLE t2 DROP FOREIGN KEY foo;
+--error ER_CANT_DROP_FIELD_OR_KEY
+ALTER TABLE t2 DROP FOREIGN KEY foo;
+ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS foo;
+SHOW CREATE TABLE best.t2;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+DROP TABLE best.t2, best.t1, t2, t1;
+DROP DATABASE best;
diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test
index b93f82c9..aeff7009 100644
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@ -268,3 +268,7 @@ SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES('G', 3);
DROP TABLE t2, t1;
SET FOREIGN_KEY_CHECKS=DEFAULT;
+
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1(a SERIAL) ENGINE=InnoDB ROW_FORMAT=COMPRESSED PAGE_COMPRESSED=1;
+SHOW WARNINGS;
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 06da1b6f..0db3a7ca 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -2,6 +2,8 @@
--source include/count_sessions.inc
--source include/default_charset.inc
+SET GLOBAL innodb_stats_persistent = 0;
+
--echo #
--echo # Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
--echo # DICT_CREATE_FOREIGN_CONSTR
@@ -126,6 +128,9 @@ FLUSH TABLES;
--let $shutdown_timeout=
disconnect incomplete;
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
INSERT INTO child SET a=0;
--error ER_NO_REFERENCED_ROW_2
INSERT INTO child SET a=1;
@@ -728,7 +733,9 @@ SELECT a FROM t1 FORCE INDEX(a);
# the "goto rollback_to_savept" in row_mysql_handle_errors() is reverted.
SELECT * FROM t1;
# Allow purge to continue by closing the read view.
-disconnect con1;
+connection con1;
+COMMIT;
+connection default;
# Wait for purge. With the fix reverted, the server would crash here.
--source include/wait_all_purged.inc
@@ -949,9 +956,37 @@ ALTER TABLE t1 MODIFY id INT unsigned AUTO_INCREMENT;
DROP TABLE t1,t2;
--echo #
---echo # End of 10.4 tests
+--echo # MDEV-31441 BLOB corruption on UPDATE of PRIMARY KEY with FOREIGN KEY
--echo #
+CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT) ENGINE=InnoDB;
+CREATE TABLE t2 (pk INT PRIMARY KEY, FOREIGN KEY (pk) REFERENCES t1(pk))
+ENGINE=InnoDB;
+
+SET @blob = REPEAT('A', @@innodb_page_size / 2);
+INSERT INTO t1 SET pk=1, t=@blob;
+INSERT INTO t2 SET pk=1;
+--connection con1
+BEGIN;
+DELETE FROM t2;
+--connection default
+# The following will be blocked by a FOREIGN KEY check on pk=1 in t2.
+--send
+UPDATE t1 SET pk=12;
+--connection con1
+let $wait_condition=
+SELECT count(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state='Updating';
+--source include/wait_condition.inc
+COMMIT;
+--disconnect con1
+--connection default
+--reap
+UPDATE t1 SET pk=1;
+SELECT pk,t=@blob FROM t1;
+DROP TABLE t2, t1;
+
+--echo # End of 10.4 tests
+
--echo #
--echo # MDEV-20729 Fix REFERENCES constraint in column definition
--echo #
@@ -1132,4 +1167,6 @@ DROP TABLE binaries, collections;
--echo # End of 10.6 tests
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test
index b79fd954..0eb31f8d 100644
--- a/mysql-test/suite/innodb/t/full_crc32_import.test
+++ b/mysql-test/suite/innodb/t/full_crc32_import.test
@@ -2,6 +2,9 @@
# This test is slow on buildbot.
--source include/big_test.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
FLUSH TABLES;
let $MYSQLD_TMPDIR = `SELECT @@tmpdir`;
@@ -222,3 +225,4 @@ SELECT * FROM t1;
DROP TABLE t1;
SET GLOBAL innodb_compression_algorithm=@save_algo;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test
index 9362f8da..b1f3c270 100644
--- a/mysql-test/suite/innodb/t/ibuf_not_empty.test
+++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test
@@ -74,6 +74,7 @@ EOF
--replace_regex /contains \d+ entries/contains 990 entries/
check table t1;
+SET GLOBAL innodb_buf_flush_list_now=ON;
--source include/shutdown_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/import_update_stats.test b/mysql-test/suite/innodb/t/import_update_stats.test
new file mode 100644
index 00000000..e1b1ae5d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/import_update_stats.test
@@ -0,0 +1,80 @@
+#
+# BUG#20125349 - PERSISTANT STATS IS NOT UPDATED WHEN TTS IS IMPORTED.
+#
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+let MYSQLD_DATADIR =`SELECT @@datadir`;
+SET @old_innodb_file_per_table = @@innodb_file_per_table;
+
+SET GLOBAL innodb_file_per_table = 1;
+SELECT @@innodb_file_per_table;
+
+CREATE TABLE t1 (
+ col_1 CHAR (255),
+ col_2 VARCHAR (255)
+) ENGINE = InnoDB;
+
+CREATE INDEX idx1 ON t1(col_1);
+CREATE INDEX idx2 ON t1(col_2);
+
+SHOW INDEXES FROM t1;
+
+INSERT INTO t1 VALUES ("col1_00001", "col2_00001"), ("col1_00002", "col2_00002");
+
+SHOW INDEXES FROM t1;
+
+ANALYZE TABLE t1;
+SHOW INDEXES FROM t1;
+
+FLUSH TABLES t1 FOR EXPORT;
+perl;
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
+ib_backup_tablespaces("test", "t1");
+EOF
+
+UNLOCK TABLES;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ col_1 CHAR (255),
+ col_2 VARCHAR (255)
+) ENGINE = InnoDB STATS_PERSISTENT=1;
+
+CREATE INDEX idx1 ON t1(col_1);
+CREATE INDEX idx2 ON t1(col_2);
+
+SHOW INDEXES FROM t1;
+
+INSERT INTO t1 VALUES ("col1_00001", "col2_00001");
+
+SHOW INDEXES FROM t1;
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE t1;
+SHOW INDEXES FROM t1;
+
+ALTER TABLE t1 DISCARD TABLESPACE;
+
+perl;
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
+ib_discard_tablespaces("test", "t1");
+ib_restore_tablespaces("test", "t1");
+EOF
+
+ALTER TABLE t1 IMPORT TABLESPACE;
+
+SHOW INDEXES FROM t1;
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE t1;
+SHOW INDEXES FROM t1;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table;
+
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.ibd
+--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfg
diff --git a/mysql-test/suite/innodb/t/index_length.test b/mysql-test/suite/innodb/t/index_length.test
new file mode 100644
index 00000000..bf4940d4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/index_length.test
@@ -0,0 +1,23 @@
+--source include/have_innodb.inc
+
+--connect (stop_purge,localhost,root)
+# Prevent the purge of history from acquiring a table handle.
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+--connection default
+
+CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(1024))
+ENGINE=InnoDB STATS_PERSISTENT=1;
+INSERT INTO t1 VALUES (1,REPEAT('b',1024));
+
+SELECT index_length FROM information_schema.tables
+WHERE table_schema = 'test' AND table_name = 't1';
+ALTER TABLE t1 ADD INDEX b (b(800));
+SELECT FLOOR(index_length/@@innodb_page_size) FROM information_schema.tables
+WHERE table_schema = 'test' AND table_name = 't1';
+ALTER TABLE t1 ADD INDEX ba (b(800),a);
+SELECT FLOOR(index_length/@@innodb_page_size) FROM information_schema.tables
+WHERE table_schema = 'test' AND table_name = 't1';
+disconnect stop_purge;
+DROP TABLE t1;
+
+--echo # End of 10.4 tests
diff --git a/mysql-test/suite/innodb/t/index_merge_threshold.test b/mysql-test/suite/innodb/t/index_merge_threshold.test
index a60ecf51..cb8e117d 100644
--- a/mysql-test/suite/innodb/t/index_merge_threshold.test
+++ b/mysql-test/suite/innodb/t/index_merge_threshold.test
@@ -13,6 +13,9 @@
--source include/have_innodb_16k.inc
--source include/have_partition.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
# Check index merge threshold by create index on all datatypes
CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT,
@@ -186,3 +189,5 @@ CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45';
--source suite/innodb/include/innodb_merge_threshold_secondary.inc
DROP TABLE tab1;
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/innodb-16k.test b/mysql-test/suite/innodb/t/innodb-16k.test
index 8bec6254..fd024047 100644
--- a/mysql-test/suite/innodb/t/innodb-16k.test
+++ b/mysql-test/suite/innodb/t/innodb-16k.test
@@ -3,6 +3,9 @@
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
call mtr.add_suppression("InnoDB: Cannot add field .* in table");
let $MYSQLD_DATADIR= `select @@datadir`;
@@ -457,6 +460,7 @@ DROP TABLE t1;
--source include/wait_all_purged.inc
SET GLOBAL innodb_compression_level=@save_level;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
DROP TABLE tlong;
diff --git a/mysql-test/suite/innodb/t/innodb-32k.test b/mysql-test/suite/innodb/t/innodb-32k.test
index 496977c1..a5fd78fd 100644
--- a/mysql-test/suite/innodb/t/innodb-32k.test
+++ b/mysql-test/suite/innodb/t/innodb-32k.test
@@ -3,10 +3,24 @@
--source include/have_innodb.inc
--source include/have_innodb_32k.inc
+SET GLOBAL innodb_stats_persistent = 0;
call mtr.add_suppression("Innodb: Cannot add field.*row size is");
let $MYSQLD_DATADIR= `select @@datadir`;
+SET SESSION innodb_strict_mode=ON;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+SET SESSION innodb_strict_mode=OFF;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+DROP TABLE t1;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+DROP TABLE t1;
+
--echo # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
diff --git a/mysql-test/suite/innodb/t/innodb-64k.test b/mysql-test/suite/innodb/t/innodb-64k.test
index 972ba6bb..d89370ff 100644
--- a/mysql-test/suite/innodb/t/innodb-64k.test
+++ b/mysql-test/suite/innodb/t/innodb-64k.test
@@ -8,6 +8,19 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
let $MYSQLD_DATADIR= `select @@datadir`;
+SET SESSION innodb_strict_mode=ON;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+SET SESSION innodb_strict_mode=OFF;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+SHOW WARNINGS;
+DROP TABLE t1;
+CREATE TABLE t1(a int PRIMARY KEY) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
+SHOW WARNINGS;
+DROP TABLE t1;
+
--echo # Test 1) Show the page size from Information Schema
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size';
diff --git a/mysql-test/suite/innodb/t/innodb-ac-non-locking-select.test b/mysql-test/suite/innodb/t/innodb-ac-non-locking-select.test
new file mode 100644
index 00000000..3376367b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-ac-non-locking-select.test
@@ -0,0 +1,117 @@
+# DEBUG_SYNC must be compiled in.
+--source include/have_debug_sync.inc
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(0, "0");
+INSERT INTO t1 VALUES(1, "1");
+INSERT INTO t1 VALUES(2, "2");
+INSERT INTO t1 VALUES(3, "3");
+
+--connect (con1,localhost,root,,)
+--connect (con2,localhost,root,,)
+--connect (con3,localhost,root,,)
+--connect (con4,localhost,root,,)
+--connect (con5,localhost,root,,)
+--connect (con6,localhost,root,,)
+
+connection default;
+# Disable query log to avoid non-deterministic output conflicts
+SET AUTOCOMMIT=0;
+BEGIN;
+# Lock all the records
+SELECT * FROM t1 FOR UPDATE;
+--disable_query_log
+
+connection con1;
+SET AUTOCOMMIT=1;
+# Test if locking autocommit selects end up in the trx_sys_t::trx_list.
+# We check this via the INFORMATION_SCHEMA.INNODB_TRX.
+# This should block and show up in the I_S.
+SET DEBUG_SYNC='lock_wait_start SIGNAL waiting1';
+--send
+SELECT COUNT(*) FROM t1 LOCK IN SHARE MODE;
+
+connection con2;
+SET AUTOCOMMIT=1;
+# Test if non-locking autocommit selects end up in the trx_sys_t::trx_list.
+# We check this via the INFORMATION_SCHEMA.INNODB_TRX.
+# This should not block and should not show up in the I_S.
+--send
+SELECT COUNT(*) FROM t1;
+
+connection con3;
+SET AUTOCOMMIT=1;
+# Note: autocommit non-locking selects are not converted to locking selects
+# Therefore this should not block;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+SELECT COUNT(*) FROM t1;
+
+connection con4;
+SET AUTOCOMMIT=0;
+# Note: Non-locking selects are converted to locking selects
+# therefore this should block;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SET DEBUG_SYNC='now WAIT_FOR waiting1';
+SET DEBUG_SYNC='lock_wait_start SIGNAL waiting4';
+--send
+SELECT COUNT(*) FROM t1 WHERE c1 >= 0;
+
+connection con5;
+SET AUTOCOMMIT=1;
+# This should not block
+BEGIN;
+--send
+SELECT COUNT(*) FROM t1;
+
+connection con6;
+SET AUTOCOMMIT=1;
+# This will ignore the auto-commit setting but wont block because it is
+# a non-locking select.
+XA START '1';
+--enable_query_log
+SELECT * FROM t1 WHERE c1 <= 3;
+
+connection default;
+# Wait for SELECTs to get into the lock wait queue
+SET DEBUG_SYNC='now WAIT_FOR waiting4';
+SET DEBUG_SYNC= 'RESET';
+
+# Check the number of non-locking transactions
+let $wait_condition =
+ SELECT COUNT(*) = 5
+ FROM INFORMATION_SCHEMA.INNODB_TRX
+ WHERE trx_autocommit_non_locking = 0;
+--source include/wait_condition.inc
+
+# Check the waiting transactions
+SELECT trx_state, trx_query, trx_autocommit_non_locking
+FROM INFORMATION_SCHEMA.INNODB_TRX
+WHERE trx_state = 'LOCK WAIT'
+ORDER BY trx_query;
+
+INSERT INTO t1 VALUES(4, '4');
+COMMIT;
+
+connection con6;
+SELECT * FROM t1 WHERE c1 <= 4;
+XA END '1';
+XA PREPARE '1';
+XA ROLLBACK '1';
+disconnect con6;
+disconnect con2;
+disconnect con3;
+disconnect con5;
+
+connection con1;
+reap;
+disconnect con1;
+
+connection con4;
+reap;
+disconnect con4;
+
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
index 0ae116f5..2534f03d 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
@@ -65,8 +65,11 @@ set DEBUG_SYNC="now WAIT_FOR default_signal";
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
disconnect con1;
---replace_column 7 #
+# This may occasionally display records for a corrupted index(f2).
+# The original bug was about a crash during the execution of SHOW KEYS.
+--disable_result_log
SHOW KEYS FROM t1;
+--enable_result_log
DROP TABLE t1;
remove_files_wildcard $datadir/test #sql-*.frm;
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index 78550763..5b121c70 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -701,6 +701,32 @@ ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
SET @@SQL_MODE= @OLD_SQL_MODE;
DROP TABLE t1;
+--echo #
+--echo # Bug#20977779 CANNOT IMPORT TABLES CONTAINING PREFIX INDEXES
+--echo #
+
+CREATE TABLE t1 (c1 VARCHAR(32), c2 VARCHAR(32), c3 VARCHAR(32),
+PRIMARY KEY (c1, c2, c3))
+ENGINE=InnoDB;
+
+ALTER TABLE t1 ADD INDEX ind1(c1(5), c2, c3);
+ALTER TABLE t1 ADD INDEX ind2(c3, c1(10), c2);
+ALTER TABLE t1 ADD INDEX ind3(c2, c3, c1(20));
+
+INSERT INTO t1 VALUES ('Test Data -1', 'Test Data -2', 'Test Data -3');
+
+let $source_db = test;
+let $dest_db = test;
+
+--echo # Test with 2ndary index having prefix
+--source suite/innodb/include/import.inc
+
+--echo # Test with PK & 2ndary index with prefix
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1(5), c2(10), c3(20));
+--source suite/innodb/include/import.inc
+
+DROP TABLE t1;
+
#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/innodb/t/innodb-index-online-fk.test b/mysql-test/suite/innodb/t/innodb-index-online-fk.test
index 5423516c..64cea29e 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online-fk.test
+++ b/mysql-test/suite/innodb/t/innodb-index-online-fk.test
@@ -482,3 +482,48 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
DROP TABLE t2;
DROP TABLE t3;
+
+--echo # Bug #17449901 TABLE DISAPPEARS WHEN ALTERING
+--echo # WITH FOREIGN KEY CHECKS OFF
+
+# Drop index via inplace algorithm
+create table t1(f1 int,primary key(f1))engine=innodb;
+create table t2(f2 int,f3 int,key t(f2,f3),foreign key(f2) references t1(f1))engine=innodb;
+SET foreign_key_checks=0;
+drop index t on t2;
+drop table t2;
+drop table t1;
+
+# Drop index using alter statement via inplace
+create table t1(f1 int ,primary key(f1))engine=innodb;
+create table t2(f2 int,f3 int, key t(f2),foreign key(f2) references t1(f1))engine=innodb;
+SET foreign_key_checks = 0;
+alter table t2 drop key t,algorithm=inplace;
+show create table t2;
+drop table t2;
+drop table t1;
+
+create table t1(f1 int ,primary key(f1))engine=innodb;
+create table t2(f2 int,f3 int, key t(f2),key t1(f2,f3),
+foreign key(f2) references t1(f1))engine=innodb;
+SET foreign_key_checks = 0;
+alter table t2 drop key t,algorithm=inplace;
+show create table t2;
+drop table t2;
+drop table t1;
+
+--echo #
+--echo # MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy
+--echo # alter from creating invalid FK structures
+--echo #
+CREATE TABLE t1(f1 INT, KEY(f1),
+ FOREIGN KEY(f1) references t1(f1))ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT, KEY(f1),
+ FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DROP KEY f1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test
index f8eb8957..96ee3149 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online.test
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test
@@ -4,6 +4,10 @@
--source include/have_debug_sync.inc
--source include/no_valgrind_without_big.inc
+SET GLOBAL innodb_monitor_reset_all=all;
+--disable_warnings
+SET GLOBAL innodb_monitor_reset_all=default;
+--enable_warnings
let $innodb_metrics_select=
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
@@ -158,6 +162,7 @@ let $ID= `SELECT @id := CONNECTION_ID()`;
--error ER_QUERY_INTERRUPTED
KILL QUERY @id;
+SET GLOBAL innodb_max_purge_lag_wait=0;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done';
--send
CREATE INDEX c2d ON t1(c2);
@@ -209,13 +214,13 @@ SHOW CREATE TABLE t1;
connection default;
SET @merge_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
connection con1;
@@ -254,13 +259,13 @@ INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
ON si.index_id = sf.index_id WHERE si.name = '?c2e';
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SELECT
@@ -297,16 +302,16 @@ ALTER TABLE t1 COMMENT 'testing if c2e will be dropped';
eval $innodb_metrics_select;
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
connection con1;
@@ -343,16 +348,16 @@ eval $innodb_metrics_select;
connection default;
SET @merge_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SELECT
diff --git a/mysql-test/suite/innodb/t/innodb-lock-inherit-read_commited.test b/mysql-test/suite/innodb/t/innodb-lock-inherit-read_commited.test
new file mode 100644
index 00000000..31bf8a73
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-lock-inherit-read_commited.test
@@ -0,0 +1,110 @@
+--echo #
+--echo # Bug #21025880 DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN)
+--echo #
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+let $i=0;
+
+while ($i <=1 )
+{
+
+CREATE TABLE t1 (
+ a INT NOT NULL,
+ b INT NOT NULL,
+ PRIMARY KEY(b),
+ UNIQUE KEY(a))
+ENGINE=INNODB;
+
+SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
+SET GLOBAL innodb_stats_auto_recalc = OFF;
+
+# Block purge
+connect purge_control,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+
+SET @old_tx_isolation = @@tx_isolation;
+SET GLOBAL tx_isolation = 'READ-COMMITTED';
+
+SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout = 1;
+
+--connect(con1,localhost,root,,)
+
+# Create and delete-mark an index record
+
+INSERT INTO t1 VALUES (1,1),(2,2);
+DELETE FROM t1;
+
+SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
+con1_locks_done WAIT_FOR con1_go';
+SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
+con1_insert_done WAIT_FOR con1_finish';
+--send
+
+if ($i == 0)
+{
+REPLACE INTO t1 VALUES (1,2);
+}
+
+if ( $i == 1)
+{
+INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2;
+}
+--connect(con2,localhost,root,,)
+
+SET debug_sync = 'now WAIT_FOR con1_locks_done';
+
+SET debug_sync = 'lock_wait_start SIGNAL con2_blocked
+WAIT_FOR con2_go';
+SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock
+WAIT_FOR con2_finish';
+SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
+
+--send
+REPLACE INTO t1 VALUES (1,3);
+
+--connection default
+SET debug_sync = 'now WAIT_FOR con2_blocked';
+
+connection purge_control;
+COMMIT;
+disconnect purge_control;
+connection default;
+
+# Wait for purge to delete the delete-marked record
+--source ../../innodb/include/wait_all_purged.inc
+
+SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
+SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
+
+SET debug_sync = 'now SIGNAL con1_finish';
+
+--connection con1
+--reap
+--disconnect con1
+--connection default
+SET debug_sync = 'now SIGNAL con2_finish';
+
+--connection con2
+--error 0,ER_LOCK_WAIT_TIMEOUT
+--reap
+--disconnect con2
+
+--connection default
+SET DEBUG_SYNC= 'RESET';
+
+SELECT * FROM t1;
+CHECK TABLE t1;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
+SET GLOBAL tx_isolation = @old_tx_isolation;
+SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
+
+--inc $i
+}
diff --git a/mysql-test/suite/innodb/t/innodb-read-view.test b/mysql-test/suite/innodb/t/innodb-read-view.test
index 425cbeb0..21c79cf6 100644
--- a/mysql-test/suite/innodb/t/innodb-read-view.test
+++ b/mysql-test/suite/innodb/t/innodb-read-view.test
@@ -1,7 +1,6 @@
# DEBUG_SYNC must be compiled in.
--source include/have_debug_sync.inc
--source include/have_debug.inc
-
# We need to test the use case:
# a. Create a transaction T1 that will be promoted to RW.
# b. Create a transaction T2 that will be promoted to RW.
@@ -27,22 +26,16 @@ INSERT INTO t2 VALUES(2, "c");
INSERT INTO t2 VALUES(3, "d");
--connect (con1,localhost,root,,)
---connect (con2,localhost,root,,)
-
-connection con1;
---echo 'T1'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t2;
connection default;
---echo 'T2'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t1;
-connection con2;
---echo 'T3'
+--connect (con2,localhost,root,,)
SET AUTOCOMMIT=0;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
@@ -50,48 +43,36 @@ SELECT * FROM t1;
SELECT * FROM t2;
connection con1;
---echo 'T1'
UPDATE t2 SET c1 = c1 + 100;
SELECT * FROM t2;
COMMIT;
connection default;
---echo 'T2'
UPDATE t1 SET c1 = c1 + 100;
SELECT * FROM t1;
COMMIT;
connection con2;
---echo 'T3'
SET DEBUG_SYNC='row_search_for_mysql_before_return WAIT_FOR waiting1';
--send SELECT * FROM t1;
connection default;
---echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
---echo 'Signalled T3'
connection con2;
---echo 'T3'
reap;
connection con2;
---echo 'T3'
SET DEBUG_SYNC='row_search_for_mysql_before_return WAIT_FOR waiting1';
--send SELECT * FROM t2;
connection default;
---echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
---echo 'Signalled T3'
connection con2;
---echo 'T3'
reap;
connection default;
-disconnect con1;
-disconnect con2;
# We need to test the use case:
# a. Create a transaction T1 that will be promoted to RW.
@@ -105,17 +86,12 @@ disconnect con2;
# i. T3 Does a select - it should not see the changes made by T1 but should
# see the changes by T2
---connect (con1,localhost,root,,)
---connect (con2,localhost,root,,)
-
connection con1;
---echo 'T1'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t1;
connection default;
---echo 'T2'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t2;
@@ -124,7 +100,6 @@ SELECT * FROM t2;
COMMIT;
connection con2;
---echo 'T3'
SET AUTOCOMMIT=0;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
@@ -132,42 +107,30 @@ SELECT * FROM t1;
SELECT * FROM t2;
connection con1;
---echo 'T1'
UPDATE t1 SET c1 = c1 + 100;
SELECT * FROM t1;
COMMIT;
connection con2;
---echo 'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
--send SELECT * FROM t1;
connection con1;
---echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
---echo 'Signalled T3'
connection con2;
---echo 'T3'
reap;
-
-connection con2;
---echo 'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
--send SELECT * FROM t2;
connection default;
---echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
---echo 'Signalled T3'
connection con2;
---echo 'T3'
reap;
+disconnect con2;
connection default;
-disconnect con1;
-disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
@@ -176,8 +139,7 @@ DROP TABLE t2;
--echo # Bug 21433768: NON-REPEATABLE READ WITH REPEATABLE READ ISOLATION
--echo #
---connect (con1,localhost,root,,)
-
+connection con1;
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 INT) ENGINE = InnoDB;
INSERT INTO t1 values (1, 0), (2, 0);
SELECT * FROM t1 ORDER BY col1;
@@ -200,9 +162,7 @@ reap;
disconnect con1;
connection default;
-
+SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
-# Clean up resources used in this test case.
-SET DEBUG_SYNC= 'RESET';
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test
index 659c42f0..663b76a1 100644
--- a/mysql-test/suite/innodb/t/innodb-system-table-view.test
+++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test
@@ -4,6 +4,9 @@
--source include/innodb_page_size_small.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
LET $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
@@ -144,3 +147,5 @@ DROP TABLE parent;
--echo # temporary tablespace information
--echo #
SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary';
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test
index ec4f4ef1..0612866a 100644
--- a/mysql-test/suite/innodb/t/innodb-table-online.test
+++ b/mysql-test/suite/innodb/t/innodb-table-online.test
@@ -4,6 +4,10 @@
--source include/have_debug_sync.inc
--source include/have_sequence.inc
+SET GLOBAL innodb_monitor_reset_all=all;
+--disable_warnings
+SET GLOBAL innodb_monitor_reset_all=default;
+--enable_warnings
let $innodb_metrics_select=
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
@@ -171,13 +175,13 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
ANALYZE TABLE t1;
SET @merge_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_0=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
connection con1;
@@ -215,13 +219,13 @@ while ($c)
eval $innodb_metrics_select;
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SELECT
@@ -243,16 +247,16 @@ reap;
eval $innodb_metrics_select;
SET @merge_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_1=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SET GLOBAL innodb_max_purge_lag_wait=0;
@@ -287,16 +291,16 @@ SELECT COUNT(c22f) FROM t1;
CHECK TABLE t1;
SET @merge_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
SET @merge_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
SET @rowlog_encrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
SET @rowlog_decrypt_2=
-(SELECT variable_value FROM information_schema.global_status
+(SELECT CAST(variable_value AS INTEGER) FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SELECT
diff --git a/mysql-test/suite/innodb/t/innodb-truncate.test b/mysql-test/suite/innodb/t/innodb-truncate.test
index 4d39fcae..cbd6139f 100644
--- a/mysql-test/suite/innodb/t/innodb-truncate.test
+++ b/mysql-test/suite/innodb/t/innodb-truncate.test
@@ -85,13 +85,11 @@ SET FOREIGN_KEY_CHECKS= ON;
CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
---replace_result $datadir ./
---error ER_ERROR_ON_RENAME
ALTER TABLE t1 RENAME TO t3;
-ALTER TABLE t1 FORCE;
+ALTER TABLE t3 FORCE;
--error ER_TRUNCATE_ILLEGAL_FK
-TRUNCATE TABLE t1;
-DROP TABLE t2, t1;
+TRUNCATE TABLE t3;
+DROP TABLE t2, t3;
--echo #
--echo # MDEV-24861 Assertion `trx->rsegs.m_redo.rseg' failed
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-1.test b/mysql-test/suite/innodb/t/innodb-wl5522-1.test
index dbd58835..9e5d606b 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-1.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-1.test
@@ -960,6 +960,25 @@ ALTER TABLE t1 IMPORT TABLESPACE;
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
---echo #
--echo # End of 10.3 tests
+
--echo #
+--echo # MDEV-29972 crash after "Unsupported meta-data version number"
+--echo #
+
+call mtr.add_suppression("Index for table 't2' is corrupt");
+
+CREATE TABLE t2 (i INT PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE t2 DISCARD TABLESPACE;
+--copy_file std_data/mysql80/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
+--copy_file std_data/mysql80/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
+--error ER_NOT_SUPPORTED_YET
+ALTER TABLE t2 IMPORT TABLESPACE;
+--remove_file $MYSQLD_DATADIR/test/t2.cfg
+--error ER_NOT_KEYFILE
+ALTER TABLE t2 IMPORT TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t2;
+DROP TABLE t2;
+
+--echo # End of 10.4 tests
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 38109116..b393ca70 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
@@ -35,49 +35,44 @@ SET GLOBAL innodb_buffer_pool_dump_pct=100;
# - The granularity of the timestamp is one second.
# - There could have been some dump caused by some previous test
# just a few milliseconds before.
-# In order to avoid conflict with previous tests, read the current value
-# of INNODB_BUFFER_POOL_DUMP_STATUS
-# and confirm that the timestamp is different after the dump
#***********************************************************
-# Read the current value to compare with the new value.
-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;
-
-# Sleep one second in order to ensure that the time stamp is
-# different at next dump
---sleep 1
+--error 0,1
+--remove_file $MYSQLD_DATADIR/ib_buffer_pool
+SET GLOBAL innodb_buffer_pool_dump_now=ON;
+perl;
+my $f="$ENV{MYSQLD_DATADIR}/ib_buffer_pool";
+my $count=300;
+until (-e $f)
+{
+ select(undef, undef, undef, .1);
+ die "File $f was not created\n" if (0 > --$count);
+}
+EOF
let $wait_condition = SELECT count(*) = 1
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
-AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc
--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;
-
-# Read the current value to compare with the new value.
---disable_warnings
-SELECT variable_value INTO @IBPDS
-FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
---enable_warnings
-
SET GLOBAL innodb_buffer_pool_dump_now=ON;
-# Sleep one second in order to ensure that the time stamp is
-# different at next dump
---sleep 1
+perl;
+my $f="$ENV{MYSQLD_DATADIR}/ib_buffer_pool";
+my $count=300;
+until (-e $f)
+{
+ select(undef, undef, undef, .1);
+ die "File $f was not created\n" if (0 > --$count);
+}
+EOF
let $wait_condition = SELECT count(*) = 1
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
-AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc
diff --git a/mysql-test/suite/innodb/t/innodb_bug12902967.test b/mysql-test/suite/innodb/t/innodb_bug12902967.test
deleted file mode 100644
index 5bd32cdf..00000000
--- a/mysql-test/suite/innodb/t/innodb_bug12902967.test
+++ /dev/null
@@ -1,25 +0,0 @@
-# Bug 12902967: Creating self referencing fk on same index unhandled,
-# confusing error
-#
-# Creating a self referencing foreign key on the same
-# column/index is an unhandled exception, it should throw a sensible
-# error but instead implies that your data dictionary may now be out
-# of sync:
-
---source include/have_innodb.inc
---source include/not_embedded.inc
-
-call mtr.add_suppression("In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
-
-let error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err;
---source include/restart_mysqld.inc
-
-create table t1 (f1 integer primary key) engine innodb;
-
-# The below statement should produce error message in error log.
-# This error message should mention problem with foreign keys
-# rather than with data dictionary.
---replace_regex /'\.\/test\/#sql-alter-[0-9a-f_\-]*'/'#sql-alter'/
---error ER_ERROR_ON_RENAME
-alter table t1 add constraint c1 foreign key (f1) references t1(f1);
-drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test
index 2368af76..30364c06 100644
--- a/mysql-test/suite/innodb/t/innodb_force_recovery.test
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test
@@ -21,8 +21,18 @@ SET GLOBAL innodb_fast_shutdown = 0;
--source include/restart_mysqld.inc
let $status=`SHOW ENGINE INNODB STATUS`;
+SELECT CAST(variable_value AS INTEGER) INTO @read1
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
+
select * from t1;
+SELECT CAST(variable_value AS INTEGER) INTO @read2
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
+
+SELECT @read1>0, @read2>@read1;
+
begin;
insert into t1 values(2, 3);
rollback;
diff --git a/mysql-test/suite/innodb/t/innodb_i_s_innodb_locks.test b/mysql-test/suite/innodb/t/innodb_i_s_innodb_locks.test
new file mode 100644
index 00000000..e6e46dbf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_i_s_innodb_locks.test
@@ -0,0 +1,169 @@
+#
+# Test that user data is correctly "visualized" in
+# INFORMATION_SCHEMA.innodb_locks.lock_data
+#
+
+-- source include/have_innodb.inc
+
+SET @save_timeout=@@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout=100000000;
+
+let $table_def =
+(
+ c01 TINYINT,
+ c02 TINYINT UNSIGNED,
+ c03 SMALLINT,
+ c04 SMALLINT UNSIGNED,
+ c05 MEDIUMINT,
+ c06 MEDIUMINT UNSIGNED,
+ c07 INT,
+ c08 INT UNSIGNED,
+ c09 BIGINT,
+ c10 BIGINT UNSIGNED,
+ PRIMARY KEY(c01, c02, c03, c04, c05, c06, c07, c08, c09, c10)
+) ENGINE=INNODB;
+
+-- eval CREATE TABLE t_min $table_def;
+INSERT INTO t_min VALUES
+(-128, 0,
+ -32768, 0,
+ -8388608, 0,
+ -2147483648, 0,
+ -9223372036854775808, 0);
+
+-- eval CREATE TABLE t_max $table_def;
+INSERT INTO t_max VALUES
+(127, 255,
+ 32767, 65535,
+ 8388607, 16777215,
+ 2147483647, 4294967295,
+ 9223372036854775807, 18446744073709551615);
+
+CREATE TABLE ```t'\"_str` (
+ c1 VARCHAR(32),
+ c2 VARCHAR(32),
+ c3 VARCHAR(32),
+ c4 VARCHAR(32),
+ c5 VARCHAR(32),
+ c6 VARCHAR(32),
+ c7 VARCHAR(32),
+ PRIMARY KEY(c1, c2, c3, c4, c5, c6, c7)
+) ENGINE=INNODB;
+INSERT INTO ```t'\"_str` VALUES
+('1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''');
+INSERT INTO ```t'\"_str` VALUES
+('2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""');
+INSERT INTO ```t'\"_str` VALUES
+('3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\');
+INSERT INTO ```t'\"_str` VALUES
+('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000);
+
+-- source include/count_sessions.inc
+
+-- connect (con_lock,localhost,root,,)
+-- connect (con_min_trylock,localhost,root,,)
+-- connect (con_max_trylock,localhost,root,,)
+-- connect (con_str_insert_supremum,localhost,root,,)
+-- connect (con_str_lock_row1,localhost,root,,)
+-- connect (con_str_lock_row2,localhost,root,,)
+-- connect (con_str_lock_row3,localhost,root,,)
+-- connect (con_str_lock_row4,localhost,root,,)
+-- connect (con_verify_innodb_locks,localhost,root,,)
+
+-- connection con_lock
+SET autocommit=0;
+SELECT * FROM t_min FOR UPDATE;
+SELECT * FROM t_max FOR UPDATE;
+SELECT * FROM ```t'\"_str` FOR UPDATE;
+
+-- connection con_min_trylock
+-- send
+SELECT * FROM t_min FOR UPDATE;
+
+-- connection con_max_trylock
+-- send
+SELECT * FROM t_max FOR UPDATE;
+
+-- connection con_str_insert_supremum
+-- send
+INSERT INTO ```t'\"_str` VALUES
+('z', 'z', 'z', 'z', 'z', 'z', 'z');
+
+-- connection con_str_lock_row1
+-- send
+SELECT * FROM ```t'\"_str` WHERE c1 = '1' FOR UPDATE;
+
+-- connection con_str_lock_row2
+-- send
+SELECT * FROM ```t'\"_str` WHERE c1 = '2' FOR UPDATE;
+
+-- connection con_str_lock_row3
+-- send
+SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE;
+
+-- connection con_str_lock_row4
+-- send
+SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
+
+-- connection con_verify_innodb_locks
+# Wait for the above queries to execute before continuing.
+# Without this, it sometimes happens that the SELECT from innodb_locks
+# executes before some of them, resulting in less than expected number
+# of rows being selected from innodb_locks. If there is a bug and there
+# are no 14 rows in innodb_locks then this test will fail with timeout.
+# Notice that if we query INNODB_LOCKS more often than once per 0.1 sec
+# then its contents will never change because the cache from which it is
+# filled is updated only if it has not been read for 0.1 seconds. See
+# CACHE_MIN_IDLE_TIME_US in trx/trx0i_s.c.
+let $cnt=10;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 14 FROM INFORMATION_SCHEMA.INNODB_LOCKS`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 0.2;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ -- echo Timeout waiting for rows in INNODB_LOCKS to appear
+}
+
+SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
+FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
+
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+
+set @save_sql_mode = @@sql_mode;
+SET SQL_MODE='ANSI_QUOTES';
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+SET @@sql_mode=@save_sql_mode;
+
+# Release all the locks;
+-- connection con_lock
+COMMIT;
+
+-- connection default
+
+-- disconnect con_lock
+-- disconnect con_min_trylock
+-- disconnect con_max_trylock
+-- disconnect con_str_insert_supremum
+-- disconnect con_str_lock_row1
+-- disconnect con_str_lock_row2
+-- disconnect con_str_lock_row3
+-- disconnect con_str_lock_row4
+-- disconnect con_verify_innodb_locks
+
+DROP TABLE t_min, t_max, ```t'\"_str`;
+
+-- source include/wait_until_count_sessions.inc
+
+SET GLOBAL innodb_lock_wait_timeout=@save_timeout;
diff --git a/mysql-test/suite/innodb/t/innodb_i_s_innodb_trx.test b/mysql-test/suite/innodb/t/innodb_i_s_innodb_trx.test
new file mode 100644
index 00000000..745e1d94
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_i_s_innodb_trx.test
@@ -0,0 +1,95 @@
+--source include/have_innodb.inc
+
+#
+# Test that transaction data is correctly "visualized" in
+# INFORMATION_SCHEMA.INNODB_TRX
+#
+
+SET @save_timeout=@@GLOBAL.innodb_lock_wait_timeout;
+SET GLOBAL innodb_lock_wait_timeout=100000000;
+
+DESCRIBE INFORMATION_SCHEMA.INNODB_TRX;
+
+CREATE TABLE t1 (
+ c01 INT,
+ c02 INT,
+ PRIMARY KEY (c01)
+) ENGINE=INNODB STATS_AUTO_RECALC=0;
+
+INSERT INTO t1 VALUES
+(1,2),(2,4),(3,6),(4,8);
+
+CREATE TABLE t2 (
+ c01 INT,
+ c02 INT,
+ PRIMARY KEY (c01),
+ FOREIGN KEY fk1 (c02) REFERENCES t1 (c01)
+) ENGINE=INNODB STATS_AUTO_RECALC=0;
+
+INSERT INTO t2 VALUES
+(1,1),(2,2),(3,3);
+
+-- source include/count_sessions.inc
+
+-- connect (con_trx,localhost,root,,)
+-- connect (con_verify_innodb_trx,localhost,root,,)
+
+-- connection con_trx
+SET autocommit=0;
+INSERT INTO t1 VALUES (5,10);
+SELECT * FROM t1 FOR UPDATE;
+
+let $wait_timeout= 300;
+let $wait_condition=
+ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TRX;
+-- source include/wait_condition.inc
+
+-- connection con_verify_innodb_trx
+SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked,
+trx_rows_locked, trx_rows_modified, trx_concurrency_tickets,
+trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
+FROM INFORMATION_SCHEMA.INNODB_TRX;
+
+-- connection con_trx
+ROLLBACK;
+SET FOREIGN_KEY_CHECKS = 0;
+SET UNIQUE_CHECKS = 0;
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+BEGIN;
+INSERT INTO t1 VALUES (6,12);
+
+let $wait_timeout= 300;
+let $wait_condition=
+ SELECT trx_unique_checks = 0 FROM INFORMATION_SCHEMA.INNODB_TRX;
+-- source include/wait_condition.inc
+
+-- connection con_verify_innodb_trx
+SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
+FROM INFORMATION_SCHEMA.INNODB_TRX;
+
+-- connection con_trx
+ROLLBACK;
+SET FOREIGN_KEY_CHECKS = 1;
+SET UNIQUE_CHECKS = 1;
+BEGIN;
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (4,10);
+
+let $wait_timeout= 300;
+let $wait_condition=
+ SELECT trx_unique_checks = 1 FROM INFORMATION_SCHEMA.INNODB_TRX;
+-- source include/wait_condition.inc
+-- disconnect con_trx
+
+-- connection con_verify_innodb_trx
+SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error
+FROM INFORMATION_SCHEMA.INNODB_TRX;
+-- disconnect con_verify_innodb_trx
+
+-- connection default
+DROP TABLE t2;
+DROP TABLE t1;
+
+-- source include/wait_until_count_sessions.inc
+
+SET GLOBAL innodb_lock_wait_timeout=@save_timeout;
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt b/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt
index 4edc71b6..101f6eae 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt
@@ -26,3 +26,4 @@
--loose-innodb_buffer_pool_pages
--loose-innodb_buffer_pool_pages_index
--loose-innodb_buffer_pool_pages_blob
+--innodb-open-files=1000000
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_tables.test b/mysql-test/suite/innodb/t/innodb_information_schema_tables.test
index 15b3bf4f..c62705da 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema_tables.test
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_tables.test
@@ -1,6 +1,10 @@
-- source include/have_innodb.inc
-- source include/not_embedded.inc
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_PATTERN= \[Warning\] InnoDB: innodb_open_files 1000000 should not be greater than the open_files_limit [0-9]+;
+--source include/search_pattern_in_file.inc
+
#
# MDEV-7762 InnoDB: Failing assertion: block->page.buf_fix_count > 0 in buf0buf.ic line 730
#
diff --git a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
index 1fb7c6d0..fa93e95c 100644
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
@@ -93,3 +93,17 @@ SELECT col_1_text = REPEAT("a", 3500) , col_2_text = REPEAT("o", 3500) FROM
worklog5743;
DROP TABLE worklog5743;
+
+--echo #
+--echo # MDEV-21245 InnoDB: Using a partial-field key prefix in search
+--echo #
+CREATE TABLE t1 (a VARCHAR(255), KEY k(a)) DEFAULT CHARSET=utf8mb3
+ENGINE=InnoDB;
+INSERT INTO t1 set a='';
+--enable_info
+alter table t1 change a a varchar(3000);
+--disable_info
+SELECT * FROM t1 WHERE a IN ('');
+DROP TABLE t1;
+
+--echo # End of 10.4 tests
diff --git a/mysql-test/suite/innodb/t/innodb_scrub.test b/mysql-test/suite/innodb/t/innodb_scrub.test
index 8fe460da..cf6b92e1 100644
--- a/mysql-test/suite/innodb/t/innodb_scrub.test
+++ b/mysql-test/suite/innodb/t/innodb_scrub.test
@@ -4,7 +4,7 @@
let $MYSQLD_DATADIR=`select @@datadir`;
CREATE TABLE t1(f1 int auto_increment primary key,
f2 varchar(256),
- f3 text) engine = innodb;
+ f3 text) engine = innodb stats_persistent=0;
let $numinserts = 500;
--disable_query_log
begin;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc.opt b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc.opt
new file mode 100644
index 00000000..aa53ff2e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc.opt
@@ -0,0 +1 @@
+--innodb-stats-persistent
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc.test b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc.test
new file mode 100644
index 00000000..e441a795
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc.test
@@ -0,0 +1,48 @@
+#
+# Test the persistent stats auto recalc
+#
+
+-- source include/have_innodb.inc
+# Page numbers printed by this test depend on the page size
+-- source include/have_innodb_16k.inc
+
+-- vertical_results
+
+-- let $check_stats1 = SELECT n_rows, clustered_index_size FROM mysql.innodb_table_stats WHERE table_name = 'autorecalc'
+-- let $check_stats2 = SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'autorecalc'
+
+CREATE TABLE autorecalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+
+# the CREATE should have inserted zeroed stats
+-- eval $check_stats1
+-- eval $check_stats2
+
+INSERT INTO autorecalc VALUES (1);
+INSERT INTO autorecalc VALUES (2);
+
+# wait for the bg stats thread to update the stats, notice we wait on
+# innodb_index_stats because innodb_table_stats gets updated first and
+# it is possible that (if we wait on innodb_table_stats) the wait cond
+# gets satisfied before innodb_index_stats is updated
+let $wait_condition = SELECT stat_value = 2 FROM mysql.innodb_index_stats WHERE table_name = 'autorecalc' AND index_name = 'PRIMARY' AND stat_name = 'n_diff_pfx01';
+-- source include/wait_condition.inc
+
+# the second INSERT from above should have triggered an auto-recalc
+-- eval $check_stats1
+-- eval $check_stats2
+
+# now DELETE the rows and trigger a second auto-recalc, InnoDB may wait a
+# few seconds before triggering an auto-recalc again (it tries not to be too
+# aggressive)
+
+DELETE FROM autorecalc;
+
+let $wait_timeout = 25;
+let $wait_condition = SELECT stat_value = 0 FROM mysql.innodb_index_stats WHERE table_name = 'autorecalc' AND index_name = 'PRIMARY' AND stat_name = 'n_diff_pfx01';
+-- source include/wait_condition.inc
+
+# the DELETE from above should have triggered an auto-recalc
+-- eval $check_stats1
+-- eval $check_stats2
+
+DROP TABLE autorecalc;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.opt b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.opt
new file mode 100644
index 00000000..aa53ff2e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.opt
@@ -0,0 +1 @@
+--innodb-stats-persistent
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.test b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.test
new file mode 100644
index 00000000..aeb5b5c2
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.test
@@ -0,0 +1,49 @@
+#
+# Test the persistent stats auto recalc during DDL
+#
+
+-- source include/have_innodb.inc
+
+-- vertical_results
+
+-- let $check_stats1 = SELECT n_rows FROM mysql.innodb_table_stats WHERE table_name = 'arddl' ORDER BY 1
+-- let $check_stats2 = SELECT index_name, stat_name, stat_value FROM mysql.innodb_index_stats WHERE table_name = 'arddl' AND index_name = 'PRIMARY' ORDER BY 1, 2, 3
+
+# Test ADD INDEX during background stats gathering
+
+CREATE TABLE arddl (a INT, b INT, PRIMARY KEY (a)) ENGINE=INNODB;
+
+INSERT INTO arddl VALUES (1, 10);
+INSERT INTO arddl VALUES (2, 10);
+
+ALTER TABLE arddl ADD INDEX (b);
+
+# wait for the bg stats thread to update the stats, notice we wait on
+# innodb_index_stats because innodb_table_stats gets updated first and
+# it is possible that (if we wait on innodb_table_stats) the wait cond
+# gets satisfied before innodb_index_stats is updated
+let $wait_condition = SELECT stat_value = 2 FROM mysql.innodb_index_stats WHERE table_name = 'arddl' AND index_name = 'PRIMARY' AND stat_name = 'n_diff_pfx01';
+-- source include/wait_condition.inc
+
+# the second INSERT from above should have triggered an auto-recalc
+-- eval $check_stats1
+-- eval $check_stats2
+
+DROP TABLE arddl;
+
+# Test DROP INDEX during background stats gathering
+
+CREATE TABLE arddl (a INT, b INT, PRIMARY KEY (a), KEY (b)) ENGINE=INNODB;
+
+INSERT INTO arddl VALUES (3, 10);
+INSERT INTO arddl VALUES (4, 10);
+
+ALTER TABLE arddl DROP INDEX b;
+
+let $wait_condition = SELECT stat_value = 2 FROM mysql.innodb_index_stats WHERE table_name = 'arddl' AND index_name = 'PRIMARY' AND stat_name = 'n_diff_pfx01';
+-- source include/wait_condition.inc
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+DROP TABLE arddl;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.opt b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.opt
new file mode 100644
index 00000000..aa53ff2e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.opt
@@ -0,0 +1 @@
+--innodb-stats-persistent
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.test b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.test
new file mode 100644
index 00000000..88ca8910
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.test
@@ -0,0 +1,45 @@
+#
+# Test the persistent stats auto recalc on lots of tables
+#
+
+--source include/no_valgrind_without_big.inc
+-- source include/have_innodb.inc
+
+let $check_stats = SELECT table_name, n_rows FROM mysql.innodb_table_stats WHERE table_name LIKE 'ar_%' ORDER BY table_name;
+
+-- disable_query_log
+let $i = 1200;
+while ($i > 1000) {
+ eval CREATE TABLE ar_$i (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+ dec $i;
+}
+-- enable_query_log
+
+# the CREATEs above should have inserted zeroed stats
+-- eval $check_stats
+
+-- disable_query_log
+let $i = 1200;
+while ($i > 1000) {
+ eval INSERT INTO ar_$i VALUES (1), (2);
+ dec $i;
+}
+-- enable_query_log
+
+-- disable_query_log
+let $i = 1200;
+while ($i > 1000) {
+ eval INSERT INTO ar_$i VALUES (3), (4);
+ dec $i;
+}
+-- enable_query_log
+
+# would be too long to wait for stats to become up to date here
+
+-- disable_query_log
+let $i = 1200;
+while ($i > 1000) {
+ eval DROP TABLE ar_$i;
+ dec $i;
+}
+-- enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.opt b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.opt
new file mode 100644
index 00000000..aa53ff2e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.opt
@@ -0,0 +1 @@
+--innodb-stats-persistent
diff --git a/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.test b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.test
new file mode 100644
index 00000000..4cd91007
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.test
@@ -0,0 +1,88 @@
+#
+# Test the persistent stats auto recalc when persistent stats do not exist
+#
+
+-- source include/have_innodb.inc
+
+-- vertical_results
+
+-- let $check_stats1 = SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'
+-- let $check_stats2 = SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'
+
+-- echo Test with default setting
+
+CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+
+# the CREATE should have inserted zeroed stats
+-- eval $check_stats1
+-- eval $check_stats2
+
+# open and close the table
+SELECT * FROM t;
+FLUSH TABLE t;
+
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+# open the table, causing stats recalc/save
+SELECT * FROM t;
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+DROP TABLE t;
+
+-- echo Test with explicit enable
+
+CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB STATS_AUTO_RECALC=1;
+
+# the CREATE should have inserted zeroed stats
+-- eval $check_stats1
+-- eval $check_stats2
+
+# open and close the table
+SELECT * FROM t;
+FLUSH TABLE t;
+
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+# open the table, causing stats recalc/save
+SELECT * FROM t;
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+DROP TABLE t;
+
+-- echo Test with explicit disable
+
+CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB STATS_AUTO_RECALC=0;
+
+# the CREATE should have inserted zeroed stats
+-- eval $check_stats1
+-- eval $check_stats2
+
+# open and close the table
+SELECT * FROM t;
+FLUSH TABLE t;
+
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+# open the table, stats should not be present, since autorecalc is disabled
+SELECT * FROM t;
+
+-- eval $check_stats1
+-- eval $check_stats2
+
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_external_pages.test b/mysql-test/suite/innodb/t/innodb_stats_external_pages.test
new file mode 100644
index 00000000..da0dce9a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_external_pages.test
@@ -0,0 +1,79 @@
+#
+# Bug#18384390 WRONG STATISTICS WITH BIG ROW LENGTH AND PERSISTENT STATS
+#
+
+--source include/have_innodb.inc
+--source include/have_innodb_max_16k.inc
+--source include/have_sequence.inc
+
+CREATE TABLE bug18384390 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ txt VARCHAR(10000)
+) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=0;
+
+let $count=1024;
+eval
+INSERT INTO bug18384390 (txt) SELECT REPEAT('0', 10000) FROM seq_1_to_$count;
+
+set use_stat_tables=never;
+ANALYZE TABLE bug18384390;
+
+-- let $n_rows = `SELECT n_rows FROM mysql.innodb_table_stats WHERE table_name = 'bug18384390'`
+
+-- let $table_rows = `SELECT table_rows FROM information_schema.tables WHERE table_name = 'bug18384390'`
+
+-- let $n_diff = `SELECT stat_value FROM mysql.innodb_index_stats WHERE table_name = 'bug18384390' AND stat_name = 'n_diff_pfx01'`
+
+-- let $cardinality = `SELECT cardinality FROM information_schema.statistics WHERE table_name = 'bug18384390'`
+
+-- let $margin_of_err_pct = 30
+-- let $margin_of_err_rows = `SELECT ROUND($count * $margin_of_err_pct / 100)`
+
+-- let $min_allowed = `SELECT $count - $margin_of_err_rows`
+-- let $max_allowed = `SELECT $count + $margin_of_err_rows`
+
+-- let $dump_sql = SELECT COUNT(*) FROM bug18384390; SELECT * FROM mysql.innodb_table_stats; SELECT * FROM mysql.innodb_index_stats; SELECT * FROM information_schema.tables WHERE table_name = 'bug18384390'; SELECT * FROM information_schema.statistics WHERE table_name = 'bug18384390';
+
+-- vertical_results
+
+if ($n_rows < $min_allowed) {
+ -- echo mysql.innodb_table_stats.n_rows is too small ($n_rows < $min_allowed)
+ -- eval $dump_sql
+}
+
+if ($n_rows > $max_allowed) {
+ -- echo mysql.innodb_table_stats.n_rows is too big ($n_rows > $max_allowed)
+ -- eval $dump_sql
+}
+
+if ($table_rows < $min_allowed) {
+ -- echo information_schema.tables.table_rows is too small ($table_rows < $min_allowed)
+ -- eval $dump_sql
+}
+
+if ($table_rows > $max_allowed) {
+ -- echo information_schema.tables.table_rows is too big ($table_rows > $max_allowed)
+ -- eval $dump_sql
+}
+
+if ($n_diff < $min_allowed) {
+ -- echo mysql.innodb_index_stats.stat_value is too small ($n_diff < $min_allowed)
+ -- eval $dump_sql
+}
+
+if ($n_diff > $max_allowed) {
+ -- echo mysql.innodb_index_stats.stat_value is too big ($n_diff > $max_allowed)
+ -- eval $dump_sql
+}
+
+if ($cardinality < $min_allowed) {
+ -- echo information_schema.statistics.cardinality is too small ($cardinality < $min_allowed)
+ -- eval $dump_sql
+}
+
+if ($cardinality > $max_allowed) {
+ -- echo information_schema.statistics.cardinality is too big ($cardinality > $max_allowed)
+ -- eval $dump_sql
+}
+
+DROP TABLE bug18384390;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_fetch.opt b/mysql-test/suite/innodb/t/innodb_stats_fetch.opt
new file mode 100644
index 00000000..faa681c8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_fetch.opt
@@ -0,0 +1,7 @@
+--innodb_sys_tables
+--innodb_sys_indexes
+--innodb_sys_virtual
+--innodb_sys_foreign
+--innodb_sys_foreign_cols
+--innodb_sys_tablestats
+--innodb_sys_tablespaces
diff --git a/mysql-test/suite/innodb/t/innodb_stats_fetch.test b/mysql-test/suite/innodb/t/innodb_stats_fetch.test
index 549ad65f..99fc115a 100644
--- a/mysql-test/suite/innodb/t/innodb_stats_fetch.test
+++ b/mysql-test/suite/innodb/t/innodb_stats_fetch.test
@@ -81,3 +81,18 @@ FROM information_schema.tables WHERE table_name = 'test_ps_fetch';
DROP TABLE test_ps_fetch;
set @@use_stat_tables = @save_use_stat_tables;
+
+--echo #
+--echo # MDEV-28613 LeakSanitizer caused by I_S query using LIMIT ROWS EXAMINED
+--echo #
+CREATE TABLE t1(f1 VARCHAR(255), FULLTEXT(f1))ENGINE=InnoDB;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS LIMIT ROWS EXAMINED 5;
+--disable_result_log
+SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES LIMIT ROWS EXAMINED 5;
+--enable_result_log
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN LIMIT ROWS EXAMINED 5;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS LIMIT ROWS EXAMINED 5;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_flag_global.combinations b/mysql-test/suite/innodb/t/innodb_stats_flag_global.combinations
new file mode 100644
index 00000000..561eb72d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_flag_global.combinations
@@ -0,0 +1,4 @@
+[on]
+--innodb-stats-persistent=1
+[off]
+--innodb-stats-persistent=0
diff --git a/mysql-test/suite/innodb/t/innodb_stats_flag_global.test b/mysql-test/suite/innodb/t/innodb_stats_flag_global.test
new file mode 100644
index 00000000..88f0ed7c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_flag_global.test
@@ -0,0 +1,91 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+#
+-- echo =====
+-- echo === Test ANALYZE behavior after default creation
+-- echo =====
+
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+DROP TABLE test_ps_flag;
+
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=default;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+DROP TABLE test_ps_flag;
+
+#
+-- echo =====
+-- echo === Test ANALYZE behavior after creation with explicit PS=OFF
+-- echo =====
+
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+DROP TABLE test_ps_flag;
+
+#
+-- echo =====
+-- echo === Test ANALYZE behavior after creation with explicit PS=ON
+-- echo =====
+
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=1;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+DROP TABLE test_ps_flag;
+
+#
+-- echo =====
+-- echo === Test ANALYZE behavior after creation with explicit PS=OFF,
+-- echo === then ALTER to ON, then ALTER to OFF, then ALTER to default
+-- echo =====
+
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
+
+ALTER TABLE test_ps_flag STATS_PERSISTENT=1;
+
+# also check that the change from the ALTER TABLE survives server restart
+-- source include/restart_mysqld.inc
+
+-- source innodb_stats_flag_global_analyze.inc
+
+ALTER TABLE test_ps_flag STATS_PERSISTENT=0;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+ALTER TABLE test_ps_flag STATS_PERSISTENT=default;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+DROP TABLE test_ps_flag;
+
+#
+-- echo =====
+-- echo === Test ANALYZE behavior after creation with explicit PS=ON,
+-- echo === then ALTER to OFF, then ALTER to ON, then ALTER to default
+-- echo =====
+
+CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=1;
+
+ALTER TABLE test_ps_flag STATS_PERSISTENT=0;
+
+# also check that the change from the ALTER TABLE survives server restart
+-- source include/restart_mysqld.inc
+
+-- source innodb_stats_flag_global_analyze.inc
+
+ALTER TABLE test_ps_flag STATS_PERSISTENT=1;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+ALTER TABLE test_ps_flag STATS_PERSISTENT=default;
+
+-- source innodb_stats_flag_global_analyze.inc
+
+DROP TABLE test_ps_flag;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_flag_global_analyze.inc b/mysql-test/suite/innodb/t/innodb_stats_flag_global_analyze.inc
new file mode 100644
index 00000000..8a68677e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_flag_global_analyze.inc
@@ -0,0 +1,13 @@
+SHOW CREATE TABLE test_ps_flag;
+
+DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
+DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+
+# must be 0, we have just deleted the rows
+SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE test_ps_flag;
+
+# if the table is PS enabled, then this should be 1 and 0 otherwise
+SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test
index a8a311a6..294f283b 100644
--- a/mysql-test/suite/innodb/t/innodb_stats_persistent.test
+++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test
@@ -13,6 +13,7 @@ ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
+SET STATEMENT use_stat_tables=never FOR
ANALYZE TABLE t1;
connect(con1, localhost, root,,);
@@ -49,7 +50,7 @@ SELECT COUNT(*) FROM t2;
connection con1;
EXPLAIN SELECT * FROM t2 WHERE val=4;
---source include/wait_all_purged.inc
+SET GLOBAL innodb_max_purge_lag_wait=0;
--echo # After COMMIT and purge, the DELETE must show up.
EXPLAIN SELECT * FROM t1 WHERE val=4;
@@ -82,3 +83,41 @@ DROP TABLE t1,t2;
SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
SET GLOBAL innodb_stats_traditional = @saved_traditional;
SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
+
+#
+# Bug#12429573 TIMESTAMP COLUMN OF INNODB.INDEX_STATS ARE NOT UPDATED
+# WHEN RE-RUNNING ANALYZE
+#
+CREATE TABLE bug12429573 (i INTEGER PRIMARY KEY, j INTEGER, KEY(j))
+ENGINE=INNODB STATS_PERSISTENT=1;
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE bug12429573;
+
+# Cannot check the exact timestamp here because it is always different
+# but at least check that both timestamps in innodb_table_stats and in
+# innodb_index_stats have been updated to the same value. If the bug is
+# present this check will fail.
+
+SELECT last_update INTO @last FROM mysql.innodb_table_stats
+WHERE table_name = 'bug12429573';
+SELECT * FROM mysql.innodb_index_stats
+WHERE table_name = 'bug12429573' AND last_update!=@last;
+
+# The first ANALYZE would insert timestamp e.g. 17:23:39 in both
+# innodb_table_stats and innodb_index_stats. The bug is that the second
+# ANALYZE only updates the timestamp in innodb_table_stats. In order to
+# check if the timestamp in innodb_index_stats has really been updated we
+# need it to be different from the previous one (17:23:39) with at least
+# one second.
+-- sleep 1
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE bug12429573;
+
+SELECT * FROM mysql.innodb_table_stats
+WHERE table_name = 'bug12429573' AND last_update=@last;
+SELECT * FROM mysql.innodb_index_stats
+WHERE table_name = 'bug12429573' AND last_update=@last;
+
+DROP TABLE bug12429573;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_sample_pages.opt b/mysql-test/suite/innodb/t/innodb_stats_sample_pages.opt
new file mode 100644
index 00000000..aa53ff2e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_sample_pages.opt
@@ -0,0 +1 @@
+--innodb-stats-persistent
diff --git a/mysql-test/suite/innodb/t/innodb_stats_sample_pages.test b/mysql-test/suite/innodb/t/innodb_stats_sample_pages.test
new file mode 100644
index 00000000..1aac71a0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_sample_pages.test
@@ -0,0 +1,53 @@
+#
+# Test that the table option STATS_SAMPLE_PAGES=N|default is indeed
+# used by InnoDB
+#
+
+-- source include/have_innodb.inc
+# Page numbers printed by this test depend on the page size
+-- source include/have_innodb_16k.inc
+
+SET GLOBAL innodb_stats_persistent_sample_pages=17;
+
+CREATE TABLE test_ps_sample_pages_used (
+ a VARCHAR(512), PRIMARY KEY (a)
+) ENGINE=INNODB STATS_SAMPLE_PAGES=default;
+
+# Insert enough records into the table so that it has more than 2*17+1 pages
+# If we ask to scan more than the half of the leaf pages, then the sampling
+# will do full scan and we cannot check whether the sample_pages variable was
+# honored.
+BEGIN;
+-- disable_query_log
+let $i=999;
+while ($i) {
+ eval INSERT INTO test_ps_sample_pages_used VALUES (REPEAT(1000+$i, 128));
+ dec $i;
+}
+-- enable_query_log
+COMMIT;
+
+ANALYZE TABLE test_ps_sample_pages_used;
+
+# confirm the big number of leaf pages in the index
+SELECT stat_name, stat_value FROM mysql.innodb_index_stats
+WHERE table_name='test_ps_sample_pages_used' AND stat_name='n_leaf_pages';
+
+# confirm that 17 pages were sampled, that is - the global
+# innodb_stats_persistent_sample_pages is used when the table option
+# STATS_SAMPLE_PAGES is set to 'default'.
+SELECT sample_size FROM mysql.innodb_index_stats
+WHERE table_name='test_ps_sample_pages_used' AND stat_name='n_diff_pfx01';
+
+ALTER TABLE test_ps_sample_pages_used STATS_SAMPLE_PAGES=14;
+
+ANALYZE TABLE test_ps_sample_pages_used;
+
+# confirm that 14 pages were sampled, that is - the table option
+# STATS_SAMPLE_PAGES is used when it is set.
+SELECT sample_size FROM mysql.innodb_index_stats
+WHERE table_name='test_ps_sample_pages_used' AND stat_name='n_diff_pfx01';
+
+DROP TABLE test_ps_sample_pages_used;
+
+SET GLOBAL innodb_stats_persistent_sample_pages=default;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_table_flag_auto_recalc.test b/mysql-test/suite/innodb/t/innodb_stats_table_flag_auto_recalc.test
new file mode 100644
index 00000000..01fe4331
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_table_flag_auto_recalc.test
@@ -0,0 +1,83 @@
+#
+# Test CREATE TABLE ... STATS_AUTO_RECALC=0|1|default
+#
+
+-- source include/no_valgrind_without_big.inc
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+-- vertical_results
+
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+ALTER TABLE test_ps_auto_recalc STATS_AUTO_RECALC=1;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+DROP TABLE test_ps_auto_recalc;
+
+##
+
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_AUTO_RECALC=default;
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+DROP TABLE test_ps_auto_recalc;
+
+##
+
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_AUTO_RECALC=0;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+ALTER TABLE test_ps_auto_recalc STATS_AUTO_RECALC=1;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+DROP TABLE test_ps_auto_recalc;
+
+##
+
+CREATE TABLE test_ps_auto_recalc (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_AUTO_RECALC=1;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+ALTER TABLE test_ps_auto_recalc STATS_AUTO_RECALC=0;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_auto_recalc;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_auto_recalc';
+
+DROP TABLE test_ps_auto_recalc;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_table_flag_sample_pages.test b/mysql-test/suite/innodb/t/innodb_stats_table_flag_sample_pages.test
new file mode 100644
index 00000000..a5c3c862
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_table_flag_sample_pages.test
@@ -0,0 +1,103 @@
+#
+# Test CREATE TABLE ... STATS_SAMPLE_PAGES=N|default
+#
+
+-- source include/have_innodb.inc
+# include/restart_mysqld.inc does not work in embedded mode
+-- source include/not_embedded.inc
+
+-- vertical_results
+
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
+
+SHOW CREATE TABLE test_ps_sample_pages;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+
+ALTER TABLE test_ps_sample_pages STATS_SAMPLE_PAGES=12345;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_sample_pages;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+
+DROP TABLE test_ps_sample_pages;
+
+##
+
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=default;
+
+SHOW CREATE TABLE test_ps_sample_pages;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+
+DROP TABLE test_ps_sample_pages;
+
+##
+
+-- error ER_PARSE_ERROR
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=-5;
+
+-- error ER_PARSE_ERROR
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=0;
+
+-- error ER_PARSE_ERROR
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=67000;
+
+-- error ER_PARSE_ERROR
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=670000;
+
+-- error ER_PARSE_ERROR
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=65536;
+
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=65535;
+
+SHOW CREATE TABLE test_ps_sample_pages;
+
+DROP TABLE test_ps_sample_pages;
+
+##
+
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=1;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_sample_pages;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+
+DROP TABLE test_ps_sample_pages;
+
+##
+
+CREATE TABLE test_ps_sample_pages (a INT, PRIMARY KEY (a)) ENGINE=INNODB
+STATS_SAMPLE_PAGES=5678;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_sample_pages;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+
+ALTER TABLE test_ps_sample_pages STATS_SAMPLE_PAGES=default;
+
+# confirm that the flag survives server restart
+-- source include/restart_mysqld.inc
+
+SHOW CREATE TABLE test_ps_sample_pages;
+SELECT create_options FROM information_schema.tables
+WHERE table_name='test_ps_sample_pages';
+
+DROP TABLE test_ps_sample_pages;
diff --git a/mysql-test/suite/innodb/t/innodb_ut_format_name.test b/mysql-test/suite/innodb/t/innodb_ut_format_name.test
new file mode 100644
index 00000000..6e4023c7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_ut_format_name.test
@@ -0,0 +1,17 @@
+#
+# Test ut_format_name()
+#
+
+-- source include/have_debug.inc
+-- source include/have_innodb.inc
+
+CREATE TABLE t (c INT) ENGINE=INNODB;
+
+# This will invoke test_ut_format_name() in debug builds
+
+SET @save_dbug = @@debug_dbug;
+SET debug_dbug = '+d,test_ut_format_name';
+
+DROP TABLE t;
+
+SET debug_dbug = @save_dbug;
diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test
index 5b6d3f87..d6d7a988 100644
--- a/mysql-test/suite/innodb/t/instant_alter.test
+++ b/mysql-test/suite/innodb/t/instant_alter.test
@@ -3,6 +3,9 @@
let $datadir=`select @@datadir`;
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
--echo #
--echo # MDEV-11369: Instant ADD COLUMN for InnoDB
--echo #
@@ -964,3 +967,4 @@ remove_file $datadir/test/mdev28822_100427_innodb.frm;
copy_file std_data/mysql_upgrade/mdev28822_100427_innodb.frm $datadir/test/mdev28822_100427_innodb.frm;
ALTER TABLE mdev28822_100427_innodb ADD i1 INTEGER, ALGORITHM=INSTANT;
DROP TABLE mdev28822_100427_innodb;
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
index 81d36849..8a4299e5 100644
--- a/mysql-test/suite/innodb/t/instant_alter_bugs.test
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -1,4 +1,8 @@
--source include/have_innodb.inc
+--source include/have_sequence.inc
+
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
--echo #
--echo # MDEV-17821 Assertion `!page_rec_is_supremum(rec)' failed
@@ -526,4 +530,32 @@ CREATE TABLE t1 (i int AS (0) STORED, j INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN i INT GENERATED ALWAYS AS (1), DROP COLUMN i;
DROP TABLE t1;
+--echo #
+--echo # MDEV-18322 Assertion "wrong_page_type" on instant ALTER
+--echo #
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE c TEXT
+ DEFAULT(SELECT CONCAT('CREATE TABLE t1 (c',
+ GROUP_CONCAT(seq SEPARATOR ' CHAR(200), c'),
+ ' CHAR(211)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT')
+ FROM seq_1_to_40);
+ EXECUTE IMMEDIATE c;
+END;
+$$
+DELIMITER ;$$
+INSERT INTO t1 SET c1=NULL;
+--error ER_TOO_BIG_ROWSIZE
+ALTER TABLE t1 ADD c41 INT FIRST;
+--error ER_TOO_BIG_ROWSIZE
+ALTER TABLE t1 ADD c41 INT FIRST;
+CHECK TABLE t1;
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+
--echo # End of 10.4 tests
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
+--echo # End of 10.6 tests
diff --git a/mysql-test/suite/innodb/t/instant_alter_crash.test b/mysql-test/suite/innodb/t/instant_alter_crash.test
index b687664d..f51f61e3 100644
--- a/mysql-test/suite/innodb/t/instant_alter_crash.test
+++ b/mysql-test/suite/innodb/t/instant_alter_crash.test
@@ -14,7 +14,7 @@ let MYSQLD_DATADIR=`select @@datadir`;
--echo #
CREATE TABLE t1(id INT PRIMARY KEY, c2 INT UNIQUE)
-ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ENGINE=InnoDB STATS_PERSISTENT=0 ROW_FORMAT=REDUNDANT;
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES(0,2);
INSERT INTO t2 VALUES(2,1);
diff --git a/mysql-test/suite/innodb/t/instant_alter_debug.test b/mysql-test/suite/innodb/t/instant_alter_debug.test
index d9ef7b06..f11d0bd0 100644
--- a/mysql-test/suite/innodb/t/instant_alter_debug.test
+++ b/mysql-test/suite/innodb/t/instant_alter_debug.test
@@ -3,6 +3,9 @@
--source include/have_debug_sync.inc
--source include/have_sequence.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
SET @old_instant=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column');
@@ -607,3 +610,7 @@ SET DEBUG_SYNC=RESET;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
+--echo # End of 10.6 tests
diff --git a/mysql-test/suite/innodb/t/instant_alter_purge.test b/mysql-test/suite/innodb/t/instant_alter_purge.test
index 445cae4d..5fbd4da8 100644
--- a/mysql-test/suite/innodb/t/instant_alter_purge.test
+++ b/mysql-test/suite/innodb/t/instant_alter_purge.test
@@ -14,7 +14,7 @@ connect (prevent_purge,localhost,root);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
-CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INT, f2 INT) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 () VALUES ();
ALTER TABLE t1 DROP f2, ADD COLUMN f2 INT;
ALTER TABLE t1 DROP f1;
diff --git a/mysql-test/suite/innodb/t/instant_alter_rollback.test b/mysql-test/suite/innodb/t/instant_alter_rollback.test
index a4608001..491f6346 100644
--- a/mysql-test/suite/innodb/t/instant_alter_rollback.test
+++ b/mysql-test/suite/innodb/t/instant_alter_rollback.test
@@ -3,6 +3,8 @@
# The embedded server tests do not support restarting.
--source include/not_embedded.inc
+SET GLOBAL innodb_stats_persistent = 0;
+
# Flush any open myisam tables from previous tests
FLUSH TABLES;
diff --git a/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test b/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test
index 3a04c712..0f88f8d9 100644
--- a/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test
+++ b/mysql-test/suite/innodb/t/lock_move_wait_lock_race.test
@@ -3,7 +3,8 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
-CREATE TABLE t (pk int PRIMARY KEY, c varchar(10)) ENGINE=InnoDB;
+CREATE TABLE t (pk int PRIMARY KEY, c varchar(10))
+STATS_PERSISTENT=0 ENGINE=InnoDB;
INSERT INTO t VALUES (10, "0123456789");
--connection default
diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test
index eb616d7f..f88a13db 100644
--- a/mysql-test/suite/innodb/t/log_file_name.test
+++ b/mysql-test/suite/innodb/t/log_file_name.test
@@ -7,6 +7,8 @@
# Embedded server does not support crashing
--source include/not_embedded.inc
+call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
+
SET GLOBAL innodb_file_per_table=ON;
FLUSH TABLES;
@@ -171,6 +173,9 @@ call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' \(init function returned error\|registration as a STORAGE ENGINE failed\)");
call mtr.add_suppression("InnoDB: Table test/u[123] in the InnoDB data dictionary has tablespace id [1-9][0-9]*, but tablespace with that id or name does not exist\\. Have you deleted or moved \\.ibd files\\?");
call mtr.add_suppression("InnoDB: Cannot replay rename of tablespace.*");
+call mtr.add_suppression("InnoDB: Attempted to open a previously opened tablespace");
+call mtr.add_suppression("InnoDB: Recovery cannot access file");
+call mtr.add_suppression("InnoDB: Cannot read first page in datafile:");
FLUSH TABLES;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test
index b1f32302..e9698cc0 100644
--- a/mysql-test/suite/innodb/t/mdev-14846.test
+++ b/mysql-test/suite/innodb/t/mdev-14846.test
@@ -2,6 +2,8 @@
--source include/count_sessions.inc
--source include/have_debug_sync.inc
+--source include/innodb_stable_estimates.inc
+
CREATE TABLE t1 (
pk INT,
f1 VARCHAR(10) NOT NULL,
diff --git a/mysql-test/suite/innodb/t/mem_pressure.test b/mysql-test/suite/innodb/t/mem_pressure.test
new file mode 100644
index 00000000..91f75e65
--- /dev/null
+++ b/mysql-test/suite/innodb/t/mem_pressure.test
@@ -0,0 +1,44 @@
+--source include/have_debug.inc
+--source include/linux.inc
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+
+--echo #
+--echo # MDEV-24670 avoid OOM by linux kernel co-operative memory management
+--echo #
+
+set @save_dbug=@@debug_dbug;
+
+set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug;
+# Wait for the undo logs to be empty from previous tests.
+# This is not an actual parameter, so there is no need to restore it.
+set GLOBAL innodb_max_purge_lag_wait=0;
+
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+SET GLOBAL innodb_limit_optimistic_insert_debug=2;
+SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR
+INSERT INTO t1 SELECT * FROM seq_1_to_1000;
+
+SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
+
+DROP TABLE t1;
+
+SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
+
+set debug_dbug="d,trigger_garbage_collection";
+SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
+
+SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
+FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
+
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*;
+--source include/search_pattern_in_file.inc
+
+set debug_dbug=@save_dbug;
+
+--echo # End of 10.11 tests
diff --git a/mysql-test/suite/innodb/t/no_pad.test b/mysql-test/suite/innodb/t/no_pad.test
index 1be1972c..15ab71b6 100644
--- a/mysql-test/suite/innodb/t/no_pad.test
+++ b/mysql-test/suite/innodb/t/no_pad.test
@@ -8,3 +8,49 @@ ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES ('',2);
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-26743 InnoDB: CHAR+nopad does not work well
+--echo #
+
+--echo #
+--echo # Basic Latin letter vs equal accented letter
+--echo #
+
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a CHAR(2), PRIMARY KEY(a)) COLLATE utf8_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES ('a'),('ä');
+DROP TABLE t1;
+
+--echo #
+--echo # Two letters vs equal (but space padded) expansion
+--echo #
+
+CREATE TABLE t1 (a CHAR(2), PRIMARY KEY(a)) COLLATE utf8_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES ('ss'),('ß');
+SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
+SELECT HEX(a) FROM t1;
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+
+--echo #
+--echo # Basic Latin letter (but followed by an ignorable character) vs equal accented letter
+--echo #
+
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a CHAR(3), PRIMARY KEY(a)) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (CONCAT('a',_utf8mb3 0x01)),('ä');
+SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
+SELECT HEX(a) FROM t1 ORDER BY HEX(a);
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+
+SET NAMES utf8mb3;
+CREATE TABLE t1 (a CHAR(2), PRIMARY KEY(a)) COLLATE utf8_unicode_nopad_ci ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES (CONCAT('a',_utf8mb3 0x01)),('ä');
+SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
+SELECT HEX(a) FROM t1 ORDER BY HEX(a);
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/page_id_innochecksum.test b/mysql-test/suite/innodb/t/page_id_innochecksum.test
index 902d2aba..9d8114d1 100644
--- a/mysql-test/suite/innodb/t/page_id_innochecksum.test
+++ b/mysql-test/suite/innodb/t/page_id_innochecksum.test
@@ -6,7 +6,7 @@ let MYSQLD_BASEDIR= `SELECT @@basedir`;
let MYSQLD_DATADIR= `SELECT @@datadir`;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
-create table t1(f1 int not null)engine=innodb;
+create table t1(f1 int not null)engine=innodb stats_persistent=0;
insert into t1 values(1), (2), (3);
let $resultlog=$MYSQLTEST_VARDIR/tmp/result.log;
diff --git a/mysql-test/suite/innodb/t/purge.test b/mysql-test/suite/innodb/t/purge.test
index 97c0fb86..1dc2b117 100644
--- a/mysql-test/suite/innodb/t/purge.test
+++ b/mysql-test/suite/innodb/t/purge.test
@@ -1,6 +1,9 @@
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
--echo # Bug #12429576 - Test an assertion failure on purge.
CREATE TABLE t1_purge (
A int,
@@ -110,4 +113,6 @@ SHOW CREATE TABLE t12963823;
# We need to activate the purge thread before DROP TABLE.
-- source include/wait_all_purged.inc
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823;
diff --git a/mysql-test/suite/innodb/t/purge_secondary.test b/mysql-test/suite/innodb/t/purge_secondary.test
index 4e664109..8a38a418 100644
--- a/mysql-test/suite/innodb/t/purge_secondary.test
+++ b/mysql-test/suite/innodb/t/purge_secondary.test
@@ -1,6 +1,9 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
--disable_query_log
call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool");
--enable_query_log
@@ -170,3 +173,7 @@ UNLOCK TABLES;
DROP TABLE t1;
--echo # End of 10.3 tests
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
+
+--echo # End of 10.6 tests
diff --git a/mysql-test/suite/innodb/t/purge_thread_shutdown.test b/mysql-test/suite/innodb/t/purge_thread_shutdown.test
deleted file mode 100644
index 53b375b8..00000000
--- a/mysql-test/suite/innodb/t/purge_thread_shutdown.test
+++ /dev/null
@@ -1,43 +0,0 @@
-source include/have_innodb.inc;
-source include/not_embedded.inc;
-source include/have_debug.inc;
-
-connect con1, localhost, root;
-create table t1 (a int) engine=innodb;
-insert t1 values (1),(2),(3),(4);
-delete from t1 where a=1;
-
-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 $_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;
-
-connection default;
-disconnect con1;
-
-sleep 5;
-select user,state from information_schema.processlist order by 2;
-set global innodb_fast_shutdown=1;
-
-let $wait_condition=select count(*) = 0 from information_schema.processlist where user='system user';
-source include/wait_condition.inc;
-select user,state from information_schema.processlist order by 2;
-
-delete from t1 where a=3;
-error ER_WRONG_VALUE_FOR_VAR;
-set global innodb_fast_shutdown=0;
-
-# Get id with space prefix to ensure that replace_result doesn't replace
-# the error code
-let $me=`select concat(' ', connection_id())`;
-replace_result $me ID;
-error ER_CONNECTION_KILLED, 2026;
-eval kill $me;
-
-source include/start_mysqld.inc;
-drop table t1;
diff --git a/mysql-test/suite/innodb/t/read_only_recovery.test b/mysql-test/suite/innodb/t/read_only_recovery.test
index 47146213..d011b3aa 100644
--- a/mysql-test/suite/innodb/t/read_only_recovery.test
+++ b/mysql-test/suite/innodb/t/read_only_recovery.test
@@ -39,6 +39,8 @@ SELECT * FROM t;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
SET GLOBAL innodb_max_purge_lag_wait=0;
+INSERT INTO mysql.innodb_index_stats
+SELECT * FROM mysql.innodb_index_stats LIMIT 0;
--let $restart_parameters=
--source include/restart_mysqld.inc
SELECT * FROM t;
diff --git a/mysql-test/suite/innodb/t/records_in_range.test b/mysql-test/suite/innodb/t/records_in_range.test
new file mode 100644
index 00000000..697dbc1e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/records_in_range.test
@@ -0,0 +1,432 @@
+#
+# Test btr_estimate_n_rows_in_range() which is used by
+# ha_innobase::records_in_range()
+#
+
+-- source include/have_debug.inc
+-- source include/have_innodb.inc
+-- source include/innodb_page_size_small.inc
+
+CREATE TABLE records_in_range_test (
+ c1 VARCHAR(16),
+ c2 VARCHAR(512),
+ PRIMARY KEY (c1)
+) ENGINE=INNODB STATS_PERSISTENT=1;
+
+# Insert some records so that they cannot fit in one page for some page sizes
+# in order to exercise records_in_range() where 1, 2 or more pages are sampled
+INSERT INTO records_in_range_test VALUES
+('ccc', REPEAT('v', 512)),
+('kkk01', REPEAT('v', 512)),
+('kkk02', REPEAT('v', 512)),
+('kkk03', REPEAT('v', 512)),
+('kkk04', REPEAT('v', 512)),
+('kkk05', REPEAT('v', 512)),
+('kkk06', REPEAT('v', 512)),
+('kkk07', REPEAT('v', 512)),
+('kkk08', REPEAT('v', 512)),
+('mmm', REPEAT('v', 512)),
+('nnn', REPEAT('v', 512)),
+('uuu01', REPEAT('v', 512)),
+('uuu02', REPEAT('v', 512)),
+('uuu03', REPEAT('v', 512)),
+('uuu04', REPEAT('v', 512)),
+('uuu05', REPEAT('v', 512)),
+('uuu06', REPEAT('v', 512)),
+('uuu07', REPEAT('v', 512)),
+('uuu08', REPEAT('v', 512)),
+('xxx', REPEAT('v', 512));
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE records_in_range_test;
+
+# 16k or bigger page size: 1 leaf page
+# 8k page size: 2 leaf pages
+# 4k page size: 4 leaf pages
+SELECT index_name, stat_name, stat_value
+FROM mysql.innodb_index_stats
+WHERE
+table_name='records_in_range_test' AND stat_name = 'n_leaf_pages';
+
+# 16k or bigger page size: 1 page in total (leaf + nonleaf)
+# 8k page size: 3 pages in total (leaf + nonleaf)
+# 4k page size: 5 pages in total (leaf + nonleaf)
+SELECT index_name, stat_name, stat_value
+FROM mysql.innodb_index_stats
+WHERE
+table_name='records_in_range_test' AND stat_name = 'size';
+
+# We exploit the warning mechanism here to display the return value from
+# btr_estimate_n_rows_in_range()
+SET @save_dbug = @@debug_dbug;
+SET DEBUG_DBUG='+d,print_btr_estimate_n_rows_in_range_return_value';
+
+-- echo
+-- echo In all SELECTs below the number of the records in the range returned
+-- echo by COUNT(*) must be the same as the number returned by
+-- echo btr_estimate_n_rows_in_range() which can be seen inside the artificial
+-- echo warning
+
+-- echo
+-- echo Test left-unbounded, right-open intervals
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'aaa';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 < 'zzz';
+
+-- echo
+-- echo Test left-unbounded, right-closed intervals
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'aaa';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 <= 'zzz';
+
+-- echo
+-- echo Test left-open, right-unbounded intervals
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz';
+
+-- echo
+-- echo Test left-closed, right-unbounded intervals
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz';
+
+-- echo
+-- echo Test left-open, right-open intervals
+-- echo In some cases here the optimizer is smart enough not to call
+-- echo ha_innobase::records_in_range() at all, so we get no warning containing
+-- echo the value returned from btr_estimate_n_rows_in_range()
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 < 'zzz';
+
+-- echo
+-- echo Test left-closed, right-open intervals
+-- echo In some cases here the optimizer is smart enough not to call
+-- echo ha_innobase::records_in_range() at all, so we get no warning containing
+-- echo the value returned from btr_estimate_n_rows_in_range()
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 < 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 < 'zzz';
+
+-- echo
+-- echo Test left-open, right-closed intervals
+-- echo In some cases here the optimizer is smart enough not to call
+-- echo ha_innobase::records_in_range() at all, so we get no warning containing
+-- echo the value returned from btr_estimate_n_rows_in_range()
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'aaa' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'ccc' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'eee' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'mmm' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'nnn' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'qqq' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'xxx' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 > 'zzz' AND c1 <= 'zzz';
+
+-- echo
+-- echo Test left-closed, right-closed intervals
+-- echo In some cases here the optimizer is smart enough not to call
+-- echo ha_innobase::records_in_range() at all, so we get no warning containing
+-- echo the value returned from btr_estimate_n_rows_in_range()
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'aaa' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'ccc' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'eee' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'mmm' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'nnn' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'qqq' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'xxx' AND c1 <= 'zzz';
+-- echo
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'bbb';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'ccc';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'eee';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'mmm';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'nnn';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'qqq';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'xxx';
+SELECT COUNT(*) FROM records_in_range_test WHERE c1 >= 'zzz' AND c1 <= 'zzz';
+
+SET DEBUG_DBUG = @save_dbug;
+
+DROP TABLE records_in_range_test;
diff --git a/mysql-test/suite/innodb/t/row_format_redundant.opt b/mysql-test/suite/innodb/t/row_format_redundant.opt
index c44c611e..d1d93da0 100644
--- a/mysql-test/suite/innodb/t/row_format_redundant.opt
+++ b/mysql-test/suite/innodb/t/row_format_redundant.opt
@@ -1 +1,3 @@
--innodb-checksum-algorithm=crc32
+--skip-innodb-fast-shutdown
+--skip-innodb-buffer-pool-dump-at-shutdown
diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
index dab9bcfa..24029a48 100644
--- a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
+++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
@@ -1,7 +1,7 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/innodb_page_size_small.inc
---source include/have_normal_bzip.inc
+--source include/have_normal_zlib.inc
call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
diff --git a/mysql-test/suite/innodb/t/scrub_debug.test b/mysql-test/suite/innodb/t/scrub_debug.test
index a1f0b38e..8cebfca6 100644
--- a/mysql-test/suite/innodb/t/scrub_debug.test
+++ b/mysql-test/suite/innodb/t/scrub_debug.test
@@ -10,7 +10,7 @@ SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;
let $MYSQLD_DATADIR=`select @@datadir`;
CREATE TABLE t1(f1 INT AUTO_INCREMENT PRIMARY KEY,
f2 VARCHAR(256) GENERATED ALWAYS as('repairman'),
- INDEX idx(f2))ENGINE= InnoDB;
+ INDEX idx(f2))ENGINE= InnoDB STATS_PERSISTENT=0;
INSERT INTO t1(f1) SELECT seq FROM seq_1_to_50;
FLUSH TABLE t1 FOR EXPORT;
let SEARCH_PATTERN= repairman;
diff --git a/mysql-test/suite/innodb/t/table_flags.opt b/mysql-test/suite/innodb/t/table_flags.opt
index bca67495..8f6c7db5 100644
--- a/mysql-test/suite/innodb/t/table_flags.opt
+++ b/mysql-test/suite/innodb/t/table_flags.opt
@@ -1,2 +1,3 @@
--innodb-checksum-algorithm=crc32
--skip-innodb-read-only-compressed
+--skip-innodb-buffer-pool-dump-at-shutdown
diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test
index 34204ae1..511d3c24 100644
--- a/mysql-test/suite/innodb/t/table_flags.test
+++ b/mysql-test/suite/innodb/t/table_flags.test
@@ -157,7 +157,9 @@ SHOW CREATE TABLE tr;
SHOW CREATE TABLE tc;
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM tc;
+--error ER_GET_ERRNO
SHOW CREATE TABLE td;
+--error ER_GET_ERRNO
SELECT * FROM td;
# This table was converted to NO_ROLLBACK due to the SYS_TABLES.TYPE change.
SHOW CREATE TABLE tz;
diff --git a/mysql-test/suite/innodb/t/tablespace_per_table_not_windows.opt b/mysql-test/suite/innodb/t/tablespace_per_table_not_windows.opt
new file mode 100644
index 00000000..66bceccc
--- /dev/null
+++ b/mysql-test/suite/innodb/t/tablespace_per_table_not_windows.opt
@@ -0,0 +1 @@
+--innodb-sys-tablespaces
diff --git a/mysql-test/suite/innodb/t/tablespace_per_table_not_windows.test b/mysql-test/suite/innodb/t/tablespace_per_table_not_windows.test
new file mode 100644
index 00000000..dc87e3fa
--- /dev/null
+++ b/mysql-test/suite/innodb/t/tablespace_per_table_not_windows.test
@@ -0,0 +1,162 @@
+--echo #
+--echo # Test the limits of a file-per-table tablespace name. MySQL combines
+--echo # the database name with the table name to make a unique table name.
+--echo #
+
+--source include/have_innodb.inc
+--source include/not_windows.inc
+# This will test the limit of a filename in MySQL at 512 bytes.
+# We control that by making it a relative path starting with "./".
+# The embedded server uses an absolute path as the datadir
+# which has a non-deterministic length.
+--source include/not_embedded.inc
+
+SET default_storage_engine=InnoDB;
+LET $MYSQLD_DATADIR = `select @@datadir`;
+
+--echo #
+--echo # MySQL limits each database and tablename identifier to 64 characters
+--echo # of up to 3 bytes per character, corresponding to 192 bytes.
+--echo #
+LET $too_long_name = this_sixty_five_byte_name_is_too_long____________________________;
+--error ER_WRONG_DB_NAME
+--eval CREATE DATABASE `$too_long_name`
+
+LET $long_name = this_sixty_four_byte_name_is_not_too_long_______________________;
+--eval CREATE DATABASE `$long_name`
+--eval USE `$long_name`
+
+--echo #
+--echo # A 64 character tablename can be created in a 64 character database name
+--echo #
+--eval CREATE TABLE `$long_name`.`$long_name` (a SERIAL)
+
+--echo #
+--echo # A 65 character tablename is too long.
+--echo #
+--error ER_WRONG_TABLE_NAME
+--eval CREATE TABLE `test`.`$too_long_name` (a SERIAL)
+--error ER_WRONG_TABLE_NAME
+--eval CREATE TABLE `$long_name`.`$too_long_name` (a SERIAL)
+
+--echo #
+--echo # Non-non-filename-safe characters like '#' are expanded to '@0023'.
+--echo # On many file systems, such as Linux extfs, you can create a database name
+--echo # that expands to up to 255 bytes long.
+--echo # `##################################################_long` is expanded to
+--echo # (50 * 5) + 5 = 255.
+--echo #
+LET $long_db_name = ##################################################_long;
+--eval CREATE DATABASE `$long_db_name`;
+--eval USE `$long_db_name`
+
+--echo #
+--echo # This 256-byte name is only one byte longer but fails with an error code
+--echo # from the stat operation.
+--echo # `##################################################_long_` is expanded to
+--echo # (50 * 5) + 6 = 256.
+--echo #
+--replace_regex /Errcode: [0-9]+/Errcode: ##/ /@0023/#/
+--error 13
+CREATE DATABASE `##################################################_long_`;
+
+--echo #
+--echo # This 300-byte name which is the longest name that gets an error code
+--echo # from the stat operation.
+--echo # `###########################################################_long` is expanded to
+--echo # (59 * 5) + 5 = 300.
+--echo #
+--replace_regex /Errcode: [0-9]+/Errcode: ##/ /@0023/#/
+--error 13
+CREATE DATABASE `###########################################################_long`;
+
+--echo #
+--echo # This 301-byte name which is only one byte longer but fails with ER_TOO_LONG_IDENT.
+--echo # `###########################################################_long_` is expanded to
+--echo # (59 * 5) + 6 = 301.
+--echo #
+--replace_result @0023 #
+--error ER_WRONG_DB_NAME
+CREATE DATABASE `###########################################################_long_`;
+
+USE test;
+
+LET $long_249_byte_table_name = #################################################long;
+LET $long_250_byte_table_name = #################################################_long;
+LET $long_251_byte_table_name = #################################################_long_;
+LET $long_252_byte_table_name = #################################################_long___;
+
+--echo #
+--echo # An expanded table name is limited to 251 bytes
+--echo #
+--eval CREATE TABLE `test`.`$long_251_byte_table_name` (a SERIAL)
+
+--echo #
+--echo # A 252-byte tablename is too long
+--echo #
+--replace_regex /errno: [0-9]+/errno: ##/ /@0023/#/
+--error ER_CANT_CREATE_TABLE
+--eval CREATE TABLE `test`.`$long_252_byte_table_name` (a SERIAL)
+
+CREATE DATABASE twenty_byte_db_name_;
+USE `twenty_byte_db_name_`;
+
+--echo #
+--echo # A 251 byte expanded table name will fit with a longer database name
+--echo #
+--eval CREATE TABLE `twenty_byte_db_name_`.`$long_251_byte_table_name` (a SERIAL)
+
+--echo #
+--echo # A 252 byte expanded table name is also too long in a longer database name
+--echo #
+--replace_regex /errno: [0-9]+/errno: ##/ /@0023/#/
+--error ER_CANT_CREATE_TABLE
+--eval CREATE TABLE `twenty_byte_db_name_`.`$long_252_byte_table_name` (a SERIAL)
+
+--echo #
+--echo # Another limitation is a 512 byte length to an expanded path that includes
+--echo # the datadir which is './' in this test, the expanded database name,
+--echo # the directory separator '/', the expanded table name, and the file extension.
+--echo # './long_db_name.long_250_byte_table_name.frm'
+--echo # 2+ 255 +1+ 250 +1+3 = 512
+--echo #
+--eval CREATE TABLE `$long_db_name`.`$long_250_byte_table_name` (a SERIAL)
+
+--error ER_IDENT_CAUSES_TOO_LONG_PATH
+--eval CREATE TABLE `$long_db_name`.`$long_251_byte_table_name` (a SERIAL)
+SHOW WARNINGS;
+
+--echo #
+--echo # Show the successfully created databases and tables
+--echo #
+--echo ---- list_files MYSQLD_DATADIR/test
+--replace_result @0023 #
+--list_files $MYSQLD_DATADIR/test
+--echo ---- list_files MYSQLD_DATADIR/$long_name
+--replace_result @0023 #
+--list_files $MYSQLD_DATADIR/$long_name
+--echo ---- list_files MYSQLD_DATADIR/$long_db_name
+--replace_result @0023 #
+--list_files $MYSQLD_DATADIR/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023_long
+
+--replace_result @0023 #
+SELECT name FROM information_schema.innodb_sys_tables WHERE name LIKE '%long%';
+--replace_result @0023 #
+SELECT name FROM information_schema.innodb_sys_tablespaces WHERE name LIKE '%long%';
+--vertical_results
+--replace_regex /innodb_file_per_table_[0-9]*/innodb_file_per_table_##/
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @0023 #
+SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%';
+--horizontal_results
+
+--echo #
+--echo # Cleanup
+--echo #
+
+--eval DROP TABLE `$long_name`.`$long_name`
+--eval DROP TABLE `test`.`$long_251_byte_table_name`
+--eval DROP TABLE `twenty_byte_db_name_`.`$long_251_byte_table_name`
+--eval DROP TABLE `$long_db_name`.`$long_250_byte_table_name`
+--eval DROP DATABASE `$long_name`
+--eval DROP DATABASE `$long_db_name`
+DROP DATABASE `twenty_byte_db_name_`;
diff --git a/mysql-test/suite/innodb/t/tablespace_per_table_windows.opt b/mysql-test/suite/innodb/t/tablespace_per_table_windows.opt
new file mode 100644
index 00000000..66bceccc
--- /dev/null
+++ b/mysql-test/suite/innodb/t/tablespace_per_table_windows.opt
@@ -0,0 +1 @@
+--innodb-sys-tablespaces
diff --git a/mysql-test/suite/innodb/t/tablespace_per_table_windows.test b/mysql-test/suite/innodb/t/tablespace_per_table_windows.test
new file mode 100644
index 00000000..eee7209c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/tablespace_per_table_windows.test
@@ -0,0 +1,77 @@
+--echo #
+--echo # Test the limits of a file-per-table tablespace name. MySQL combines
+--echo # the database name with the table name to make a unique table name.
+--echo #
+
+# There is no use in testing the maximum expanded filename using "#" or
+# some other character that is expanded by MySQL to "@0023" because
+# Windows imposes a maximum absolute path length of 260 bytes. So the
+# results will depend upon what local directory this test is run in.
+# See https://msdn.microsoft.com/en-us/library/aa365247.aspx
+# "Maximum Path Length Limitation
+# In the Windows API, the maximum length for a path is MAX_PATH, which is
+# defined as 260 characters. A local path is structured in the following
+# order: drive letter, colon, backslash, name components separated by
+# backslashes, and a terminating null character. For example, the maximum
+# path on drive D is "D:\some 256-character path string<NUL>" where
+# "<NUL>" represents the invisible terminating null character for the
+# current system codepage. (The characters < > are used here for visual
+# clarity and cannot be part of a valid path string.)"
+
+--source include/have_innodb.inc
+--source include/windows.inc
+# This will test the limit of a filename in MySQL at 512 bytes.
+# We control that by making it a relative path starting with "./".
+# The embedded server uses an absolute path as the datadir
+# which has a non-deterministic length.
+--source include/not_embedded.inc
+
+SET default_storage_engine=InnoDB;
+LET $MYSQLD_DATADIR = `select @@datadir`;
+
+--echo #
+--echo # MySQL limits each database and tablename identifier to 64 characters
+--echo # of up to 3 bytes per character, corresponding to 192 bytes.
+--echo #
+LET $too_long_name = this_sixty_five_byte_name_is_too_long____________________________;
+--error ER_WRONG_DB_NAME
+--eval CREATE DATABASE `$too_long_name`
+
+LET $long_name = this_sixty_four_byte_name_is_not_too_long_______________________;
+--eval CREATE DATABASE `$long_name`
+--eval USE `$long_name`
+
+--echo #
+--echo # A 64 character tablename can be created in a 64 character database name
+--echo #
+--eval CREATE TABLE `$long_name`.`$long_name` (a SERIAL)
+
+--echo #
+--echo # A 65 character tablename is too long.
+--echo #
+--error ER_WRONG_TABLE_NAME
+--eval CREATE TABLE `test`.`$too_long_name` (a SERIAL)
+--error ER_WRONG_TABLE_NAME
+--eval CREATE TABLE `$long_name`.`$too_long_name` (a SERIAL)
+
+--echo #
+--echo # Show the successfully created database and table
+--echo #
+--eval SHOW CREATE TABLE `$long_name`.`$long_name`
+
+--echo ---- list_files MYSQLD_DATADIR/$long_name
+--list_files $MYSQLD_DATADIR/$long_name
+
+SELECT name FROM information_schema.innodb_sys_tables WHERE name LIKE '%long%';
+SELECT name FROM information_schema.innodb_sys_tablespaces WHERE name LIKE '%long%';
+--vertical_results
+--replace_regex /innodb_file_per_table_[0-9]*/innodb_file_per_table_##/
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%';
+--horizontal_results
+
+--echo #
+--echo # Cleanup
+--echo #
+
+--eval DROP DATABASE `$long_name`
diff --git a/mysql-test/suite/innodb/t/truncate_crash.test b/mysql-test/suite/innodb/t/truncate_crash.test
index c5156b4b..8a11b1ed 100644
--- a/mysql-test/suite/innodb/t/truncate_crash.test
+++ b/mysql-test/suite/innodb/t/truncate_crash.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
FLUSH TABLES;
-CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 VALUES (1),(2);
connect (wait,localhost,root,,test);
diff --git a/mysql-test/suite/innodb/t/truncate_foreign.test b/mysql-test/suite/innodb/t/truncate_foreign.test
index abbe1b3d..c29c1410 100644
--- a/mysql-test/suite/innodb/t/truncate_foreign.test
+++ b/mysql-test/suite/innodb/t/truncate_foreign.test
@@ -89,16 +89,14 @@ call mtr.add_suppression("InnoDB: In ALTER TABLE `test`\\.`t1` has or is");
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
-ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a), ALGORITHM=COPY;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (a), ALGORITHM=COPY;
INSERT INTO t1 VALUES (1,1);
+CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB;
LOCK TABLES t1 WRITE;
SET FOREIGN_KEY_CHECKS=1;
--error ER_CANNOT_ADD_FOREIGN
TRUNCATE t1;
-# Whether TRUNCATE succeeds or fails, it will reload FOREIGN KEY constraints.
-# As a result, ha_innobase::referenced_by_foreign_key() will retun TRUE
-# (for the self-referential key), and the statement will fail.
---error ER_TABLE_NOT_LOCKED
+--error ER_NO_REFERENCED_ROW_2
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1;
UNLOCK TABLES;
@@ -107,6 +105,6 @@ INSERT INTO t1 VALUES (2,2);
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1;
-DROP TABLE t1;
+DROP TABLE t2, t1;
--echo # End of 10.6 tests
diff --git a/mysql-test/suite/innodb/t/trx_id_future.test b/mysql-test/suite/innodb/t/trx_id_future.test
index 1aeb1372..049e8f2c 100644
--- a/mysql-test/suite/innodb/t/trx_id_future.test
+++ b/mysql-test/suite/innodb/t/trx_id_future.test
@@ -8,7 +8,7 @@
let PAGE_SIZE=`select @@innodb_page_size`;
-CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
+CREATE TABLE t1(a INT) row_format=redundant engine=innoDB stats_persistent=0;
INSERT INTO t1 VALUES(1);
let MYSQLD_DATADIR=`select @@datadir`;
diff --git a/mysql-test/suite/innodb/t/undo_log.test b/mysql-test/suite/innodb/t/undo_log.test
index 2dbc9191..60da94c3 100644
--- a/mysql-test/suite/innodb/t/undo_log.test
+++ b/mysql-test/suite/innodb/t/undo_log.test
@@ -1,5 +1,8 @@
--source include/have_innodb.inc
+SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
+
SET innodb_strict_mode=OFF;
CREATE TABLE test_tab (
a_str_18 mediumtext,
@@ -151,3 +154,5 @@ ROLLBACK;
--source include/wait_all_purged.inc
DROP TABLE t1;
DROP TABLE t2;
+
+SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
diff --git a/mysql-test/suite/innodb/t/undo_space_dblwr.opt b/mysql-test/suite/innodb/t/undo_space_dblwr.opt
index 0b4f5917..f498dd1f 100644
--- a/mysql-test/suite/innodb/t/undo_space_dblwr.opt
+++ b/mysql-test/suite/innodb/t/undo_space_dblwr.opt
@@ -1,2 +1,3 @@
--innodb_undo_tablespaces=3
--innodb_sys_tablespaces
+--innodb-stats-persistent=0
diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result
index c6fc9dfa..b6319014 100644
--- a/mysql-test/suite/innodb_fts/r/crash_recovery.result
+++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result
@@ -33,7 +33,7 @@ connection default;
disconnect ddl1;
disconnect ddl2;
disconnect ddl3;
-InnoDB 0 transactions not purged
+SET GLOBAL innodb_max_purge_lag_wait=0;
CHECK TABLE t1,t2,t3;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/innodb_fts/r/foreign_key_check.result b/mysql-test/suite/innodb_fts/r/foreign_key_check.result
new file mode 100644
index 00000000..38f46d5f
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/foreign_key_check.result
@@ -0,0 +1,27 @@
+CREATE TABLE t1 (
+id INT NOT NULL,
+title TEXT,
+PRIMARY KEY (id),
+FULLTEXT KEY (title),
+FOREIGN KEY (id) REFERENCES t2 (id)
+) ENGINE=InnoDB;
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+CREATE TABLE t1 (
+id INT NOT NULL,
+title TEXT,
+PRIMARY KEY (id)
+) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FULLTEXT KEY (title), ADD FOREIGN KEY (id) REFERENCES t2 (id);
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+SET FOREIGN_KEY_CHECKS = 0;
+ALTER TABLE t1 ADD FULLTEXT KEY (title), ADD FOREIGN KEY (id) REFERENCES t2 (id);
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT NOT NULL,
+title TEXT,
+PRIMARY KEY (id),
+FULLTEXT KEY (title),
+FOREIGN KEY (id) REFERENCES t2 (id)
+) ENGINE=InnoDB;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/mysql-test/suite/innodb_fts/r/foreign_key_update.result b/mysql-test/suite/innodb_fts/r/foreign_key_update.result
new file mode 100644
index 00000000..f2d47da7
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/foreign_key_update.result
@@ -0,0 +1,34 @@
+CREATE TABLE t1 (
+a varchar(40),
+KEY a(a)
+) ENGINE=InnoDB;
+CREATE TABLE t1_fk (
+a varchar(40),
+KEY a(a),
+FULLTEXT KEY (a),
+CONSTRAINT fk FOREIGN KEY (a) REFERENCES t1 (a) ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('mysql');
+INSERT INTO t1_fk VALUES('mysql');
+INSERT INTO t1_fk VALUES('mysql');
+SELECT * FROM t1_fk;
+a
+mysql
+mysql
+SELECT * FROM t1_fk WHERE MATCH(a) AGAINST('mysql');
+a
+mysql
+mysql
+UPDATE t1 SET a = 'database' WHERE a = 'mysql';
+SELECT * FROM t1_fk;
+a
+database
+database
+SELECT * FROM t1_fk WHERE MATCH(a) AGAINST('mysql');
+a
+SELECT * FROM t1_fk WHERE MATCH(a) AGAINST('database');
+a
+database
+database
+DROP TABLE t1_fk;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result b/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result
index 2dbdd5a0..74d60410 100644
--- a/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result
+++ b/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result
@@ -20,8 +20,6 @@ END//
CALL populate_t1;
SET autocommit=1;
SET SESSION debug="+d,fts_instrument_result_cache_limit";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
ALTER TABLE t1 ADD FULLTEXT INDEX `text_content_idx` (`text_content`);
SELECT FTS_DOC_ID, text_content
FROM t1
diff --git a/mysql-test/suite/innodb_fts/r/index_table.result b/mysql-test/suite/innodb_fts/r/index_table.result
new file mode 100644
index 00000000..570e367a
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/index_table.result
@@ -0,0 +1,265 @@
+SET @optimize=@@GLOBAL.INNODB_OPTIMIZE_FULLTEXT_ONLY;
+SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+content TEXT
+) ENGINE= InnoDB;
+CREATE FULLTEXT INDEX idx ON articles (title, content);
+INSERT INTO articles (title, content) VALUES
+('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','How to use full-text search engine'),
+('Go MySQL Tricks','How to use full text search engine');
+SET @aux=@@GLOBAL.innodb_ft_aux_table;
+SET GLOBAL innodb_ft_aux_table='test/articles';
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+1001 4 4 1 4 0
+after 2 2 1 2 22
+database 1 1 1 1 37
+dbms 1 1 1 1 15
+engine 4 5 2 4 46
+engine 4 5 2 5 44
+full 4 5 2 4 29
+full 4 5 2 5 27
+mysql 1 5 5 1 0
+mysql 1 5 5 1 31
+mysql 1 5 5 2 11
+mysql 1 5 5 3 11
+mysql 1 5 5 4 5
+mysql 1 5 5 5 3
+optimizing 3 3 1 3 0
+search 4 5 2 4 39
+search 4 5 2 5 37
+show 3 3 1 3 42
+stands 1 1 1 1 20
+text 4 5 2 4 34
+text 4 5 2 5 32
+through 2 2 1 2 37
+tricks 4 5 2 4 11
+tricks 4 5 2 5 9
+tutorial 1 3 2 1 6
+tutorial 1 3 2 3 25
+use 2 5 3 2 7
+use 2 5 3 4 25
+use 2 5 3 5 23
+well 2 2 1 2 17
+went 2 2 1 2 32
+you 2 2 1 2 28
+OPTIMIZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles optimize status OK
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+1001 4 4 1 4 0
+after 2 2 1 2 22
+database 1 1 1 1 37
+dbms 1 1 1 1 15
+engine 4 5 2 4 46
+engine 4 5 2 5 44
+full 4 5 2 4 29
+full 4 5 2 5 27
+mysql 1 5 5 1 0
+mysql 1 5 5 1 31
+mysql 1 5 5 2 11
+mysql 1 5 5 3 11
+mysql 1 5 5 4 5
+mysql 1 5 5 5 3
+optimizing 3 3 1 3 0
+search 4 5 2 4 39
+search 4 5 2 5 37
+show 3 3 1 3 42
+stands 1 1 1 1 20
+text 4 5 2 4 34
+text 4 5 2 5 32
+through 2 2 1 2 37
+tricks 4 5 2 4 11
+tricks 4 5 2 5 9
+tutorial 1 3 2 1 6
+tutorial 1 3 2 3 25
+use 2 5 3 2 7
+use 2 5 3 4 25
+use 2 5 3 5 23
+well 2 2 1 2 17
+went 2 2 1 2 32
+you 2 2 1 2 28
+SET @save_dbug=@@debug_dbug;
+SET debug_dbug='+d,fts_instrument_result_cache_limit';
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+1001 4 4 1 4 0
+after 2 2 1 2 22
+database 1 1 1 1 37
+dbms 1 1 1 1 15
+engine 4 5 2 4 46
+engine 4 5 2 5 44
+full 4 5 2 4 29
+full 4 5 2 5 27
+mysql 1 5 5 1 0
+mysql 1 5 5 1 31
+mysql 1 5 5 2 11
+mysql 1 5 5 3 11
+mysql 1 5 5 4 5
+mysql 1 5 5 5 3
+optimizing 3 3 1 3 0
+search 4 5 2 4 39
+search 4 5 2 5 37
+show 3 3 1 3 42
+stands 1 1 1 1 20
+text 4 5 2 4 34
+text 4 5 2 5 32
+through 2 2 1 2 37
+tricks 4 5 2 4 11
+tricks 4 5 2 5 9
+tutorial 1 3 2 1 6
+tutorial 1 3 2 3 25
+use 2 5 3 2 7
+use 2 5 3 4 25
+use 2 5 3 5 23
+well 2 2 1 2 17
+went 2 2 1 2 32
+you 2 2 1 2 28
+SET debug_dbug=@save_dbug;
+DROP TABLE articles;
+SET GLOBAL innodb_ft_result_cache_limit=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+content TEXT
+) ENGINE= InnoDB;
+CREATE FULLTEXT INDEX idx_t ON articles (title);
+CREATE FULLTEXT INDEX idx_c ON articles (content);
+INSERT INTO articles (title, content) VALUES
+('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','How to use full-text search engine'),
+('Go MySQL Tricks','How to use full text search engine');
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+SET GLOBAL innodb_ft_aux_table='test/articles';
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+1001 4 4 1 4 0
+mysql 1 5 5 1 0
+mysql 1 5 5 2 11
+mysql 1 5 5 3 11
+mysql 1 5 5 4 5
+mysql 1 5 5 5 3
+optimizing 3 3 1 3 0
+tricks 4 5 2 4 11
+tricks 4 5 2 5 9
+tutorial 1 1 1 1 6
+use 2 2 1 2 7
+well 2 2 1 2 17
+after 2 2 1 2 0
+database 1 1 1 1 22
+dbms 1 1 1 1 0
+engine 4 5 2 4 28
+engine 4 5 2 5 28
+full 4 5 2 4 11
+full 4 5 2 5 11
+mysql 1 1 1 1 16
+search 4 5 2 4 21
+search 4 5 2 5 21
+show 3 3 1 3 25
+stands 1 1 1 1 5
+text 4 5 2 4 16
+text 4 5 2 5 16
+through 2 2 1 2 15
+tutorial 3 3 1 3 8
+use 4 5 2 4 7
+use 4 5 2 5 7
+went 2 2 1 2 10
+you 2 2 1 2 6
+OPTIMIZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles optimize status OK
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+1001 4 4 1 4 0
+mysql 1 5 5 1 0
+mysql 1 5 5 2 11
+mysql 1 5 5 3 11
+mysql 1 5 5 4 5
+mysql 1 5 5 5 3
+optimizing 3 3 1 3 0
+tricks 4 5 2 4 11
+tricks 4 5 2 5 9
+tutorial 1 1 1 1 6
+use 2 2 1 2 7
+well 2 2 1 2 17
+after 2 2 1 2 0
+database 1 1 1 1 22
+dbms 1 1 1 1 0
+engine 4 5 2 4 28
+engine 4 5 2 5 28
+full 4 5 2 4 11
+full 4 5 2 5 11
+mysql 1 1 1 1 16
+search 4 5 2 4 21
+search 4 5 2 5 21
+show 3 3 1 3 25
+stands 1 1 1 1 5
+text 4 5 2 4 16
+text 4 5 2 5 16
+through 2 2 1 2 15
+tutorial 3 3 1 3 8
+use 4 5 2 4 7
+use 4 5 2 5 7
+went 2 2 1 2 10
+you 2 2 1 2 6
+DROP TABLE articles;
+SET NAMES utf8;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200)
+) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+CREATE FULLTEXT INDEX idx ON articles (title);
+INSERT INTO articles (title) VALUES
+('相亲相爱'),('怜香惜爱'),('充满可爱'),('爱恨交织');
+SET GLOBAL innodb_ft_aux_table="test/articles";
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+充满可爱 3 3 1 3 0
+怜香惜爱 2 2 1 2 0
+爱恨交织 4 4 1 4 0
+相亲相爱 1 1 1 1 0
+OPTIMIZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles optimize status OK
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+充满可爱 3 3 1 3 0
+怜香惜爱 2 2 1 2 0
+爱恨交织 4 4 1 4 0
+相亲相爱 1 1 1 1 0
+DROP TABLE articles;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200)
+) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
+CREATE FULLTEXT INDEX idx ON articles (title);
+INSERT INTO articles (title) VALUES
+('相亲相爱'),('怜香惜爱'),('充满可爱'),('爱恨交织');
+SET GLOBAL innodb_ft_aux_table="test/articles";
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+爱恨交织 4 4 1 4 0
+充满可爱 3 3 1 3 0
+怜香惜爱 2 2 1 2 0
+相亲相爱 1 1 1 1 0
+OPTIMIZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles optimize status OK
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+怜香惜爱 2 2 1 2 0
+充满可爱 3 3 1 3 0
+相亲相爱 1 1 1 1 0
+爱恨交织 4 4 1 4 0
+DROP TABLE articles;
+SET GLOBAL innodb_ft_aux_table=@aux;
+SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=@optimize;
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result
index d67981e0..a53fca51 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result
@@ -134,6 +134,7 @@ count(*)
2
DROP TABLE t1;
set global innodb_file_per_table=1;
+set names utf8;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
a TEXT,
@@ -160,7 +161,7 @@ SELECT count(*) FROM t1
WHERE MATCH (a,b,c)
AGAINST ('"very blob"@4' IN BOOLEAN MODE);
count(*)
-4
+5
SELECT count(*) FROM t1
WHERE MATCH (a,b,c)
AGAINST ('"interesting blob"@9' IN BOOLEAN MODE);
@@ -175,7 +176,7 @@ SELECT COUNT(*) FROM t1
WHERE MATCH (a,b,c)
AGAINST ('"very blob"@4 - "interesting blob"@9' IN BOOLEAN MODE);
COUNT(*)
-3
+4
DROP TABLE t1;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
diff --git a/mysql-test/suite/innodb_fts/r/limit_union.result b/mysql-test/suite/innodb_fts/r/limit_union.result
new file mode 100644
index 00000000..843d55d2
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/limit_union.result
@@ -0,0 +1,157 @@
+# Bug #22709692 FTS QUERY EXCEEDS RESULT CACHE LIMIT
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body),
+FULLTEXT (body))ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SET @default_cache_size = @@GLOBAL.query_cache_size;
+SET GLOBAL query_cache_size=0;
+# Query involves Ranking
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE) LIMIT 1;
+id title body
+6 MySQL Security When configured properly, MySQL ...
+# Without optimization
+SET @save_dbug = @@debug_dbug;
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE) LIMIT 1;
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SET debug_dbug = @save_dbug;
+# Query involves No Ranking and fts_union operations
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN BOOLEAN MODE) limit 1;
+id title body
+6 MySQL Security When configured properly, MySQL ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN BOOLEAN MODE) limit 1;
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SET debug_dbug = @save_dbug;
+# Query involves No ranking and fts_union, fts_ignore
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL -YourSQL' IN BOOLEAN MODE) limit 1;
+id title body
+6 MySQL Security When configured properly, MySQL ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL -YourSQL' IN BOOLEAN MODE) limit 1;
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SET debug_dbug = @save_dbug;
+# Query with fts_intersect
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL +YourSQL' IN BOOLEAN MODE) limit 1;
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL +YourSQL' IN BOOLEAN MODE) limit 1;
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SET debug_dbug = @save_dbug;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','request doc@oraclehelp.com ...'),
+('MySQL Tutorial','request support@oraclehelp.com ...'),
+('Trial version','query performace @1255 minute on 2.1Hz
+ Memory 2GB...'),
+('when To Use MySQL Well','for free faq mail@xyz.com ...');
+# Query with @distance
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"MySQL request"@3' IN BOOLEAN MODE) limit 1;
+id title body
+7 MySQL Tutorial request doc@oraclehelp.com ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"MySQL request"@3' IN BOOLEAN MODE) limit 1;
+id title body
+7 MySQL Tutorial request doc@oraclehelp.com ...
+SET debug_dbug = @save_dbug;
+# Query with subexpression
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('+MySQL +(-support +doc)' IN BOOLEAN MODE) limit 1;
+id title body
+7 MySQL Tutorial request doc@oraclehelp.com ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('+MySQL +(-support +doc)' IN BOOLEAN MODE) limit 1;
+id title body
+7 MySQL Tutorial request doc@oraclehelp.com ...
+SET debug_dbug = @save_dbug;
+# limit num1 OFFSET num2
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' in boolean mode) limit 4 offset 2;
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' in boolean mode) limit 4 offset 2;
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SET debug_dbug = @save_dbug;
+# wild card search
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('ru*' IN BOOLEAN MODE) limit 1;
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('ru*' IN BOOLEAN MODE) limit 1;
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SET debug_dbug = @save_dbug;
+# phrase search
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"request support"' IN BOOLEAN MODE) limit 1;
+id title body
+8 MySQL Tutorial request support@oraclehelp.com ...
+# Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"request support"' IN BOOLEAN MODE) limit 1;
+id title body
+8 MySQL Tutorial request support@oraclehelp.com ...
+SET debug_dbug = @save_dbug;
+DROP TABLE articles;
+SET GLOBAL query_cache_size = @default_cache_size;
diff --git a/mysql-test/suite/innodb_fts/r/misc.result b/mysql-test/suite/innodb_fts/r/misc.result
new file mode 100644
index 00000000..684996fb
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/misc.result
@@ -0,0 +1,1878 @@
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `a` varchar(200) DEFAULT NULL,
+ `b` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+id
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+id
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+id
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+INSERT INTO t1 (a,b) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id
+8
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+id
+8
+9
+10
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+id
+8
+9
+10
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id
+10
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE);
+id
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+SELECT id FROM t1 WHERE id = (SELECT MAX(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+id
+3
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+id
+1
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+id
+1
+3
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+) OR t1.id = 3 ;
+id
+1
+3
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2
+WHERE MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t2.id != 3) ;
+id
+1
+SELECT id FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE
+MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+id
+1
+3
+SELECT id FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1
+WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ;
+id
+2
+3
+4
+5
+6
+SELECT id FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+id
+1
+3
+SELECT id FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+id
+2
+4
+5
+6
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT ,
+FULLTEXT (a,b)
+) ENGINE = InnoDB;
+INSERT INTO t1(a,b) VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST("+support +collections" IN BOOLEAN MODE));
+id
+3
+SELECT id FROM t1 WHERE t1.id != (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST("+search" IN BOOLEAN MODE));
+id
+2
+3
+4
+5
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ("+call* +coll*" IN BOOLEAN MODE));
+id
+2
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE) AND t2.id=t1.id);
+id
+1
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+INSERT INTO t1 (a,b) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+id
+7
+SELECT id FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+id
+8
+9
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+id
+7
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"proximity search"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+id
+7
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@3' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+id
+9
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+id
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('support') ;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(10) unsigned NOT NULL DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT id FROM t2;
+id
+1
+3
+DROP TABLE t2;
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST("+support +collections" IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(10) unsigned NOT NULL DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT id FROM t2;
+id
+3
+DROP TABLE t2;
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('"proximity search"@10' IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(10) unsigned NOT NULL DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT id FROM t2;
+id
+7
+8
+9
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...');
+INSERT INTO t1 (a,b) VALUES
+('when To Use MySQL Well','After that you went through a ...');
+INSERT INTO t1 (a,b) VALUES
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL null...');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+106
+SELECT COUNT(*) FROM t1 WHERE a IS NULL;
+COUNT(*)
+100
+SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL;
+COUNT(*)
+6
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+103
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST (NULL IN NATURAL LANGUAGE MODE);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST (NULL WITH QUERY EXPANSION);
+id
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('null' IN NATURAL LANGUAGE MODE);
+id
+106
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id
+106
+1
+52
+103
+104
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NOT NULL OR b IS NOT NULL);
+id
+106
+1
+52
+103
+104
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NULL AND b IS NOT NULL);
+id
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id
+1
+106
+SELECT COUNT(*) FROM t1
+WHERE MATCH (a,b)
+AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+6
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"following database"@10' IN BOOLEAN MODE);
+id
+105
+DROP TABLE t1;
+drop table if exists t50;
+set names utf8;
+"----------Test1---------"
+create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb;
+create fulltext index i on t50 (s1);
+insert into t50 values ('ABCDE'),('FGHIJ'),('KLMNO'),('VÐƷWİ');
+select * from t50 where match(s1) against ('VÐƷWİ');
+s1
+VÐƷWİ
+drop table t50;
+"----------Test2---------"
+create table t50 (s1 int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÐƷWİ'),('ABCDE');
+select * from t50 order by s2;
+s1 s2
+4 ABCDE
+1 FGHIJ
+2 KLMNO
+3 VÐƷWİ
+drop table t50;
+"----------Test3---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÐƷWİ'),('ABCDE');
+set @@autocommit=0;
+update t50 set s2 = lower(s2);
+update t50 set s2 = upper(s2);
+commit;
+select * from t50 where match(s2) against ('VÐƷWİ FGHIJ KLMNO ABCDE' in boolean mode);
+id s2
+1 FGHIJ
+2 KLMNO
+3 VÐƷWI
+4 ABCDE
+select * from t50;
+id s2
+1 FGHIJ
+2 KLMNO
+3 VÐƷWI
+4 ABCDE
+drop table t50;
+set @@autocommit=1;
+"----------Test4---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÐƷWİ'),('ABCD*');
+select * from t50 where match(s2) against ('abcd*' in natural language
+mode);
+id s2
+4 ABCD*
+select * from t50 where match(s2) against ('abcd*' in boolean mode);
+id s2
+4 ABCD*
+drop table t50;
+"----------Test5---------"
+create table t50 (s1 int, s2 varchar(200), fulltext key(s2)) engine = innodb;
+set @@autocommit=0;
+insert into t50 values (1,'Sunshine'),(2,'Lollipops');
+select * from t50 where match(s2) against('Rainbows');
+s1 s2
+rollback;
+select * from t50;
+s1 s2
+drop table t50;
+set @@autocommit=1;
+"----------Test6---------"
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('aab` MySQL Tutorial','DBMS stands for DataBase ...') ,
+('aas How To Use MySQL Well','After you went through a ...'),
+('aac Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t1 (a,b) VALUES
+('aac 1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('aab MySQL vs. YourSQL','In the following database comparison ...'),
+('aaa MySQL Security','When configured properly, MySQL ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aac') DESC;
+id a b
+3 aac Optimizing MySQL In this tutorial we will show ...
+4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+1 aab` MySQL Tutorial DBMS stands for DataBase ...
+2 aas How To Use MySQL Well After you went through a ...
+5 aab MySQL vs. YourSQL In the following database comparison ...
+6 aaa MySQL Security When configured properly, MySQL ...
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aab') DESC;
+id a b
+1 aab` MySQL Tutorial DBMS stands for DataBase ...
+5 aab MySQL vs. YourSQL In the following database comparison ...
+2 aas How To Use MySQL Well After you went through a ...
+3 aac Optimizing MySQL In this tutorial we will show ...
+4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+6 aaa MySQL Security When configured properly, MySQL ...
+"----------Test7---------"
+select * from t1 where match(a,b) against ('aaa')
+union select * from t1 where match(a,b) against ('aab')
+union select * from t1 where match(a,b) against ('aac');
+id a b
+6 aaa MySQL Security When configured properly, MySQL ...
+1 aab` MySQL Tutorial DBMS stands for DataBase ...
+5 aab MySQL vs. YourSQL In the following database comparison ...
+3 aac Optimizing MySQL In this tutorial we will show ...
+4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+select * from t1 where match(a,b) against ('aaa')
+or match(a,b) against ('aab')
+or match(a,b) against ('aac');
+id a b
+1 aab` MySQL Tutorial DBMS stands for DataBase ...
+3 aac Optimizing MySQL In this tutorial we will show ...
+4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 aab MySQL vs. YourSQL In the following database comparison ...
+6 aaa MySQL Security When configured properly, MySQL ...
+DROP TABLE t1;
+"----------Test8---------"
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ... abcd') ,
+('How To Use MySQL Well','After you went through a q ...abdd'),
+('Optimizing MySQL','In this tutorial we will show ...abed');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `a` varchar(200) DEFAULT NULL,
+ `b` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. q ...'),
+('MySQL vs. YourSQL use','In the following database comparison ...'),
+('MySQL Security','When run configured properly, MySQL ...');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+id a b
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. q ...
+6 MySQL Security When run configured properly, MySQL ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use');
+id a b
+2 How To Use MySQL Well After you went through a q ...abdd
+5 MySQL vs. YourSQL use In the following database comparison ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went');
+id a b
+2 How To Use MySQL Well After you went through a q ...abdd
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run') AND NOT MATCH(a,b) AGAINST ('q');
+id a b
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. q ...
+6 MySQL Security When run configured properly, MySQL ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use') AND NOT MATCH(a,b) AGAINST ('q');
+id a b
+2 How To Use MySQL Well After you went through a q ...abdd
+5 MySQL vs. YourSQL use In the following database comparison ...
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went') AND NOT MATCH(a,b) AGAINST ('q');
+id a b
+2 How To Use MySQL Well After you went through a q ...abdd
+"----------Test9---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SET @x = (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+SELECT @x, @x2;
+@x @x2
+7 0
+DROP TABLE t2;
+"----------Test10---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t2;
+"----------Test11---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE = MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+ALTER TABLE t2 ENGINE=InnoDB;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+id a b
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. q ...
+6 MySQL Security When run configured properly, MySQL ...
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t2,t1;
+"----------Test13---------"
+set names utf8;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_SPANISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+INSERT INTO t1 VALUES (1,'aaCen'),(2,'aaCha'),(3,'aaCio'),(4,'aaçen'),(5,'aaçha'),(6,'aaçio');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aach*' IN BOOLEAN MODE);
+s1 s2
+2 aaCha
+5 aaçha
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aaC*' IN BOOLEAN MODE);
+s1 s2
+1 aaCen
+2 aaCha
+3 aaCio
+4 aaçen
+5 aaçha
+6 aaçio
+DROP TABLE t1;
+"----------Test14---------"
+CREATE TABLE t1(s1 INT , s2 VARCHAR(100) CHARACTER SET sjis) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+INSERT INTO t1 VALUES (1,'ペペペ'),(2,'テテテ'),(3,'ルルル'),(4,'グググ');
+DROP TABLE t1;
+"----------Test15---------"
+CREATE TABLE t1 (s1 VARCHAR (60) CHARACTER SET UTF8 COLLATE UTF8_UNICODE_520_CI) ENGINE = MyISAM;
+CREATE FULLTEXT INDEX i ON t1 (s1);
+INSERT INTO t1 VALUES
+('a'),('b'),('c'),('d'),('ŁŁŁŁ'),('LLLL'),(NULL),('ŁŁŁŁ ŁŁŁŁ'),('LLLLLLLL');
+SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+s1
+ŁŁŁŁ
+LLLL
+ŁŁŁŁ ŁŁŁŁ
+DROP TABLE if EXISTS t2;
+Warnings:
+Note 1051 Unknown table 'test.t2'
+CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t2 ( s1);
+INSERT INTO t2 VALUES
+('a'),('b'),('c'),('d'),('ŁŁŁŁ'),('LLLL'),(NULL),('ŁŁŁŁ ŁŁŁŁ'),('LLLLLLLL');
+SELECT * FROM t2 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+s1
+LLLL
+DROP TABLE t1,t2;
+"----------Test16---------"
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(50) CHARACTER SET UTF8) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1(s2);
+INSERT INTO t1 VALUES (2, 'ğė Daśi p ');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('+p +"ğė Daśi*"' IN BOOLEAN MODE);
+s1 s2
+DROP TABLE t1;
+"----------Test19---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'İóëɠ');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('"İóëɠ"' IN BOOLEAN MODE);
+id char_column
+1 İóëɠ
+DROP TABLE t1;
+"----------Test20---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_column2 VARCHAR(60) character set utf8) ENGINE = InnoDB;
+INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu');
+UPDATE t1 SET char_column2 = char_column;
+CREATE FULLTEXT INDEX i ON t1 (char_column2);
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
+ERROR HY000: Can't find FULLTEXT index matching the column list
+DROP TABLE t1;
+"----------Test22---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'aaa'),(2,'bbb'),(3,'ccc');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+HANDLER t1 OPEN;
+HANDLER t1 READ i = ('aaa');
+ERROR HY000: FULLTEXT index `i` does not support this operation
+DROP TABLE t1;
+"----------Test25---------"
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_CROATIAN_CI) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'LJin'),(2,'ljin'),(3,'lmin'),(4,'LJLJLJLJLJ');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+SELECT count(*) FROM t1 WHERE MATCH (char_column) AGAINST ('lj*' IN BOOLEAN MODE);
+count(*)
+3
+DROP TABLE t1;
+"----------Test27---------"
+CREATE TABLE t1 (id INT,char_column VARCHAR(60)) ENGINE=InnoDB;
+SET @@autocommit=0;
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+INSERT INTO t1 values (1,'aaa');
+"restart server..."
+# Restart the server
+--source include/restart_mysqld.inc
+DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb')
+SET @@autocommit=1;
+DROP TABLE t1;
+"----------Test28---------"
+drop table if exists `fts_test`;
+Warnings:
+Note 1051 Unknown table 'test.fts_test'
+create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
+set session autocommit=0;
+insert into `fts_test` values ('');
+savepoint `b`;
+savepoint `b`;
+set session autocommit=1;
+DROP TABLE fts_test;
+"----------Test29---------"
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+start transaction;
+INSERT INTO articles (title,body) VALUES
+('How To Use MySQL Well','After you went through a ...');
+savepoint `a1`;
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+savepoint `a2`;
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+savepoint `a3`;
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+savepoint `a4`;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+rollback to savepoint a3;
+select title, body from articles;
+title body
+MySQL Tutorial DBMS stands for DataBase ...
+How To Use MySQL Well After you went through a ...
+Optimizing MySQL In this tutorial we will show ...
+1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+savepoint `a5`;
+select title, body from articles;
+title body
+MySQL Tutorial DBMS stands for DataBase ...
+How To Use MySQL Well After you went through a ...
+Optimizing MySQL In this tutorial we will show ...
+1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+MySQL Security When configured properly, MySQL ...
+rollback to savepoint a2;
+select title, body from articles;
+title body
+MySQL Tutorial DBMS stands for DataBase ...
+How To Use MySQL Well After you went through a ...
+Optimizing MySQL In this tutorial we will show ...
+commit;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+DROP TABLE articles;
+"----------Test30---------"
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...');
+start transaction;
+INSERT INTO articles (title,body) VALUES
+('How To Use MySQL Well','After you went through a ...');
+savepoint `a1`;
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+savepoint `a2`;
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+savepoint `a3`;
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+savepoint `a4`;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+rollback to savepoint a3;
+select title, body from articles;
+title body
+MySQL Tutorial DBMS stands for DataBase ...
+How To Use MySQL Well After you went through a ...
+Optimizing MySQL In this tutorial we will show ...
+1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+savepoint `a5`;
+select title, body from articles;
+title body
+MySQL Tutorial DBMS stands for DataBase ...
+How To Use MySQL Well After you went through a ...
+Optimizing MySQL In this tutorial we will show ...
+1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+MySQL Security When configured properly, MySQL ...
+rollback to savepoint a2;
+select title, body from articles;
+title body
+MySQL Tutorial DBMS stands for DataBase ...
+How To Use MySQL Well After you went through a ...
+Optimizing MySQL In this tutorial we will show ...
+rollback;
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+DROP TABLE articles;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+ANALYZE TABLE articles;
+SELECT *, MATCH(title, body) AGAINST ('-database +MySQL' IN BOOLEAN MODE) AS score from articles;
+id title body score
+1 MySQL Tutorial DBMS stands for DataBase ... 0
+2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
+3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186
+5 MySQL vs. YourSQL In the following database comparison ... 0
+6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372
+SELECT *, MATCH(title, body) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score FROM articles;
+id title body score
+1 MySQL Tutorial DBMS stands for DataBase ... 0
+2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
+3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186
+5 MySQL vs. YourSQL In the following database comparison ... 0
+6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (database - tutorial)' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database)' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database) -Tricks' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles where MATCH(title, body) AGAINST ('-Tricks MySQL - (- tutorial database)' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+DROP TABLE articles;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key,
+title varchar(200),body text,fulltext(title,body)) engine=innodb;
+insert into t1 set body='test';
+select * from t1 where match(title,body) against('%test');
+FTS_DOC_ID title body
+1 NULL test
+select * from t1 where match(title,body) against('%');
+FTS_DOC_ID title body
+select * from t1 where match(title,body) against('%%%%');
+FTS_DOC_ID title body
+drop table t1;
+CREATE DATABASE `benu database`;
+USE `benu database`;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `a` varchar(200) DEFAULT NULL,
+ `b` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+DROP DATABASE `benu database`;
+USE test;
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`), fulltext key (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+Warnings:
+Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release
+ALTER TABLE `t21` ADD UNIQUE INDEX (`b`), ALGORITHM=INPLACE;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY
+ALTER TABLE `t21` ADD UNIQUE INDEX (`b`);
+DROP TABLE t21;
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`)) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+ALTER TABLE `t21` ADD UNIQUE INDEX (`b`);
+DROP TABLE t21;
+CREATE TABLE t1 (
+id INT NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+ALTER TABLE t1 ADD UNIQUE INDEX (`id`);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id x
+1 0
+2 0
+3 0
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD UNIQUE INDEX (`id`), ADD FULLTEXT INDEX idx (a,b);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+ALTER TABLE t1 ADD UNIQUE INDEX (`FTS_DOC_ID`);
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID
+1
+3
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+FTS_DOC_ID x
+1 0
+2 0
+3 0
+DROP TABLE t1;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+(1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+(2, 'How To Use MySQL Well','After you went through a ...'),
+(3, 'Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b), ADD UNIQUE INDEX FTS_DOC_ID_INDEX (FTS_DOC_ID);
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+FTS_DOC_ID
+1
+3
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+FTS_DOC_ID
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+FTS_DOC_ID x
+1 0
+2 0
+3 0
+DROP TABLE t1;
+CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB
+DEFAULT CHARSET=LATIN1;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO `t2` VALUES();
+COMMIT WORK AND CHAIN;
+INSERT INTO `t3` VALUES ();
+UPDATE `t2` SET `b` = 'a';
+SAVEPOINT BATCH1;
+DROP TABLE t2;
+DROP TABLE t3;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+COMMIT WORK AND CHAIN;
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SAVEPOINT BATCH1;
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id
+1
+2
+3
+INSERT INTO t1 (a,b) VALUES
+('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+ROLLBACK TO SAVEPOINT BATCH1;
+COMMIT;
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id
+6
+1
+2
+3
+4
+5
+DROP TABLE t1;
+CREATE TABLE `t` (`a` char(20) character set utf8 default null,
+fulltext key (`a`)) ENGINE=INNODB;
+INSERT INTO `t` VALUES ('a');
+INSERT INTO `t` VALUES ('aaa');
+SELECT MATCH(`a`) AGAINST (0x22dd22) FROM `t`;
+MATCH(`a`) AGAINST (0x22dd22)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x2222) FROM `t`;
+MATCH(`a`) AGAINST (0x2222)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x22) FROM `t`;
+MATCH(`a`) AGAINST (0x22)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x2261616122) FROM `t`;
+MATCH(`a`) AGAINST (0x2261616122)
+0
+0.0906190574169159
+SELECT MATCH(`a`) AGAINST (0x2261dd6122) FROM `t`;
+MATCH(`a`) AGAINST (0x2261dd6122)
+0
+0
+SELECT MATCH(`a`) AGAINST (0x2261dd612222226122) FROM `t`;
+MATCH(`a`) AGAINST (0x2261dd612222226122)
+0
+0
+DROP TABLE t;
+CREATE TABLE t(a CHAR(1),FULLTEXT KEY(a)) ENGINE=INNODB;
+HANDLER t OPEN;
+HANDLER t READ a NEXT;
+a
+HANDLER t READ a PREV;
+a
+DROP TABLE t;
+CREATE TABLE `%`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+CREATE TABLE `A B`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+DROP TABLE `%`;
+DROP TABLE `A B`;
+CREATE TABLE `t-26`(a VARCHAR(10),FULLTEXT KEY(a)) ENGINE=INNODB;
+INSERT INTO `t-26` VALUES('117');
+DROP TABLE `t-26`;
+CREATE TABLE `t1` (
+`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+`content` TEXT NOT NULL,
+PRIMARY KEY (`id`),
+FULLTEXT INDEX `IDX_CONTEXT_FULLTEXT`(`content`)
+)
+ENGINE = InnoDB;
+insert into t1 (content)
+values
+('This is a story which has has a complicated phrase structure here in the
+middle'),
+('This is a story which doesn''t have that text'),
+('This is a story that has complicated the phrase structure');
+select * from t1
+where match(content) against('"complicated phrase structure"' in boolean
+mode);
+id content
+1 This is a story which has has a complicated phrase structure here in the
+middle
+select * from t1
+where match(content) against('+"complicated phrase structure"' in boolean
+mode);
+id content
+1 This is a story which has has a complicated phrase structure here in the
+middle
+select * from t1
+where match(content) against('"complicated the phrase structure"' in boolean
+mode);
+id content
+3 This is a story that has complicated the phrase structure
+select * from t1 where match(content) against('+"this is a story which" +"complicated the phrase structure"' in boolean mode);
+id content
+select * from t1 where match(content) against('"the complicated the phrase structure"' in boolean mode);
+id content
+3 This is a story that has complicated the phrase structure
+select * from t1 where match(content) against('"complicated a phrase structure"' in boolean mode);
+id content
+DROP TABLE t1;
+CREATE TABLE my (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+c VARCHAR(32), FULLTEXT(c)) ENGINE = INNODB;
+INSERT INTO my (c) VALUES ('green-iguana');
+SELECT * FROM my WHERE MATCH(c) AGAINST ('green-iguana');
+id c
+1 green-iguana
+DROP TABLE my;
+CREATE TABLE ift (
+`a` int(11) NOT NULL,
+`b` text,
+PRIMARY KEY (`a`),
+FULLTEXT KEY `b` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO ift values (1, "skip");
+INSERT INTO ift values (2, "skip and networking");
+INSERT INTO ift values (3, "--skip-networking");
+INSERT INTO ift values (4, "-donot--skip-networking");
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('--skip-networking');
+a b
+2 skip and networking
+3 --skip-networking
+4 -donot--skip-networking
+1 skip
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('skip-networking');
+a b
+2 skip and networking
+3 --skip-networking
+4 -donot--skip-networking
+1 skip
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('----');
+a b
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('-donot--skip-networking');
+a b
+4 -donot--skip-networking
+2 skip and networking
+3 --skip-networking
+1 skip
+DROP TABLE ift;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('( that''s me )','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('( yours''s* )' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('s*' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('stands\'] | * | show[@database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+5 MySQL vs. YourSQL In the following database comparison ...
+DROP TABLE articles;
+CREATE TABLE t1(a TEXT CHARACTER SET LATIN1, FULLTEXT INDEX(a)) ENGINE=INNODB;
+SELECT * FROM t1 WHERE MATCH(a) AGAINST("*");
+ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*'
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+FULLTEXT (a)
+) ENGINE= InnoDB;
+INSERT INTO t1 (a) VALUES
+('Do you know MySQL is a good database'),
+('How to build a good database'),
+('Do you know'),
+('Do you know MySQL'),
+('How to use MySQL'),
+('Do you feel good'),
+('MySQL is good'),
+('MySQL is good to know'),
+('What is database');
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know mysql"' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+4 Do you know MySQL
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql")' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+4 Do you know MySQL
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('("know mysql" good)' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+4 Do you know MySQL
+2 How to build a good database
+6 Do you feel good
+7 MySQL is good
+8 MySQL is good to know
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql" good)' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+4 Do you know MySQL
+2 How to build a good database
+6 Do you feel good
+7 MySQL is good
+8 MySQL is good to know
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('(good "know mysql")' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+4 Do you know MySQL
+2 How to build a good database
+6 Do you feel good
+7 MySQL is good
+8 MySQL is good to know
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+(good "know mysql")' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+4 Do you know MySQL
+2 How to build a good database
+6 Do you feel good
+7 MySQL is good
+8 MySQL is good to know
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql" "good database")' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+2 How to build a good database
+4 Do you know MySQL
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know mysql" +"good database"' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know database"@4' IN BOOLEAN MODE);
+id a
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know database"@8' IN BOOLEAN MODE);
+id a
+1 Do you know MySQL is a good database
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+FULLTEXT (a)
+) ENGINE= InnoDB;
+INSERT INTO t1 (a) VALUES
+('know mysql good database');
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"good database"' IN BOOLEAN MODE);
+id a
+1 know mysql good database
+DROP TABLE t1;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES ('Test Article','blah blah
+blah'),("Matt's Noise",'this is noisy'),('February Weather','It was terrible
+this year.'),('Peter Pan','Tis a kids story.'),('Test1','nada'),('Database
+database database','foo database database database'),('Database article
+title','body with lots of words.'),('myfulltext database', 'my test fulltext
+database');
+SELECT id, title, body FROM articles ORDER BY MATCH (title,body) AGAINST ('database' IN BOOLEAN MODE) DESC;
+id title body
+6 Database
+database database foo database database database
+8 myfulltext database my test fulltext
+database
+7 Database article
+title body with lots of words.
+1 Test Article blah blah
+blah
+2 Matt's Noise this is noisy
+3 February Weather It was terrible
+this year.
+4 Peter Pan Tis a kids story.
+5 Test1 nada
+DELETE from articles WHERE title like "myfulltext database";
+INSERT INTO articles (title,body) VALUES ('myfulltext database', 'my test fulltext database');
+SELECT id, title, body FROM articles ORDER BY MATCH (title,body) AGAINST ('database' IN BOOLEAN MODE) DESC;
+id title body
+6 Database
+database database foo database database database
+9 myfulltext database my test fulltext database
+7 Database article
+title body with lots of words.
+1 Test Article blah blah
+blah
+2 Matt's Noise this is noisy
+3 February Weather It was terrible
+this year.
+4 Peter Pan Tis a kids story.
+5 Test1 nada
+DELETE from articles WHERE title like "myfulltext database";
+INSERT INTO articles (title,body) VALUES ('myfulltext database', 'my test fulltext database');
+SELECT id, title, body FROM articles ORDER BY MATCH (title,body) AGAINST ('database' IN BOOLEAN MODE) DESC;
+id title body
+6 Database
+database database foo database database database
+10 myfulltext database my test fulltext database
+7 Database article
+title body with lots of words.
+1 Test Article blah blah
+blah
+2 Matt's Noise this is noisy
+3 February Weather It was terrible
+this year.
+4 Peter Pan Tis a kids story.
+5 Test1 nada
+DROP TABLE articles;
+CREATE TABLE t1(
+a TEXT CHARSET ujis COLLATE ujis_japanese_ci,
+b TEXT CHARSET utf8mb4 COLLATE utf8mb4_turkish_ci,
+c TEXT CHARSET eucjpms COLLATE eucjpms_bin,
+d TEXT CHARSET utf8mb4,
+FULLTEXT INDEX(a),
+FULLTEXT INDEX(b),
+FULLTEXT INDEX(c),
+FULLTEXT INDEX(d)
+) ENGINE = InnoDB;
+INSERT INTO t1 VALUES
+('myisam', 'myisam', 'myisam', 'myisam'),
+('innodb', 'innodb', 'innodb', 'innodb'),
+('innodb myisam', 'innodb myisam', 'innodb myisam', 'innodb myisam'),
+('memory', 'memory', 'memory', 'memory'),
+('archive', 'archive', 'archive', 'archive'),
+('federated', 'federated', 'federated', 'federated'),
+('storage engine innodb', 'storage engine innodb', 'storage engine innodb', 'storage engine innodb'),
+('storage engine myisam', 'storage engine myisam', 'storage engine myisam', 'storage engine myisam'),
+('innobase', 'innobase', 'innobase', 'innobase'),
+('myisam innodb', 'myisam innodb', 'myisam innodb', 'myisam innodb'),
+('innodb myisam engines', 'innodb myisam engines', 'innodb myisam engines', 'innodb myisam engines');
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', ' ', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '&', 0x00, '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '&', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '%', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+a
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+a
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+a
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"'));
+a
+innodb myisam
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', '(', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', ')'));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm'));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm', '"'));
+a
+innodb myisam
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected FTS_TERM, expecting FTS_NUMB
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', '"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', ' ', '"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 0x00, '"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', '&', 0x00, '"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 0x00, '&', '"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', '%', '"'));
+b
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+b
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+b
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+b
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+b
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+b
+innodb myisam
+myisam innodb
+innodb myisam engines
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+b
+innodb myisam
+myisam innodb
+innodb myisam engines
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected FTS_TERM, expecting FTS_NUMB
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', '"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', ' ', '"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, '"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', '&', 0x00, '"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, '&', '"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', '%', '"'));
+c
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+c
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+c
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+c
+innodb
+innodb myisam
+storage engine innodb
+myisam innodb
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+c
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+c
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"'));
+c
+innodb myisam
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', '(', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', ')'));
+c
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm'));
+c
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm', '"'));
+c
+innodb myisam
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+c
+innodb myisam
+myisam innodb
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+c
+innodb myisam
+myisam innodb
+innodb myisam engines
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected FTS_TERM, expecting FTS_NUMB
+ALTER TABLE t1 ENGINE = MyISAM;
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', ' ', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '&', 0x00, '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '&', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '%', '"'));
+a
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+a
+innodb
+innodb myisam
+myisam innodb
+storage engine innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+a
+innodb
+innodb myisam
+myisam innodb
+storage engine innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+a
+innodb
+innodb myisam
+myisam innodb
+storage engine innodb
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"'));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', '(', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', ')'));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm'));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm', '"'));
+a
+innodb myisam
+myisam innodb
+innodb myisam engines
+myisam
+innodb
+storage engine innodb
+storage engine myisam
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+a
+innodb myisam
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+a
+innodb myisam
+innodb myisam engines
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+a
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+FULLTEXT (a)
+) ENGINE= InnoDB;
+INSERT INTO t1 (a) VALUES
+('know database'),('good database'), ('gmail email'), ('ghome windows');
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g *' IN NATURAL LANGUAGE MODE);
+id a
+2 good database
+3 gmail email
+4 ghome windows
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+3 gmail email
+4 ghome windows
+2 good database
+1 know database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * k *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+1 know database
+3 gmail email
+4 ghome windows
+2 good database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * k * d *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+1 know database
+3 gmail email
+4 ghome windows
+2 good database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * go *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+2 good database
+3 gmail email
+4 ghome windows
+1 know database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * good' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+2 good database
+3 gmail email
+4 ghome windows
+1 know database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('gm * go *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+3 gmail email
+2 good database
+1 know database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('good *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+2 good database
+1 know database
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g* database' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+id a
+1 know database
+2 good database
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/misc_1.result b/mysql-test/suite/innodb_fts/r/misc_1.result
new file mode 100644
index 00000000..69a234fb
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/misc_1.result
@@ -0,0 +1,922 @@
+set names utf8;
+call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
+call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`t1`");
+CREATE TABLE t1 (
+id1 INT ,
+a1 VARCHAR(200) ,
+b1 TEXT ,
+FULLTEXT KEY (a1,b1), PRIMARY KEY (a1, id1)
+) CHARACTER SET = utf8 , ENGINE = InnoDB;
+CREATE TABLE t2 (
+id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a2 VARCHAR(200),
+b2 TEXT ,
+FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+FULLTEXT KEY (b2,a2)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(1,'MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+(2,'How To Use MySQL Well','After you went through a ...'),
+(3,'Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t1 (id1,a1,b1) VALUES
+(4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(5,'MySQL vs. YourSQL','In the following database comparison ...'),
+(6,'MySQL Security','When configured properly, MySQL ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t2 (a2,b2) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
+DELETE FROM t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1'
+test.t1 analyze status OK
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Warning Engine-independent statistics are not collected for column 'b2'
+test.t2 analyze status OK
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
+id1
+1
+3
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
+id2
+1
+3
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
+id1
+1
+2
+3
+4
+5
+6
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
+id2
+1
+2
+3
+4
+5
+6
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
+id1
+1
+2
+3
+4
+5
+6
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
+id2
+1
+2
+3
+4
+5
+6
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id1
+1
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id2
+1
+set global innodb_optimize_fulltext_only=1;
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+set global innodb_optimize_fulltext_only=0;
+UPDATE t1 SET a1 = "changing column - on update cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+id1
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+id2
+3
+6
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id1;
+id1
+1
+2
+3
+4
+5
+6
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id2;
+id2
+1
+2
+3
+4
+5
+6
+SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
+id2
+1
+2
+3
+4
+5
+6
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on update cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on delete cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1 where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on delete set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1 where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+fulltext key(s2),
+foreign key (s1,s2) references t1 (s1,s2) on update set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+create table t1 (s1 bigint unsigned not null, s2 varchar(200),
+primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL, s2 varchar(200),
+foreign key (FTS_DOC_ID) references t1 (s1)
+on update cascade) ENGINE = InnoDB;
+create fulltext index idx on t2(s2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `FTS_DOC_ID` bigint(20) unsigned NOT NULL,
+ `s2` varchar(200) DEFAULT NULL,
+ KEY `FTS_DOC_ID` (`FTS_DOC_ID`),
+ FULLTEXT KEY `idx` (`s2`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s1 = 3 where s1=1;
+select * from t2 where match(s2) against ('sunshine');
+FTS_DOC_ID s2
+3 Sunshine
+update t1 set s1 = 1 where s1=3;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (
+id1 INT ,
+a1 VARCHAR(200) PRIMARY KEY,
+b1 TEXT character set utf8 ,
+FULLTEXT KEY (a1,b1)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+CREATE TABLE t2 (
+id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a2 VARCHAR(200),
+b2 TEXT character set utf8 ,
+FOREIGN KEY (a2) REFERENCES t1(a1) ON DELETE CASCADE,
+FULLTEXT KEY (b2,a2)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(1,'MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+(2,'How To Use MySQL Well','After you went through a ...'),
+(3,'Optimizing MySQL','In this tutorial we will show ...'),
+(4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(5,'MySQL vs. YourSQL','In the following database comparison ...'),
+(6,'MySQL Security','When configured properly, MySQL ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+DELETE FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+id1 a1 b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+id2 a2 b2
+SELECT * FROM t1 WHERE a1 LIKE '%tutorial%';
+id1 a1 b1
+SELECT * FROM t2 WHERE a2 LIKE '%tutorial%';
+id2 a2 b2
+DROP TABLE t2 , t1;
+call mtr.add_suppression("\\[ERROR\\] InnoDB: FTS Doc ID must be larger than 3 for table `test`.`t2`");
+CREATE TABLE t1 (
+id1 INT ,
+a1 VARCHAR(200) ,
+b1 TEXT ,
+FULLTEXT KEY (a1,b1), PRIMARY KEY(a1, id1)
+) CHARACTER SET = utf8 , ENGINE = InnoDB;
+CREATE TABLE t2 (
+id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a2 VARCHAR(200),
+b2 TEXT ,
+FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+FULLTEXT KEY (b2,a2)
+) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(1,'MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+(2,'How To Use MySQL Well','After you went through a ...'),
+(3,'Optimizing MySQL','In this tutorial we will show ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+START TRANSACTION;
+INSERT INTO t1 (id1,a1,b1) VALUES
+(4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+(5,'MySQL vs. YourSQL','In the following database comparison ...'),
+(6,'MySQL Security','When configured properly, MySQL ...');
+INSERT INTO t2 (a2,b2) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+INSERT INTO t2 (a2,b2) VALUES
+('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
+DELETE FROM t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE)
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
+id1 a1 b1
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
+id2 a2 b2
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
+id1 a1 b1
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
+id2 a2 b2
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
+id1 a1 b1
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
+id2 a2 b2
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id1 a1 b1
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+id2 a2 b2
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root') ;
+id1 a1 b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root') ;
+id2 a2 b2
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('mysqld (+root)' IN BOOLEAN MODE) ;
+id1 a1 b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('mysqld (-root)' IN BOOLEAN MODE) ;
+id2 a2 b2
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root' WITH QUERY EXPANSION) ;
+id1 a1 b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root' WITH QUERY EXPANSION) ;
+id2 a2 b2
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
+id1 a1 b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
+id2 a2 b2
+SELECT * FROM t1 ORDER BY id1;
+id1 a1 b1
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM t2 ORDER BY id2;
+id2 a2 b2
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+COMMIT;
+START TRANSACTION;
+UPDATE t1 SET a1 = "changing column - on UPDATE cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+COMMIT;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+id1 a1 b1
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+id2 a2 b2
+3 changing column - on UPDATE cascade In this tutorial we will show ...
+6 changing column - on UPDATE cascade When configured properly, MySQL ...
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id1;
+id1 a1 b1
+1 changing column - on UPDATE cascade to check foreign constraint
+2 changing column - on UPDATE cascade to check foreign constraint
+3 changing column - on UPDATE cascade to check foreign constraint
+4 changing column - on UPDATE cascade to check foreign constraint
+5 changing column - on UPDATE cascade to check foreign constraint
+6 changing column - on UPDATE cascade to check foreign constraint
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id2;
+id2 a2 b2
+1 changing column - on UPDATE cascade DBMS stands for DataBase VÐƷWİ...
+2 changing column - on UPDATE cascade After you went through a ...
+3 changing column - on UPDATE cascade In this tutorial we will show ...
+4 changing column - on UPDATE cascade 1. Never run mysqld as root. 2. ...
+5 changing column - on UPDATE cascade In the following database comparison ...
+6 changing column - on UPDATE cascade When configured properly, MySQL ...
+SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
+id2 a2 b2
+1 changing column - on UPDATE cascade DBMS stands for DataBase VÐƷWİ...
+2 changing column - on UPDATE cascade After you went through a ...
+3 changing column - on UPDATE cascade In this tutorial we will show ...
+4 changing column - on UPDATE cascade 1. Never run mysqld as root. 2. ...
+5 changing column - on UPDATE cascade In the following database comparison ...
+6 changing column - on UPDATE cascade When configured properly, MySQL ...
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+FULLTEXT KEY(s2),
+FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+s1 s2
+DROP TABLE t2 , t1;
+set global innodb_file_per_table=1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = utf8, ROW_FORMAT=COMPRESSED, ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `a` varchar(200) DEFAULT NULL,
+ `b` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=COMPRESSED
+SELECT count(*) FROM information_schema.innodb_sys_tables WHERE name LIKE "%FTS_%" AND space !=0;
+count(*)
+11
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+ANALYZE TABLE t1;
+SELECT * FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+3 Optimizing MySQL In this tutorial we will show ...
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÐƷWİ" IN BOOLEAN MODE);
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+select * from t1 where MATCH(a,b) AGAINST("+-VÐƷWİ" IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected '-'
+select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
+id a b
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1 ORDER BY id;
+id a b x
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ... 0.6055193543434143
+2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
+3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186
+5 MySQL vs. YourSQL In the following database comparison ... 0.000000001885928302414186
+6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372
+select * from t1 where MATCH a,b AGAINST ("+database* +VÐƷW*" IN BOOLEAN MODE);
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
+id a b
+select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT * FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+3 Optimizing MySQL In this tutorial we will show ...
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÐƷWİ" IN BOOLEAN MODE);
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+select * from t1 where MATCH(a,b) AGAINST("+dbms" IN BOOLEAN MODE);
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
+id a b
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+select *, MATCH(a,b) AGAINST("mysql VÐƷWİ" IN BOOLEAN MODE) as x from t1 ORDER BY id;
+id a b x
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ... 0.6055193543434143
+2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
+3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186
+5 MySQL vs. YourSQL In the following database comparison ... 0.000000001885928302414186
+6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372
+select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
+id a b
+select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
+id a b
+1 MySQL Tutorial DBMS stands for DataBase VÐƷWİ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+INSERT INTO t1 (a,b) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test proximity fts search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO t1 (a,b) VALUES
+('test more proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id a b
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE) ORDER BY id;
+id a b
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test proximity fts search, test, proximity and phrase search, with proximity innodb
+10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"test proximity"@5' IN BOOLEAN MODE) ORDER BY id;
+id a b
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test proximity fts search, test, proximity and phrase search, with proximity innodb
+10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id a b
+10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"more fts proximity"@03' IN BOOLEAN MODE);
+id a b
+10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb
+UPDATE t1 SET a = UPPER(a) , b = UPPER(b) ;
+UPDATE t1 SET a = UPPER(a) , b = LOWER(b) ;
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +dbms" IN BOOLEAN MODE);
+id a b
+1 MYSQL TUTORIAL dbms stands for database vðʒwi...
+select * from t1 where MATCH(a,b) AGAINST("+VÐƷWİ" IN BOOLEAN MODE);
+id a b
+1 MYSQL TUTORIAL dbms stands for database vðʒwi...
+SELECT * FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
+id a b
+1 MYSQL TUTORIAL dbms stands for database vðʒwi...
+3 OPTIMIZING MYSQL in this tutorial we will show ...
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"proximity search"@14' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id a b
+SELECT * FROM t1 ORDER BY id;
+id a b
+2 HOW TO USE MYSQL WELL after you went through a ...
+4 1001 MYSQL TRICKS 1. never run mysqld as root. 2. ...
+5 MYSQL VS. YOURSQL in the following database comparison ...
+6 MYSQL SECURITY when configured properly, mysql ...
+7 TEST QUERY EXPANSION for database ...
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) CHARACTER SET = utf8, ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('Я могу есть стекло', 'оно мне не вредит'),
+('Мога да ям стъкло', 'то не ми вреди'),
+('Μπορῶ νὰ φάω σπασμένα' ,'γυαλιὰ χωρὶς νὰ πάθω τίποτα'),
+('Příliš žluťoučký kůň', 'úpěl ďábelské kódy'),
+('Sævör grét', 'áðan því úlpan var ónýt'),
+('うゐのおくやま','けふこえて'),
+('いろはにほへど ちりぬる','あさきゆめみじ ゑひもせず');
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','request docteam@oraclehelp.com ...') ,
+('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...') ,
+('when To Use MySQL Well','for free faq mail@xyz.com ...');
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωρὶς") ORDER BY id;
+id a b
+1 Я могу есть стекло оно мне не вредит
+3 Μπορῶ νὰ φάω σπασμένα γυαλιὰ χωρὶς νὰ πάθω τίποτα
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("оно" WITH QUERY EXPANSION);
+id a b
+1 Я могу есть стекло оно мне не вредит
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE) ORDER BY id;
+id a b
+1 Я могу есть стекло оно мне не вредит
+2 Мога да ям стъкло то не ми вреди
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+γυαλιὰ +tutorial" IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+tutorial +(Мога τίποτα)" IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+id a b
+7 いろはにほへど ちりぬる あさきゆめみじ ゑひもせず
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("ちりぬる" WITH QUERY EXPANSION);
+id a b
+7 いろはにほへど ちりぬる あさきゆめみじ ゑひもせず
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("+あさきゆめみじ +ゑひもせず" IN BOOLEAN MODE);
+id a b
+7 いろはにほへど ちりぬる あさきゆめみじ ゑひもせず
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("うゐのおく*" IN BOOLEAN MODE);
+id a b
+6 うゐのおくやま けふこえて
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
+id a b
+5 Sævör grét áðan því úlpan var ónýt
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"γυαλιὰ χωρὶς"@2' IN BOOLEAN MODE);
+id a b
+3 Μπορῶ νὰ φάω σπασμένα γυαλιὰ χωρὶς νὰ πάθω τίποτα
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"query performace"@02' IN BOOLEAN MODE);
+id a b
+9 Trial version query performace @1255 minute on 2.1Hz Memory 2GB...
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"πάθω τίποτα"@2' IN BOOLEAN MODE);
+id a b
+3 Μπορῶ νὰ φάω σπασμένα γυαλιὰ χωρὶς νὰ πάθω τίποτα
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"あさきゆめみじ ゑひもせず"@1' IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"あさきゆめみじ ゑひもせず"@2' IN BOOLEAN MODE);
+id a b
+7 いろはにほへど ちりぬる あさきゆめみじ ゑひもせず
+ALTER TABLE t1 DROP INDEX idx;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+id a b
+7 いろはにほへど ちりぬる あさきゆめみじ ゑひもせず
+UPDATE t1 SET a = "Pchnąć w tę łódź jeża" , b = "lub osiem skrzyń fig" WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+UPDATE t1 SET a = "В чащах юга жил-был цитрус? Да", b = "но фальшивый экземпляр! ёъ" WHERE MATCH(a,b) AGAINST ("вред*" IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+id a b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("łódź osiem");
+id a b
+7 Pchnąć w tę łódź jeża lub osiem skrzyń fig
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE) ORDER BY id;
+id a b
+1 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
+2 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
+id a b
+SELECT * FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"łódź jeża"@2' IN BOOLEAN MODE);
+id a b
+7 Pchnąć w tę łódź jeża lub osiem skrzyń fig
+SELECT * FROM t1 ORDER BY id;
+id a b
+1 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
+2 В чащах юга жил-был цитрус? Да но фальшивый экземпляр! ёъ
+3 Μπορῶ νὰ φάω σπασμένα γυαλιὰ χωρὶς νὰ πάθω τίποτα
+4 Příliš žluťoučký kůň úpěl ďábelské kódy
+6 うゐのおくやま けふこえて
+7 Pchnąć w tę łódź jeża lub osiem skrzyń fig
+8 MySQL Tutorial request docteam@oraclehelp.com ...
+9 Trial version query performace @1255 minute on 2.1Hz Memory 2GB...
+10 when To Use MySQL Well for free faq mail@xyz.com ...
+DROP TABLE t1;
+CREATE TABLE t1(ID INT PRIMARY KEY,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+ID no_fts_field fts_field
+1 AAA BBB
+UPDATE t1 SET fts_field='anychange' where id = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+ID no_fts_field fts_field
+1 AAA anychange
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+ID no_fts_field fts_field
+1 anychange anychange
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+ID no_fts_field fts_field
+1 anychange other
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+ID no_fts_field fts_field
+DROP INDEX f on t1;
+UPDATE t1 SET fts_field='anychange' where id = 1;
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+CREATE FULLTEXT INDEX f ON t1(FTS_FIELD);
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+ID no_fts_field fts_field
+1 anychange other
+DROP TABLE t1;
+CREATE TABLE t1(`FTS_DOC_ID` serial,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+UPDATE t1 SET fts_field='anychange' where FTS_DOC_ID = 1;
+ERROR HY000: Invalid InnoDB FTS Doc ID
+UPDATE t1 SET fts_field='anychange', FTS_DOC_ID = 2 where FTS_DOC_ID = 1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+FTS_DOC_ID no_fts_field fts_field
+2 AAA anychange
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+FTS_DOC_ID no_fts_field fts_field
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+FTS_DOC_ID no_fts_field fts_field
+2 anychange anychange
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where FTS_DOC_ID = 2;
+ERROR HY000: Invalid InnoDB FTS Doc ID
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+FTS_DOC_ID no_fts_field fts_field
+UPDATE t1 SET FTS_DOC_ID = 1 where FTS_DOC_ID = 2;
+ERROR HY000: Invalid InnoDB FTS Doc ID
+DROP INDEX f ON t1;
+UPDATE t1 SET fts_field='newchange' where FTS_DOC_ID = 2;
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+SELECT * FROM t1;
+FTS_DOC_ID no_fts_field fts_field
+2 anychange newchange
+DROP TABLE t1;
+CREATE TABLE t1(ID INT PRIMARY KEY,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field), index k(fts_field)) ENGINE=INNODB;
+CREATE TABLE t2(ID INT PRIMARY KEY,
+no_fts_field VARCHAR(10),
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field),
+INDEX k2(fts_field),
+FOREIGN KEY(fts_field) REFERENCES
+t1(fts_field) ON UPDATE CASCADE) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+INSERT INTO t2 VALUES (1, 'AAA', 'BBB');
+update t1 set fts_field='newchange' where id =1;
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+ID no_fts_field fts_field
+SELECT * FROM t2 WHERE MATCH(fts_field) against("BBB");
+ID no_fts_field fts_field
+SELECT * FROM t1 WHERE MATCH(fts_field) against("newchange");
+ID no_fts_field fts_field
+1 AAA newchange
+SELECT * FROM t2 WHERE MATCH(fts_field) against("newchange");
+ID no_fts_field fts_field
+1 AAA newchange
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1(id INT PRIMARY KEY,
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY,
+fts_field VARCHAR(10),
+FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+INSERT INTO t1 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800'),(9,'900'),(10,'1000'),(11,'1100'),(12,'1200');
+INSERT INTO t2 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800');
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo');
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo') WHERE t1.fts_field = "100foo";
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'xoo'), t2.fts_field = CONCAT(t1.fts_field, 'xoo') where t1.fts_field=CONCAT(t2.fts_field, 'foo');
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foofoo");
+id fts_field
+1 100foofoo
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foo");
+id fts_field
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100");
+id fts_field
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400fooxoo");
+id fts_field
+4 400fooxoo
+SELECT * FROM t2 WHERE MATCH(fts_field) against("100");
+id fts_field
+1 100
+SELECT * FROM t2 WHERE MATCH(fts_field) against("200");
+id fts_field
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400");
+id fts_field
+DROP TABLE t1;
+DROP TABLE t2;
+
+BUG#13701973/64274: MYSQL THREAD WAS SUSPENDED WHEN EXECUTE UPDATE QUERY
+
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1 (
+t1_id INT(10) UNSIGNED NOT NULL,
+t2_id INT(10) UNSIGNED DEFAULT NULL,
+PRIMARY KEY (t1_id),
+FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+t1_id INT(10) UNSIGNED NOT NULL,
+t2_id INT(10) UNSIGNED NOT NULL,
+t3_id INT(10) UNSIGNED NOT NULL,
+t4_id INT(10) UNSIGNED NOT NULL,
+PRIMARY KEY (t2_id),
+FOREIGN KEY (t1_id) REFERENCES t1 (t1_id),
+FOREIGN KEY (t3_id) REFERENCES t3 (t3_id)
+ON DELETE CASCADE ON UPDATE CASCADE,
+FOREIGN KEY (t4_id) REFERENCES t4 (t4_id)
+) ENGINE=InnoDB;
+CREATE TABLE t3 (
+t3_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+payload char(3),
+PRIMARY KEY (t3_id)
+) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (1, '100');
+CREATE TABLE t4 (
+t2_id INT(10) UNSIGNED DEFAULT NULL,
+t4_id INT(10) UNSIGNED NOT NULL,
+PRIMARY KEY (t4_id),
+FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=1;
+UPDATE t3 SET payload='101' WHERE t3_id=1;
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
diff --git a/mysql-test/suite/innodb_fts/r/opt.result b/mysql-test/suite/innodb_fts/r/opt.result
new file mode 100644
index 00000000..57375495
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/opt.result
@@ -0,0 +1,1654 @@
+CREATE TABLE wp(
+FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+title VARCHAR(255) NOT NULL DEFAULT '',
+text MEDIUMTEXT NOT NULL,
+dummy INTEGER,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO wp (title, text) VALUES
+('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database to database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE TABLE t1 (i INTEGER);
+INSERT INTO t1 SELECT FTS_DOC_ID FROM wp;
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE wp;
+Table Op Msg_type Msg_text
+test.wp analyze status OK
+SELECT FTS_DOC_ID, title, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp;
+FTS_DOC_ID title score1 score2
+1 MySQL Tutorial 0.22764469683170319 0.000000003771856604828372
+2 How To Use MySQL Well 0 0.000000001885928302414186
+3 Optimizing MySQL 0 0.000000001885928302414186
+4 1001 MySQL Tricks 0 0.000000001885928302414186
+5 MySQL vs. YourSQL 0.45528939366340637 0.000000001885928302414186
+6 MySQL Security 0 0.000000003771856604828372
+No sorting for this query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+No sorting for this query even if MATCH is part of an expression
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database') > 0.1
+ORDER BY score DESC;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+No sorting even if there are several MATCH expressions as long as the
+right one is used in ORDER BY
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score1 DESC;
+title score1 score2
+MySQL vs. YourSQL 0.45528939366340637 0.000000001885928302414186
+MySQL Tutorial 0.22764469683170319 0.000000003771856604828372
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+No Sorting since FT table is first table in query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp, t1
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID = t1.i
+ORDER BY score DESC;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+Sorting since there is no WHERE clause
+FLUSH STATUS;
+SELECT MATCH(title, text) AGAINST ('database'), title AS score
+FROM wp
+ORDER BY score DESC;
+MATCH(title, text) AGAINST ('database') score
+0 1001 MySQL Tricks
+0 How To Use MySQL Well
+0 MySQL Security
+0 Optimizing MySQL
+0.22764469683170319 MySQL Tutorial
+0.45528939366340637 MySQL vs. YourSQL
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 6
+Sorting since ordering on multiple columns
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC, FTS_DOC_ID;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+Sorting since ordering is not descending
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score ASC;
+title score
+MySQL Tutorial 0.22764469683170319
+MySQL vs. YourSQL 0.45528939366340637
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+Sorting because one is ordering on a different MATCH expression
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('mysql') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title score
+MySQL Tutorial 0.000000003771856604828372
+MySQL vs. YourSQL 0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+No sorting for this query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+Revert to table scan and sorting for this query since not
+enough matching rows to satisfy LIMIT clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 14
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+Sorting since no LIMIT clause
+FLUSH STATUS;
+SELECT MATCH(title, text) AGAINST ('database') AS score, title
+FROM wp
+ORDER BY score DESC;
+score title
+0 1001 MySQL Tricks
+0 How To Use MySQL Well
+0 MySQL Security
+0 Optimizing MySQL
+0.22764469683170319 MySQL Tutorial
+0.45528939366340637 MySQL vs. YourSQL
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 6
+Sorting since there is a WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE dummy IS NULL
+ORDER BY score DESC LIMIT 2;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+Sorting since ordering is not on a simple MATCH expressions
+FLUSH STATUS;
+SELECT title, (MATCH(title, text) AGAINST ('database')) * 100 AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+title score
+MySQL vs. YourSQL 45.52893936634064
+MySQL Tutorial 22.76446968317032
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name Value
+Sort_rows 2
+No ordinary handler accesses when only accessing FTS_DOC_ID and MATCH
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+docid score
+5 0.45528939366340637
+1 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+Still no handler accesses when adding FTS_DOC_ID to WHERE clause
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID > 2;
+docid score
+5 0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+Still no handler accesses when ordering by MATCH expression
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score;
+docid score
+1 0.22764469683170319
+5 0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 3
+Optimization is disabled when ordering on FTS_DOC_ID
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY 1 DESC;
+docid score
+5 0.45528939366340637
+1 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+Optimization also work with several MATCH expressions
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+docid score1 score2
+5 0.45528939366340637 0.000000001885928302414186
+1 0.22764469683170319 0.000000003771856604828372
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+Optimization does not apply if sorting on a different MATCH expressions
+from the one used to access the
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score2 DESC;
+docid score1 score2
+1 0.22764469683170319 0.000000003771856604828372
+5 0.45528939366340637 0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 3
+FLUSH STATUS;
+Optimization does not apply for GROUP BY
+SET @save_mode = @@sql_mode;
+SET sql_mode = (select replace(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+GROUP BY score;
+FTS_DOC_ID score
+1 0.22764469683170319
+5 0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 3
+SET sql_mode = @save_mode;
+No sorting and no table access with LIMIT clause and only information
+from FTS result
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+docid score
+5 0.45528939366340637
+1 0.22764469683170319
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+If count optimization applies, EXPLAIN shows
+"Select tables optimized away."
+EXPLAIN SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+FLUSH STATUS;
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+Verify that there was no table access
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+Optimization applies also to COUNT(expr) as long as expr is not nullable
+EXPLAIN SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(title)
+2
+Optimization does not apply if not a single table query.
+EXPLAIN SELECT count(*)
+FROM wp, t1
+WHERE MATCH(title, text) AGAINST ('database');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6
+SELECT count(*)
+FROM wp, t1
+WHERE MATCH(title, text) AGAINST ('database');
+count(*)
+12
+Optimization does not apply if MATCH is part of an expression
+EXPLAIN SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+COUNT(title)
+2
+Optimization does not apply if MATCH is part of an expression
+EXPLAIN SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+COUNT(title)
+2
+Optimization does not apply if COUNT expression is nullable
+EXPLAIN SELECT COUNT(dummy)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+SELECT COUNT(dummy)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(dummy)
+0
+FLUSH STATUS;
+SELECT MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score,
+title
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+score title
+0.000000001885928302414186 1001 MySQL Tricks
+0.000000001885928302414186 How To Use MySQL Well
+0.000000003771856604828372 MySQL Security
+0.22764469683170319 Optimizing MySQL
+1.6663280725479126 MySQL Tutorial
+2.2718474864959717 MySQL vs. YourSQL
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 6
+Sort_scan 1
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+title score
+MySQL vs. YourSQL 2.2718474864959717
+MySQL Tutorial 1.6663280725479126
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+docid score
+5 2.2718474864959717
+1 1.6663280725479126
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+docid score
+5 2.2718474864959717
+1 1.6663280725479126
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+EXPLAIN SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+FLUSH STATUS;
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+6
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) score,
+title
+FROM wp
+WHERE MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE)
+ORDER BY score DESC;
+score title
+0.000000001885928302414186 1001 MySQL Tricks
+0.000000001885928302414186 How To Use MySQL Well
+0.000000001885928302414186 Optimizing MySQL
+0.000000003771856604828372 MySQL Security
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 4
+Sort_scan 1
+FLUSH STATUS;
+SELECT MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) score,
+title
+FROM wp
+ORDER BY score DESC;
+score title
+0 MySQL Tutorial
+0 MySQL vs. YourSQL
+0.000000001885928302414186 1001 MySQL Tricks
+0.000000001885928302414186 How To Use MySQL Well
+0.000000001885928302414186 Optimizing MySQL
+0.000000003771856604828372 MySQL Security
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 6
+Sort_scan 1
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('+MySQL -database');
+docid score
+5 0
+1 0
+6 0.000000003771856604828372
+2 0.000000001885928302414186
+3 0.000000001885928302414186
+4 0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+docid score
+6 0.000000003771856604828372
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 1
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+EXPLAIN SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+FLUSH STATUS;
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+COUNT(*)
+4
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title score
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+title score
+MySQL Tutorial 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5');
+docid score
+1 0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+docid score
+1 0.22764469683170319
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 1
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 1
+Sort_scan 1
+EXPLAIN SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+FLUSH STATUS;
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE);
+COUNT(*)
+1
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+SELECT title,
+MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC, title ASC;
+title score
+MySQL vs. YourSQL 0.45528939366340637
+MySQL Tutorial 0.22764469683170319
+1001 MySQL Tricks 0
+How To Use MySQL Well 0
+MySQL Security 0
+Optimizing MySQL 0
+SELECT title,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('MySQL database' WITH QUERY EXPANSION)
+ORDER BY score DESC, title ASC;
+title score
+MySQL Security 0.000000003771856604828372
+1001 MySQL Tricks 0.000000001885928302414186
+How To Use MySQL Well 0.000000001885928302414186
+Optimizing MySQL 0.000000001885928302414186
+MySQL Tutorial 0
+MySQL vs. YourSQL 0
+SELECT title,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC, title ASC;
+title score
+MySQL Tutorial 0
+ALTER TABLE wp ENGINE=myisam;
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title score
+MySQL vs. YourSQL 0.9562782645225525
+MySQL Tutorial 0.5756555199623108
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+title score
+MySQL vs. YourSQL 0.9562782645225525
+MySQL Tutorial 0.5756555199623108
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+docid score
+5 0.9562782645225525
+1 0.5756555199623108
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 3
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+docid score
+5 0.9562782645225525
+1 0.5756555199623108
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 2
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 14
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 1
+Sort_range 0
+Sort_rows 2
+Sort_scan 1
+EXPLAIN SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE wp fulltext idx idx 0 1 Using where
+FLUSH STATUS;
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 3
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+DROP TABLE wp, t1;
+CREATE TABLE t1
+(
+FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+title VARCHAR(255) DEFAULT '',
+text MEDIUMTEXT ,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY ft_idx (title,text)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 (title, text) VALUES
+('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL database','In the following database to database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...'),
+('InnoDB', 'InnoDB is a transaction-safe (ACID compliant) storage engine'),
+('MySQL is a database management system', 'A database is a structured collection of data...'),
+('MySQL databases are relational', 'A relational database stores data in separate tables rather than putting all the data in one big storeroom...'),
+('MySQL software is Open Source', 'Open Source means that it is possible for anyone to use and modify the software...'),
+('The MySQL Database Server is very fast, reliable, scalable, and easy to use', 'MySQL Server can run comfortably on a desktop or laptop...'),
+('MySQL Server works in client/server or embedded systems', 'The MySQL Database Software is a client/server system...'),
+('MyISAM', 'MyISAM is based on the older (and no longer available) ISAM storage engine but has many useful extensions'),
+('A large amount of contributed MySQL software is available', 'MySQL Server has a practical set of features developed in close cooperation with our users'),
+(NULL,NULL);
+ANALYZE TABLE t1;
+# No ranking
+EXPLAIN
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE);
+count(*)
+6
+EXPLAIN
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('data*' IN BOOLEAN MODE) ORDER BY title LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('data*' IN BOOLEAN MODE) ORDER BY title LIMIT 3;
+count(*)
+6
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+FTS_DOC_ID title
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION);
+FTS_DOC_ID title
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+12 MySQL Server works in client/server or embedded systems
+10 MySQL software is Open Source
+4 1001 MySQL Tricks
+14 A large amount of contributed MySQL software is available
+2 How To Use MySQL Well
+13 MyISAM
+5 MySQL vs. YourSQL database
+8 MySQL is a database management system
+1 MySQL Tutorial
+9 MySQL databases are relational
+6 MySQL Security
+3 Optimizing MySQL
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE);
+FTS_DOC_ID title
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+for' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+for' IN BOOLEAN MODE);
+FTS_DOC_ID
+# No sorting by rank
+EXPLAIN SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY title;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using filesort
+SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY title;
+FTS_DOC_ID TITLE
+9 MySQL databases are relational
+8 MySQL is a database management system
+12 MySQL Server works in client/server or embedded systems
+1 MySQL Tutorial
+5 MySQL vs. YourSQL database
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+FTS_DOC_ID
+11
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using filesort
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title;
+FTS_DOC_ID title
+4 1001 MySQL Tricks
+14 A large amount of contributed MySQL software is available
+2 How To Use MySQL Well
+13 MyISAM
+9 MySQL databases are relational
+8 MySQL is a database management system
+6 MySQL Security
+12 MySQL Server works in client/server or embedded systems
+10 MySQL software is Open Source
+1 MySQL Tutorial
+5 MySQL vs. YourSQL database
+3 Optimizing MySQL
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using filesort
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title;
+FTS_DOC_ID title
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+# LIMIT optimization
+EXPLAIN SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+LIMIT 3;
+FTS_DOC_ID TITLE
+11 The MySQL Database Server is very fast, reliable, scalable, and easy to use
+5 MySQL vs. YourSQL database
+8 MySQL is a database management system
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+LIMIT 3;
+FTS_DOC_ID
+11
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+ORDER BY title
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using filesort
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+ORDER BY title
+LIMIT 3;
+FTS_DOC_ID
+11
+EXPLAIN
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using filesort
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title LIMIT 1;
+FTS_DOC_ID
+4
+EXPLAIN
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using filesort
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title LIMIT 1;
+FTS_DOC_ID
+11
+EXPLAIN
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank, FTS_DOC_ID
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank, FTS_DOC_ID
+LIMIT 3;
+FTS_DOC_ID rank
+1 0.15835624933242798
+9 0.15835624933242798
+12 0.15835624933242798
+EXPLAIN
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank DESC, FTS_DOC_ID ASC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank DESC, FTS_DOC_ID ASC
+LIMIT 3;
+FTS_DOC_ID rank
+11 1.5415468215942383
+5 0.47506874799728394
+8 0.31671249866485596
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+FTS_DOC_ID rank
+5 0.47506874799728394
+8 0.31671249866485596
+EXPLAIN SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 3;
+FTS_DOC_ID rank
+11 1.5415468215942383
+5 0.47506874799728394
+8 0.31671249866485596
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE)
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC,
+FTS_DOC_ID ASC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE)
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC,
+FTS_DOC_ID ASC;
+FTS_DOC_ID rank
+5 0.47506874799728394
+8 0.31671249866485596
+1 0.15835624933242798
+9 0.15835624933242798
+11 0.15835624933242798
+12 0.15835624933242798
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) and FTS_DOC_ID > 1
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC
+LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext PRIMARY,FTS_DOC_ID_INDEX,ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) and FTS_DOC_ID > 1
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC
+LIMIT 2;
+FTS_DOC_ID rank
+5 0.47506874799728394
+8 0.31671249866485596
+EXPLAIN
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank
+LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank
+LIMIT 1;
+FTS_DOC_ID rank
+3 0.009391550906002522
+EXPLAIN
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank DESC
+LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank DESC
+LIMIT 1;
+FTS_DOC_ID rank
+11 15.345823287963867
+EXPLAIN
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) DESC
+LIMIT 1;
+FTS_DOC_ID rank
+11 15.345823287963867
+# WHERE optimization on MATCH > 'some_rank'
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) > 0.1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) > 0.1;
+FTS_DOC_ID
+11
+5
+8
+1
+9
+12
+# additional test for correct behaviour
+EXPLAIN SELECT * FROM t1 ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) AND
+MATCH (title, text) AGAINST ('mysql' IN NATURAL LANGUAGE MODE)
+LIMIT 6;
+FTS_DOC_ID
+11
+5
+8
+1
+9
+12
+# test OR condition
+SELECT FTS_DOC_ID
+FROM t1
+WHERE MATCH(title, text) AGAINST ('database')
+OR MATCH(title, text) AGAINST ('mysql')
+ORDER BY MATCH(title, text) AGAINST ('database') DESC, FTS_DOC_ID ASC;
+FTS_DOC_ID
+5
+8
+1
+9
+11
+12
+2
+3
+4
+6
+10
+14
+EXPLAIN SELECT FTS_DOC_ID
+FROM t1
+WHERE MATCH(title, text) AGAINST ('database')
+OR MATCH(title, text) AGAINST ('mysql')
+ORDER BY MATCH(title, text) AGAINST ('database') DESC, FTS_DOC_ID ASC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using where; Using temporary; Using filesort
+# MATCH and GROUP BY, DISTINCT
+SET sql_mode = (select replace(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY FTS_DOC_ID
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY FTS_DOC_ID
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+FTS_DOC_ID
+11
+5
+8
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY title
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY title
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+FTS_DOC_ID
+11
+5
+8
+EXPLAIN SELECT MAX(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where
+SELECT MAX(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+MAX(FTS_DOC_ID)
+12
+EXPLAIN SELECT DISTINCT(title) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT DISTINCT(title) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+title
+The MySQL Database Server is very fast, reliable, scalable, and easy to use
+MySQL vs. YourSQL database
+MySQL is a database management system
+EXPLAIN SELECT DISTINCT(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext ft_idx ft_idx 0 1 Using where; Using temporary; Using filesort
+SELECT DISTINCT(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+FTS_DOC_ID
+11
+5
+8
+SET sql_mode = @save_mode;
+# FTS index access
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+FTS_DOC_ID rank
+5 0.47506874799728394
+8 0.31671249866485596
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
+SELECT a.FTS_DOC_ID, b.FTS_DOC_ID
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+MATCH(b.title, b.text) AGAINST ('+mysql' IN BOOLEAN MODE) and
+a.FTS_DOC_ID = b.FTS_DOC_ID;
+FTS_DOC_ID FTS_DOC_ID
+5 5
+8 8
+1 1
+9 9
+11 11
+12 12
+EXPLAIN SELECT a.FTS_DOC_ID, b.FTS_DOC_ID
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+MATCH(b.title, b.text) AGAINST ('+mysql' IN BOOLEAN MODE) and
+a.FTS_DOC_ID = b.FTS_DOC_ID;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE a fulltext PRIMARY,FTS_DOC_ID_INDEX,ft_idx ft_idx 0 1 Using where
+1 SIMPLE b eq_ref PRIMARY,FTS_DOC_ID_INDEX,ft_idx PRIMARY 8 test.a.FTS_DOC_ID 1 Using where
+SELECT a.FTS_DOC_ID, MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE),
+b.FTS_DOC_ID, MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE)
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE);
+FTS_DOC_ID MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) FTS_DOC_ID MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE)
+5 0.47506874799728394 5 0.47506874799728394
+5 0.47506874799728394 8 0.31671249866485596
+5 0.47506874799728394 1 0.15835624933242798
+5 0.47506874799728394 9 0.15835624933242798
+5 0.47506874799728394 11 0.15835624933242798
+5 0.47506874799728394 12 0.15835624933242798
+8 0.31671249866485596 5 0.47506874799728394
+8 0.31671249866485596 8 0.31671249866485596
+8 0.31671249866485596 1 0.15835624933242798
+8 0.31671249866485596 9 0.15835624933242798
+8 0.31671249866485596 11 0.15835624933242798
+8 0.31671249866485596 12 0.15835624933242798
+1 0.15835624933242798 5 0.47506874799728394
+1 0.15835624933242798 8 0.31671249866485596
+1 0.15835624933242798 1 0.15835624933242798
+1 0.15835624933242798 9 0.15835624933242798
+1 0.15835624933242798 11 0.15835624933242798
+1 0.15835624933242798 12 0.15835624933242798
+9 0.15835624933242798 5 0.47506874799728394
+9 0.15835624933242798 8 0.31671249866485596
+9 0.15835624933242798 1 0.15835624933242798
+9 0.15835624933242798 9 0.15835624933242798
+9 0.15835624933242798 11 0.15835624933242798
+9 0.15835624933242798 12 0.15835624933242798
+11 0.15835624933242798 5 0.47506874799728394
+11 0.15835624933242798 8 0.31671249866485596
+11 0.15835624933242798 1 0.15835624933242798
+11 0.15835624933242798 9 0.15835624933242798
+11 0.15835624933242798 11 0.15835624933242798
+11 0.15835624933242798 12 0.15835624933242798
+12 0.15835624933242798 5 0.47506874799728394
+12 0.15835624933242798 8 0.31671249866485596
+12 0.15835624933242798 1 0.15835624933242798
+12 0.15835624933242798 9 0.15835624933242798
+12 0.15835624933242798 11 0.15835624933242798
+12 0.15835624933242798 12 0.15835624933242798
+EXPLAIN SELECT a.FTS_DOC_ID, MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE),
+b.FTS_DOC_ID, MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE)
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE a fulltext ft_idx ft_idx 0 1 Using where
+1 SIMPLE b fulltext ft_idx ft_idx 0 1 Using where
+EXPLAIN SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using where
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100
+FROM t1 WHERE MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100;
+FTS_DOC_ID MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100
+1 4.92168664932251
+5 14.76505994796753
+8 9.84337329864502
+9 4.92168664932251
+11 4.92168664932251
+12 4.92168664932251
+SELECT * FROM t1 WHERE title IS NULL AND text IS NULL;
+FTS_DOC_ID title text
+15 NULL NULL
+CREATE TABLE t2 SELECT FTS_DOC_ID as doc_id, title, text FROM t1;
+ALTER TABLE t2 ADD PRIMARY KEY (doc_id);
+ALTER TABLE t2 ADD FULLTEXT KEY ft_idx (title,text);
+ANALYZE TABLE t2;
+EXPLAIN SELECT DOC_ID FROM t2 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 15 Using where
+SELECT DOC_ID FROM t2 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+DOC_ID
+1
+5
+8
+9
+11
+12
+EXPLAIN SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using where
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+FTS_DOC_ID
+1
+5
+8
+9
+11
+12
+DROP TABLE t1, t2;
+"Check hints with uft8 charset for 2 cases"
+set names utf8;
+CREATE TABLE t1 (
+FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+text TEXT
+) CHARACTER SET = utf8, ENGINE=InnoDB;
+INSERT INTO t1 (title, text) VALUES
+('Я могу есть стекло', 'оно мне не вредит'),
+('Мога да ям стъкло', 'то не ми вреди'),
+('Μπορῶ νὰ φάω σπασμένα' ,'γυαλιὰ χωρὶς νὰ πάθω τίποτα'),
+('Příliš žluťoučký kůň', 'úpěl ďábelské kódy'),
+('Sævör grét', 'áðan því úlpan var ónýt'),
+('うゐのおくやま','けふこえて'),
+('いろはにほへど ちりぬる','あさきゆめみじ ゑひもせず');
+CREATE FULLTEXT INDEX idx on t1 (title, text);
+# No ranking
+EXPLAIN
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('вредит' IN NATURAL LANGUAGE MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext idx idx 0 1 Using where
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('вредит' IN NATURAL LANGUAGE MODE);
+count(*)
+1
+EXPLAIN
+SELECT * FROM t1 WHERE MATCH(title, text) AGAINST ("оно" WITH QUERY EXPANSION);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext idx idx 0 1 Using where
+SELECT * FROM t1 WHERE MATCH(title, text) AGAINST ("оно" WITH QUERY EXPANSION);
+FTS_DOC_ID title text
+1 Я могу есть стекло оно мне не вредит
+# No sorting by rank
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+(Мога τίποτα)' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext idx idx 0 1 Using where
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+(Мога τίποτα)' IN BOOLEAN MODE);
+FTS_DOC_ID
+2
+3
+DROP TABLE t1;
+#
+# Bug #18924341 CRASH IN TEST_IF_SKIP_SORT_ORDER, GROUP BY MATCH AGAINST DESC
+#
+CREATE TABLE t1 (f1 CHAR(1), FULLTEXT KEY (f1));
+SELECT 1 FROM t1 NATURAL JOIN t1 a GROUP BY MATCH(t1.f1) AGAINST ("1") DESC;
+1
+DROP TABLE t1;
+#
+# Bug#20261601 ASSERTION FAILED: !FIRST_QEP_TAB->TABLE()->NO_KEYREAD
+#
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(1),(2);
+SELECT (SELECT MATCH(`a`)AGAINST('1') FROM t1) FROM t1;
+ERROR HY000: Can't find FULLTEXT index matching the column list
+SELECT 1, a IN (SELECT a FROM t1) FROM t1;
+1 a IN (SELECT a FROM t1)
+1 1
+1 1
+DROP TABLE t1;
+#
+# Bug#20442572 ASSERTION `!FIRST_QEP_TAB->TABLE()->NO_KEYREAD' FAILED.
+# Bug#75688 Assertion `!first_qep_tab->table()->no_keyread' failed.
+#
+CREATE TABLE t1(a INT,b POINT NOT NULL,KEY(a));
+HANDLER t1 OPEN;
+select * from t1 where MATCH a,b AGAINST('"Now sUPPort"' IN BOOLEAN MODE);
+a b
+prepare stmt1 from "truncate t1";
+SELECT a IN(SELECT a FROM t1)FROM t1;
+a IN(SELECT a FROM t1)
+deallocate prepare stmt1;
+DROP TABLE t1;
+#
+# Bug #20685427 INVALID WRITE OF FREED MEMORY IN ITEM_FUNC_MATCH::CLEANUP
+#
+CREATE TABLE t1(a TEXT CHARSET LATIN1, FULLTEXT KEY(a)) ENGINE=INNODB;
+SELECT MATCH(a) AGAINST ('') FROM (SELECT a FROM t1 LIMIT 1) q;
+ERROR HY000: Can't find FULLTEXT index matching the column list
+DROP TABLE t1;
+#
+# Bug#21140067 EXPLAIN .. MATCH AGAINST: ASSERTION FAILED: TO <= END
+#
+CREATE TABLE t1(f1 CHAR(1) CHARSET latin1, FULLTEXT(f1)) ENGINE=INNODB;
+EXPLAIN SELECT 1 FROM t1 WHERE 1.238585e+308 <= MATCH(f1) AGAINST ('1' IN BOOLEAN MODE);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext f1 f1 0 1 Using where
+EXPLAIN FORMAT = JSON SELECT 1 FROM t1 WHERE 1.238585e+308 <= MATCH(f1) AGAINST ('1' IN BOOLEAN MODE);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "fulltext",
+ "possible_keys": ["f1"],
+ "key": "f1",
+ "key_length": "0",
+ "used_key_parts": ["f1"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "1.238585e+308 <= (match t1.f1 against ('1' in boolean mode))"
+ }
+ }
+ ]
+ }
+}
+DROP TABLE t1;
+#
+# Bug#21140088 MATCH AGAINST: ASSERTION FAILED: !TABLE || (!TABLE->READ_SET || BITMAP_IS_SET
+#
+SET sql_mode='';
+CREATE TABLE t1(a INT) ENGINE=INNODB;
+CREATE TABLE t2(b TEXT CHARSET LATIN1, FULLTEXT(b), PRIMARY KEY(b(10))) ENGINE=INNODB;
+INSERT INTO t2 VALUES ('a'),('b');
+SELECT NOT EXISTS (SELECT MATCH(b) AGAINST ('1') FROM t1) FROM t2 GROUP BY "a";
+ERROR HY000: Incorrect arguments to MATCH
+DROP TABLE t1, t2;
+CREATE TABLE t1(a INT) ENGINE=MyISAM;
+CREATE TABLE t2(b TEXT CHARSET LATIN1, FULLTEXT(b), PRIMARY KEY(b(10))) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('a'),('b');
+SELECT NOT EXISTS (SELECT MATCH(b) AGAINST ('1' in BOOLEAN MODE) FROM t1) FROM t2 GROUP BY "a";
+NOT EXISTS (SELECT MATCH(b) AGAINST ('1' in BOOLEAN MODE) FROM t1)
+1
+DROP TABLE t1, t2;
+SET sql_mode=default;
+#
+# Bug#21140039 ASSERTION FAILED: !FIRST_QEP_TAB->TABLE()->NO_KEYREAD MATCH AGAINST.....
+#
+CREATE TABLE t1
+(
+a INT,
+b INT,
+c CHAR(1) CHARSET latin1,
+PRIMARY KEY (b,a),
+FULLTEXT KEY (c)
+) ENGINE=INNODB;
+SELECT "a" NOT IN(SELECT b FROM t1 WHERE MATCH(c) AGAINST ('a' IN BOOLEAN MODE));
+"a" NOT IN(SELECT b FROM t1 WHERE MATCH(c) AGAINST ('a' IN BOOLEAN MODE))
+1
+DROP TABLE t1;
+#
+# Bug#21300774 ASSERT `!INIT_FTFUNCS(THD, SELECT_LEX)` IN JOIN::RESET AT SQL/SQL_SELECT.CC:874
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+CREATE TABLE t2 (ft TEXT, FULLTEXT KEY ft(ft));
+INSERT INTO t2 VALUES ('abc');
+INSERT INTO t2 VALUES ('def');
+UPDATE t1 SET f1 =
+(SELECT t1.f1 FROM t2 WHERE NOT TRUE AND
+MATCH (ft) AGAINST ((SELECT 'xyz' FROM t2)));
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, t2;
+#
+# Bug#22679209: FULL-TEXT QUERIES WITH ADDITIONAL SECONDARY INDEX
+# GIVES NULL OR ZERO ROWS
+#
+CREATE TABLE t1 (
+f1 INTEGER,
+title varchar(255),
+body mediumtext,
+KEY f1 (f1),
+FULLTEXT KEY title (title),
+FULLTEXT KEY body (body)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1, 'Insert into table', 'insert into table select from'),
+(1, 'Delete from table', 'insert into table select from'),
+(1, 'Update', 'perform update'),
+(2, 'Insert into table', 'insert into table select from'),
+( 2, 'Delete from table', 'some body text here'),
+( 2, 'Update', 'perform update'),
+( 3, 'Insert into table', 'insert into table select from'),
+( 3, 'Delete from table', 'some body text here');
+SELECT f1 FROM t1 WHERE f1=1 AND
+(MATCH (title) AGAINST ('table' IN BOOLEAN MODE) OR
+MATCH (body) AGAINST ('table' IN BOOLEAN MODE));
+f1
+1
+1
+DROP TABLE t1;
+# End of test for Bug#22679209
diff --git a/mysql-test/suite/innodb_fts/r/phrase.result b/mysql-test/suite/innodb_fts/r/phrase.result
new file mode 100644
index 00000000..efcbaeac
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/phrase.result
@@ -0,0 +1,84 @@
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+(NULL, 'mysql good database'),
+(NULL, ' mysql good database'),
+('', 'mysql good database'),
+('', ' mysql good database'),
+(' ', 'mysql good database'),
+('mysql', 'good database'),
+('mysql ', 'good database'),
+('mysql', ' good database'),
+('mysql good database', ''),
+('mysql good database', NULL);
+SET GLOBAL innodb_ft_aux_table="test/articles";
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
+database 1 10 10 1 11
+database 1 10 10 2 12
+database 1 10 10 3 11
+database 1 10 10 4 12
+database 1 10 10 5 13
+database 1 10 10 6 11
+database 1 10 10 7 12
+database 1 10 10 8 12
+database 1 10 10 9 11
+database 1 10 10 10 11
+good 1 10 10 1 6
+good 1 10 10 2 7
+good 1 10 10 3 6
+good 1 10 10 4 7
+good 1 10 10 5 8
+good 1 10 10 6 6
+good 1 10 10 7 7
+good 1 10 10 8 7
+good 1 10 10 9 6
+good 1 10 10 10 6
+mysql 1 10 10 1 0
+mysql 1 10 10 2 1
+mysql 1 10 10 3 0
+mysql 1 10 10 4 1
+mysql 1 10 10 5 2
+mysql 1 10 10 6 0
+mysql 1 10 10 7 0
+mysql 1 10 10 8 0
+mysql 1 10 10 9 0
+mysql 1 10 10 10 0
+SET GLOBAL innodb_ft_aux_table=default;
+SELECT * FROM articles;
+id title body
+1 NULL mysql good database
+2 NULL mysql good database
+3 mysql good database
+4 mysql good database
+5 mysql good database
+6 mysql good database
+7 mysql good database
+8 mysql good database
+9 mysql good database
+10 mysql good database NULL
+SELECT * FROM articles WHERE MATCH(title, body)
+AGAINST('"mysql good database"' IN BOOLEAN MODE);
+id title body
+1 NULL mysql good database
+2 NULL mysql good database
+3 mysql good database
+4 mysql good database
+5 mysql good database
+9 mysql good database
+10 mysql good database NULL
+SELECT * FROM articles WHERE MATCH(title, body)
+AGAINST('("mysql good database")' IN BOOLEAN MODE);
+id title body
+1 NULL mysql good database
+2 NULL mysql good database
+3 mysql good database
+4 mysql good database
+5 mysql good database
+9 mysql good database
+10 mysql good database NULL
+DROP TABLE articles;
diff --git a/mysql-test/suite/innodb_fts/r/result_cache_limit.result b/mysql-test/suite/innodb_fts/r/result_cache_limit.result
new file mode 100644
index 00000000..4f13f4e7
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/result_cache_limit.result
@@ -0,0 +1,31 @@
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE= InnoDB;
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...'),
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+SET @save_limit=@@GLOBAL.innodb_ft_result_cache_limit;
+SET @save_dbug=@@debug_dbug;
+SET debug_dbug="+d,fts_instrument_result_cache_limit";
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' IN BOOLEAN MODE);
+COUNT(*)
+9
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' WITH QUERY EXPANSION);
+ERROR HY000: Table handler out of memory
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database"' IN BOOLEAN MODE);
+ERROR HY000: Table handler out of memory
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database" @ 5' IN BOOLEAN MODE);
+ERROR HY000: Table handler out of memory
+SET debug_dbug=@save_dbug;
+DROP TABLE t1;
+SET GLOBAL innodb_ft_result_cache_limit=@save_limit;
diff --git a/mysql-test/suite/innodb_fts/r/savepoint.result b/mysql-test/suite/innodb_fts/r/savepoint.result
new file mode 100644
index 00000000..1abfc961
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/savepoint.result
@@ -0,0 +1,318 @@
+CREATE TABLE articles (
+id INT UNSIGNED NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+FULLTEXT (title)
+) ENGINE= InnoDB;
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+4 mysql
+5 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+4 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+5 mysql
+6 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+3 mysql
+4 mysql
+5 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+RELEASE SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+3 mysql
+4 mysql
+5 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+3 mysql
+4 mysql
+5 mysql
+6 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+RELEASE SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+3 mysql
+4 mysql
+5 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+RELEASE SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+4 mysql
+5 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+3 mysql
+4 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+RELEASE SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+COMMIT;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+2 mysql
+3 mysql
+5 mysql
+6 mysql
+7 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+ROLLBACK;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+3 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+ROLLBACK;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+4 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+ROLLBACK;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+5 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+ROLLBACK;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+5 mysql
+TRUNCATE TABLE articles;
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+BEGIN;
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+RELEASE SAVEPOINT sp1;
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+ROLLBACK;
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+id title
+1 mysql
+7 mysql
+DROP TABLE articles;
diff --git a/mysql-test/suite/innodb_fts/r/subexpr.result b/mysql-test/suite/innodb_fts/r/subexpr.result
new file mode 100644
index 00000000..cf476abb
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/subexpr.result
@@ -0,0 +1,105 @@
+#
+# Bug #20028323 INNODB FULLTEXT BOOLEAN SEARCH INCORRECTLY HANDLES
+# PARENTHESES
+#
+CREATE TABLE t1 (
+f1 INT NOT NULL AUTO_INCREMENT,
+f2 TEXT NOT NULL,
+PRIMARY KEY (f1),
+FULLTEXT (f2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 (f2) VALUES
+('Pumpkin soup with cheese bread'),
+('Yellow chicken curry'),
+('Fresh green vegetables with garlic');
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE);
+f1 f2
+1 Pumpkin soup with cheese bread
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE);
+f1 f2
+1 Pumpkin soup with cheese bread
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE);
+f1 f2
+1 Pumpkin soup with cheese bread
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE);
+f1 f2
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+f1 f2
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE);
+f1 f2
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+f1 f2
+INSERT INTO t1 (f2) VALUES
+('This row contains only souffle'),
+('This row contains only tart'),
+('This row contains only pumpkin'),
+('This row contains only cheese'),
+('This row contains pumpkin and souffle'),
+('This row contains pumpkin and tart'),
+('This row contains pumpkin and cheese'),
+('This row contains both souffle and tart'),
+('This row contains both souffle and cheese'),
+('This row contains both tart and cheese'),
+('This row contains all three souffle, pumpkin and tart'),
+('This row contains all four cheese, souffle, pumpkin and tart');
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE);
+f1 f2
+1 Pumpkin soup with cheese bread
+6 This row contains only pumpkin
+8 This row contains pumpkin and souffle
+9 This row contains pumpkin and tart
+10 This row contains pumpkin and cheese
+14 This row contains all three souffle, pumpkin and tart
+15 This row contains all four cheese, souffle, pumpkin and tart
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE);
+f1 f2
+1 Pumpkin soup with cheese bread
+7 This row contains only cheese
+10 This row contains pumpkin and cheese
+12 This row contains both souffle and cheese
+13 This row contains both tart and cheese
+15 This row contains all four cheese, souffle, pumpkin and tart
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE);
+f1 f2
+1 Pumpkin soup with cheese bread
+10 This row contains pumpkin and cheese
+15 This row contains all four cheese, souffle, pumpkin and tart
+7 This row contains only cheese
+12 This row contains both souffle and cheese
+13 This row contains both tart and cheese
+6 This row contains only pumpkin
+8 This row contains pumpkin and souffle
+9 This row contains pumpkin and tart
+14 This row contains all three souffle, pumpkin and tart
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE);
+f1 f2
+8 This row contains pumpkin and souffle
+14 This row contains all three souffle, pumpkin and tart
+15 This row contains all four cheese, souffle, pumpkin and tart
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+f1 f2
+14 This row contains all three souffle, pumpkin and tart
+15 This row contains all four cheese, souffle, pumpkin and tart
+8 This row contains pumpkin and souffle
+9 This row contains pumpkin and tart
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE);
+f1 f2
+8 This row contains pumpkin and souffle
+14 This row contains all three souffle, pumpkin and tart
+15 This row contains all four cheese, souffle, pumpkin and tart
+9 This row contains pumpkin and tart
+SELECT * FROM t1 WHERE MATCH(f2)
+AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+f1 f2
+14 This row contains all three souffle, pumpkin and tart
+15 This row contains all four cheese, souffle, pumpkin and tart
+8 This row contains pumpkin and souffle
+9 This row contains pumpkin and tart
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test
index dd8a07f8..ac3f0385 100644
--- a/mysql-test/suite/innodb_fts/t/crash_recovery.test
+++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test
@@ -113,7 +113,7 @@ disconnect ddl3;
# Wait for purge, so that any #sql-ib.ibd files from the previous kill
# will be deleted.
-source ../../innodb/include/wait_all_purged.inc;
+SET GLOBAL innodb_max_purge_lag_wait=0;
CHECK TABLE t1,t2,t3;
DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/innodb_fts/t/foreign_key_check.test b/mysql-test/suite/innodb_fts/t/foreign_key_check.test
new file mode 100644
index 00000000..24421dcb
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/foreign_key_check.test
@@ -0,0 +1,41 @@
+#
+# BUG#22094601 CREATE TABLE WITH FULLTEXT AND CONSTRAINT FAILS WHEN FOREIGN_KEY_CHECKS IS 0
+#
+
+--source include/have_innodb.inc
+
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ title TEXT,
+ PRIMARY KEY (id),
+ FULLTEXT KEY (title),
+ FOREIGN KEY (id) REFERENCES t2 (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ title TEXT,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB;
+
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ADD FULLTEXT KEY (title), ADD FOREIGN KEY (id) REFERENCES t2 (id);
+
+SET FOREIGN_KEY_CHECKS = 0;
+
+ALTER TABLE t1 ADD FULLTEXT KEY (title), ADD FOREIGN KEY (id) REFERENCES t2 (id);
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ title TEXT,
+ PRIMARY KEY (id),
+ FULLTEXT KEY (title),
+ FOREIGN KEY (id) REFERENCES t2 (id)
+) ENGINE=InnoDB;
+
+DROP TABLE t1;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/mysql-test/suite/innodb_fts/t/foreign_key_update.test b/mysql-test/suite/innodb_fts/t/foreign_key_update.test
new file mode 100644
index 00000000..1f74e640
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/foreign_key_update.test
@@ -0,0 +1,34 @@
+#
+# BUG#21111301 INNODB FTS: ERROR DUPLICATE ENTRY IN FTS_DOC_ID_INDEX ON UPDATE CASCADE
+#
+
+-- source include/have_innodb.inc
+
+CREATE TABLE t1 (
+ a varchar(40),
+ KEY a(a)
+) ENGINE=InnoDB;
+
+CREATE TABLE t1_fk (
+ a varchar(40),
+ KEY a(a),
+ FULLTEXT KEY (a),
+ CONSTRAINT fk FOREIGN KEY (a) REFERENCES t1 (a) ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES('mysql');
+
+INSERT INTO t1_fk VALUES('mysql');
+INSERT INTO t1_fk VALUES('mysql');
+
+SELECT * FROM t1_fk;
+SELECT * FROM t1_fk WHERE MATCH(a) AGAINST('mysql');
+
+UPDATE t1 SET a = 'database' WHERE a = 'mysql';
+
+SELECT * FROM t1_fk;
+SELECT * FROM t1_fk WHERE MATCH(a) AGAINST('mysql');
+SELECT * FROM t1_fk WHERE MATCH(a) AGAINST('database');
+
+DROP TABLE t1_fk;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/index_table.opt b/mysql-test/suite/innodb_fts/t/index_table.opt
new file mode 100644
index 00000000..7724f976
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/index_table.opt
@@ -0,0 +1,2 @@
+--innodb-ft-index-cache
+--innodb-ft-index-table
diff --git a/mysql-test/suite/innodb_fts/t/index_table.test b/mysql-test/suite/innodb_fts/t/index_table.test
new file mode 100644
index 00000000..4b484877
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/index_table.test
@@ -0,0 +1,121 @@
+# This is the basic function tests for INNODB_FT_INDEX_TABLE
+# and INNODB_FT_INDEX_TABLE in INFORMATION_SCHEMA.
+
+-- source include/have_innodb.inc
+-- source include/have_debug.inc
+
+SET @optimize=@@GLOBAL.INNODB_OPTIMIZE_FULLTEXT_ONLY;
+SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1;
+
+# Test Case 1: Test Result Cache Limit
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ content TEXT
+ ) ENGINE= InnoDB;
+
+CREATE FULLTEXT INDEX idx ON articles (title, content);
+
+INSERT INTO articles (title, content) VALUES
+ ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','How to use full-text search engine'),
+ ('Go MySQL Tricks','How to use full text search engine');
+
+SET @aux=@@GLOBAL.innodb_ft_aux_table;
+SET GLOBAL innodb_ft_aux_table='test/articles';
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+
+OPTIMIZE TABLE articles;
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+
+SET @save_dbug=@@debug_dbug;
+SET debug_dbug='+d,fts_instrument_result_cache_limit';
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+
+SET debug_dbug=@save_dbug;
+
+DROP TABLE articles;
+
+SET GLOBAL innodb_ft_result_cache_limit=default;
+
+# Test Case 2: Test Multiple Indexes
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ content TEXT
+ ) ENGINE= InnoDB;
+
+CREATE FULLTEXT INDEX idx_t ON articles (title);
+
+CREATE FULLTEXT INDEX idx_c ON articles (content);
+
+INSERT INTO articles (title, content) VALUES
+ ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','How to use full-text search engine'),
+ ('Go MySQL Tricks','How to use full text search engine');
+
+# test.articles had been dropped, so this result will be empty
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+SET GLOBAL innodb_ft_aux_table='test/articles';
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+
+OPTIMIZE TABLE articles;
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+
+DROP TABLE articles;
+
+SET NAMES utf8;
+
+# Test Case 3: Test UFT8 Charset
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200)
+ ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+CREATE FULLTEXT INDEX idx ON articles (title);
+
+INSERT INTO articles (title) VALUES
+ ('相亲相爱'),('怜香惜爱'),('充满可爱'),('爱恨交织');
+
+SET GLOBAL innodb_ft_aux_table="test/articles";
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+
+OPTIMIZE TABLE articles;
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+
+DROP TABLE articles;
+
+# Test Case 4: Test GB2312 Charset
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200)
+ ) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
+
+CREATE FULLTEXT INDEX idx ON articles (title);
+
+INSERT INTO articles (title) VALUES
+ ('相亲相爱'),('怜香惜爱'),('充满可爱'),('爱恨交织');
+
+SET GLOBAL innodb_ft_aux_table="test/articles";
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+
+OPTIMIZE TABLE articles;
+
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+
+DROP TABLE articles;
+
+# Restore global variables
+SET GLOBAL innodb_ft_aux_table=@aux;
+SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=@optimize;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test
index e3d8eb0c..edf7ab21 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test
@@ -163,6 +163,8 @@ DROP TABLE t1;
set global innodb_file_per_table=1;
+set names utf8;
+--character_set utf8
# Test fts with externally stored long column
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
diff --git a/mysql-test/suite/innodb_fts/t/limit_union.test b/mysql-test/suite/innodb_fts/t/limit_union.test
new file mode 100644
index 00000000..71c9af69
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/limit_union.test
@@ -0,0 +1,143 @@
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+--echo # Bug #22709692 FTS QUERY EXCEEDS RESULT CACHE LIMIT
+
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body),
+FULLTEXT (body))ENGINE=InnoDB;
+
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...'),
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+SET @default_cache_size = @@GLOBAL.query_cache_size;
+SET GLOBAL query_cache_size=0;
+
+--echo # Query involves Ranking
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' IN NATURAL LANGUAGE MODE) LIMIT 1;
+
+--echo # Without optimization
+SET @save_dbug = @@debug_dbug;
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' IN NATURAL LANGUAGE MODE) LIMIT 1;
+SET debug_dbug = @save_dbug;
+
+--echo # Query involves No Ranking and fts_union operations
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' IN BOOLEAN MODE) limit 1;
+
+SET debug_dbug = @save_dbug;
+
+--echo # Query involves No ranking and fts_union, fts_ignore
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL -YourSQL' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL -YourSQL' IN BOOLEAN MODE) limit 1;
+SET debug_dbug = @save_dbug;
+
+--echo # Query with fts_intersect
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL +YourSQL' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL +YourSQL' IN BOOLEAN MODE) limit 1;
+SET debug_dbug = @save_dbug;
+
+# insert record with @ character which is used in proximity search
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','request doc@oraclehelp.com ...'),
+ ('MySQL Tutorial','request support@oraclehelp.com ...'),
+ ('Trial version','query performace @1255 minute on 2.1Hz
+ Memory 2GB...'),
+ ('when To Use MySQL Well','for free faq mail@xyz.com ...');
+
+--echo # Query with @distance
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"MySQL request"@3' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"MySQL request"@3' IN BOOLEAN MODE) limit 1;
+SET debug_dbug = @save_dbug;
+
+--echo # Query with subexpression
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('+MySQL +(-support +doc)' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('+MySQL +(-support +doc)' IN BOOLEAN MODE) limit 1;
+SET debug_dbug = @save_dbug;
+
+--echo # limit num1 OFFSET num2
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' in boolean mode) limit 4 offset 2;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' in boolean mode) limit 4 offset 2;
+SET debug_dbug = @save_dbug;
+
+--echo # wild card search
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('ru*' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('ru*' IN BOOLEAN MODE) limit 1;
+SET debug_dbug = @save_dbug;
+
+--echo # phrase search
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"request support"' IN BOOLEAN MODE) limit 1;
+
+--echo # Without optimization
+SET debug_dbug = '+d,fts_union_limit_off';
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"request support"' IN BOOLEAN MODE) limit 1;
+SET debug_dbug = @save_dbug;
+
+DROP TABLE articles;
+SET GLOBAL query_cache_size = @default_cache_size;
diff --git a/mysql-test/suite/innodb_fts/t/misc.test b/mysql-test/suite/innodb_fts/t/misc.test
new file mode 100644
index 00000000..f897cf12
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/misc.test
@@ -0,0 +1,1511 @@
+--source include/have_innodb.inc
+--source include/no_valgrind_without_big.inc
+
+#------------------------------------------------------------------------------
+# Test With alter/create/drop index
+#------------------------------------------------------------------------------
+
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+# query expansion
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+
+# Drop index
+ALTER TABLE t1 DROP INDEX idx;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+# query expansion
+select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
+select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
+
+# insert for proximity search
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+ ('test proximity search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+ ('test proximity fts search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+ ('test more proximity fts search, test, more proximity and phrase',
+ 'search, with proximity innodb');
+
+# This should only return the first document
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+
+# Similar boundary testing for the words
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+
+
+#------------------------------------------------------------------------------
+# Test with FTS condition in subquery
+#------------------------------------------------------------------------------
+
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id = (SELECT MAX(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE));
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+
+
+# Select word "tutorial" in the table - innodb crash
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+) OR t1.id = 3 ;
+
+
+# Select word "tutorial" in the table - innodb crash
+SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN (
+SELECT CONCAT(a,b) FROM t1 AS t2
+WHERE MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t2.id != 3) ;
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE
+MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ;
+
+# Select word except "tutorial" in the table
+SELECT id FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1
+WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ;
+
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+
+
+# Select not word like "tutorial" using subquery
+SELECT id FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)
+AND t1.id = t2.id) ;
+
+DROP TABLE t1;
+
+# boolean search
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT ,
+ FULLTEXT (a,b)
+ ) ENGINE = InnoDB;
+
+INSERT INTO t1(a,b) VALUES('MySQL has now support', 'for full-text search'),
+('Full-text indexes', 'are called collections'),
+('Only MyISAM tables','support collections'),
+('Function MATCH ... AGAINST()','is used to do a search'),
+('Full-text search in MySQL', 'implements vector space model');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+ MATCH(t2.a,t2.b) AGAINST("+support +collections" IN BOOLEAN MODE));
+SELECT id FROM t1 WHERE t1.id != (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+ MATCH(t2.a,t2.b) AGAINST("+search" IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ("+call* +coll*" IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE) AND t2.id=t1.id);
+
+
+#query expansion search
+# result differ for query expansion search even wo subquery
+#SELECT id FROM t1 WHERE t1.id = ( SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+#MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION));
+#SELECT id FROM t1 WHERE t1.id IN ( SELECT t2.id FROM t1 AS t2 WHERE
+#MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION));
+#SELECT id FROM t1 WHERE ( SELECT COUNT(*) FROM t1 AS t2 WHERE
+#MATCH(t2.a,t2.b) AGAINST ("indexes collections" WITH QUERY EXPANSION)) >= 1
+#AND t1.id <=3 ;
+
+# proximity search
+# insert for proximity search
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+ ('test proximity search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+ ('test proximity fts search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+ ('test more proximity fts search, test, more proximity and phrase',
+ 'search, with proximity innodb');
+
+
+SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+SELECT id FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE
+MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE
+MATCH (t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE));
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"proximity search"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@3' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+
+SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE
+MATCH t2.a,t2.b AGAINST ('"more test proximity"@2' IN BOOLEAN MODE)
+AND t2.id=t1.id);
+
+
+#------------------------------------------------------------------------------
+# create table AS SELECT from fts indexed table
+#------------------------------------------------------------------------------
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('support') ;
+SHOW CREATE TABLE t2;
+SELECT id FROM t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST("+support +collections" IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+SELECT id FROM t2;
+DROP TABLE t2;
+
+CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE
+MATCH a,b AGAINST ('"proximity search"@10' IN BOOLEAN MODE);
+SHOW CREATE TABLE t2;
+SELECT id FROM t2;
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+
+#------------------------------------------------------------------------------
+# Verift FTS with NULL records
+#------------------------------------------------------------------------------
+# Create FTS table
+EVAL CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...');
+
+let $counter = 50;
+--disable_query_log
+WHILE ($counter > 0) {
+ INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+ dec $counter;
+}
+--enable_query_log
+INSERT INTO t1 (a,b) VALUES
+('when To Use MySQL Well','After that you went through a ...');
+
+let $counter = 50;
+--disable_query_log
+WHILE ($counter > 0) {
+ INSERT INTO t1 (a,b) VALUES (NULL,NULL);
+ dec $counter;
+}
+--enable_query_log
+INSERT INTO t1 (a,b) VALUES
+('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL null...');
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t1 WHERE a IS NULL;
+SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL;
+
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST (NULL IN NATURAL LANGUAGE MODE);
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST (NULL WITH QUERY EXPANSION);
+SELECT id FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('null' IN NATURAL LANGUAGE MODE);
+# Boolean search
+# Select rows contain "MySQL" but not "YourSQL"
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NOT NULL OR b IS NOT NULL);
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NULL AND b IS NOT NULL);
+
+# Select rows contain at least one of the two words
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+
+# Test query expansion
+SELECT COUNT(*) FROM t1
+WHERE MATCH (a,b)
+AGAINST ('database' WITH QUERY EXPANSION);
+
+# proximity
+SELECT id FROM t1
+WHERE MATCH (a,b)
+AGAINST ('"following database"@10' IN BOOLEAN MODE);
+
+
+DROP TABLE t1;
+
+
+
+#------------------------------------------------------------------------------
+# More FTS test from peter's testing
+#------------------------------------------------------------------------------
+--disable_warnings
+drop table if exists t50;
+--enable_warnings
+
+set names utf8;
+
+
+--echo "----------Test1---------"
+# Create FTS table
+create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb;
+create fulltext index i on t50 (s1);
+# INNODB_FTS: Assert - fixed
+# Assert : InnoDB: Failing assertion: rbt_validate(result_doc->tokens)
+insert into t50 values ('ABCDE'),('FGHIJ'),('KLMNO'),('VÐƷWİ');
+# it was giving empty result set instead of one record
+select * from t50 where match(s1) against ('VÐƷWİ');
+drop table t50;
+
+
+--echo "----------Test2---------"
+create table t50 (s1 int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÐƷWİ'),('ABCDE');
+# INNODB_FTS: RESULT DIFF
+# Order by does not sort result.
+# Optimizer's Evgeny is investigate a similar issue. InnoDB FTS is used only
+# for FT search, and should not be used as regular index for such order by query.
+# Correct the result file when fixed.
+select * from t50 order by s2;
+drop table t50;
+
+
+--echo "----------Test3---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÐƷWİ'),('ABCDE');
+set @@autocommit=0;
+update t50 set s2 = lower(s2);
+update t50 set s2 = upper(s2);
+commit;
+select * from t50 where match(s2) against ('VÐƷWİ FGHIJ KLMNO ABCDE' in boolean mode);
+select * from t50;
+drop table t50;
+set @@autocommit=1;
+
+--echo "----------Test4---------"
+create table t50 (id int unsigned primary key auto_increment, s2
+varchar(60) character set utf8) engine = innodb;
+create fulltext index i on t50 (s2);
+insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÐƷWİ'),('ABCD*');
+select * from t50 where match(s2) against ('abcd*' in natural language
+mode);
+# INNODB_FTS: RESULT DIFF(Expected). InnoDB do not index "*", so
+# word "ABCD" indexed, instead of "ABCD*"
+select * from t50 where match(s2) against ('abcd*' in boolean mode);
+drop table t50;
+
+
+--echo "----------Test5---------"
+create table t50 (s1 int, s2 varchar(200), fulltext key(s2)) engine = innodb;
+set @@autocommit=0;
+insert into t50 values (1,'Sunshine'),(2,'Lollipops');
+select * from t50 where match(s2) against('Rainbows');
+rollback;
+select * from t50;
+drop table t50;
+set @@autocommit=1;
+
+--echo "----------Test6---------"
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('aab` MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('aas How To Use MySQL Well','After you went through a ...'),
+ ('aac Optimizing MySQL','In this tutorial we will show ...');
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('aac 1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('aab MySQL vs. YourSQL','In the following database comparison ...'),
+ ('aaa MySQL Security','When configured properly, MySQL ...');
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+-- disable_query_log
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+-- enable_query_log
+
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aac') DESC;
+SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aab') DESC;
+
+--echo "----------Test7---------"
+select * from t1 where match(a,b) against ('aaa')
+union select * from t1 where match(a,b) against ('aab')
+union select * from t1 where match(a,b) against ('aac');
+
+select * from t1 where match(a,b) against ('aaa')
+ or match(a,b) against ('aab')
+ or match(a,b) against ('aac');
+
+DROP TABLE t1;
+
+--echo "----------Test8---------"
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ... abcd') ,
+ ('How To Use MySQL Well','After you went through a q ...abdd'),
+ ('Optimizing MySQL','In this tutorial we will show ...abed');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. q ...'),
+ ('MySQL vs. YourSQL use','In the following database comparison ...'),
+ ('MySQL Security','When run configured properly, MySQL ...');
+
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went');
+# rows should be matched as 'q' is single char its not indexed
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run') AND NOT MATCH(a,b) AGAINST ('q');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use') AND NOT MATCH(a,b) AGAINST ('q');
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went') AND NOT MATCH(a,b) AGAINST ('q');
+
+--echo "----------Test9---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SET @x = (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('use'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('went'));
+SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run'));
+# Innodb returns value for x which is correct
+SELECT @x, @x2;
+
+
+DROP TABLE t2;
+
+--echo "----------Test10---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE=MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+
+DROP TABLE t2;
+
+
+--echo "----------Test11---------"
+CREATE TABLE t2 AS SELECT * FROM t1;
+ALTER TABLE t2 ENGINE = MYISAM;
+CREATE FULLTEXT INDEX i ON t2 (a,b);
+ALTER TABLE t2 ENGINE=InnoDB;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run');
+SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE);
+DROP TABLE t2,t1;
+
+
+--echo "----------Test13---------"
+set names utf8;
+
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_SPANISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+INSERT INTO t1 VALUES (1,'aaCen'),(2,'aaCha'),(3,'aaCio'),(4,'aaçen'),(5,'aaçha'),(6,'aaçio');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aach*' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aaC*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo "----------Test14---------"
+CREATE TABLE t1(s1 INT , s2 VARCHAR(100) CHARACTER SET sjis) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1 (s2);
+INSERT INTO t1 VALUES (1,'ペペペ'),(2,'テテテ'),(3,'ルルル'),(4,'グググ');
+# Innodb Asset : file ha_innodb.cc line 4557
+#SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('テテ*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+
+--echo "----------Test15---------"
+CREATE TABLE t1 (s1 VARCHAR (60) CHARACTER SET UTF8 COLLATE UTF8_UNICODE_520_CI) ENGINE = MyISAM;
+CREATE FULLTEXT INDEX i ON t1 (s1);
+INSERT INTO t1 VALUES
+('a'),('b'),('c'),('d'),('ŁŁŁŁ'),('LLLL'),(NULL),('ŁŁŁŁ ŁŁŁŁ'),('LLLLLLLL');
+SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+DROP TABLE if EXISTS t2;
+CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t2 ( s1);
+INSERT INTO t2 VALUES
+('a'),('b'),('c'),('d'),('ŁŁŁŁ'),('LLLL'),(NULL),('ŁŁŁŁ ŁŁŁŁ'),('LLLLLLLL');
+SELECT * FROM t2 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
+--disable_warnings
+DROP TABLE t1,t2;
+--enable_warnings
+
+--echo "----------Test16---------"
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(50) CHARACTER SET UTF8) ENGINE = InnoDB;
+CREATE FULLTEXT INDEX i ON t1(s2);
+INSERT INTO t1 VALUES (2, 'ğė Daśi p ');
+SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('+p +"ğė Daśi*"' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+
+--echo "----------Test19---------"
+#19 Failure with Boolean quoted search
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'İóëɠ');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('"İóëɠ"' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo "----------Test20---------"
+#20 Crash with utf32 and boolean mode.
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_column2 VARCHAR(60) character set utf8) ENGINE = InnoDB;
+INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu');
+UPDATE t1 SET char_column2 = char_column;
+CREATE FULLTEXT INDEX i ON t1 (char_column2);
+--error ER_FT_MATCHING_KEY_NOT_FOUND
+SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+--echo "----------Test22---------"
+# case 22
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,'aaa'),(2,'bbb'),(3,'ccc');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+HANDLER t1 OPEN;
+--error ER_KEY_DOESNT_SUPPORT
+HANDLER t1 READ i = ('aaa');
+DROP TABLE t1;
+#23. Duplicate key error when there are no unique indexes (procedure test)
+#24 Failure after cascading update - already have tests
+
+--echo "----------Test25---------"
+#25 Failure with Croatian boolean truncated search.
+CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_CROATIAN_CI) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'LJin'),(2,'ljin'),(3,'lmin'),(4,'LJLJLJLJLJ');
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+#inndob:error incorrect result correct it after fix
+SELECT count(*) FROM t1 WHERE MATCH (char_column) AGAINST ('lj*' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+#26. Index error when run procedure call from multiple clients
+
+--echo "----------Test27---------"
+#27 Crash after server restart
+CREATE TABLE t1 (id INT,char_column VARCHAR(60)) ENGINE=InnoDB;
+SET @@autocommit=0;
+CREATE FULLTEXT INDEX i ON t1 (char_column);
+INSERT INTO t1 values (1,'aaa');
+echo "restart server..."
+# Restart the server
+--source include/restart_mysqld.inc
+DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
+SET @@autocommit=1;
+DROP TABLE t1;
+
+--echo "----------Test28---------"
+drop table if exists `fts_test`;
+create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
+set session autocommit=0;
+insert into `fts_test` values ('');
+savepoint `b`;
+savepoint `b`;
+set session autocommit=1;
+DROP TABLE fts_test;
+
+# Continue test savepoint related operations. With a commit after
+# multiple rollback to savepoints
+--echo "----------Test29---------"
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+
+start transaction;
+
+INSERT INTO articles (title,body) VALUES
+('How To Use MySQL Well','After you went through a ...');
+
+savepoint `a1`;
+
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+
+savepoint `a2`;
+
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+savepoint `a3`;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+
+savepoint `a4`;
+
+# FTS do not parse those uncommitted rows, only one row should show up
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+rollback to savepoint a3;
+
+# The last inserted row should not be there
+select title, body from articles;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+
+savepoint `a5`;
+
+select title, body from articles;
+
+rollback to savepoint a2;
+
+select title, body from articles;
+
+commit;
+
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Continue test savepoint related operations. With a rollback after
+# multiple rollback to savepoints
+--echo "----------Test30---------"
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...');
+
+start transaction;
+
+INSERT INTO articles (title,body) VALUES
+('How To Use MySQL Well','After you went through a ...');
+
+savepoint `a1`;
+
+INSERT INTO articles (title,body) VALUES
+('Optimizing MySQL','In this tutorial we will show ...');
+
+savepoint `a2`;
+
+INSERT INTO articles (title,body) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+savepoint `a3`;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL vs. YourSQL','In the following database comparison ...');
+
+savepoint `a4`;
+
+# FTS do not parse those uncommitted rows, only one row should show up
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+rollback to savepoint a3;
+
+# The last inserted row should not be there
+select title, body from articles;
+
+INSERT INTO articles (title,body) VALUES
+('MySQL Security','When configured properly, MySQL ...');
+
+savepoint `a5`;
+
+select title, body from articles;
+
+rollback to savepoint a2;
+
+select title, body from articles;
+
+rollback;
+
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Test for Bug #13907075 - DIFFERENT RESULTS FOR DIFFERENT TERM ORDER
+# WITH INNODB BOOLEAN FULLTEXT SEARCH. The FTS_IGNORE ("-") operation
+# is orderless
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+-- disable_result_log
+ANALYZE TABLE articles;
+-- enable_result_log
+
+SELECT *, MATCH(title, body) AGAINST ('-database +MySQL' IN BOOLEAN MODE) AS score from articles;
+
+SELECT *, MATCH(title, body) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score FROM articles;
+
+# With subquery
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (database - tutorial)' IN BOOLEAN MODE);
+
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database)' IN BOOLEAN MODE);
+
+# More complex query
+SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database) -Tricks' IN BOOLEAN MODE);
+
+SELECT * FROM articles where MATCH(title, body) AGAINST ('-Tricks MySQL - (- tutorial database)' IN BOOLEAN MODE);
+
+DROP TABLE articles;
+
+# Test for Bug 13940669 - 64901: INNODB: ASSERTION FAILURE IN
+# THREAD 34387022112 IN FILE REM0CMP.CC LINE 5
+
+drop table if exists t1;
+
+create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key,
+title varchar(200),body text,fulltext(title,body)) engine=innodb;
+
+insert into t1 set body='test';
+
+select * from t1 where match(title,body) against('%test');
+
+select * from t1 where match(title,body) against('%');
+
+select * from t1 where match(title,body) against('%%%%');
+
+drop table t1;
+
+# Test for Bug 13881758 - 64745: CREATE FULLTEXT INDEX CAUSES CRASH
+# Create a database with empty space in its name
+CREATE DATABASE `benu database`;
+
+USE `benu database`;
+
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+DROP DATABASE `benu database`;
+
+USE test;
+
+# Test for Bug #14101706 - CRASH WITH DDL IN ROW_MERGE_BUILD_INDEXES
+# WHEN FULLTEXT INDEXES EXIST
+
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`), fulltext key (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER TABLE `t21` ADD UNIQUE INDEX (`b`), ALGORITHM=INPLACE;
+ALTER TABLE `t21` ADD UNIQUE INDEX (`b`);
+
+DROP TABLE t21;
+
+CREATE TABLE `t21` (`a` text, `b` int not null,
+fulltext key (`a`)) ENGINE=INNODB DEFAULT CHARSET=LATIN1;
+
+ALTER TABLE `t21` ADD UNIQUE INDEX (`b`);
+
+DROP TABLE t21;
+
+# Test primary index rebuild
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+ (1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+ (2, 'How To Use MySQL Well','After you went through a ...'),
+ (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+ALTER TABLE t1 ADD UNIQUE INDEX (`id`);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+
+DROP TABLE t1;
+
+# Test create the FTS and primary index in the same clause
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+ (1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+ (2, 'How To Use MySQL Well','After you went through a ...'),
+ (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD UNIQUE INDEX (`id`), ADD FULLTEXT INDEX idx (a,b);
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+# Create FTS table with FTS_DOC_ID already existed
+CREATE TABLE t1 (
+ FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+ (1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+ (2, 'How To Use MySQL Well','After you went through a ...'),
+ (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+ALTER TABLE t1 ADD UNIQUE INDEX (`FTS_DOC_ID`);
+
+# Select word "tutorial" in the table
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+
+DROP TABLE t1;
+
+# Create FTS table with FTS_DOC_ID and FTS_DOC_ID_INDEX
+CREATE TABLE t1 (
+ FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 VALUES
+ (1, 'MySQL Tutorial','DBMS stands for DataBase ...') ,
+ (2, 'How To Use MySQL Well','After you went through a ...'),
+ (3, 'Optimizing MySQL','In this tutorial we will show ...');
+
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b), ADD UNIQUE INDEX FTS_DOC_ID_INDEX (FTS_DOC_ID);
+
+# Select word "tutorial" in the table
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+
+DROP TABLE t1;
+
+# Test for bug #14079609 - FTS: CRASH IN FTS_TRX_TABLE_CMP WITH SAVEPOINTS, XA
+
+CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB
+DEFAULT CHARSET=LATIN1;
+
+CREATE TABLE t3 LIKE t2;
+
+INSERT INTO `t2` VALUES();
+
+COMMIT WORK AND CHAIN;
+
+INSERT INTO `t3` VALUES ();
+UPDATE `t2` SET `b` = 'a';
+
+SAVEPOINT BATCH1;
+
+DROP TABLE t2;
+DROP TABLE t3;
+
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+
+COMMIT WORK AND CHAIN;
+
+INSERT INTO t1 (a,b) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+SAVEPOINT BATCH1;
+
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+INSERT INTO t1 (a,b) VALUES
+ ('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+
+ROLLBACK TO SAVEPOINT BATCH1;
+
+COMMIT;
+
+SELECT id FROM t1 WHERE MATCH (a,b)
+ AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE t1;
+
+# Test for Bug 14588091 - FTS: BUFFER OVERFLOW IN FTS_AST_CREATE_NODE_TEXT
+CREATE TABLE `t` (`a` char(20) character set utf8 default null,
+fulltext key (`a`)) ENGINE=INNODB;
+INSERT INTO `t` VALUES ('a');
+INSERT INTO `t` VALUES ('aaa');
+
+# 0x22 is the '"', 0xdd is not encoded in utf8
+SELECT MATCH(`a`) AGAINST (0x22dd22) FROM `t`;
+SELECT MATCH(`a`) AGAINST (0x2222) FROM `t`;
+SELECT MATCH(`a`) AGAINST (0x22) FROM `t`;
+
+# this should show one match
+SELECT MATCH(`a`) AGAINST (0x2261616122) FROM `t`;
+
+# again 0xdd should be ignored
+SELECT MATCH(`a`) AGAINST (0x2261dd6122) FROM `t`;
+
+SELECT MATCH(`a`) AGAINST (0x2261dd612222226122) FROM `t`;
+
+DROP TABLE t;
+
+# InnoDB FTS does not support index scan from handler
+CREATE TABLE t(a CHAR(1),FULLTEXT KEY(a)) ENGINE=INNODB;
+HANDLER t OPEN;
+HANDLER t READ a NEXT;
+HANDLER t READ a PREV;
+DROP TABLE t;
+
+CREATE TABLE `%`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+CREATE TABLE `A B`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB;
+DROP TABLE `%`;
+DROP TABLE `A B`;
+
+CREATE TABLE `t-26`(a VARCHAR(10),FULLTEXT KEY(a)) ENGINE=INNODB;
+INSERT INTO `t-26` VALUES('117');
+DROP TABLE `t-26`;
+
+# Test on phrase search with stopwords contained in the search string
+CREATE TABLE `t1` (
+ `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ `content` TEXT NOT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT INDEX `IDX_CONTEXT_FULLTEXT`(`content`)
+)
+ENGINE = InnoDB;
+
+insert into t1 (content)
+values
+('This is a story which has has a complicated phrase structure here in the
+middle'),
+('This is a story which doesn''t have that text'),
+('This is a story that has complicated the phrase structure');
+
+select * from t1
+where match(content) against('"complicated phrase structure"' in boolean
+mode);
+
+# Test single phrase search with "+" symbol, one row should be returned
+select * from t1
+where match(content) against('+"complicated phrase structure"' in boolean
+mode);
+
+# Test phrase search with stopwords in between, one row should be returned
+select * from t1
+where match(content) against('"complicated the phrase structure"' in boolean
+mode);
+
+# Test phrase search with multiple "+" symbols
+select * from t1 where match(content) against('+"this is a story which" +"complicated the phrase structure"' in boolean mode);
+
+# Test phrase search with leading word is a stopword, such stopword would be
+# ignored
+select * from t1 where match(content) against('"the complicated the phrase structure"' in boolean mode);
+
+# Test phrase search with non-matching stopword in between, no row should be
+# returned
+select * from t1 where match(content) against('"complicated a phrase structure"' in boolean mode);
+
+DROP TABLE t1;
+
+CREATE TABLE my (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+c VARCHAR(32), FULLTEXT(c)) ENGINE = INNODB;
+
+INSERT INTO my (c) VALUES ('green-iguana');
+
+SELECT * FROM my WHERE MATCH(c) AGAINST ('green-iguana');
+
+DROP TABLE my;
+
+CREATE TABLE ift (
+ `a` int(11) NOT NULL,
+ `b` text,
+ PRIMARY KEY (`a`),
+ FULLTEXT KEY `b` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO ift values (1, "skip");
+INSERT INTO ift values (2, "skip and networking");
+INSERT INTO ift values (3, "--skip-networking");
+INSERT INTO ift values (4, "-donot--skip-networking");
+
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('--skip-networking');
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('skip-networking');
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('----');
+SELECT * FROM ift WHERE MATCH (b) AGAINST ('-donot--skip-networking');
+
+DROP TABLE ift;
+
+# Test special cases of wildword.
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('( that''s me )','When configured properly, MySQL ...');
+
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('( yours''s* )' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('s*' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('stands\'] | * | show[@database' IN NATURAL LANGUAGE MODE);
+
+DROP TABLE articles;
+
+# Test for BUG#16429688 - FTS: SYNTAX ERROR, UNEXPECTED '*', EXPECTING $END
+CREATE TABLE t1(a TEXT CHARACTER SET LATIN1, FULLTEXT INDEX(a)) ENGINE=INNODB;
+
+--error ER_PARSE_ERROR
+SELECT * FROM t1 WHERE MATCH(a) AGAINST("*");
+
+DROP TABLE t1;
+
+# Test for BUG#16516193 - LITERAL PHRASES CANNOT BE COMBINED WITH + OR - OPERATOR
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ FULLTEXT (a)
+ ) ENGINE= InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a) VALUES
+ ('Do you know MySQL is a good database'),
+ ('How to build a good database'),
+ ('Do you know'),
+ ('Do you know MySQL'),
+ ('How to use MySQL'),
+ ('Do you feel good'),
+ ('MySQL is good'),
+ ('MySQL is good to know'),
+ ('What is database');
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know mysql"' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql")' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('("know mysql" good)' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql" good)' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('(good "know mysql")' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+(good "know mysql")' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql" "good database")' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know mysql" +"good database"' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know database"@4' IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know database"@8' IN BOOLEAN MODE);
+
+# Drop table
+DROP TABLE t1;
+
+# Test for BUG#16885178 - INNODB FULLTEXT PHRASE SEARCH VALGRIND ERROR
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ FULLTEXT (a)
+ ) ENGINE= InnoDB;
+
+# Insert a special row
+INSERT INTO t1 (a) VALUES
+ ('know mysql good database');
+
+# This phrase search fails in valgrind test before the fix.
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"good database"' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+# Test single term ranking
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+# Repeatedly insert/delete records, the ranking should be the same for
+# each of them
+INSERT INTO articles (title,body) VALUES ('Test Article','blah blah
+blah'),("Matt's Noise",'this is noisy'),('February Weather','It was terrible
+this year.'),('Peter Pan','Tis a kids story.'),('Test1','nada'),('Database
+database database','foo database database database'),('Database article
+title','body with lots of words.'),('myfulltext database', 'my test fulltext
+database');
+
+SELECT id, title, body FROM articles ORDER BY MATCH (title,body) AGAINST ('database' IN BOOLEAN MODE) DESC;
+DELETE from articles WHERE title like "myfulltext database";
+
+INSERT INTO articles (title,body) VALUES ('myfulltext database', 'my test fulltext database');
+
+SELECT id, title, body FROM articles ORDER BY MATCH (title,body) AGAINST ('database' IN BOOLEAN MODE) DESC;
+DELETE from articles WHERE title like "myfulltext database";
+
+INSERT INTO articles (title,body) VALUES ('myfulltext database', 'my test fulltext database');
+
+SELECT id, title, body FROM articles ORDER BY MATCH (title,body) AGAINST ('database' IN BOOLEAN MODE) DESC;
+
+DROP TABLE articles;
+
+# Test for BUG 18277305 - FTS: FAILING ASSERTION: PTR[1] == '\"'
+# IN FTS_AST_CREATE_NODE_TEXT
+CREATE TABLE t1(
+ a TEXT CHARSET ujis COLLATE ujis_japanese_ci,
+ b TEXT CHARSET utf8mb4 COLLATE utf8mb4_turkish_ci,
+ c TEXT CHARSET eucjpms COLLATE eucjpms_bin,
+ d TEXT CHARSET utf8mb4,
+ FULLTEXT INDEX(a),
+ FULLTEXT INDEX(b),
+ FULLTEXT INDEX(c),
+ FULLTEXT INDEX(d)
+) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES
+ ('myisam', 'myisam', 'myisam', 'myisam'),
+ ('innodb', 'innodb', 'innodb', 'innodb'),
+ ('innodb myisam', 'innodb myisam', 'innodb myisam', 'innodb myisam'),
+ ('memory', 'memory', 'memory', 'memory'),
+ ('archive', 'archive', 'archive', 'archive'),
+ ('federated', 'federated', 'federated', 'federated'),
+ ('storage engine innodb', 'storage engine innodb', 'storage engine innodb', 'storage engine innodb'),
+ ('storage engine myisam', 'storage engine myisam', 'storage engine myisam', 'storage engine myisam'),
+ ('innobase', 'innobase', 'innobase', 'innobase'),
+ ('myisam innodb', 'myisam innodb', 'myisam innodb', 'myisam innodb'),
+ ('innodb myisam engines', 'innodb myisam engines', 'innodb myisam engines', 'innodb myisam engines');
+
+# Test the ujis_japanese_ci
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', ' ', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '&', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '&', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '%', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', '(', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', ')'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+--error ER_PARSE_ERROR
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+
+
+# Test the utf8mb4_turkish_ci
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', ' ', '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 0x00, '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', '&', 0x00, '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 0x00, '&', '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', '%', '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+--error ER_PARSE_ERROR
+SELECT b FROM t1 WHERE MATCH (b) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+
+# Test the eucjpms_bin
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', ' ', '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', '&', 0x00, '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, '&', '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', '%', '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', '(', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', ')'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm', '"'));
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+--error ER_PARSE_ERROR
+SELECT c FROM t1 WHERE MATCH (c) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+
+ALTER TABLE t1 ENGINE = MyISAM;
+
+# Test the query against myisam to verify
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', ' ', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, '"', 0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '&', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, '&', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', '%', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, 0x00, 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', 0x00, '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', '(', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', ')'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', 'm', 'y', 'i', 's', 'a', 'm', '"'));
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 0x00, 'i', 'n', 'n', 'o', 'd', 'b', '@', '$', 'm', 'y', 'i', 's', 'a', 'm', '%', 0x00, 0x00, '"','@', '2') IN BOOLEAN MODE);
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT('"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 'm', 'y', 'i', 's', 'a', 'm', '"','@', '4') IN BOOLEAN MODE);
+SELECT a FROM t1 WHERE MATCH (a) AGAINST (CONCAT(0x00, '"', 'i', 'n', 'n', 'o', 'd', 'b', ' ', '$', 's', 't', 'o', 'r', 'a', 'g', 'e', '"','@', '4', 0x00) IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+# Test for BUG#18229097 - FTS: DID NOT FIND WORD 0 IN DOC 39161 FOR QUERY EXPANSION SEARCH.
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ FULLTEXT (a)
+) ENGINE= InnoDB;
+
+INSERT INTO t1 (a) VALUES
+ ('know database'),('good database'), ('gmail email'), ('ghome windows');
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g *' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * k *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * k * d *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * go *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g * good' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('gm * go *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('good *' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH (a) AGAINST ('g* database' IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/misc_1.test b/mysql-test/suite/innodb_fts/t/misc_1.test
new file mode 100644
index 00000000..45eaf447
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/misc_1.test
@@ -0,0 +1,894 @@
+--source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
+--source include/no_valgrind_without_big.inc
+
+#------------------------------------------------------------------------------
+# FTS with FK and update cascade
+#-------------------------------------------------------------------------------
+set names utf8;
+
+call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
+call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`t1`");
+
+# Create FTS table
+CREATE TABLE t1 (
+ id1 INT ,
+ a1 VARCHAR(200) ,
+ b1 TEXT ,
+ FULLTEXT KEY (a1,b1), PRIMARY KEY (a1, id1)
+ ) CHARACTER SET = utf8 , ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+ id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a2 VARCHAR(200),
+ b2 TEXT ,
+ FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+ FULLTEXT KEY (b2,a2)
+ ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+ (1,'MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ (2,'How To Use MySQL Well','After you went through a ...'),
+ (3,'Optimizing MySQL','In this tutorial we will show ...');
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+ (4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ (5,'MySQL vs. YourSQL','In the following database comparison ...'),
+ (6,'MySQL Security','When configured properly, MySQL ...');
+
+# Insert rows in t2 fk table
+INSERT INTO t2 (a2,b2) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Insert rows t2 fk table
+INSERT INTO t2 (a2,b2) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# error on violating fk constraint
+--error 1452
+INSERT INTO t2 (a2,b2) VALUES
+ ('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+# error on delete from parent table
+--error 1451
+DELETE FROM t1;
+
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
+
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
+
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
+
+
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+
+set global innodb_optimize_fulltext_only=1;
+optimize table t1;
+set global innodb_optimize_fulltext_only=0;
+# Updating parent table hence child table should get updated due to 'update cascade' clause
+UPDATE t1 SET a1 = "changing column - on update cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+
+# no records expected
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+# InnoDB:Error child table shows records which is incorrect - UPADTE on Fix
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+
+# it shows updated record
+SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id1;
+# InnoDB:Error child table does not show the expected record
+SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id2;
+SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
+
+DROP TABLE t2 , t1;
+
+# on update cascade
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+ fulltext key(s2),
+ foreign key (s1,s2) references t1 (s1,s2) on update cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+# on delete cascade
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+ fulltext key(s2),
+ foreign key (s1,s2) references t1 (s1,s2) on delete cascade) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1 where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+# on delete set NULL
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+ fulltext key(s2),
+ foreign key (s1,s2) references t1 (s1,s2) on delete set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+delete from t1 where s2 <> 'Sunshine';
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+# on update set NULL
+create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (s1 int, s2 varchar(200),
+ fulltext key(s2),
+ foreign key (s1,s2) references t1 (s1,s2) on update set null) ENGINE = InnoDB;
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine';
+commit;
+select * from t2 where match(s2) against ('Lollipops');
+DROP TABLE t2 , t1;
+
+# When Doc ID is involved
+create table t1 (s1 bigint unsigned not null, s2 varchar(200),
+ primary key (s1,s2)) ENGINE = InnoDB;
+create table t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL, s2 varchar(200),
+ foreign key (FTS_DOC_ID) references t1 (s1)
+ on update cascade) ENGINE = InnoDB;
+
+create fulltext index idx on t2(s2);
+
+show create table t2;
+
+insert into t1 values (1,'Sunshine'),(2,'Lollipops');
+insert into t2 values (1,'Sunshine'),(2,'Lollipops');
+
+update t1 set s1 = 3 where s1=1;
+
+select * from t2 where match(s2) against ('sunshine');
+
+# FTS Doc ID cannot be reused
+--error 1451
+update t1 set s1 = 1 where s1=3;
+
+DROP TABLE t2 , t1;
+
+#------------------------------------------------------------------------------
+# FTS with FK and delete casecade
+#------------------------------------------------------------------------------
+
+# Create FTS table
+CREATE TABLE t1 (
+ id1 INT ,
+ a1 VARCHAR(200) PRIMARY KEY,
+ b1 TEXT character set utf8 ,
+ FULLTEXT KEY (a1,b1)
+ ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+ id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a2 VARCHAR(200),
+ b2 TEXT character set utf8 ,
+ FOREIGN KEY (a2) REFERENCES t1(a1) ON DELETE CASCADE,
+ FULLTEXT KEY (b2,a2)
+ ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+ (1,'MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ (2,'How To Use MySQL Well','After you went through a ...'),
+ (3,'Optimizing MySQL','In this tutorial we will show ...'),
+ (4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ (5,'MySQL vs. YourSQL','In the following database comparison ...'),
+ (6,'MySQL Security','When configured properly, MySQL ...');
+
+# Insert rows in t2
+INSERT INTO t2 (a2,b2) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# delete records from parent
+DELETE FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+
+# no records expected
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+
+SELECT * FROM t1 WHERE a1 LIKE '%tutorial%';
+SELECT * FROM t2 WHERE a2 LIKE '%tutorial%';
+
+DROP TABLE t2 , t1;
+
+#------------------------------------------------------------------------------
+# FTS with FK+transactions and UPDATE casecade with transaction
+#-------------------------------------------------------------------------------
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: FTS Doc ID must be larger than 3 for table `test`.`t2`");
+
+# Create FTS table
+CREATE TABLE t1 (
+ id1 INT ,
+ a1 VARCHAR(200) ,
+ b1 TEXT ,
+ FULLTEXT KEY (a1,b1), PRIMARY KEY(a1, id1)
+ ) CHARACTER SET = utf8 , ENGINE = InnoDB;
+
+CREATE TABLE t2 (
+ id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a2 VARCHAR(200),
+ b2 TEXT ,
+ FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE,
+ FULLTEXT KEY (b2,a2)
+ ) CHARACTER SET = utf8 ,ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+ (1,'MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ (2,'How To Use MySQL Well','After you went through a ...'),
+ (3,'Optimizing MySQL','In this tutorial we will show ...');
+
+# Insert rows in t2 fk table
+INSERT INTO t2 (a2,b2) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+START TRANSACTION;
+# Insert rows
+INSERT INTO t1 (id1,a1,b1) VALUES
+ (4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ (5,'MySQL vs. YourSQL','In the following database comparison ...'),
+ (6,'MySQL Security','When configured properly, MySQL ...');
+
+# Insert rows t2 fk table
+INSERT INTO t2 (a2,b2) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# error on violating fk constraint
+--error 1452
+INSERT INTO t2 (a2,b2) VALUES
+ ('MySQL Tricks','1. Never run mysqld as root. 2. ...');
+
+# error on DELETE FROM parent table
+--error 1451
+DELETE FROM t1;
+
+# records expected
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id1;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ORDER BY id2;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ;
+
+# no records as data not COMMITted.
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root') ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root') ;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('mysqld (+root)' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('mysqld (-root)' IN BOOLEAN MODE) ;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root' WITH QUERY EXPANSION) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root' WITH QUERY EXPANSION) ;
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ;
+
+SELECT * FROM t1 ORDER BY id1;
+SELECT * FROM t2 ORDER BY id2;
+
+COMMIT;
+
+START TRANSACTION;
+# Updating parent table hence child table should get updated due to 'UPDATE cascade' clause
+UPDATE t1 SET a1 = "changing column - on UPDATE cascade" , b1 = "to check foreign constraint" WHERE
+MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+COMMIT;
+
+# no records expected
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÐƷWİ)' IN BOOLEAN MODE) ;
+
+# it shows updated record
+SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id1;
+SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id2;
+SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2;
+
+DROP TABLE t2 , t1;
+
+
+# FTS with FK+transactions - UPDATE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions - on DELETE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions - DELETE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+# FTS with FK+transactions - UPDATE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+COMMIT;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+#-----------------------------------------------------------------------------
+
+# FTS with FK+transactions - UPDATE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions - DELETE cascade
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+# FTS with FK+transactions - DELETE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+DELETE FROM t1 WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+# FTS with FK+transactions - UPDATE SET NULL
+CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB;
+CREATE TABLE t2 (s1 INT, s2 VARCHAR(200),
+ FULLTEXT KEY(s2),
+ FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops');
+INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops');
+UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine';
+ROLLBACK;
+SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops');
+DROP TABLE t2 , t1;
+
+
+#------------------------------------------------------------------------------
+# FTS index with compressed row format
+#------------------------------------------------------------------------------
+
+# Save innodb variables
+let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+
+set global innodb_file_per_table=1;
+
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) CHARACTER SET = utf8, ROW_FORMAT=COMPRESSED, ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase VÐƷWİ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Check whether individual space id created for AUX tables
+SELECT count(*) FROM information_schema.innodb_sys_tables WHERE name LIKE "%FTS_%" AND space !=0;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
+
+# boolean mode
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÐƷWİ" IN BOOLEAN MODE);
+--error ER_PARSE_ERROR
+select * from t1 where MATCH(a,b) AGAINST("+-VÐƷWİ" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
+select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1 ORDER BY id;
+select * from t1 where MATCH a,b AGAINST ("+database* +VÐƷW*" IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
+
+# query expansion
+select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
+
+# Drop index
+ALTER TABLE t1 DROP INDEX idx;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+-- disable_query_log
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+-- enable_query_log
+
+# Select word "tutorial" in the table
+SELECT * FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
+
+# boolean mode
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÐƷWİ" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+dbms" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id;
+select *, MATCH(a,b) AGAINST("mysql VÐƷWİ" IN BOOLEAN MODE) as x from t1 ORDER BY id;
+# Innodb:Assert eval0eval.c line 148
+#select * from t1 where MATCH a,b AGAINST ("+database* +VÐƷWİ*" IN BOOLEAN MODE);
+select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE);
+
+# query expansion
+select * from t1 where MATCH(a,b) AGAINST ("VÐƷWİ" WITH QUERY EXPANSION) ORDER BY id;
+
+
+# insert for proximity search
+INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...');
+# Insert into table with similar word of different distances
+INSERT INTO t1 (a,b) VALUES
+ ('test proximity search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+ ('test proximity fts search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO t1 (a,b) VALUES
+ ('test more proximity fts search, test, more proximity and phrase',
+ 'search, with proximity innodb');
+
+# This should only return the first document
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"proximity search"@1' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"proximity search"@3' IN BOOLEAN MODE) ORDER BY id;
+
+# Similar boundary testing for the words
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"test proximity"@5' IN BOOLEAN MODE) ORDER BY id;
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"more test proximity"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"more fts proximity"@03' IN BOOLEAN MODE);
+
+
+UPDATE t1 SET a = UPPER(a) , b = UPPER(b) ;
+UPDATE t1 SET a = UPPER(a) , b = LOWER(b) ;
+
+select * from t1 where MATCH(a,b) AGAINST("+tutorial +dbms" IN BOOLEAN MODE);
+select * from t1 where MATCH(a,b) AGAINST("+VÐƷWİ" IN BOOLEAN MODE);
+
+SELECT * FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id;
+
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"proximity search"@14' IN BOOLEAN MODE);
+
+
+SELECT * FROM t1 WHERE MATCH (a,b)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM t1 ORDER BY id;
+
+DROP TABLE t1;
+eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
+
+#------------------------------------------------------------------------------
+# FTS index with utf8 character testcase
+#------------------------------------------------------------------------------
+
+# Create FTS table
+EVAL CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) CHARACTER SET = utf8, ENGINE=InnoDB;
+
+
+# Insert rows from different languages
+INSERT INTO t1 (a,b) VALUES
+('Я могу есть стекло', 'оно мне не вредит'),
+('Мога да ям стъкло', 'то не ми вреди'),
+('Μπορῶ νὰ φάω σπασμένα' ,'γυαλιὰ χωρὶς νὰ πάθω τίποτα'),
+('Příliš žluťoučký kůň', 'úpěl ďábelské kódy'),
+('Sævör grét', 'áðan því úlpan var ónýt'),
+('うゐのおくやま','けふこえて'),
+('いろはにほへど ちりぬる','あさきゆめみじ ゑひもせず');
+
+# insert english text
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL Tutorial','request docteam@oraclehelp.com ...') ,
+ ('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...') ,
+ ('when To Use MySQL Well','for free faq mail@xyz.com ...');
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# FTS Queries
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωρὶς") ORDER BY id;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("оно" WITH QUERY EXPANSION);
+
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE) ORDER BY id;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+γυαλιὰ +tutorial" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+tutorial +(Мога τίποτα)" IN BOOLEAN MODE);
+
+# Innodb:error - no result returned (update result of query once fixed) (innodb limit , does not understand character boundry for japanses like charcter set)
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("ちりぬる" WITH QUERY EXPANSION);
+
+# Innodb:error - no result returned (update result of query once fixed) (innodb limit , does not understand character boundry for japanses like charcter set)
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("+あさきゆめみじ +ゑひもせず" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("うゐのおく*" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"γυαλιὰ χωρὶς"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"query performace"@02' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"πάθω τίποτα"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"あさきゆめみじ ゑひもせず"@1' IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"あさきゆめみじ ゑひもせず"@2' IN BOOLEAN MODE);
+
+ALTER TABLE t1 DROP INDEX idx;
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Innodb:error - no result returned (update result of query once fixed) (innodb limit , does not understand character boundry for japanses like charcter set)
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+# Update fails because where condition do not succeed which is incorrect (update result of query once fixed)
+UPDATE t1 SET a = "Pchnąć w tę łódź jeża" , b = "lub osiem skrzyń fig" WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+UPDATE t1 SET a = "В чащах юга жил-был цитрус? Да", b = "но фальшивый экземпляр! ёъ" WHERE MATCH(a,b) AGAINST ("вред*" IN BOOLEAN MODE);
+DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
+
+# Innodb error - no result returned
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("あさきゆめみじ ゑひもせず");
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("łódź osiem");
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE) ORDER BY id;
+SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE);
+
+SELECT * FROM t1
+ WHERE MATCH (a,b)
+ AGAINST ('"łódź jeża"@2' IN BOOLEAN MODE);
+
+SELECT * FROM t1 ORDER BY id;
+DROP TABLE t1;
+
+# This is to test the update operation on FTS indexed and non-indexed
+# column
+CREATE TABLE t1(ID INT PRIMARY KEY,
+ no_fts_field VARCHAR(10),
+ fts_field VARCHAR(10),
+ FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+
+# Update FULLTEXT indexed column, Doc ID will be updated
+UPDATE t1 SET fts_field='anychange' where id = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# Update non-FULLTEXT indexed column, Doc ID stay to be the same
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# Update both FULLTEXT indexed and non-indexed column, Doc ID will be updated
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+
+# FTS index dropped, the DOC_ID column is kept, however, the ID will not
+# change
+DROP INDEX f on t1;
+
+UPDATE t1 SET fts_field='anychange' where id = 1;
+
+UPDATE t1 SET no_fts_field='anychange' where id = 1;
+
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1;
+
+CREATE FULLTEXT INDEX f ON t1(FTS_FIELD);
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+
+DROP TABLE t1;
+
+# Test on user supplied 'FTS_DOC_ID'
+CREATE TABLE t1(`FTS_DOC_ID` serial,
+ no_fts_field VARCHAR(10),
+ fts_field VARCHAR(10),
+ FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+
+# Doc ID must be updated as well (HA_FTS_INVALID_DOCID).
+--error 182
+UPDATE t1 SET fts_field='anychange' where FTS_DOC_ID = 1;
+
+UPDATE t1 SET fts_field='anychange', FTS_DOC_ID = 2 where FTS_DOC_ID = 1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# "BBB" should be marked as deleted.
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange");
+
+# "HA_FTS_INVALID_DOCID"
+--error 182
+UPDATE t1 SET no_fts_field='anychange', fts_field='other' where FTS_DOC_ID = 2;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("other");
+
+# Doc ID must be monotonically increase (HA_FTS_INVALID_DOCID)
+--error 182
+UPDATE t1 SET FTS_DOC_ID = 1 where FTS_DOC_ID = 2;
+
+DROP INDEX f ON t1;
+
+# After FULLTEXT index dropped, we can update the fields freely
+UPDATE t1 SET fts_field='newchange' where FTS_DOC_ID = 2;
+
+UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2;
+
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1(ID INT PRIMARY KEY,
+ no_fts_field VARCHAR(10),
+ fts_field VARCHAR(10),
+ FULLTEXT INDEX f(fts_field), index k(fts_field)) ENGINE=INNODB;
+
+CREATE TABLE t2(ID INT PRIMARY KEY,
+ no_fts_field VARCHAR(10),
+ fts_field VARCHAR(10),
+ FULLTEXT INDEX f(fts_field),
+ INDEX k2(fts_field),
+ FOREIGN KEY(fts_field) REFERENCES
+ t1(fts_field) ON UPDATE CASCADE) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 'AAA', 'BBB');
+
+INSERT INTO t2 VALUES (1, 'AAA', 'BBB');
+
+update t1 set fts_field='newchange' where id =1;
+
+SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("BBB");
+SELECT * FROM t1 WHERE MATCH(fts_field) against("newchange");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("newchange");
+
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+# Testcases adopted from innodb_multi_update.test
+
+CREATE TABLE t1(id INT PRIMARY KEY,
+ fts_field VARCHAR(10),
+ FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+
+CREATE TABLE t2(id INT PRIMARY KEY,
+ fts_field VARCHAR(10),
+ FULLTEXT INDEX f(fts_field)) ENGINE=INNODB;
+
+INSERT INTO t1 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800'),(9,'900'),(10,'1000'),(11,'1100'),(12,'1200');
+INSERT INTO t2 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800');
+
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo');
+
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo') WHERE t1.fts_field = "100foo";
+
+# Update two tables in the same statement
+UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'xoo'), t2.fts_field = CONCAT(t1.fts_field, 'xoo') where t1.fts_field=CONCAT(t2.fts_field, 'foo');
+
+# Following selects shows whether the correct Doc ID are updated
+
+# This row should present in table t1
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foofoo");
+
+# Following rows should be dropped
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100foo");
+SELECT * FROM t1 WHERE MATCH(fts_field) against("100");
+
+# This row should present in table t2
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400fooxoo");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("100");
+
+# Follow rows should be marked as dropped
+SELECT * FROM t2 WHERE MATCH(fts_field) against("200");
+SELECT * FROM t2 WHERE MATCH(fts_field) against("400");
+
+
+DROP TABLE t1;
+
+DROP TABLE t2;
+
+
+--echo
+--echo BUG#13701973/64274: MYSQL THREAD WAS SUSPENDED WHEN EXECUTE UPDATE QUERY
+--echo
+# FTS setup did not track which tables it had already looked at to see whether
+# they need initialization. Hilarity ensued when hitting circular dependencies.
+
+SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
+
+CREATE TABLE t1 (
+ t1_id INT(10) UNSIGNED NOT NULL,
+ t2_id INT(10) UNSIGNED DEFAULT NULL,
+ PRIMARY KEY (t1_id),
+ FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ t1_id INT(10) UNSIGNED NOT NULL,
+ t2_id INT(10) UNSIGNED NOT NULL,
+ t3_id INT(10) UNSIGNED NOT NULL,
+ t4_id INT(10) UNSIGNED NOT NULL,
+ PRIMARY KEY (t2_id),
+ FOREIGN KEY (t1_id) REFERENCES t1 (t1_id),
+ FOREIGN KEY (t3_id) REFERENCES t3 (t3_id)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ FOREIGN KEY (t4_id) REFERENCES t4 (t4_id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t3 (
+ t3_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ payload char(3),
+ PRIMARY KEY (t3_id)
+) ENGINE=InnoDB;
+
+INSERT INTO t3 VALUES (1, '100');
+
+CREATE TABLE t4 (
+ t2_id INT(10) UNSIGNED DEFAULT NULL,
+ t4_id INT(10) UNSIGNED NOT NULL,
+ PRIMARY KEY (t4_id),
+ FOREIGN KEY (t2_id) REFERENCES t2 (t2_id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+SET FOREIGN_KEY_CHECKS=1;
+
+UPDATE t3 SET payload='101' WHERE t3_id=1;
+
+SET FOREIGN_KEY_CHECKS=0;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
diff --git a/mysql-test/suite/innodb_fts/t/opt.opt b/mysql-test/suite/innodb_fts/t/opt.opt
new file mode 100644
index 00000000..d7d47164
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/opt.opt
@@ -0,0 +1 @@
+--query_cache_type=0
diff --git a/mysql-test/suite/innodb_fts/t/opt.test b/mysql-test/suite/innodb_fts/t/opt.test
new file mode 100644
index 00000000..19dfdcad
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/opt.test
@@ -0,0 +1,1086 @@
+--source include/have_innodb.inc
+
+#
+# Tests for optimizations for InnoDB fulltext search (WL#6043)
+#
+
+CREATE TABLE wp(
+ FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ title VARCHAR(255) NOT NULL DEFAULT '',
+ text MEDIUMTEXT NOT NULL,
+ dummy INTEGER,
+ PRIMARY KEY (FTS_DOC_ID),
+ UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+ FULLTEXT KEY idx (title,text)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO wp (title, text) VALUES
+ ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database to database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+CREATE TABLE t1 (i INTEGER);
+INSERT INTO t1 SELECT FTS_DOC_ID FROM wp;
+
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE t1;
+SET STATEMENT use_stat_tables=never FOR
+ANALYZE TABLE wp;
+
+--disable_ps2_protocol
+
+#
+# Show results of MATCH expressions for reference
+#
+SELECT FTS_DOC_ID, title, MATCH(title, text) AGAINST ('database') AS score1,
+ MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp;
+
+#
+# Test that filesort is not used if ordering on same match expression
+# as where clause
+#
+--echo No sorting for this query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No sorting for this query even if MATCH is part of an expression
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database') > 0.1
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No sorting even if there are several MATCH expressions as long as the
+--echo right one is used in ORDER BY
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score1,
+ MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score1 DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No Sorting since FT table is first table in query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp, t1
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID = t1.i
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since there is no WHERE clause
+FLUSH STATUS;
+
+--sorted_result
+SELECT MATCH(title, text) AGAINST ('database'), title AS score
+FROM wp
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering on multiple columns
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC, FTS_DOC_ID;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering is not descending
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score ASC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting because one is ordering on a different MATCH expression
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('mysql') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+#
+# Tests for ORDER BY/LIMIT optimzation
+#
+--echo No sorting for this query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo Revert to table scan and sorting for this query since not
+--echo enough matching rows to satisfy LIMIT clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since no LIMIT clause
+FLUSH STATUS;
+
+--sorted_result
+SELECT MATCH(title, text) AGAINST ('database') AS score, title
+FROM wp
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since there is a WHERE clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE dummy IS NULL
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering is not on a simple MATCH expressions
+FLUSH STATUS;
+
+SELECT title, (MATCH(title, text) AGAINST ('database')) * 100 AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+#
+# Test that there is no row accesses if all necessary information is
+# available in FTS result
+#
+--echo No ordinary handler accesses when only accessing FTS_DOC_ID and MATCH
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Still no handler accesses when adding FTS_DOC_ID to WHERE clause
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID > 2;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Still no handler accesses when ordering by MATCH expression
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization is disabled when ordering on FTS_DOC_ID
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY 1 DESC;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization also work with several MATCH expressions
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+ MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization does not apply if sorting on a different MATCH expressions
+--echo from the one used to access the
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+ MATCH(title, text) AGAINST ('mysql') AS score2
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score2 DESC;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+FLUSH STATUS;
+
+--echo Optimization does not apply for GROUP BY
+SET @save_mode = @@sql_mode;
+SET sql_mode = (select replace(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+GROUP BY score;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+SET sql_mode = @save_mode;
+
+#
+# Putting all three optimizations together
+#
+--echo No sorting and no table access with LIMIT clause and only information
+--echo from FTS result
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+#
+# Count optimization
+#
+let $query =
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo If count optimization applies, EXPLAIN shows
+--echo "Select tables optimized away."
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+--echo Verify that there was no table access
+SHOW STATUS LIKE 'Handler_read%';
+
+let $query =
+SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo Optimization applies also to COUNT(expr) as long as expr is not nullable
+eval EXPLAIN $query;
+eval $query;
+
+let $query =
+SELECT count(*)
+FROM wp, t1
+WHERE MATCH(title, text) AGAINST ('database');
+
+--echo Optimization does not apply if not a single table query.
+eval EXPLAIN $query;
+eval $query;
+
+let $query =
+SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+
+--echo Optimization does not apply if MATCH is part of an expression
+eval EXPLAIN $query;
+eval $query;
+
+let $query =
+SELECT COUNT(title)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+
+--echo Optimization does not apply if MATCH is part of an expression
+eval EXPLAIN $query;
+eval $query;
+
+let $query =
+SELECT COUNT(dummy)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo Optimization does not apply if COUNT expression is nullable
+eval EXPLAIN $query;
+eval $query;
+
+#
+# Verify that the queries optimized for InnoDB works with QUERY EXPANSION
+#
+
+# Query will also avoid sorting when query expansion is used
+FLUSH STATUS;
+--sorted_result
+SELECT MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score,
+title
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+ MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+ MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+ MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query =
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+#
+# Verify that the queries optimized for InnoDB works with BOOLEAN MODE
+#
+
+# Query will also avoid sorting when Boolean mode is used
+FLUSH STATUS;
+--sorted_result
+SELECT MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) score,
+title
+FROM wp
+WHERE MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+--sorted_result
+SELECT MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) score,
+title
+FROM wp
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+ MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('+MySQL -database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+ MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query =
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+
+#
+# Verify that the queries optimized for InnoDB works with
+# BOOLEAN proximity search
+#
+
+# Query will also avoid sorting when Boolean mode is used
+FLUSH STATUS;
+SELECT title,
+ MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+ MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+ MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+ MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE) AS score
+FROM wp
+ORDER BY score DESC LIMIT 1;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query =
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+#
+# Check that nothing goes wrong when combining different modes
+#
+SELECT title,
+ MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC, title ASC;
+
+SELECT title,
+ MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('MySQL database' WITH QUERY EXPANSION)
+ORDER BY score DESC, title ASC;
+
+SELECT title,
+ MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@5' IN BOOLEAN MODE)
+ORDER BY score DESC, title ASC;
+
+
+#
+# Verify that the queries optimized for InnoDB still works with MyISAM
+#
+ALTER TABLE wp ENGINE=myisam;
+
+# Check avoid sorting query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+WHERE MATCH(title, text) AGAINST ('database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score
+FROM wp
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query =
+SELECT COUNT(*)
+FROM wp
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+
+DROP TABLE wp, t1;
+
+--enable_ps2_protocol
+
+# Tests for FT hints.
+
+CREATE TABLE t1
+(
+ FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ title VARCHAR(255) DEFAULT '',
+ text MEDIUMTEXT ,
+ PRIMARY KEY (FTS_DOC_ID),
+ UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+ FULLTEXT KEY ft_idx (title,text)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+INSERT INTO t1 (title, text) VALUES
+ ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL database','In the following database to database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...'),
+ ('InnoDB', 'InnoDB is a transaction-safe (ACID compliant) storage engine'),
+ ('MySQL is a database management system', 'A database is a structured collection of data...'),
+ ('MySQL databases are relational', 'A relational database stores data in separate tables rather than putting all the data in one big storeroom...'),
+ ('MySQL software is Open Source', 'Open Source means that it is possible for anyone to use and modify the software...'),
+ ('The MySQL Database Server is very fast, reliable, scalable, and easy to use', 'MySQL Server can run comfortably on a desktop or laptop...'),
+ ('MySQL Server works in client/server or embedded systems', 'The MySQL Database Software is a client/server system...'),
+ ('MyISAM', 'MyISAM is based on the older (and no longer available) ISAM storage engine but has many useful extensions'),
+ ('A large amount of contributed MySQL software is available', 'MySQL Server has a practical set of features developed in close cooperation with our users'),
+ (NULL,NULL);
+
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+
+--echo # No ranking
+
+EXPLAIN
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE);
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE);
+
+# Atm opt_sum_query does not support COUNT optimization if
+# ORDER BY is present. TODO: fix it.
+EXPLAIN
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('data*' IN BOOLEAN MODE) ORDER BY title LIMIT 3;
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('data*' IN BOOLEAN MODE) ORDER BY title LIMIT 3;
+
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION);
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION);
+
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE);
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE);
+
+# check case with 'for' stopword
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+for' IN BOOLEAN MODE);
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+for' IN BOOLEAN MODE);
+
+
+--echo # No sorting by rank
+
+EXPLAIN SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY title;
+SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY title;
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE);
+
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title;
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title;
+
+EXPLAIN
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title;
+SELECT FTS_DOC_ID, title FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title;
+
+--echo # LIMIT optimization
+
+EXPLAIN SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+LIMIT 3;
+SELECT FTS_DOC_ID, TITLE FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+LIMIT 3;
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+LIMIT 3;
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+LIMIT 3;
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+ORDER BY title
+LIMIT 3;
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+fast +database' IN BOOLEAN MODE)
+ORDER BY title
+LIMIT 3;
+
+
+EXPLAIN
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title LIMIT 1;
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) ORDER BY title LIMIT 1;
+
+EXPLAIN
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title LIMIT 1;
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('"very fast"@3' IN BOOLEAN MODE) ORDER BY title LIMIT 1;
+
+EXPLAIN
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank, FTS_DOC_ID
+LIMIT 3;
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank, FTS_DOC_ID
+LIMIT 3;
+
+EXPLAIN
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank DESC, FTS_DOC_ID ASC
+LIMIT 3;
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1 WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY rank DESC, FTS_DOC_ID ASC
+LIMIT 3;
+
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+
+EXPLAIN SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 3;
+SELECT FTS_DOC_ID, MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 3;
+
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE)
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC,
+FTS_DOC_ID ASC;
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE)
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC,
+FTS_DOC_ID ASC;
+
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) and FTS_DOC_ID > 1
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC
+LIMIT 2;
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) and FTS_DOC_ID > 1
+ORDER BY MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) DESC
+LIMIT 2;
+
+
+EXPLAIN
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank
+LIMIT 1;
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank
+LIMIT 1;
+
+EXPLAIN
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank DESC
+LIMIT 1;
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY rank DESC
+LIMIT 1;
+
+
+EXPLAIN
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+LIMIT 1;
+SELECT FTS_DOC_ID,MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) as rank
+FROM t1 WHERE MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION)
+ORDER BY MATCH(title, text) AGAINST ('+very +fast' WITH QUERY EXPANSION) DESC
+LIMIT 1;
+
+--echo # WHERE optimization on MATCH > 'some_rank'
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) > 0.1;
+
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) > 0.1;
+
+
+--echo # additional test for correct behaviour
+
+EXPLAIN SELECT * FROM t1 ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC LIMIT 10;
+
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) AND
+MATCH (title, text) AGAINST ('mysql' IN NATURAL LANGUAGE MODE)
+LIMIT 6;
+
+--echo # test OR condition
+
+SELECT FTS_DOC_ID
+FROM t1
+WHERE MATCH(title, text) AGAINST ('database')
+ OR MATCH(title, text) AGAINST ('mysql')
+ORDER BY MATCH(title, text) AGAINST ('database') DESC, FTS_DOC_ID ASC;
+
+EXPLAIN SELECT FTS_DOC_ID
+FROM t1
+WHERE MATCH(title, text) AGAINST ('database')
+ OR MATCH(title, text) AGAINST ('mysql')
+ORDER BY MATCH(title, text) AGAINST ('database') DESC, FTS_DOC_ID ASC;
+
+--echo # MATCH and GROUP BY, DISTINCT
+
+SET sql_mode = (select replace(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY FTS_DOC_ID
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY FTS_DOC_ID
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY title
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+GROUP BY title
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+
+EXPLAIN SELECT MAX(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+SELECT MAX(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+
+EXPLAIN SELECT DISTINCT(title) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+SELECT DISTINCT(title) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+
+EXPLAIN SELECT DISTINCT(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+SELECT DISTINCT(FTS_DOC_ID) FROM t1
+WHERE MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE)
+ORDER BY MATCH (title, text) AGAINST ('fast database' IN NATURAL LANGUAGE MODE) DESC
+LIMIT 3;
+
+SET sql_mode = @save_mode;
+
+--echo # FTS index access
+
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+EXPLAIN SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) as rank
+FROM t1
+ORDER BY rank DESC
+LIMIT 2;
+
+SELECT a.FTS_DOC_ID, b.FTS_DOC_ID
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+ MATCH(b.title, b.text) AGAINST ('+mysql' IN BOOLEAN MODE) and
+ a.FTS_DOC_ID = b.FTS_DOC_ID;
+EXPLAIN SELECT a.FTS_DOC_ID, b.FTS_DOC_ID
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+ MATCH(b.title, b.text) AGAINST ('+mysql' IN BOOLEAN MODE) and
+ a.FTS_DOC_ID = b.FTS_DOC_ID;
+
+SELECT a.FTS_DOC_ID, MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE),
+ b.FTS_DOC_ID, MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE)
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+ MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE);
+
+EXPLAIN SELECT a.FTS_DOC_ID, MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE),
+ b.FTS_DOC_ID, MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE)
+FROM t1 a, t1 b
+WHERE MATCH(a.title, a.text) AGAINST ('+database' IN BOOLEAN MODE) and
+ MATCH(b.title, b.text) AGAINST ('+database' IN BOOLEAN MODE);
+
+# Index only access by non-FTS index
+
+EXPLAIN SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100;
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100
+FROM t1 WHERE MATCH(title, text) AGAINST ("data*" IN BOOLEAN MODE) * 100;
+# Run query returning null record
+SELECT * FROM t1 WHERE title IS NULL AND text IS NULL;
+
+# More testing of index only access by non-FTS index
+
+CREATE TABLE t2 SELECT FTS_DOC_ID as doc_id, title, text FROM t1;
+ALTER TABLE t2 ADD PRIMARY KEY (doc_id);
+ALTER TABLE t2 ADD FULLTEXT KEY ft_idx (title,text);
+
+-- disable_result_log
+ANALYZE TABLE t2;
+-- enable_result_log
+
+# No index access
+EXPLAIN SELECT DOC_ID FROM t2 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+SELECT DOC_ID FROM t2 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+# Index access
+EXPLAIN SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+SELECT FTS_DOC_ID FROM t1 WHERE MATCH(title, text) AGAINST ('+database' IN BOOLEAN MODE) * 100;
+
+DROP TABLE t1, t2;
+
+--echo "Check hints with uft8 charset for 2 cases"
+set names utf8;
+EVAL CREATE TABLE t1 (
+ FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ text TEXT
+ ) CHARACTER SET = utf8, ENGINE=InnoDB;
+
+INSERT INTO t1 (title, text) VALUES
+('Я могу есть стекло', 'оно мне не вредит'),
+('Мога да ям стъкло', 'то не ми вреди'),
+('Μπορῶ νὰ φάω σπασμένα' ,'γυαλιὰ χωρὶς νὰ πάθω τίποτα'),
+('Příliš žluťoučký kůň', 'úpěl ďábelské kódy'),
+('Sævör grét', 'áðan því úlpan var ónýt'),
+('うゐのおくやま','けふこえて'),
+('いろはにほへど ちりぬる','あさきゆめみじ ゑひもせず');
+CREATE FULLTEXT INDEX idx on t1 (title, text);
+
+--echo # No ranking
+
+EXPLAIN
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('вредит' IN NATURAL LANGUAGE MODE);
+SELECT count(*) FROM t1 WHERE MATCH (title, text) AGAINST ('вредит' IN NATURAL LANGUAGE MODE);
+
+EXPLAIN
+SELECT * FROM t1 WHERE MATCH(title, text) AGAINST ("оно" WITH QUERY EXPANSION);
+SELECT * FROM t1 WHERE MATCH(title, text) AGAINST ("оно" WITH QUERY EXPANSION);
+--echo # No sorting by rank
+EXPLAIN SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+(Мога τίποτα)' IN BOOLEAN MODE);
+SELECT FTS_DOC_ID FROM t1
+WHERE MATCH(title, text) AGAINST ('+(Мога τίποτα)' IN BOOLEAN MODE);
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #18924341 CRASH IN TEST_IF_SKIP_SORT_ORDER, GROUP BY MATCH AGAINST DESC
+--echo #
+
+CREATE TABLE t1 (f1 CHAR(1), FULLTEXT KEY (f1));
+SELECT 1 FROM t1 NATURAL JOIN t1 a GROUP BY MATCH(t1.f1) AGAINST ("1") DESC;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#20261601 ASSERTION FAILED: !FIRST_QEP_TAB->TABLE()->NO_KEYREAD
+--echo #
+
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(1),(2);
+--error ER_FT_MATCHING_KEY_NOT_FOUND
+SELECT (SELECT MATCH(`a`)AGAINST('1') FROM t1) FROM t1;
+SELECT 1, a IN (SELECT a FROM t1) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#20442572 ASSERTION `!FIRST_QEP_TAB->TABLE()->NO_KEYREAD' FAILED.
+--echo # Bug#75688 Assertion `!first_qep_tab->table()->no_keyread' failed.
+--echo #
+
+CREATE TABLE t1(a INT,b POINT NOT NULL,KEY(a));
+
+HANDLER t1 OPEN;
+#--error ER_FT_MATCHING_KEY_NOT_FOUND
+select * from t1 where MATCH a,b AGAINST('"Now sUPPort"' IN BOOLEAN MODE);
+prepare stmt1 from "truncate t1";
+SELECT a IN(SELECT a FROM t1)FROM t1;
+
+deallocate prepare stmt1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug #20685427 INVALID WRITE OF FREED MEMORY IN ITEM_FUNC_MATCH::CLEANUP
+--echo #
+
+CREATE TABLE t1(a TEXT CHARSET LATIN1, FULLTEXT KEY(a)) ENGINE=INNODB;
+--error ER_FT_MATCHING_KEY_NOT_FOUND
+SELECT MATCH(a) AGAINST ('') FROM (SELECT a FROM t1 LIMIT 1) q;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#21140067 EXPLAIN .. MATCH AGAINST: ASSERTION FAILED: TO <= END
+--echo #
+
+CREATE TABLE t1(f1 CHAR(1) CHARSET latin1, FULLTEXT(f1)) ENGINE=INNODB;
+EXPLAIN SELECT 1 FROM t1 WHERE 1.238585e+308 <= MATCH(f1) AGAINST ('1' IN BOOLEAN MODE);
+
+EXPLAIN FORMAT = JSON SELECT 1 FROM t1 WHERE 1.238585e+308 <= MATCH(f1) AGAINST ('1' IN BOOLEAN MODE);
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#21140088 MATCH AGAINST: ASSERTION FAILED: !TABLE || (!TABLE->READ_SET || BITMAP_IS_SET
+--echo #
+
+SET sql_mode='';
+CREATE TABLE t1(a INT) ENGINE=INNODB;
+CREATE TABLE t2(b TEXT CHARSET LATIN1, FULLTEXT(b), PRIMARY KEY(b(10))) ENGINE=INNODB;
+INSERT INTO t2 VALUES ('a'),('b');
+--error ER_WRONG_ARGUMENTS
+SELECT NOT EXISTS (SELECT MATCH(b) AGAINST ('1') FROM t1) FROM t2 GROUP BY "a";
+DROP TABLE t1, t2;
+
+CREATE TABLE t1(a INT) ENGINE=MyISAM;
+CREATE TABLE t2(b TEXT CHARSET LATIN1, FULLTEXT(b), PRIMARY KEY(b(10))) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('a'),('b');
+#--error ER_WRONG_ARGUMENTS
+SELECT NOT EXISTS (SELECT MATCH(b) AGAINST ('1' in BOOLEAN MODE) FROM t1) FROM t2 GROUP BY "a";
+DROP TABLE t1, t2;
+
+SET sql_mode=default;
+
+--echo #
+--echo # Bug#21140039 ASSERTION FAILED: !FIRST_QEP_TAB->TABLE()->NO_KEYREAD MATCH AGAINST.....
+--echo #
+
+CREATE TABLE t1
+(
+ a INT,
+ b INT,
+ c CHAR(1) CHARSET latin1,
+ PRIMARY KEY (b,a),
+ FULLTEXT KEY (c)
+) ENGINE=INNODB;
+SELECT "a" NOT IN(SELECT b FROM t1 WHERE MATCH(c) AGAINST ('a' IN BOOLEAN MODE));
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#21300774 ASSERT `!INIT_FTFUNCS(THD, SELECT_LEX)` IN JOIN::RESET AT SQL/SQL_SELECT.CC:874
+--echo #
+
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+CREATE TABLE t2 (ft TEXT, FULLTEXT KEY ft(ft));
+INSERT INTO t2 VALUES ('abc');
+INSERT INTO t2 VALUES ('def');
+
+--error ER_SUBQUERY_NO_1_ROW
+UPDATE t1 SET f1 =
+(SELECT t1.f1 FROM t2 WHERE NOT TRUE AND
+ MATCH (ft) AGAINST ((SELECT 'xyz' FROM t2)));
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#22679209: FULL-TEXT QUERIES WITH ADDITIONAL SECONDARY INDEX
+--echo # GIVES NULL OR ZERO ROWS
+--echo #
+
+CREATE TABLE t1 (
+f1 INTEGER,
+title varchar(255),
+body mediumtext,
+KEY f1 (f1),
+FULLTEXT KEY title (title),
+FULLTEXT KEY body (body)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1, 'Insert into table', 'insert into table select from'),
+(1, 'Delete from table', 'insert into table select from'),
+(1, 'Update', 'perform update'),
+(2, 'Insert into table', 'insert into table select from'),
+( 2, 'Delete from table', 'some body text here'),
+( 2, 'Update', 'perform update'),
+( 3, 'Insert into table', 'insert into table select from'),
+( 3, 'Delete from table', 'some body text here');
+
+SELECT f1 FROM t1 WHERE f1=1 AND
+(MATCH (title) AGAINST ('table' IN BOOLEAN MODE) OR
+MATCH (body) AGAINST ('table' IN BOOLEAN MODE));
+
+DROP TABLE t1;
+
+--echo # End of test for Bug#22679209
diff --git a/mysql-test/suite/innodb_fts/t/phrase.opt b/mysql-test/suite/innodb_fts/t/phrase.opt
new file mode 100644
index 00000000..7724f976
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/phrase.opt
@@ -0,0 +1,2 @@
+--innodb-ft-index-cache
+--innodb-ft-index-table
diff --git a/mysql-test/suite/innodb_fts/t/phrase.test b/mysql-test/suite/innodb_fts/t/phrase.test
new file mode 100644
index 00000000..fb0d29f3
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/phrase.test
@@ -0,0 +1,39 @@
+-- source include/have_innodb.inc
+
+#
+# BUG#20465273 - FULLTEXT SEARCH BEHAVIOUR WITH MYISAM VS. INNODB (WRONG RESULT WITH INNODB)
+#
+
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+) ENGINE=InnoDB;
+
+INSERT INTO articles (title,body) VALUES
+ (NULL, 'mysql good database'),
+ (NULL, ' mysql good database'),
+ ('', 'mysql good database'),
+ ('', ' mysql good database'),
+ (' ', 'mysql good database'),
+ ('mysql', 'good database'),
+ ('mysql ', 'good database'),
+ ('mysql', ' good database'),
+ ('mysql good database', ''),
+ ('mysql good database', NULL);
+
+
+SET GLOBAL innodb_ft_aux_table="test/articles";
+SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+SET GLOBAL innodb_ft_aux_table=default;
+
+SELECT * FROM articles;
+
+SELECT * FROM articles WHERE MATCH(title, body)
+ AGAINST('"mysql good database"' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH(title, body)
+ AGAINST('("mysql good database")' IN BOOLEAN MODE);
+
+DROP TABLE articles;
diff --git a/mysql-test/suite/innodb_fts/t/result_cache_limit.test b/mysql-test/suite/innodb_fts/t/result_cache_limit.test
new file mode 100644
index 00000000..b19907a5
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/result_cache_limit.test
@@ -0,0 +1,52 @@
+# This is a basic test for innodb fts result cache limit.
+
+-- source include/have_innodb.inc
+
+# Must have debug code to use SET SESSION debug
+--source include/have_debug.inc
+
+# Create FTS table
+CREATE TABLE t1 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ a VARCHAR(200),
+ b TEXT
+ ) ENGINE= InnoDB;
+
+# Create the FTS index again
+CREATE FULLTEXT INDEX idx on t1 (a,b);
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','what In this tutorial we will show ...'),
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','what In this tutorial we will show ...');
+
+SET @save_limit=@@GLOBAL.innodb_ft_result_cache_limit;
+SET @save_dbug=@@debug_dbug;
+SET debug_dbug="+d,fts_instrument_result_cache_limit";
+
+# Simple term search
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' IN BOOLEAN MODE);
+
+# Query expansion
+--error 128
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' WITH QUERY EXPANSION);
+
+# Simple phrase search
+--error 128
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database"' IN BOOLEAN MODE);
+
+# Simple proximity search
+--error 128
+SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database" @ 5' IN BOOLEAN MODE);
+
+SET debug_dbug=@save_dbug;
+
+DROP TABLE t1;
+SET GLOBAL innodb_ft_result_cache_limit=@save_limit;
diff --git a/mysql-test/suite/innodb_fts/t/savepoint.test b/mysql-test/suite/innodb_fts/t/savepoint.test
new file mode 100644
index 00000000..09ccb383
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/savepoint.test
@@ -0,0 +1,475 @@
+# This is the basic function tests for innodb FTS savepoint
+
+-- source include/have_innodb.inc
+
+
+CREATE TABLE articles (
+ id INT UNSIGNED NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ FULLTEXT (title)
+ ) ENGINE= InnoDB;
+
+# Test Part 1: ROLLBACK TO SAVEPOINT
+# Test rollback to savepoint 1(S1,RB1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback to savepoint 2(S1,RB1,S2,RB2)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback to savepoint 3(S1,S2,RB1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback to savepoint 4(S1,S2,RB2,RB1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test Part 2: RELEASE SAVEPOINT
+# Test release savepoint 1(S1,RL1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test release savepoint 2(S1,RL1,S2,RL2)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+RELEASE SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test release savepoint 3(S1,S2,RL1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test release savepoint 4(S1,S2,RL2,RL1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+RELEASE SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test Part 3: RELEASE & ROLLBACK TO SAVEPOINT
+# Test release & rollback to savepoint 1(S1,RB1,S2,RL2)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+RELEASE SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test release & rollback to savepoint 2(S1,RL1,S2,RB2)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test release & rollback to savepoint 3(S1,S2,RL2,RB1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+RELEASE SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test release & rollback to savepoint 4(S1,S2,RB2,RL1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+COMMIT;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test Part 4: ROLLBACK & SAVEPOINT
+# Test rollback 1
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+ROLLBACK;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback 2(S1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+ROLLBACK;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback 3(S1,RL1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+ROLLBACK;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback 4(S1,RB1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+ROLLBACK;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+# Test rollback 5(S1,S2,RB2,RL1)
+TRUNCATE TABLE articles;
+
+INSERT INTO articles(id, title) VALUES(1, 'mysql');
+
+BEGIN;
+
+INSERT INTO articles(id, title) VALUES(2, 'mysql');
+
+SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(3, 'mysql');
+
+SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(4, 'mysql');
+
+ROLLBACK TO SAVEPOINT sp2;
+
+INSERT INTO articles(id, title) VALUES(5, 'mysql');
+
+RELEASE SAVEPOINT sp1;
+
+INSERT INTO articles(id, title) VALUES(6, 'mysql');
+
+ROLLBACK;
+
+INSERT INTO articles(id, title) VALUES(7, 'mysql');
+
+SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql');
+
+DROP TABLE articles;
diff --git a/mysql-test/suite/innodb_fts/t/subexpr.test b/mysql-test/suite/innodb_fts/t/subexpr.test
new file mode 100644
index 00000000..63294066
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/subexpr.test
@@ -0,0 +1,58 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #20028323 INNODB FULLTEXT BOOLEAN SEARCH INCORRECTLY HANDLES
+--echo # PARENTHESES
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT NOT NULL AUTO_INCREMENT,
+ f2 TEXT NOT NULL,
+ PRIMARY KEY (f1),
+ FULLTEXT (f2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 (f2) VALUES
+('Pumpkin soup with cheese bread'),
+('Yellow chicken curry'),
+('Fresh green vegetables with garlic');
+
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+
+INSERT INTO t1 (f2) VALUES
+('This row contains only souffle'),
+('This row contains only tart'),
+('This row contains only pumpkin'),
+('This row contains only cheese'),
+('This row contains pumpkin and souffle'),
+('This row contains pumpkin and tart'),
+('This row contains pumpkin and cheese'),
+('This row contains both souffle and tart'),
+('This row contains both souffle and cheese'),
+('This row contains both tart and cheese'),
+('This row contains all three souffle, pumpkin and tart'),
+('This row contains all four cheese, souffle, pumpkin and tart');
+
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+pumpkin' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+cheese' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2) AGAINST('+(pumpkin cheese)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(souffle)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(>souffle <tart)' IN BOOLEAN MODE);
+SELECT * FROM t1 WHERE MATCH(f2)
+ AGAINST('+pumpkin +(souffle tart)' IN BOOLEAN MODE);
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/r/check_rtree.result b/mysql-test/suite/innodb_gis/r/check_rtree.result
index fe60a628..0d7b25b6 100644
--- a/mysql-test/suite/innodb_gis/r/check_rtree.result
+++ b/mysql-test/suite/innodb_gis/r/check_rtree.result
@@ -1,7 +1,5 @@
create table t1 (i int, g geometry not null, spatial index (g))engine=innodb;
SET SESSION debug="+d,rtree_test_check_count";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
insert into t1 values (1, POINT(1,1));
insert into t1 values (1, POINT(1.5,1.5));
insert into t1 values (1, POINT(3,3));
diff --git a/mysql-test/suite/innodb_gis/r/rollback.result b/mysql-test/suite/innodb_gis/r/rollback.result
index 0d2b9c7c..1efe5d28 100644
--- a/mysql-test/suite/innodb_gis/r/rollback.result
+++ b/mysql-test/suite/innodb_gis/r/rollback.result
@@ -408,8 +408,6 @@ update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3;
ERROR 23000: Duplicate entry '5' for key 'c'
rollback;
set session debug="+d,row_mysql_crash_if_error";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3;
ERROR HY000: Lost connection to server during query
insert into t1 values(5, point(5,5), point(5,5), 5);
diff --git a/mysql-test/suite/innodb_gis/r/rtree_add_index.result b/mysql-test/suite/innodb_gis/r/rtree_add_index.result
index ba552e27..be15d97a 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_add_index.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_add_index.result
@@ -1,4 +1,4 @@
-CREATE TABLE t1 (g MULTIPOINT NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t1 (g MULTIPOINT NOT NULL) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 VALUES ('');
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_compress.result b/mysql-test/suite/innodb_gis/r/rtree_compress.result
index fce42319..9b646985 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_compress.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_compress.result
@@ -1,4 +1,6 @@
-create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb ROW_FORMAT=COMPRESSED;
+create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb ROW_FORMAT=COMPRESSED STATS_PERSISTENT=0;
+lock tables t1 write;
+start transaction;
insert into t1 values(1, Point(1,1));
insert into t1 values(2, Point(2,2));
insert into t1 values(3, Point(3,3));
@@ -18,6 +20,8 @@ insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
+commit;
+unlock tables;
start transaction;
insert into t1 select * from t1;
select count(*) from t1;
@@ -40,8 +44,6 @@ count(*)
0
SET @saved_dbug = @@SESSION.debug_dbug;
SET DEBUG='+d,page_copy_rec_list_start_compress_fail';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
delete from t1;
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
diff --git a/mysql-test/suite/innodb_gis/r/rtree_create_inplace.result b/mysql-test/suite/innodb_gis/r/rtree_create_inplace.result
index a8898f5c..2016ce1b 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_create_inplace.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_create_inplace.result
@@ -1,22 +1,17 @@
CREATE TABLE t1 (c1 INT, c2 GEOMETRY NOT NULL, c3 GEOMETRY NOT NULL) ENGINE=INNODB;
-INSERT INTO t1 VALUES(1, Point(1,1), ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
-INSERT INTO t1 VALUES(2, Point(2,2), ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
-INSERT INTO t1 VALUES(3, Point(3,3), ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
-INSERT INTO t1 VALUES(4, Point(4,4), ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
-INSERT INTO t1 VALUES(5, Point(5,5), ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
-INSERT INTO t1 VALUES(6, Point(6,6), ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
-INSERT INTO t1 VALUES(7, Point(7,7), ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
-INSERT INTO t1 VALUES(8, Point(8,8), ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
-INSERT INTO t1 VALUES(9, Point(9,9), ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
+CREATE TEMPORARY TABLE t LIKE t1;
+INSERT INTO t VALUES
+(1, Point(1,1), ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')),
+(2, Point(2,2), ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')),
+(3, Point(3,3), ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')),
+(4, Point(4,4), ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')),
+(5, Point(5,5), ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')),
+(6, Point(6,6), ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')),
+(7, Point(7,7), ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')),
+(8, Point(8,8), ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')),
+(9, Point(9,9), ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 SELECT t.* FROM t, seq_1_to_512;
+DROP TEMPORARY TABLE t;
CREATE SPATIAL INDEX idx ON t1(c2);
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -30,8 +25,7 @@ SELECT COUNT(*) FROM t1 WHERE MBRWithin(t1.c2, @g1);
COUNT(*)
0
ALTER TABLE t1 DROP INDEX idx, ADD SPATIAL INDEX idx3(c2);
-SET SESSION debug="+d,row_merge_instrument_log_check_flush";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
+SET debug_dbug='+d,row_merge_instrument_log_check_flush';
ALTER TABLE t1 DROP INDEX idx3, ADD SPATIAL INDEX idx4(c2), ADD SPATIAL INDEX idx5(c3);
+ALTER TABLE t1 FORCE;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_purge.result b/mysql-test/suite/innodb_gis/r/rtree_purge.result
index 4c39cc98..35953c32 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_purge.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_purge.result
@@ -1,5 +1,5 @@
create table t (
b point not null,d point not null, spatial key (d),spatial key (b)
-) engine=innodb;
+) engine=innodb stats_persistent=0;
InnoDB 0 transactions not purged
drop table t;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_undo.result b/mysql-test/suite/innodb_gis/r/rtree_undo.result
index d0e15641..1f44542f 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_undo.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_undo.result
@@ -4,7 +4,7 @@ CREATE TABLE t1 (
p INT NOT NULL AUTO_INCREMENT,
g LINESTRING NOT NULL,
PRIMARY KEY(p)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
ALTER TABLE t1 ADD INDEX prefix_idx (g(767));
INSERT INTO t1(g) VALUES(ST_linefromtext('linestring(-5 -576,0 -576,0 -571,0 -571,5 -568,6 -564,6 -565,6 -563)'));
INSERT INTO t1(g) VALUES(ST_linefromtext(concat('linestring','(18 106,19 106,24 111,27 108,32 104,37 107,42 107,44 112,44 116,40 118,43 114,46 114,42 118,44 123,45 123,49 123,53 119,50 123,50 124,54 126,58 125,59 126,64 127,65 127,69 131,74 132,75 135,78 139,2078 141,2075 143,2077 143,2079 143,2084 143,2085 147,2090 -1853,2086 -1852,2086 -1856,2089 -1852,2093 -1850,2090 -1851,2090 -1852,2091 -1851,2092 -1850,2097 -1847,2102 -1848,2100 -1852,2100 -1852,7100 -1851,7103 -1850,7104 -1847,7109 -1842,65 127,67 131,66 131,61 132,61 133,62 137,65 1137,2065 1135,2061 1135,2064 1135,5064 1135,5066 1135,5070 1136,5070 1141,5071 1138,5074 1141,5075 1141,5074 1137,5076 1137,5071 1139,5066 1142,5065 2142,5068 2147,5073 2151,5069 2156,5071 2157,5072 2162,5074 2165,5069 2169,5072 2169,5076 2173,5074 2169,5078 2169,5076 2170,76 2175,74 2179,75 2184,80 2188,83 2190,87 2189,84 2193,87 2189,86 2190,87 2195,87 2200,87 1200,85 1202,86 1199,87 1200,87 1201,91 1206,92 1204,94 1204,98 1206,102 1208,105 1211,102 1216,105 1220,109 1224,110 1224,114 1225,117 1224,118 1229,117 1232,122 1237,123 1236,120 1235,124 1237,121 1236,122 1240,126 1244,127 1246,126 1249,125 5249,123 5251,127 5251,131 5251,135 5256,138 5257,135 5257,139 5257,138 5258,141 5260,146 5260,146 5260,143 10260,147 10265,151 10270,156 10266,157 10269,162 10273,166 12273,168 12274,163 12270,168 12275,170 12277,170 12277,-3830 12277,-3825 12277,-3824 12278,-3825 12276,-3825 12278,-3822 12277,-3825 12275,-3829 12278,-3828 12275,-3824 12280,-3827 12280,-3826 12282,-3822 12283,-3822 12286,-3820 12288,-3818 12289,-3816 12294,-3817 12297,-3819 12300,-3816 12297,-3813 12295,-3811 12299,-3811 12297,-3806 12298,-3806 12298,-3804 12301,-3801 12306,-3803 17306,-3803 17306,-3798 17306,-3803 17310,-3801 17314,-3798 17317,-3797 17317,-797 17321,-797 17323,-796 17325,-793 17326,-792 17322,-789 17327,-784 17331,-780 17335,-776 17339,-774 17339,-771 17342,-770 17345,-765 17348,-765 17349,-763 17353,-760 17350,-760 22350,-756 22346,-752 22349,-748 22352,-752 22348,-748 22347,-746 22345,-745 27345,-743 27346,257 27350,260 27349,261 27352,266 27348,266 22348,269 22347,271 22347,272 22347,273 22348,273 22352,278 22348,279 22344,282 22345,282 22342,283 22347,283 22347,288 22349,292 22347,292 22348,293 22348,298 22348,303 22351,306 22352,309 22352,308 22354,310 22356,311 22361,311 22358,311 22360,311 22360,315 22356,320 22358,325 22363,326 22366,321 22371,318 22373,318 22375,314 22375,316 22375,321 22376,321 22376,322 22372,32 104,36 109,40 114,40 113,40 117,44 119,49 123,49 126,49 129,53 133,50 137,50 139,49 137,48 138,43 138,42 139,46 142,46 138,41 139,45 141,4045 5141,4045 5146,4042 5147,4043 10147,4041 10150,4042 10152,4045 10152,4041 10156,4041 10152,4041 10152,4046 10153,4049 10156,4046 10155,4051 10157,4055 10159,4055 10160,4056 10161,4055 10166,4054 10169,4054 10172,4054 15172,4051 15176,4047 15177,4049 15174,4047 15176,4047 15176,4046 15177,4046 15180,4043 15184,4043 15187,4038 15190,4040 15194,4040 15199,4045 15196,4047 15197,4050 15200,4050 15204,4050 15208,4047 15212,4047 15215,4049 15216,4046 15218,4042 15223,4042 15228,4042 15232,4047 15235,4050 15236,4050 15239,4051 15243,4053 15243,4050 17243,4052 17243,4052 18243,4057 18247,4061 18249,4064 18249,4067 20249,4067 20250,4067 20255,4066 20259,4066 20259,4067 20255,4069 20256,4071 20258,4072 20254,4067 20257,4067 20260,4069 20265,4065 20267,4069 20266,4070 20267,4071 20264,4074 20259,4070 20264,4073 20260,4074 20263,4077 20268,4082 20271,4084 20273,4084 20277,4081 18277,4085 18279,4086 18276,4087 18273,4087 18275,4092 18277,4093 18279,4093 18280,4095 18280,4091 18283,4092 18281,4094 18283,4090 18287,4094 18287,138 5257,138 5255,138 5258,-1862 5254,-1860 5256,-1856 5258,-1851 5255,-1850 5260,-1847 5260,-1847 5263,-1847 5258,-1850 5257,-1850 5259,-1851 5257,-1855 5258,-1853 5261,-1849 5261,-1849 5258,-1849 5259,-1845 5264,-1847 5264,-1850 5268,-1852 5266,-1853 5270,-1856 5265,-1852 5262,-1847 5263,-1842 5263,-1842 5260,-1842 5265,-1841 5265,-1844 5265,-1842 5270,-1837 5274,-1838 5279,-1843 5275,-1842 5280,-1838 5281,-1838 5285,-1833 5285,-1828 5288,-1824 5289,-1828 5291,-1831 5291,-1826 5291,-1830 5293,-1826 5296,-1822 5301,-1826 5302,-1826 5302,-1826 5302,-1825 5297,-1820 5299,-1816 5303,-1816 5299,-3811 12299,-3809 12302,-3806 12302,-3806 12302,-3803 12304,-3798 12304,-3797 12304,-3793 12306,-3788 12306,-3783 12309,-3816 12294,-3811 12299,-3809 12297,7100 -1851,7098 -1854,7102 -1854,7107 -1856,7107 -1858,7110 -1854,7110 -1851,7113 -1851,7115 -1851,7120 -1851,7123 -1847,7124 -1852,7125 -1852,7127 -1852,7131 -1852,7129 1148,7129 1145,7133 1150,7137 1148,7138 1147,7143 1149,7147 1154,8147 1155,8152 3155,8147 3157,8143 3158,8144 3160,8144 3164,11144 3167,11146 3167,11148 3163,11152 3161,11148 3159,11149 3163,11150 3161,11151 3166,11154 3171,11154 3170,8144 3160,8144 3163,8144 3166,8145 3166,8146 3171,8146 3174,8144 3174,8144 3174,8145 3176,8141 3180,3141 3182,7141 3183,7141 7183,7136 7185,7136 7185,7133 7187,7136 7187,7131 7190,7136 7194,7137 7197,7141 7196,7139 7199,12139 7200,12143 7200,12143 7199,12144 7203,12145 7200,12141 7200,12136 7195,12136 7191,12137 7191,12137 7196,12139 7197,12140 7197,12137 7201,12140 7204,12140 7209,12143 7209,12145 7210,12147 7214,12148 9214,12152 9218,12149 9218,12149 9221,12149 9220,12150 9222,12153 10222,12153 10226,12156 10227,12159 10223,12160 10220,12161 10225,12161 10227,12163 10224,12163 10223,12158 10224,12158 10227,12158 10231,12155 12231,12157 12226,7136 7185,7139 7189,7139 7189,7139 7188,7137 7191,7139 7191,7140 7189,7143 7191,7144 7189,7144 7190,7149 7193,7152 7194,7154 7198,7153 7203,7148 7207,12148 7209,12146 7209,12145 7213,12140 7217,12139 7219,12141 7219,12138 7218,12143 7218,13143 7220,13140 7224,13142 7228,13137 7231,13142 7235,13146 7239,13149 7243,13148 7247,13150 7248,13155 7249,13155 7253,13155 7253,13155 7258,13157 7260,13162 7255,13159 7255,13163 7258,13164 7258,13164 7263,13167 7264,13167 8264,13165 8265,13169 8265,13171 13265,13175 13261,13176 13259,13176 13259,13180 13262,13181 13262,13183 13262,13188 13265,13191 13267,13191 13265,13194 13267,13191 13269,13192 13264,13196 13269,13198 13272,13200 13272,13202 13270,13207 11270,13211 11270,13211 11273,13213 11274,13217 11275,13222 11276,13222 11272,13226 11274,13231 11277,13233 11282,13236 11284,13238 11284,13236 11286,13236 11288,13236 11283,13236 11284,13238 11289,13241 11292,13244 11292,13245 11289,13241 11294,13244 11298,13249 11301,320 22358,324 24358,328 24358,327 24363,326 24359,327 24361,329 24365,334 24367,-666 24367,-670 24368,49 123,46 127,46 129,49 131,49 136,47 135,45 138,3045 135,3042 138,3044 139,3044 144,3049 144,3053 142,3055 137,3058 136,3053 139,3048 142,7048 138,7048 3138,7048 3139,7048 3140,7050 3145,7053 1145,7050 1146,7053 5146,7048 5150,7047 5146,10047 5147,10043 5147,10047 5147,10050 5152,10052 5155,10054 5156,10056 5157,10056 5159,10058 5162,10062 5164,10062 5169,10066 9169,10068 9168,10063 9164,10063 9169,10061 9171,14061 9172,14061 9174,282 22342,287 22347,288 22347,288 22343,285 22339,280 22338,278 22341,279 25341,284 25343,13241 11294,13246 11296,13243 11296,13244 11291,13245 11291,13244 11291,13246 11295,13251 11300,13253 11305,13253 11306,13258 11305,13255 11306,13256 11309,13256 11311,13261 11307,13265 11303,13267 11305,13270 11301,13275 11298,13271 11300,15271 11302,15276 11306,15279 11303,15284 11305,15286 11305,15289 11307,15290 11302,15292 11305,15296 11309,15297 11313,15298 11316,15300 11317,15304 11320,15306 11324,15306 11320,15307 11320,15312 11320,15313 11319,15317 11317,15315 11321,15317 11323,15317 11328,15319 11333,15322 11336,15322 11337,15322 11337,15324 11341,15324 11345,15325 14345,15328 13345,17328 13346,17333 13349,17337 13354,17338 13358,17342 13358,17346 13353,17348 13353,17345 13353,17348 13354,17347 13354,17347 13354,17347 13355,22347 13358,22349 13355,22351 13355,22356 13354,22358 13354,22361 13355,22362 13355,22358 13355,22359 13359,22364 13364,22369 13369,22372 13373,22376 13371,22377 13371,22377 13369,22381 13374,22386 13379,22387 13376,22387 13380,22392 13378,22390 13374,22392 13378,22391 13378,22391 13375,22392 13378,22390 13380,22393 13382,22398 13387,22398 10387,22402 10391,22399 10392,22400 10392,22400 10394,22404 10391,22403 15391,22405 15392,22407 15392,22412 15387,22412 15390,22412 15394,22408 15396,26408 15398,26407 20398,26411 20402,26415 20406,26417 20411,26420 20407,26422 20407,31422 16407,31421 16405,31421 16410,31423 16410,31426 16414,31426 16410,31430 16415,31430 16418,31435 16419,31437 16420,31438 16422,31438 16425,31438 16425,31441 16427,31439 16431,31441 16436,36441 16436,36443 18436,36442 18437,36440 18440,36440 18436,36440 18440,36442 18445,36443 18446,36447 18451,37447 23451,37452 23456,37456 23455,37458 23459,37456 23461,37458 23463,37460 23466,37464 23469,37460 23474,37462 23476,37461 26476,37466 26479,37470 26483,37471 26488,37474 26489,37474 26485,37474 26483,37474 26488,37470 26492,37474 26497,37474 26499,37478 26495,37483 26499,37483 26501,37488 26496,37491 26499,37495 26495,37500 26496,37500 26497,37500 26501,37497 26499,37497 26499,37495 26504,37498 26504,37494 26509,37497 26514,37495 26515,37498 26514,37503 26514,37508 26512,37510 26516,37511 26519,37509 26523,37506 26528,37507 26532,37512 26536,37513 26538,37510 26542,37512 26544,37517 26543,37522 26546,37527 26551,37525 26555,37529 26558,37524 26563,37524 26562,37527 26562,37522 26562,37522 26559,37526 26561,37522 26559,37523 26561,37523 26556,37524 26558,40524 26560,40524 26563,40521 26567,40525 26566,40527 26568,40532 26572,40534 26569,40533 26565,40531 26565,40535 26569,40535 26570,40539 26572,40544 26575,40543 26575,40544 26579,40548 26584,40549 26581,40553 26585,40556 26590,40552 22590,40557 22594,40556 22595,40561 22592,40561 22593,40565 22593,40568 22593,40573 22588,40570 22590,40570 22591,40570 22588,40573 22590,40573 22593,40568 22593,40567 22597,40567 22599,40571 22599,40574 22600,40574 22604,42574 22607,42577 22607,42577 22612,42579 22616,38579 22619,38580 22617,38580 22614,38575 22619,38579 22619,38579 18619,38582 18614,38582 18617,38586 18622,38590 18625,38590 18622,38594 18621,38596 18616,38597 18614,38597 18618,38600 21618,38601 21618,38605 21620,38607 25620,38611 25620,38608 25617,38608 25621,38608 25625,38611 25623,38615 25623,38615 25620,38616 25622,38619 25624,38620 25625,38620 26625,38623 26627,38623 26627,311 22358,311 22359,-1689 22360,2311 27360,2312 27360,2312 27360,2317 27362,2317 27362,2319 27359,2319 27364,2318 27359,2321 27364,2326 27367,2325 27371,2326 27373,2326 27373,2325 27377,2329 27377,2327 27377,2330 27379,2333 27379,2331 27379,2331 27381,2336 27381,6336 27382,6336 27383,40527 26568,40531 26572,40533 26574,40538 26576,40533 26580,40538 26585,40539 26588,40536 26583,40540 26587,40539 26588,40535 26593,40540 26594,40544 26597,40548 26602,40548 26601,40549 26602,40547 26602,40548 26603,40553 26606,40548 26606,40548 26603,40551 26608,40556 26612,40559 26616,40554 26619,40556 26619,40556 26623,42556 26623,42556 26624,42560 26624,42562 26626,42563 26630,42564 26630,42564 26634,42559 26635,42562 26635,42565 26637,42562 26638,42564 26642,42564 26641,42568 26641,42572 26641,42572 29641,42574 29642,39574 29641,39574 34641,39576 34643,39581 34638,39578 34638,39574 34642,39574 34645,39572 35645,34572 35648,34577 35651,39577 35655,43577 35659,43580 35655,43575 35658,43578 35658,43581 35662,43577 39662,43572 39658,43572 39661,43572 39664,43572 39666,43576 39670,43577 39667,43580 39671,43576 39673,43573 39673,43574 39677,43569 39679,43567 39679,43568 39683,43563 39686,43566 39690,43566 39692,43568 39694,43568 39695,41568 39691,41570 39692,41571 39692,41571 39693,41571 39698,41571 39698,41574 39698,41569 39698,41570 39699,41570 39704,41572 39709,41573 39712,41578 39713,41579 39717,41584 39719,41585 39720,-1850 5268,-1845 5268,-1847 5266,-1842 5268,-1840 5263,-1845 5264,-1843 5264,-1839 8264,-1839 8267,-1839 8272,-1838 8276,-1834 8273,-1834 8273,-1833 8274,-1837 8279,-1836 8283,-1834 8286,-1836 8282,-1834 8279,-1835 8279,-1834 8280,-1836 8283,-1841 8288,-1846 8289,-1843 8286,-1838 8286,-1841 8285,-1838 8285,-1834 8288,-1829 8291,-1825 8286,-1825 8289,-1825 8287,-1824 8291,-1822 8294,-1821 8298,-1818 8300,-1818 8296,-1814 8296,-1811 8295,-1808 8292,1192 8296,1192 8297,1195 11297,1192 11301,1195 11305,1197 11300,1193 11300,1193 11296,1193 11293,1194 11294,1199 11292,1204 11292,1205 11294,1210 11292,1208 11288,1204 11290,1205 11289,1207 8289,1202 8284,1204 8282,1204 8281,1206 8281,1208 8281,1212 8283,1212 13283,1213 13287,1213 13290,1216 13293,1214 13289,1217 13286,1212 13291,1208 13288,1208 13292,1209 13297,1208 13296,1204 13298,1205 13303,1209 13308,1204 13308,1209 13304,1210 13304,1214 13309,1214 13314,1215 13314,1219 13314,1219 13319,1224 13320,1229 13321,1232 13325,1233 13329,1231 13329,1234 13334,-2766 13336,-2769 13337,-2765 13340,-2762 13345,-2760 13342,2240 13342,2238 13342,2242 13342,2246 13345,2246 13346,2244 13348,2239 13348,2240 13351,2240 13352,2245 13357,2248 13357,2243 13362,2247 13362,2248 13362,2252 13363,2256 13363,2256 13363,2260 13367,2255 13372,2251 13369,2251 13369,2252 13372,2249 13376,2254 13378,2255 13382,2259 13379,2262 13379,2267 13381,2262 13381,2262 13383,2265 13383,2269 13385,2270 13386,2271 13389,2267 13391,2271 13386,2275 13391,2273 13392,2275 13387,2277 13390,2274 13390,2275 13394,2280 13395,2280 11395,2281 14395,2279 14400,2277 14403,2273 14406,2274 16406,2274 16410,2279 16410,2284 16411,2280 16409,2280 16409,2282 16409,2282 16411,2282 16412,2280 16413,3280 16418,3284 16418,3285 16423,3289 16423,3292 16427,3294 16429,3296 16431,3297 16436,3298 16435,3303 16435,3305 16434,3305 16436,3305 16436,3309 16437,3309 16438,3308 16439,3308 16439,3306 16444,3302 16441,-1698 16437,-1703 16438,-1699 16438,-1697 16438,-1698 16439,-1695 16436,-1690 16441,-1687 16446,-1683 16450,-1682 16451,-1684 16453,-1682 16457,-1682 16457,-1686 16460,-1681 16459,-1680 16456,-1677 16460,-1681 16461,-1679 16464,-1674 16465,-1673 16469,-1669 16471,-1669 16476,-1665 16474,-1665 16478,-1664 16478,-1664 16479,-1661 16474,-1656 16471,-1655 11471,-1660 11473,-1663 11475,-1666 11480,3334 15480,3338 15476,3342 15471,3345 15471,3345 15470,3350 15469,3347 15474,3351 15476,3352 15473,3353 15476,3350 15477,3350 15479,3351 15482,3352 15484,3351 15487,3353 15487,3358 15487,3353 15486,1217 13286,1222 13291,1222 13291,1225 13286,1229 13286,1231 13281,1235 13280,1236 13281,1241 13282,1245 13285,1247 13285,1247 13287,1250 13287,1247 13290,1247 13295,1247 13298,1252 13301,1249 13304,1252 13304,3252 13304,3247 13304,3249 13308,3254 13308,3257 13308,3261 17308,3261 17309,3261 17306,3259 17305,3262 17310,3263 17308,3262 17311,3259 17314,3259 17314,3257 17309,3254 17309,3253 17309,3255 17310,3253 17312,3255 17312,3255 17312,3256 17307,3257 17307,3256 17311,3256 17313,3255 17317,3251 17317,3248 17321,3253 17325,3256 17326,3258 17324,3258 17327,3263 17322,7263 17325,7265 17328,7263 17330,7265 17333,7270 17333,7273 17333,7278 17336,4278 21336,4278 21340,4279 21340,4281 21340,4286 24340,4290 24343,9290 24347,9294 24349,9296 24347,9298 25347,9301 25348,9301 25348,9304 25353,9303 25357,9303 25352,11303 25355,11304 25358,11307 25358,11312 25358,11312 25361,11310 25365,11313 25365,11314 25369,11319 25371,11321 25371,11325 25366,11329 25365,11330 25366,11329 25370,11330 25365,11334 25367,11338 25366,11343 25363,11348 25359,11345 25356,11348 25357,11349 25358,11349 25358,11352 25360,11356 30360,11360 30365,11360 30365,11362 30365,11367 30367,11368 30369,15368 30370,15373 30371,15376 30373,14376 30378,14377 30383,14381 30378,14386 30380,14388 30382,14391 30385,14393 31385,16393 31389,16396 31394,16396 31397,16392 31400,16395 31405,16398 31409,16398 31413,16397 31415,16396 31417,16401 31418,16401 31422,16402 31419,16407 31420,16411 31419,16406 31423,18406 31427,18411 31432,18415 28432,18417 28437,18418 28441,18414 28438,18417 28435,18416 28439,18420 28442,18423 28447,18427 28444,21427 28445,21428 28450,22428 28455,22432 28457,22436 28458,22441 28458,22445 28463,22448 28468,22451 28465,22456 28468,22453 28468,22458 28471,22463 28473,22460 28475,22459 28472,22463 28476,22464 28472,22468 28468,22468 28471,25468 28466,25471 28468,25473 28464,25473 28464,25475 29464,25476 29466,25479 29461,25476 29462,25476 29464,25478 29464,25483 29461,25484 29460,25486 29458,25486 29462,25490 29460,25495 26460,25498 26463,25495 26468,25495 26472,25495 26472,25499 26474,25504 26476,25504 26478,25509 26476,25513 26479,25514 26481,25519 26477,25519 26480,25518 26481,25519 26484,25524 26483,25527 26484,25522 26484,25526 26487,25528 26492,25533 26496,25535 26498,25535 26498,25539 26503,25542 26504,25543 26505,25547 26510,25552 26510,25551 26508,25550 26512,25553 26510,25557 26510,25554 26511,25552 26508,25556 26505,25556 26506,25560 26506,25560 26507,25560 26506,25565 26501,25567 26504,25569 26504,25568 26508,25571 26508,25571 26511,25576 26511,25581 26516,25581 26519,25582 26521,25585 26522,25588 26527,25588 26526,25584 26530,25587 26534,25589 26529,25593 26533,25598 26538,25599 26540,25599 26540,25599 26540,25604 26543,25603 26543,25603 26538,25606 26538,25609 26540,25611 26542,25612 26547,25612 26547,25612 26548,25617 25548,25612 25548,25613 25547,25616 25545,25616 25549,25618 25551,25620 25555,25620 25551,25622 25550,25625 25551,25622 25555,25619 25557,25617 25556,25622 28556,25625 28551,25630 28546,25634 28548,25639 28553,25643 28553,25638 25553,25634 25553,25634 25557,25639 25557,25643 25558,25644 25553,25646 25556,25647 25560,25650 25562,25650 30562,25650 30562,25650 30564,25650 30566,25652 30570,25656 30571,25661 31571,25662 31575,25663 31579,25662 31579,25665 31581,25666 31584,25671 31582,25674 31581,25674 31584,25676 31584,25673 31587,25678 31586,25679 31581,30679 31584,30675 31589,30680 31590,35680 31590,35675 31589,35677 31591,35680 31590,35681 31587,35684 31588,35685 31589,35689 31592,35689 31593,35692 31597,35696 31597,35700 34597,35699 34599,35703 34604,35703 34606,35702 34601,35705 34603,35705 34606,35708 34603,35713 34604,35717 34603,35719 34608,35715 34608,35711 34608,35713 34609,35714 34605,35714 34610,35714 34614,35718 34616,35719 34617,35722 34618,35722 34621,35725 34625,35725 34626,35725 34629,35725 34631,35725 34635,35730 34636,35727 34638,35731 34640,35735 34642,35739 34645,35741 34645,35742 34649,35738 34649,35738 34645,35741 34647,38741 34650,38741 37650,38742 37646,38746 37651,38749 37652,38753 37653,38753 37657,38757 37656,38756 37660,38761 37660,38765 37660,38760 37660,38759 37660,38760 41660,38760 41660,38762 41665,38757 41667,43757 41669,43752 41674,43752 41677,43757 41672,43758 41677,45758 41680,45758 41679,45762 41683,45765 41683,45769 41683,45770 41684,45768 46684,45773 46688,45776 46692,45774 46694,45775 46697,45778 46695,45776 46698,45774 46702,45779 46702,45784 46704,45787 46706,45791 46711,45786 46707,45790 46711,45793 46715,45796 46719,45799 46724,45797 46728,45802 46726,45797 46729,45801 46733,45802 46733,45803 46732,45804 46732,45805 46732,45808 46735,45810 46740,45810 46744,2326 27373,2322 27377,2323 27379,2325 27383,2325 27382,2322 27382,2323 27382,5323 23382,5325 23385,5329 23386,5330 23390,5335 23392,5330 23392,5330 23395,5329 23395,5333 23399,5333 23402,5338 23405,5339 23405,5334 23406,5329 23401,5332 23403,5330 23407,5333 23409,5328 20409,5324 20411,5324 20414,5329 20416,5328 20421,5325 20421,5329 20424,5330 20424,5335 21424,5331 21427,5333 21431,5334 21433,5329 21434,5330 21437,5333 21440,5338 21437,5338 21440,5334 21441,5333 21438,5329 26438,5332 26435,5335 26439,5337 26440,5338 26444,5342 26439,5342 26442,5345 26440,5349 26438,5352 26442,5349 26445,5348 30445,5350 30447,5350 30444,5354 30444,5359 30443,5363 30445,5367 30446,5367 30448,5367 30453,5371 30455,5371 30453,5373 30458,5375 30461,5380 30463,5384 30463,5383 30459,5384 30459,5383 30459,5385 30460,5390 30459,5392 30464,5394 30464,5389 30465,5393 30469,5391 30469,5391 30469,5395 30474,5396 30470,5399 30470,5401 30467,5401 30468,5404 30470,5400 30465,5401 30462,5403 30467,5404 30467,5409 30469,5412 30473,5412 30477,5407 30481,8407 30486,8408 30489,8410 30490,8410 30489,8413 30490,8414 30493,8414 30496,8419 30501,8420 30502,8415 30507,13415 30509,13411 30506,13414 30507,13412 30511,13412 30515,13417 30518,13419 30523,13418 30527,13422 30529,13418 30531,13413 35531,13409 35531,13413 35532,13417 35537,13419 35533,13423 35529,13424 35529,13423 35524,13428 35525,13433 35526,13438 35530,13443 35531,13448 35531,13452 35532,13455 35536,13457 35536,13452 35536,13455 35539,13452 35535,13457 35540,13457 35544,18457 35546,18460 35547,22460 35546,22465 35550,22466 35554,22468 35552,22473 35555,22471 35559,22470 35564,22472 35564,22470 35569,22474 35569,22474 35571,22477 35573,22482 35576,22487 35580,22488 35583,22489 35585,22493 35585,22496 35585,25496 35586,25493 35582,25494 35585,25498 35585,25496 35585,25498 35587,25503 35591,25503 35593,25499 35590,25499 35591,25495 35591,26495 35595,29495 35591,29495 35593,29498 35597,29498 35601,29500 35606,29501 30606,29502 30603,29505 30603,29510 30606,29511 30606,29514 30607,29516 30610,29518 30608,3259 17305,3263 17304,3267 17303,3271 17308,3269 17312,3269 17313,3274 17315,3277 17315,3282 17311,3285 17313,3283 17309,3278 17310,3275 17315,3275 17317,3276 17322,3280 17324,3280 17324,3276 17325,3277 17325,3276 17328,3278 17324,3273 17329,3277 17331,3280 17326,3281 17328,3276 17324,3277 17324,3277 17322,3277 17321,3277 17321,3281 17323,3282 17327,3282 17332,3287 17335,3288 17335,3288 17338,3290 17337,3294 17340,3294 17341,3299 17341,3299 12341,3299 12342,3304 12339,3301 14339,3305 14340,3307 14341,3311 14343,3313 14343,3314 16343,3310 16341,3310 16346,3312 16348,3311 16349,4311 16346,4316 16348,4321 16344,4324 16348,4322 16349,4323 16346,4323 16346,4326 16350,4322 16354,4323 16356,4325 16361,4325 16358,4322 16362,4325 20362,4325 20366,4322 20367,4326 20372,4326 20374,4331 20373,4333 20373,4338 20376,4339 20379,4341 20382,4338 20384,4339 20386,4340 20383,4340 20383,4335 20388,4336 20390,4341 20390,4346 20391,4348 20391,4349 20393,37497 26499,37494 26496,37496 26500,37496 26501,37499 26506,37497 26502,37498 26502,37500 29502,37500 29507,37505 29508,37506 33508,37508 33513,37513 33518,37517 33522,37516 33520,37521 33521,37521 33525,37516 33530,37519 33528,37520 33528,37524 33530,37527 33530,37525 33527,37528 33530,37533 33533,37534 38533,37536 38536,22358 13355,25358 13360,25361 13358,25362 13362,25362 13362,25365 13365,25363 13367,25359 13369,25357 13374,25360 13374,2247 13362,2252 13366,2254 13363,2257 13363,2261 13358,2264 13354,2264 13356,2269 13361,2272 13363,2274 13363,2275 13363,2273 13362,2274 13365,2278 13365,2280 13370,2284 13366,2284 13365,2289 13368,2290 13366,2293 13368,2298 13373,2298 13372,2295 13375,271 22347,273 22350,4273 22347,4269 22348,4270 22350,4271 22355,4272 22360,4276 22363,4281 22365,4284 24365,4279 24365,4282 24365,4285 24365,4287 24364,4289 24362,4294 24360,4295 24362,4298 24365,4301 24369,1301 24370,1301 24371,1305 24375,1305 24376,1307 24377,1312 24380,1314 24382,1318 24380,1316 24382,1316 24387,1318 24387,1318 29387,1321 29387,1316 29383,1320 29386,1321 29389,1326 29389,1327 29389,2327 29394,2327 29394,2332 29393,-666 24367,-663 24368,-661 24368,-656 24371,-653 24372,-649 24372,-647 24374,-643 24370,-638 24375,-635 24380,-638 24382,-638 24384,-638 24384,-636 24388,-637 24390,-632 24386,-630 24386,-629 24386,371 24389,376 24394,374 24392,377 24397,3377 24400,6377 24405,6378 24408,6373 24406,6370 24406,6375 24403,6370 24403,6375 24403,6379 24406,6374 24409,6378 24411,6380 24412,6378 24415,6378 24419,6383 24423,6385 24425,6387 24428,6390 24433,6386 24430,6386 24435,6387 24436,6388 24440,6387 24444,6383 29444,6383 29447,6386 29451,6382 29446,6387 29447,6390 29452,6393 29452,6397 29455,6400 29459,6400 29463,6397 29467,6393 29467,6395 29470,6397 29473,6399 29468,6394 29467,6397 29470,6396 29473,6396 29470,6393 29465,6389 29469,6390 29470,6389 29465,6389 29468,6392 29470,6388 33470,6390 33466,6391 33466,6392 33467,6394 33467,322 22372,322 22374,323 22377,327 22378,331 22382,330 22383,332 22386,333 22383,331 22383,330 22387,332 22391,332 22396,337 22397,339 22394,340 22399,340 22398,340 22396,343 22396,343 22396,341 22400,342 22404,343 22402,348 22403,345 22407,347 22411,342 22411,345 22413,340 22417,345 22417,348 22422,348 22426,351 22427,352 22432,352 22436,4352 22438,4353 22442,4354 22444,4354 22447,4357 22449,4360 22450,4364 22450,4367 22451,4369 22453,4366 22455,4369 22453,4373 22458,4377 22459,4380 22459,4380 22464,4385 22467,4385 22467,4390 22469,4385 22469,4385 22472,25571 26508,25574 26507,25578 26512,25581 26512,25581 26512,25583 26508,25583 26513,25587 26516,25589 26515,25590 26515,25591 26517,25589 26520,25587 26522,23587 26526,23585 26531,23589 26534,23592 26538,24592 26543,24588 26545,24593 26547,24598 26543,24598 26548,24602 26545,24598 26540,24600 26545,24600 26548,24600 31548,24605 31549,24608 31551,24613 31552,24615 36552,24616 36557,24619 36557,24622 36560,24622 36564,24627 35564,24627 35569,24632 35569,25632 35570,25635 35569,25636 35573,25636 35573,25638 35576,25641 35580,25641 35583,25641 35588,25642 40588,20642 40593,20645 40593,20650 40595,20651 40591,20651 40594,20648 40591,20648 40591,20652 40596,20652 40596,20656 40597,20656 40600,20656 40601,20659 40598,20662 40597,20662 40597,20663 40600,20668 40601,20665 40606,1215 13314,1214 13319,1212 13317,1209 13312,1210 13312,1211 13317,6211 13320,6214 13320,6216 13320,6211 13323,6214 13318,6214 13323,6214 13324,6216 13319,6219 13323,6218 13321,6219 13321,6218 13326,6221 13329,6225 13331,6230 13335,6231 13339,6231 13343,6235 13338,6234 13342,6234 13344,6236 13345,25524 26483,25521 26484,25524 26489,25527 26487,25529 26484,25530 26482,25534 27482,25539 27486,25537 27488,25541 27483,25544 27486,25547 27490,25550 27491,25550 27491,25554 27486,25559 27486,25563 27489,25561 27489,25563 27493,25561 27491,25563 27493,25563 27495,25564 27497,25563 27497,25563 27497,25558 27498,25563 27499,25565 27503,25567 27503,25569 27503,25567 27504,25565 27505,25565 27505,25565 27505,25566 27505,25570 27501,25570 27497,25574 27498,25570 32498,25570 32501,25573 32501,25576 32497,25576 32498,25577 32501,25579 32503,25583 32504,25588 32507,25592 32512,25596 32507,25599 32507,25594 32503,25597 32506,25597 32510,25594 32509,25594 32510,25596 32513,25592 32513,25594 32515,25594 32520,25598 32520,25602 32517,25603 32518,27603 32520,27607 32523,27608 31523,27613 31527,27615 31527,30615 31530,30617 31530,30618 31532,30619 31536,30623 31537,30623 31538,30625 31538,30626 31541,30627 31541,30624 31540,30623 31540,30624 31545,34624 31546,34619 31543,34623 31545,34624 31549,34624 31548,34626 31550,34626 31555,34626 31551,34628 31555,34633 31555,34636 31559,34634 31564,34636 31564,34639 31562,34639 31560,36639 31555,36636 27555,41636 27557,41640 27554,41644 27558,41647 27559,41648 27555,41653 27555,41658 27555,41658 27552,41658 27552,41660 27550,41656 27554,41661 27558,41664 27561,41667 27566,41662 27562,41663 27563,41663 27565,41662 27569,41661 27569,41664 27571,41664 27567,41659 30567,41660 30565,41660 30561,41665 30566,41664 30561,41664 30561,41664 30562,41664 30563,41660 30558,1312 24380,4312 25380,4315 25384,4315 25385,4319 25383,4322 25388,6322 25387,6322 25387,6326 25392,6321 25397,6324 25397,6324 25401,6319 25404,9319 25405,9314 25400,9312 25402,9310 25403,9313 25403,9313 25403,9316 25400,9319 25401,4319 25396,8319 25398,8315 25400,8315 25396,8315 25397,8311 25398,8307 25394,8309 25394,8311 25397,8315 25402,8310 25403,11310 25365,11311 25365,11316 25370,11320 25375,11325 25375,11325 25380,11325 25382,11326 25378,14326 25380,14328 25382,14331 25383,14334 25385,14336 25386,19336 25386,19336 25389,19332 25390,19332 25391,19335 25388,19338 25391,19342 25393,19340 25393,19345 25396,19345 25394,19347 25394,19349 25393,19351 25397,19350 25398,19348 25399,19349 25403,19352 25399,19350 25402,19354 25400,19353 25405,23353 25402,23354 25402,23356 25405,23358 25409,23360 25413,23363 25414,23367 25412,23365 25411,23367 25414,23363 25413,23367 25416,23367 25416,23370 25418,24370 25414,24370 25419,24373 27419,24378 27419,24380 27416,24380 27412,24380 27410,24380 27406,24376 27406,24374 27410,24370 27414,24370 27415,24371 27420,24375 27415,24378 27411,24375 27415,24378 27418,24382 27421,24383 27426,24383 27425,24385 27430,24390 27431,24394 27432,24395 27436,24399 30436,24400 30439,24404 30443,24403 30439,24406 30438,24410 30442,24406 30446,24408 30445,24403 30445,24408 30442,24412 30446,24416 30446,24416 30449,19416 30449,19416 30447,19418 30452,19420 30453,19423 30458,15423 30462,15423 30464,15425 30466,16425 30467,16424 30471,16421 30474,16426 30474,16428 30476,16428 30476,16424 30474,16424 33474,16425 33474,16427 33477,16425 33479,16426 33477,16422 33480,16425 33482,16430 33479,16430 33478,16429 33482,16424 33482,16427 33484,16430 33488,16431 33488,16434 33488,16435 33491,16432 33487,16436 37487,16434 37490,16438 37485,16443 37482,16446 37480,16447 37480,16447 37482,16451 37478,16454 37479,16458 37479,16454 37479,16454 37482,16459 37486,16460 37491,16463 37495,16464 37492,16465 37493,16466 37494,16468 37497,16468 37501,16468 37501,16473 37503,16473 37503,16473 37498,16476 37494,21476 33494,21473 33493,21476 33489,21478 33491,21478 33496,21478 33492,21480 33496,21483 33501,21484 33504,21483 33500,21484 33505,21484 33505,21488 35505,21491 35505,21494 35506,21496 35510,21492 35506,21492 35509,21489 35514,21490 35517,21487 35519,23487 35523,23485 35528,23487 35533,23483 35534,23487 35535,23488 35537,23493 35539,23495 35542,23495 35546,23495 35550,23491 35549,23488 35552,23492 35555,23495 35560,23500 35559,23496 35557,4322 16354,4317 16358,4318 16358,4320 16363,4315 16363,4315 16362,4316 20362,4320 20365,4323 20363,4326 20366,4329 20367,4332 20370,4337 20374,4338 20375,4333 20375,4338 20375,4341 20377,4342 20377,4342 20378,4343 20381,4346 20386,4346 20386,4346 20386,4346 20386,4349 20390,4352 20395,4354 20396,4355 20400,4358 20400,4360 20401,4360 20404,4363 20405,4368 20406,4372 20411,4371 20416,4367 20417,4364 20422,4367 20420,4372 20425,4373 20422,4374 20418,4377 20418,4381 20422,4382 20423,4384 20418,4389 20421,4385 20423,4390 20423,4390 20425,4392 20429,4396 20434,41574 39698,41578 39702,41576 39704,45576 39704,45575 39709,45577 39713,45581 39715,45581 39718,45583 39721,45578 39726,47578 39722,47581 39719,47586 39722,47586 39726,47589 39730,47592 39733,47597 39733,47593 39733,47596 39735,47597 39735,47595 39735,47591 39739,47593 39744,47593 39747,4074 20263,4077 20268,4079 20268,4078 20271,4078 22271,4083 22276,4087 22272,4088 22275,4086 22279,4082 22280,4084 22282,4086 22277,4082 22277,4087 22281,4090 22281,4092 22281,4092 22286,4094 22287,4097 22290,4097 22291,4095 22286,4095 22288,4095 22293,4095 22288,4092 22285,4089 22286,4090 22286,4095 22281,4100 22286,4103 22285,4104 22288,4104 22289,4107 22294,4112 22292,4117 22290,4120 22295,120 22300,121 22303,122 22300,122 22300,121 26300,125 26303,129 26303,127 26305,127 26306,132 26306,132 26307,136 26307,141 26309,140 26311,143 26313,140 26314,145 26318,149 26318,153 26321,153 29321,158 29326,158 29329,162 29324,162 34324,165 34329,168 34328,167 34332,169 34333,173 34334,173 34336,177 34338,178 34340,178 34344,182 34348,177 34348,182 34348,184 34353,184 34358,181 34360,183 34365,187 34365,192 34365,197 34367,199 34366,203 34368,205 34368,202 34363,204 34360,1204 34360,1205 34364,1205 30364,1205 30359,1206 30361,1207 30364,1210 30366,1210 30366,1214 30367,1218 30372,1219 30375,1214 30379,1214 30384,1217 30382,1222 30383,1223 30382,1225 30380,1228 30379,1231 30383,1232 30383,1235 30384,1237 30388,1242 30386,1244 30389,2244 30392,2241 30395,2245 30397,2245 30399,2244 30394,2242 30395,2246 32395,2246 32395,2249 32398,2251 32393,5251 32390,5251 32395,5255 32399,5255 32397,5257 32397,5257 32401,5261 32406,5261 32411,5266 32412,5271 32416,5273 32419,5276 32420,5281 32422,5279 32425,6279 33425,6284 33429,6284 33430,6282 33431,6282 33428,6286 33425,6288 32425,6288 32421,6286 32424,6288 32424,11288 32427,11292 32425,11292 32429,11290 32434,11286 32437,11286 32437,11283 32442,11278 32442,11279 32443,11283 32445,11284 32445,11283 32448,13283 32447,13287 32442,16287 32446,16282 32445,16283 32445,16284 32448,16285 32448,16284 32446,16286 32443,16290 32446,16291 32446,16292 32450,16291 32450,16291 32450,16291 32445,16287 32447,16288 32452,16287 32457,16291 36457,16289 36462,16293 36462,16294 36462,16297 36462,16301 36464,16306 36469,16310 36467,16310 36463,16313 36459,16312 36460,16313 36465,16313 36469,16308 36470,16309 36468,16314 36470,16319 41470,16322 41471,16325 44471,16330 44471,16330 44471,16330 44473,16330 44474,16335 44479,16332 44477,8414 30496,8415 30497,8419 30497,8414 30501,8416 30500,8418 30495,8421 35495,8423 35494,8427 35497,8429 35499,8432 35499,8436 35503,8438 35503,8443 35505,8440 35508,8443 35509,8440 35509,8440 35511,8441 35515,8445 35511,8448 35512,8443 35517,8443 35519,8442 35524,8444 35526,8441 35527,8436 35527,8433 35523,8429 35527,8430 35530,8431 35532,8429 35533,8433 35535,8437 32535,8435 32536,8439 32536,8436 32539,9436 32542,9434 32537,9429 32534,9429 32534,9433 32537,9433 32542,9429 32543,9434 32538,9436 32538,9436 34538,7436 34538,7438 34543,7439 34543,7439 34543,7439 34548,7438 34549,7438 34552,7438 34553,7438 34556,11438 34561,11434 34559,11436 34555,7436 34553,7436 34549,120 1235,124 1239,125 1236,125 1238,129 1235,128 1235,125 1236,123 1239,128 2239,132 2242,131 2242,135 2242,140 2242,145 2247,146 2252,144 2253,146 2248,144 2245,146 2244,150 2249,155 2245,159 2242,160 2243,160 2245,155 2244,156 2245,3156 2246,3159 2248,3159 2250,3164 2254,3165 2257,3166 2255,3169 2257,3171 2262,3169 2263,3174 2268,3177 2273,3174 2276,3178 2275,3173 2279,3177 2276,3180 2279,3182 2284,3185 2289,5185 2286,5185 2288,5181 2286,5185 2288,5184 2293,5187 2293,5187 2297,5190 2299,5187 2299,5185 2300,5181 6300,5182 6297,5187 6300,5189 6298,5191 6296,5193 6296,5193 6296,5195 6297,5195 6300,5197 6297,5195 6300,5190 6302,5191 6306,5192 6308,5195 6312,24395 27436,24391 27437,24393 27433,24398 27436,24398 27437,16286 32443,21286 32443,21286 32444,21282 32448,21283 32446,21283 32448,21285 32451,21281 32456,21282 32458,21282 32463,21282 32468,21284 32470,21289 32471,21287 32471,21287 32469,21287 32474,21284 32477,21288 32482,21291 32482,21291 32486,21296 32485,21299 32486,21301 32487,21303 32484,21301 32482,21305 32487,21310 32491,21312 32495,21313 32491,21315 32495,21312 32495,21314 32498,21316 32501,21311 32506,21311 32508,21312 32513,21317 32516,21319 32516,21324 32516,21327 32521,21328 32526,21332 32527,21328 36527,21331 41527,21336 41527,21334 41531,21337 41533,21335 41535,21339 41540,21340 41540,21343 41536,25343 41539,25340 41542,25337 41542,25337 41545,25335 41542,25335 41543,25335 46543,25339 46548,30339 46551,30340 46556,30343 46557,30342 46553,30337 46556,30341 46561,30337 46565,30336 46563,30338 46564,24373 27419,24373 27421,24375 27424,24377 27425,24377 27430,24374 27435,24379 27437,24384 27432,24385 27434,24382 27437,24381 27442,24381 31442,24381 33442,20381 33439,20383 34439,20382 34440,20378 34444,20381 34446,20381 34442,20384 34443,20388 34446,20392 34447,20393 34442,20393 34447,20396 29447,20395 29443,20399 29443,20400 29439,20399 29436,20404 29439,20409 29440,20410 29440,20410 29444,20408 29445,20413 29448,20413 29451,20412 29455,20413 29458,20418 29461,20413 29463,20415 29464,20416 29464,20416 29463,20416 29463,20418 29464,20414 29465,20418 29463,20413 29460,20413 26460,20418 26458,20421 26459,20421 26461,20421 26460,43578 35658,43578 35654,43578 35658,43578 35660,43583 35661,43583 35659,43583 35662,43579 35663,43583 35661,43587 35666,25625 25551,25629 25551,25630 25554,25630 25559,25632 25560,25627 25561,25623 25557,25623 25559,25624 25561,26624 25566,26627 25566,29627 25571,29626 25574,29625 25575,29622 25579,29625 25583,29630 25588,29632 25589,29635 25591,29635 25594,29637 25598,29642 25596,29643 25597,29644 25597,29649 25598,29654 25602,29656 25602,29661 25603,29661 25601,29664 26601,29666 26604,29665 26604,29668 26607,29672 26607,29669 26611,29671 26616,29674 26613,29679 26616,29680 26616,29681 26615,29682 26619,29679 26617,29684 26622,29686 26624,29689 26624,29690 26628,29691 26630,29693 26625,29694 26620,29698 26617,29703 29617,29707 29616,29706 29620,29709 29623,34709 29626,34710 29628,34710 29627,2282 16411,2283 16412,2283 16412,2287 16417,2292 16421,2297 16421,2298 16426,2303 16426,2304 16429,2309 11429,2313 11432,2308 14432,2308 14431,2311 14433,2310 14437,2308 14438,2309 14440,2311 14440,2309 14443,2312 14443,2314 14447,2314 14452,2314 14450,2309 14451,2309 14451,2309 14456,2313 14461,2313 14461,2309 19461,2309 19461,2311 19462,2315 19465,2318 19465,2321 19462,2317 19464,2321 19467,2322 19467,2322 19469,2322 19469,2320 19464,2321 19462,2322 19461,2327 19466,2327 19461,2322 19461,2322 19463,2317 19467,2318 19471,2102 -1848,2107 -1848,2111 -1846,2114 1154,2114 1156,2115 1157,2114 6157,2116 6162,2121 6165,2124 6170,2121 6175,2124 6179,2124 6183,2128 6178,2126 6179,2125 6178,2126 6181,2122 10181,2127 10186,2128 10189,2130 10188,2130 10191,2127 11191,2127 11195,2131 11196,2132 11192,2131 11197,2135 11201,2135 11203,2139 11199,2142 11203,2143 11204,2147 11208,2142 11210,2142 11211,2147 11212,2150 11217,2150 11219,2151 11219,2152 11222,2152 11222,2148 11224,2150 11220,2150 11223,2146 11218,2143 11219,2140 11221,2143 11218,2140 11219,2140 11223,2145 11225,2147 11226,2152 11226,2155 11224,2157 11229,2157 11229,2153 11233,2153 11238,2149 11239,7149 10239,7154 10241,7157 10241,7162 10243,7164 10248,7164 10251,7169 10253,7171 10253,7172 10257,7177 10260,7182 10256,7187 10260,7191 8260,7195 8256,7200 8258,7204 8258,7203 8261,7203 8262,7205 8266,7209 8270,7209 8273,7214 8273,7214 8276,7210 8276,7211 8276,7213 8279,7218 8278,7222 8283,7223 8279,7220 10279,7221 10283,7223 10284,7228 10286,7230 10290,7231 10290,7231 10293,7232 10294,7232 10297,7234 10299,7229 10295,7226 10294,7221 10293,7223 10295,7228 10299,7229 10303,7232 10307,7232 10311,7233 10316,7234 9316,7239 9318,7244 9321,7241 9326,7241 9328,7238 9331,7235 9330,7237 9335,7236 9335,7236 9337,7236 9338,7231 14338,7230 14333,7232 14338,7237 18338,4082 22280,4081 22280,6081 22283,6076 22285,6076 22289,6078 22286,6080 22287,6084 22292,6084 22293,6085 22293,6086 22291,6091 22294,6092 22293,9092 22290,9095 22294,9096 22295,9096 22297,9091 22292,9096 22295,9098 22290,9094 18290,9097 18290,9096 18294,9099 18292,9098 18297,9103 18299,9103 18302,9103 18305,9100 18301,9102 18302,9106 18305,9102 18310,9101 18306,9103 18308,9103 18312,9107 18310,9107 18315,9107 18320,9111 18322,9111 18326,9113 18329,9111 18329,9116 18329,9121 18329,9121 18332,9123 18331,9124 18332,9125 18328,9127 18325,9125 18328,9128 18329,9133 18329,9136 18333,9141 18337,9142 18342,9143 18340,9148 18344,9152 18341,9150 18346,9149 18341,9149 18341,9154 18343,9158 18345,9161 18346,9161 18347,9163 18352,9164 18352,9162 18349,9165 18352,9165 18351,9165 18352,9165 18356,9163 18352,9167 18353,9167 18349,9168 18351,9168 18347,9173 18347,9175 18347,9179 18348,9182 18349,9187 18352,9186 18357,9189 18360,9192 18360,9196 18362,13196 18367,13196 18369,13196 18371,13199 18374,13194 18374,13197 18375,13200 18377,13205 18380,13210 18384,13209 18379,13209 18374,13213 18375,13216 20375,13212 20375,13215 20375,13211 20375,13211 20372,13208 20373,13204 20373,13204 20369,13205 20369,13207 20366,13212 20367,13216 20367,13221 20372,13222 20377,13225 20381,13226 20386,13230 20383,9230 20388,9228 20384,9228 20386,9223 20389,9223 20392,4223 20397,4223 20396,4225 20399,4222 20404,4220 20408,4220 20411,4223 20416,4227 20421,4230 20418,4234 20421,4232 20422,4236 20423,4238 20423,4239 20423,4235 20427,4231 20427,4230 20426,4228 20428,4232 20427,4232 20431,4236 20433,4241 20431,4241 22431,4236 22436,4239 22437,4239 22439,4236 22443,4232 22439,4236 22444,4236 22446,4239 22447,4239 22452,4241 22454,4245 22457,4245 22460,4250 22462,4251 22465,4253 22465,4249 22465,4251 22460,4251 22464,4255 22469,4257 22473,4256 22478,4259 22479,4260 22480,4257 22485,6257 22489,6260 22490,6260 22493,6262 22496,6262 22500,6267 22495,6271 22495,6276 22491,6276 22489,6281 22487,6286 22490,6289 22490,6294 22490,6294 22489,6292 22485,6292 22489,6288 22489,6288 22494,6288 22496,6286 22497,6288 22501,6292 22500,5292 22503,5292 22503,5296 22508,5295 22510,5300 22510,5305 22513,5302 22514,5306 22510,5309 22513,5313 27513,5313 27513,5317 27513,5322 22513,5326 22517,6326 22516,6323 22518,6323 22523,6320 22523,6321 22526,6323 22531,6323 22531,6324 22532,6324 22532,6325 22529,6321 22531,6323 22534,6328 22534,6329 22530,6324 22527,10324 22522,10319 22524,10315 22520,10314 22525,10311 22525,10307 22526,10304 22531,10306 22527,10306 22528,10309 22530,10312 27530,10312 27534,10312 27534,10307 27536,10307 27532,11307 27531,11307 27533,11308 27535,11303 27531,11298 27532,11294 27534,11294 27534,11299 27538,11297 27542,11302 27547,11306 27547,11311 27549,11313 30549,11317 30551,11313 30546,11316 30541,11316 30540,11319 30545,11318 30546,11323 30550,11326 30554,11326 34554,11330 34558,11331 34558,11333 34558,11332 34561,11328 34561,11331 34562,11336 34562,11336 34567,11340 34570,11342 34569,11345 34568,11344 34569,11345 34571,11349 34574,15349 34574,15354 34569,15359 34566,15362 34571,15363 34576,15367 34577,15368 34577,15371 34581,15374 34576,15379 34574,15383 34579,15384 34584,15387 34583,17387 34578,17392 34578,17391 34578,17396 34573,17397 34578,17397 34580,17397 39580,17402 39584,17397 39587,17402 39587,17406 39582,17403 39587,17407 39589,17409 39592,17406 39592,17409 39595,17409 39599,17412 39603,17416 39608,17417 39608,17417 39608,17421 39607,17422 39609,17424 39608,17427 39604,17425 39605,17426 39609,17423 39611,17422 39610,17425 39613,17428 39618,17428 39619,17429 39616,17432 39616,13432 39615,13432 39617,13432 39617,13432 44617,13434 44621,13434 44623,13439 44627,13442 44632,13442 44635,13440 44631,13442 44631,13445 44635,13447 44639,13445 44637,13445 44638,13450 44639,13454 44644,13457 44644,13459 44642,15459 44639,15457 44644,15461 44644,15462 44642,15459 44645,15459 44647,15463 44650,15458 44651,15459 44653,15461 44657,15463 44661,15463 44661,15463 44663,15467 44666,15472 44668,15474 44664,15470 44668,15471 44670,15473 44674,15475 44675,-3806 12298,-3804 12301,-3805 13301,-3804 13296,-3808 13292,-3809 13295,-3806 13300,-3804 13297,-3801 13301,-3801 13302,-3796 18302,-3801 18306,-3799 18311,-3802 18311,-3799 18312,-3801 18314,-3796 18319,-3795 18322,-3791 18321,-3786 18320,-3786 18321,-3784 18321,-3782 18321,-3781 18324,-3782 18325,-3783 18320,-3788 18324,-1788 18324,-1788 18329,-1784 18333,-1784 18334,-1781 18329,-1777 18334,-6777 18337,-6774 18339,-6776 18341,-6781 18341,-6779 18341,-6779 18343,-6779 18339,-6777 18343,-6782 18338,-6779 18341,-6778 18341,-6776 18336,-6776 18333,-6776 18333,-6780 18338,-6784 18338,-6787 18335,-6786 18336,-6781 22336,-6781 22335,-6778 22331,-6777 22326,-6777 22331,-6777 22335,-6772 22335,-6774 22340,-6769 22341,-6767 22337,-6767 22335,-6767 22335,-6767 22333,-6767 22336,-6762 22331,-6759 22331,-6764 22332,-6765 22334,-6767 22339,-6762 22334,-6760 22334,-6760 22334,-6758 22337,-6754 22341,-6754 22342,-6750 22339,-4750 22343,-4747 22343,-4752 22343,-4751 22344,-4749 22345,-4745 22348,-4740 22353,-4736 22358,-4738 22363,-4740 22358,21336 41527,21334 41527,21330 41526,21330 41526,21333 41529,21328 41529,21329 41530,21326 41532,21328 41532,21324 41537,21328 41532,21330 41535,21334 41532,21336 40532,21334 40536,21339 40534,21341 40534,21344 40534,21346 40532,21350 40532,21353 40535,21357 40539,21359 40542,21360 40546,21355 40546,21360 40547,21359 40550,21356 40551,21356 40550,21357 40550,21361 40554,21358 45554,21362 45556,21366 45553,21370 45557,21374 45556,21377 45553,22377 45549,22382 45549,22382 45552,22386 45557,22387 45557,22388 45553,22392 45557,24392 45561,22392 45558,22397 45561,22399 45558,22398 45561,22400 45564,22400 45569,22404 45573,22406 45577,22406 45581,22404 45581,22407 45582,22409 45579,22409 45575,22409 45579,22407 45579,22402 45582,22402 45582,22404 45587,22406 45587,22406 45589,22411 45589,22413 45590,22417 45591,22417 45592,22422 45587,22425 45583,22428 50583,22428 50585,22428 50585,22430 50588,22435 50590,22435 50585,22435 50590,22439 50595,22440 50590,22445 50587,22442 50584,22442 50586,22443 54586,22443 54590,22446 54595,22448 54597,22448 59597,22444 59593,22449 59596,22449 59599,22452 59600,22457 59600,22458 59605,22457 59602,22462 59603,22463 59604,22461 59605,22458 59602,22457 59601,22457 59601,22455 59605,25455 59606,25457 59611,25462 59613,25464 59614,25467 59617,25472 59612,25476 59613,25478 59610,25482 59615,25482 59616,25486 59612,25483 59614,25487 59619,25492 59623,25497 59625,146 2252,150 2249,150 2249,152 2254,157 2249,158 2253,157 2252,161 2255,159 3255,161 3258,161 3255,163 3255,168 3259,168 3259,172 3263,167 3267,172 3271,172 3272,172 3274,175 3278,179 3282,181 3283,184 3280,185 3282,187 3282,191 3284,192 3286,191 6286,193 6289,198 6285,195 6290,194 6289,195 6289,199 6293,200 6288,198 6290,202 6291,207 6296,212 6301,215 6301,216 6301,211 6304,212 6304,216 6309,216 6304,214 6308,213 6308,211 6305,212 6309,217 6314,220 6317,224 6322,222 6327,220 6323,41573 39712,41572 39709,41576 40709,41580 40714,41576 40717,36576 40717,36577 40719,36582 40716,36585 40721,36590 43721,36585 43721,36582 43724,36585 43729,36590 43731,36590 43730,15289 11307,15285 11312,15286 11315,15289 11315,15294 11315,15295 11316,15296 13316,38742 37646,38743 37650,38745 37655,38744 37658,38739 37659,38737 37662,38742 37662,38745 37657,38748 37662,38748 37662,38752 37667,38753 37667,38748 37669,38748 37668,38752 37673,38754 37674,38756 37676,38758 37674,38760 37679,38760 37675,38758 37675,38763 37675,38767 37674,38772 40674,38767 40679,38772 40683,38774 44683,38778 44686,38780 44690,38780 44690,38779 44695,38782 44700,38780 44695,38775 44696,38775 44696,38775 44696,38779 44699,38783 44696,38784 44696,38786 44692,38786 44692,38786 44696,38791 44698,38793 44699,38795 44703,38800 44708,38803 44708,38807 44709,38802 44706,38806 44708,38809 44709,36809 44709,36814 44704,36813 44705,36814 44705,36816 44709,36811 44712,36812 48712,36811 48717,36815 48721,36816 51721,36818 51717,36822 51720,40822 51715,40827 51712,40830 51716,40829 51719,40832 51723,40835 51724,40840 51721,40841 51721,40836 51725,40841 51730,40846 51734,40848 51738,40849 51740,40851 51743,40854 51745,40855 51746,40857 51750,40857 51746,40861 51748,40866 51751,40862 51750,40866 51750,40869 51752,40865 51752,40863 51755,40858 51757,40855 51753,40855 51758,40852 51758,40853 51760,40857 51761,40855 51757,40852 51760,40853 51761,40855 51762,40858 51757,40859 51756,40863 51757,40863 51759,40860 51764,40859 51764,40854 51768,40850 51765,40852 51767,40852 51767,40848 51772,40852 51776,40854 51778,40852 51778,43852 51778,43854 52778,43856 52781,43859 52781,43859 52776,37512 26536,37517 26531,37520 26535,37520 26540,37522 26544,37527 26544,37532 26549,37537 26544,37540 26549,37545 26544,37549 26547,37549 26550,37548 26551,37549 26553,37546 26553,37546 26553,37549 26556,37549 26559,37552 26559,37556 26564,37560 26559,37561 26561,37565 26565,41565 26565,41569 26568,41571 26573,41571 26573,41576 29573,41571 29573,41573 29576,41573 29578,46573 29578,46569 29582,45569 29583,45572 29583,45568 29583,45573 29581,45575 29578,45571 29581,45572 29584,45572 29585,45576 29585,45578 29588,45581 29591,45582 29593,45582 29598,45584 29597,45589 29600,45585 29605,45589 33605,45593 36605,45594 36607,45599 36609,45600 36604,45604 36604,45604 36608,45604 36607,45608 36610,50608 36613,50611 36609,50614 36609,50619 36605,50624 36605,50625 36606,50625 36605,50629 36606,50624 36608,50625 36610,50626 36610,50629 36608,50627 36610,50628 36614,50632 36618,46632 34618,46632 35618,46636 35622,46636 35617,46637 35620,46639 35619,46643 35620,46645 35625,46643 35630,46648 35635,46648 35640,46649 35643,46651 35647,46655 35650,46652 35655,46657 35656,46658 35657,46662 35660,46659 35663,46662 35664,46665 35663,46667 35667,46667 35663,46670 35666,46672 35671,46674 35671,47674 35668,47676 35672,47677 35673,47677 35678,47677 35677,47677 35677,47677 35682,47672 35683,47671 35683,49671 35685,49674 35689,49677 35692,49675 35692,54675 35697,54678 35699,54674 35699,54670 35701,54670 35700,54675 35703,54676 34703,54676 34703,54679 34706,54683 34708,54688 34706,54688 34707,54685 34702,54687 34702,54692 34707,54687 36707,54687 36706,54682 36707,54685 38707,54680 38710,54680 38714,54677 38714,54679 38719,54682 38720,54687 38716,54688 38717,54692 38722,54697 38726,54699 38727,54700 38724,54702 38720,52702 38719,52702 38719,52702 38721,52702 38725,52704 38726,52706 38728,52707 38729,52711 38728,52711 35728,52713 35733,52712 35737,52712 35739,52713 35742,52713 35745,52708 35745,52710 39745,52713 39749,52716 39748,52721 39749,52720 39753,52716 39756,52716 40756,47716 40757,47717 40761,47722 40761,47722 40761,47722 40766,47726 40769,47728 40772,47733 40777,47731 40773,50731 40777,51731 40779,51733 40782,51734 40786,51737 40784,51741 41784,51739 41783,51739 41785,51739 41785,51736 41789,51731 41789,52731 41790,52735 41791,52738 41790,52742 41789,52746 41785,52747 41785,52745 41785,52750 41782,52753 41786,52753 41787,52758 41792,52754 42792,52749 42793,52752 42794,52756 42791,52757 42790,52762 42793,52766 42797,52766 42797,52769 42802,52774 42806,52774 42805,52771 42807,52774 42807,52770 42808,52771 42811,52767 42811,52766 42812,52767 42817,52771 42817,52771 42817,52775 42815,52779 42811,52779 42812,52780 42815,52776 42818,52774 42818,52777 42822,52780 42823,52781 42827,52776 42829,52780 42832,54780 42835,54780 42840,2135 11201,2140 11203,2137 11204,2140 11209,2142 11213,2147 11211,2145 11213,2145 11213,2150 11218,2150 11221,2153 11225,2157 13225,2162 13228,2167 13231,2171 13232,2167 13229,2168 13233,2171 13237,2173 13239,2168 13234,2168 13235,2173 13235,2175 13234,2177 13235,2177 13234,2179 13229,2179 13226,2180 13226,2177 13226,2177 13231,2180 13231,2181 10231,2176 10233,2177 10232,2180 10235,2185 10237,2182 10240,6182 10240,6184 10244,6182 10242,6183 10243,6185 10246,6190 10244,6194 10244,6194 10247,6192 10247,6192 10252,6195 10256,6194 10260,6195 9260,6195 9260,6195 9264,6199 9269,6204 9272,6199 9268,6201 9268,6203 9265,6208 9268,6204 9270,6204 9275,6201 9279,6201 9281,6201 9286,6206 9281,6206 9277,6202 9281,6200 9285,6202 9288,6198 9290,7198 9293,7200 9297,7201 9297,7205 9298,7209 9298,7209 9299,8209 9302,8214 10302,8218 10306,8222 10308,8226 10313,8231 10313,8235 10318,8237 10318,8237 10323,8233 10326,8233 10327,8237 10325,8238 10328,8238 10330,8234 10330,11234 10332,11236 10333,11241 10337,14241 10338,14240 10338,14237 10339,14238 10337,14237 10339,14242 10339,14246 10339,14250 10339,14250 10339,14251 10337,14254 10337,14256 10334,14256 10332,14252 10336,14255 10340,14259 10342,14262 10347,11148 3159,11153 3163,11154 3162,11154 3165,11158 3167,11161 3172,11162 3175,11162 3176,11166 3179,11166 3181,11171 3185,11176 3180,11178 3179,11176 3181,11179 3183,11174 3182,52776 42818,52778 42822,52777 42822,52782 42817,52783 42822,52784 42823,52789 42826,52789 42823,56789 42828,56786 42829,56786 42832,56789 42836,56789 42835,56785 42838,56786 42843,51786 42844,51788 42846,51790 42847,51794 42842,51796 42842,51801 42846,53801 42849,53806 42849,53809 42852,53812 42850,53817 42846,53817 42848,53818 42853,53822 42856,53823 42854,53826 42858,53825 42860,53826 42860,53826 42864,53830 42868,53835 42873,53839 42873,53841 42872,53841 42876,53841 42879,53841 42884,53836 42888,53836 42889,53836 44889,53833 44889,53835 44893,53838 44897,53842 44897,53844 44900,53844 44904,53845 44905,53850 44903,53853 44904,53858 44906,53856 44907,53861 44909,53856 44913,53858 44916,53863 44916,53868 44918,53867 43918,53869 43921,53869 43919,53867 43919,53862 43918,53860 43923,53864 43928,53869 43930,53874 43933,53874 43932,53874 43932,53875 43930,53877 43928,53878 43924,53883 43927,55883 43929,55883 43925,55879 43929,55881 43929,55884 43928,55881 43928,55882 43929,55883 45929,55883 45933,55883 45936,55884 45941,55884 45941,55886 45946,55882 45948,55883 45952,55888 45956,55890 45957,55894 45953,55892 45954,55897 45950,55893 45954,55896 45956,55892 45955,55897 45959,55899 45961,55899 45961,55894 45962,55898 45957,55893 49957,55896 47957,55894 47956,55898 47960,55901 47964,55901 47967,55901 47970,55896 47973,55898 47969,55894 47974,55895 47975,55891 47976,55896 47979,55899 47984,55902 47983,55897 47987,55899 47989,55904 47992,55904 47993,55905 47997,55902 48001,55902 48003,55907 48000,55910 47998,55915 47999,55911 47994,55906 47998,55910 48003,55914 48000,55918 48000,55914 48000,55919 48000,55921 48003,55921 48007,55924 48007,55919 48010,55922 48005,55927 48009,55928 48008,55928 48008,55930 48012,55925 48012,55925 48016,54925 48014,54922 48018,54922 44018,54926 44013,54929 44012,54932 44016,55932 44017,55935 44017,55936 44020,55937 44022,55936 44020,55939 44015,55944 44018,55945 44022,55947 44023,55950 44024,55953 44020,55956 44023,53867 43919,53871 43921,52871 43921,53871 43923,53876 43923,53881 43923,53880 43927,53882 43931,53886 43936,53884 43937,53879 43934,53879 43937,53877 43939,53878 43938,53879 43942,53880 43947,53881 43948,53884 45948,53884 45949,53882 45953,53883 45954,53878 45956,53880 45953,53885 45958,53885 45958,53886 45957,53886 48957,53886 48962,53891 48962,53892 48964,53897 48965,49897 48962,49902 48965,49906 48967,49902 48967,49904 48971,49901 48967,49904 48970,54904 48971,54904 48971,54904 48975,54909 48979,54907 48975,54910 48975,54906 48971,54909 48973,54911 48975,54915 48978,54920 48978,54923 48981,54918 48984,54921 48984,56921 48984,56926 48986,56924 48981,56929 48980,56932 48979,56932 48977,56936 48979,56937 48981,56937 48982,61937 48984,61937 48980,61934 51980,61935 51981,61935 51984,61935 51984,61931 51986,5329 23395,5331 23395,5333 23390,5337 23392,5340 23395,5345 27395,5345 27397,5350 27398,5355 27399,5356 27402,6356 27405,6360 27407,6361 27406,6364 27402,6366 26402,6371 26402,6371 26402,6372 26405,6370 26405,6375 26406,6380 26411,6385 26413,6387 26414,6388 26419,6390 26419,6391 26424,6393 30424,6390 30429,6390 30432,6390 30430,6394 30434,6394 30437,6394 30441,6396 30442,6398 30439,6399 30436,6404 30435,6405 30435,6400 30435,6405 30440,6404 30443,6405 30447,6409 30447,6411 30447,6412 30448,6417 30446,6421 30450,6418 30448,6417 30444,6418 30449,6420 30451,6425 30456,6426 30456,6425 30458,6426 30458,6426 34458,6427 34459,6432 39459,6434 39462,6434 39467,6439 39470,6443 39467,6444 39468,6449 39473,6451 39476,6452 39481,6452 39479,6452 39476,8452 39476,8456 39478,8460 39480,10460 39482,10455 39482,10456 39484,10460 39484,10463 39484,10468 39486,10473 39482,10475 39484,10475 39486,10476 39488,10477 39492,10475 39494,10480 39499,10476 39501,10479 39506,10480 39510,10475 39508,10480 39513,10481 39516,10481 39516,10485 39521,10487 39522,10490 39523,10490 39520,10493 39520,10496 44520,10491 44519,10491 44524,10492 44520,10497 44525,10499 44525,10502 44527,10500 44531,10502 44535,10506 44535,10511 44532,13511 44536,13513 44533,13510 44535,13507 44540,13511 44543,13515 44548,13517 44549,13522 44550,13525 42550,13520 42551,13522 42553,13525 42552,13529 42557,13529 42558,13524 42559,13525 42559,13525 42562,13520 42564,13523 42567,15523 42569,15523 42572,15524 42577,15529 42577,15530 42582,15532 42584,15532 42588,15531 42587,15531 42592,15530 42587,15530 42583,15533 42583,15536 47583,15532 47583,15535 47587,15534 47590,15536 47594,11536 47590,11533 47590,11529 47590,11533 47592,11533 47592,11533 47593,11537 47598,11538 47603,11538 47603,11538 47605,11541 47609,11544 47613,14544 47614,14539 47610,14537 47610,14537 47614,14535 50614,14537 50619,14539 50619,14540 50623,14538 50623,14537 50619,25599 26540,25599 26541,25599 26544,25594 26542,25599 26543,25596 26544,25597 26543,25598 26543,25593 26544,25588 26542,25593 26545,25595 26544,25596 26544,25599 26541,25594 26544,25592 26549,25593 26548,25597 26549,25596 26550,25594 26551,25590 26550,25594 26554,25597 26550,25598 26552,25593 26555,25598 22555,25599 22557,25604 22559,25605 22558,25606 22562,25605 22559,25605 22564,30605 22569,30610 22571,30610 22575,30609 22575,30609 22576,30609 22581,30605 22581,30610 22583,30610 22584,30613 22579,30613 22581,30616 22577,30619 22577,30621 22580,30621 22585,30626 22590,30628 22593,30629 22598,30626 22603,30628 22606,30629 22607,30629 22604,30627 22606,30632 22608,30633 22608,30636 22612,30641 17612,30642 17614,30647 17614,30651 17615,30654 17610,30655 17607,30658 17611,30653 17610,30654 17606,30654 17607,30659 17606,30660 17611,30658 17616,30659 17616,30664 17619,30665 17621,30665 17620,30667 17621,30671 17624,30673 17624,30673 17624,30678 17627,30675 17632,30675 17635,30678 17640,30681 17643,30686 17639,30691 17641,30696 19641,30699 19640,30700 19640,30696 19645,30698 19643,30699 19645,30702 19646,30703 19649,30699 19651,30704 19648,30706 19652,30709 19653,30709 19655,30709 19655,30712 19657,30708 19658,30705 19660,30700 19662,30701 19663,30706 19664,30711 19663,30707 19667,30704 19670,30708 19672,30709 19673,30711 19673,30711 19674,30713 19678,30718 19682,30723 20682,30721 20686,30725 20691,30726 20693,30729 20695,30728 20690,30730 20692,30733 20694,30736 20692,30736 20691,30740 20694,30741 20695,30741 20697,30746 20700,30747 20702,30750 20701,30751 20698,30753 24698,30749 24701,30748 24703,30746 24704,30747 29704,30747 29705,30749 29707,30752 29712,30757 29712,30760 34712,30760 34716,30763 34716,30759 34713,30759 34717,30763 34717,30758 34717,30757 34721,30760 34726,30758 34726,30763 34727,30763 34727,30764 34727,30759 34729,30759 34732,30762 34734,30757 34735,30761 34736,30759 34736,30762 34738,30757 34733,30760 34735,30762 34737,30760 34736,30765 34733,32765 34737,32768 34737,32765 34740,32765 34742,32768 34747,32772 34751,32772 34752,32777 34749,32782 34751,32783 33751,32783 33746,36783 33749,36783 33754,36786 33756,36787 33755,36787 33758,36791 33754,36796 33754,36801 33756,36801 33758,36801 33762,36802 33765,36802 33765,36806 33770,33806 33772,33806 33777,33809 33777,33814 33780,33814 33785,33818 33782,33821 33784,33826 33781,33822 33781,33824 33783,33822 33784,33826 33787,33823 33792,33827 33795,33828 33798,33829 33799,33833 33801,33833 33801,33836 33805,33839 33809,33842 33805,33847 33810,33845 32810,33847 32808,33849 32812,33851 32815,33849 32818,33849 32822,33847 32822,33847 32826,33850 32831,33854 32836,33857 32833,33856 32828,33859 32829,33860 32832,33857 32834,33857 32830,33855 32830,33857 32830,33855 32834,33859 32829,33859 32833,33862 32836,33864 32837,33864 32839,33866 32837,33869 32835,33872 32840,33874 37840,33879 37845,33881 37850,33881 37855,33886 37856,33891 37860,33896 37860,33893 37863,33894 38863,33896 38859,28896 38864,28899 39864,33899 39869,33896 39871,33898 39875,33902 39873,33902 39875,33907 39879,33912 39884,33908 39887,33908 39888,33905 39890,33909 39895,33911 39896,33908 39900,33912 39901,33915 39902,33915 39902,33915 39902,33910 39907,33910 39904,33914 39903,33912 39906,33916 39909,33920 39909,33922 39912,33923 39916,33928 39916,33931 39918,33932 39919,33935 39915,33936 39912,33934 39909,35934 39914,35931 39915,35935 39917,35939 39920,35939 39915,35940 39911,35944 39916,35944 39911,35944 39908,35945 39904,35945 39908,35945 39912,35950 39915,35955 39917,38955 39916,38960 39921,38962 39920,38962 39920,38967 39922,38967 39924,38970 39928,38975 39928,38973 39928,38977 39931,38980 39934,38984 39936,38982 39939,38983 39942,38985 39943,38987 39945,38992 41945,38988 41950,38989 41954,38992 41958,38992 41962,38992 41965,38993 41970,38997 41970,38997 41970,38994 41974,38994 41979,38997 41979,38999 41982,38994 41980,38998 41985,38998 41984,5334 23406,5330 23406,5325 23403,9325 23404,12325 23408,12325 23408,12322 23406,13322 23411,13325 23416,13326 23412,13322 23414,13327 23419,13328 23422,13329 23425,13333 23422,13337 23424,23491 35549,23490 35544,23494 35546,23499 35548,23495 35549,21495 35553,21490 35556,21492 35558,21492 35556,21494 35559,21494 35564,21494 35566,21499 35566,21502 35562,21502 35567,17502 35568,17506 35573,17507 35574,17511 35578,17512 35583,17513 35588,18513 35591,18514 35592,18515 35594,18513 35596,16513 35601,16513 37601,16513 37602,16511 37604,16513 37609,16514 37611,16518 37616,16522 34616,16524 34613,16528 34615,16528 34620,16533 34624,16535 34627,16538 34628,16539 34630,16539 34631,16542 34628,16542 34633,16544 34638,16547 38638,16547 38640,16543 38645,16543 38640,16540 38640,16543 38640,16542 38641,16546 38646,16541 38649,16541 38645,18541 38648,18544 38648,18544 38653,18544 38656,18549 38651,18547 38651,18550 38656,18547 38658,23547 38663,23544 38664,23548 38668,23548 38670,28548 38672,28549 38669,28549 38673,28545 38669,28549 38670,28554 38670,28557 38674,28560 38669,28562 38674,28562 38669,28561 38669,28564 38671,28569 38671,38779 44699,38780 44695,38778 44698,38783 44700,38785 44700,38781 44701,38782 44696,38786 44691,38789 44692,38794 44692,38799 44688,38799 44693,38803 44697,38808 44697,38806 44697,38806 44700,38803 44702,38803 44706,38802 44707,38807 48707,38808 48707,38806 48707,38810 48712,38810 48709,38810 48711,38810 48711,38806 48707,38802 48710,38803 48706,38805 48711,38810 48711,38805 48709,38809 48710,38809 48710,38814 48707,38815 48703,38816 48703,38816 48704,38820 48704,38822 48709,38820 48710,38818 48714,38822 48716,38822 48719,38827 48722,38828 48727,38832 48725,38830 48730,38831 48726,38832 48724,38829 48728,8431 35532,8431 35537,4431 35532,4434 35537,4438 35537,4439 35533,4443 35535,4442 35530,4445 35527,4449 35527,4453 35530,4458 35530,4459 39530,4460 39531,4461 39531,4464 39531,4468 39531,4470 39534,4465 39534,4465 39532,4469 39532,4471 39537,4466 39538,4470 39539,4473 39540,4476 39540,4480 39543,4485 39548,4483 39546,4484 39547,4484 39549,4484 39551,4486 39553,4486 39554,4487 39551,4483 39553,4486 39554,4490 39556,4493 39557,4498 39561,4494 39562,-4749 22345,-4752 22345,-4748 22348,-4744 22351,-4740 22356,-4741 22358,-4739 22361,-4734 22359,-4730 25359,-4730 25360,-4725 25360,-4727 25360,-4727 25361,-6727 25360,-6729 25365,-6730 25365,-6727 25365,-6731 25364,-6730 27364,-6727 27366,-6723 27367,-3723 27363,-3719 27368,-3720 27371,-3718 27366,-3717 27369,-3716 27369,-3714 27372,-3711 27370,-3712 27371,-3712 27370,-3710 27375,-3708 27377,-3707 27382,-3706 27385,-3706 27389,-3705 32389,-3704 32392,-3704 32392,-3699 32391,-3699 32395,-3694 32399,-3694 32400,-3695 32404,-3695 32408,-3693 32410,-3693 32410,-3697 32410,-3692 32413,-3691 32418,-3686 32420,-3683 32425,-3681 32420,-3678 32424,-3673 32424,-3676 32427,-3673 32426,-3671 32426,-3676 33426,-3678 33428,-3676 33428,-3679 33428,-3679 33433,-3677 33434,-3676 33438,-3681 33440,1319 33444,1321 33441,1325 33444,1329 33439,1326 33444,1326 33439,1327 33439,1327 33440,1332 33444,1333 33449,1338 33453,1338 33450,1343 33450,1347 33454,1346 33457,1346 33455,1342 33459,1341 33462,1346 33462,1347 33463,1343 33463,1344 33462,1348 33457,1347 33460,1352 33464,1356 33468,1361 33469,1363 33468,1365 33469,1368 33472,1369 33475,-2631 33478,-2633 33483,-2629 33486,-2632 34486,-2628 36486,-2625 36488,-2621 36488,-2624 36488,-2622 36492,-2624 36491,-2629 36491,-2627 36496,-2623 36499,-2628 36502,-2631 36506,-2626 36506,-2622 36506,-2622 36509,-2619 36514,-2624 36512,-2621 36510,-2619 36510,-2619 36508,-2617 36512,-2615 36512,-2615 36513,-2615 36511,-2615 36506,-2612 36507,-2609 36511,-2606 37511,-2606 37508,-2610 37505,-2607 37508,-2602 37512,-2599 37512,-2595 37510,-2597 37511,-2592 37515,-2597 37514,-2592 37519,-2592 37524,-2592 37526,-2594 37521,-2594 37516,-2591 36516,-2588 36517,-2589 36513,-2586 36514,-2584 36514,-2583 36516,-2579 36514,-2578 36518,-2578 35518,-2575 35519,-2577 35519,-2578 35524,-2578 35529,-2578 35532,-2578 35534,-2580 35537,-2584 35541,-2586 35542,-2587 35544,-2585 35540,-2585 35544,-2584 35543,-2580 35548,-2576 35550,-2571 35553,-2567 35555,-2565 35560,-2560 35560,-2557 35564,-2553 35564,-5553 36564,-5548 36564,-5544 36565,-5547 36565,-5545 36570,-5542 36565,-5543 36566,-5543 36568,-5543 36570,-5540 36575,-5537 36577,-5535 36581,-5532 36580,-5528 36575,-5526 38575,-5526 38576,-5526 38571,-5522 38571,-5518 38576,-5514 42576,-5510 42581,-5512 42583,-5512 42582,-5507 42582,-5510 42585,-2510 42589,-2511 42592,-2508 42594,-2506 42597,-2503 42598,-2503 42603,-2498 42608,-2501 42611,-2500 42616,-2502 42613,-2502 42616,-4502 42616,-4502 42620,-4502 42622,-4506 42619,-4509 42621,-4511 42624,-4515 42625,-4510 42625,-4507 42628,-4502 42624,-4501 42629,-4505 45629,-4503 45630,-4499 45631,-4496 45630,-4497 45628,-4495 45630,-4494 46630,-4491 46634,-4487 46629,-4483 46631,21336 40532,21341 40533,21346 40534,21346 40536,21345 40536,21346 40536,21345 40536,21344 40538,21347 40543,21348 40543,21351 40540,21351 40542,21348 40545,21351 40546,21352 40546,21353 40546,21358 40546,21359 40545,21359 40550,21357 40555,21362 40560,21364 40555,21363 40555,21364 40560,25364 40564,25365 40566,25368 40566,25371 45566,25372 45567,25372 45562,25376 45564,25381 42564,25385 42560,25389 42564,25389 42568,25393 42572,25390 42572,28390 42569,28389 42570,28385 42574,28386 42576,28389 42577,31389 42578,31385 42582,31387 42582,31390 42578,31391 42579,31392 42576,29392 42580,29396 42582,29398 43582,29402 43584,29406 43585,29407 43587,29411 43592,29413 43594,29414 43595,25414 43600,25412 43595,25415 43599,25420 43602,25418 43604,25423 43599,25426 43599,25429 43602,25434 42602,25429 42604,25432 42600,25435 42605,25436 47605,25440 50605,25441 50610,25439 50614,25444 50617,25447 50621,25444 50624,25444 50626,25445 50627,25450 50632,25450 50628,25451 50630,25451 50632,25454 50633,25458 50637,25462 50641,25463 50640,25463 51640,25467 51644,25469 51649,25473 51650,25474 51653,25475 51654,26475 51658,26475 51662,26474 51665,26476 51665,26481 51661,26483 55661,26485 55664,30485 55667,30485 55670,30489 55671,30489 55668,30491 55670,30492 55670,30493 55675,30497 55675,30501 55671,30503 55676,30500 55677,30498 55672,30494 55675,30499 55676,30500 55676,30505 55681,30501 55684,30496 55685,30500 55685,30502 55687,30506 55692,30507 55693,30506 55692,30511 55693,30516 55694,30514 55699,30514 55701,30512 55701,34512 55705,34516 55708,34520 55704,34518 56704,34519 56704,34520 56706,34517 56706,34515 56701,34519 59701,34522 59706,34522 59708,34522 59713,34526 59715,34528 59717,34533 59712,34538 59715,34538 59717,34541 59717,34546 59720,34548 59721,34552 63721,34547 63726,34549 63728,34554 63726,34556 63726,34557 63721,34556 63725,34561 63730,34558 63730,37558 63725,37561 63729,37565 63724,37569 63720,37573 63718,37578 63722,37577 63718,37579 63720,37579 63722,37580 63719,37580 63720,37579 63724,37574 63725,37574 63727,37576 63725,37581 63729,37583 63732,37586 63732,37590 63737,37592 63734,37597 63731,37600 63730,37596 63731,37596 63733,37600 63733,37601 63735,37596 63735,37591 63732,37596 63733,37601 63738,37602 63733,37599 63738,37594 63740,37598 63744,37603 63745,37605 63747,37607 63752,37607 63756,37603 63757,37603 63761,37604 63761,37608 63758,37609 63762,37604 63764,37604 63764,41604 63765,41600 63761,41599 63761,41600 63766,41596 63766,41599 63766,41601 63770,41604 63768,41608 63768,41611 63772,41614 63767,41609 63763,41612 63765,41615 63760,38615 63764,38615 63768,38618 63768,35618 63769,35618 63774,35617 63775,35618 63776,35613 63775,35615 63780,35612 63782,35613 63779,35614 63775,35618 63774,35619 63776,35624 63778,35624 63780,35629 63785,35629 63780,35626 63781,35624 63782,35629 63784,35634 63787,35638 63782,35634 63783,35634 63778,35633 63777,35638 63782,35641 63786,35644 63791,35648 63793,35647 63793,35649 63797,35653 63801,35654 63804,35654 63804,35656 63804,35655 63806,35658 63810,35658 63805,35662 63805,35657 67805,35658 67808,35660 67811,35664 67808,35660 67803,35658 67803,35661 67803,35663 67808,35666 67810,35670 67814,35669 67813,35669 67816,37669 67820,37664 67820,2275 13363,2278 16363,2274 16363,2275 16362,2279 16362,2282 16362,2287 16366,2284 16366,4284 16366,4286 16371,4290 16375,4294 18375,4295 18377,9295 18381,9296 18381,9299 18382,9303 18379,9305 19379,9308 19375,8308 19380,8312 19380,38746 37651,38749 37652,38754 37653,38757 37656,38753 37661,38753 37661,38758 37663,38763 37664,38763 42664,38768 42666,38765 42668,38770 42664,38767 42659,38768 42659,38773 42654,38771 42659,38775 42661,41775 42663,41778 42665,41781 42669,41782 42667,41779 42669,41784 42672,41781 42672,41783 42672,41780 42672,41783 42675,41784 42675,41788 42676,41792 42677,41792 42675,41793 42680,41793 42676,41796 42681,41801 42685,41804 42684,41806 42685,41804 42690,41802 42692,41805 42696,41800 42697,41802 42698,41804 42700,41809 42704,41813 42705,36813 42708,36813 42704,36810 42703,36811 42705,40811 42706,40815 46706,40816 46708,40820 46708,40818 46712,40822 46717,40825 46720,40829 46724,40827 46727,40831 46727,40833 46731,40829 46733,40830 46733,36830 46738,36830 46741,36834 46744,36831 46749,36826 46748,36822 46748,36824 46751,36819 46755,36823 46758,36823 46762,36824 46766,36822 46769,36826 46772,36831 46774,36828 42774,36833 42776,36833 42777,36838 42782)')));
@@ -42,13 +42,13 @@ SPATIAL KEY (g3),
SPATIAL KEY (g4),
SPATIAL KEY (g5),
SPATIAL KEY (g6)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
DROP TABLE t1,t2;
CREATE TABLE t1 (
p INT NOT NULL AUTO_INCREMENT,
g LINESTRING NOT NULL,
PRIMARY KEY(p)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
ALTER TABLE t1 ADD SPATIAL INDEX spatial_idx (g);
INSERT INTO t1(g) VALUES(ST_linefromtext('linestring(-5 -576,0 -576,0 -571,0 -571,5 -568,6 -564,6 -565,6 -563)'));
INSERT INTO t1(g) VALUES(ST_linefromtext(concat('linestring','(18 106,19 106,24 111,27 108,32 104,37 107,42 107,44 112,44 116,40 118,43 114,46 114,42 118,44 123,45 123,49 123,53 119,50 123,50 124,54 126,58 125,59 126,64 127,65 127,69 131,74 132,75 135,78 139,2078 141,2075 143,2077 143,2079 143,2084 143,2085 147,2090 -1853,2086 -1852,2086 -1856,2089 -1852,2093 -1850,2090 -1851,2090 -1852,2091 -1851,2092 -1850,2097 -1847,2102 -1848,2100 -1852,2100 -1852,7100 -1851,7103 -1850,7104 -1847,7109 -1842,65 127,67 131,66 131,61 132,61 133,62 137,65 1137,2065 1135,2061 1135,2064 1135,5064 1135,5066 1135,5070 1136,5070 1141,5071 1138,5074 1141,5075 1141,5074 1137,5076 1137,5071 1139,5066 1142,5065 2142,5068 2147,5073 2151,5069 2156,5071 2157,5072 2162,5074 2165,5069 2169,5072 2169,5076 2173,5074 2169,5078 2169,5076 2170,76 2175,74 2179,75 2184,80 2188,83 2190,87 2189,84 2193,87 2189,86 2190,87 2195,87 2200,87 1200,85 1202,86 1199,87 1200,87 1201,91 1206,92 1204,94 1204,98 1206,102 1208,105 1211,102 1216,105 1220,109 1224,110 1224,114 1225,117 1224,118 1229,117 1232,122 1237,123 1236,120 1235,124 1237,121 1236,122 1240,126 1244,127 1246,126 1249,125 5249,123 5251,127 5251,131 5251,135 5256,138 5257,135 5257,139 5257,138 5258,141 5260,146 5260,146 5260,143 10260,147 10265,151 10270,156 10266,157 10269,162 10273,166 12273,168 12274,163 12270,168 12275,170 12277,170 12277,-3830 12277,-3825 12277,-3824 12278,-3825 12276,-3825 12278,-3822 12277,-3825 12275,-3829 12278,-3828 12275,-3824 12280,-3827 12280,-3826 12282,-3822 12283,-3822 12286,-3820 12288,-3818 12289,-3816 12294,-3817 12297,-3819 12300,-3816 12297,-3813 12295,-3811 12299,-3811 12297,-3806 12298,-3806 12298,-3804 12301,-3801 12306,-3803 17306,-3803 17306,-3798 17306,-3803 17310,-3801 17314,-3798 17317,-3797 17317,-797 17321,-797 17323,-796 17325,-793 17326,-792 17322,-789 17327,-784 17331,-780 17335,-776 17339,-774 17339,-771 17342,-770 17345,-765 17348,-765 17349,-763 17353,-760 17350,-760 22350,-756 22346,-752 22349,-748 22352,-752 22348,-748 22347,-746 22345,-745 27345,-743 27346,257 27350,260 27349,261 27352,266 27348,266 22348,269 22347,271 22347,272 22347,273 22348,273 22352,278 22348,279 22344,282 22345,282 22342,283 22347,283 22347,288 22349,292 22347,292 22348,293 22348,298 22348,303 22351,306 22352,309 22352,308 22354,310 22356,311 22361,311 22358,311 22360,311 22360,315 22356,320 22358,325 22363,326 22366,321 22371,318 22373,318 22375,314 22375,316 22375,321 22376,321 22376,322 22372,32 104,36 109,40 114,40 113,40 117,44 119,49 123,49 126,49 129,53 133,50 137,50 139,49 137,48 138,43 138,42 139,46 142,46 138,41 139,45 141,4045 5141,4045 5146,4042 5147,4043 10147,4041 10150,4042 10152,4045 10152,4041 10156,4041 10152,4041 10152,4046 10153,4049 10156,4046 10155,4051 10157,4055 10159,4055 10160,4056 10161,4055 10166,4054 10169,4054 10172,4054 15172,4051 15176,4047 15177,4049 15174,4047 15176,4047 15176,4046 15177,4046 15180,4043 15184,4043 15187,4038 15190,4040 15194,4040 15199,4045 15196,4047 15197,4050 15200,4050 15204,4050 15208,4047 15212,4047 15215,4049 15216,4046 15218,4042 15223,4042 15228,4042 15232,4047 15235,4050 15236,4050 15239,4051 15243,4053 15243,4050 17243,4052 17243,4052 18243,4057 18247,4061 18249,4064 18249,4067 20249,4067 20250,4067 20255,4066 20259,4066 20259,4067 20255,4069 20256,4071 20258,4072 20254,4067 20257,4067 20260,4069 20265,4065 20267,4069 20266,4070 20267,4071 20264,4074 20259,4070 20264,4073 20260,4074 20263,4077 20268,4082 20271,4084 20273,4084 20277,4081 18277,4085 18279,4086 18276,4087 18273,4087 18275,4092 18277,4093 18279,4093 18280,4095 18280,4091 18283,4092 18281,4094 18283,4090 18287,4094 18287,138 5257,138 5255,138 5258,-1862 5254,-1860 5256,-1856 5258,-1851 5255,-1850 5260,-1847 5260,-1847 5263,-1847 5258,-1850 5257,-1850 5259,-1851 5257,-1855 5258,-1853 5261,-1849 5261,-1849 5258,-1849 5259,-1845 5264,-1847 5264,-1850 5268,-1852 5266,-1853 5270,-1856 5265,-1852 5262,-1847 5263,-1842 5263,-1842 5260,-1842 5265,-1841 5265,-1844 5265,-1842 5270,-1837 5274,-1838 5279,-1843 5275,-1842 5280,-1838 5281,-1838 5285,-1833 5285,-1828 5288,-1824 5289,-1828 5291,-1831 5291,-1826 5291,-1830 5293,-1826 5296,-1822 5301,-1826 5302,-1826 5302,-1826 5302,-1825 5297,-1820 5299,-1816 5303,-1816 5299,-3811 12299,-3809 12302,-3806 12302,-3806 12302,-3803 12304,-3798 12304,-3797 12304,-3793 12306,-3788 12306,-3783 12309,-3816 12294,-3811 12299,-3809 12297,7100 -1851,7098 -1854,7102 -1854,7107 -1856,7107 -1858,7110 -1854,7110 -1851,7113 -1851,7115 -1851,7120 -1851,7123 -1847,7124 -1852,7125 -1852,7127 -1852,7131 -1852,7129 1148,7129 1145,7133 1150,7137 1148,7138 1147,7143 1149,7147 1154,8147 1155,8152 3155,8147 3157,8143 3158,8144 3160,8144 3164,11144 3167,11146 3167,11148 3163,11152 3161,11148 3159,11149 3163,11150 3161,11151 3166,11154 3171,11154 3170,8144 3160,8144 3163,8144 3166,8145 3166,8146 3171,8146 3174,8144 3174,8144 3174,8145 3176,8141 3180,3141 3182,7141 3183,7141 7183,7136 7185,7136 7185,7133 7187,7136 7187,7131 7190,7136 7194,7137 7197,7141 7196,7139 7199,12139 7200,12143 7200,12143 7199,12144 7203,12145 7200,12141 7200,12136 7195,12136 7191,12137 7191,12137 7196,12139 7197,12140 7197,12137 7201,12140 7204,12140 7209,12143 7209,12145 7210,12147 7214,12148 9214,12152 9218,12149 9218,12149 9221,12149 9220,12150 9222,12153 10222,12153 10226,12156 10227,12159 10223,12160 10220,12161 10225,12161 10227,12163 10224,12163 10223,12158 10224,12158 10227,12158 10231,12155 12231,12157 12226,7136 7185,7139 7189,7139 7189,7139 7188,7137 7191,7139 7191,7140 7189,7143 7191,7144 7189,7144 7190,7149 7193,7152 7194,7154 7198,7153 7203,7148 7207,12148 7209,12146 7209,12145 7213,12140 7217,12139 7219,12141 7219,12138 7218,12143 7218,13143 7220,13140 7224,13142 7228,13137 7231,13142 7235,13146 7239,13149 7243,13148 7247,13150 7248,13155 7249,13155 7253,13155 7253,13155 7258,13157 7260,13162 7255,13159 7255,13163 7258,13164 7258,13164 7263,13167 7264,13167 8264,13165 8265,13169 8265,13171 13265,13175 13261,13176 13259,13176 13259,13180 13262,13181 13262,13183 13262,13188 13265,13191 13267,13191 13265,13194 13267,13191 13269,13192 13264,13196 13269,13198 13272,13200 13272,13202 13270,13207 11270,13211 11270,13211 11273,13213 11274,13217 11275,13222 11276,13222 11272,13226 11274,13231 11277,13233 11282,13236 11284,13238 11284,13236 11286,13236 11288,13236 11283,13236 11284,13238 11289,13241 11292,13244 11292,13245 11289,13241 11294,13244 11298,13249 11301,320 22358,324 24358,328 24358,327 24363,326 24359,327 24361,329 24365,334 24367,-666 24367,-670 24368,49 123,46 127,46 129,49 131,49 136,47 135,45 138,3045 135,3042 138,3044 139,3044 144,3049 144,3053 142,3055 137,3058 136,3053 139,3048 142,7048 138,7048 3138,7048 3139,7048 3140,7050 3145,7053 1145,7050 1146,7053 5146,7048 5150,7047 5146,10047 5147,10043 5147,10047 5147,10050 5152,10052 5155,10054 5156,10056 5157,10056 5159,10058 5162,10062 5164,10062 5169,10066 9169,10068 9168,10063 9164,10063 9169,10061 9171,14061 9172,14061 9174,282 22342,287 22347,288 22347,288 22343,285 22339,280 22338,278 22341,279 25341,284 25343,13241 11294,13246 11296,13243 11296,13244 11291,13245 11291,13244 11291,13246 11295,13251 11300,13253 11305,13253 11306,13258 11305,13255 11306,13256 11309,13256 11311,13261 11307,13265 11303,13267 11305,13270 11301,13275 11298,13271 11300,15271 11302,15276 11306,15279 11303,15284 11305,15286 11305,15289 11307,15290 11302,15292 11305,15296 11309,15297 11313,15298 11316,15300 11317,15304 11320,15306 11324,15306 11320,15307 11320,15312 11320,15313 11319,15317 11317,15315 11321,15317 11323,15317 11328,15319 11333,15322 11336,15322 11337,15322 11337,15324 11341,15324 11345,15325 14345,15328 13345,17328 13346,17333 13349,17337 13354,17338 13358,17342 13358,17346 13353,17348 13353,17345 13353,17348 13354,17347 13354,17347 13354,17347 13355,22347 13358,22349 13355,22351 13355,22356 13354,22358 13354,22361 13355,22362 13355,22358 13355,22359 13359,22364 13364,22369 13369,22372 13373,22376 13371,22377 13371,22377 13369,22381 13374,22386 13379,22387 13376,22387 13380,22392 13378,22390 13374,22392 13378,22391 13378,22391 13375,22392 13378,22390 13380,22393 13382,22398 13387,22398 10387,22402 10391,22399 10392,22400 10392,22400 10394,22404 10391,22403 15391,22405 15392,22407 15392,22412 15387,22412 15390,22412 15394,22408 15396,26408 15398,26407 20398,26411 20402,26415 20406,26417 20411,26420 20407,26422 20407,31422 16407,31421 16405,31421 16410,31423 16410,31426 16414,31426 16410,31430 16415,31430 16418,31435 16419,31437 16420,31438 16422,31438 16425,31438 16425,31441 16427,31439 16431,31441 16436,36441 16436,36443 18436,36442 18437,36440 18440,36440 18436,36440 18440,36442 18445,36443 18446,36447 18451,37447 23451,37452 23456,37456 23455,37458 23459,37456 23461,37458 23463,37460 23466,37464 23469,37460 23474,37462 23476,37461 26476,37466 26479,37470 26483,37471 26488,37474 26489,37474 26485,37474 26483,37474 26488,37470 26492,37474 26497,37474 26499,37478 26495,37483 26499,37483 26501,37488 26496,37491 26499,37495 26495,37500 26496,37500 26497,37500 26501,37497 26499,37497 26499,37495 26504,37498 26504,37494 26509,37497 26514,37495 26515,37498 26514,37503 26514,37508 26512,37510 26516,37511 26519,37509 26523,37506 26528,37507 26532,37512 26536,37513 26538,37510 26542,37512 26544,37517 26543,37522 26546,37527 26551,37525 26555,37529 26558,37524 26563,37524 26562,37527 26562,37522 26562,37522 26559,37526 26561,37522 26559,37523 26561,37523 26556,37524 26558,40524 26560,40524 26563,40521 26567,40525 26566,40527 26568,40532 26572,40534 26569,40533 26565,40531 26565,40535 26569,40535 26570,40539 26572,40544 26575,40543 26575,40544 26579,40548 26584,40549 26581,40553 26585,40556 26590,40552 22590,40557 22594,40556 22595,40561 22592,40561 22593,40565 22593,40568 22593,40573 22588,40570 22590,40570 22591,40570 22588,40573 22590,40573 22593,40568 22593,40567 22597,40567 22599,40571 22599,40574 22600,40574 22604,42574 22607,42577 22607,42577 22612,42579 22616,38579 22619,38580 22617,38580 22614,38575 22619,38579 22619,38579 18619,38582 18614,38582 18617,38586 18622,38590 18625,38590 18622,38594 18621,38596 18616,38597 18614,38597 18618,38600 21618,38601 21618,38605 21620,38607 25620,38611 25620,38608 25617,38608 25621,38608 25625,38611 25623,38615 25623,38615 25620,38616 25622,38619 25624,38620 25625,38620 26625,38623 26627,38623 26627,311 22358,311 22359,-1689 22360,2311 27360,2312 27360,2312 27360,2317 27362,2317 27362,2319 27359,2319 27364,2318 27359,2321 27364,2326 27367,2325 27371,2326 27373,2326 27373,2325 27377,2329 27377,2327 27377,2330 27379,2333 27379,2331 27379,2331 27381,2336 27381,6336 27382,6336 27383,40527 26568,40531 26572,40533 26574,40538 26576,40533 26580,40538 26585,40539 26588,40536 26583,40540 26587,40539 26588,40535 26593,40540 26594,40544 26597,40548 26602,40548 26601,40549 26602,40547 26602,40548 26603,40553 26606,40548 26606,40548 26603,40551 26608,40556 26612,40559 26616,40554 26619,40556 26619,40556 26623,42556 26623,42556 26624,42560 26624,42562 26626,42563 26630,42564 26630,42564 26634,42559 26635,42562 26635,42565 26637,42562 26638,42564 26642,42564 26641,42568 26641,42572 26641,42572 29641,42574 29642,39574 29641,39574 34641,39576 34643,39581 34638,39578 34638,39574 34642,39574 34645,39572 35645,34572 35648,34577 35651,39577 35655,43577 35659,43580 35655,43575 35658,43578 35658,43581 35662,43577 39662,43572 39658,43572 39661,43572 39664,43572 39666,43576 39670,43577 39667,43580 39671,43576 39673,43573 39673,43574 39677,43569 39679,43567 39679,43568 39683,43563 39686,43566 39690,43566 39692,43568 39694,43568 39695,41568 39691,41570 39692,41571 39692,41571 39693,41571 39698,41571 39698,41574 39698,41569 39698,41570 39699,41570 39704,41572 39709,41573 39712,41578 39713,41579 39717,41584 39719,41585 39720,-1850 5268,-1845 5268,-1847 5266,-1842 5268,-1840 5263,-1845 5264,-1843 5264,-1839 8264,-1839 8267,-1839 8272,-1838 8276,-1834 8273,-1834 8273,-1833 8274,-1837 8279,-1836 8283,-1834 8286,-1836 8282,-1834 8279,-1835 8279,-1834 8280,-1836 8283,-1841 8288,-1846 8289,-1843 8286,-1838 8286,-1841 8285,-1838 8285,-1834 8288,-1829 8291,-1825 8286,-1825 8289,-1825 8287,-1824 8291,-1822 8294,-1821 8298,-1818 8300,-1818 8296,-1814 8296,-1811 8295,-1808 8292,1192 8296,1192 8297,1195 11297,1192 11301,1195 11305,1197 11300,1193 11300,1193 11296,1193 11293,1194 11294,1199 11292,1204 11292,1205 11294,1210 11292,1208 11288,1204 11290,1205 11289,1207 8289,1202 8284,1204 8282,1204 8281,1206 8281,1208 8281,1212 8283,1212 13283,1213 13287,1213 13290,1216 13293,1214 13289,1217 13286,1212 13291,1208 13288,1208 13292,1209 13297,1208 13296,1204 13298,1205 13303,1209 13308,1204 13308,1209 13304,1210 13304,1214 13309,1214 13314,1215 13314,1219 13314,1219 13319,1224 13320,1229 13321,1232 13325,1233 13329,1231 13329,1234 13334,-2766 13336,-2769 13337,-2765 13340,-2762 13345,-2760 13342,2240 13342,2238 13342,2242 13342,2246 13345,2246 13346,2244 13348,2239 13348,2240 13351,2240 13352,2245 13357,2248 13357,2243 13362,2247 13362,2248 13362,2252 13363,2256 13363,2256 13363,2260 13367,2255 13372,2251 13369,2251 13369,2252 13372,2249 13376,2254 13378,2255 13382,2259 13379,2262 13379,2267 13381,2262 13381,2262 13383,2265 13383,2269 13385,2270 13386,2271 13389,2267 13391,2271 13386,2275 13391,2273 13392,2275 13387,2277 13390,2274 13390,2275 13394,2280 13395,2280 11395,2281 14395,2279 14400,2277 14403,2273 14406,2274 16406,2274 16410,2279 16410,2284 16411,2280 16409,2280 16409,2282 16409,2282 16411,2282 16412,2280 16413,3280 16418,3284 16418,3285 16423,3289 16423,3292 16427,3294 16429,3296 16431,3297 16436,3298 16435,3303 16435,3305 16434,3305 16436,3305 16436,3309 16437,3309 16438,3308 16439,3308 16439,3306 16444,3302 16441,-1698 16437,-1703 16438,-1699 16438,-1697 16438,-1698 16439,-1695 16436,-1690 16441,-1687 16446,-1683 16450,-1682 16451,-1684 16453,-1682 16457,-1682 16457,-1686 16460,-1681 16459,-1680 16456,-1677 16460,-1681 16461,-1679 16464,-1674 16465,-1673 16469,-1669 16471,-1669 16476,-1665 16474,-1665 16478,-1664 16478,-1664 16479,-1661 16474,-1656 16471,-1655 11471,-1660 11473,-1663 11475,-1666 11480,3334 15480,3338 15476,3342 15471,3345 15471,3345 15470,3350 15469,3347 15474,3351 15476,3352 15473,3353 15476,3350 15477,3350 15479,3351 15482,3352 15484,3351 15487,3353 15487,3358 15487,3353 15486,1217 13286,1222 13291,1222 13291,1225 13286,1229 13286,1231 13281,1235 13280,1236 13281,1241 13282,1245 13285,1247 13285,1247 13287,1250 13287,1247 13290,1247 13295,1247 13298,1252 13301,1249 13304,1252 13304,3252 13304,3247 13304,3249 13308,3254 13308,3257 13308,3261 17308,3261 17309,3261 17306,3259 17305,3262 17310,3263 17308,3262 17311,3259 17314,3259 17314,3257 17309,3254 17309,3253 17309,3255 17310,3253 17312,3255 17312,3255 17312,3256 17307,3257 17307,3256 17311,3256 17313,3255 17317,3251 17317,3248 17321,3253 17325,3256 17326,3258 17324,3258 17327,3263 17322,7263 17325,7265 17328,7263 17330,7265 17333,7270 17333,7273 17333,7278 17336,4278 21336,4278 21340,4279 21340,4281 21340,4286 24340,4290 24343,9290 24347,9294 24349,9296 24347,9298 25347,9301 25348,9301 25348,9304 25353,9303 25357,9303 25352,11303 25355,11304 25358,11307 25358,11312 25358,11312 25361,11310 25365,11313 25365,11314 25369,11319 25371,11321 25371,11325 25366,11329 25365,11330 25366,11329 25370,11330 25365,11334 25367,11338 25366,11343 25363,11348 25359,11345 25356,11348 25357,11349 25358,11349 25358,11352 25360,11356 30360,11360 30365,11360 30365,11362 30365,11367 30367,11368 30369,15368 30370,15373 30371,15376 30373,14376 30378,14377 30383,14381 30378,14386 30380,14388 30382,14391 30385,14393 31385,16393 31389,16396 31394,16396 31397,16392 31400,16395 31405,16398 31409,16398 31413,16397 31415,16396 31417,16401 31418,16401 31422,16402 31419,16407 31420,16411 31419,16406 31423,18406 31427,18411 31432,18415 28432,18417 28437,18418 28441,18414 28438,18417 28435,18416 28439,18420 28442,18423 28447,18427 28444,21427 28445,21428 28450,22428 28455,22432 28457,22436 28458,22441 28458,22445 28463,22448 28468,22451 28465,22456 28468,22453 28468,22458 28471,22463 28473,22460 28475,22459 28472,22463 28476,22464 28472,22468 28468,22468 28471,25468 28466,25471 28468,25473 28464,25473 28464,25475 29464,25476 29466,25479 29461,25476 29462,25476 29464,25478 29464,25483 29461,25484 29460,25486 29458,25486 29462,25490 29460,25495 26460,25498 26463,25495 26468,25495 26472,25495 26472,25499 26474,25504 26476,25504 26478,25509 26476,25513 26479,25514 26481,25519 26477,25519 26480,25518 26481,25519 26484,25524 26483,25527 26484,25522 26484,25526 26487,25528 26492,25533 26496,25535 26498,25535 26498,25539 26503,25542 26504,25543 26505,25547 26510,25552 26510,25551 26508,25550 26512,25553 26510,25557 26510,25554 26511,25552 26508,25556 26505,25556 26506,25560 26506,25560 26507,25560 26506,25565 26501,25567 26504,25569 26504,25568 26508,25571 26508,25571 26511,25576 26511,25581 26516,25581 26519,25582 26521,25585 26522,25588 26527,25588 26526,25584 26530,25587 26534,25589 26529,25593 26533,25598 26538,25599 26540,25599 26540,25599 26540,25604 26543,25603 26543,25603 26538,25606 26538,25609 26540,25611 26542,25612 26547,25612 26547,25612 26548,25617 25548,25612 25548,25613 25547,25616 25545,25616 25549,25618 25551,25620 25555,25620 25551,25622 25550,25625 25551,25622 25555,25619 25557,25617 25556,25622 28556,25625 28551,25630 28546,25634 28548,25639 28553,25643 28553,25638 25553,25634 25553,25634 25557,25639 25557,25643 25558,25644 25553,25646 25556,25647 25560,25650 25562,25650 30562,25650 30562,25650 30564,25650 30566,25652 30570,25656 30571,25661 31571,25662 31575,25663 31579,25662 31579,25665 31581,25666 31584,25671 31582,25674 31581,25674 31584,25676 31584,25673 31587,25678 31586,25679 31581,30679 31584,30675 31589,30680 31590,35680 31590,35675 31589,35677 31591,35680 31590,35681 31587,35684 31588,35685 31589,35689 31592,35689 31593,35692 31597,35696 31597,35700 34597,35699 34599,35703 34604,35703 34606,35702 34601,35705 34603,35705 34606,35708 34603,35713 34604,35717 34603,35719 34608,35715 34608,35711 34608,35713 34609,35714 34605,35714 34610,35714 34614,35718 34616,35719 34617,35722 34618,35722 34621,35725 34625,35725 34626,35725 34629,35725 34631,35725 34635,35730 34636,35727 34638,35731 34640,35735 34642,35739 34645,35741 34645,35742 34649,35738 34649,35738 34645,35741 34647,38741 34650,38741 37650,38742 37646,38746 37651,38749 37652,38753 37653,38753 37657,38757 37656,38756 37660,38761 37660,38765 37660,38760 37660,38759 37660,38760 41660,38760 41660,38762 41665,38757 41667,43757 41669,43752 41674,43752 41677,43757 41672,43758 41677,45758 41680,45758 41679,45762 41683,45765 41683,45769 41683,45770 41684,45768 46684,45773 46688,45776 46692,45774 46694,45775 46697,45778 46695,45776 46698,45774 46702,45779 46702,45784 46704,45787 46706,45791 46711,45786 46707,45790 46711,45793 46715,45796 46719,45799 46724,45797 46728,45802 46726,45797 46729,45801 46733,45802 46733,45803 46732,45804 46732,45805 46732,45808 46735,45810 46740,45810 46744,2326 27373,2322 27377,2323 27379,2325 27383,2325 27382,2322 27382,2323 27382,5323 23382,5325 23385,5329 23386,5330 23390,5335 23392,5330 23392,5330 23395,5329 23395,5333 23399,5333 23402,5338 23405,5339 23405,5334 23406,5329 23401,5332 23403,5330 23407,5333 23409,5328 20409,5324 20411,5324 20414,5329 20416,5328 20421,5325 20421,5329 20424,5330 20424,5335 21424,5331 21427,5333 21431,5334 21433,5329 21434,5330 21437,5333 21440,5338 21437,5338 21440,5334 21441,5333 21438,5329 26438,5332 26435,5335 26439,5337 26440,5338 26444,5342 26439,5342 26442,5345 26440,5349 26438,5352 26442,5349 26445,5348 30445,5350 30447,5350 30444,5354 30444,5359 30443,5363 30445,5367 30446,5367 30448,5367 30453,5371 30455,5371 30453,5373 30458,5375 30461,5380 30463,5384 30463,5383 30459,5384 30459,5383 30459,5385 30460,5390 30459,5392 30464,5394 30464,5389 30465,5393 30469,5391 30469,5391 30469,5395 30474,5396 30470,5399 30470,5401 30467,5401 30468,5404 30470,5400 30465,5401 30462,5403 30467,5404 30467,5409 30469,5412 30473,5412 30477,5407 30481,8407 30486,8408 30489,8410 30490,8410 30489,8413 30490,8414 30493,8414 30496,8419 30501,8420 30502,8415 30507,13415 30509,13411 30506,13414 30507,13412 30511,13412 30515,13417 30518,13419 30523,13418 30527,13422 30529,13418 30531,13413 35531,13409 35531,13413 35532,13417 35537,13419 35533,13423 35529,13424 35529,13423 35524,13428 35525,13433 35526,13438 35530,13443 35531,13448 35531,13452 35532,13455 35536,13457 35536,13452 35536,13455 35539,13452 35535,13457 35540,13457 35544,18457 35546,18460 35547,22460 35546,22465 35550,22466 35554,22468 35552,22473 35555,22471 35559,22470 35564,22472 35564,22470 35569,22474 35569,22474 35571,22477 35573,22482 35576,22487 35580,22488 35583,22489 35585,22493 35585,22496 35585,25496 35586,25493 35582,25494 35585,25498 35585,25496 35585,25498 35587,25503 35591,25503 35593,25499 35590,25499 35591,25495 35591,26495 35595,29495 35591,29495 35593,29498 35597,29498 35601,29500 35606,29501 30606,29502 30603,29505 30603,29510 30606,29511 30606,29514 30607,29516 30610,29518 30608,3259 17305,3263 17304,3267 17303,3271 17308,3269 17312,3269 17313,3274 17315,3277 17315,3282 17311,3285 17313,3283 17309,3278 17310,3275 17315,3275 17317,3276 17322,3280 17324,3280 17324,3276 17325,3277 17325,3276 17328,3278 17324,3273 17329,3277 17331,3280 17326,3281 17328,3276 17324,3277 17324,3277 17322,3277 17321,3277 17321,3281 17323,3282 17327,3282 17332,3287 17335,3288 17335,3288 17338,3290 17337,3294 17340,3294 17341,3299 17341,3299 12341,3299 12342,3304 12339,3301 14339,3305 14340,3307 14341,3311 14343,3313 14343,3314 16343,3310 16341,3310 16346,3312 16348,3311 16349,4311 16346,4316 16348,4321 16344,4324 16348,4322 16349,4323 16346,4323 16346,4326 16350,4322 16354,4323 16356,4325 16361,4325 16358,4322 16362,4325 20362,4325 20366,4322 20367,4326 20372,4326 20374,4331 20373,4333 20373,4338 20376,4339 20379,4341 20382,4338 20384,4339 20386,4340 20383,4340 20383,4335 20388,4336 20390,4341 20390,4346 20391,4348 20391,4349 20393,37497 26499,37494 26496,37496 26500,37496 26501,37499 26506,37497 26502,37498 26502,37500 29502,37500 29507,37505 29508,37506 33508,37508 33513,37513 33518,37517 33522,37516 33520,37521 33521,37521 33525,37516 33530,37519 33528,37520 33528,37524 33530,37527 33530,37525 33527,37528 33530,37533 33533,37534 38533,37536 38536,22358 13355,25358 13360,25361 13358,25362 13362,25362 13362,25365 13365,25363 13367,25359 13369,25357 13374,25360 13374,2247 13362,2252 13366,2254 13363,2257 13363,2261 13358,2264 13354,2264 13356,2269 13361,2272 13363,2274 13363,2275 13363,2273 13362,2274 13365,2278 13365,2280 13370,2284 13366,2284 13365,2289 13368,2290 13366,2293 13368,2298 13373,2298 13372,2295 13375,271 22347,273 22350,4273 22347,4269 22348,4270 22350,4271 22355,4272 22360,4276 22363,4281 22365,4284 24365,4279 24365,4282 24365,4285 24365,4287 24364,4289 24362,4294 24360,4295 24362,4298 24365,4301 24369,1301 24370,1301 24371,1305 24375,1305 24376,1307 24377,1312 24380,1314 24382,1318 24380,1316 24382,1316 24387,1318 24387,1318 29387,1321 29387,1316 29383,1320 29386,1321 29389,1326 29389,1327 29389,2327 29394,2327 29394,2332 29393,-666 24367,-663 24368,-661 24368,-656 24371,-653 24372,-649 24372,-647 24374,-643 24370,-638 24375,-635 24380,-638 24382,-638 24384,-638 24384,-636 24388,-637 24390,-632 24386,-630 24386,-629 24386,371 24389,376 24394,374 24392,377 24397,3377 24400,6377 24405,6378 24408,6373 24406,6370 24406,6375 24403,6370 24403,6375 24403,6379 24406,6374 24409,6378 24411,6380 24412,6378 24415,6378 24419,6383 24423,6385 24425,6387 24428,6390 24433,6386 24430,6386 24435,6387 24436,6388 24440,6387 24444,6383 29444,6383 29447,6386 29451,6382 29446,6387 29447,6390 29452,6393 29452,6397 29455,6400 29459,6400 29463,6397 29467,6393 29467,6395 29470,6397 29473,6399 29468,6394 29467,6397 29470,6396 29473,6396 29470,6393 29465,6389 29469,6390 29470,6389 29465,6389 29468,6392 29470,6388 33470,6390 33466,6391 33466,6392 33467,6394 33467,322 22372,322 22374,323 22377,327 22378,331 22382,330 22383,332 22386,333 22383,331 22383,330 22387,332 22391,332 22396,337 22397,339 22394,340 22399,340 22398,340 22396,343 22396,343 22396,341 22400,342 22404,343 22402,348 22403,345 22407,347 22411,342 22411,345 22413,340 22417,345 22417,348 22422,348 22426,351 22427,352 22432,352 22436,4352 22438,4353 22442,4354 22444,4354 22447,4357 22449,4360 22450,4364 22450,4367 22451,4369 22453,4366 22455,4369 22453,4373 22458,4377 22459,4380 22459,4380 22464,4385 22467,4385 22467,4390 22469,4385 22469,4385 22472,25571 26508,25574 26507,25578 26512,25581 26512,25581 26512,25583 26508,25583 26513,25587 26516,25589 26515,25590 26515,25591 26517,25589 26520,25587 26522,23587 26526,23585 26531,23589 26534,23592 26538,24592 26543,24588 26545,24593 26547,24598 26543,24598 26548,24602 26545,24598 26540,24600 26545,24600 26548,24600 31548,24605 31549,24608 31551,24613 31552,24615 36552,24616 36557,24619 36557,24622 36560,24622 36564,24627 35564,24627 35569,24632 35569,25632 35570,25635 35569,25636 35573,25636 35573,25638 35576,25641 35580,25641 35583,25641 35588,25642 40588,20642 40593,20645 40593,20650 40595,20651 40591,20651 40594,20648 40591,20648 40591,20652 40596,20652 40596,20656 40597,20656 40600,20656 40601,20659 40598,20662 40597,20662 40597,20663 40600,20668 40601,20665 40606,1215 13314,1214 13319,1212 13317,1209 13312,1210 13312,1211 13317,6211 13320,6214 13320,6216 13320,6211 13323,6214 13318,6214 13323,6214 13324,6216 13319,6219 13323,6218 13321,6219 13321,6218 13326,6221 13329,6225 13331,6230 13335,6231 13339,6231 13343,6235 13338,6234 13342,6234 13344,6236 13345,25524 26483,25521 26484,25524 26489,25527 26487,25529 26484,25530 26482,25534 27482,25539 27486,25537 27488,25541 27483,25544 27486,25547 27490,25550 27491,25550 27491,25554 27486,25559 27486,25563 27489,25561 27489,25563 27493,25561 27491,25563 27493,25563 27495,25564 27497,25563 27497,25563 27497,25558 27498,25563 27499,25565 27503,25567 27503,25569 27503,25567 27504,25565 27505,25565 27505,25565 27505,25566 27505,25570 27501,25570 27497,25574 27498,25570 32498,25570 32501,25573 32501,25576 32497,25576 32498,25577 32501,25579 32503,25583 32504,25588 32507,25592 32512,25596 32507,25599 32507,25594 32503,25597 32506,25597 32510,25594 32509,25594 32510,25596 32513,25592 32513,25594 32515,25594 32520,25598 32520,25602 32517,25603 32518,27603 32520,27607 32523,27608 31523,27613 31527,27615 31527,30615 31530,30617 31530,30618 31532,30619 31536,30623 31537,30623 31538,30625 31538,30626 31541,30627 31541,30624 31540,30623 31540,30624 31545,34624 31546,34619 31543,34623 31545,34624 31549,34624 31548,34626 31550,34626 31555,34626 31551,34628 31555,34633 31555,34636 31559,34634 31564,34636 31564,34639 31562,34639 31560,36639 31555,36636 27555,41636 27557,41640 27554,41644 27558,41647 27559,41648 27555,41653 27555,41658 27555,41658 27552,41658 27552,41660 27550,41656 27554,41661 27558,41664 27561,41667 27566,41662 27562,41663 27563,41663 27565,41662 27569,41661 27569,41664 27571,41664 27567,41659 30567,41660 30565,41660 30561,41665 30566,41664 30561,41664 30561,41664 30562,41664 30563,41660 30558,1312 24380,4312 25380,4315 25384,4315 25385,4319 25383,4322 25388,6322 25387,6322 25387,6326 25392,6321 25397,6324 25397,6324 25401,6319 25404,9319 25405,9314 25400,9312 25402,9310 25403,9313 25403,9313 25403,9316 25400,9319 25401,4319 25396,8319 25398,8315 25400,8315 25396,8315 25397,8311 25398,8307 25394,8309 25394,8311 25397,8315 25402,8310 25403,11310 25365,11311 25365,11316 25370,11320 25375,11325 25375,11325 25380,11325 25382,11326 25378,14326 25380,14328 25382,14331 25383,14334 25385,14336 25386,19336 25386,19336 25389,19332 25390,19332 25391,19335 25388,19338 25391,19342 25393,19340 25393,19345 25396,19345 25394,19347 25394,19349 25393,19351 25397,19350 25398,19348 25399,19349 25403,19352 25399,19350 25402,19354 25400,19353 25405,23353 25402,23354 25402,23356 25405,23358 25409,23360 25413,23363 25414,23367 25412,23365 25411,23367 25414,23363 25413,23367 25416,23367 25416,23370 25418,24370 25414,24370 25419,24373 27419,24378 27419,24380 27416,24380 27412,24380 27410,24380 27406,24376 27406,24374 27410,24370 27414,24370 27415,24371 27420,24375 27415,24378 27411,24375 27415,24378 27418,24382 27421,24383 27426,24383 27425,24385 27430,24390 27431,24394 27432,24395 27436,24399 30436,24400 30439,24404 30443,24403 30439,24406 30438,24410 30442,24406 30446,24408 30445,24403 30445,24408 30442,24412 30446,24416 30446,24416 30449,19416 30449,19416 30447,19418 30452,19420 30453,19423 30458,15423 30462,15423 30464,15425 30466,16425 30467,16424 30471,16421 30474,16426 30474,16428 30476,16428 30476,16424 30474,16424 33474,16425 33474,16427 33477,16425 33479,16426 33477,16422 33480,16425 33482,16430 33479,16430 33478,16429 33482,16424 33482,16427 33484,16430 33488,16431 33488,16434 33488,16435 33491,16432 33487,16436 37487,16434 37490,16438 37485,16443 37482,16446 37480,16447 37480,16447 37482,16451 37478,16454 37479,16458 37479,16454 37479,16454 37482,16459 37486,16460 37491,16463 37495,16464 37492,16465 37493,16466 37494,16468 37497,16468 37501,16468 37501,16473 37503,16473 37503,16473 37498,16476 37494,21476 33494,21473 33493,21476 33489,21478 33491,21478 33496,21478 33492,21480 33496,21483 33501,21484 33504,21483 33500,21484 33505,21484 33505,21488 35505,21491 35505,21494 35506,21496 35510,21492 35506,21492 35509,21489 35514,21490 35517,21487 35519,23487 35523,23485 35528,23487 35533,23483 35534,23487 35535,23488 35537,23493 35539,23495 35542,23495 35546,23495 35550,23491 35549,23488 35552,23492 35555,23495 35560,23500 35559,23496 35557,4322 16354,4317 16358,4318 16358,4320 16363,4315 16363,4315 16362,4316 20362,4320 20365,4323 20363,4326 20366,4329 20367,4332 20370,4337 20374,4338 20375,4333 20375,4338 20375,4341 20377,4342 20377,4342 20378,4343 20381,4346 20386,4346 20386,4346 20386,4346 20386,4349 20390,4352 20395,4354 20396,4355 20400,4358 20400,4360 20401,4360 20404,4363 20405,4368 20406,4372 20411,4371 20416,4367 20417,4364 20422,4367 20420,4372 20425,4373 20422,4374 20418,4377 20418,4381 20422,4382 20423,4384 20418,4389 20421,4385 20423,4390 20423,4390 20425,4392 20429,4396 20434,41574 39698,41578 39702,41576 39704,45576 39704,45575 39709,45577 39713,45581 39715,45581 39718,45583 39721,45578 39726,47578 39722,47581 39719,47586 39722,47586 39726,47589 39730,47592 39733,47597 39733,47593 39733,47596 39735,47597 39735,47595 39735,47591 39739,47593 39744,47593 39747,4074 20263,4077 20268,4079 20268,4078 20271,4078 22271,4083 22276,4087 22272,4088 22275,4086 22279,4082 22280,4084 22282,4086 22277,4082 22277,4087 22281,4090 22281,4092 22281,4092 22286,4094 22287,4097 22290,4097 22291,4095 22286,4095 22288,4095 22293,4095 22288,4092 22285,4089 22286,4090 22286,4095 22281,4100 22286,4103 22285,4104 22288,4104 22289,4107 22294,4112 22292,4117 22290,4120 22295,120 22300,121 22303,122 22300,122 22300,121 26300,125 26303,129 26303,127 26305,127 26306,132 26306,132 26307,136 26307,141 26309,140 26311,143 26313,140 26314,145 26318,149 26318,153 26321,153 29321,158 29326,158 29329,162 29324,162 34324,165 34329,168 34328,167 34332,169 34333,173 34334,173 34336,177 34338,178 34340,178 34344,182 34348,177 34348,182 34348,184 34353,184 34358,181 34360,183 34365,187 34365,192 34365,197 34367,199 34366,203 34368,205 34368,202 34363,204 34360,1204 34360,1205 34364,1205 30364,1205 30359,1206 30361,1207 30364,1210 30366,1210 30366,1214 30367,1218 30372,1219 30375,1214 30379,1214 30384,1217 30382,1222 30383,1223 30382,1225 30380,1228 30379,1231 30383,1232 30383,1235 30384,1237 30388,1242 30386,1244 30389,2244 30392,2241 30395,2245 30397,2245 30399,2244 30394,2242 30395,2246 32395,2246 32395,2249 32398,2251 32393,5251 32390,5251 32395,5255 32399,5255 32397,5257 32397,5257 32401,5261 32406,5261 32411,5266 32412,5271 32416,5273 32419,5276 32420,5281 32422,5279 32425,6279 33425,6284 33429,6284 33430,6282 33431,6282 33428,6286 33425,6288 32425,6288 32421,6286 32424,6288 32424,11288 32427,11292 32425,11292 32429,11290 32434,11286 32437,11286 32437,11283 32442,11278 32442,11279 32443,11283 32445,11284 32445,11283 32448,13283 32447,13287 32442,16287 32446,16282 32445,16283 32445,16284 32448,16285 32448,16284 32446,16286 32443,16290 32446,16291 32446,16292 32450,16291 32450,16291 32450,16291 32445,16287 32447,16288 32452,16287 32457,16291 36457,16289 36462,16293 36462,16294 36462,16297 36462,16301 36464,16306 36469,16310 36467,16310 36463,16313 36459,16312 36460,16313 36465,16313 36469,16308 36470,16309 36468,16314 36470,16319 41470,16322 41471,16325 44471,16330 44471,16330 44471,16330 44473,16330 44474,16335 44479,16332 44477,8414 30496,8415 30497,8419 30497,8414 30501,8416 30500,8418 30495,8421 35495,8423 35494,8427 35497,8429 35499,8432 35499,8436 35503,8438 35503,8443 35505,8440 35508,8443 35509,8440 35509,8440 35511,8441 35515,8445 35511,8448 35512,8443 35517,8443 35519,8442 35524,8444 35526,8441 35527,8436 35527,8433 35523,8429 35527,8430 35530,8431 35532,8429 35533,8433 35535,8437 32535,8435 32536,8439 32536,8436 32539,9436 32542,9434 32537,9429 32534,9429 32534,9433 32537,9433 32542,9429 32543,9434 32538,9436 32538,9436 34538,7436 34538,7438 34543,7439 34543,7439 34543,7439 34548,7438 34549,7438 34552,7438 34553,7438 34556,11438 34561,11434 34559,11436 34555,7436 34553,7436 34549,120 1235,124 1239,125 1236,125 1238,129 1235,128 1235,125 1236,123 1239,128 2239,132 2242,131 2242,135 2242,140 2242,145 2247,146 2252,144 2253,146 2248,144 2245,146 2244,150 2249,155 2245,159 2242,160 2243,160 2245,155 2244,156 2245,3156 2246,3159 2248,3159 2250,3164 2254,3165 2257,3166 2255,3169 2257,3171 2262,3169 2263,3174 2268,3177 2273,3174 2276,3178 2275,3173 2279,3177 2276,3180 2279,3182 2284,3185 2289,5185 2286,5185 2288,5181 2286,5185 2288,5184 2293,5187 2293,5187 2297,5190 2299,5187 2299,5185 2300,5181 6300,5182 6297,5187 6300,5189 6298,5191 6296,5193 6296,5193 6296,5195 6297,5195 6300,5197 6297,5195 6300,5190 6302,5191 6306,5192 6308,5195 6312,24395 27436,24391 27437,24393 27433,24398 27436,24398 27437,16286 32443,21286 32443,21286 32444,21282 32448,21283 32446,21283 32448,21285 32451,21281 32456,21282 32458,21282 32463,21282 32468,21284 32470,21289 32471,21287 32471,21287 32469,21287 32474,21284 32477,21288 32482,21291 32482,21291 32486,21296 32485,21299 32486,21301 32487,21303 32484,21301 32482,21305 32487,21310 32491,21312 32495,21313 32491,21315 32495,21312 32495,21314 32498,21316 32501,21311 32506,21311 32508,21312 32513,21317 32516,21319 32516,21324 32516,21327 32521,21328 32526,21332 32527,21328 36527,21331 41527,21336 41527,21334 41531,21337 41533,21335 41535,21339 41540,21340 41540,21343 41536,25343 41539,25340 41542,25337 41542,25337 41545,25335 41542,25335 41543,25335 46543,25339 46548,30339 46551,30340 46556,30343 46557,30342 46553,30337 46556,30341 46561,30337 46565,30336 46563,30338 46564,24373 27419,24373 27421,24375 27424,24377 27425,24377 27430,24374 27435,24379 27437,24384 27432,24385 27434,24382 27437,24381 27442,24381 31442,24381 33442,20381 33439,20383 34439,20382 34440,20378 34444,20381 34446,20381 34442,20384 34443,20388 34446,20392 34447,20393 34442,20393 34447,20396 29447,20395 29443,20399 29443,20400 29439,20399 29436,20404 29439,20409 29440,20410 29440,20410 29444,20408 29445,20413 29448,20413 29451,20412 29455,20413 29458,20418 29461,20413 29463,20415 29464,20416 29464,20416 29463,20416 29463,20418 29464,20414 29465,20418 29463,20413 29460,20413 26460,20418 26458,20421 26459,20421 26461,20421 26460,43578 35658,43578 35654,43578 35658,43578 35660,43583 35661,43583 35659,43583 35662,43579 35663,43583 35661,43587 35666,25625 25551,25629 25551,25630 25554,25630 25559,25632 25560,25627 25561,25623 25557,25623 25559,25624 25561,26624 25566,26627 25566,29627 25571,29626 25574,29625 25575,29622 25579,29625 25583,29630 25588,29632 25589,29635 25591,29635 25594,29637 25598,29642 25596,29643 25597,29644 25597,29649 25598,29654 25602,29656 25602,29661 25603,29661 25601,29664 26601,29666 26604,29665 26604,29668 26607,29672 26607,29669 26611,29671 26616,29674 26613,29679 26616,29680 26616,29681 26615,29682 26619,29679 26617,29684 26622,29686 26624,29689 26624,29690 26628,29691 26630,29693 26625,29694 26620,29698 26617,29703 29617,29707 29616,29706 29620,29709 29623,34709 29626,34710 29628,34710 29627,2282 16411,2283 16412,2283 16412,2287 16417,2292 16421,2297 16421,2298 16426,2303 16426,2304 16429,2309 11429,2313 11432,2308 14432,2308 14431,2311 14433,2310 14437,2308 14438,2309 14440,2311 14440,2309 14443,2312 14443,2314 14447,2314 14452,2314 14450,2309 14451,2309 14451,2309 14456,2313 14461,2313 14461,2309 19461,2309 19461,2311 19462,2315 19465,2318 19465,2321 19462,2317 19464,2321 19467,2322 19467,2322 19469,2322 19469,2320 19464,2321 19462,2322 19461,2327 19466,2327 19461,2322 19461,2322 19463,2317 19467,2318 19471,2102 -1848,2107 -1848,2111 -1846,2114 1154,2114 1156,2115 1157,2114 6157,2116 6162,2121 6165,2124 6170,2121 6175,2124 6179,2124 6183,2128 6178,2126 6179,2125 6178,2126 6181,2122 10181,2127 10186,2128 10189,2130 10188,2130 10191,2127 11191,2127 11195,2131 11196,2132 11192,2131 11197,2135 11201,2135 11203,2139 11199,2142 11203,2143 11204,2147 11208,2142 11210,2142 11211,2147 11212,2150 11217,2150 11219,2151 11219,2152 11222,2152 11222,2148 11224,2150 11220,2150 11223,2146 11218,2143 11219,2140 11221,2143 11218,2140 11219,2140 11223,2145 11225,2147 11226,2152 11226,2155 11224,2157 11229,2157 11229,2153 11233,2153 11238,2149 11239,7149 10239,7154 10241,7157 10241,7162 10243,7164 10248,7164 10251,7169 10253,7171 10253,7172 10257,7177 10260,7182 10256,7187 10260,7191 8260,7195 8256,7200 8258,7204 8258,7203 8261,7203 8262,7205 8266,7209 8270,7209 8273,7214 8273,7214 8276,7210 8276,7211 8276,7213 8279,7218 8278,7222 8283,7223 8279,7220 10279,7221 10283,7223 10284,7228 10286,7230 10290,7231 10290,7231 10293,7232 10294,7232 10297,7234 10299,7229 10295,7226 10294,7221 10293,7223 10295,7228 10299,7229 10303,7232 10307,7232 10311,7233 10316,7234 9316,7239 9318,7244 9321,7241 9326,7241 9328,7238 9331,7235 9330,7237 9335,7236 9335,7236 9337,7236 9338,7231 14338,7230 14333,7232 14338,7237 18338,4082 22280,4081 22280,6081 22283,6076 22285,6076 22289,6078 22286,6080 22287,6084 22292,6084 22293,6085 22293,6086 22291,6091 22294,6092 22293,9092 22290,9095 22294,9096 22295,9096 22297,9091 22292,9096 22295,9098 22290,9094 18290,9097 18290,9096 18294,9099 18292,9098 18297,9103 18299,9103 18302,9103 18305,9100 18301,9102 18302,9106 18305,9102 18310,9101 18306,9103 18308,9103 18312,9107 18310,9107 18315,9107 18320,9111 18322,9111 18326,9113 18329,9111 18329,9116 18329,9121 18329,9121 18332,9123 18331,9124 18332,9125 18328,9127 18325,9125 18328,9128 18329,9133 18329,9136 18333,9141 18337,9142 18342,9143 18340,9148 18344,9152 18341,9150 18346,9149 18341,9149 18341,9154 18343,9158 18345,9161 18346,9161 18347,9163 18352,9164 18352,9162 18349,9165 18352,9165 18351,9165 18352,9165 18356,9163 18352,9167 18353,9167 18349,9168 18351,9168 18347,9173 18347,9175 18347,9179 18348,9182 18349,9187 18352,9186 18357,9189 18360,9192 18360,9196 18362,13196 18367,13196 18369,13196 18371,13199 18374,13194 18374,13197 18375,13200 18377,13205 18380,13210 18384,13209 18379,13209 18374,13213 18375,13216 20375,13212 20375,13215 20375,13211 20375,13211 20372,13208 20373,13204 20373,13204 20369,13205 20369,13207 20366,13212 20367,13216 20367,13221 20372,13222 20377,13225 20381,13226 20386,13230 20383,9230 20388,9228 20384,9228 20386,9223 20389,9223 20392,4223 20397,4223 20396,4225 20399,4222 20404,4220 20408,4220 20411,4223 20416,4227 20421,4230 20418,4234 20421,4232 20422,4236 20423,4238 20423,4239 20423,4235 20427,4231 20427,4230 20426,4228 20428,4232 20427,4232 20431,4236 20433,4241 20431,4241 22431,4236 22436,4239 22437,4239 22439,4236 22443,4232 22439,4236 22444,4236 22446,4239 22447,4239 22452,4241 22454,4245 22457,4245 22460,4250 22462,4251 22465,4253 22465,4249 22465,4251 22460,4251 22464,4255 22469,4257 22473,4256 22478,4259 22479,4260 22480,4257 22485,6257 22489,6260 22490,6260 22493,6262 22496,6262 22500,6267 22495,6271 22495,6276 22491,6276 22489,6281 22487,6286 22490,6289 22490,6294 22490,6294 22489,6292 22485,6292 22489,6288 22489,6288 22494,6288 22496,6286 22497,6288 22501,6292 22500,5292 22503,5292 22503,5296 22508,5295 22510,5300 22510,5305 22513,5302 22514,5306 22510,5309 22513,5313 27513,5313 27513,5317 27513,5322 22513,5326 22517,6326 22516,6323 22518,6323 22523,6320 22523,6321 22526,6323 22531,6323 22531,6324 22532,6324 22532,6325 22529,6321 22531,6323 22534,6328 22534,6329 22530,6324 22527,10324 22522,10319 22524,10315 22520,10314 22525,10311 22525,10307 22526,10304 22531,10306 22527,10306 22528,10309 22530,10312 27530,10312 27534,10312 27534,10307 27536,10307 27532,11307 27531,11307 27533,11308 27535,11303 27531,11298 27532,11294 27534,11294 27534,11299 27538,11297 27542,11302 27547,11306 27547,11311 27549,11313 30549,11317 30551,11313 30546,11316 30541,11316 30540,11319 30545,11318 30546,11323 30550,11326 30554,11326 34554,11330 34558,11331 34558,11333 34558,11332 34561,11328 34561,11331 34562,11336 34562,11336 34567,11340 34570,11342 34569,11345 34568,11344 34569,11345 34571,11349 34574,15349 34574,15354 34569,15359 34566,15362 34571,15363 34576,15367 34577,15368 34577,15371 34581,15374 34576,15379 34574,15383 34579,15384 34584,15387 34583,17387 34578,17392 34578,17391 34578,17396 34573,17397 34578,17397 34580,17397 39580,17402 39584,17397 39587,17402 39587,17406 39582,17403 39587,17407 39589,17409 39592,17406 39592,17409 39595,17409 39599,17412 39603,17416 39608,17417 39608,17417 39608,17421 39607,17422 39609,17424 39608,17427 39604,17425 39605,17426 39609,17423 39611,17422 39610,17425 39613,17428 39618,17428 39619,17429 39616,17432 39616,13432 39615,13432 39617,13432 39617,13432 44617,13434 44621,13434 44623,13439 44627,13442 44632,13442 44635,13440 44631,13442 44631,13445 44635,13447 44639,13445 44637,13445 44638,13450 44639,13454 44644,13457 44644,13459 44642,15459 44639,15457 44644,15461 44644,15462 44642,15459 44645,15459 44647,15463 44650,15458 44651,15459 44653,15461 44657,15463 44661,15463 44661,15463 44663,15467 44666,15472 44668,15474 44664,15470 44668,15471 44670,15473 44674,15475 44675,-3806 12298,-3804 12301,-3805 13301,-3804 13296,-3808 13292,-3809 13295,-3806 13300,-3804 13297,-3801 13301,-3801 13302,-3796 18302,-3801 18306,-3799 18311,-3802 18311,-3799 18312,-3801 18314,-3796 18319,-3795 18322,-3791 18321,-3786 18320,-3786 18321,-3784 18321,-3782 18321,-3781 18324,-3782 18325,-3783 18320,-3788 18324,-1788 18324,-1788 18329,-1784 18333,-1784 18334,-1781 18329,-1777 18334,-6777 18337,-6774 18339,-6776 18341,-6781 18341,-6779 18341,-6779 18343,-6779 18339,-6777 18343,-6782 18338,-6779 18341,-6778 18341,-6776 18336,-6776 18333,-6776 18333,-6780 18338,-6784 18338,-6787 18335,-6786 18336,-6781 22336,-6781 22335,-6778 22331,-6777 22326,-6777 22331,-6777 22335,-6772 22335,-6774 22340,-6769 22341,-6767 22337,-6767 22335,-6767 22335,-6767 22333,-6767 22336,-6762 22331,-6759 22331,-6764 22332,-6765 22334,-6767 22339,-6762 22334,-6760 22334,-6760 22334,-6758 22337,-6754 22341,-6754 22342,-6750 22339,-4750 22343,-4747 22343,-4752 22343,-4751 22344,-4749 22345,-4745 22348,-4740 22353,-4736 22358,-4738 22363,-4740 22358,21336 41527,21334 41527,21330 41526,21330 41526,21333 41529,21328 41529,21329 41530,21326 41532,21328 41532,21324 41537,21328 41532,21330 41535,21334 41532,21336 40532,21334 40536,21339 40534,21341 40534,21344 40534,21346 40532,21350 40532,21353 40535,21357 40539,21359 40542,21360 40546,21355 40546,21360 40547,21359 40550,21356 40551,21356 40550,21357 40550,21361 40554,21358 45554,21362 45556,21366 45553,21370 45557,21374 45556,21377 45553,22377 45549,22382 45549,22382 45552,22386 45557,22387 45557,22388 45553,22392 45557,24392 45561,22392 45558,22397 45561,22399 45558,22398 45561,22400 45564,22400 45569,22404 45573,22406 45577,22406 45581,22404 45581,22407 45582,22409 45579,22409 45575,22409 45579,22407 45579,22402 45582,22402 45582,22404 45587,22406 45587,22406 45589,22411 45589,22413 45590,22417 45591,22417 45592,22422 45587,22425 45583,22428 50583,22428 50585,22428 50585,22430 50588,22435 50590,22435 50585,22435 50590,22439 50595,22440 50590,22445 50587,22442 50584,22442 50586,22443 54586,22443 54590,22446 54595,22448 54597,22448 59597,22444 59593,22449 59596,22449 59599,22452 59600,22457 59600,22458 59605,22457 59602,22462 59603,22463 59604,22461 59605,22458 59602,22457 59601,22457 59601,22455 59605,25455 59606,25457 59611,25462 59613,25464 59614,25467 59617,25472 59612,25476 59613,25478 59610,25482 59615,25482 59616,25486 59612,25483 59614,25487 59619,25492 59623,25497 59625,146 2252,150 2249,150 2249,152 2254,157 2249,158 2253,157 2252,161 2255,159 3255,161 3258,161 3255,163 3255,168 3259,168 3259,172 3263,167 3267,172 3271,172 3272,172 3274,175 3278,179 3282,181 3283,184 3280,185 3282,187 3282,191 3284,192 3286,191 6286,193 6289,198 6285,195 6290,194 6289,195 6289,199 6293,200 6288,198 6290,202 6291,207 6296,212 6301,215 6301,216 6301,211 6304,212 6304,216 6309,216 6304,214 6308,213 6308,211 6305,212 6309,217 6314,220 6317,224 6322,222 6327,220 6323,41573 39712,41572 39709,41576 40709,41580 40714,41576 40717,36576 40717,36577 40719,36582 40716,36585 40721,36590 43721,36585 43721,36582 43724,36585 43729,36590 43731,36590 43730,15289 11307,15285 11312,15286 11315,15289 11315,15294 11315,15295 11316,15296 13316,38742 37646,38743 37650,38745 37655,38744 37658,38739 37659,38737 37662,38742 37662,38745 37657,38748 37662,38748 37662,38752 37667,38753 37667,38748 37669,38748 37668,38752 37673,38754 37674,38756 37676,38758 37674,38760 37679,38760 37675,38758 37675,38763 37675,38767 37674,38772 40674,38767 40679,38772 40683,38774 44683,38778 44686,38780 44690,38780 44690,38779 44695,38782 44700,38780 44695,38775 44696,38775 44696,38775 44696,38779 44699,38783 44696,38784 44696,38786 44692,38786 44692,38786 44696,38791 44698,38793 44699,38795 44703,38800 44708,38803 44708,38807 44709,38802 44706,38806 44708,38809 44709,36809 44709,36814 44704,36813 44705,36814 44705,36816 44709,36811 44712,36812 48712,36811 48717,36815 48721,36816 51721,36818 51717,36822 51720,40822 51715,40827 51712,40830 51716,40829 51719,40832 51723,40835 51724,40840 51721,40841 51721,40836 51725,40841 51730,40846 51734,40848 51738,40849 51740,40851 51743,40854 51745,40855 51746,40857 51750,40857 51746,40861 51748,40866 51751,40862 51750,40866 51750,40869 51752,40865 51752,40863 51755,40858 51757,40855 51753,40855 51758,40852 51758,40853 51760,40857 51761,40855 51757,40852 51760,40853 51761,40855 51762,40858 51757,40859 51756,40863 51757,40863 51759,40860 51764,40859 51764,40854 51768,40850 51765,40852 51767,40852 51767,40848 51772,40852 51776,40854 51778,40852 51778,43852 51778,43854 52778,43856 52781,43859 52781,43859 52776,37512 26536,37517 26531,37520 26535,37520 26540,37522 26544,37527 26544,37532 26549,37537 26544,37540 26549,37545 26544,37549 26547,37549 26550,37548 26551,37549 26553,37546 26553,37546 26553,37549 26556,37549 26559,37552 26559,37556 26564,37560 26559,37561 26561,37565 26565,41565 26565,41569 26568,41571 26573,41571 26573,41576 29573,41571 29573,41573 29576,41573 29578,46573 29578,46569 29582,45569 29583,45572 29583,45568 29583,45573 29581,45575 29578,45571 29581,45572 29584,45572 29585,45576 29585,45578 29588,45581 29591,45582 29593,45582 29598,45584 29597,45589 29600,45585 29605,45589 33605,45593 36605,45594 36607,45599 36609,45600 36604,45604 36604,45604 36608,45604 36607,45608 36610,50608 36613,50611 36609,50614 36609,50619 36605,50624 36605,50625 36606,50625 36605,50629 36606,50624 36608,50625 36610,50626 36610,50629 36608,50627 36610,50628 36614,50632 36618,46632 34618,46632 35618,46636 35622,46636 35617,46637 35620,46639 35619,46643 35620,46645 35625,46643 35630,46648 35635,46648 35640,46649 35643,46651 35647,46655 35650,46652 35655,46657 35656,46658 35657,46662 35660,46659 35663,46662 35664,46665 35663,46667 35667,46667 35663,46670 35666,46672 35671,46674 35671,47674 35668,47676 35672,47677 35673,47677 35678,47677 35677,47677 35677,47677 35682,47672 35683,47671 35683,49671 35685,49674 35689,49677 35692,49675 35692,54675 35697,54678 35699,54674 35699,54670 35701,54670 35700,54675 35703,54676 34703,54676 34703,54679 34706,54683 34708,54688 34706,54688 34707,54685 34702,54687 34702,54692 34707,54687 36707,54687 36706,54682 36707,54685 38707,54680 38710,54680 38714,54677 38714,54679 38719,54682 38720,54687 38716,54688 38717,54692 38722,54697 38726,54699 38727,54700 38724,54702 38720,52702 38719,52702 38719,52702 38721,52702 38725,52704 38726,52706 38728,52707 38729,52711 38728,52711 35728,52713 35733,52712 35737,52712 35739,52713 35742,52713 35745,52708 35745,52710 39745,52713 39749,52716 39748,52721 39749,52720 39753,52716 39756,52716 40756,47716 40757,47717 40761,47722 40761,47722 40761,47722 40766,47726 40769,47728 40772,47733 40777,47731 40773,50731 40777,51731 40779,51733 40782,51734 40786,51737 40784,51741 41784,51739 41783,51739 41785,51739 41785,51736 41789,51731 41789,52731 41790,52735 41791,52738 41790,52742 41789,52746 41785,52747 41785,52745 41785,52750 41782,52753 41786,52753 41787,52758 41792,52754 42792,52749 42793,52752 42794,52756 42791,52757 42790,52762 42793,52766 42797,52766 42797,52769 42802,52774 42806,52774 42805,52771 42807,52774 42807,52770 42808,52771 42811,52767 42811,52766 42812,52767 42817,52771 42817,52771 42817,52775 42815,52779 42811,52779 42812,52780 42815,52776 42818,52774 42818,52777 42822,52780 42823,52781 42827,52776 42829,52780 42832,54780 42835,54780 42840,2135 11201,2140 11203,2137 11204,2140 11209,2142 11213,2147 11211,2145 11213,2145 11213,2150 11218,2150 11221,2153 11225,2157 13225,2162 13228,2167 13231,2171 13232,2167 13229,2168 13233,2171 13237,2173 13239,2168 13234,2168 13235,2173 13235,2175 13234,2177 13235,2177 13234,2179 13229,2179 13226,2180 13226,2177 13226,2177 13231,2180 13231,2181 10231,2176 10233,2177 10232,2180 10235,2185 10237,2182 10240,6182 10240,6184 10244,6182 10242,6183 10243,6185 10246,6190 10244,6194 10244,6194 10247,6192 10247,6192 10252,6195 10256,6194 10260,6195 9260,6195 9260,6195 9264,6199 9269,6204 9272,6199 9268,6201 9268,6203 9265,6208 9268,6204 9270,6204 9275,6201 9279,6201 9281,6201 9286,6206 9281,6206 9277,6202 9281,6200 9285,6202 9288,6198 9290,7198 9293,7200 9297,7201 9297,7205 9298,7209 9298,7209 9299,8209 9302,8214 10302,8218 10306,8222 10308,8226 10313,8231 10313,8235 10318,8237 10318,8237 10323,8233 10326,8233 10327,8237 10325,8238 10328,8238 10330,8234 10330,11234 10332,11236 10333,11241 10337,14241 10338,14240 10338,14237 10339,14238 10337,14237 10339,14242 10339,14246 10339,14250 10339,14250 10339,14251 10337,14254 10337,14256 10334,14256 10332,14252 10336,14255 10340,14259 10342,14262 10347,11148 3159,11153 3163,11154 3162,11154 3165,11158 3167,11161 3172,11162 3175,11162 3176,11166 3179,11166 3181,11171 3185,11176 3180,11178 3179,11176 3181,11179 3183,11174 3182,52776 42818,52778 42822,52777 42822,52782 42817,52783 42822,52784 42823,52789 42826,52789 42823,56789 42828,56786 42829,56786 42832,56789 42836,56789 42835,56785 42838,56786 42843,51786 42844,51788 42846,51790 42847,51794 42842,51796 42842,51801 42846,53801 42849,53806 42849,53809 42852,53812 42850,53817 42846,53817 42848,53818 42853,53822 42856,53823 42854,53826 42858,53825 42860,53826 42860,53826 42864,53830 42868,53835 42873,53839 42873,53841 42872,53841 42876,53841 42879,53841 42884,53836 42888,53836 42889,53836 44889,53833 44889,53835 44893,53838 44897,53842 44897,53844 44900,53844 44904,53845 44905,53850 44903,53853 44904,53858 44906,53856 44907,53861 44909,53856 44913,53858 44916,53863 44916,53868 44918,53867 43918,53869 43921,53869 43919,53867 43919,53862 43918,53860 43923,53864 43928,53869 43930,53874 43933,53874 43932,53874 43932,53875 43930,53877 43928,53878 43924,53883 43927,55883 43929,55883 43925,55879 43929,55881 43929,55884 43928,55881 43928,55882 43929,55883 45929,55883 45933,55883 45936,55884 45941,55884 45941,55886 45946,55882 45948,55883 45952,55888 45956,55890 45957,55894 45953,55892 45954,55897 45950,55893 45954,55896 45956,55892 45955,55897 45959,55899 45961,55899 45961,55894 45962,55898 45957,55893 49957,55896 47957,55894 47956,55898 47960,55901 47964,55901 47967,55901 47970,55896 47973,55898 47969,55894 47974,55895 47975,55891 47976,55896 47979,55899 47984,55902 47983,55897 47987,55899 47989,55904 47992,55904 47993,55905 47997,55902 48001,55902 48003,55907 48000,55910 47998,55915 47999,55911 47994,55906 47998,55910 48003,55914 48000,55918 48000,55914 48000,55919 48000,55921 48003,55921 48007,55924 48007,55919 48010,55922 48005,55927 48009,55928 48008,55928 48008,55930 48012,55925 48012,55925 48016,54925 48014,54922 48018,54922 44018,54926 44013,54929 44012,54932 44016,55932 44017,55935 44017,55936 44020,55937 44022,55936 44020,55939 44015,55944 44018,55945 44022,55947 44023,55950 44024,55953 44020,55956 44023,53867 43919,53871 43921,52871 43921,53871 43923,53876 43923,53881 43923,53880 43927,53882 43931,53886 43936,53884 43937,53879 43934,53879 43937,53877 43939,53878 43938,53879 43942,53880 43947,53881 43948,53884 45948,53884 45949,53882 45953,53883 45954,53878 45956,53880 45953,53885 45958,53885 45958,53886 45957,53886 48957,53886 48962,53891 48962,53892 48964,53897 48965,49897 48962,49902 48965,49906 48967,49902 48967,49904 48971,49901 48967,49904 48970,54904 48971,54904 48971,54904 48975,54909 48979,54907 48975,54910 48975,54906 48971,54909 48973,54911 48975,54915 48978,54920 48978,54923 48981,54918 48984,54921 48984,56921 48984,56926 48986,56924 48981,56929 48980,56932 48979,56932 48977,56936 48979,56937 48981,56937 48982,61937 48984,61937 48980,61934 51980,61935 51981,61935 51984,61935 51984,61931 51986,5329 23395,5331 23395,5333 23390,5337 23392,5340 23395,5345 27395,5345 27397,5350 27398,5355 27399,5356 27402,6356 27405,6360 27407,6361 27406,6364 27402,6366 26402,6371 26402,6371 26402,6372 26405,6370 26405,6375 26406,6380 26411,6385 26413,6387 26414,6388 26419,6390 26419,6391 26424,6393 30424,6390 30429,6390 30432,6390 30430,6394 30434,6394 30437,6394 30441,6396 30442,6398 30439,6399 30436,6404 30435,6405 30435,6400 30435,6405 30440,6404 30443,6405 30447,6409 30447,6411 30447,6412 30448,6417 30446,6421 30450,6418 30448,6417 30444,6418 30449,6420 30451,6425 30456,6426 30456,6425 30458,6426 30458,6426 34458,6427 34459,6432 39459,6434 39462,6434 39467,6439 39470,6443 39467,6444 39468,6449 39473,6451 39476,6452 39481,6452 39479,6452 39476,8452 39476,8456 39478,8460 39480,10460 39482,10455 39482,10456 39484,10460 39484,10463 39484,10468 39486,10473 39482,10475 39484,10475 39486,10476 39488,10477 39492,10475 39494,10480 39499,10476 39501,10479 39506,10480 39510,10475 39508,10480 39513,10481 39516,10481 39516,10485 39521,10487 39522,10490 39523,10490 39520,10493 39520,10496 44520,10491 44519,10491 44524,10492 44520,10497 44525,10499 44525,10502 44527,10500 44531,10502 44535,10506 44535,10511 44532,13511 44536,13513 44533,13510 44535,13507 44540,13511 44543,13515 44548,13517 44549,13522 44550,13525 42550,13520 42551,13522 42553,13525 42552,13529 42557,13529 42558,13524 42559,13525 42559,13525 42562,13520 42564,13523 42567,15523 42569,15523 42572,15524 42577,15529 42577,15530 42582,15532 42584,15532 42588,15531 42587,15531 42592,15530 42587,15530 42583,15533 42583,15536 47583,15532 47583,15535 47587,15534 47590,15536 47594,11536 47590,11533 47590,11529 47590,11533 47592,11533 47592,11533 47593,11537 47598,11538 47603,11538 47603,11538 47605,11541 47609,11544 47613,14544 47614,14539 47610,14537 47610,14537 47614,14535 50614,14537 50619,14539 50619,14540 50623,14538 50623,14537 50619,25599 26540,25599 26541,25599 26544,25594 26542,25599 26543,25596 26544,25597 26543,25598 26543,25593 26544,25588 26542,25593 26545,25595 26544,25596 26544,25599 26541,25594 26544,25592 26549,25593 26548,25597 26549,25596 26550,25594 26551,25590 26550,25594 26554,25597 26550,25598 26552,25593 26555,25598 22555,25599 22557,25604 22559,25605 22558,25606 22562,25605 22559,25605 22564,30605 22569,30610 22571,30610 22575,30609 22575,30609 22576,30609 22581,30605 22581,30610 22583,30610 22584,30613 22579,30613 22581,30616 22577,30619 22577,30621 22580,30621 22585,30626 22590,30628 22593,30629 22598,30626 22603,30628 22606,30629 22607,30629 22604,30627 22606,30632 22608,30633 22608,30636 22612,30641 17612,30642 17614,30647 17614,30651 17615,30654 17610,30655 17607,30658 17611,30653 17610,30654 17606,30654 17607,30659 17606,30660 17611,30658 17616,30659 17616,30664 17619,30665 17621,30665 17620,30667 17621,30671 17624,30673 17624,30673 17624,30678 17627,30675 17632,30675 17635,30678 17640,30681 17643,30686 17639,30691 17641,30696 19641,30699 19640,30700 19640,30696 19645,30698 19643,30699 19645,30702 19646,30703 19649,30699 19651,30704 19648,30706 19652,30709 19653,30709 19655,30709 19655,30712 19657,30708 19658,30705 19660,30700 19662,30701 19663,30706 19664,30711 19663,30707 19667,30704 19670,30708 19672,30709 19673,30711 19673,30711 19674,30713 19678,30718 19682,30723 20682,30721 20686,30725 20691,30726 20693,30729 20695,30728 20690,30730 20692,30733 20694,30736 20692,30736 20691,30740 20694,30741 20695,30741 20697,30746 20700,30747 20702,30750 20701,30751 20698,30753 24698,30749 24701,30748 24703,30746 24704,30747 29704,30747 29705,30749 29707,30752 29712,30757 29712,30760 34712,30760 34716,30763 34716,30759 34713,30759 34717,30763 34717,30758 34717,30757 34721,30760 34726,30758 34726,30763 34727,30763 34727,30764 34727,30759 34729,30759 34732,30762 34734,30757 34735,30761 34736,30759 34736,30762 34738,30757 34733,30760 34735,30762 34737,30760 34736,30765 34733,32765 34737,32768 34737,32765 34740,32765 34742,32768 34747,32772 34751,32772 34752,32777 34749,32782 34751,32783 33751,32783 33746,36783 33749,36783 33754,36786 33756,36787 33755,36787 33758,36791 33754,36796 33754,36801 33756,36801 33758,36801 33762,36802 33765,36802 33765,36806 33770,33806 33772,33806 33777,33809 33777,33814 33780,33814 33785,33818 33782,33821 33784,33826 33781,33822 33781,33824 33783,33822 33784,33826 33787,33823 33792,33827 33795,33828 33798,33829 33799,33833 33801,33833 33801,33836 33805,33839 33809,33842 33805,33847 33810,33845 32810,33847 32808,33849 32812,33851 32815,33849 32818,33849 32822,33847 32822,33847 32826,33850 32831,33854 32836,33857 32833,33856 32828,33859 32829,33860 32832,33857 32834,33857 32830,33855 32830,33857 32830,33855 32834,33859 32829,33859 32833,33862 32836,33864 32837,33864 32839,33866 32837,33869 32835,33872 32840,33874 37840,33879 37845,33881 37850,33881 37855,33886 37856,33891 37860,33896 37860,33893 37863,33894 38863,33896 38859,28896 38864,28899 39864,33899 39869,33896 39871,33898 39875,33902 39873,33902 39875,33907 39879,33912 39884,33908 39887,33908 39888,33905 39890,33909 39895,33911 39896,33908 39900,33912 39901,33915 39902,33915 39902,33915 39902,33910 39907,33910 39904,33914 39903,33912 39906,33916 39909,33920 39909,33922 39912,33923 39916,33928 39916,33931 39918,33932 39919,33935 39915,33936 39912,33934 39909,35934 39914,35931 39915,35935 39917,35939 39920,35939 39915,35940 39911,35944 39916,35944 39911,35944 39908,35945 39904,35945 39908,35945 39912,35950 39915,35955 39917,38955 39916,38960 39921,38962 39920,38962 39920,38967 39922,38967 39924,38970 39928,38975 39928,38973 39928,38977 39931,38980 39934,38984 39936,38982 39939,38983 39942,38985 39943,38987 39945,38992 41945,38988 41950,38989 41954,38992 41958,38992 41962,38992 41965,38993 41970,38997 41970,38997 41970,38994 41974,38994 41979,38997 41979,38999 41982,38994 41980,38998 41985,38998 41984,5334 23406,5330 23406,5325 23403,9325 23404,12325 23408,12325 23408,12322 23406,13322 23411,13325 23416,13326 23412,13322 23414,13327 23419,13328 23422,13329 23425,13333 23422,13337 23424,23491 35549,23490 35544,23494 35546,23499 35548,23495 35549,21495 35553,21490 35556,21492 35558,21492 35556,21494 35559,21494 35564,21494 35566,21499 35566,21502 35562,21502 35567,17502 35568,17506 35573,17507 35574,17511 35578,17512 35583,17513 35588,18513 35591,18514 35592,18515 35594,18513 35596,16513 35601,16513 37601,16513 37602,16511 37604,16513 37609,16514 37611,16518 37616,16522 34616,16524 34613,16528 34615,16528 34620,16533 34624,16535 34627,16538 34628,16539 34630,16539 34631,16542 34628,16542 34633,16544 34638,16547 38638,16547 38640,16543 38645,16543 38640,16540 38640,16543 38640,16542 38641,16546 38646,16541 38649,16541 38645,18541 38648,18544 38648,18544 38653,18544 38656,18549 38651,18547 38651,18550 38656,18547 38658,23547 38663,23544 38664,23548 38668,23548 38670,28548 38672,28549 38669,28549 38673,28545 38669,28549 38670,28554 38670,28557 38674,28560 38669,28562 38674,28562 38669,28561 38669,28564 38671,28569 38671,38779 44699,38780 44695,38778 44698,38783 44700,38785 44700,38781 44701,38782 44696,38786 44691,38789 44692,38794 44692,38799 44688,38799 44693,38803 44697,38808 44697,38806 44697,38806 44700,38803 44702,38803 44706,38802 44707,38807 48707,38808 48707,38806 48707,38810 48712,38810 48709,38810 48711,38810 48711,38806 48707,38802 48710,38803 48706,38805 48711,38810 48711,38805 48709,38809 48710,38809 48710,38814 48707,38815 48703,38816 48703,38816 48704,38820 48704,38822 48709,38820 48710,38818 48714,38822 48716,38822 48719,38827 48722,38828 48727,38832 48725,38830 48730,38831 48726,38832 48724,38829 48728,8431 35532,8431 35537,4431 35532,4434 35537,4438 35537,4439 35533,4443 35535,4442 35530,4445 35527,4449 35527,4453 35530,4458 35530,4459 39530,4460 39531,4461 39531,4464 39531,4468 39531,4470 39534,4465 39534,4465 39532,4469 39532,4471 39537,4466 39538,4470 39539,4473 39540,4476 39540,4480 39543,4485 39548,4483 39546,4484 39547,4484 39549,4484 39551,4486 39553,4486 39554,4487 39551,4483 39553,4486 39554,4490 39556,4493 39557,4498 39561,4494 39562,-4749 22345,-4752 22345,-4748 22348,-4744 22351,-4740 22356,-4741 22358,-4739 22361,-4734 22359,-4730 25359,-4730 25360,-4725 25360,-4727 25360,-4727 25361,-6727 25360,-6729 25365,-6730 25365,-6727 25365,-6731 25364,-6730 27364,-6727 27366,-6723 27367,-3723 27363,-3719 27368,-3720 27371,-3718 27366,-3717 27369,-3716 27369,-3714 27372,-3711 27370,-3712 27371,-3712 27370,-3710 27375,-3708 27377,-3707 27382,-3706 27385,-3706 27389,-3705 32389,-3704 32392,-3704 32392,-3699 32391,-3699 32395,-3694 32399,-3694 32400,-3695 32404,-3695 32408,-3693 32410,-3693 32410,-3697 32410,-3692 32413,-3691 32418,-3686 32420,-3683 32425,-3681 32420,-3678 32424,-3673 32424,-3676 32427,-3673 32426,-3671 32426,-3676 33426,-3678 33428,-3676 33428,-3679 33428,-3679 33433,-3677 33434,-3676 33438,-3681 33440,1319 33444,1321 33441,1325 33444,1329 33439,1326 33444,1326 33439,1327 33439,1327 33440,1332 33444,1333 33449,1338 33453,1338 33450,1343 33450,1347 33454,1346 33457,1346 33455,1342 33459,1341 33462,1346 33462,1347 33463,1343 33463,1344 33462,1348 33457,1347 33460,1352 33464,1356 33468,1361 33469,1363 33468,1365 33469,1368 33472,1369 33475,-2631 33478,-2633 33483,-2629 33486,-2632 34486,-2628 36486,-2625 36488,-2621 36488,-2624 36488,-2622 36492,-2624 36491,-2629 36491,-2627 36496,-2623 36499,-2628 36502,-2631 36506,-2626 36506,-2622 36506,-2622 36509,-2619 36514,-2624 36512,-2621 36510,-2619 36510,-2619 36508,-2617 36512,-2615 36512,-2615 36513,-2615 36511,-2615 36506,-2612 36507,-2609 36511,-2606 37511,-2606 37508,-2610 37505,-2607 37508,-2602 37512,-2599 37512,-2595 37510,-2597 37511,-2592 37515,-2597 37514,-2592 37519,-2592 37524,-2592 37526,-2594 37521,-2594 37516,-2591 36516,-2588 36517,-2589 36513,-2586 36514,-2584 36514,-2583 36516,-2579 36514,-2578 36518,-2578 35518,-2575 35519,-2577 35519,-2578 35524,-2578 35529,-2578 35532,-2578 35534,-2580 35537,-2584 35541,-2586 35542,-2587 35544,-2585 35540,-2585 35544,-2584 35543,-2580 35548,-2576 35550,-2571 35553,-2567 35555,-2565 35560,-2560 35560,-2557 35564,-2553 35564,-5553 36564,-5548 36564,-5544 36565,-5547 36565,-5545 36570,-5542 36565,-5543 36566,-5543 36568,-5543 36570,-5540 36575,-5537 36577,-5535 36581,-5532 36580,-5528 36575,-5526 38575,-5526 38576,-5526 38571,-5522 38571,-5518 38576,-5514 42576,-5510 42581,-5512 42583,-5512 42582,-5507 42582,-5510 42585,-2510 42589,-2511 42592,-2508 42594,-2506 42597,-2503 42598,-2503 42603,-2498 42608,-2501 42611,-2500 42616,-2502 42613,-2502 42616,-4502 42616,-4502 42620,-4502 42622,-4506 42619,-4509 42621,-4511 42624,-4515 42625,-4510 42625,-4507 42628,-4502 42624,-4501 42629,-4505 45629,-4503 45630,-4499 45631,-4496 45630,-4497 45628,-4495 45630,-4494 46630,-4491 46634,-4487 46629,-4483 46631,21336 40532,21341 40533,21346 40534,21346 40536,21345 40536,21346 40536,21345 40536,21344 40538,21347 40543,21348 40543,21351 40540,21351 40542,21348 40545,21351 40546,21352 40546,21353 40546,21358 40546,21359 40545,21359 40550,21357 40555,21362 40560,21364 40555,21363 40555,21364 40560,25364 40564,25365 40566,25368 40566,25371 45566,25372 45567,25372 45562,25376 45564,25381 42564,25385 42560,25389 42564,25389 42568,25393 42572,25390 42572,28390 42569,28389 42570,28385 42574,28386 42576,28389 42577,31389 42578,31385 42582,31387 42582,31390 42578,31391 42579,31392 42576,29392 42580,29396 42582,29398 43582,29402 43584,29406 43585,29407 43587,29411 43592,29413 43594,29414 43595,25414 43600,25412 43595,25415 43599,25420 43602,25418 43604,25423 43599,25426 43599,25429 43602,25434 42602,25429 42604,25432 42600,25435 42605,25436 47605,25440 50605,25441 50610,25439 50614,25444 50617,25447 50621,25444 50624,25444 50626,25445 50627,25450 50632,25450 50628,25451 50630,25451 50632,25454 50633,25458 50637,25462 50641,25463 50640,25463 51640,25467 51644,25469 51649,25473 51650,25474 51653,25475 51654,26475 51658,26475 51662,26474 51665,26476 51665,26481 51661,26483 55661,26485 55664,30485 55667,30485 55670,30489 55671,30489 55668,30491 55670,30492 55670,30493 55675,30497 55675,30501 55671,30503 55676,30500 55677,30498 55672,30494 55675,30499 55676,30500 55676,30505 55681,30501 55684,30496 55685,30500 55685,30502 55687,30506 55692,30507 55693,30506 55692,30511 55693,30516 55694,30514 55699,30514 55701,30512 55701,34512 55705,34516 55708,34520 55704,34518 56704,34519 56704,34520 56706,34517 56706,34515 56701,34519 59701,34522 59706,34522 59708,34522 59713,34526 59715,34528 59717,34533 59712,34538 59715,34538 59717,34541 59717,34546 59720,34548 59721,34552 63721,34547 63726,34549 63728,34554 63726,34556 63726,34557 63721,34556 63725,34561 63730,34558 63730,37558 63725,37561 63729,37565 63724,37569 63720,37573 63718,37578 63722,37577 63718,37579 63720,37579 63722,37580 63719,37580 63720,37579 63724,37574 63725,37574 63727,37576 63725,37581 63729,37583 63732,37586 63732,37590 63737,37592 63734,37597 63731,37600 63730,37596 63731,37596 63733,37600 63733,37601 63735,37596 63735,37591 63732,37596 63733,37601 63738,37602 63733,37599 63738,37594 63740,37598 63744,37603 63745,37605 63747,37607 63752,37607 63756,37603 63757,37603 63761,37604 63761,37608 63758,37609 63762,37604 63764,37604 63764,41604 63765,41600 63761,41599 63761,41600 63766,41596 63766,41599 63766,41601 63770,41604 63768,41608 63768,41611 63772,41614 63767,41609 63763,41612 63765,41615 63760,38615 63764,38615 63768,38618 63768,35618 63769,35618 63774,35617 63775,35618 63776,35613 63775,35615 63780,35612 63782,35613 63779,35614 63775,35618 63774,35619 63776,35624 63778,35624 63780,35629 63785,35629 63780,35626 63781,35624 63782,35629 63784,35634 63787,35638 63782,35634 63783,35634 63778,35633 63777,35638 63782,35641 63786,35644 63791,35648 63793,35647 63793,35649 63797,35653 63801,35654 63804,35654 63804,35656 63804,35655 63806,35658 63810,35658 63805,35662 63805,35657 67805,35658 67808,35660 67811,35664 67808,35660 67803,35658 67803,35661 67803,35663 67808,35666 67810,35670 67814,35669 67813,35669 67816,37669 67820,37664 67820,2275 13363,2278 16363,2274 16363,2275 16362,2279 16362,2282 16362,2287 16366,2284 16366,4284 16366,4286 16371,4290 16375,4294 18375,4295 18377,9295 18381,9296 18381,9299 18382,9303 18379,9305 19379,9308 19375,8308 19380,8312 19380,38746 37651,38749 37652,38754 37653,38757 37656,38753 37661,38753 37661,38758 37663,38763 37664,38763 42664,38768 42666,38765 42668,38770 42664,38767 42659,38768 42659,38773 42654,38771 42659,38775 42661,41775 42663,41778 42665,41781 42669,41782 42667,41779 42669,41784 42672,41781 42672,41783 42672,41780 42672,41783 42675,41784 42675,41788 42676,41792 42677,41792 42675,41793 42680,41793 42676,41796 42681,41801 42685,41804 42684,41806 42685,41804 42690,41802 42692,41805 42696,41800 42697,41802 42698,41804 42700,41809 42704,41813 42705,36813 42708,36813 42704,36810 42703,36811 42705,40811 42706,40815 46706,40816 46708,40820 46708,40818 46712,40822 46717,40825 46720,40829 46724,40827 46727,40831 46727,40833 46731,40829 46733,40830 46733,36830 46738,36830 46741,36834 46744,36831 46749,36826 46748,36822 46748,36824 46751,36819 46755,36823 46758,36823 46762,36824 46766,36822 46769,36826 46772,36831 46774,36828 42774,36833 42776,36833 42777,36838 42782)')));
@@ -86,13 +86,13 @@ SPATIAL KEY (g3),
SPATIAL KEY (g4),
SPATIAL KEY (g5),
SPATIAL KEY (g6)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
DROP TABLE t1,t2;
CREATE TABLE t1 (
p INT NOT NULL AUTO_INCREMENT,
g LINESTRING NOT NULL,
PRIMARY KEY(p)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
ALTER TABLE t1 ADD SPATIAL INDEX spatial_idx (g);
ALTER TABLE t1 ADD INDEX prefix_idx (g(767));
INSERT INTO t1(g) VALUES(ST_linefromtext('linestring(-5 -576,0 -576,0 -571,0 -571,5 -568,6 -564,6 -565,6 -563)'));
@@ -131,6 +131,6 @@ SPATIAL KEY (g3),
SPATIAL KEY (g4),
SPATIAL KEY (g5),
SPATIAL KEY (g6)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
DROP TABLE t1,t2;
disconnect control_purge;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_add_index.test b/mysql-test/suite/innodb_gis/t/rtree_add_index.test
index 81755124..a11f1783 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_add_index.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_add_index.test
@@ -1,6 +1,6 @@
--source include/have_innodb.inc
-CREATE TABLE t1 (g MULTIPOINT NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t1 (g MULTIPOINT NOT NULL) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 VALUES ('');
connect purge_control,localhost,root;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_compress.test b/mysql-test/suite/innodb_gis/t/rtree_compress.test
index e667ec8e..56690b88 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_compress.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_compress.test
@@ -10,9 +10,11 @@
# Valgrind takes too much time on PB2 even in the --big-test runs.
--source include/not_valgrind.inc
-create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb ROW_FORMAT=COMPRESSED;
+create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb ROW_FORMAT=COMPRESSED STATS_PERSISTENT=0;
# Insert enough values to let R-tree split.
+lock tables t1 write;
+start transaction;
insert into t1 values(1, Point(1,1));
insert into t1 values(2, Point(2,2));
insert into t1 values(3, Point(3,3));
@@ -33,6 +35,8 @@ insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
+commit;
+unlock tables;
start transaction;
insert into t1 select * from t1;
select count(*) from t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_create_inplace.opt b/mysql-test/suite/innodb_gis/t/rtree_create_inplace.opt
new file mode 100644
index 00000000..c3f4a891
--- /dev/null
+++ b/mysql-test/suite/innodb_gis/t/rtree_create_inplace.opt
@@ -0,0 +1 @@
+--innodb_sort_buffer_size=64k
diff --git a/mysql-test/suite/innodb_gis/t/rtree_create_inplace.test b/mysql-test/suite/innodb_gis/t/rtree_create_inplace.test
index ef3f0171..73469368 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_create_inplace.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_create_inplace.test
@@ -2,32 +2,27 @@
--source include/have_innodb.inc
--source include/have_debug.inc
+--source include/have_sequence.inc
--source include/no_valgrind_without_big.inc
# Create table with geometry column
CREATE TABLE t1 (c1 INT, c2 GEOMETRY NOT NULL, c3 GEOMETRY NOT NULL) ENGINE=INNODB;
+CREATE TEMPORARY TABLE t LIKE t1;
# Insert enough values
-INSERT INTO t1 VALUES(1, Point(1,1), ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
-INSERT INTO t1 VALUES(2, Point(2,2), ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
-INSERT INTO t1 VALUES(3, Point(3,3), ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
-INSERT INTO t1 VALUES(4, Point(4,4), ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
-INSERT INTO t1 VALUES(5, Point(5,5), ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
-INSERT INTO t1 VALUES(6, Point(6,6), ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
-INSERT INTO t1 VALUES(7, Point(7,7), ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
-INSERT INTO t1 VALUES(8, Point(8,8), ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
-INSERT INTO t1 VALUES(9, Point(9,9), ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
-
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t VALUES
+(1, Point(1,1), ST_GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')),
+(2, Point(2,2), ST_GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')),
+(3, Point(3,3), ST_GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')),
+(4, Point(4,4), ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')),
+(5, Point(5,5), ST_GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')),
+(6, Point(6,6), ST_GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')),
+(7, Point(7,7), ST_GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')),
+(8, Point(8,8), ST_GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')),
+(9, Point(9,9), ST_GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+
+INSERT INTO t1 SELECT t.* FROM t, seq_1_to_512;
+DROP TEMPORARY TABLE t;
# create spatial index
CREATE SPATIAL INDEX idx ON t1(c2);
@@ -42,8 +37,9 @@ SELECT COUNT(*) FROM t1 WHERE MBRWithin(t1.c2, @g1);
ALTER TABLE t1 DROP INDEX idx, ADD SPATIAL INDEX idx3(c2);
-SET SESSION debug="+d,row_merge_instrument_log_check_flush";
+SET debug_dbug='+d,row_merge_instrument_log_check_flush';
ALTER TABLE t1 DROP INDEX idx3, ADD SPATIAL INDEX idx4(c2), ADD SPATIAL INDEX idx5(c3);
+ALTER TABLE t1 FORCE;
# Clean up.
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test
index cab86aa6..194c8a23 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_purge.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test
@@ -8,7 +8,7 @@
create table t (
b point not null,d point not null, spatial key (d),spatial key (b)
-) engine=innodb;
+) engine=innodb stats_persistent=0;
--disable_query_log
set @p=point(1,1);
diff --git a/mysql-test/suite/innodb_gis/t/rtree_undo.test b/mysql-test/suite/innodb_gis/t/rtree_undo.test
index 962ff780..9126b96d 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_undo.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_undo.test
@@ -17,7 +17,7 @@ CREATE TABLE t1 (
p INT NOT NULL AUTO_INCREMENT,
g LINESTRING NOT NULL,
PRIMARY KEY(p)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
if ($index == 3) {
eval ALTER TABLE t1 ADD INDEX prefix_idx (g($prefix_size));
@@ -88,7 +88,7 @@ CREATE TABLE t2 (
SPATIAL KEY (g4),
SPATIAL KEY (g5),
SPATIAL KEY (g6)
-) ENGINE=InnoDB;
+) ENGINE=InnoDB STATS_PERSISTENT=0;
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb_zip/include/innodb_dml_ops.inc b/mysql-test/suite/innodb_zip/include/innodb_dml_ops.inc
deleted file mode 100644
index 4908dfb6..00000000
--- a/mysql-test/suite/innodb_zip/include/innodb_dml_ops.inc
+++ /dev/null
@@ -1,82 +0,0 @@
-delimiter |;
-create procedure populate_t1()
-begin
- declare i int default 1;
- while (i <= 200) do
- insert into t1 values (i, 'a', 'b');
- set i = i + 1;
- end while;
-end|
-create procedure populate_t1_small()
-begin
- declare i int default 1;
- while (i <= 20) do
- insert into t1 values (i, 'c', 'd');
- set i = i + 1;
- end while;
-end|
-create procedure populate_t1_small2()
-begin
- declare i int default 30;
- while (i <= 50) do
- insert into t1 values (i, 'e', 'f');
- set i = i + 1;
- end while;
-end|
-delimiter ;|
-#
-begin;
-select count(*) from t1;
-call populate_t1();
-select count(*) from t1;
-select * from t1 limit 10;
-rollback;
-select count(*) from t1;
-#
-begin;
-call populate_t1();
-select count(*) from t1;
-commit;
-select count(*) from t1;
-#
-truncate table t1;
-select count(*) from t1;
-#
-call populate_t1_small();
-select count(*) from t1;
-rollback;
-select count(*) from t1;
-truncate table t1;
-#
-call populate_t1();
-select count(*) from t1;
-delete from t1 where keyc <= 60;
-select count(*) from t1;
-call populate_t1_small();
-select count(*) from t1;
-select * from t1 limit 10;
-begin;
-call populate_t1_small2();
-select count(*) from t1;
-select * from t1 where keyc > 30 limit 10;
-rollback;
-select count(*) from t1;
-select * from t1 where keyc > 30 limit 10;
-#
-update t1 set keyc = keyc + 2000;
-select * from t1 limit 10;
-rollback;
-begin;
-update t1 set keyc = keyc + 2000;
-select * from t1 limit 10;
-rollback;
-select * from t1 limit 10;
-commit;
-select * from t1 limit 10;
-#
-insert into t2 select * from t1 where keyc < 2101;
-select count(*) from t2;
-#
-drop procedure populate_t1;
-drop procedure populate_t1_small;
-drop procedure populate_t1_small2;
diff --git a/mysql-test/suite/innodb_zip/r/blob.result b/mysql-test/suite/innodb_zip/r/blob.result
index df3a49ed..5671e81a 100644
--- a/mysql-test/suite/innodb_zip/r/blob.result
+++ b/mysql-test/suite/innodb_zip/r/blob.result
@@ -3,7 +3,7 @@
# failed in mtr_t::write(), btr_free_externally_stored_field()
#
CREATE TABLE t1 (c TEXT, f2 INT PRIMARY KEY, f3 INT UNIQUE)
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+ENGINE=InnoDB STATS_PERSISTENT=0 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET @level= @@GLOBAL.innodb_compression_level;
SET GLOBAL innodb_compression_level=0;
connect prevent_purge,localhost,root;
diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_3.result b/mysql-test/suite/innodb_zip/r/innochecksum_3.result
index 03a31194..04d2fcaa 100644
--- a/mysql-test/suite/innodb_zip/r/innochecksum_3.result
+++ b/mysql-test/suite/innodb_zip/r/innochecksum_3.result
@@ -120,7 +120,6 @@ Filename::tab#.ibd
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Freshly allocated page | -
-#::# | Freshly allocated page | -
# Variables used by page type dump for ibdata1
Variables (--variable-name=value)
@@ -154,7 +153,6 @@ Filename::tab#.ibd
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Freshly allocated page | -
-#::# | Freshly allocated page | -
[6]: check the valid lower bound values for option
# allow-mismatches,page,start-page,end-page
[9]: check the both short and long options "page" and "start-page" when
diff --git a/mysql-test/suite/innodb_zip/r/restart.result b/mysql-test/suite/innodb_zip/r/restart.result
index eb1bfe67..8bd3f73f 100644
--- a/mysql-test/suite/innodb_zip/r/restart.result
+++ b/mysql-test/suite/innodb_zip/r/restart.result
@@ -527,15 +527,6 @@ Variable_name Value
innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Page_Size Zip_Size Path
-test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t6_restart#p#p0 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
-test/t6_restart#p#p1 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
-test/t7_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
-test/t7_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
-test/t5_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
-test/t6_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
-test/t7_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
-test/t7_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1
SELECT count(*) FROM t5_restart;
count(*)
@@ -629,7 +620,6 @@ RENAME TABLE t6_restart TO t66_restart;
RENAME TABLE t7_restart TO t77_restart;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Page_Size Zip_Size Path
-test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
test/t66_restart#p#p0 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
@@ -728,15 +718,6 @@ Variable_name Value
innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Page_Size Zip_Size Path
-test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t66_restart#p#p0 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
-test/t66_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
SELECT count(*) FROM t55_restart;
@@ -863,15 +844,6 @@ t77_restart#p#p1#sp#s3.ibd
# restart
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Page_Size Zip_Size Path
-test/t4_restart DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
-test/t66_restart#p#p0 DEFAULT 2048 MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 DEFAULT 2048 MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
-test/t66_restart#p#p2 DEFAULT 2048 MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd
innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SELECT count(*) FROM t4_restart;
@@ -1002,15 +974,6 @@ t77_restart.par
# restart
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Page_Size Zip_Size Path
-test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd
-test/t66_restart#p#p0 DEFAULT 2048 MYSQLD_DATADIR/test/t66_restart#p#p0.ibd
-test/t66_restart#p#p1 DEFAULT 2048 MYSQLD_DATADIR/test/t66_restart#p#p1.ibd
-test/t77_restart#p#p0#sp#s0 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd
-test/t77_restart#p#p0#sp#s1 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd
-test/t55_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t55_restart.ibd
-test/t66_restart#p#p2 DEFAULT 2048 MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
-test/t77_restart#p#p1#sp#s2 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd
-test/t77_restart#p#p1#sp#s3 DEFAULT DEFAULT MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd
innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
SELECT count(*) FROM t4_restart;
diff --git a/mysql-test/suite/innodb_zip/t/blob.test b/mysql-test/suite/innodb_zip/t/blob.test
index 4f9117f7..461b451f 100644
--- a/mysql-test/suite/innodb_zip/t/blob.test
+++ b/mysql-test/suite/innodb_zip/t/blob.test
@@ -6,7 +6,7 @@
--echo #
CREATE TABLE t1 (c TEXT, f2 INT PRIMARY KEY, f3 INT UNIQUE)
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+ENGINE=InnoDB STATS_PERSISTENT=0 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET @level= @@GLOBAL.innodb_compression_level;
SET GLOBAL innodb_compression_level=0;
diff --git a/mysql-test/suite/innodb_zip/t/restart.opt b/mysql-test/suite/innodb_zip/t/restart.opt
index d7564300..03fb84e9 100644
--- a/mysql-test/suite/innodb_zip/t/restart.opt
+++ b/mysql-test/suite/innodb_zip/t/restart.opt
@@ -1,2 +1,5 @@
---loose-innodb-sys-tables
---loose-innodb-sys-tablespaces
+--innodb-sys-tables
+--innodb-sys-tablespaces
+--skip-innodb-stats-persistent
+--skip-innodb-buffer-pool-dump-at-shutdown
+--skip-innodb-fast-shutdown
diff --git a/mysql-test/suite/mariabackup/backup_grants.result b/mysql-test/suite/mariabackup/backup_grants.result
index 56899f8d..6bd6c9f4 100644
--- a/mysql-test/suite/mariabackup/backup_grants.result
+++ b/mysql-test/suite/mariabackup/backup_grants.result
@@ -3,12 +3,13 @@ FOUND 1 /missing required privilege RELOAD/ in backup.log
FOUND 1 /missing required privilege PROCESS/ in backup.log
FOUND 1 /GRANT USAGE ON/ in backup.log
GRANT RELOAD, PROCESS on *.* to backup@localhost;
-NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log
+FOUND 1 /missing required privilege REPLICA MONITOR/ in backup.log
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
REVOKE REPLICA MONITOR ON *.* FROM backup@localhost;
+FOUND 1 /missing required privilege CONNECTION ADMIN/ in backup.log
GRANT CONNECTION ADMIN ON *.* TO backup@localhost;
FOUND 1 /missing required privilege REPLICATION SLAVE ADMIN/ in backup.log
-NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log
+FOUND 1 /missing required privilege REPLICA MONITOR/ in backup.log
GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost;
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
DROP USER backup@localhost;
diff --git a/mysql-test/suite/mariabackup/backup_grants.test b/mysql-test/suite/mariabackup/backup_grants.test
index 894ae73a..18db3489 100644
--- a/mysql-test/suite/mariabackup/backup_grants.test
+++ b/mysql-test/suite/mariabackup/backup_grants.test
@@ -10,7 +10,7 @@ rmdir $targetdir;
# backup fails without --no-lock, because of FTWRL
--disable_result_log
error 1;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
@@ -31,7 +31,7 @@ rmdir $targetdir;
# --slave-info and galera info require REPLICA MONITOR
--disable_result_log
error 1;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
rmdir $targetdir;
@@ -47,16 +47,15 @@ REVOKE REPLICA MONITOR ON *.* FROM backup@localhost;
# TODO need a query that would delay a BACKUP STAGE START/ BACKUP STAGE BLOCK_COMMIT longer than the kill-long-queries-timeout
#--send SELECT SLEEP(9) kill_me
-## kill-long-query-type=(not empty) requires CONNECTION ADMIN
-#--disable_result_log
-#error 1;
-#--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=all --kill-long-queries-timeout=4 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
-#--reap
-#--enable_result_log
-#rmdir $targetdir;
-#
-#--let SEARCH_PATTERN= missing required privilege CONNECTION ADMIN
-#--source include/search_pattern_in_file.inc
+
+# kill-long-query-type=(not empty) requires CONNECTION ADMIN
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=ALL --kill-long-queries-timeout=4 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
+--enable_result_log
+rmdir $targetdir;
+
+--let SEARCH_PATTERN= missing required privilege CONNECTION ADMIN
+--source include/search_pattern_in_file.inc
GRANT CONNECTION ADMIN ON *.* TO backup@localhost;
--disable_result_log
diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result
index 1d0dffd5..71525c22 100644
--- a/mysql-test/suite/mariabackup/full_backup.result
+++ b/mysql-test/suite/mariabackup/full_backup.result
@@ -18,6 +18,12 @@ DROP TABLE t;
#
call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 because previous shutdown was not with innodb_fast_shutdown=0");
+call mtr.add_suppression("Found 1 prepared XA transactions");
+CREATE TABLE t(f1 INT NOT NULL)ENGINE=InnoDB;
+XA START 'zombie';
+INSERT INTO t VALUES(1);
+XA END 'zombie';
+XA PREPARE 'zombie';
# restart: --innodb_undo_tablespaces=0
# xtrabackup backup
# xtrabackup prepare
@@ -28,3 +34,5 @@ call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 becaus
# Display undo log files from target directory
undo001
undo002
+XA COMMIT 'zombie';
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test
index fb043f63..c6a21112 100644
--- a/mysql-test/suite/mariabackup/full_backup.test
+++ b/mysql-test/suite/mariabackup/full_backup.test
@@ -35,6 +35,13 @@ rmdir $targetdir;
--echo #
call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 because previous shutdown was not with innodb_fast_shutdown=0");
+call mtr.add_suppression("Found 1 prepared XA transactions");
+
+CREATE TABLE t(f1 INT NOT NULL)ENGINE=InnoDB;
+XA START 'zombie';
+INSERT INTO t VALUES(1);
+XA END 'zombie';
+XA PREPARE 'zombie';
let $restart_parameters=--innodb_undo_tablespaces=0;
--source include/restart_mysqld.inc
@@ -53,4 +60,6 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
--echo # Display undo log files from target directory
list_files $targetdir undo*;
+XA COMMIT 'zombie';
+DROP TABLE t;
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff b/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff
index 29afd468..9ed08fcd 100644
--- a/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff
+++ b/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff
@@ -1,3 +1,5 @@
+--- suite/mariabackup/huge_lsn.result
++++ suite/mariabackup/huge_lsn.reject
@@ -1,8 +1,8 @@
#
# MDEV-13416 mariabackup fails with EFAULT "Bad Address"
diff --git a/mysql-test/suite/mariabackup/slave_provision_nolock.cnf b/mysql-test/suite/mariabackup/slave_provision_nolock.cnf
new file mode 100644
index 00000000..0e0bbd63
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_provision_nolock.cnf
@@ -0,0 +1,13 @@
+[mysqld.1]
+log-slave-updates
+loose-innodb
+
+[mysqld.2]
+log-slave-updates
+loose-innodb
+
+[ENV]
+SERVER_MYPORT_1= @mysqld.1.port
+SERVER_MYSOCK_1= @mysqld.1.socket
+SERVER_MYPORT_2= @mysqld.2.port
+SERVER_MYSOCK_2= @mysqld.2.socket
diff --git a/mysql-test/suite/mariabackup/slave_provision_nolock.result b/mysql-test/suite/mariabackup/slave_provision_nolock.result
new file mode 100644
index 00000000..445a9801
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_provision_nolock.result
@@ -0,0 +1,48 @@
+call mtr.add_suppression("Can't init tc log");
+call mtr.add_suppression("Aborting");
+# restart
+RESET MASTER;
+CREATE TABLE t1(a varchar(60) PRIMARY KEY, b VARCHAR(60)) ENGINE INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+CREATE TABLE t2 (val INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0);
+connect con1,localhost,root,,;
+*** Start a background load...
+CALL gen_load();
+connection default;
+*** Doing backup...
+*** Doing prepare...
+*** Stop the background load...
+UPDATE t2 SET val=1;
+connection con1;
+connection default;
+disconnect con1;
+*** Provision a new slave from the backup
+connect server2,127.0.0.1,root,,,$SERVER_MYPORT_2;
+*** Stopping provisioned server
+*** Removing old datadir for provisioned server
+*** Provision new server from backup
+# restart
+*** Configure slave position from xtrabackup_binlog_pos_innodb
+CREATE TABLE t3 (file VARCHAR(255), pos INT) ENGINE=InnoDB;
+LOAD DATA LOCAL INFILE "BASEDIR/xtrabackup_binlog_pos_innodb"
+ INTO TABLE t3 FIELDS ESCAPED BY '' (file, pos);
+CHANGE MASTER TO
+master_port=PORT, master_host='127.0.0.1', master_user='root',
+master_log_file= "MASTER_FILE",
+master_log_pos= MASTER_POS;
+Warnings:
+Note 4190 CHANGE MASTER TO is implicitly changing the value of 'Using_Gtid' from 'Slave_Pos' to 'No'
+START SLAVE;
+connection default;
+connection server2;
+connection server2;
+STOP SLAVE;
+RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2, t3;
+connection default;
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/mariabackup/slave_provision_nolock.test b/mysql-test/suite/mariabackup/slave_provision_nolock.test
new file mode 100644
index 00000000..618f3132
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_provision_nolock.test
@@ -0,0 +1,170 @@
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+
+call mtr.add_suppression("Can't init tc log");
+call mtr.add_suppression("Aborting");
+
+# Test provisioning a slave from an existing server, using mariabackup --no-lock
+# and the binlog position recovered from InnoDB redo log.
+
+# Update the InnoDB system tablespace to simulate a pre-10.3.5
+# position in TRX_SYS. There was a bug that the wrong position could
+# be recovered if the old filename in TRX_SYS compares newer than the
+# newer filenames stored in rseg headers.
+let MYSQLD_DATADIR=`select @@datadir`;
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+--source include/shutdown_mysqld.inc
+
+--perl
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
+
+my $ps = $ENV{INNODB_PAGE_SIZE};
+
+sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/ibdata1", O_RDWR
+ or die "Cannot open ibdata1: $!\n";
+
+# Read the TRX_SYS page.
+my $page;
+sysseek(IBD_FILE, $ps * 5, SEEK_SET)
+ or die "Cannot seek ibdata1: $!\n";
+sysread(IBD_FILE, $page, $ps)
+ or die "Cannot read ibdata1: $!\n";
+
+# Put in an old binlog position that will compare larger than master-bin.000001
+my $old_name= '~~~-bin.999999' . chr(0);
+my $old_off= 0xffff0000;
+my $old_magic= 873422344;
+my $binlog_offset= $ps - 1000 + 38;
+substr($page, $binlog_offset, 4)= pack('N', $old_magic);
+substr($page, $binlog_offset + 4, 4)= pack('N', ($old_off >> 32));
+substr($page, $binlog_offset + 8, 4)= pack('N', ($old_off & 0xffffffff));
+substr($page, $binlog_offset + 12, length($old_name))= $old_name;
+
+# Write back the modified page.
+my $full_crc32= get_full_crc32(\*IBD_FILE);
+$page= fix_page_crc($page, $full_crc32);
+sysseek(IBD_FILE, $ps * 5, SEEK_SET)
+ or die "Cannot seek ibdata1: $!\n";
+syswrite(IBD_FILE, $page, $ps) == $ps
+ or die "Cannot write ibdata1: $!\n";
+close IBD_FILE;
+EOF
+
+--source include/start_mysqld.inc
+
+
+let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
+
+RESET MASTER;
+CREATE TABLE t1(a varchar(60) PRIMARY KEY, b VARCHAR(60)) ENGINE INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+CREATE TABLE t2 (val INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0);
+
+--disable_query_log
+--delimiter //
+CREATE PROCEDURE gen_load()
+ MODIFIES SQL DATA
+ BEGIN
+ DECLARE i INT;
+ DECLARE flag TYPE OF t2.val;
+ SET i = 0;
+ load_loop: LOOP
+ SELECT val INTO flag FROM t2;
+ IF NOT (flag=0) THEN
+ LEAVE load_loop;
+ END IF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES (CONCAT("AbAdCaFe", LPAD(i, 6, "0")), @@SESSION.last_gtid);
+ COMMIT;
+ SET i = i + 1;
+ END LOOP;
+ END
+//
+--delimiter ;
+--enable_query_log
+
+connect (con1,localhost,root,,);
+--echo *** Start a background load...
+send CALL gen_load();
+
+--connection default
+--echo *** Doing backup...
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir --no-lock
+--echo *** Doing prepare...
+--exec $XTRABACKUP --prepare --binlog-info=1 --target-dir=$basedir
+
+--echo *** Stop the background load...
+UPDATE t2 SET val=1;
+--connection con1
+reap;
+--connection default
+disconnect con1;
+--let $count_master= `SELECT COUNT(*) FROM t1`
+
+--echo *** Provision a new slave from the backup
+--connect (server2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--let $datadir_2= `SELECT @@datadir`
+
+--echo *** Stopping provisioned server
+--source include/shutdown_mysqld.inc
+
+--echo *** Removing old datadir for provisioned server
+--rmdir $datadir_2
+
+--echo *** Provision new server from backup
+--exec $XTRABACKUP --copy-back --datadir=$datadir_2 --target-dir=$basedir
+
+# --no-lock backup might leave prepared xa transactions. rollback them.
+--error 1
+--exec $MYSQLD_LAST_CMD --tc-heuristic-recover=ROLLBACK
+--source include/start_mysqld.inc
+
+--echo *** Configure slave position from xtrabackup_binlog_pos_innodb
+CREATE TABLE t3 (file VARCHAR(255), pos INT) ENGINE=InnoDB;
+--replace_result $basedir BASEDIR
+--disable_warnings
+eval LOAD DATA LOCAL INFILE "$basedir/xtrabackup_binlog_pos_innodb"
+ INTO TABLE t3 FIELDS ESCAPED BY '' (file, pos);
+--enable_warnings
+
+# Remove leading ./ from filename (leading .\ on windows).
+--let provision_master_file= `SELECT REGEXP_REPLACE(file, "^[.].", "") FROM t3`
+--let provision_master_pos= `SELECT pos FROM t3`
+
+--replace_result $SERVER_MYPORT_1 PORT $provision_master_file MASTER_FILE $provision_master_pos MASTER_POS
+eval CHANGE MASTER TO
+ master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root',
+ master_log_file= "$provision_master_file",
+ master_log_pos= $provision_master_pos;
+START SLAVE;
+
+--connection default
+--save_master_pos
+
+--connection server2
+--sync_with_master
+--let $count_slave= `SELECT COUNT(*) FROM t1`
+if ($count_master != $count_slave) {
+ --echo *** ERROR: Table on master has $count_master rows, but table on provisioned slave has $count_slave rows
+ --die Row difference on provisioned slave.
+}
+
+# Cleanup
+
+--connection server2
+STOP SLAVE;
+RESET SLAVE ALL;
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2, t3;
+
+--connection default
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2;
+
+rmdir $basedir;
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
index d995d1be..dfcf19b6 100644
--- a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
@@ -1,5 +1,6 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200))
+ENGINE=InnoDB PAGE_COMPRESSED=YES STATS_PERSISTENT=0;
insert into t1(b, c) values("mariadb", "mariabackup");
InnoDB 0 transactions not purged
# Corrupt the table
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
index 247a210a..700c4dd2 100644
--- a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
@@ -1,5 +1,6 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200))
+ENGINE=InnoDB PAGE_COMPRESSED=YES STATS_PERSISTENT=0;
insert into t1(b, c) values("mariadb", "mariabackup");
--source ../innodb/include/wait_all_purged.inc
diff --git a/mysql-test/suite/multi_source/gtid_slave_pos.result b/mysql-test/suite/multi_source/gtid_slave_pos.result
index d57cfc17..44eb4823 100644
--- a/mysql-test/suite/multi_source/gtid_slave_pos.result
+++ b/mysql-test/suite/multi_source/gtid_slave_pos.result
@@ -97,8 +97,9 @@ set default_master_connection = 'slave1';
STOP SLAVE;
include/wait_for_slave_to_stop.inc
set default_master_connection = 'slave2';
+include/wait_for_slave_sql_error.inc [errno=1942]
STOP SLAVE;
-include/wait_for_slave_to_stop.inc
+include/wait_for_slave_io_to_stop.inc
set default_master_connection = 'slave1';
START SLAVE;
include/wait_for_slave_to_start.inc
diff --git a/mysql-test/suite/multi_source/gtid_slave_pos.test b/mysql-test/suite/multi_source/gtid_slave_pos.test
index c01130f8..cc418d76 100644
--- a/mysql-test/suite/multi_source/gtid_slave_pos.test
+++ b/mysql-test/suite/multi_source/gtid_slave_pos.test
@@ -118,8 +118,10 @@ set default_master_connection = 'slave1';
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
set default_master_connection = 'slave2';
+--let $slave_sql_errno= 1942
+--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
---source include/wait_for_slave_to_stop.inc
+--source include/wait_for_slave_io_to_stop.inc
set default_master_connection = 'slave1';
START SLAVE;
--source include/wait_for_slave_to_start.inc
diff --git a/mysql-test/suite/multi_source/mdev-9544.test b/mysql-test/suite/multi_source/mdev-9544.test
index fd89bdfa..c2626dc7 100644
--- a/mysql-test/suite/multi_source/mdev-9544.test
+++ b/mysql-test/suite/multi_source/mdev-9544.test
@@ -1,6 +1,7 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_debug.inc
+--source include/not_windows.inc
--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2)
diff --git a/mysql-test/suite/parts/r/partition_alter_innodb.result b/mysql-test/suite/parts/r/partition_alter_innodb.result
index f040f266..03e7d078 100644
--- a/mysql-test/suite/parts/r/partition_alter_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter_innodb.result
@@ -71,7 +71,8 @@ DROP TABLE t1;
#
# MDEV-28079 Shutdown hangs after altering innodb partition fts table
#
-CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2;
+CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB STATS_PERSISTENT=0
+PARTITION BY HASH(f1) PARTITIONS 2;
ALTER TABLE t1 ADD FULLTEXT(f2);
InnoDB 0 transactions not purged
DROP TABLE t1;
diff --git a/mysql-test/suite/parts/r/partition_purge.result b/mysql-test/suite/parts/r/partition_purge.result
index 072b141c..a58e095d 100644
--- a/mysql-test/suite/parts/r/partition_purge.result
+++ b/mysql-test/suite/parts/r/partition_purge.result
@@ -1,4 +1,4 @@
-CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1))ENGINE=InnoDB
+CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1))ENGINE=InnoDB STATS_PERSISTENT=0
PARTITION BY LIST(f1) (
PARTITION p1 VALUES in (1, 2, 3),
PARTITION p2 VALUES in (4, 5, 6));
diff --git a/mysql-test/suite/parts/t/partition_alter_innodb.test b/mysql-test/suite/parts/t/partition_alter_innodb.test
index 844b2084..dcc44863 100644
--- a/mysql-test/suite/parts/t/partition_alter_innodb.test
+++ b/mysql-test/suite/parts/t/partition_alter_innodb.test
@@ -12,7 +12,8 @@ SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--echo #
--echo # MDEV-28079 Shutdown hangs after altering innodb partition fts table
--echo #
-CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2;
+CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB STATS_PERSISTENT=0
+PARTITION BY HASH(f1) PARTITIONS 2;
ALTER TABLE t1 ADD FULLTEXT(f2);
--source ../innodb/include/wait_all_purged.inc
DROP TABLE t1;
diff --git a/mysql-test/suite/parts/t/partition_purge.test b/mysql-test/suite/parts/t/partition_purge.test
index 2df81b0e..054ecf47 100644
--- a/mysql-test/suite/parts/t/partition_purge.test
+++ b/mysql-test/suite/parts/t/partition_purge.test
@@ -3,7 +3,7 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
-CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1))ENGINE=InnoDB
+CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1))ENGINE=InnoDB STATS_PERSISTENT=0
PARTITION BY LIST(f1) (
PARTITION p1 VALUES in (1, 2, 3),
PARTITION p2 VALUES in (4, 5, 6));
diff --git a/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc b/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc
index 219a4105..313c0ed8 100644
--- a/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc
+++ b/mysql-test/suite/perfschema/include/pfs_running_event_scheduler.inc
@@ -1,10 +1,10 @@
-# threads are removed from:
+# threads are added to:
# - information_schema.processlist
# - performance_schema.threads
# at different times, so we may have to wait a little more
-# for the event_scheduler to shutdown
+# for the event_scheduler to start
#
let $wait_condition=
SELECT COUNT(*) = 1 FROM performance_schema.threads
- WHERE name like 'thread/sql/event%';
+ WHERE name LIKE 'thread/sql/event%' AND processlist_command IS NOT NULL;
--source include/wait_condition.inc
diff --git a/mysql-test/suite/perfschema/r/digest_view.result b/mysql-test/suite/perfschema/r/digest_view.result
index 2d5c7ca0..1bc4a3c2 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 8b1406618d34996cd11d1796438c78b5 EXPLAIN SELECT * FROM `test` . `v1` 1
-test 2c9e5d5b30d1690ba1a625afb4c42005 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
-test 2265269dbe1b17d1f309a63b8e56933f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
-test 2df0babfc3c8ad27b4e3f99ad59bc938 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
-test 8607297e7ffe77aa19a9d60812c5a8fd EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
-test 9c94fee7865aa050201f6e67887fd0c8 SELECT * FROM `test` . `v1` 1
-test 7c856ddf7b57d65f8124f39e8b81882e SELECT * FROM `test` . `v1` WHERE `a` = ? 1
-test 994b14d068c24edd8fd61b2f03663be2 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
-test b3102e1f51878e35936d7d3fe2901839 SELECT `a` , `b` FROM `test` . `v1` 1
-test cb300dd6358987c5afe1a2b0022fdea0 SELECT `b` , `a` FROM `test` . `v1` 1
-test 1b40b63f6a9dbffd146f0916fe4f5ed2 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test b69a5ddd08657692e23aa72d37dc15e0 EXPLAIN SELECT * FROM `test` . `v1` 1
+test 8c76fc18fe1711607640be2906e38f58 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
+test 9bedc57de65e2ac25d67fcb6ccadb427 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
+test 0539bbfdb016341a22d32fecb12c9882 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
+test 3368b44e9d8b8cfb13b58f97a255d77f EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
+test 2f619aeadc8bd993980ef9b4d12e4222 SELECT * FROM `test` . `v1` 1
+test b9a44c024c9d79de76f2ebcd2f208c4c SELECT * FROM `test` . `v1` WHERE `a` = ? 1
+test a3ccc4c3c79e853eaa17e3ceb7a24b30 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
+test 9556566adc0953fccd8e2e35019287ed SELECT `a` , `b` FROM `test` . `v1` 1
+test fc937c99007b0976d19fb685b3bf9acc SELECT `b` , `a` FROM `test` . `v1` 1
+test a73dca7a09f45de04f1f4588f0a4e19f 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 a68fd555281a14d2809c3105e9cb2c90 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
-test 4baff8f96e4b6ec6cdbfef5b9c7a8b12 DROP TABLE `test` . `v1` 1
-test 8b1406618d34996cd11d1796438c78b5 EXPLAIN SELECT * FROM `test` . `v1` 2
-test 2c9e5d5b30d1690ba1a625afb4c42005 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
-test 2265269dbe1b17d1f309a63b8e56933f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
-test 2df0babfc3c8ad27b4e3f99ad59bc938 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
-test 8607297e7ffe77aa19a9d60812c5a8fd EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
-test 9c94fee7865aa050201f6e67887fd0c8 SELECT * FROM `test` . `v1` 2
-test 7c856ddf7b57d65f8124f39e8b81882e SELECT * FROM `test` . `v1` WHERE `a` = ? 2
-test 994b14d068c24edd8fd61b2f03663be2 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
-test df38ce7f6e35972efe5a4ec57e48bf4d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
-test b3102e1f51878e35936d7d3fe2901839 SELECT `a` , `b` FROM `test` . `v1` 2
-test cb300dd6358987c5afe1a2b0022fdea0 SELECT `b` , `a` FROM `test` . `v1` 2
-test 1b40b63f6a9dbffd146f0916fe4f5ed2 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
+test 7f6c48fe072a231bc75d6d449978b9f5 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
+test c24db45ea4beed6ba2537ca6ea2d0484 DROP TABLE `test` . `v1` 1
+test b69a5ddd08657692e23aa72d37dc15e0 EXPLAIN SELECT * FROM `test` . `v1` 2
+test 8c76fc18fe1711607640be2906e38f58 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
+test 9bedc57de65e2ac25d67fcb6ccadb427 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
+test 0539bbfdb016341a22d32fecb12c9882 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
+test 3368b44e9d8b8cfb13b58f97a255d77f EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
+test 2f619aeadc8bd993980ef9b4d12e4222 SELECT * FROM `test` . `v1` 2
+test b9a44c024c9d79de76f2ebcd2f208c4c SELECT * FROM `test` . `v1` WHERE `a` = ? 2
+test a3ccc4c3c79e853eaa17e3ceb7a24b30 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
+test 7b82ea9a7c1859f76abed712d2d4b14d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
+test 9556566adc0953fccd8e2e35019287ed SELECT `a` , `b` FROM `test` . `v1` 2
+test fc937c99007b0976d19fb685b3bf9acc SELECT `b` , `a` FROM `test` . `v1` 2
+test a73dca7a09f45de04f1f4588f0a4e19f 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/mdl_func.result b/mysql-test/suite/perfschema/r/mdl_func.result
index 4887b15e..f3fc0d10 100644
--- a/mysql-test/suite/perfschema/r/mdl_func.result
+++ b/mysql-test/suite/perfschema/r/mdl_func.result
@@ -1,3 +1,4 @@
+# restart
UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name in ('wait/io/table/sql/handler',
diff --git a/mysql-test/suite/perfschema/r/misc_session_status.result b/mysql-test/suite/perfschema/r/misc_session_status.result
new file mode 100644
index 00000000..3ce472fc
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/misc_session_status.result
@@ -0,0 +1,20 @@
+#
+# MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
+#
+set @old_innodb_io_capacity=@@global.innodb_io_capacity;
+set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max;
+select * from performance_schema.session_status limit 0;
+VARIABLE_NAME VARIABLE_VALUE
+set max_session_mem_used=32768;
+select * from performance_schema.session_status;
+ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement
+set global innodb_io_capacity_max=100;
+Warnings:
+Warning 1210 Setting innodb_io_capacity_max 100 lower than innodb_io_capacity 200.
+Warning 1210 Setting innodb_io_capacity to 100
+set max_session_mem_used=default;
+set global innodb_io_capacity=@old_innodb_io_capacity;
+Warnings:
+Warning 1210 Setting innodb_io_capacity to 200 higher than innodb_io_capacity_max 100
+Warning 1210 Setting innodb_max_io_capacity to 400
+set global innodb_io_capacity_max=@old_innodb_io_capacity_max;
diff --git a/mysql-test/suite/perfschema/r/rpl_threads.result b/mysql-test/suite/perfschema/r/rpl_threads.result
index c756b4d9..3e9cf22f 100644
--- a/mysql-test/suite/perfschema/r/rpl_threads.result
+++ b/mysql-test/suite/perfschema/r/rpl_threads.result
@@ -58,4 +58,10 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
from performance_schema.threads
where PROCESSLIST_ID = @slave_sql_pid;
NAME TYPE PROCESSLIST_COMMAND PROCESSLIST_STATE
+#
+# MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
+#
+select variable_name, variable_value from performance_schema.status_by_thread
+where variable_name like '%impossible%';
+variable_name variable_value
include/rpl_end.inc
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 f0ceee5e..482c4cd5 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 ca9181d6d668396d467dd974f58a9402 SELECT ? + ? + SELECT ...
-statement/sql/truncate 4d2423d405bbcea8fa7bf9519c08dd8e TRUNCATE TABLE truncat...
+statement/sql/select 142569e3e23dff2a0170a603ed79020a SELECT ? + ? + SELECT ...
+statement/sql/truncate 5947880b8ba439f0ed3ff0bfbb04eebf TRUNCATE TABLE truncat...
diff --git a/mysql-test/suite/perfschema/t/mdl_func.test b/mysql-test/suite/perfschema/t/mdl_func.test
index fc12bdac..209c2f11 100644
--- a/mysql-test/suite/perfschema/t/mdl_func.test
+++ b/mysql-test/suite/perfschema/t/mdl_func.test
@@ -1,7 +1,11 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-# This test fails very frequently on a Windows builder.
---source include/not_windows.inc
+# This test needs a fresh restart. The table performance_schema.table_handles
+# can otherwise contain extra rows left from previous testcases.
+# For example the test case main.long_unique_delayed, which uses
+# INSERT DELAYED, will leave extra rows in this table if run just before this
+# test, causing .result diff failure.
+--source include/restart_mysqld.inc
UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
diff --git a/mysql-test/suite/perfschema/t/misc_session_status.test b/mysql-test/suite/perfschema/t/misc_session_status.test
new file mode 100644
index 00000000..c9e7d066
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/misc_session_status.test
@@ -0,0 +1,20 @@
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+# This does not crash on 32 bit because of less memory used
+--source include/have_64bit.inc
+--echo #
+--echo # MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
+--echo #
+source include/have_innodb.inc;
+set @old_innodb_io_capacity=@@global.innodb_io_capacity;
+set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max;
+select * from performance_schema.session_status limit 0; # discover the table
+set max_session_mem_used=32768;
+--error ER_OPTION_PREVENTS_STATEMENT
+# this used to crash, when OOM happened under LOCK_thd_kill
+select * from performance_schema.session_status;
+# this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables
+set global innodb_io_capacity_max=100;
+set max_session_mem_used=default;
+set global innodb_io_capacity=@old_innodb_io_capacity;
+set global innodb_io_capacity_max=@old_innodb_io_capacity_max;
diff --git a/mysql-test/suite/perfschema/t/rpl_threads.test b/mysql-test/suite/perfschema/t/rpl_threads.test
index a5ca51a9..fcecf775 100644
--- a/mysql-test/suite/perfschema/t/rpl_threads.test
+++ b/mysql-test/suite/perfschema/t/rpl_threads.test
@@ -81,5 +81,11 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
from performance_schema.threads
where PROCESSLIST_ID = @slave_sql_pid;
+--echo #
+--echo # MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
+--echo #
+select variable_name, variable_value from performance_schema.status_by_thread
+where variable_name like '%impossible%'; # should not crash
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff
index 06fdb0bd..791aecda 100644
--- a/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff
+++ b/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff
@@ -10,15 +10,19 @@
+set global innodb_compression_algorithm = lz4;
call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
- call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
-@@ -15,8 +15,8 @@
+ call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
+@@ -16,12 +16,12 @@
0 abcabcabc 300
1 defdefdef 3000
2 ghighighi 30000
-# restart: --disable-provider-bzip2
+# restart: --disable-provider-lz4
select a, left(b, 9), length(b) from t1;
--ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
-+ERROR HY000: Table test/t1 is compressed with lz4, which is not currently loaded. Please load the lz4 provider plugin to open the table
+ ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ show warnings;
+ Level Code Message
+-Warning 4185 MariaDB tried to use the BZip2 compression, but its provider plugin is not loaded
++Warning 4185 MariaDB tried to use the LZ4 compression, but its provider plugin is not loaded
+ Error 1932 Table 'test.t1' doesn't exist in engine
drop table t1;
# restart
diff --git a/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff
index ee348934..13c42f82 100644
--- a/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff
+++ b/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff
@@ -10,15 +10,19 @@
+set global innodb_compression_algorithm = lzma;
call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
- call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
-@@ -15,8 +15,8 @@
+ call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
+@@ -16,12 +16,12 @@
0 abcabcabc 300
1 defdefdef 3000
2 ghighighi 30000
-# restart: --disable-provider-bzip2
+# restart: --disable-provider-lzma
select a, left(b, 9), length(b) from t1;
--ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
-+ERROR HY000: Table test/t1 is compressed with lzma, which is not currently loaded. Please load the lzma provider plugin to open the table
+ ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ show warnings;
+ Level Code Message
+-Warning 4185 MariaDB tried to use the BZip2 compression, but its provider plugin is not loaded
++Warning 4185 MariaDB tried to use the LZMA compression, but its provider plugin is not loaded
+ Error 1932 Table 'test.t1' doesn't exist in engine
drop table t1;
# restart
diff --git a/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff
index d7cdc410..cc7783cc 100644
--- a/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff
+++ b/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff
@@ -10,15 +10,19 @@
+set global innodb_compression_algorithm = lzo;
call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
- call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
-@@ -15,8 +15,8 @@
+ call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
+@@ -16,12 +16,12 @@
0 abcabcabc 300
1 defdefdef 3000
2 ghighighi 30000
-# restart: --disable-provider-bzip2
+# restart: --disable-provider-lzo
select a, left(b, 9), length(b) from t1;
--ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
-+ERROR HY000: Table test/t1 is compressed with lzo, which is not currently loaded. Please load the lzo provider plugin to open the table
+ ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ show warnings;
+ Level Code Message
+-Warning 4185 MariaDB tried to use the BZip2 compression, but its provider plugin is not loaded
++Warning 4185 MariaDB tried to use the LZO compression, but its provider plugin is not loaded
+ Error 1932 Table 'test.t1' doesn't exist in engine
drop table t1;
# restart
diff --git a/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff b/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff
index e9c7485d..98c4427a 100644
--- a/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff
+++ b/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff
@@ -10,15 +10,19 @@
+set global innodb_compression_algorithm = snappy;
call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
- call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
-@@ -15,8 +15,8 @@
+ call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
+@@ -16,12 +16,12 @@
0 abcabcabc 300
1 defdefdef 3000
2 ghighighi 30000
-# restart: --disable-provider-bzip2
+# restart: --disable-provider-snappy
select a, left(b, 9), length(b) from t1;
--ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
-+ERROR HY000: Table test/t1 is compressed with snappy, which is not currently loaded. Please load the snappy provider plugin to open the table
+ ERROR 42S02: Table 'test.t1' doesn't exist in engine
+ show warnings;
+ Level Code Message
+-Warning 4185 MariaDB tried to use the BZip2 compression, but its provider plugin is not loaded
++Warning 4185 MariaDB tried to use the Snappy compression, but its provider plugin is not loaded
+ Error 1932 Table 'test.t1' doesn't exist in engine
drop table t1;
# restart
diff --git a/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff b/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff
index 9b155ff3..ac186d3c 100644
--- a/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff
+++ b/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff
@@ -1,6 +1,6 @@
--- suite/plugins/r/compression.result
+++ suite/plugins/r/compression.reject
-@@ -1,12 +1,8 @@
+@@ -1,13 +1,8 @@
#
-# Testing bzip2 compression provider with innodb
+# Testing lz4 compression provider with mroonga
@@ -9,20 +9,25 @@
-set global innodb_compression_algorithm = bzip2;
-call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
-call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+-call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
-call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
-create table t1 (a int, b text ) engine = innodb page_compressed = 1;
+create table t1 (a int, b text COMMENT 'FLAGS "COLUMN_SCALAR|COMPRESS_LZ4"') engine = mroonga charset = utf8;
insert t1 (a, b) values (0, repeat("abc", 100));
insert t1 (a, b) values (1, repeat("def", 1000));
insert t1 (a, b) values (2, repeat("ghi", 10000));
-@@ -14,8 +11,20 @@
+@@ -16,12 +11,20 @@
0 abcabcabc 300
1 defdefdef 3000
2 ghighighi 30000
-# restart: --disable-provider-bzip2
+# restart: --disable-provider-lz4
select a, left(b, 9), length(b) from t1;
--ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
+-ERROR 42S02: Table 'test.t1' doesn't exist in engine
+-show warnings;
+-Level Code Message
+-Warning 4185 MariaDB tried to use the BZip2 compression, but its provider plugin is not loaded
+-Error 1932 Table 'test.t1' doesn't exist in engine
+a left(b, 9) length(b)
+0 0
+1 0
diff --git a/mysql-test/suite/plugins/r/compression.result b/mysql-test/suite/plugins/r/compression.result
index dd267f28..d7c11abc 100644
--- a/mysql-test/suite/plugins/r/compression.result
+++ b/mysql-test/suite/plugins/r/compression.result
@@ -5,6 +5,7 @@ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provi
set global innodb_compression_algorithm = bzip2;
call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
create table t1 (a int, b text ) engine = innodb page_compressed = 1;
insert t1 (a, b) values (0, repeat("abc", 100));
@@ -17,6 +18,10 @@ a left(b, 9) length(b)
2 ghighighi 30000
# restart: --disable-provider-bzip2
select a, left(b, 9), length(b) from t1;
-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table
+ERROR 42S02: Table 'test.t1' doesn't exist in engine
+show warnings;
+Level Code Message
+Warning 4185 MariaDB tried to use the BZip2 compression, but its provider plugin is not loaded
+Error 1932 Table 'test.t1' doesn't exist in engine
drop table t1;
# restart
diff --git a/mysql-test/suite/plugins/r/sql_error_log.result b/mysql-test/suite/plugins/r/sql_error_log.result
index 0329949a..a0bf0ebc 100644
--- a/mysql-test/suite/plugins/r/sql_error_log.result
+++ b/mysql-test/suite/plugins/r/sql_error_log.result
@@ -9,6 +9,7 @@ sql_error_log_rotate OFF
sql_error_log_rotations 9
sql_error_log_size_limit 1000000
sql_error_log_warnings ON
+sql_error_log_with_db_and_thread_info OFF
set global sql_error_log_rate=1;
select * from t_doesnt_exist;
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
diff --git a/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result b/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result
new file mode 100644
index 00000000..732e74d8
--- /dev/null
+++ b/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result
@@ -0,0 +1,41 @@
+show variables like 'sql_error_log%';
+Variable_name Value
+sql_error_log_filename sql_errors.log
+sql_error_log_rate 1
+sql_error_log_rotate OFF
+sql_error_log_rotations 9
+sql_error_log_size_limit 1000000
+sql_error_log_warnings ON
+sql_error_log_with_db_and_thread_info ON
+set global sql_error_log_rate=1;
+# Trying to set the variable at runtime
+SET sql_error_log_with_db_and_thread_info=OFF;
+ERROR HY000: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable
+#
+# Using test database from mtr
+#
+DROP DATABASE db;
+ERROR HY000: Can't drop database 'db'; database doesn't exist
+#
+# Using no database at all
+#
+connect con1,localhost,root,,*NO-ONE*;
+DROP DATABASE dbnodb;
+ERROR HY000: Can't drop database 'dbnodb'; database doesn't exist
+disconnect con1;
+connection default;
+#
+# Using database with name `NULL`
+#
+CREATE DATABASE `NULL`;
+USE `NULL`;
+DROP DATABASE db;
+ERROR HY000: Can't drop database 'db'; database doesn't exist
+TIME THREAD_ID HOSTNAME `mtr` WARNING 1286: Unknown storage engine 'InnoDB' : SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql
+TIME THREAD_ID HOSTNAME `mtr` WARNING 1286: Unknown storage engine 'InnoDB' : SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql
+TIME THREAD_ID HOSTNAME `mtr` WARNING 1286: Unknown storage engine 'InnoDB' : SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql
+TIME THREAD_ID HOSTNAME `test` ERROR 1238: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable : SET sql_error_log_with_db_and_thread_info=OFF
+TIME THREAD_ID HOSTNAME `test` ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
+TIME THREAD_ID HOSTNAME NULL ERROR 1008: Can't drop database 'dbnodb'; database doesn't exist : DROP DATABASE dbnodb
+TIME THREAD_ID HOSTNAME `NULL` ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
+DROP DATABASE `NULL`;
diff --git a/mysql-test/suite/plugins/r/test_sql_service.result b/mysql-test/suite/plugins/r/test_sql_service.result
index 2983da28..bb0b536a 100644
--- a/mysql-test/suite/plugins/r/test_sql_service.result
+++ b/mysql-test/suite/plugins/r/test_sql_service.result
@@ -1,8 +1,8 @@
-reset master;
install plugin test_sql_service soname 'test_sql_service';
show status like 'test_sql_service_passed';
Variable_name Value
Test_sql_service_passed 1
+reset master;
set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN';
set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN';
set global test_sql_service_execute_sql_global= 'SET SQL_LOG_BIN=1';
diff --git a/mysql-test/suite/plugins/t/compression.combinations b/mysql-test/suite/plugins/t/compression.combinations
index 645ca60e..17ea9e82 100644
--- a/mysql-test/suite/plugins/t/compression.combinations
+++ b/mysql-test/suite/plugins/t/compression.combinations
@@ -1,25 +1,30 @@
[innodb-bzip2]
innodb
+innodb-fast-shutdown=0
plugin-load-add=$PROVIDER_BZIP2_SO
loose-provider-bzip2
[innodb-lz4]
innodb
+innodb-fast-shutdown=0
plugin-load-add=$PROVIDER_LZ4_SO
loose-provider-lz4
[innodb-lzma]
innodb
+innodb-fast-shutdown=0
plugin-load-add=$PROVIDER_LZMA_SO
loose-provider-lzma
[innodb-lzo]
innodb
+innodb-fast-shutdown=0
plugin-load-add=$PROVIDER_LZO_SO
loose-provider-lzo
[innodb-snappy]
innodb
+innodb-fast-shutdown=0
plugin-load-add=$PROVIDER_SNAPPY_SO
loose-provider-snappy
diff --git a/mysql-test/suite/plugins/t/compression.test b/mysql-test/suite/plugins/t/compression.test
index c97c5725..df892acf 100644
--- a/mysql-test/suite/plugins/t/compression.test
+++ b/mysql-test/suite/plugins/t/compression.test
@@ -21,6 +21,7 @@ if ($engine == "innodb") {
let $table_params = page_compressed = 1;
call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt");
call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed");
+ call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate");
call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table");
}
if ($engine == "mroonga") {
@@ -39,8 +40,9 @@ let $restart_parameters = --disable-provider-$alg;
source include/restart_mysqld.inc;
if ($engine == "innodb") {
- error ER_PROVIDER_NOT_LOADED;
+ error ER_NO_SUCH_TABLE_IN_ENGINE;
select a, left(b, 9), length(b) from t1;
+ show warnings;
}
if ($engine == "mroonga"){
select a, left(b, 9), length(b) from t1;
diff --git a/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.opt b/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.opt
new file mode 100644
index 00000000..7d502896
--- /dev/null
+++ b/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.opt
@@ -0,0 +1 @@
+--plugin-load-add=$SQL_ERRLOG_SO --sql-error-log-with-db-and-thread-info=1 --lower_case_table_names=2
diff --git a/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test b/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test
new file mode 100644
index 00000000..a9f01903
--- /dev/null
+++ b/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test
@@ -0,0 +1,49 @@
+--source include/not_embedded.inc
+
+if (!$SQL_ERRLOG_SO) {
+ skip No SQL_ERROR_LOG plugin;
+}
+
+show variables like 'sql_error_log%';
+set global sql_error_log_rate=1;
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--echo # Trying to set the variable at runtime
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET sql_error_log_with_db_and_thread_info=OFF;
+
+--echo #
+--echo # Using test database from mtr
+--echo #
+
+--error ER_DB_DROP_EXISTS
+DROP DATABASE db;
+
+--echo #
+--echo # Using no database at all
+--echo #
+
+
+connect (con1,localhost,root,,*NO-ONE*);
+--error ER_DB_DROP_EXISTS
+DROP DATABASE dbnodb;
+disconnect con1;
+connection default;
+
+--echo #
+--echo # Using database with name `NULL`
+--echo #
+CREATE DATABASE `NULL`;
+USE `NULL`;
+--error ER_DB_DROP_EXISTS
+DROP DATABASE db;
+
+
+--let SEARCH_FILE= $MYSQLD_DATADIR/sql_errors.log
+--let LINES_TO_READ=7
+--replace_regex /[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `mtr` /TIME THREAD_ID HOSTNAME `mtr` //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `test` /TIME THREAD_ID HOSTNAME `test` //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* NULL /TIME THREAD_ID HOSTNAME NULL //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `NULL` /TIME THREAD_ID HOSTNAME `NULL` /
+--source include/read_head.inc
+
+DROP DATABASE `NULL`;
diff --git a/mysql-test/suite/plugins/t/test_sql_service.test b/mysql-test/suite/plugins/t/test_sql_service.test
index 2f53c1d5..ee611ef9 100644
--- a/mysql-test/suite/plugins/t/test_sql_service.test
+++ b/mysql-test/suite/plugins/t/test_sql_service.test
@@ -1,8 +1,6 @@
--source include/not_embedded.inc
--source include/have_log_bin.inc
-reset master; # clear binlogs
-
if (!$TEST_SQL_SERVICE_SO) {
skip No TEST_SQL_SERVICE plugin;
}
@@ -13,6 +11,7 @@ source include/wait_until_count_sessions.inc;
install plugin test_sql_service soname 'test_sql_service';
show status like 'test_sql_service_passed';
+reset master;
set global test_sql_service_execute_sql_global= 'create table test.t1 select 1 as a, @@SQL_LOG_BIN';
set global test_sql_service_execute_sql_local= 'insert into test.t1 select 2 as a, @@SQL_LOG_BIN';
@@ -76,8 +75,7 @@ drop table t1;
uninstall plugin test_sql_service;
# Check that statements were executed/binlogged in correct order.
-source include/show_binlog_events.inc;
+--source include/show_binlog_events.inc
# --replace_column 2 # 5 #
# --replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
-# SHOW BINLOG EVENTS LIMIT 3,100;
-
+# SHOW BINLOG EVENTS LIMIT 3,5;
diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result
index 57a14711..1b133b1b 100644
--- a/mysql-test/suite/roles/set_default_role_for.result
+++ b/mysql-test/suite/roles/set_default_role_for.result
@@ -14,7 +14,7 @@ set default role role_a for user_a@localhost;
set default role invalid_role for user_a@localhost;
ERROR OP000: Invalid role specification `invalid_role`
set default role role_b for user_a@localhost;
-ERROR OP000: User `root`@`localhost` has not been granted role `role_b`
+ERROR OP000: User `user_a`@`localhost` has not been granted role `role_b`
set default role role_b for user_b@localhost;
show grants;
Grants for user_a@localhost
diff --git a/mysql-test/suite/roles/set_default_role_invalid.result b/mysql-test/suite/roles/set_default_role_invalid.result
index 12e2c035..2cd84cf2 100644
--- a/mysql-test/suite/roles/set_default_role_invalid.result
+++ b/mysql-test/suite/roles/set_default_role_invalid.result
@@ -48,7 +48,7 @@ CREATE USER b;
CREATE ROLE r1;
CREATE ROLE r2;
SET DEFAULT ROLE r1 FOR a;
-ERROR OP000: User `root`@`localhost` has not been granted role `r1`
+ERROR OP000: User `a`@`%` has not been granted role `r1`
GRANT r1 TO b;
GRANT r2 TO b;
SET DEFAULT ROLE r1 FOR b;
@@ -100,7 +100,7 @@ GRANT USAGE ON *.* TO `b`@`%`
GRANT SELECT, UPDATE ON `mysql`.* TO `b`@`%`
SET DEFAULT ROLE `r2` FOR `b`@`%`
SET DEFAULT ROLE r1 FOR a;
-ERROR OP000: User `b`@`%` has not been granted role `r1`
+ERROR OP000: User `a`@`%` has not been granted role `r1`
SET DEFAULT ROLE invalid_role;
ERROR OP000: Invalid role specification `invalid_role`
SET DEFAULT ROLE invalid_role FOR a;
@@ -117,7 +117,7 @@ SET DEFAULT ROLE None;
# Change user b (session 3: role granted to user a)
SET DEFAULT ROLE r1 FOR a;
SET DEFAULT ROLE r2 FOR a;
-ERROR OP000: User `b`@`%` has not been granted role `r2`
+ERROR OP000: User `a`@`%` has not been granted role `r2`
SET DEFAULT ROLE invalid_role;
ERROR OP000: Invalid role specification `invalid_role`
SET DEFAULT ROLE invalid_role FOR a;
diff --git a/mysql-test/suite/roles/set_default_role_invalid.test b/mysql-test/suite/roles/set_default_role_invalid.test
index 02fca110..d2ef01b8 100644
--- a/mysql-test/suite/roles/set_default_role_invalid.test
+++ b/mysql-test/suite/roles/set_default_role_invalid.test
@@ -70,7 +70,6 @@ CREATE USER a;
CREATE USER b;
CREATE ROLE r1;
CREATE ROLE r2;
-# Role has not been granted to user a, but the role is visible to current_user
--error ER_INVALID_ROLE
SET DEFAULT ROLE r1 FOR a;
# Granting roles to user b
diff --git a/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt
new file mode 100644
index 00000000..ec008a81
--- /dev/null
+++ b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt
@@ -0,0 +1 @@
+--skip-name-resolve \ No newline at end of file
diff --git a/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result
new file mode 100644
index 00000000..a267e114
--- /dev/null
+++ b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result
@@ -0,0 +1,85 @@
+#
+# MDEV-26875: Wrong user in SET DEFAULT ROLE error
+#
+create user test_user;
+create role test_role;
+show grants for test_user;
+Grants for test_user@%
+GRANT USAGE ON *.* TO `test_user`@`%`
+set default role test_role for test_user;
+ERROR OP000: User `test_user`@`%` has not been granted role `test_role`
+grant test_role to test_user;
+set default role test_role for test_user;
+show grants for test_user;
+Grants for test_user@%
+GRANT `test_role` TO `test_user`@`%`
+GRANT USAGE ON *.* TO `test_user`@`%`
+SET DEFAULT ROLE `test_role` FOR `test_user`@`%`
+set default role none for test_user;
+#
+# Try to set default role to role(`test_role`).
+--------------------------------------------------------------
+show grants for test_role;
+Grants for test_role
+GRANT USAGE ON *.* TO `test_role`
+create role new_role;
+grant new_role to test_role;
+show grants for test_role;
+Grants for test_role
+GRANT `new_role` TO `test_role`
+GRANT USAGE ON *.* TO `test_role`
+GRANT USAGE ON *.* TO `new_role`
+set default role new_role for test_role;
+ERROR OP000: User `test_role`@`%` has not been granted role `new_role`
+#
+# Test of errors, where hostname cannot be resolved `test_user`
+--------------------------------------------------------------
+grant test_role to test_user@'%';
+set default role test_role for test_user@'%';
+connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT;
+show grants;
+Grants for test_user@%
+GRANT `test_role` TO `test_user`@`%`
+GRANT USAGE ON *.* TO `test_user`@`%`
+GRANT `new_role` TO `test_role`
+GRANT USAGE ON *.* TO `test_role`
+GRANT USAGE ON *.* TO `new_role`
+SET DEFAULT ROLE `test_role` FOR `test_user`@`%`
+select current_role;
+current_role
+test_role
+set role `new_role`;
+ERROR OP000: User `test_user`@`%` has not been granted role `new_role`
+connection default;
+set default role none for test_user;
+disconnect con_test_user;
+connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT;
+select current_role;
+current_role
+NULL
+set role `new_role`;
+ERROR OP000: User `test_user`@`%` has not been granted role `new_role`
+connection default;
+disconnect con_test_user;
+#
+# Test of anonymous user connection
+--------------------------------------------------------------
+grant test_role to ''@localhost;
+connect con1,localhost,'',,,$MASTER_MYPORT;
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+NULL
+SET role test_role;
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+test_role
+SET role new_role;
+ERROR OP000: User ``@`localhost` has not been granted role `new_role`
+set default role test_role for ''@localhost;
+ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings
+connection default;
+disconnect con1;
+REVOKE all privileges, grant option from ''@localhost;
+drop role new_role;
+drop role test_role;
+drop user test_user;
diff --git a/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test
new file mode 100644
index 00000000..5b4b14d3
--- /dev/null
+++ b/mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test
@@ -0,0 +1,78 @@
+source include/not_embedded.inc;
+
+--echo #
+--echo # MDEV-26875: Wrong user in SET DEFAULT ROLE error
+--echo #
+create user test_user;
+create role test_role;
+show grants for test_user;
+--error ER_INVALID_ROLE
+set default role test_role for test_user;
+grant test_role to test_user;
+set default role test_role for test_user;
+show grants for test_user;
+set default role none for test_user;
+
+--echo #
+--echo # Try to set default role to role(`test_role`).
+--echo --------------------------------------------------------------
+show grants for test_role;
+create role new_role;
+grant new_role to test_role;
+show grants for test_role;
+# One can not set role to a role
+--error ER_INVALID_ROLE
+set default role new_role for test_role;
+
+--echo #
+--echo # Test of errors, where hostname cannot be resolved `test_user`
+--echo --------------------------------------------------------------
+# `new_role` is granted to `test_role`
+grant test_role to test_user@'%';
+set default role test_role for test_user@'%';
+
+connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT;
+show grants;
+select current_role;
+# `test_user` indirectly granted `new_role`
+--error ER_INVALID_ROLE
+set role `new_role`;
+
+connection default;
+set default role none for test_user;
+disconnect con_test_user;
+
+connect con_test_user,127.0.0.1,test_user,,,$MASTER_MYPORT;
+select current_role;
+--error ER_INVALID_ROLE
+set role `new_role`;
+
+connection default;
+disconnect con_test_user;
+
+--echo #
+--echo # Test of anonymous user connection
+--echo --------------------------------------------------------------
+--source include/add_anonymous_users.inc
+# Skip windows, since it uses current user `Administrator` in buildbot.
+--source include/not_windows.inc
+grant test_role to ''@localhost;
+
+connect(con1,localhost,'',,,$MASTER_MYPORT);
+SELECT CURRENT_ROLE;
+SET role test_role;
+SELECT CURRENT_ROLE;
+# user cannot set subset role, since it is not granted explicitly
+--error ER_INVALID_ROLE
+SET role new_role;
+--error ER_PASSWORD_ANONYMOUS_USER
+set default role test_role for ''@localhost;
+
+connection default;
+disconnect con1;
+REVOKE all privileges, grant option from ''@localhost;
+--source include/delete_anonymous_users.inc
+
+drop role new_role;
+drop role test_role;
+drop user test_user;
diff --git a/mysql-test/suite/rpl/include/mdev-31448_conservative.inc b/mysql-test/suite/rpl/include/mdev-31448_conservative.inc
index 3db5a000..e479901f 100644
--- a/mysql-test/suite/rpl/include/mdev-31448_conservative.inc
+++ b/mysql-test/suite/rpl/include/mdev-31448_conservative.inc
@@ -36,7 +36,8 @@ insert into t1 values (3);
--connection slave
--source include/start_slave.inc
---let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
+# Wildcard for `state` as it depends on whether WSREP is compiled in or not.
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
@@ -50,8 +51,8 @@ insert into t1 values (3);
commit;
--connection slave
---let $slave_timeout=1032
---source include/wait_for_slave_sql_to_stop.inc
+--let $slave_sql_errno=1032
+--source include/wait_for_slave_sql_error.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
diff --git a/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc b/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
index 22cee6b3..c561e298 100644
--- a/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
+++ b/mysql-test/suite/rpl/include/mdev-31448_optimistic.inc
@@ -55,7 +55,8 @@ drop table t2;
--source include/start_slave.inc
--echo # wait for T1
---let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
+# Wildcard for `state` as it depends on whether WSREP is compiled in or not.
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # wait for T2
@@ -75,8 +76,8 @@ drop table t2;
commit;
--connection slave
---let $slave_timeout=1032
---source include/wait_for_slave_sql_to_stop.inc
+--let $slave_sql_errno=1032
+--source include/wait_for_slave_sql_error.inc
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
diff --git a/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
index 48e4399d..b571c24e 100644
--- a/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
+++ b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
@@ -128,6 +128,7 @@ if (!$slave_sql_errno)
}
--echo # Stop $con2 so it stops receiving $con1 events.
+--let $rpl_allow_error= 1
--source include/stop_slave.inc
--connection $con1
diff --git a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
index 2634a602..77b969fc 100644
--- a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
+++ b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
@@ -418,6 +418,8 @@ while ($n)
COMMIT;
--connection slave
+# Multi-statement transaction raised ER_TRANS_CACHE_FULL (4096=128x32)
+# that will stop SQL slave thread
--let $slave_sql_errno= 1197
if (`SELECT @@binlog_format = 'ROW'`)
{
@@ -437,7 +439,8 @@ source include/show_binlog_events.inc;
--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
-source include/stop_slave.inc;
+# SQL slave is stopped, stop only IO thread
+source include/stop_slave_io.inc;
source include/start_slave.inc;
connection master;
diff --git a/mysql-test/suite/rpl/include/rpl_change_master_demote.inc b/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
index 4c563454..932a2b87 100644
--- a/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
+++ b/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
@@ -85,5 +85,16 @@ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHER
--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1
--source include/start_slave.inc
+# Ensure master is ready to start sending new transactions. That is, because
+# the master does not have log_slave_updates, the slave's transactions of
+# repl_t are not binlogged, and its state is behind. If the master binlogs
+# any new transactions before the slaves connection is matured,
+# ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 can be reported to the slave
+# FIXME: We shouldn't need to do this, rather, the master should use
+# log-slave-updates and gtid-strict-mode
+--connection master
+--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State like '%Master has sent all binlog to slave%'
+--source include/wait_condition.inc
+
--let $include_filename= rpl_change_master_demote.inc
--source include/end_include_file.inc
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
index 96d75f33..a8b729d0 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
@@ -67,6 +67,17 @@ if ($same_version_binlogs)
if (!$same_version_binlogs)
{
+ # Make sure the dump thread is gone before moving around binlog files. Else
+ # it might see an empty file and give error (MDEV-29816).
+ --let $dump_thrid= `Select id FROM information_schema.processlist WHERE Command='Binlog Dump'`
+ if ($dump_thrid) {
+ --disable_query_log
+ --error 0,ER_NO_SUCH_THREAD
+ eval KILL CONNECTION $dump_thrid;
+ --enable_query_log
+ --let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE Command='Binlog Dump'
+ --source include/wait_condition.inc
+ }
--move_file $datadir/master-bin.000002 $datadir/master-bin.000002.sav
--copy_file $MYSQL_TEST_DIR/std_data/mdev29078-mysql-bin.000001 $datadir/master-bin.000002
--exec $MYSQL_BINLOG --short-form $datadir/master-bin.000002
diff --git a/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc b/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
index 4726bbe1..f9c007b4 100644
--- a/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
+++ b/mysql-test/suite/rpl/include/rpl_shutdown_wait_slaves.inc
@@ -75,17 +75,22 @@ EOF
--connection server_1
DROP TABLE t1;
+# Slaves IO thread will receive the disconnect error when master was shutdown
+# so we are allowing error on start.
--connection server_2
--disable_warnings
+--let rpl_allow_error=1
--source include/start_slave.inc
--enable_warnings
--connection server_3
--disable_warnings
+--let rpl_allow_error=1
--source include/start_slave.inc
--enable_warnings
--connection server_4
--disable_warnings
+--let rpl_allow_error=1
--source include/start_slave.inc
--enable_warnings
diff --git a/mysql-test/suite/rpl/include/rpl_start_stop_slave.test b/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
index ae5f8361..56b04494 100644
--- a/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
@@ -207,7 +207,7 @@ START SLAVE;
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
RESET SLAVE;
--connection master
diff --git a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test
index ac01fb04..6bc872ca 100644
--- a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test
+++ b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test
@@ -82,7 +82,9 @@ connection slave;
# slave will catch the killed status, won't shut down immediately
# but does it eventually having the whole group unfinished (not committed)
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_SLAVE_FATAL_ERROR
+--let slave_sql_errno= 1593
+source include/wait_for_slave_sql_error.inc;
# checking: the error and group unfinished
@@ -120,7 +122,8 @@ connection slave;
# but does it eventually having the whole group unfinished (not committed)
#
-source include/wait_for_slave_sql_to_stop.inc;
+--let slave_sql_errno= 1593
+source include/wait_for_slave_sql_error.inc;
# checking: the error and group unfinished
diff --git a/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result b/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result
index 23a16e01..7fa1a831 100644
--- a/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result
+++ b/mysql-test/suite/rpl/r/mdev-31448_kill_ooo_finish_optimistic.result
@@ -42,7 +42,8 @@ include/save_master_gtid.inc
connection slave;
#
# Cleanup
-include/stop_slave.inc
+include/wait_for_slave_sql_to_stop.inc
+include/stop_slave_io.inc
set @@global.slave_parallel_threads= 0;
set @@global.slave_parallel_mode= optimistic;
set @@global.innodb_lock_wait_timeout= 50;
diff --git a/mysql-test/suite/rpl/r/parallel_backup.result b/mysql-test/suite/rpl/r/parallel_backup.result
index 7cf72ed1..83c7a916 100644
--- a/mysql-test/suite/rpl/r/parallel_backup.result
+++ b/mysql-test/suite/rpl/r/parallel_backup.result
@@ -73,8 +73,6 @@ include/stop_slave.inc
# Normal XA ROLLBACK
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
@@ -110,8 +108,6 @@ include/stop_slave.inc
# Errored out XA COMMIT
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
diff --git a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result
index b89cb154..e1fd7701 100644
--- a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result
+++ b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result
@@ -76,8 +76,6 @@ include/stop_slave.inc
# Normal XA ROLLBACK
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
@@ -113,8 +111,6 @@ include/stop_slave.inc
# Errored out XA COMMIT
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
diff --git a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result
index 111bc7fb..9e29e5a3 100644
--- a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result
+++ b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result
@@ -76,8 +76,6 @@ include/stop_slave.inc
# Normal XA ROLLBACK
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
@@ -113,8 +111,6 @@ include/stop_slave.inc
# Errored out XA COMMIT
connection slave;
include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
connection master;
connection aux_slave;
BEGIN;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result
new file mode 100644
index 00000000..a876a597
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result
@@ -0,0 +1,38 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=MyISAM;
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 0
+Binlog_stmt_cache_use 0
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,load_data_binlog_cache_error";
+LOAD DATA CONCURRENT LOCAL INFILE 'std_data/bug30435_5k.txt'
+ REPLACE INTO TABLE t1 (a);
+ERROR HY000: Error writing file '<FILENAME>' (Errcode: 28 "No space left on device")
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 1
+Binlog_stmt_cache_use 1
+SELECT IF(COUNT(*) > 0 AND COUNT(*) < 5000,
+"ok",
+CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+AS check_result
+FROM t1;
+check_result
+ok
+connection slave;
+include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+connection master;
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result
new file mode 100644
index 00000000..753fdaa4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result
@@ -0,0 +1,51 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(255)) ENGINE=MyISAM;
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 0
+Binlog_stmt_cache_use 0
+INSERT INTO t1 VALUES (0, CONCAT("?", "-", REPEAT("x", 200)));
+INSERT INTO t1 SELECT a+1, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+2, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+4, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+8, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+16, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+32, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+64, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+128, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 2
+Binlog_stmt_cache_use 9
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,simulate_disk_full_at_flush_pending";
+INSERT INTO t1 SELECT a+256, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+ERROR HY000: Error writing file '<FILENAME>' (Errcode: 28 "No space left on device")
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+Variable_name Value
+Binlog_stmt_cache_disk_use 3
+Binlog_stmt_cache_use 10
+SELECT IF(COUNT(*) > 256 AND COUNT(*) < 512,
+"ok",
+CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+AS check_result
+FROM t1;
+check_result
+ok
+ALTER TABLE t1 COMMENT '<mumble>';
+connection slave;
+include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+256
+connection master;
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
index b913a49b..af79b482 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
@@ -8,6 +8,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err
connection slave;
include/stop_slave.inc
@@ -15,6 +16,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
include/start_slave.inc
connection master;
"Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err
CREATE TABLE t (f INT) ENGINE=INNODB;
INSERT INTO t VALUES(10);
@@ -25,6 +27,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
"Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err
SET @@SESSION.gtid_domain_id=10;
INSERT INTO t VALUES(20);
@@ -35,6 +38,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
"Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
+include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err
"===== Clean up ====="
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_change_master_demote.result b/mysql-test/suite/rpl/r/rpl_change_master_demote.result
index 38cff838..70d141ef 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master_demote.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master_demote.result
@@ -58,6 +58,7 @@ GTID_SLAVE_POS 0-2-3
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will
# completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
@@ -124,6 +125,7 @@ GTID_SLAVE_POS 0-2-5
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 3: Using a single domain id, if neither gtid_slave_pos nor
# gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
@@ -183,6 +185,7 @@ GTID_SLAVE_POS 0-2-9
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent,
# MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
@@ -244,6 +247,7 @@ GTID_SLAVE_POS 0-2-13
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 5: If a new domain id is added into gtid_binlog_pos while
# gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will
@@ -308,6 +312,7 @@ GTID_SLAVE_POS 0-2-17,1-1-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 6: If gtid_slave_pos has multiple GTID positions and
# gtid_binlog_pos contains updates on existing domain ids, new
@@ -390,6 +395,7 @@ GTID_SLAVE_POS 0-2-21,1-3-4,2-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with
# IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs
@@ -455,6 +461,7 @@ GTID_SLAVE_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
#
# Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos,
# and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
@@ -556,6 +563,7 @@ GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
# Demote master to slave with the more recent gtid_slave_pos
connection master;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
@@ -619,6 +627,7 @@ GTID_SLAVE_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
connection master;
connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+connection master;
# Tag gtid_slave_pos now (before binlog updates) for later comparison
connection master;
# In domain 1, make gtid_slave_pos < gtid_binlog_pos
diff --git a/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result b/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
index 5664b791..2596d346 100644
--- a/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_circular_semi_sync.result
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+connection server_2;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
# Master server_1 and Slave server_2 initialization ...
connection server_2;
include/stop_slave.inc
@@ -40,6 +42,8 @@ set @@global.rpl_semi_sync_master_enabled = 1;
INSERT INTO t1(a) VALUES (2);
include/save_master_gtid.inc
connection server_1;
+include/stop_slave.inc
+include/start_slave.inc
#
# the successful sync is a required proof
#
diff --git a/mysql-test/suite/rpl/r/rpl_connection.result b/mysql-test/suite/rpl/r/rpl_connection.result
index b5ce7f4e..9fb17b5f 100644
--- a/mysql-test/suite/rpl/r/rpl_connection.result
+++ b/mysql-test/suite/rpl/r/rpl_connection.result
@@ -6,7 +6,7 @@ include/stop_slave.inc
CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '';
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1045, 1593]
-include/stop_slave.inc
+include/stop_slave_sql.inc
CHANGE MASTER TO MASTER_USER= 'root', MASTER_PASSWORD= '';
START SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result b/mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result
new file mode 100644
index 00000000..12ad5870
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result
@@ -0,0 +1,66 @@
+include/master-slave.inc
+[connection master]
+#
+# Initialize test data
+connection master;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+call mtr.add_suppression("Connection was killed");
+call mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
+set @save_parallel_threads= @@global.slave_parallel_threads;
+set @save_parallel_mode= @@global.slave_parallel_mode;
+set @save_transaction_retries= @@global.slave_transaction_retries;
+set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+set @@global.slave_parallel_threads= 2;
+set @@global.slave_parallel_mode= CONSERVATIVE;
+set @@global.slave_transaction_retries= 0;
+set @@global.innodb_lock_wait_timeout= 10;
+# Grabbing lock on innodb row to force future replication transaction to wait (and eventually timeout)
+BEGIN;
+select * from t1 where a=1 for update;
+a
+1
+connection master;
+set @old_dbug= @@session.debug_dbug;
+set @@session.debug_dbug="+d,binlog_force_commit_id";
+SET @commit_id= 10000;
+update t1 set a=2 where a=1;
+SET @commit_id= 10001;
+insert into t1 values (3);
+set @@session.debug_dbug= @old_dbug;
+connection slave;
+start slave;
+# Waiting for first transaction to start (and be held at innodb row lock)..
+# Waiting for next transaction to start and hold at do_gco_wait()..
+connection slave1;
+set @@session.debug_dbug="+d,hold_sss_with_err_lock";
+show slave status;
+connection slave;
+set debug_sync="now wait_for sss_got_err_lock";
+kill <TID of worker in do_gco_wait>;
+set debug_sync="now signal sss_continue";
+connection slave1;
+# Waiting for SHOW SLAVE STATUS to complete..
+# ..done
+connection slave;
+ROLLBACK;
+include/wait_for_slave_sql_error.inc [errno=1927]
+#
+# Cleanup
+connection master;
+drop table t1;
+include/save_master_gtid.inc
+connection slave;
+set debug_sync= "RESET";
+set @@global.slave_parallel_threads= @save_parallel_threads;
+set @@global.slave_parallel_mode= @save_parallel_mode;
+set @@global.slave_transaction_retries= @save_transaction_retries;
+set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
+start slave sql_thread;
+include/sync_with_master_gtid.inc
+include/rpl_end.inc
+# End of rpl_deadlock_show_slave_status.test
diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave.result b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
index c8c3bc36..7ac68e25 100644
--- a/mysql-test/suite/rpl/r/rpl_delayed_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
@@ -70,6 +70,9 @@ include/stop_slave.inc
# CHANGE MASTER TO MASTER_DELAY = 2*T
include/start_slave.inc
connection master;
+INSERT INTO t1 VALUES ('Syncing slave', 5);
+connection slave;
+connection master;
INSERT INTO t1 VALUES (delay_on_slave(1), 6);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
index feef82a5..5250c4bb 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
@@ -135,7 +135,7 @@ i
2
3
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
@@ -204,7 +204,7 @@ i
10
11
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
@@ -287,7 +287,7 @@ i
16
17
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
@@ -384,7 +384,7 @@ i
22
23
SET @@global.debug_dbug=@saved_dbug;
-include/stop_slave.inc
+include/stop_slave_sql.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
index 0a414cb3..a54ff99b 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
@@ -38,7 +38,8 @@ connection master;
include/rpl_start_server.inc [server_number=1]
# Master has restarted successfully
connection slave;
-include/stop_slave.inc
+include/stop_slave_sql.inc
+include/stop_slave_io.inc
include/start_slave.inc
select * from ti;
a
diff --git a/mysql-test/suite/rpl/r/rpl_fail_register.result b/mysql-test/suite/rpl/r/rpl_fail_register.result
index 2cddc796..0398220c 100644
--- a/mysql-test/suite/rpl/r/rpl_fail_register.result
+++ b/mysql-test/suite/rpl/r/rpl_fail_register.result
@@ -1,14 +1,15 @@
include/master-slave.inc
[connection master]
connection slave;
+CALL mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: Debug Induced Error");
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='d,fail_com_register_slave';
stop slave;
reset slave;
include/wait_for_slave_to_stop.inc
start slave;
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/wait_for_slave_io_error.inc [errno=1597]
+include/stop_slave_sql.inc
set global debug_dbug=@old_dbug;
connection master;
kill DUMP_THREAD;
diff --git a/mysql-test/suite/rpl/r/rpl_gis_user_var.result b/mysql-test/suite/rpl/r/rpl_gis_user_var.result
new file mode 100644
index 00000000..c6aab9e0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gis_user_var.result
@@ -0,0 +1,21 @@
+include/master-slave.inc
+[connection master]
+#
+#
+#
+connection master;
+SET @p=POINT(1,1);
+CREATE TABLE t1 AS SELECT @p AS p;
+connection slave;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `p` point DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT ST_AsWKT(p) FROM t1;
+ST_AsWKT(p)
+POINT(1 1)
+connection master;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
index 584499a9..a7da7010 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
@@ -188,6 +188,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
+SET sql_log_bin= 0;
+CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
+SELECT BINLOG_GTID_POS(@binlog_file, 4);
+BINLOG_GTID_POS(@binlog_file, 4)
+NULL
+DROP TABLE t1;
+SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
index 9c369734..9e788e8f 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
@@ -52,7 +52,7 @@ Waiting until 'Slave_IO_Running' = 'Yes' [$slave_error_param='Last_IO_Errno']
.. con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
...==== BEGIN include/wait_for_slave_param.inc [Slave_SQL_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
-Waiting until 'Slave_SQL_Running' = 'Yes' [$slave_error_param='1']
+Waiting until 'Slave_SQL_Running' = 'Yes' [$slave_error_param='']
[connection slave]
...==== END include/wait_for_slave_param.inc [Slave_SQL_Running] ====
... con='slave' warn='1' qlog='1' rlog='1' aborterr='1'
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result b/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
index 593f83a7..229ac02b 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_errorlog.result
@@ -23,7 +23,8 @@ INSERT INTO t1 VALUES (2);
SET sql_log_bin=1;
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
-include/stop_slave.inc
+include/wait_for_slave_io_to_start.inc
+include/stop_slave_io.inc
SET GLOBAL gtid_slave_pos= "0-1-100";
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
@@ -39,7 +40,7 @@ REPLACE INTO t1 VALUES (5);
SET debug_dbug= @dbug_save;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1590]
-include/stop_slave.inc
+include/stop_slave_io.inc
SET sql_slave_skip_counter=1;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result b/mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result
new file mode 100644
index 00000000..84080b94
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result
@@ -0,0 +1,78 @@
+include/rpl_init.inc [topology=1->2->3]
+*** Test GTID master switch in a topology with filtered events.
+*** With --gtid-ignore-duplicate and --gtid-strict-mode, should allow
+*** GTID connect at a GTID position that is filtered on the new master.
+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);
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (1,1);
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t3 VALUES (2,1);
+include/save_master_gtid.inc
+connection server_2;
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2);
+include/sync_with_master_gtid.inc
+include/save_master_gtid.inc
+connection server_3;
+include/sync_with_master_gtid.inc
+*** Promote 3 as new master, demote 2 as slave of 3.
+*** GTID position of 2 in domain 0 is filtered on 3.
+connection server_2;
+include/stop_slave.inc
+connection server_3;
+include/stop_slave.inc
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
+MASTER_USE_GTID=SLAVE_POS;
+connection server_2;
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3,
+MASTER_USE_GTID=SLAVE_POS;
+include/start_slave.inc
+connection server_3;
+include/start_slave.inc
+connection server_1;
+INSERT INTO t1 VALUES (3,1);
+INSERT INTO t3 VALUES (3,1);
+include/save_master_gtid.inc
+connection server_3;
+INSERT INTO t2 VALUES (2,2);
+include/sync_with_master_gtid.inc
+include/save_master_gtid.inc
+connection server_2;
+include/sync_with_master_gtid.inc
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 1
+3 1
+SELECT * FROM t3 ORDER BY a;
+ERROR 42S02: Table 'test.t3' doesn't exist
+SELECT * FROM t2 ORDER BY a;
+a b
+1 2
+2 2
+*** Restore original topology.
+connection server_3;
+include/stop_slave.inc
+connection server_2;
+include/stop_slave.inc
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
+MASTER_USE_GTID=SLAVE_POS;
+include/start_slave.inc
+connection server_3;
+CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
+MASTER_USE_GTID=SLAVE_POS;
+include/start_slave.inc
+connection server_1;
+DROP TABLE t1;
+DROP TABLE t3;
+include/save_master_gtid.inc
+connection server_2;
+DROP TABLE t2;
+include/sync_with_master_gtid.inc
+include/save_master_gtid.inc
+connection server_3;
+include/sync_with_master_gtid.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
index e38eddcc..f271e730 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
@@ -36,7 +36,7 @@ CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=SLAVE_POS;
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1236]
-include/stop_slave.inc
+include/stop_slave_sql.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4, MASTER_USE_GTID=NO;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
index 88e02141..a9bd16cc 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -228,7 +228,7 @@ call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on q
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;
Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
-include/stop_slave.inc
+include/stop_slave_io.inc
set sql_log_bin= 0;
DROP TABLE t1;
set sql_log_bin= 1;
diff --git a/mysql-test/suite/rpl/r/rpl_invoked_features.result b/mysql-test/suite/rpl/r/rpl_invoked_features.result
index 43a8e862..3cfd40d5 100644
--- a/mysql-test/suite/rpl/r/rpl_invoked_features.result
+++ b/mysql-test/suite/rpl/r/rpl_invoked_features.result
@@ -45,14 +45,14 @@ BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
-CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
-CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
index 68e8b22d..fddb07c9 100644
--- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
+++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
@@ -6,6 +6,11 @@ connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=NO;
include/start_slave.inc
+connection master;
+# Ensure only the new binlog dump thread is alive (wait for the old one
+# to complete its kill)
+# And that it has already sent its fake rotate
+connection slave;
include/stop_slave.inc
# Test slave with no capability gets dummy event, which is ignored.
set @old_dbug= @@global.debug_dbug;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev_17614.result b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
index 0cc92474..7e2e8727 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev_17614.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
@@ -29,8 +29,7 @@ SELECT * FROM t1;
a b c
1 1 1
2 2 3
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
connection master;
reset master;
@@ -189,8 +188,7 @@ SELECT * FROM t1;
a b c
1 1 1
2 2 3
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
index e94e097f..dbaceb65 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
@@ -197,7 +197,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
index ce11b814..57654d15 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
@@ -36,7 +36,8 @@ connection server_2;
connection con_temp2;
COMMIT;
connection server_2;
-include/stop_slave.inc
+include/wait_for_slave_sql_error.inc [errno=1062]
+include/stop_slave_io.inc
include/assert.inc [table t1 should have zero rows where a>32]
SELECT * FROM t1 WHERE a>32;
a
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_kill.result b/mysql-test/suite/rpl/r/rpl_parallel_kill.result
index 7e6b0657..8772ac99 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_kill.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_kill.result
@@ -30,7 +30,7 @@ kill $t3_tid;
connection slave1;
commit;
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
@@ -78,7 +78,7 @@ include/wait_for_slave_param.inc [Last_Errno]
connection slave1;
commit;
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
@@ -127,7 +127,7 @@ include/wait_for_slave_param.inc [Last_Errno]
connection slave1;
commit;
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
update t1 set a=1 where a=2;
set @@global.slave_parallel_threads = @save.slave_parallel_threads;
set @@global.slave_parallel_mode = @save.slave_parallel_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result b/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result
index e9d04c02..c9094c8b 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_missed_error_handling.result
@@ -38,7 +38,6 @@ connection con2;
SET debug_sync='RESET';
connection server_2;
include/wait_for_slave_sql_error.inc [errno=1062]
-include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
a b
110 1
diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
index 694a6132..0c51e58f 100644
--- a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
@@ -21,22 +21,22 @@ master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
-master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
-master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
-master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
-master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
+master-bin.000001 # Table_map 1 # table_id: 4294967298 (test.t)
+master-bin.000001 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
connection slave;
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
index a8e569aa..e1000835 100644
--- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
@@ -191,7 +191,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_corruption.result b/mysql-test/suite/rpl/r/rpl_row_corruption.result
index 24535460..1950617a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_row_corruption.result
@@ -14,7 +14,7 @@ connection master;
UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1593 ]
-include/stop_slave.inc
+include/stop_slave_io.inc
SET @@global.debug_dbug=@saved_debug;
include/start_slave.inc
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_idempotency.result b/mysql-test/suite/rpl/r/rpl_row_idempotency.result
index c655ae67..061cc836 100644
--- a/mysql-test/suite/rpl/r/rpl_row_idempotency.result
+++ b/mysql-test/suite/rpl/r/rpl_row_idempotency.result
@@ -89,7 +89,7 @@ b
3
*** slave must stop (Trying to delete a referenced foreing key)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1451]
Last_SQL_Error
1451
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
@@ -114,7 +114,7 @@ connection master;
insert into ti2 set a=3, b=3 /* offending write event */;
*** slave must stop (Trying to insert an invalid foreign key)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1452]
Last_SQL_Error
1452
select * from ti2 order by b /* must be (2,2) */;
@@ -139,9 +139,9 @@ a b
insert into ti1 set b=1;
connection master;
insert into ti1 set b=1 /* offending write event */;
-*** slave must stop (Trying to insert a dupliacte key)
+*** slave must stop (Trying to insert a duplicate key)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1062]
Last_SQL_Error
1062
set foreign_key_checks= 0;
@@ -164,7 +164,7 @@ connection master;
DELETE FROM t1 WHERE a = -2;
*** slave must stop (Key was not found)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
@@ -176,7 +176,7 @@ connection master;
DELETE FROM t2 WHERE a = -2;
*** slave must stop (Key was not found)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
@@ -190,7 +190,7 @@ connection master;
UPDATE t1 SET a = 1 WHERE a = -1;
*** slave must stop (Key was not found)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
@@ -202,7 +202,7 @@ connection master;
UPDATE t2 SET a = 1 WHERE a = -1;
*** slave must stop (Key was not found)
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1032]
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index 8ef10bf4..b4e3704c 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -51,7 +51,9 @@ ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UN
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
-include/stop_slave.inc
+include/wait_for_slave_io_to_start.inc
+include/wait_for_slave_sql_to_stop.inc
+include/stop_slave_io.inc
include/reset_slave.inc
include/start_slave.inc
include/rpl_reset.inc
diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
index 9c7a257c..c208ee2e 100644
--- a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
+++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
@@ -6,7 +6,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
include/start_slave.inc
include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
-SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
+SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
+SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
include/start_slave.inc
# Future events must be logged at least 2 seconds after
# the slave starts
@@ -18,11 +19,6 @@ insert into t1 values (1);
# event in its relay log
flush logs;
connection slave;
-# Ignore FDEs that happen before the CREATE/INSERT commands
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
# On the next FDE, the slave should have the master CREATE/INSERT events
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
select count(*)=1 from t1;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index edd5e774..03e3443b 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -7,7 +7,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
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;
@@ -28,7 +27,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -163,11 +162,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -317,6 +320,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -359,6 +364,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
index 7341eb54..a79b372f 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
@@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
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;
@@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -164,11 +163,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
index d75a3a2c..393c9c55 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
@@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
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;
@@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here
#
connection master;
-set global rpl_semi_sync_master_timeout= 60000;
+set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -164,11 +163,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply.
#
+connection master;
+show status like "Rpl_semi_sync_master_status";
+Variable_name Value
+Rpl_semi_sync_master_status ON
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
@@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
+connection slave;
+connection master;
create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1);
insert into t1 values (2), (3);
@@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
+connection slave;
+connection master;
[ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_event.result b/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
index 917e7c2b..b1eb623c 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
@@ -7,7 +7,6 @@ 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;
-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");
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result
index 24daf0d7..34af8d31 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_event_after_sync.result
@@ -8,7 +8,6 @@ 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;
-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");
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result
index 8956eee2..1c94c239 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result
@@ -5,6 +5,7 @@ include/stop_slave.inc
connection server_1;
RESET MASTER;
SET @@global.max_binlog_size= 4096;
+set @@global.rpl_semi_sync_master_enabled = 1;
connection server_2;
RESET MASTER;
SET @@global.max_binlog_size= 4096;
@@ -14,7 +15,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
include/start_slave.inc
connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
-set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
INSERT INTO t1 VALUES (1, 'dummy1');
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
index 786e1682..6124ba01 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
@@ -14,14 +14,12 @@ connection master;
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
connection slave;
-include/stop_slave.inc
+include/wait_for_slave_io_error.inc [errno=2003]
# Restart master
include/rpl_start_server.inc [server_number=1]
connection slave;
-include/stop_slave.inc
-Warnings:
-Note 1255 Slave already has been stopped
-include/start_slave.inc
+include/wait_for_slave_sql_to_start.inc
+include/wait_for_slave_io_to_start.inc
connection master;
SET @@GLOBAL.debug_dbug="";
SET @@GLOBAL. rpl_semi_sync_master_enabled = 0;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result b/mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result
new file mode 100644
index 00000000..19fed30f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result
@@ -0,0 +1,48 @@
+include/rpl_init.inc [topology=1->2,1->3]
+connection server_1;
+set @old_enabled= @@global.rpl_semi_sync_master_enabled;
+set @old_timeout= @@global.rpl_semi_sync_master_timeout;
+set global rpl_semi_sync_master_enabled= 1;
+set global rpl_semi_sync_master_timeout= 500;
+connection server_2;
+include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set @old_dbug= @@global.debug_dbug;
+set global rpl_semi_sync_slave_enabled= 1;
+set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
+include/start_slave.inc
+connection server_3;
+include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set global rpl_semi_sync_slave_enabled= 1;
+include/start_slave.inc
+# Ensure primary recognizes both replicas are semi-sync
+connection server_1;
+connection server_1;
+create table t1 (a int);
+connection server_2;
+# Verifying server_2 did not send ACK
+connection server_3;
+# Verifying server_3 did send ACK
+connection server_1;
+# Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
+# Verifying rpl_semi_sync_master_yes_tx incremented
+#
+# Cleanup
+connection server_2;
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+set global debug_dbug= @old_dbug;
+include/stop_slave.inc
+connection server_3;
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+include/stop_slave.inc
+connection server_1;
+set global rpl_semi_sync_master_enabled= @old_enabled;
+set global rpl_semi_sync_master_timeout= @old_timeout;
+drop table t1;
+connection server_2;
+include/start_slave.inc
+connection server_3;
+include/start_slave.inc
+include/rpl_end.inc
+# End of rpl_semi_sync_no_missed_ack_after_add_slave.test
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result
new file mode 100644
index 00000000..99c31249
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result
@@ -0,0 +1,35 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Replication event checksum verification failed");
+call mtr.add_suppression("could not queue event from master");
+#
+# Set up a semisync connection
+connection master;
+set @@global.rpl_semi_sync_master_enabled= ON;
+connection slave;
+stop slave io_thread;
+set @@global.rpl_semi_sync_slave_enabled= ON;
+set @old_dbug= @@global.debug_dbug;
+set @@global.debug_dbug= "+d,corrupt_queue_event";
+set @@global.debug_dbug= "+d,pause_before_io_read_event";
+set @@global.debug_dbug= "+d,placeholder";
+start slave io_thread;
+# Disable semi-sync on the slave while the IO thread is active
+set debug_sync='now wait_for io_thread_at_read_event';
+set @@global.rpl_semi_sync_slave_enabled= OFF;
+set debug_sync='now signal io_thread_continue_read_event';
+# Waiting for the slave to stop with the error from corrupt_queue_event
+connection slave;
+include/wait_for_slave_io_error.inc [errno=1595,1743]
+# Sleep 1 to give time for Ack_receiver to receive COM_QUIT
+include/assert_grep.inc [Check that there is no 'Read semi-sync reply magic number error' in error log.]
+#
+# Cleanup
+connection slave;
+include/stop_slave.inc
+set @@global.debug_dbug= @old_dbug;
+include/start_slave.inc
+connection master;
+set @@global.rpl_semi_sync_master_enabled= default;
+include/rpl_end.inc
+# End of rpl_semi_sync_slave_enabled_consistent.test
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result
index f026a1c9..3c9cf71a 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_slave_reply_fail.result
@@ -4,6 +4,7 @@ connection slave;
include/stop_slave.inc
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog*");
+call mtr.add_suppression("Master server does not read semi-sync messages*");
set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
create table t1 (i int);
@@ -15,8 +16,8 @@ SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
include/start_slave.inc
connection master;
connection slave;
-"Assert that the net_fulsh() reply failed is present in slave error log.
-FOUND 1 /Semi-sync slave net_flush\(\) reply failed/ in mysqld.2.err
+"Assert that Master server does not read semi-sync messages" is present in slave error log.
+FOUND 1 /Master server does not read semi-sync messages/ in mysqld.2.err
"Assert that Slave IO thread is up and running."
SHOW STATUS LIKE 'Slave_running';
Variable_name Value
@@ -32,7 +33,7 @@ connection slave;
include/diff_tables.inc [master:t1, slave:t1]
connection master;
set statement sql_log_bin=0 for call mtr.add_suppression("Read semi-sync reply magic number error");
-SET @save_debug_master= @@global.debug;
+SET @save_debug_master= @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,semisync_corrupt_magic";
insert into t1 values (11);
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result b/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
index 36a2bac5..d7f87ae5 100644
--- a/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
+++ b/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
@@ -14,7 +14,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
CALL mtr.add_suppression("Semi-sync master failed on*");
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
CALL mtr.add_suppression("on master failed*");
-CALL mtr.add_suppression("Master server does not support semi-sync*");
CALL mtr.add_suppression("Semi-sync slave net_flush*");
CALL mtr.add_suppression("Failed to flush master info*");
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
@@ -196,7 +195,7 @@ Variable_name Value
Rpl_semi_sync_master_clients 0
show status like 'Rpl_semi_sync_master_status';
Variable_name Value
-Rpl_semi_sync_master_status OFF
+Rpl_semi_sync_master_status ON
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
@@ -270,16 +269,12 @@ Variable_name Value
Rpl_semi_sync_master_clients 1
# Test failure of select error .
SET GLOBAL debug = 'd,rpl_semisync_simulate_select_error';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
INSERT INTO t1 VALUES(3);
connection slave;
connection con1;
# Test failure of pthread_create
SET GLOBAL rpl_semi_sync_master_enabled = 0;
SET GLOBAL debug = 'd,rpl_semisync_simulate_create_thread_failure';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL rpl_semi_sync_master_enabled= ON;
# Test failure of pthread_join
SET GLOBAL rpl_semi_sync_master_enabled= OFF;
@@ -287,8 +282,6 @@ SET GLOBAL rpl_semi_sync_master_enabled= OFF;
# Failure on registering semisync slave
#
SET GLOBAL debug= 'd,rpl_semisync_simulate_add_slave_failure';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL rpl_semi_sync_master_enabled= ON;
connection slave;
STOP SLAVE IO_THREAD;
@@ -297,8 +290,6 @@ START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
connection con1;
SET GLOBAL debug='';
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
diff --git a/mysql-test/suite/rpl/r/rpl_session_var.result b/mysql-test/suite/rpl/r/rpl_session_var.result
index 67863583..f9794df3 100644
--- a/mysql-test/suite/rpl/r/rpl_session_var.result
+++ b/mysql-test/suite/rpl/r/rpl_session_var.result
@@ -1,5 +1,16 @@
include/master-slave.inc
[connection master]
+select @@rpl_semi_sync_master_enabled;
+@@rpl_semi_sync_master_enabled
+0
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+@@rpl_semi_sync_slave_enabled
+0
+show status like "rpl_semi_sync_slave_status";
+Variable_name Value
+Rpl_semi_sync_slave_status OFF
+connection master;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
diff --git a/mysql-test/suite/rpl/r/rpl_session_var2.result b/mysql-test/suite/rpl/r/rpl_session_var2.result
new file mode 100644
index 00000000..645eca02
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_session_var2.result
@@ -0,0 +1,69 @@
+include/master-slave.inc
+[connection master]
+select @@rpl_semi_sync_master_enabled;
+@@rpl_semi_sync_master_enabled
+1
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+@@rpl_semi_sync_slave_enabled
+1
+show status like "rpl_semi_sync_slave_status";
+Variable_name Value
+Rpl_semi_sync_slave_status ON
+connection master;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+create table t1(a varchar(100),b int);
+set @@session.sql_mode=pipes_as_concat;
+insert into t1 values('My'||'SQL', 1);
+set @@session.sql_mode=default;
+insert into t1 values('1'||'2', 2);
+select * from t1 where b<3 order by a;
+a b
+1 2
+MySQL 1
+connection slave;
+select * from t1 where b<3 order by a;
+a b
+1 2
+MySQL 1
+connection master;
+set @@session.sql_mode=ignore_space;
+insert into t1 values(password ('MySQL'), 3);
+set @@session.sql_mode=ansi_quotes;
+create table "t2" ("a" int);
+drop table t1, t2;
+set @@session.sql_mode=default;
+create table t1(a int auto_increment primary key);
+create table t2(b int, a int);
+set @@session.sql_auto_is_null=1;
+insert into t1 values(null);
+insert into t2 select 1,a from t1 where a is null;
+set @@session.sql_auto_is_null=0;
+insert into t1 values(null);
+insert into t2 select 2,a from t1 where a is null;
+select * from t2 order by b;
+b a
+1 1
+connection slave;
+select * from t2 order by b;
+b a
+1 1
+connection master;
+drop table t1,t2;
+connection slave;
+connection master;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`data` varchar(100),
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+INSERT INTO t1(data) VALUES(SESSION_USER());
+connection slave;
+SELECT length(data) < 100 FROM t1;
+length(data) < 100
+1
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result b/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result
index 828e1715..46f5a7c9 100644
--- a/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result
+++ b/mysql-test/suite/rpl/r/rpl_set_statement_default_master.result
@@ -14,6 +14,7 @@ RESET SLAVE ALL;
CHANGE MASTER 'm1' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_USER='root';
SET STATEMENT default_master_connection = 'm1' FOR START SLAVE;
set default_master_connection = 'm1';
+include/wait_for_slave_to_start.inc
stop slave;
include/wait_for_slave_to_stop.inc
reset slave all;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result
index 249f3514..e9a96fc4 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result
@@ -4,6 +4,7 @@ connection slave;
START SLAVE;
call mtr.add_suppression("Slave SQL.*Unable to use slave.s temporary directory");
include/wait_for_slave_sql_error.inc [errno=12]
+include/wait_for_slave_io_to_start.inc
include/stop_slave_io.inc
RESET SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result
index 1c81cec2..ef122b9c 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_status.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result
@@ -36,7 +36,6 @@ connection slave;
include/stop_slave.inc
START SLAVE;
include/wait_for_slave_sql_to_start.inc
-include/wait_for_slave_io_to_stop.inc
==== Verify that Slave IO thread stopped with error ====
include/wait_for_slave_io_error.inc [errno=1045]
==== Cleanup (Note that slave IO thread is not running) ====
diff --git a/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result b/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result
index b14f7b01..a3e98afa 100644
--- a/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result
+++ b/mysql-test/suite/rpl/r/rpl_sql_thd_start_errno_cleared.result
@@ -34,6 +34,7 @@ set debug_sync= "now wait_for sql_thread_run_lock_released";
# Validating that Last_SQL_Errno is cleared..
# ..success
set debug_sync= "now signal sql_thread_continue";
+# Wait for debug_sync signal to have been received before issuing RESET
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
# Cleanup
diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result
index 1d55fe12..0cb21716 100644
--- a/mysql-test/suite/rpl/r/rpl_ssl1.result
+++ b/mysql-test/suite/rpl/r/rpl_ssl1.result
@@ -14,8 +14,8 @@ insert into t1 values (1);
connection slave;
select * from t1;
t
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
change master to 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;
include/wait_for_slave_to_start.inc
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_1.result
index 9edb2321..de7c0875 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_1.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_1.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_2.result b/mysql-test/suite/rpl/r/rpl_start_alter_2.result
index a862fc55..49af973f 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_2.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_2.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_3.result b/mysql-test/suite/rpl/r/rpl_start_alter_3.result
index 97754401..31d0023b 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_3.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_3.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_4.result b/mysql-test/suite/rpl/r/rpl_start_alter_4.result
index 9d7d6376..819bcda0 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_4.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_4.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_5.result b/mysql-test/suite/rpl/r/rpl_start_alter_5.result
index 4e592c19..ef19cd8f 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_5.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_5.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_6.result b/mysql-test/suite/rpl/r/rpl_start_alter_6.result
index 6c26d511..59a83631 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_6.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_6.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection master;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_7.result b/mysql-test/suite/rpl/r/rpl_start_alter_7.result
index cfe31497..df7664d4 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_7.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_7.result
@@ -10,6 +10,10 @@ Warnings:
Note 1255 Slave already has been stopped
set global binlog_alter_two_phase=true;
connection server_3;
+SET STATEMENT sql_log_bin=0 FOR
+CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET GLOBAL slave_parallel_threads=8;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_8.result b/mysql-test/suite/rpl/r/rpl_start_alter_8.result
index 8002f295..406f2d1f 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_8.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_8.result
@@ -10,6 +10,10 @@ Warnings:
Note 1255 Slave already has been stopped
set global binlog_alter_two_phase=true;
connection server_3;
+SET STATEMENT sql_log_bin=0 FOR
+CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET GLOBAL slave_parallel_threads=20;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
index bf9d9be0..b11804ed 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
@@ -4,6 +4,8 @@ connection master;
set global binlog_alter_two_phase=true;
connection slave;
include/stop_slave.inc
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global gtid_strict_mode=1;
# Legacy Master Slave
connect master_node,127.0.0.1,root,,$db_name, $M_port;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result
index 2c1ae667..55bec7d3 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_2.result
@@ -49,6 +49,10 @@ connection server_2;
SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase;
SET GLOBAL binlog_alter_two_phase = ON;
connection server_3;
+SET STATEMENT sql_log_bin=0 FOR
+CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET @save_gtid_strict_mode= @@GLOBAL.gtid_strict_mode;
SET @slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET @slave_parallel_mode= @@GLOBAL.slave_parallel_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result
index 0a1c1f79..76f9cbcd 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_restart_slave.result
@@ -79,7 +79,9 @@ domain_id seq_no
0 5
include/start_slave.inc
connection master;
+include/save_master_gtid.inc
connection slave;
+include/sync_with_master_gtid.inc
# Everything from the master binlog must have been applied now:
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
domain_id seq_no
diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
index e94e097f..dbaceb65 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
@@ -197,7 +197,7 @@ SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
-include/stop_slave.inc
+include/stop_slave_io.inc
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
index 40910b8c..9575ea89 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
@@ -109,7 +109,7 @@ START SLAVE;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
-include/stop_slave.inc
+include/stop_slave_sql.inc
RESET SLAVE;
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
index 0afe1992..86c90ff3 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
@@ -43,7 +43,7 @@ Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
commit;
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1593]
SELECT "Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
Last_SQL_Error true
Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
@@ -63,7 +63,7 @@ set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log
connection master;
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
connection slave;
-include/wait_for_slave_sql_to_stop.inc
+include/wait_for_slave_sql_error.inc [errno=1593]
SELECT "Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
Last_SQL_Error true
Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1
diff --git a/mysql-test/suite/rpl/r/rpl_using_gtid_default.result b/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
index e077bcd9..3bdc9d47 100644
--- a/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
+++ b/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
@@ -117,7 +117,10 @@ include/start_slave.inc
# not master_use_gtid=no should warn the user that Using_Gtid is being
# changed to No.
#
+connection master;
+include/save_master_pos.inc
connection slave;
+include/sync_io_with_master.inc
include/stop_slave.inc
CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file';
Warnings:
diff --git a/mysql-test/suite/rpl/r/semisync_future-7591.result b/mysql-test/suite/rpl/r/semisync_future-7591.result
index 80414ac1..8287b8fe 100644
--- a/mysql-test/suite/rpl/r/semisync_future-7591.result
+++ b/mysql-test/suite/rpl/r/semisync_future-7591.result
@@ -13,7 +13,7 @@ connection master;
insert into t1 values (1);
reset master;
connection slave;
-include/stop_slave.inc
+include/stop_slave_sql.inc
include/reset_slave.inc
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
diff --git a/mysql-test/suite/rpl/t/create_or_replace.inc b/mysql-test/suite/rpl/t/create_or_replace.inc
index df46cc36..e8fa95cb 100644
--- a/mysql-test/suite/rpl/t/create_or_replace.inc
+++ b/mysql-test/suite/rpl/t/create_or_replace.inc
@@ -213,12 +213,19 @@ set @@session.binlog_format=default;
drop temporary table if exists t9;
--connect(con1,localhost,root,,)
+--let $conid = `SELECT CONNECTION_ID()`
set session binlog_format=default;
create temporary table t9 (i int);
--echo *** Must be no DROP logged for t9 when there was no CREATE, at disconnect too ***
--disconnect con1
--connection server_1
+# The disconnect runs asynchroneously. Wait for it to complete, otherwise the
+# DROP TEMPORARY TABLE may not have been binlogged yet when SHOW BINLOG EVENTS
+# is run.
+--let $wait_condition= SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID=$conid
+--source include/wait_condition.inc
+
--source include/show_binlog_events.inc
# Clean up
diff --git a/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test b/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test
index 1297fcda..aa777d40 100644
--- a/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test
+++ b/mysql-test/suite/rpl/t/mdev-31448_kill_ooo_finish_optimistic.test
@@ -54,7 +54,8 @@ drop table t2;
--source include/start_slave.inc
--echo # wait for T1
---let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(-1)%' and command LIKE 'Slave_worker';
+# Wildcard for `state` as it depends on whether WSREP is compiled in or not.
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
--source include/wait_condition.inc
--echo # wait for T2
@@ -81,7 +82,9 @@ DROP TABLE t1;
--connection slave
--echo #
--echo # Cleanup
---source include/stop_slave.inc
+--let $rpl_allow_error= 1
+--source include/wait_for_slave_sql_to_stop.inc
+--source include/stop_slave_io.inc
eval set @@global.slave_parallel_threads= $save_slave_parallel_threads;
eval set @@global.slave_parallel_mode= $save_slave_parallel_mode;
eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout;
diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa.inc b/mysql-test/suite/rpl/t/parallel_backup_xa.inc
index 2d831199..83a6fb79 100644
--- a/mysql-test/suite/rpl/t/parallel_backup_xa.inc
+++ b/mysql-test/suite/rpl/t/parallel_backup_xa.inc
@@ -59,6 +59,7 @@ XA RECOVER;
{
--let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"
--source include/wait_condition.inc
+ --let $rpl_allow_error=1
}
ROLLBACK;
--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for backup lock"
@@ -71,6 +72,7 @@ if (!$slave_ooo_error)
{
--source include/sync_with_master_gtid.inc
}
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
if ($slave_ooo_error)
{
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test
new file mode 100644
index 00000000..50a67532
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test
@@ -0,0 +1,47 @@
+--source include/have_binlog_format_statement.inc
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection master
+# Set minimal cache size so smaller transaction can trigger spill to disk.
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=MyISAM;
+
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,load_data_binlog_cache_error";
+--replace_regex /Error writing file '[^']+'/Error writing file '<FILENAME>'/
+--error 3
+LOAD DATA CONCURRENT LOCAL INFILE 'std_data/bug30435_5k.txt'
+ REPLACE INTO TABLE t1 (a);
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+# The actual number of rows left after the disk full error may change as
+# binlog event sizes are modified. So here we just test that we get partial
+# update from the last INSERT..SELECT that gets disk full error.
+SELECT IF(COUNT(*) > 0 AND COUNT(*) < 5000,
+ "ok",
+ CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+ AS check_result
+ FROM t1;
+
+--save_master_pos
+
+--connection slave
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+--sync_with_master
+SELECT COUNT(*) FROM t1;
+
+# Cleanup
+
+--connection master
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test
new file mode 100644
index 00000000..2c5813bb
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test
@@ -0,0 +1,61 @@
+--source include/have_binlog_format_row.inc
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection master
+# Set minimal cache size so smaller transaction can trigger spill to disk.
+SET @save_binlog_stmt_cache_size= @@GLOBAL.binlog_stmt_cache_size;
+SET GLOBAL binlog_stmt_cache_size= 4096;
+
+CALL mtr.add_suppression('"No space left on device".*An incident event is written to binary log');
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(255)) ENGINE=MyISAM;
+
+FLUSH STATUS;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+INSERT INTO t1 VALUES (0, CONCAT("?", "-", REPEAT("x", 200)));
+INSERT INTO t1 SELECT a+1, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+2, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+4, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+8, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+16, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+32, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+64, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+INSERT INTO t1 SELECT a+128, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+
+SET @old_dbug= @@SESSION.debug_dbug;
+SET SESSION debug_dbug="+d,simulate_disk_full_at_flush_pending";
+--replace_regex /Error writing file '[^']+'/Error writing file '<FILENAME>'/
+--error 3
+INSERT INTO t1 SELECT a+256, CONCAT(a, "-", REPEAT("x", 200)) FROM t1;
+SET SESSION debug_dbug= @old_dbug;
+SHOW STATUS LIKE "binlog_stmt_cache%";
+# The actual number of rows left after the disk full error may change as
+# binlog event sizes are modified. So here we just test that we get partial
+# update from the last INSERT..SELECT that gets disk full error.
+SELECT IF(COUNT(*) > 256 AND COUNT(*) < 512,
+ "ok",
+ CONCAT("ERROR! Row count ", COUNT(*), " not as expected for partially executed query"))
+ AS check_result
+ FROM t1;
+
+# A random extra event that helped show the bug that a partial event
+# group was binlogged.
+ALTER TABLE t1 COMMENT '<mumble>';
+
+--save_master_pos
+
+--connection slave
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+--sync_with_master
+SELECT COUNT(*) FROM t1;
+
+# Cleanup
+
+--connection master
+SET GLOBAL binlog_stmt_cache_size= @save_binlog_stmt_cache_size;
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
index bba41295..02b31c06 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
@@ -59,7 +59,7 @@ if(!$log_error_)
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
--connection slave
--source include/stop_slave.inc
@@ -71,7 +71,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
CREATE TABLE t (f INT) ENGINE=INNODB;
INSERT INTO t VALUES(10);
save_master_pos;
@@ -89,7 +89,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
SET @@SESSION.gtid_domain_id=10;
INSERT INTO t VALUES(20);
save_master_pos;
@@ -107,7 +107,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
---source include/search_pattern_in_file.inc
+--source include/wait_for_pattern_in_file.inc
--echo "===== Clean up ====="
--connection slave
diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test
index fc765744..bea325b2 100644
--- a/mysql-test/suite/rpl/t/rpl_checksum.test
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test
@@ -95,6 +95,9 @@ flush logs;
flush logs;
-- source include/wait_for_binlog_checkpoint.inc
flush logs;
+# The binlog position here is output in the error message from
+# wait_for_slave_io_error below, so make sure it's deterministic.
+-- source include/wait_for_binlog_checkpoint.inc
sync_slave_with_master;
#connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test
index 267fa621..e533c54b 100644
--- a/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_circular_semi_sync.test
@@ -7,6 +7,9 @@
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
+connection server_2;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+
# The following tests prove
# A.
# no out-of-order gtid error is done to the stict gtid mode semisync
@@ -66,10 +69,18 @@ evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, ma
--connection server_2
set @@global.gtid_strict_mode = true;
set @@global.rpl_semi_sync_master_enabled = 1;
+
+# The following command is likely to cause the slave master is not yet setup
+# for semi-sync
+
INSERT INTO t1(a) VALUES (2);
--source include/save_master_gtid.inc
--connection server_1
+# Update slave to notice that server_2 now has rpl_semi_sync_master_enabled
+--source include/stop_slave.inc
+--source include/start_slave.inc
+
--echo #
--echo # the successful sync is a required proof
--echo #
diff --git a/mysql-test/suite/rpl/t/rpl_connection.test b/mysql-test/suite/rpl/t/rpl_connection.test
index 31024006..24ada7c8 100644
--- a/mysql-test/suite/rpl/t/rpl_connection.test
+++ b/mysql-test/suite/rpl/t/rpl_connection.test
@@ -16,7 +16,7 @@ CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '';
START SLAVE;
--let $slave_io_errno= 1045, 1593
--source include/wait_for_slave_io_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
CHANGE MASTER TO MASTER_USER= 'root', MASTER_PASSWORD= '';
START SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test b/mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test
new file mode 100644
index 00000000..4c41011e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test
@@ -0,0 +1,121 @@
+#
+# Verify that SHOW SLAVE STATUS will not cause deadlocks on the replica.
+# A deadlock has been seen in do_gco_wait if the thread is killed, as it will
+# hold the LOCK_parallel_entry, and during error reporting, try to grab the
+# err_lock. Prior to MDEV-10653, SHOW SLAVE STATUS would grab these locks in
+# the reverse order, as calling workers_idle() used to grab LOCK_parallel_entry
+# with the err_lock already grabbed (though the MDEV-10653 patch changed the
+# workles_idle() implementation to remove the need for locking the
+# parallel_entry).
+#
+# References:
+# MDEV-10653: SHOW SLAVE STATUS Can Deadlock an Errored Slave
+#
+
+--source include/master-slave.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # Initialize test data
+--connection master
+create table t1 (a int) engine=innodb;
+insert into t1 values (1);
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+
+call mtr.add_suppression("Connection was killed");
+call mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
+
+set @save_parallel_threads= @@global.slave_parallel_threads;
+set @save_parallel_mode= @@global.slave_parallel_mode;
+set @save_transaction_retries= @@global.slave_transaction_retries;
+set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+
+set @@global.slave_parallel_threads= 2;
+set @@global.slave_parallel_mode= CONSERVATIVE;
+set @@global.slave_transaction_retries= 0;
+set @@global.innodb_lock_wait_timeout= 10;
+
+--echo # Grabbing lock on innodb row to force future replication transaction to wait (and eventually timeout)
+BEGIN;
+select * from t1 where a=1 for update;
+
+--connection master
+
+set @old_dbug= @@session.debug_dbug;
+set @@session.debug_dbug="+d,binlog_force_commit_id";
+
+
+# GCO 1
+SET @commit_id= 10000;
+# T1
+update t1 set a=2 where a=1;
+
+# GCO 2
+SET @commit_id= 10001;
+# T2
+insert into t1 values (3);
+
+set @@session.debug_dbug= @old_dbug;
+
+--connection slave
+start slave;
+
+--echo # Waiting for first transaction to start (and be held at innodb row lock)..
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%)%' and command LIKE 'Slave_worker';
+--source include/wait_condition.inc
+
+--echo # Waiting for next transaction to start and hold at do_gco_wait()..
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to start commit%' and command LIKE 'Slave_worker';
+--source include/wait_condition.inc
+
+--connection slave1
+set @@session.debug_dbug="+d,hold_sss_with_err_lock";
+--send show slave status
+
+--connection slave
+set debug_sync="now wait_for sss_got_err_lock";
+
+--let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to start commit%'`
+--replace_result $t2_tid "<TID of worker in do_gco_wait>"
+--eval kill $t2_tid
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE command LIKE 'Killed';
+--source include/wait_condition.inc
+
+set debug_sync="now signal sss_continue";
+
+--connection slave1
+--echo # Waiting for SHOW SLAVE STATUS to complete..
+--disable_result_log
+--reap
+--enable_result_log
+--echo # ..done
+
+--connection slave
+ROLLBACK;
+--let $slave_sql_errno= 1927
+--source include/wait_for_slave_sql_error.inc
+
+
+--echo #
+--echo # Cleanup
+--connection master
+drop table t1;
+--source include/save_master_gtid.inc
+
+--connection slave
+set debug_sync= "RESET";
+set @@global.slave_parallel_threads= @save_parallel_threads;
+set @@global.slave_parallel_mode= @save_parallel_mode;
+set @@global.slave_transaction_retries= @save_transaction_retries;
+set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
+start slave sql_thread;
+--source include/sync_with_master_gtid.inc
+
+--source include/rpl_end.inc
+--echo # End of rpl_deadlock_show_slave_status.test
diff --git a/mysql-test/suite/rpl/t/rpl_delayed_slave.test b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
index d00e796b..32d0b030 100644
--- a/mysql-test/suite/rpl/t/rpl_delayed_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
@@ -192,6 +192,12 @@ eval CHANGE MASTER TO MASTER_DELAY = $time2;
--enable_query_log
--source include/start_slave.inc
+# Ensure that slave has started properly
+--connection master
+INSERT INTO t1 VALUES ('Syncing slave', 5);
+--save_master_pos
+--sync_slave_with_master
+
--connection master
INSERT INTO t1 VALUES (delay_on_slave(1), 6);
--save_master_pos
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
index a949da0c..95fac6c2 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
@@ -149,8 +149,7 @@ connection slave;
SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
-
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
@@ -218,7 +217,7 @@ SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
@@ -286,7 +285,7 @@ SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
@@ -354,7 +353,7 @@ SELECT * FROM t1;
SET @@global.debug_dbug=@saved_dbug;
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
--echo DO_DOMAIN_IDS (BEFORE) : $do_domain_ids_before
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
index 6dafab19..cdfdc098 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
@@ -67,8 +67,26 @@ connection master;
save_master_pos;
--connection slave
---source include/stop_slave.inc
+
+# Left to its own devices, the IO thread may or may not stop in error,
+# depending on what it is doing when its connection to the primary is killed
+# (e.g. a failed read results in an error, whereas if the IO thread is idly
+# waiting for events when the connection dies, it will enter into a reconnect
+# loop and reconnect). So we manually stop/start the IO thread to ensure it is
+# in a consistent state
+#
+# FIXME: We shouldn't need to stop/start the SQL thread here, but due to
+# MDEV-33268, we have to. So after fixing 33268, this should only stop/start
+# the IO thread. Note the SQL thread must be stopped first due to an invalid
+# DBUG_ASSERT in the IO thread's stop logic that depends on the state of the
+# SQL thread (also reported and to be fixed in the same ticket).
+#
+--source include/stop_slave_sql.inc
+--let rpl_allow_error=1
+--source include/stop_slave_io.inc
+--let rpl_allow_error=
--source include/start_slave.inc
+
sync_with_master;
select * from ti;
select * from tm;
diff --git a/mysql-test/suite/rpl/t/rpl_fail_register.test b/mysql-test/suite/rpl/t/rpl_fail_register.test
index d95a5c5f..5f86a33c 100644
--- a/mysql-test/suite/rpl/t/rpl_fail_register.test
+++ b/mysql-test/suite/rpl/t/rpl_fail_register.test
@@ -3,7 +3,7 @@ source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
connection slave;
-
+CALL mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: Debug Induced Error");
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='d,fail_com_register_slave';
@@ -11,8 +11,11 @@ stop slave;
reset slave;
source include/wait_for_slave_to_stop.inc;
start slave;
-stop slave;
-source include/wait_for_slave_to_stop.inc;
+# Debug point will raise IO thread error ER_SLAVE_MASTER_COM_FAILURE
+# so we will wait for that and manually stop the SQL thread
+--let $slave_io_errno= 1597
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
set global debug_dbug=@old_dbug;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_gis_user_var.test b/mysql-test/suite/rpl/t/rpl_gis_user_var.test
new file mode 100644
index 00000000..8edd8cb9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gis_user_var.test
@@ -0,0 +1,18 @@
+--source include/have_geometry.inc
+--source include/master-slave.inc
+
+--echo #
+--echo #
+--echo #
+
+connection master;
+SET @p=POINT(1,1);
+CREATE TABLE t1 AS SELECT @p AS p;
+sync_slave_with_master;
+SHOW CREATE TABLE t1;
+SELECT ST_AsWKT(p) FROM t1;
+connection master;
+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 70bd0087..a7af234d 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test
@@ -162,6 +162,13 @@ 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);
+# MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
+SET sql_log_bin= 0;
+CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
+SELECT BINLOG_GTID_POS(@binlog_file, 4);
+DROP TABLE t1;
+SET sql_log_bin= 1;
+
--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
--connection server_2
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
index 412489b3..c9c4d650 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
@@ -20,7 +20,7 @@ INSERT INTO t1 VALUES (1);
CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
--let $slave_sql_errno=1944
--source include/wait_for_slave_sql_error.inc
-
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test b/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test
index ea321062..0ee54cd1 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test
@@ -31,8 +31,8 @@ SET sql_log_bin=1;
START SLAVE;
--let $slave_sql_errno=1062
--source include/wait_for_slave_sql_error.inc
-
---source include/stop_slave.inc
+--source include/wait_for_slave_io_to_start.inc
+--source include/stop_slave_io.inc
# Skip the problem event from the master.
SET GLOBAL gtid_slave_pos= "0-1-100";
--source include/start_slave.inc
@@ -51,7 +51,7 @@ SET debug_dbug= @dbug_save;
--connection slave
--let $slave_sql_errno=1590
--source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_io.inc
SET sql_slave_skip_counter=1;
--source include/start_slave.inc
--sync_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf
new file mode 100644
index 00000000..a57dbbf3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf
@@ -0,0 +1,28 @@
+!include ../my.cnf
+
+[mysqld.1]
+log-slave-updates
+loose-innodb
+gtid-domain-id=1
+gtid-strict-mode=0
+gtid-ignore-duplicates=1
+
+[mysqld.2]
+log-slave-updates
+loose-innodb
+gtid-domain-id=0
+replicate-ignore-table=test.t3
+gtid-strict-mode=0
+gtid-ignore-duplicates=1
+
+[mysqld.3]
+log-slave-updates
+loose-innodb
+gtid-domain-id=0
+replicate-ignore-table=test.t3
+gtid-strict-mode=0
+gtid-ignore-duplicates=1
+
+[ENV]
+SERVER_MYPORT_3= @mysqld.3.port
+SERVER_MYSOCK_3= @mysqld.3.socket
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test
new file mode 100644
index 00000000..842bae82
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test
@@ -0,0 +1,109 @@
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed.inc
+
+--let $rpl_topology=1->2->3
+--source include/rpl_init.inc
+
+--echo *** Test GTID master switch in a topology with filtered events.
+--echo *** With --gtid-ignore-duplicate and --gtid-strict-mode, should allow
+--echo *** GTID connect at a GTID position that is filtered on the new master.
+
+--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);
+CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (1,1);
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t3 VALUES (2,1);
+--source include/save_master_gtid.inc
+
+--connection server_2
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2);
+
+--let $slave_timeout= 10
+--source include/sync_with_master_gtid.inc
+--source include/save_master_gtid.inc
+
+--connection server_3
+--source include/sync_with_master_gtid.inc
+
+--echo *** Promote 3 as new master, demote 2 as slave of 3.
+--echo *** GTID position of 2 in domain 0 is filtered on 3.
+
+--connection server_2
+--source include/stop_slave.inc
+
+--connection server_3
+--source include/stop_slave.inc
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1,
+ MASTER_USE_GTID=SLAVE_POS;
+
+--connection server_2
+--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3,
+ MASTER_USE_GTID=SLAVE_POS;
+--source include/start_slave.inc
+
+--connection server_3
+--source include/start_slave.inc
+
+--connection server_1
+INSERT INTO t1 VALUES (3,1);
+INSERT INTO t3 VALUES (3,1);
+--source include/save_master_gtid.inc
+
+--connection server_3
+INSERT INTO t2 VALUES (2,2);
+
+--source include/sync_with_master_gtid.inc
+--source include/save_master_gtid.inc
+
+--connection server_2
+--source include/sync_with_master_gtid.inc
+
+SELECT * FROM t1 ORDER BY a;
+# Verify that table t3 is being filtered.
+--error 1146
+SELECT * FROM t3 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+
+--echo *** Restore original topology.
+
+--connection server_3
+--source include/stop_slave.inc
+
+--connection server_2
+--source include/stop_slave.inc
+--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1,
+ MASTER_USE_GTID=SLAVE_POS;
+--source include/start_slave.inc
+
+--connection server_3
+--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2
+eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2,
+ MASTER_USE_GTID=SLAVE_POS;
+--source include/start_slave.inc
+
+
+# Cleanup
+
+--connection server_1
+DROP TABLE t1;
+DROP TABLE t3;
+--source include/save_master_gtid.inc
+
+--connection server_2
+DROP TABLE t2;
+--source include/sync_with_master_gtid.inc
+--source include/save_master_gtid.inc
+
+--connection server_3
+--source include/sync_with_master_gtid.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
index c7bcc1bb..d0885ab8 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
@@ -50,7 +50,7 @@ eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
START SLAVE;
--let $slave_io_errno= 1236
--source include/wait_for_slave_io_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
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 9760d4df..b5ff2949 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
@@ -210,7 +210,7 @@ SET sql_log_bin=0;
call mtr.add_suppression("Failed to load slave replication state from table");
call mtr.add_suppression("Unable to load replication GTID slave state");
SET sql_log_bin=1;
-
+--let rpl_allow_error= 1
--source include/start_slave.inc
--connection server_1
INSERT INTO t1 VALUES (9);
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
index d6d14e02..b6133625 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -331,7 +331,7 @@ sleep 4;
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
---source include/stop_slave.inc
+--source include/stop_slave_io.inc
set sql_log_bin= 0;
DROP TABLE t1;
set sql_log_bin= 1;
diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features.test b/mysql-test/suite/rpl/t/rpl_invoked_features.test
index 91391cf8..cd2b770c 100644
--- a/mysql-test/suite/rpl/t/rpl_invoked_features.test
+++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test
@@ -102,14 +102,17 @@ BEGIN
UPDATE t13 SET c = '';
END|
-# Create events which will run every 1 sec
-CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+# Create events which will run every 10 sec
+# It cannot be much shorter as we have to ensure that a new
+# event is not scheduled before the DISABLE has been
+# executed.
+CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
-CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
+CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
index d49851cc..7e313b37 100644
--- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
+++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
@@ -11,13 +11,25 @@ set @old_master_binlog_checksum= @@global.binlog_checksum;
# empty Gtid_list event
#
# Test this by binlog rotation before we log any GTIDs.
-connection slave;
+sync_slave_with_master;
# Need to stop/start the master without GTID before setting debug_dbug
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=NO;
--source include/start_slave.inc
+--connection master
+--echo # Ensure only the new binlog dump thread is alive (wait for the old one
+--echo # to complete its kill)
+--let $wait_condition= select count(*)=1 from information_schema.processlist where command='Binlog Dump'
+--source include/wait_condition.inc
+
+--echo # And that it has already sent its fake rotate
+--let $wait_condition= select count(*)=1 from information_schema.processlist where state LIKE '%Master has sent all binlog to slave%' and command='Binlog Dump'
+--source include/wait_condition.inc
+
+
+--connection slave
--source include/stop_slave.inc
--echo # Test slave with no capability gets dummy event, which is ignored.
set @old_dbug= @@global.debug_dbug;
@@ -26,6 +38,7 @@ SET @@global.debug_dbug='+d,simulate_slave_capability_none';
connection master;
FLUSH LOGS;
+--source include/wait_for_binlog_checkpoint.inc
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (0);
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_mdev_17614.test b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
index 8d91944a..e9a41c95 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev_17614.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
@@ -40,8 +40,7 @@ SELECT * FROM t1;
SELECT * FROM t1;
# restart replication for the next testcase
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--source include/stop_slave_io.inc
--source include/reset_slave.inc
connection master;
reset master;
@@ -159,8 +158,7 @@ SELECT * FROM t1;
SELECT * FROM t1;
# restart replication for the next testcase
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--source include/stop_slave_io.inc
--source include/reset_slave.inc
connection master;
reset master;
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 493385f1..83b89a69 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_ignored_errors.test
@@ -96,7 +96,9 @@ COMMIT;
# Clean up.
--connection server_2
---source include/stop_slave.inc
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
+--source include/stop_slave_io.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
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test
index 33b1bcb1..6ed9638d 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test
@@ -60,7 +60,6 @@ SET debug_sync='RESET';
--connection server_2
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
---source include/wait_for_slave_sql_to_stop.inc
# We should not see the row (112,3) here, it should be rolled back due to
# error signal from the prior transaction.
SELECT * FROM t3 WHERE a >= 110 ORDER BY a;
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
index 8b2affed..fe6f40d2 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
@@ -497,6 +497,7 @@ if (`SELECT count(*) = 1 FROM t1 WHERE a = 2`)
# Clean up
#
--connection server_2
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads;
SET @@GLOBAL.slave_parallel_mode=@old_parallel_mode;
diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
index 44df3ca4..794a0c63 100644
--- a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
+++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
@@ -209,6 +209,7 @@ drop table t;
reset master;
--connection slave
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
reset slave;
reset master;
diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test
index 857979d0..5ef28a62 100644
--- a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test
+++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_worker.test
@@ -227,6 +227,7 @@ select Last_Error_Message from performance_schema.replication_applier_status_by_
#let $assert_cond= "$sss_value" = "$ps_value_in_sss_format";
#source include/assert.inc;
+--let $rpl_only_running_threads= 1
--source include/stop_slave.inc
RESET SLAVE;
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test
index b06899bb..27710063 100644
--- a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test
+++ b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test
@@ -108,6 +108,7 @@ select * from my_table;
--source include/save_master_gtid.inc
connection slave;
+--let $rpl_only_running_threads=1
--source include/stop_slave.inc
--source include/reset_slave.inc
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_corruption.test b/mysql-test/suite/rpl/t/rpl_row_corruption.test
index d78df905..6f4f9c88 100644
--- a/mysql-test/suite/rpl/t/rpl_row_corruption.test
+++ b/mysql-test/suite/rpl/t/rpl_row_corruption.test
@@ -39,7 +39,7 @@ SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
# wait for error 1593 (ER_SLAVE_FATAL_ERROR)
--let $slave_sql_errno=1593
--source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
+--source include/stop_slave_io.inc
# clean up
SET @@global.debug_dbug=@saved_debug;
diff --git a/mysql-test/suite/rpl/t/rpl_row_idempotency.test b/mysql-test/suite/rpl/t/rpl_row_idempotency.test
index 85775832..326f94ec 100644
--- a/mysql-test/suite/rpl/t/rpl_row_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_row_idempotency.test
@@ -139,7 +139,9 @@ select * from ti1 order by b /* must be (2),(3) */;
--echo *** slave must stop (Trying to delete a referenced foreing key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_ROW_IS_REFERENCED_2 # Cannot add or update a child row: a foreign key constraint fails
+--let slave_sql_errno= 1451
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -173,7 +175,9 @@ insert into ti2 set a=3, b=3 /* offending write event */;
--echo *** slave must stop (Trying to insert an invalid foreign key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_NO_REFERENCED_ROW_2 # Cannot add or update a parent row: a foreign key constraint fails
+--let slave_sql_errno= 1452
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -210,9 +214,11 @@ insert into ti1 set b=1;
connection master;
insert into ti1 set b=1 /* offending write event */;
---echo *** slave must stop (Trying to insert a dupliacte key)
+--echo *** slave must stop (Trying to insert a duplicate key)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_DUP_ENTRY # Duplicate entry for key
+--let slave_sql_errno= 1062
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -247,7 +253,10 @@ DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
+
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -265,7 +274,9 @@ connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -287,7 +298,9 @@ UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -307,7 +320,9 @@ UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop (Key was not found)
connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# ER_KEY_NOT_FOUND # Can't find record
+--let slave_sql_errno= 1032
+source include/wait_for_slave_sql_error.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index d318e0d7..aa43831b 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -101,7 +101,12 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
--replace_result 740 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
---source include/stop_slave.inc
+# Explicit wait for slave thread start and then stop. Otherwise the STOP SLAVE
+# command can abort the slave connecting to the master, and an error state
+# left which makes stop_slave.inc throw an error.
+--source include/wait_for_slave_io_to_start.inc
+--source include/wait_for_slave_sql_to_stop.inc
+--source include/stop_slave_io.inc
--source include/reset_slave.inc
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
index 7c2e39dc..a80dedb7 100644
--- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
+++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
@@ -33,7 +33,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
--source include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
-SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
+SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
+SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
--source include/start_slave.inc
--let $sleep_time=2
@@ -52,12 +53,6 @@ insert into t1 values (1);
flush logs;
--connection slave
---echo # Ignore FDEs that happen before the CREATE/INSERT commands
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
-SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
-SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
-
--echo # On the next FDE, the slave should have the master CREATE/INSERT events
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
select count(*)=1 from t1;
@@ -138,6 +133,7 @@ while (!$caught_up)
}
sleep 0.1;
}
+set debug_sync="RESET";
--enable_query_log
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 720ec059..ff233615 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -23,7 +23,6 @@ connection slave;
# 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;
@@ -58,7 +57,7 @@ set global rpl_semi_sync_slave_enabled= 0;
connection master;
-set global rpl_semi_sync_master_timeout= 60000; # 60s
+set global rpl_semi_sync_master_timeout= 2000; # 2s
echo [ default state of semi-sync on master should be OFF ];
show variables like 'rpl_semi_sync_master_enabled';
@@ -202,12 +201,16 @@ sync_slave_with_master;
--echo # Test semi-sync master will switch OFF after one transaction
--echo # timeout waiting for slave reply.
--echo #
+
+connection master;
+show status like "Rpl_semi_sync_master_status";
+
connection slave;
source include/stop_slave.inc;
connection master;
--source include/kill_binlog_dump_threads.inc
-set global rpl_semi_sync_master_timeout= 5000;
+set global rpl_semi_sync_master_timeout= 2000;
# The first semi-sync check should be on because after slave stop,
# there are no transactions on the master.
@@ -239,8 +242,8 @@ 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.
+# Semi-sync status on master is now ON, but there are no slaves attached,
+# 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;
@@ -374,6 +377,9 @@ let $status_var= Rpl_semi_sync_master_clients;
let $status_var_value= 1;
source include/wait_for_status_var.inc;
+sync_slave_with_master;
+connection master;
+
replace_result $engine_type ENGINE_TYPE;
eval create table t1 (a int) engine = $engine_type;
insert into t1 values (1);
@@ -420,6 +426,10 @@ connection master;
let $status_var= Rpl_semi_sync_master_clients;
let $status_var_value= 1;
source include/wait_for_status_var.inc;
+
+sync_slave_with_master;
+connection master;
+
echo [ master semi-sync should be ON ];
show status like 'Rpl_semi_sync_master_clients';
show status like 'Rpl_semi_sync_master_status';
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 d4df9b40..86e1522e 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
@@ -14,7 +14,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
-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");
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test
index 6a691ae0..17d7b50d 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test
@@ -18,6 +18,7 @@
--connection server_1
RESET MASTER;
SET @@global.max_binlog_size= 4096;
+set @@global.rpl_semi_sync_master_enabled = 1;
--connection server_2
RESET MASTER;
@@ -29,7 +30,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
-set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
index 2224f78d..05e6fcca 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
@@ -30,8 +30,12 @@ connection master;
--let $rpl_server_number=1
source include/rpl_stop_server.inc;
+# After stoping the master, slave receives the disconnect error (2003)
--connection slave
---source include/stop_slave.inc
+--let $slave_io_errno=2003
+--let $slave_io_error_is_nonfatal=1
+--source include/wait_for_slave_io_error.inc
+--let $slave_io_error_is_nonfatal=0
#connection master;
--echo # Restart master
@@ -42,8 +46,10 @@ source include/rpl_start_server.inc;
# Clean up
#
--connection slave
---source include/stop_slave.inc
---source include/start_slave.inc
+--source include/wait_for_slave_sql_to_start.inc
+--let rpl_allow_error=1
+--source include/wait_for_slave_io_to_start.inc
+#--source include/start_slave.inc
--connection master
SET @@GLOBAL.debug_dbug="";
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf
new file mode 100644
index 00000000..cb7062d5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf
@@ -0,0 +1,12 @@
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+
+[mysqld.2]
+
+[mysqld.3]
+
+[ENV]
+SERVER_MYPORT_1= @mysqld.1.port
+SERVER_MYPORT_2= @mysqld.2.port
+SERVER_MYPORT_3= @mysqld.3.port
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test
new file mode 100644
index 00000000..c8870e47
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test
@@ -0,0 +1,122 @@
+#
+# This test ensures that a primary will listen for ACKs by newly added
+# semi-sync connections connections, after a pre-existing connection is already
+# established. MDEV-32960 reported that the newly added slave's ACK can be
+# ignored if listen_on_sockets() does not timeout before
+# rpl_semi_sync_master_timeout, and if the existing semi-sync connections fail
+# to send ACKs, semi-sync is switched off.
+#
+# This test ensures this in a two-replica setup with a semi-sync timeout of
+# 500ms, and delaying the ACK reply of the first-established replica by 800ms
+# to force a timeout, and allowing the second replica to immediately ACK.
+#
+# References:
+# MDEV-32960: Semi-sync ACKed Transaction can Timeout and Switch Off
+# Semi-sync with Multiple Replicas
+#
+--source include/have_debug.inc
+# binlog_format independent
+--source include/have_binlog_format_statement.inc
+
+--let $rpl_topology= 1->2,1->3
+--source include/rpl_init.inc
+
+
+--connection server_1
+set @old_enabled= @@global.rpl_semi_sync_master_enabled;
+set @old_timeout= @@global.rpl_semi_sync_master_timeout;
+set global rpl_semi_sync_master_enabled= 1;
+set global rpl_semi_sync_master_timeout= 500;
+
+--connection server_2
+--source include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set @old_dbug= @@global.debug_dbug;
+set global rpl_semi_sync_slave_enabled= 1;
+set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
+--source include/start_slave.inc
+
+--connection server_3
+--source include/stop_slave.inc
+set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
+set global rpl_semi_sync_slave_enabled= 1;
+--source include/start_slave.inc
+
+--echo # Ensure primary recognizes both replicas are semi-sync
+--connection server_1
+--let $status_var_value= 2
+--let $status_var= rpl_semi_sync_master_clients
+--source include/wait_for_status_var.inc
+
+--let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1)
+if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_master_status';
+ --die rpl_semi_sync_master_status should be ON to start
+}
+
+--connection server_1
+--let $init_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
+create table t1 (a int);
+
+--connection server_2
+--echo # Verifying server_2 did not send ACK
+--let $slave1_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
+if (`SELECT $slave1_sent_ack`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
+ --die server_2 should not have sent semi-sync ACK to primary
+}
+
+--connection server_3
+--echo # Verifying server_3 did send ACK
+--let $slave2_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
+if (`SELECT NOT $slave2_sent_ack`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
+ --die server_3 should have sent semi-sync ACK to primary
+}
+
+--connection server_1
+--echo # Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
+let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1);
+if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
+{
+ SHOW STATUS LIKE 'rpl_semi_sync_master_status';
+ --die rpl_semi_sync_master_status should not have switched off after server_3 ACKed transaction
+}
+
+--echo # Verifying rpl_semi_sync_master_yes_tx incremented
+--let $cur_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
+if (`SELECT $cur_master_yes_tx != ($init_master_yes_tx + 1)`)
+{
+ --echo # Initial yes_tx: $init_master_yes_tx
+ --echo # Current yes_tx: $cur_master_yes_tx
+ --die rpl_semi_sync_master_yes_tx should have been incremented by primary
+}
+
+
+--echo #
+--echo # Cleanup
+
+--connection server_2
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+set global debug_dbug= @old_dbug;
+--source include/stop_slave.inc
+
+--connection server_3
+set global rpl_semi_sync_slave_enabled= @old_enabled;
+--source include/stop_slave.inc
+
+--connection server_1
+set global rpl_semi_sync_master_enabled= @old_enabled;
+set global rpl_semi_sync_master_timeout= @old_timeout;
+drop table t1;
+
+--connection server_2
+--source include/start_slave.inc
+--connection server_3
+--source include/start_slave.inc
+
+--source include/rpl_end.inc
+--echo # End of rpl_semi_sync_no_missed_ack_after_add_slave.test
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc
index a232f685..252541ae 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.inc
@@ -116,11 +116,13 @@ show status like 'Rpl_semi_sync_master_no_tx';
--connection server_2
--eval SET @@GLOBAL.debug_dbug= "$sav_server_2_dbug"
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0
+--let $rpl_only_running_threads= 1
source include/stop_slave.inc;
--connection server_3
--eval SET @@GLOBAL.debug_dbug= "$sav_server_3_dbug"
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0
+--let $rpl_only_running_threads= 1
source include/stop_slave.inc;
--echo #-- Bring the master back up
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test
index bc05bec2..644e6517 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_compressed_protocol.test
@@ -40,7 +40,7 @@ DROP TABLE t1;
--let $assert_select=Read semi-sync reply magic number error
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count= 0
---let $assert_only_after = CURRENT_TEST:rpl.rpl_semi_sync_slave_compressed_protocol.test
+--let $assert_only_after = CURRENT_TEST: rpl.rpl_semi_sync_slave_compressed_protocol
--source include/assert_grep.inc
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test
new file mode 100644
index 00000000..9e388ab4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test
@@ -0,0 +1,73 @@
+#
+# MDEV-32551: "Read semi-sync reply magic number error" warnings on master
+#
+# Test that changing rpl_semi_sync_master_enabled after startup does not
+# cause problems with semi-sync cleanup.
+#
+
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+# Test is binlog format independent, so save resources
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+call mtr.add_suppression("Replication event checksum verification failed");
+call mtr.add_suppression("could not queue event from master");
+
+--echo #
+--echo # Set up a semisync connection
+--connection master
+set @@global.rpl_semi_sync_master_enabled= ON;
+
+--connection slave
+stop slave io_thread;
+set @@global.rpl_semi_sync_slave_enabled= ON;
+set @old_dbug= @@global.debug_dbug;
+
+# Force an error to abort out of the main IO thread loop
+set @@global.debug_dbug= "+d,corrupt_queue_event";
+
+# Pause the IO thread as soon as the main loop starts. Note we can't use
+# processlist where "Waiting for master to send event" because the
+# "corrupt_queue_event" will trigger before we can turn semisync OFF
+set @@global.debug_dbug= "+d,pause_before_io_read_event";
+
+# Because the other debug_dbug points are automatically negated when they are
+# run, and there is a bug that if "-d" takes us to an empty debug string state,
+# _all_ debug_print statements are output
+set @@global.debug_dbug= "+d,placeholder";
+
+start slave io_thread;
+
+--echo # Disable semi-sync on the slave while the IO thread is active
+set debug_sync='now wait_for io_thread_at_read_event';
+set @@global.rpl_semi_sync_slave_enabled= OFF;
+set debug_sync='now signal io_thread_continue_read_event';
+
+--echo # Waiting for the slave to stop with the error from corrupt_queue_event
+--connection slave
+--let $slave_io_errno= 1595,1743
+--source include/wait_for_slave_io_error.inc
+
+--echo # Sleep 1 to give time for Ack_receiver to receive COM_QUIT
+--sleep 1
+
+--let $assert_text= Check that there is no 'Read semi-sync reply magic number error' in error log.
+--let $assert_select=magic number error
+--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_count= 0
+--let $assert_only_after=CURRENT_TEST
+--source include/assert_grep.inc
+
+--echo #
+--echo # Cleanup
+--connection slave
+--source include/stop_slave.inc
+set @@global.debug_dbug= @old_dbug;
+--source include/start_slave.inc
+--connection master
+set @@global.rpl_semi_sync_master_enabled= default;
+
+--source include/rpl_end.inc
+--echo # End of rpl_semi_sync_slave_enabled_consistent.test
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test
index 94853799..84462ed6 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test
@@ -31,6 +31,7 @@
--connection master
call mtr.add_suppression("Timeout waiting for reply of binlog*");
+call mtr.add_suppression("Master server does not read semi-sync messages*");
--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
@@ -54,9 +55,9 @@ if(!$log_error_)
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
}
---echo "Assert that the net_fulsh() reply failed is present in slave error log.
+--echo "Assert that Master server does not read semi-sync messages" is present in slave error log.
--let SEARCH_FILE=$log_error_
---let SEARCH_PATTERN=Semi-sync slave net_flush\(\) reply failed
+--let SEARCH_PATTERN=Master server does not read semi-sync messages
--source include/search_pattern_in_file.inc
--echo "Assert that Slave IO thread is up and running."
@@ -78,7 +79,7 @@ insert into t1 values (10);
--connection master
set statement sql_log_bin=0 for call mtr.add_suppression("Read semi-sync reply magic number error");
-SET @save_debug_master= @@global.debug;
+SET @save_debug_master= @@global.debug_dbug;
SET GLOBAL debug_dbug="+d,semisync_corrupt_magic";
insert into t1 values (11);
diff --git a/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test b/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
index 5e6f350b..c5c1daa4 100644
--- a/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
+++ b/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
@@ -16,7 +16,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
CALL mtr.add_suppression("Semi-sync master failed on*");
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
CALL mtr.add_suppression("on master failed*");
-CALL mtr.add_suppression("Master server does not support semi-sync*");
CALL mtr.add_suppression("Semi-sync slave net_flush*");
CALL mtr.add_suppression("Failed to flush master info*");
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
index cf3faa65..3ea6d5da 100644
--- a/mysql-test/suite/rpl/t/rpl_session_var.test
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -7,6 +7,12 @@ disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
+select @@rpl_semi_sync_master_enabled;
+connection slave;
+select @@rpl_semi_sync_slave_enabled;
+show status like "rpl_semi_sync_slave_status";
+connection master;
+
drop table if exists t1;
create table t1(a varchar(100),b int);
set @@session.sql_mode=pipes_as_concat;
diff --git a/mysql-test/suite/rpl/t/rpl_session_var2-master.opt b/mysql-test/suite/rpl/t/rpl_session_var2-master.opt
new file mode 100644
index 00000000..edb0c915
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var2-master.opt
@@ -0,0 +1 @@
+--rpl_semi_sync_master_enabled=1 --rpl_semi_sync_slave_enabled=1
diff --git a/mysql-test/suite/rpl/t/rpl_session_var2-slave.opt b/mysql-test/suite/rpl/t/rpl_session_var2-slave.opt
new file mode 100644
index 00000000..c9f3082e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var2-slave.opt
@@ -0,0 +1 @@
+--rpl_semi_sync_slave_enabled=1
diff --git a/mysql-test/suite/rpl/t/rpl_session_var2.test b/mysql-test/suite/rpl/t/rpl_session_var2.test
new file mode 100644
index 00000000..cbf8a5cf
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_session_var2.test
@@ -0,0 +1,3 @@
+# Replication of session variables when semi-sync is on
+
+--source rpl_session_var.test
diff --git a/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test b/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test
index 106cb454..d30da61b 100644
--- a/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test
+++ b/mysql-test/suite/rpl/t/rpl_set_statement_default_master.test
@@ -26,6 +26,7 @@ eval CHANGE MASTER 'm1' TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT,
SET STATEMENT default_master_connection = 'm1' FOR START SLAVE;
set default_master_connection = 'm1';
+--source include/wait_for_slave_to_start.inc
stop slave;
--source include/wait_for_slave_to_stop.inc
reset slave all;
diff --git a/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test b/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test
index 2c63df30..0547a97f 100644
--- a/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test
+++ b/mysql-test/suite/rpl/t/rpl_shutdown_wait_semisync_slaves.test
@@ -28,6 +28,9 @@ while (`SELECT $i <= $slaves`)
--inc $i
}
+# The following script will restart master and slaves. This will also set
+# rpl_semi_sync_master_enabled=0
+
--source include/rpl_shutdown_wait_slaves.inc
--let i= 2
while (`SELECT $i <= $slaves`)
diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test
index 16dcd8ec..89b7c7f1 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test
@@ -15,6 +15,7 @@ call mtr.add_suppression("Slave SQL.*Unable to use slave.s temporary directory")
--let $slave_sql_errno= 12
source include/wait_for_slave_sql_error.inc;
+--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test
index 63e37216..fb552d64 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -59,7 +59,6 @@ sync_slave_with_master;
source include/stop_slave.inc;
START SLAVE;
source include/wait_for_slave_sql_to_start.inc;
-source include/wait_for_slave_io_to_stop.inc;
--echo ==== Verify that Slave IO thread stopped with error ====
# 1045 = ER_ACCESS_DENIED_ERROR
@@ -68,7 +67,7 @@ source include/wait_for_slave_io_to_stop.inc;
--echo ==== Cleanup (Note that slave IO thread is not running) ====
-# cleanup: slave io thread has is stopped so we reset replication
+# cleanup: slave io thread is stopped so we reset replication
--source include/stop_slave_sql.inc
CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = '';
# clear Slave_IO_Errno
diff --git a/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test b/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test
index f6dcfd91..8b096902 100644
--- a/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test
+++ b/mysql-test/suite/rpl/t/rpl_sql_thd_start_errno_cleared.test
@@ -76,6 +76,10 @@ if ($last_error)
set debug_sync= "now signal sql_thread_continue";
+--echo # Wait for debug_sync signal to have been received before issuing RESET
+let $wait_condition= select count(*)=0 from information_schema.processlist where state like "debug sync point%";
+source include/wait_condition.inc;
+
set @@global.debug_dbug= @saved_dbug;
set debug_sync= "RESET";
diff --git a/mysql-test/suite/rpl/t/rpl_ssl1.test b/mysql-test/suite/rpl/t/rpl_ssl1.test
index d994dd21..04f6cfff 100644
--- a/mysql-test/suite/rpl/t/rpl_ssl1.test
+++ b/mysql-test/suite/rpl/t/rpl_ssl1.test
@@ -29,8 +29,10 @@ connection slave;
select * from t1;
#showing that replication could work with ssl params
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--let $slave_io_errno=1045
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
+
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval change master to 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;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_1.test
index 9ce061f1..b16f6a53 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_1.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_1.test
@@ -6,6 +6,7 @@
--source include/master-slave.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_2.test b/mysql-test/suite/rpl/t/rpl_start_alter_2.test
index 457409c5..a5cef2e5 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_2.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_2.test
@@ -8,9 +8,11 @@
--source include/have_debug.inc
--source include/master-slave.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
+
--connection slave
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_3.test b/mysql-test/suite/rpl/t/rpl_start_alter_3.test
index b280aeb9..8207dcbb 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_3.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_3.test
@@ -9,9 +9,11 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
+
--connection slave
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_4.test b/mysql-test/suite/rpl/t/rpl_start_alter_4.test
index 8c67b50a..f4edc4b9 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_4.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_4.test
@@ -9,6 +9,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_5.test b/mysql-test/suite/rpl/t/rpl_start_alter_5.test
index 10d0d523..b2d31f21 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_5.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_5.test
@@ -9,6 +9,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_6.test b/mysql-test/suite/rpl/t/rpl_start_alter_6.test
index fc49ea4a..6c2b5015 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_6.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_6.test
@@ -10,6 +10,7 @@
--source include/master-slave.inc
--source include/have_debug.inc
--connection master
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase`
set global binlog_alter_two_phase = ON;
set binlog_alter_two_phase = ON;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_7.test b/mysql-test/suite/rpl/t/rpl_start_alter_7.test
index 7225c075..21c21c85 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_7.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_7.test
@@ -21,6 +21,10 @@ stop slave;
set global binlog_alter_two_phase=true;
--connection server_3
+SET STATEMENT sql_log_bin=0 FOR
+ CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
--let $slave_parallel_mode= `select @@slave_parallel_mode`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_8.test b/mysql-test/suite/rpl/t/rpl_start_alter_8.test
index 4ab8e2b0..c8c5ac74 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_8.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_8.test
@@ -21,6 +21,10 @@ stop slave;
set global binlog_alter_two_phase=true;
--connection server_3
+SET STATEMENT sql_log_bin=0 FOR
+ CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $gtid_strict_mode= `select @@gtid_strict_mode`
--let $slave_parallel_threads= `select @@slave_parallel_threads`
--let $slave_parallel_mode= `select @@slave_parallel_mode`
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test
index f655d3c1..a2f6adcc 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test
@@ -10,6 +10,8 @@
set global binlog_alter_two_phase=true;
--connection slave
--source include/stop_slave.inc
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set global gtid_strict_mode=1;
--echo # Legacy Master Slave
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test
index c7d5bd66..9d9675c6 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test
@@ -57,6 +57,10 @@ SET @save_binlog_alter_two_phase= @@GLOBAL.binlog_alter_two_phase;
SET GLOBAL binlog_alter_two_phase = ON;
--connection server_3
+SET STATEMENT sql_log_bin=0 FOR
+ CALL mtr.add_suppression("The table mysql.gtid_slave_pos was removed. This change will not take full effect until all SQL threads have been restarted");
+SET STATEMENT sql_log_bin=0 FOR
+ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET @save_gtid_strict_mode= @@GLOBAL.gtid_strict_mode;
SET @slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
SET @slave_parallel_mode= @@GLOBAL.slave_parallel_mode;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test
index df028ff1..5dcb0bf8 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_restart_slave.test
@@ -90,8 +90,12 @@ SET GLOBAL debug_dbug= @old_debug_slave;
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--source include/start_slave.inc
+
--connection master
---sync_slave_with_master
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
--echo # Everything from the master binlog must have been applied now:
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--let $slave_gtid_state = `select @@gtid_binlog_state`
diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
index 85e16afa..4d179cd5 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
@@ -71,13 +71,15 @@ connection slave;
set @@global.innodb_lock_wait_timeout=1;
set @@global.slave_transaction_retries=100;
+--let $rpl_allow_error=1
--source include/restart_slave_sql.inc
+--let $rpl_allow_error=0
--let $last_retries= query_get_value(SHOW GLOBAL STATUS LIKE 'Slave_retried_transactions', Value, 1)
--let $status_type=GLOBAL
--let $status_var=Slave_retried_transactions
--let $status_var_value=`SELECT 1 + $last_retries`
---let $$status_var_comparsion= >
+--let $status_var_comparsion= >
--source include/wait_for_status_var.inc
# Release the record after just one retry
diff --git a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
index eab5b4dd..c14695f9 100644
--- a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
+++ b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
@@ -271,7 +271,10 @@ eval set global gtid_slave_pos="$old_slave_pos";
--echo # not master_use_gtid=no should warn the user that Using_Gtid is being
--echo # changed to No.
--echo #
+--connection master
+--source include/save_master_pos.inc
--connection slave
+--source include/sync_io_with_master.inc
--let $io_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
--let $io_log_file= query_get_value('SHOW SLAVE STATUS', Master_Log_File, 1)
--source include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/t/semisync_future-7591.test b/mysql-test/suite/rpl/t/semisync_future-7591.test
index 793d8bcc..ce01e41f 100644
--- a/mysql-test/suite/rpl/t/semisync_future-7591.test
+++ b/mysql-test/suite/rpl/t/semisync_future-7591.test
@@ -19,7 +19,7 @@ insert into t1 values (1);
reset master;
--connection slave
---source include/stop_slave.inc
+--source include/stop_slave_sql.inc
--let $master_use_gtid_option= No
--source include/reset_slave.inc
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
index 12794dbd..cd0f8aad 100644
--- a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
+++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
@@ -15,6 +15,9 @@ call mtr.add_suppression("Master is configured to log replication events");
# All done.
--connection slave
+# The parallel START SLAVE can leave an error condition if the last START was
+# aborted by the master due to conflicting server_id from multiple connections.
+--let $rpl_allow_error= 1
--source include/wait_for_slave_to_stop.inc
start slave;
diff --git a/mysql-test/suite/s3/amazon.result b/mysql-test/suite/s3/amazon.result
index 29075118..b24969ab 100644
--- a/mysql-test/suite/s3/amazon.result
+++ b/mysql-test/suite/s3/amazon.result
@@ -4,4 +4,14 @@ create table t1 (pk int primary key, a int);
insert into t1 values (1,1),(2,2),(3,3),(4,4);
alter table t1 engine=S3;
drop table t1;
+set @@global.s3_protocol_version="Amazon";
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+drop table t1;
+set @@global.s3_protocol_version="Domain";
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+drop table t1;
set @@global.s3_protocol_version=@save_s3_protocol_version;
diff --git a/mysql-test/suite/s3/amazon.test b/mysql-test/suite/s3/amazon.test
index 3c64cc28..bc9439ab 100644
--- a/mysql-test/suite/s3/amazon.test
+++ b/mysql-test/suite/s3/amazon.test
@@ -1,6 +1,6 @@
--source include/have_s3.inc
-if (`SELECT @@s3_host_name <> "s3.amazonaws.com"`)
+if (`SELECT @@s3_host_name NOT LIKE "%.amazonaws.com"`)
{
skip Not connected to AWS;
}
@@ -20,6 +20,22 @@ insert into t1 values (1,1),(2,2),(3,3),(4,4);
alter table t1 engine=S3;
drop table t1;
+set @@global.s3_protocol_version="Amazon";
+
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+--replace_result $database database
+alter table t1 engine=S3;
+drop table t1;
+
+set @@global.s3_protocol_version="Domain";
+
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+--replace_result $database database
+alter table t1 engine=S3;
+drop table t1;
+
#
# clean up
#
diff --git a/mysql-test/suite/s3/debug.result b/mysql-test/suite/s3/debug.result
new file mode 100644
index 00000000..2dffcff8
--- /dev/null
+++ b/mysql-test/suite/s3/debug.result
@@ -0,0 +1,32 @@
+drop table if exists t1;
+#
+# MDEV-32884 Make s3_debug dynamic
+#
+create or replace table t1 (a int, b int, c varchar(1000), key (a), key(c)) engine=aria;
+insert into t1 select seq, seq+10, repeat(char(65+ mod(seq, 20)),mod(seq,1000)) from seq_1_to_100;
+alter table t1 engine=s3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` varchar(1000) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `c` (`c`)
+) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+select count(*) from t1;
+count(*)
+100
+flush table t1;
+NOT FOUND /s3_test_/ in mysqld.1.err
+set @@global.s3_debug=1;
+select count(*) from t1;
+count(*)
+100
+set @@global.s3_debug=0;
+FOUND 6 /s3_test_/ in mysqld.1.err
+select count(*) from t1;
+count(*)
+100
+drop table t1;
+FOUND 6 /s3_test_/ in mysqld.1.err
diff --git a/mysql-test/suite/s3/debug.test b/mysql-test/suite/s3/debug.test
new file mode 100644
index 00000000..67787d72
--- /dev/null
+++ b/mysql-test/suite/s3/debug.test
@@ -0,0 +1,34 @@
+--source include/have_s3.inc
+--source include/have_sequence.inc
+
+#
+# Create unique database for running the tests
+#
+--source create_database.inc
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--echo #
+--echo # MDEV-32884 Make s3_debug dynamic
+--echo #
+
+create or replace table t1 (a int, b int, c varchar(1000), key (a), key(c)) engine=aria;
+insert into t1 select seq, seq+10, repeat(char(65+ mod(seq, 20)),mod(seq,1000)) from seq_1_to_100;
+alter table t1 engine=s3;
+show create table t1;
+select count(*) from t1;
+flush table t1;
+
+--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
+--let SEARCH_PATTERN=s3_test_
+--source include/search_pattern_in_file.inc
+set @@global.s3_debug=1;
+select count(*) from t1;
+set @@global.s3_debug=0;
+--source include/search_pattern_in_file.inc
+select count(*) from t1;
+drop table t1;
+--source include/search_pattern_in_file.inc
+
+--source drop_database.inc
diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result
index 6d29876a..75da828c 100644
--- a/mysql-test/suite/sql_sequence/alter.result
+++ b/mysql-test/suite/sql_sequence/alter.result
@@ -210,8 +210,12 @@ create table t1 (a int);
alter sequence t1 minvalue=100;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop table t1;
+#
+# MDEV-32795: ALTER SEQUENCE IF NOT EXISTS non_existing_seq Errors rather than note
+#
alter sequence if exists t1 minvalue=100;
-ERROR 42S02: Unknown SEQUENCE: 't1'
+Warnings:
+Note 4091 Unknown SEQUENCE: 'test.t1'
alter sequence t1 minvalue=100;
ERROR 42S02: Unknown SEQUENCE: 't1'
create sequence t1;
@@ -249,6 +253,55 @@ NEXTVAL(s)
1
DROP SEQUENCE s;
#
+# MDEV-33169 Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds
+#
+create sequence s;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+alter sequence s maxvalue 123;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+alter sequence s maxvalue 123;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+drop sequence s;
+create sequence s;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+prepare stmt from 'alter sequence s maxvalue 123';
+execute stmt;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+execute stmt;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+deallocate prepare stmt;
+drop sequence s;
+create sequence s;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+create procedure p() alter sequence s maxvalue 123;
+call p;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+call p;
+show create sequence s;
+Table Create Table
+s CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 123 increment by 1 cache 1000 nocycle ENGINE=MyISAM
+drop procedure p;
+drop sequence s;
+#
+# End of 10.4 tests
+#
+#
# MDEV-31607 ER_DUP_KEY in mysql.table_stats upon REANME on sequence
#
CREATE SEQUENCE s1 ENGINE=InnoDB;
@@ -262,3 +315,6 @@ s2 CREATE SEQUENCE `s2` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
DROP SEQUENCE s2;
RENAME TABLE s1 TO s2;
DROP SEQUENCE s2;
+#
+# End of 10.6 tests
+#
diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test
index dab0e665..7b14055d 100644
--- a/mysql-test/suite/sql_sequence/alter.test
+++ b/mysql-test/suite/sql_sequence/alter.test
@@ -120,8 +120,12 @@ create table t1 (a int);
alter sequence t1 minvalue=100;
drop table t1;
---error ER_UNKNOWN_SEQUENCES
+--echo #
+--echo # MDEV-32795: ALTER SEQUENCE IF NOT EXISTS non_existing_seq Errors rather than note
+--echo #
+
alter sequence if exists t1 minvalue=100;
+
--error ER_UNKNOWN_SEQUENCES
alter sequence t1 minvalue=100;
@@ -164,6 +168,41 @@ SELECT NEXTVAL(s);
DROP SEQUENCE s;
--echo #
+--echo # MDEV-33169 Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds
+--echo #
+create sequence s;
+show create sequence s;
+alter sequence s maxvalue 123;
+show create sequence s;
+alter sequence s maxvalue 123;
+show create sequence s;
+drop sequence s;
+
+create sequence s;
+show create sequence s;
+prepare stmt from 'alter sequence s maxvalue 123';
+execute stmt;
+show create sequence s;
+execute stmt;
+show create sequence s;
+deallocate prepare stmt;
+drop sequence s;
+
+create sequence s;
+show create sequence s;
+create procedure p() alter sequence s maxvalue 123;
+call p;
+show create sequence s;
+call p;
+show create sequence s;
+drop procedure p;
+drop sequence s;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
+
+--echo #
--echo # MDEV-31607 ER_DUP_KEY in mysql.table_stats upon REANME on sequence
--echo #
@@ -176,3 +215,7 @@ RENAME TABLE s1 TO s2;
DROP SEQUENCE s2;
--enable_ps2_protocol
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
diff --git a/mysql-test/suite/sys_vars/r/debug_basic.result b/mysql-test/suite/sys_vars/r/debug_basic.result
index a97ad65b..5a77446d 100644
--- a/mysql-test/suite/sys_vars/r/debug_basic.result
+++ b/mysql-test/suite/sys_vars/r/debug_basic.result
@@ -1,6 +1,4 @@
set session debug="L";
-Warnings:
-Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
select @@global.debug="1";
@@global.debug="1"
0
diff --git a/mysql-test/suite/sys_vars/r/old_mode_basic.result b/mysql-test/suite/sys_vars/r/old_mode_basic.result
index 252316dc..776d45a1 100644
--- a/mysql-test/suite/sys_vars/r/old_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/old_mode_basic.result
@@ -114,8 +114,8 @@ SET @@global.old_mode = 4;
SELECT @@global.old_mode;
@@global.old_mode
ZERO_DATE_TIME_CAST
-SET @@global.old_mode = 64;
-ERROR 42000: Variable 'old_mode' can't be set to the value of '64'
+SET @@global.old_mode = 128;
+ERROR 42000: Variable 'old_mode' can't be set to the value of '128'
SELECT @@global.old_mode;
@@global.old_mode
ZERO_DATE_TIME_CAST
diff --git a/mysql-test/suite/sys_vars/r/old_passwords_func.result b/mysql-test/suite/sys_vars/r/old_passwords_func.result
index 6bd06093..fb250eeb 100644
--- a/mysql-test/suite/sys_vars/r/old_passwords_func.result
+++ b/mysql-test/suite/sys_vars/r/old_passwords_func.result
@@ -9,6 +9,8 @@ SET GLOBAL old_passwords = TRUE;
SET SESSION old_passwords = TRUE;
CREATE USER 'userOldPass'@'localhost' IDENTIFIED BY 'pass3';
SET GLOBAL secure_auth = FALSE;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
connect con1,localhost,userNewPass1,pass1,;
SELECT CURRENT_USER();
CURRENT_USER()
@@ -30,6 +32,8 @@ disconnect con2;
disconnect con3;
'#------------------------FN_DYNVARS_115_02---------------------------#'
SET GLOBAL secure_auth = TRUE;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
connect con1,localhost,userNewPass1,pass1,;
SELECT CURRENT_USER();
CURRENT_USER()
@@ -55,3 +59,5 @@ DROP USER 'userOldPass'@'localhost';
SET @@GLOBAL.old_passwords = @global_old_passwords;
SET @@SESSION.old_passwords = @session_old_passwords;
SET @@GLOBAL.secure_auth = @global_secure_auth;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
diff --git a/mysql-test/suite/sys_vars/r/pseudo_slave_mode_notembedded.result b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_notembedded.result
new file mode 100644
index 00000000..3246a309
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_notembedded.result
@@ -0,0 +1,14 @@
+'### MDEV-32844: THD::rli_fake/rgi_fake not cleared on new connection'
+connect con1,localhost,root,,;
+BINLOG '
+6ENbZQ8BAAAA/AAAAAABAAAAAAQAMTAuMTEuNi1NYXJpYURCLWRlYnVnLWxvZwAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAADoQ1tlEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAEEwQADQgICAoKCgGbvv33
+';
+disconnect con1;
+connect con1,localhost,root,,;
+SET SESSION pseudo_slave_mode= 1;
+disconnect con1;
+connection default;
diff --git a/mysql-test/suite/sys_vars/r/secure_auth_basic.result b/mysql-test/suite/sys_vars/r/secure_auth_basic.result
index 35f283de..66763fc5 100644
--- a/mysql-test/suite/sys_vars/r/secure_auth_basic.result
+++ b/mysql-test/suite/sys_vars/r/secure_auth_basic.result
@@ -4,7 +4,11 @@ SELECT @global_start_value;
1
'#--------------------FN_DYNVARS_143_01------------------------#'
SET @@global.secure_auth = 1;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SET @@global.secure_auth = DEFAULT;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
1
@@ -17,15 +21,21 @@ SELECT @@secure_auth;
SELECT global.secure_auth;
ERROR 42S02: Unknown table 'global' in field list
SET global secure_auth = 1;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
1
'#--------------------FN_DYNVARS_143_03------------------------#'
SET @@global.secure_auth = 0;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
0
SET @@global.secure_auth = 1;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
1
@@ -83,23 +93,33 @@ VARIABLE_VALUE
ON
'#---------------------FN_DYNVARS_143_08-------------------------#'
SET @@global.secure_auth = OFF;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
0
SET @@global.secure_auth = ON;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
1
'#---------------------FN_DYNVARS_143_09----------------------#'
SET @@global.secure_auth = TRUE;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
1
SET @@global.secure_auth = FALSE;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
0
SET @@global.secure_auth = @global_start_value;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SELECT @@global.secure_auth;
@@global.secure_auth
1
diff --git a/mysql-test/suite/sys_vars/r/secure_auth_func.result b/mysql-test/suite/sys_vars/r/secure_auth_func.result
index 97d22fac..ee0d6146 100644
--- a/mysql-test/suite/sys_vars/r/secure_auth_func.result
+++ b/mysql-test/suite/sys_vars/r/secure_auth_func.result
@@ -8,6 +8,8 @@ SELECT @@GLOBAL.secure_auth;
1 / ON Expected
'#--------------------FN_DYNVARS_144_02-------------------------#'
SET GLOBAL secure_auth = OFF;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
CREATE USER 'testUser'@'localhost' IDENTIFIED BY 'newpass';
connect con_user1,localhost,testUser,newpass,;
connection default;
@@ -16,6 +18,8 @@ connect con_user2,localhost,testUser,newpass,;
connection default;
'#--------------------FN_DYNVARS_144_03-------------------------#'
SET GLOBAL secure_auth = ON;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
connect con_user3,localhost,testUser,newpass,;
connection default;
@@ -27,6 +31,8 @@ SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass');
connect con_user4,localhost,testUser,newpass,;
connection default;
SET GLOBAL secure_auth = @old_secure_auth;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
disconnect con_user1;
disconnect con_user2;
disconnect con_user3;
diff --git a/mysql-test/suite/sys_vars/r/secure_auth_grant.result b/mysql-test/suite/sys_vars/r/secure_auth_grant.result
index ed33eb33..ea4b1b09 100644
--- a/mysql-test/suite/sys_vars/r/secure_auth_grant.result
+++ b/mysql-test/suite/sys_vars/r/secure_auth_grant.result
@@ -23,6 +23,8 @@ GRANT CONNECTION ADMIN ON *.* TO user1@localhost;
connect user1,localhost,user1,,;
connection user1;
SET GLOBAL secure_auth=1;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SET secure_auth=1;
ERROR HY000: Variable 'secure_auth' is a GLOBAL variable and should be set with SET GLOBAL
SET SESSION secure_auth=1;
@@ -36,6 +38,8 @@ GRANT SUPER ON *.* TO user1@localhost;
connect user1,localhost,user1,,;
connection user1;
SET GLOBAL secure_auth=1;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
SET secure_auth=1;
ERROR HY000: Variable 'secure_auth' is a GLOBAL variable and should be set with SET GLOBAL
SET SESSION secure_auth=1;
@@ -44,3 +48,5 @@ disconnect user1;
connection default;
DROP USER user1@localhost;
SET @@global.secure_auth=@global;
+Warnings:
+Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug.result b/mysql-test/suite/sys_vars/r/sysvars_debug.result
index fc04ac83..01f74170 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_debug.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_debug.result
@@ -38,7 +38,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE
VARIABLE_SCOPE SESSION
VARIABLE_TYPE VARCHAR
-VARIABLE_COMMENT Built-in DBUG debugger
+VARIABLE_COMMENT Built-in DBUG debugger. Alias for --debug
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
index 1ba2756f..e7621986 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff
@@ -1,3 +1,5 @@
+--- sysvars_server_embedded.result 2024-01-24 07:43:25.510260081 +0100
++++ sysvars_server_embedded,32bit.result 2024-01-28 18:07:02.851488186 +0100
@@ -44,7 +44,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_BLOCK_SIZE
@@ -429,7 +431,7 @@
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity
+ VARIABLE_COMMENT Log some non critical warnings to the error log.Value can be between 0 and 11. Higher values mean more verbosity
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -1834,7 +1834,7 @@
@@ -722,6 +724,15 @@
NUMERIC_MAX_VALUE 4294967295
@@ -2324,7 +2324,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT 0 = No changes. 1 = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. 2 = Remove 'max_seek optimization' for secondary keys and slight adjustment of filter cost. This option will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -2334,7 +2334,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -729,7 +740,7 @@
VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try aggressively prune away the search space.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 62
-@@ -2334,7 +2334,7 @@
+@@ -2344,7 +2344,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_MAX_SEL_ARGS
VARIABLE_SCOPE SESSION
@@ -738,7 +749,7 @@
VARIABLE_COMMENT The maximum number of SEL_ARG objects created when optimizing a range. If more objects would be needed, the range will not be used by the optimizer.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2344,7 +2344,7 @@
+@@ -2354,7 +2354,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT
VARIABLE_SCOPE SESSION
@@ -747,7 +758,7 @@
VARIABLE_COMMENT The maximum weight of the SEL_ARG graph. Set to 0 for no limit
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2354,7 +2354,7 @@
+@@ -2364,7 +2364,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_PRUNE_LEVEL
VARIABLE_SCOPE SESSION
@@ -756,7 +767,7 @@
VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search: 1 - prune plans based on cost and number of retrieved rows eq_ref: 2 - prune also if we find an eq_ref chain
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -2364,7 +2364,7 @@
+@@ -2374,7 +2374,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH
VARIABLE_SCOPE SESSION
@@ -765,7 +776,7 @@
VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 62
-@@ -2374,7 +2374,7 @@
+@@ -2384,7 +2384,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT
VARIABLE_SCOPE SESSION
@@ -774,7 +785,7 @@
VARIABLE_COMMENT Controls number of record samples to check condition selectivity
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 4294967295
-@@ -2404,17 +2404,17 @@
+@@ -2414,17 +2414,17 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE
VARIABLE_SCOPE SESSION
@@ -795,7 +806,7 @@
VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5
-@@ -2434,7 +2434,7 @@
+@@ -2444,7 +2444,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -804,7 +815,7 @@
VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2444,7 +2444,7 @@
+@@ -2454,7 +2454,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -813,7 +824,7 @@
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2454,7 +2454,7 @@
+@@ -2464,7 +2464,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -822,7 +833,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2464,7 +2464,7 @@
+@@ -2474,7 +2474,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -831,7 +842,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2474,7 +2474,7 @@
+@@ -2484,7 +2484,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -840,7 +851,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2484,7 +2484,7 @@
+@@ -2494,7 +2494,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -849,7 +860,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2494,7 +2494,7 @@
+@@ -2504,7 +2504,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -858,7 +869,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2504,7 +2504,7 @@
+@@ -2514,7 +2514,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -867,7 +878,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2514,7 +2514,7 @@
+@@ -2524,7 +2524,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -876,7 +887,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2524,7 +2524,7 @@
+@@ -2534,7 +2534,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -885,7 +896,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2534,7 +2534,7 @@
+@@ -2544,7 +2544,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -894,7 +905,7 @@
VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2544,7 +2544,7 @@
+@@ -2554,7 +2554,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -903,7 +914,7 @@
VARIABLE_COMMENT Maximum number of condition instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2554,7 +2554,7 @@
+@@ -2564,7 +2564,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -912,7 +923,7 @@
VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2564,7 +2564,7 @@
+@@ -2574,7 +2574,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
VARIABLE_SCOPE GLOBAL
@@ -921,7 +932,7 @@
VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2574,7 +2574,7 @@
+@@ -2584,7 +2584,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -930,7 +941,7 @@
VARIABLE_COMMENT Maximum number of file instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2584,7 +2584,7 @@
+@@ -2594,7 +2594,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -939,7 +950,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented files.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2594,7 +2594,7 @@
+@@ -2604,7 +2604,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -948,7 +959,7 @@
VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2604,7 +2604,7 @@
+@@ -2614,7 +2614,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_INDEX_STAT
VARIABLE_SCOPE GLOBAL
@@ -957,7 +968,7 @@
VARIABLE_COMMENT Maximum number of index statistics for instrumented tables. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2614,7 +2614,7 @@
+@@ -2624,7 +2624,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MEMORY_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -966,7 +977,7 @@
VARIABLE_COMMENT Maximum number of memory pool instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
-@@ -2624,7 +2624,7 @@
+@@ -2634,7 +2634,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_METADATA_LOCKS
VARIABLE_SCOPE GLOBAL
@@ -975,7 +986,7 @@
VARIABLE_COMMENT Maximum number of metadata locks. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2634,7 +2634,7 @@
+@@ -2644,7 +2644,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -984,7 +995,7 @@
VARIABLE_COMMENT Maximum number of mutex instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2644,7 +2644,7 @@
+@@ -2654,7 +2654,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -993,7 +1004,7 @@
VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2654,7 +2654,7 @@
+@@ -2664,7 +2664,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PREPARED_STATEMENTS_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1002,7 +1013,7 @@
VARIABLE_COMMENT Maximum number of instrumented prepared statements. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2664,7 +2664,7 @@
+@@ -2674,7 +2674,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PROGRAM_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1011,7 +1022,7 @@
VARIABLE_COMMENT Maximum number of instrumented programs. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2674,7 +2674,7 @@
+@@ -2684,7 +2684,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1020,7 +1031,7 @@
VARIABLE_COMMENT Maximum number of rwlock instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2684,7 +2684,7 @@
+@@ -2694,7 +2694,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1029,7 +1040,7 @@
VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2694,7 +2694,7 @@
+@@ -2704,7 +2704,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1038,7 +1049,7 @@
VARIABLE_COMMENT Maximum number of socket instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2704,7 +2704,7 @@
+@@ -2714,7 +2714,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1047,7 +1058,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2714,7 +2714,7 @@
+@@ -2724,7 +2724,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SQL_TEXT_LENGTH
VARIABLE_SCOPE GLOBAL
@@ -1056,7 +1067,7 @@
VARIABLE_COMMENT Maximum length of displayed sql text.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2724,7 +2724,7 @@
+@@ -2734,7 +2734,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1065,7 +1076,7 @@
VARIABLE_COMMENT Maximum number of stage instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2734,7 +2734,7 @@
+@@ -2744,7 +2744,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1074,7 +1085,7 @@
VARIABLE_COMMENT Maximum number of statement instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2744,7 +2744,7 @@
+@@ -2754,7 +2754,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_STACK
VARIABLE_SCOPE GLOBAL
@@ -1083,7 +1094,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_CURRENT.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 256
-@@ -2754,7 +2754,7 @@
+@@ -2764,7 +2764,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -1092,7 +1103,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2764,7 +2764,7 @@
+@@ -2774,7 +2774,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1101,7 +1112,7 @@
VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2774,7 +2774,7 @@
+@@ -2784,7 +2784,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_LOCK_STAT
VARIABLE_SCOPE GLOBAL
@@ -1110,7 +1121,7 @@
VARIABLE_COMMENT Maximum number of lock statistics for instrumented tables. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2784,7 +2784,7 @@
+@@ -2794,7 +2794,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1119,7 +1130,7 @@
VARIABLE_COMMENT Maximum number of thread instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2794,7 +2794,7 @@
+@@ -2804,7 +2804,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1128,7 +1139,7 @@
VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2804,7 +2804,7 @@
+@@ -2814,7 +2814,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1137,7 +1148,7 @@
VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2814,7 +2814,7 @@
+@@ -2824,7 +2824,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1146,7 +1157,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2824,7 +2824,7 @@
+@@ -2834,7 +2834,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1155,7 +1166,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2834,7 +2834,7 @@
+@@ -2844,7 +2844,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1164,7 +1175,7 @@
VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2884,7 +2884,7 @@
+@@ -2894,7 +2894,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PRELOAD_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1173,7 +1184,7 @@
VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -2904,7 +2904,7 @@
+@@ -2914,7 +2914,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME PROFILING_HISTORY_SIZE
VARIABLE_SCOPE SESSION
@@ -1182,7 +1193,7 @@
VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -2914,7 +2914,7 @@
+@@ -2924,7 +2924,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PROGRESS_REPORT_TIME
VARIABLE_SCOPE SESSION
@@ -1191,7 +1202,7 @@
VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2974,7 +2974,7 @@
+@@ -2984,7 +2984,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE
VARIABLE_SCOPE SESSION
@@ -1200,7 +1211,7 @@
VARIABLE_COMMENT Allocation block size for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -2984,7 +2984,7 @@
+@@ -2994,7 +2994,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1209,7 +1220,7 @@
VARIABLE_COMMENT Don't cache results that are bigger than this
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2994,7 +2994,7 @@
+@@ -3004,7 +3004,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT
VARIABLE_SCOPE GLOBAL
@@ -1218,7 +1229,7 @@
VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3007,7 +3007,7 @@
+@@ -3017,7 +3017,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
NUMERIC_MIN_VALUE 0
@@ -1227,7 +1238,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3044,7 +3044,7 @@
+@@ -3054,7 +3054,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME QUERY_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1236,7 +1247,7 @@
VARIABLE_COMMENT Persistent buffer for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3057,7 +3057,7 @@
+@@ -3067,7 +3067,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1245,7 +1256,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3067,14 +3067,14 @@
+@@ -3077,14 +3077,14 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1262,7 +1273,7 @@
VARIABLE_COMMENT Allocation block size for storing ranges during optimization
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 4294967295
-@@ -3084,7 +3084,7 @@
+@@ -3094,7 +3094,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME READ_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1271,7 +1282,7 @@
VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -3104,7 +3104,7 @@
+@@ -3114,7 +3114,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME READ_RND_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1280,7 +1291,7 @@
VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 2147483647
-@@ -3124,10 +3124,10 @@
+@@ -3134,10 +3134,10 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ROWID_MERGE_BUFF_SIZE
VARIABLE_SCOPE SESSION
@@ -1293,7 +1304,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3164,7 +3164,7 @@
+@@ -3174,7 +3174,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SERVER_ID
VARIABLE_SCOPE SESSION
@@ -1302,7 +1313,7 @@
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -3244,7 +3244,7 @@
+@@ -3254,7 +3254,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET
VARIABLE_SCOPE GLOBAL
@@ -1311,7 +1322,7 @@
VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3254,7 +3254,7 @@
+@@ -3264,7 +3264,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLOW_LAUNCH_TIME
VARIABLE_SCOPE GLOBAL
@@ -1320,7 +1331,7 @@
VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -3297,7 +3297,7 @@
+@@ -3307,7 +3307,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1329,7 +1340,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3514,7 +3514,7 @@
+@@ -3524,7 +3524,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME STORED_PROGRAM_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1338,7 +1349,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -3604,7 +3604,7 @@
+@@ -3614,7 +3614,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME TABLE_DEFINITION_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1347,7 +1358,7 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 2097152
-@@ -3614,7 +3614,7 @@
+@@ -3624,7 +3624,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1356,7 +1367,7 @@
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 1048576
-@@ -3674,7 +3674,7 @@
+@@ -3684,7 +3684,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME THREAD_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1365,7 +1376,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -3757,7 +3757,7 @@
+@@ -3767,7 +3767,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 1024
@@ -1374,7 +1385,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3767,7 +3767,7 @@
+@@ -3777,7 +3777,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
NUMERIC_MIN_VALUE 0
@@ -1383,7 +1394,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3777,14 +3777,14 @@
+@@ -3787,14 +3787,14 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 0
@@ -1400,7 +1411,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -3794,7 +3794,7 @@
+@@ -3804,7 +3804,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TRANSACTION_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1409,7 +1420,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -3934,7 +3934,7 @@
+@@ -3944,7 +3944,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME WAIT_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -1418,7 +1429,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -3961,7 +3961,7 @@
+@@ -3971,7 +3971,7 @@
VARIABLE_NAME LOG_TC_SIZE
GLOBAL_VALUE_ORIGIN AUTO
VARIABLE_SCOPE GLOBAL
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 48eb32e9..96e1c92c 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -1785,7 +1785,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_WARNINGS
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity
+VARIABLE_COMMENT Log some non critical warnings to the error log.Value can be between 0 and 11. Higher values mean more verbosity
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -2299,7 +2299,7 @@ VARIABLE_COMMENT Used to emulate old behavior from earlier MariaDB or MySQL vers
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM
+ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM,NO_NULL_COLLATION_IDS
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OLD_PASSWORDS
@@ -2322,6 +2322,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT 0 = No changes. 1 = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. 2 = Remove 'max_seek optimization' for secondary keys and slight adjustment of filter cost. This option will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer.
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 2
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
index b23840af..a3f9acf3 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff
@@ -1,3 +1,5 @@
+--- sysvars_server_notembedded.result 2024-01-28 17:50:35.442241137 +0100
++++ sysvars_server_notembedded,32bit.result 2024-01-28 17:51:20.662078993 +0100
@@ -44,7 +44,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_BLOCK_SIZE
@@ -429,7 +431,7 @@
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity
+ VARIABLE_COMMENT Log some non critical warnings to the error log.Value can be between 0 and 11. Higher values mean more verbosity
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -1994,7 +1994,7 @@
@@ -722,6 +724,15 @@
NUMERIC_MAX_VALUE 4294967295
@@ -2494,7 +2494,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT 0 = No changes. 1 = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. 2 = Remove 'max_seek optimization' for secondary keys and slight adjustment of filter cost. This option will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -2504,7 +2504,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
@@ -729,7 +740,7 @@
VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try aggressively prune away the search space.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 62
-@@ -2504,7 +2504,7 @@
+@@ -2514,7 +2514,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_MAX_SEL_ARGS
VARIABLE_SCOPE SESSION
@@ -738,7 +749,7 @@
VARIABLE_COMMENT The maximum number of SEL_ARG objects created when optimizing a range. If more objects would be needed, the range will not be used by the optimizer.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2514,7 +2514,7 @@
+@@ -2524,7 +2524,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT
VARIABLE_SCOPE SESSION
@@ -747,7 +758,7 @@
VARIABLE_COMMENT The maximum weight of the SEL_ARG graph. Set to 0 for no limit
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -2524,7 +2524,7 @@
+@@ -2534,7 +2534,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_PRUNE_LEVEL
VARIABLE_SCOPE SESSION
@@ -756,7 +767,7 @@
VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search: 1 - prune plans based on cost and number of retrieved rows eq_ref: 2 - prune also if we find an eq_ref chain
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -2534,7 +2534,7 @@
+@@ -2544,7 +2544,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH
VARIABLE_SCOPE SESSION
@@ -765,7 +776,7 @@
VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 62
-@@ -2544,7 +2544,7 @@
+@@ -2554,7 +2554,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT
VARIABLE_SCOPE SESSION
@@ -774,7 +785,7 @@
VARIABLE_COMMENT Controls number of record samples to check condition selectivity
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 4294967295
-@@ -2574,17 +2574,17 @@
+@@ -2584,17 +2584,17 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE
VARIABLE_SCOPE SESSION
@@ -795,7 +806,7 @@
VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5
-@@ -2604,7 +2604,7 @@
+@@ -2614,7 +2614,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -804,7 +815,7 @@
VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2614,7 +2614,7 @@
+@@ -2624,7 +2624,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -813,7 +824,7 @@
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2624,7 +2624,7 @@
+@@ -2634,7 +2634,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -822,7 +833,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2634,7 +2634,7 @@
+@@ -2644,7 +2644,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -831,7 +842,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2644,7 +2644,7 @@
+@@ -2654,7 +2654,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -840,7 +851,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2654,7 +2654,7 @@
+@@ -2664,7 +2664,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -849,7 +860,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2664,7 +2664,7 @@
+@@ -2674,7 +2674,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -858,7 +869,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2674,7 +2674,7 @@
+@@ -2684,7 +2684,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -867,7 +878,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2684,7 +2684,7 @@
+@@ -2694,7 +2694,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
VARIABLE_SCOPE GLOBAL
@@ -876,7 +887,7 @@
VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2694,7 +2694,7 @@
+@@ -2704,7 +2704,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
VARIABLE_SCOPE GLOBAL
@@ -885,7 +896,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2704,7 +2704,7 @@
+@@ -2714,7 +2714,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -894,7 +905,7 @@
VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2714,7 +2714,7 @@
+@@ -2724,7 +2724,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -903,7 +914,7 @@
VARIABLE_COMMENT Maximum number of condition instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2724,7 +2724,7 @@
+@@ -2734,7 +2734,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -912,7 +923,7 @@
VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2734,7 +2734,7 @@
+@@ -2744,7 +2744,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
VARIABLE_SCOPE GLOBAL
@@ -921,7 +932,7 @@
VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2744,7 +2744,7 @@
+@@ -2754,7 +2754,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -930,7 +941,7 @@
VARIABLE_COMMENT Maximum number of file instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2754,7 +2754,7 @@
+@@ -2764,7 +2764,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -939,7 +950,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented files.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2764,7 +2764,7 @@
+@@ -2774,7 +2774,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -948,7 +959,7 @@
VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2774,7 +2774,7 @@
+@@ -2784,7 +2784,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_INDEX_STAT
VARIABLE_SCOPE GLOBAL
@@ -957,7 +968,7 @@
VARIABLE_COMMENT Maximum number of index statistics for instrumented tables. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2784,7 +2784,7 @@
+@@ -2794,7 +2794,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MEMORY_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -966,7 +977,7 @@
VARIABLE_COMMENT Maximum number of memory pool instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
-@@ -2794,7 +2794,7 @@
+@@ -2804,7 +2804,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_METADATA_LOCKS
VARIABLE_SCOPE GLOBAL
@@ -975,7 +986,7 @@
VARIABLE_COMMENT Maximum number of metadata locks. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2804,7 +2804,7 @@
+@@ -2814,7 +2814,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -984,7 +995,7 @@
VARIABLE_COMMENT Maximum number of mutex instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2814,7 +2814,7 @@
+@@ -2824,7 +2824,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -993,7 +1004,7 @@
VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2824,7 +2824,7 @@
+@@ -2834,7 +2834,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PREPARED_STATEMENTS_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1002,7 +1013,7 @@
VARIABLE_COMMENT Maximum number of instrumented prepared statements. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2834,7 +2834,7 @@
+@@ -2844,7 +2844,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PROGRAM_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1011,7 +1022,7 @@
VARIABLE_COMMENT Maximum number of instrumented programs. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2844,7 +2844,7 @@
+@@ -2854,7 +2854,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1020,7 +1031,7 @@
VARIABLE_COMMENT Maximum number of rwlock instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2854,7 +2854,7 @@
+@@ -2864,7 +2864,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1029,7 +1040,7 @@
VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 104857600
-@@ -2864,7 +2864,7 @@
+@@ -2874,7 +2874,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1038,7 +1049,7 @@
VARIABLE_COMMENT Maximum number of socket instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2874,7 +2874,7 @@
+@@ -2884,7 +2884,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1047,7 +1058,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2884,7 +2884,7 @@
+@@ -2894,7 +2894,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SQL_TEXT_LENGTH
VARIABLE_SCOPE GLOBAL
@@ -1056,7 +1067,7 @@
VARIABLE_COMMENT Maximum length of displayed sql text.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1048576
-@@ -2894,7 +2894,7 @@
+@@ -2904,7 +2904,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1065,7 +1076,7 @@
VARIABLE_COMMENT Maximum number of stage instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2904,7 +2904,7 @@
+@@ -2914,7 +2914,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1074,7 +1085,7 @@
VARIABLE_COMMENT Maximum number of statement instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2914,7 +2914,7 @@
+@@ -2924,7 +2924,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_STACK
VARIABLE_SCOPE GLOBAL
@@ -1083,7 +1094,7 @@
VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_CURRENT.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 256
-@@ -2924,7 +2924,7 @@
+@@ -2934,7 +2934,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
VARIABLE_SCOPE GLOBAL
@@ -1092,7 +1103,7 @@
VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2934,7 +2934,7 @@
+@@ -2944,7 +2944,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1101,7 +1112,7 @@
VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2944,7 +2944,7 @@
+@@ -2954,7 +2954,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_LOCK_STAT
VARIABLE_SCOPE GLOBAL
@@ -1110,7 +1121,7 @@
VARIABLE_COMMENT Maximum number of lock statistics for instrumented tables. Use 0 to disable, -1 for automated scaling.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2954,7 +2954,7 @@
+@@ -2964,7 +2964,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
VARIABLE_SCOPE GLOBAL
@@ -1119,7 +1130,7 @@
VARIABLE_COMMENT Maximum number of thread instruments.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 256
-@@ -2964,7 +2964,7 @@
+@@ -2974,7 +2974,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
VARIABLE_SCOPE GLOBAL
@@ -1128,7 +1139,7 @@
VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2974,7 +2974,7 @@
+@@ -2984,7 +2984,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1137,7 +1148,7 @@
VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -2984,7 +2984,7 @@
+@@ -2994,7 +2994,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1146,7 +1157,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1024
-@@ -2994,7 +2994,7 @@
+@@ -3004,7 +3004,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1155,7 +1166,7 @@
VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -3004,7 +3004,7 @@
+@@ -3014,7 +3014,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1164,7 +1175,7 @@
VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
NUMERIC_MAX_VALUE 1048576
-@@ -3054,7 +3054,7 @@
+@@ -3064,7 +3064,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PRELOAD_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1173,7 +1184,7 @@
VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3074,7 +3074,7 @@
+@@ -3084,7 +3084,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME PROFILING_HISTORY_SIZE
VARIABLE_SCOPE SESSION
@@ -1182,7 +1193,7 @@
VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
-@@ -3084,7 +3084,7 @@
+@@ -3094,7 +3094,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PROGRESS_REPORT_TIME
VARIABLE_SCOPE SESSION
@@ -1191,7 +1202,7 @@
VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3144,7 +3144,7 @@
+@@ -3154,7 +3154,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE
VARIABLE_SCOPE SESSION
@@ -1200,7 +1211,7 @@
VARIABLE_COMMENT Allocation block size for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3154,7 +3154,7 @@
+@@ -3164,7 +3164,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1209,7 +1220,7 @@
VARIABLE_COMMENT Don't cache results that are bigger than this
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3164,7 +3164,7 @@
+@@ -3174,7 +3174,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT
VARIABLE_SCOPE GLOBAL
@@ -1218,7 +1229,7 @@
VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3177,7 +3177,7 @@
+@@ -3187,7 +3187,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The memory allocated to store results from old queries
NUMERIC_MIN_VALUE 0
@@ -1227,7 +1238,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3214,7 +3214,7 @@
+@@ -3224,7 +3224,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME QUERY_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1236,7 +1247,7 @@
VARIABLE_COMMENT Persistent buffer for query parsing and execution
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294967295
-@@ -3227,7 +3227,7 @@
+@@ -3237,7 +3237,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1245,7 +1256,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3237,14 +3237,14 @@
+@@ -3247,14 +3247,14 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1262,7 +1273,7 @@
VARIABLE_COMMENT Allocation block size for storing ranges during optimization
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 4294967295
-@@ -3257,14 +3257,14 @@
+@@ -3267,14 +3267,14 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit)
NUMERIC_MIN_VALUE 0
@@ -1279,7 +1290,7 @@
VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value
NUMERIC_MIN_VALUE 8192
NUMERIC_MAX_VALUE 2147483647
-@@ -3284,7 +3284,7 @@
+@@ -3294,7 +3294,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME READ_RND_BUFFER_SIZE
VARIABLE_SCOPE SESSION
@@ -1288,7 +1299,7 @@
VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 2147483647
-@@ -3504,10 +3504,10 @@
+@@ -3514,10 +3514,10 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME ROWID_MERGE_BUFF_SIZE
VARIABLE_SCOPE SESSION
@@ -1301,7 +1312,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3524,20 +3524,20 @@
+@@ -3534,20 +3534,20 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME RPL_SEMI_SYNC_MASTER_TIMEOUT
VARIABLE_SCOPE GLOBAL
@@ -1326,7 +1337,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3594,10 +3594,10 @@
+@@ -3604,10 +3604,10 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME RPL_SEMI_SYNC_SLAVE_TRACE_LEVEL
VARIABLE_SCOPE GLOBAL
@@ -1339,7 +1350,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -3634,7 +3634,7 @@
+@@ -3644,7 +3644,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SERVER_ID
VARIABLE_SCOPE SESSION
@@ -1348,7 +1359,7 @@
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -3774,7 +3774,7 @@
+@@ -3784,7 +3784,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_DOMAIN_PARALLEL_THREADS
VARIABLE_SCOPE GLOBAL
@@ -1357,7 +1368,7 @@
VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16383
-@@ -3804,7 +3804,7 @@
+@@ -3814,7 +3814,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET
VARIABLE_SCOPE GLOBAL
@@ -1366,7 +1377,7 @@
VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 1073741824
-@@ -3834,7 +3834,7 @@
+@@ -3844,7 +3844,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_PARALLEL_MAX_QUEUED
VARIABLE_SCOPE GLOBAL
@@ -1375,7 +1386,7 @@
VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2147483647
-@@ -3854,7 +3854,7 @@
+@@ -3864,7 +3864,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME SLAVE_PARALLEL_THREADS
VARIABLE_SCOPE GLOBAL
@@ -1384,7 +1395,7 @@
VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16383
-@@ -3864,7 +3864,7 @@
+@@ -3874,7 +3874,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_PARALLEL_WORKERS
VARIABLE_SCOPE GLOBAL
@@ -1393,7 +1404,7 @@
VARIABLE_COMMENT Alias for slave_parallel_threads
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16383
-@@ -3904,7 +3904,7 @@
+@@ -3914,7 +3914,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME SLAVE_TRANSACTION_RETRIES
VARIABLE_SCOPE GLOBAL
@@ -1402,7 +1413,7 @@
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -3924,7 +3924,7 @@
+@@ -3934,7 +3934,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL
VARIABLE_SCOPE GLOBAL
@@ -1411,7 +1422,7 @@
VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3600
-@@ -3944,7 +3944,7 @@
+@@ -3954,7 +3954,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLOW_LAUNCH_TIME
VARIABLE_SCOPE GLOBAL
@@ -1420,7 +1431,7 @@
VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
-@@ -3987,7 +3987,7 @@
+@@ -3997,7 +3997,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1429,7 +1440,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4214,7 +4214,7 @@
+@@ -4224,7 +4224,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME STORED_PROGRAM_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1438,7 +1449,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
-@@ -4324,7 +4324,7 @@
+@@ -4334,7 +4334,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME TABLE_DEFINITION_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1447,7 +1458,7 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 2097152
-@@ -4334,7 +4334,7 @@
+@@ -4344,7 +4344,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
VARIABLE_SCOPE GLOBAL
@@ -1456,7 +1467,7 @@
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 1048576
-@@ -4394,7 +4394,7 @@
+@@ -4404,7 +4404,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME THREAD_CACHE_SIZE
VARIABLE_SCOPE GLOBAL
@@ -1465,7 +1476,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
-@@ -4567,7 +4567,7 @@
+@@ -4577,7 +4577,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 1024
@@ -1474,7 +1485,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4577,7 +4577,7 @@
+@@ -4587,7 +4587,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
NUMERIC_MIN_VALUE 0
@@ -1483,7 +1494,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -4587,14 +4587,14 @@
+@@ -4597,14 +4597,14 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 0
@@ -1500,7 +1511,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4604,7 +4604,7 @@
+@@ -4614,7 +4614,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TRANSACTION_PREALLOC_SIZE
VARIABLE_SCOPE SESSION
@@ -1509,7 +1520,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
-@@ -4744,7 +4744,7 @@
+@@ -4754,7 +4754,7 @@
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME WAIT_TIMEOUT
VARIABLE_SCOPE SESSION
@@ -1518,7 +1529,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
-@@ -4771,7 +4771,7 @@
+@@ -4781,7 +4781,7 @@
VARIABLE_NAME LOG_TC_SIZE
GLOBAL_VALUE_ORIGIN AUTO
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff
new file mode 100644
index 00000000..acee8a39
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff
@@ -0,0 +1,1465 @@
+--- suite/sys_vars/r/sysvars_server_notembedded.result
++++ suite/sys_vars/r/sysvars_server_notembedded.reject
+@@ -34,7 +34,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_BLOCK_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Block size to be used for Aria index pages.
+ NUMERIC_MIN_VALUE 4096
+ NUMERIC_MAX_VALUE 32768
+@@ -44,7 +44,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_CHECKPOINT_INTERVAL
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Interval between tries to do an automatic checkpoints. In seconds; 0 means 'no automatic checkpoints' which makes sense only for testing.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -54,7 +54,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_CHECKPOINT_LOG_ACTIVITY
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of bytes that the transaction log has to grow between checkpoints before a new checkpoint is written to the log.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -74,7 +74,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 255
+@@ -94,7 +94,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_GROUP_COMMIT_INTERVAL
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Interval between commits in microseconds (1/1000000 sec). 0 stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect if aria_group_commit is used
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -114,7 +114,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_LOG_FILE_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Limit for transaction log size
+ NUMERIC_MIN_VALUE 8388608
+ NUMERIC_MAX_VALUE 4294967295
+@@ -144,10 +144,10 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_PAGECACHE_AGE_THRESHOLD
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in the page cache.
+ NUMERIC_MIN_VALUE 100
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 100
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -164,7 +164,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_PAGECACHE_DIVISION_LIMIT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The minimum percentage of warm blocks in key cache
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 100
+@@ -174,7 +174,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME ARIA_PAGECACHE_FILE_HASH_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of Aria files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open Aria files.
+ NUMERIC_MIN_VALUE 128
+ NUMERIC_MAX_VALUE 16384
+@@ -204,7 +204,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME ARIA_REPAIR_THREADS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 128
+@@ -274,7 +274,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME AUTO_INCREMENT_INCREMENT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Auto-increment columns are incremented by this
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 65535
+@@ -284,7 +284,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME AUTO_INCREMENT_OFFSET
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Offset added to Auto-increment columns. Used when auto-increment-increment != 1
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 65535
+@@ -294,7 +294,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME BACK_LOG
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MariaDB thread gets very many connection requests in a very short time
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 65535
+@@ -364,20 +364,20 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME BINLOG_COMMIT_WAIT_COUNT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If non-zero, binlog write will wait at most binlog_commit_wait_usec microseconds for at least this many commits to queue up for group commit to the binlog. This can reduce I/O on the binlog and provide increased opportunity for parallel apply on the slave, but too high a value will decrease commit throughput.
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME BINLOG_COMMIT_WAIT_USEC
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum time, in microseconds, to wait for more commits to queue up for binlog group commit. Only takes effect if the value of binlog_commit_wait_count is non-zero.
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -394,7 +394,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME BINLOG_EXPIRE_LOGS_SECONDS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 8553600
+@@ -654,7 +654,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME CONNECT_TIMEOUT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'
+ NUMERIC_MIN_VALUE 2
+ NUMERIC_MAX_VALUE 31536000
+@@ -704,7 +704,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_LONG
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Long search depth for the two-step deadlock detection
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 33
+@@ -714,7 +714,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_SHORT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Short search depth for the two-step deadlock detection
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 32
+@@ -724,7 +724,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DEADLOCK_TIMEOUT_LONG
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds)
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -734,7 +734,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DEADLOCK_TIMEOUT_SHORT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds)
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -794,7 +794,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME DEFAULT_WEEK_FORMAT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The default week format used by WEEK() functions
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 7
+@@ -804,7 +804,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DELAYED_INSERT_LIMIT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -814,7 +814,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DELAYED_INSERT_TIMEOUT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 31536000
+@@ -824,7 +824,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME DELAYED_QUEUE_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -854,7 +854,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME DIV_PRECISION_INCREMENT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 38
+@@ -974,7 +974,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME EXTRA_MAX_CONNECTIONS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of connections on extra-port
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 100000
+@@ -1004,7 +1004,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME FLUSH_TIME
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 31536000
+@@ -1034,7 +1034,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME FT_MAX_WORD_LEN
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable
+ NUMERIC_MIN_VALUE 10
+ NUMERIC_MAX_VALUE 84
+@@ -1044,7 +1044,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME FT_MIN_WORD_LEN
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 84
+@@ -1054,7 +1054,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME FT_QUERY_EXPANSION_LIMIT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of best matches to use for query expansion
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000
+@@ -1304,7 +1304,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME HISTOGRAM_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 255
+@@ -1334,7 +1334,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME HOST_CACHE_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT How many host names should be cached to avoid resolving.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 65536
+@@ -1357,7 +1357,7 @@
+ VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of seconds the server waits for read-only idle transaction
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 31536000
++NUMERIC_MAX_VALUE 2147483
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1367,7 +1367,7 @@
+ VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of seconds the server waits for idle transaction
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 31536000
++NUMERIC_MAX_VALUE 2147483
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1377,7 +1377,7 @@
+ VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of seconds the server waits for write idle transaction
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 31536000
++NUMERIC_MAX_VALUE 2147483
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1444,7 +1444,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME INTERACTIVE_TIMEOUT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 31536000
+@@ -1494,7 +1494,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME JOIN_CACHE_LEVEL
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 8
+@@ -1672,19 +1672,9 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
+-VARIABLE_NAME LOCKED_IN_MEMORY
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT Whether mysqld was locked in memory with --memlock
+-NUMERIC_MIN_VALUE NULL
+-NUMERIC_MAX_VALUE NULL
+-NUMERIC_BLOCK_SIZE NULL
+-ENUM_VALUE_LIST OFF,ON
+-READ_ONLY YES
+-COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME LOCK_WAIT_TIMEOUT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 31536000
+@@ -1834,7 +1824,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME LOG_SLOW_MAX_WARNINGS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Max numbers of warnings printed to slow query log per statement
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000
+@@ -1844,7 +1834,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME LOG_SLOW_RATE_LIMIT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -1874,7 +1864,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME LOG_WARNINGS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Log some non critical warnings to the error log.Value can be between 0 and 11. Higher values mean more verbosity
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -1934,7 +1924,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME MAX_ALLOWED_PACKET
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Max packet length to send to or receive from the server
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 1073741824
+@@ -1954,7 +1944,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_BINLOG_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value.
+ NUMERIC_MIN_VALUE 4096
+ NUMERIC_MAX_VALUE 1073741824
+@@ -1974,7 +1964,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_CONNECTIONS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of simultaneous clients allowed
+ NUMERIC_MIN_VALUE 10
+ NUMERIC_MAX_VALUE 100000
+@@ -1984,7 +1974,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_CONNECT_ERRORS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -1994,7 +1984,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_DELAYED_THREADS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16384
+@@ -2014,7 +2004,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_ERROR_COUNT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Max number of errors/warnings to store for a statement
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 65535
+@@ -2034,7 +2024,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_INSERT_DELAYED_THREADS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16384
+@@ -2054,7 +2044,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_LENGTH_FOR_SORT_DATA
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Max number of bytes in sorted records
+ NUMERIC_MIN_VALUE 4
+ NUMERIC_MAX_VALUE 8388608
+@@ -2084,7 +2074,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_RECURSIVE_ITERATIONS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of iterations when executing recursive queries
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2114,7 +2104,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_SEEKS_FOR_KEY
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2134,7 +2124,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_SORT_LENGTH
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored)
+ NUMERIC_MIN_VALUE 64
+ NUMERIC_MAX_VALUE 8388608
+@@ -2144,7 +2134,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_SP_RECURSION_DEPTH
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum stored procedure recursion depth
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 255
+@@ -2164,7 +2154,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_TMP_TABLES
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Unused, will be removed.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2184,7 +2174,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MAX_WRITE_LOCK_COUNT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2194,7 +2184,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME METADATA_LOCKS_CACHE_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Unused
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2204,7 +2194,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME METADATA_LOCKS_HASH_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Unused
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1024
+@@ -2214,7 +2204,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2224,7 +2214,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MRR_BUFFER_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Size of buffer to use when using MRR with range access
+ NUMERIC_MIN_VALUE 8192
+ NUMERIC_MAX_VALUE 2147483647
+@@ -2234,7 +2224,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MYISAM_BLOCK_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Block size to be used for MyISAM index pages
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 16384
+@@ -2244,7 +2234,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME MYISAM_DATA_POINTER_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables
+ NUMERIC_MIN_VALUE 2
+ NUMERIC_MAX_VALUE 7
+@@ -2284,10 +2274,10 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME MYISAM_REPAIR_THREADS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If larger than 1, when repairing a MyISAM table all indexes will be created in parallel, with one thread per index. The value of 1 disables parallel repair
+ NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -2332,9 +2322,19 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME NAMED_PIPE
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Enable the named pipe (NT)
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME NET_BUFFER_LENGTH
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 1048576
+@@ -2344,7 +2344,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME NET_READ_TIMEOUT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 31536000
+@@ -2354,7 +2354,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME NET_RETRY_COUNT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2364,7 +2364,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME NET_WRITE_TIMEOUT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 31536000
+@@ -2424,7 +2424,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME OPEN_FILES_LIMIT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2434,7 +2434,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT 0 = No changes. 1 = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. 2 = Remove 'max_seek optimization' for secondary keys and slight adjustment of filter cost. This option will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -2444,7 +2444,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_MAX_SEL_ARGS
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The maximum number of SEL_ARG objects created when optimizing a range. If more objects would be needed, the range will not be used by the optimizer.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2454,7 +2454,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The maximum weight of the SEL_ARG graph. Set to 0 for no limit
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2464,7 +2464,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_PRUNE_LEVEL
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1
+@@ -2474,7 +2474,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 62
+@@ -2484,7 +2484,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Controls number of record samples to check condition selectivity
+ NUMERIC_MIN_VALUE 10
+ NUMERIC_MAX_VALUE 4294967295
+@@ -2514,17 +2514,17 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum allowed size of an optimizer trace
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME OPTIMIZER_USE_CONDITION_SELECTIVITY
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 5
+@@ -2544,7 +2544,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2554,7 +2554,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2564,7 +2564,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2574,7 +2574,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1024
+@@ -2584,7 +2584,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2594,7 +2594,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1024
+@@ -2604,7 +2604,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_LONG_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2614,7 +2614,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1024
+@@ -2624,7 +2624,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2634,7 +2634,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1024
+@@ -2644,7 +2644,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2654,7 +2654,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of condition instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2664,7 +2664,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2674,7 +2674,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1048576
+@@ -2684,7 +2684,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of file instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2694,7 +2694,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of opened instrumented files.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1048576
+@@ -2704,7 +2704,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2714,7 +2714,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_INDEX_STAT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of index statistics for instrumented tables. Use 0 to disable, -1 for automated scaling.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2724,7 +2724,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MEMORY_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of memory pool instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1024
+@@ -2734,7 +2734,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_METADATA_LOCKS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of metadata locks. Use 0 to disable, -1 for automated scaling.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 104857600
+@@ -2744,7 +2744,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of mutex instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2754,7 +2754,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 104857600
+@@ -2764,7 +2764,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PREPARED_STATEMENTS_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented prepared statements. Use 0 to disable, -1 for automated scaling.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2774,7 +2774,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PROGRAM_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented programs. Use 0 to disable, -1 for automated scaling.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2784,7 +2784,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of rwlock instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2794,7 +2794,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 104857600
+@@ -2804,7 +2804,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of socket instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2814,7 +2814,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2824,7 +2824,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SQL_TEXT_LENGTH
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum length of displayed sql text.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1048576
+@@ -2834,7 +2834,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of stage instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2844,7 +2844,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of statement instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2854,7 +2854,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_STACK
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_CURRENT.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 256
+@@ -2864,7 +2864,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2874,7 +2874,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2884,7 +2884,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_LOCK_STAT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of lock statistics for instrumented tables. Use 0 to disable, -1 for automated scaling.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2894,7 +2894,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of thread instruments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 256
+@@ -2904,7 +2904,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2914,7 +2914,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2924,7 +2924,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1024
+@@ -2934,7 +2934,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2944,7 +2944,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing.
+ NUMERIC_MIN_VALUE -1
+ NUMERIC_MAX_VALUE 1048576
+@@ -2994,7 +2994,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PRELOAD_BUFFER_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 1073741824
+@@ -3014,7 +3014,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME PROFILING_HISTORY_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 100
+@@ -3024,7 +3024,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME PROGRESS_REPORT_TIME
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3084,7 +3084,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Allocation block size for query parsing and execution
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3094,7 +3094,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME QUERY_CACHE_LIMIT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Don't cache results that are bigger than this
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3104,7 +3104,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3117,7 +3117,7 @@
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT The memory allocated to store results from old queries
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1024
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -3154,7 +3154,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME QUERY_PREALLOC_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Persistent buffer for query parsing and execution
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3167,7 +3167,7 @@
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -3177,14 +3177,14 @@
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME RANGE_ALLOC_BLOCK_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Allocation block size for storing ranges during optimization
+ NUMERIC_MIN_VALUE 4096
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3197,14 +3197,14 @@
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME READ_BUFFER_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value
+ NUMERIC_MIN_VALUE 8192
+ NUMERIC_MAX_VALUE 2147483647
+@@ -3224,7 +3224,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME READ_RND_BUFFER_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 2147483647
+@@ -3434,10 +3434,10 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME ROWID_MERGE_BUFF_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The size of the buffers used [NOT] IN evaluation via partial matching
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -3454,20 +3454,20 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME RPL_SEMI_SYNC_MASTER_TIMEOUT
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The timeout value (in ms) for semi-synchronous replication in the master
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME RPL_SEMI_SYNC_MASTER_TRACE_LEVEL
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The tracing level for semi-sync replication.
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -3524,10 +3524,10 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME RPL_SEMI_SYNC_SLAVE_TRACE_LEVEL
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The tracing level for semi-sync replication.
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -3564,7 +3564,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SERVER_ID
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3694,7 +3694,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SLAVE_DOMAIN_PARALLEL_THREADS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16383
+@@ -3724,7 +3724,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave.
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 1073741824
+@@ -3744,7 +3744,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SLAVE_PARALLEL_MAX_QUEUED
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2147483647
+@@ -3764,7 +3764,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME SLAVE_PARALLEL_THREADS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16383
+@@ -3774,7 +3774,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SLAVE_PARALLEL_WORKERS
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Alias for slave_parallel_threads
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16383
+@@ -3814,7 +3814,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME SLAVE_TRANSACTION_RETRIES
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -3834,7 +3834,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 3600
+@@ -3854,7 +3854,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME SLOW_LAUNCH_TIME
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 31536000
+@@ -4124,7 +4124,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME STORED_PROGRAM_CACHE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 524288
+@@ -4224,7 +4224,7 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME TABLE_DEFINITION_CACHE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of cached table definitions
+ NUMERIC_MIN_VALUE 400
+ NUMERIC_MAX_VALUE 2097152
+@@ -4234,7 +4234,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME TABLE_OPEN_CACHE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of cached open tables
+ NUMERIC_MIN_VALUE 10
+ NUMERIC_MAX_VALUE 1048576
+@@ -4294,7 +4294,7 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME THREAD_CACHE_SIZE
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16384
+@@ -4352,6 +4352,26 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME THREAD_POOL_MIN_THREADS
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Minimum number of threads in the thread pool.
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 256
++NUMERIC_BLOCK_SIZE 1
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME THREAD_POOL_MODE
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT Chose implementation of the threadpool
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST windows,generic
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME THREAD_POOL_OVERSUBSCRIBE
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE INT UNSIGNED
+@@ -4455,7 +4475,7 @@
+ VARIABLE_NAME TMPDIR
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE VARCHAR
+-VARIABLE_COMMENT Path for temporary files. Several paths may be specified, separated by a colon (:), in this case they are used in a round-robin fashion
++VARIABLE_COMMENT Path for temporary files. Several paths may be specified, separated by a semicolon (;), in this case they are used in a round-robin fashion
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -4494,7 +4514,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME TRANSACTION_ALLOC_BLOCK_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 134217728
+@@ -4504,7 +4524,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME TRANSACTION_PREALLOC_SIZE
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
+ NUMERIC_MIN_VALUE 1024
+ NUMERIC_MAX_VALUE 134217728
+@@ -4644,10 +4664,10 @@
+ COMMAND_LINE_ARGUMENT NULL
+ VARIABLE_NAME WAIT_TIMEOUT
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
+ NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 31536000
++NUMERIC_MAX_VALUE 2147483
+ NUMERIC_BLOCK_SIZE 1
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -4671,7 +4691,7 @@
+ VARIABLE_NAME LOG_TC_SIZE
+ GLOBAL_VALUE_ORIGIN AUTO
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Size of transaction coordinator log.
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
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 6cb55630..4e79d858 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -1935,7 +1935,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_WARNINGS
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity
+VARIABLE_COMMENT Log some non critical warnings to the error log.Value can be between 0 and 11. Higher values mean more verbosity
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
@@ -2469,7 +2469,7 @@ VARIABLE_COMMENT Used to emulate old behavior from earlier MariaDB or MySQL vers
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM
+ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM,NO_NULL_COLLATION_IDS
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OLD_PASSWORDS
@@ -2492,6 +2492,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS
+VARIABLE_SCOPE SESSION
+VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_COMMENT 0 = No changes. 1 = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. 2 = Remove 'max_seek optimization' for secondary keys and slight adjustment of filter cost. This option will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer.
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 2
+NUMERIC_BLOCK_SIZE 1
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
@@ -3545,7 +3555,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME RPL_SEMI_SYNC_MASTER_WAIT_NO_SLAVE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Wait until timeout when no semi-synchronous replication slave available (enabled by default).
+VARIABLE_COMMENT Wait until timeout when no semi-synchronous replication slave is available.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
diff --git a/mysql-test/suite/sys_vars/t/old_mode_basic.test b/mysql-test/suite/sys_vars/t/old_mode_basic.test
index 631d6387..cb187967 100644
--- a/mysql-test/suite/sys_vars/t/old_mode_basic.test
+++ b/mysql-test/suite/sys_vars/t/old_mode_basic.test
@@ -172,7 +172,7 @@ SET @@global.old_mode = 4;
SELECT @@global.old_mode;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.old_mode = 64;
+SET @@global.old_mode = 128;
SELECT @@global.old_mode;
# use of decimal values
diff --git a/mysql-test/suite/sys_vars/t/pseudo_slave_mode_notembedded.test b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_notembedded.test
new file mode 100644
index 00000000..c18872db
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_notembedded.test
@@ -0,0 +1,20 @@
+--source include/not_embedded.inc
+--source include/load_sysvars.inc
+
+--echo '### MDEV-32844: THD::rli_fake/rgi_fake not cleared on new connection'
+--connect(con1,localhost,root,,)
+BINLOG '
+6ENbZQ8BAAAA/AAAAAABAAAAAAQAMTAuMTEuNi1NYXJpYURCLWRlYnVnLWxvZwAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAADoQ1tlEzgNAAgAEgAEBAQEEgAA5AAEGggAAAAICAgCAAAACgoKAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAEEwQADQgICAoKCgGbvv33
+';
+--disconnect con1
+--connect(con1,localhost,root,,)
+# The bug was that the THD::rli_fake was not cleared when the THD is re-used
+# for the new connection, and we would get a warning from the following
+# statement.
+SET SESSION pseudo_slave_mode= 1;
+--disconnect con1
+--connection default
diff --git a/mysql-test/suite/sys_vars/t/sysvars_star.test b/mysql-test/suite/sys_vars/t/sysvars_star.test
index 8d0aefdc..f1d1c137 100644
--- a/mysql-test/suite/sys_vars/t/sysvars_star.test
+++ b/mysql-test/suite/sys_vars/t/sysvars_star.test
@@ -15,7 +15,7 @@ set global low_priority_updates=1;
install soname 'sql_errlog';
vertical_results;
-replace_regex /\/.*\//var\//;
+replace_regex /(C:)?\/.*\//var\//;
select * from information_schema.system_variables
where variable_name in (
'completion_type', #session!=global, origin=compile-time
@@ -32,7 +32,7 @@ create user foo@localhost;
connect foo,localhost,foo;
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
connection default;
-replace_regex /\/.*\//var\//;
+replace_regex /(C:)?\/.*\//var\//;
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
disconnect foo;
drop user foo@localhost;
diff --git a/mysql-test/suite/vcol/r/partition.result b/mysql-test/suite/vcol/r/partition.result
index d7c5052b..74c1e3bf 100644
--- a/mysql-test/suite/vcol/r/partition.result
+++ b/mysql-test/suite/vcol/r/partition.result
@@ -101,3 +101,25 @@ partition pn values less than (maxvalue));
insert into t1 (x, b) values (1, ''), (2, ''), (3, 'a'), (4, 'b');
update t1 set b= 'bar' where x > 0 order by v limit 2;
drop table t1;
+#
+# MDEV-28127 EXCHANGE PARTITION with non-matching vcol expression segfault
+#
+set @old_mode= @@sql_mode;
+set sql_mode='';
+create table t1 (a int, key(a)) partition by range (a) (partition p values less than (1));
+create table t (a int generated always as (1) virtual, key(a));
+alter table t1 exchange partition p with table t;
+ERROR HY000: Tables have different definitions
+create or replace table t (a int, key(a));
+alter table t1 exchange partition p with table t;
+create or replace table t1 (a int generated always as (1) virtual, key(a)) partition by range (a) (partition p values less than (1));
+create or replace table t (a int generated always as (1) virtual, key(a));
+alter table t1 exchange partition p with table t;
+create or replace table t (a int generated always as (1) stored, key(a));
+alter table t1 exchange partition p with table t;
+ERROR HY000: Tables have different definitions
+insert into t values (1);
+Warnings:
+Warning 1906 The value specified for generated column 'a' in table 't' has been ignored
+drop tables t1, t;
+set sql_mode= @old_mode;
diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result
index 2e15c502..6b86d40e 100644
--- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result
@@ -418,3 +418,40 @@ create or replace table t2 (pk int, b int, c int as (b) virtual, primary key (pk
insert into t2 (pk) select a from t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
drop tables t1, t2;
+#
+# MDEV-23294 Segfault or assertion upon MyISAM repair
+#
+set @old_mode= @@sql_mode;
+set @old_myisam_repair_threads= @@myisam_repair_threads;
+set sql_mode='', myisam_repair_threads=2;
+create table t (a binary,b blob,c blob as (concat (a,b)),h char,index (c)) engine=innodb;
+Warnings:
+Warning 1286 Unknown storage engine 'innodb'
+Warning 1266 Using storage engine MyISAM for table 't'
+Note 1071 Specified key was too long; max key length is 1000 bytes
+insert into t values (0,0,default,0);
+create table ti like t;
+alter table ti engine=myisam;
+insert into ti select * from t;
+Warnings:
+Warning 1906 The value specified for generated column 'c' in table 'ti' has been ignored
+drop tables ti, t;
+create table t (id int,a varchar(1),b varchar(1),c varchar(1) generated always as (concat (a,b)),key(c)) engine=myisam;
+insert into t values (0,0,9687,0);
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+Warning 1906 The value specified for generated column 'c' in table 't' has been ignored
+Warning 1265 Data truncated for column 'c' at row 1
+repair table t quick;
+Table Op Msg_type Msg_text
+test.t repair status OK
+drop table t;
+create table t1 (b varchar(1024), c char(3), unique(b,c)) engine=myisam;
+insert into t1 values ('foo','baz');
+alter table t1 disable keys;
+set session myisam_repair_threads= 2;
+insert into t1 select 'qux';
+ERROR 21S01: Column count doesn't match value count at row 1
+drop table t1;
+set sql_mode= @old_mode;
+set myisam_repair_threads= @old_myisam_repair_threads;
diff --git a/mysql-test/suite/vcol/r/vcol_syntax.result b/mysql-test/suite/vcol/r/vcol_syntax.result
index 7725d59f..1c3a7566 100644
--- a/mysql-test/suite/vcol/r/vcol_syntax.result
+++ b/mysql-test/suite/vcol/r/vcol_syntax.result
@@ -238,3 +238,13 @@ Warning 1292 Incorrect datetime value: '1' for column `test`.`t`.`c2` at row 1
Warning 1292 Incorrect datetime value: '0' for column `test`.`t`.`c2` at row 1
drop trigger tr;
drop table t;
+#
+# MDEV-29932 Invalid expr in cleanup_session_expr() upon INSERT DELAYED
+#
+create table t (f timestamp default from_unixtime(1), g timestamp as (from_unixtime(2)));
+insert delayed into t values ();
+flush table t;
+select unix_timestamp(f), unix_timestamp(g) from t;
+unix_timestamp(f) unix_timestamp(g)
+1 2
+drop table t;
diff --git a/mysql-test/suite/vcol/t/partition.test b/mysql-test/suite/vcol/t/partition.test
index 408990b2..019618b0 100644
--- a/mysql-test/suite/vcol/t/partition.test
+++ b/mysql-test/suite/vcol/t/partition.test
@@ -78,3 +78,24 @@ partition by range columns (x) (
insert into t1 (x, b) values (1, ''), (2, ''), (3, 'a'), (4, 'b');
update t1 set b= 'bar' where x > 0 order by v limit 2;
drop table t1;
+
+--echo #
+--echo # MDEV-28127 EXCHANGE PARTITION with non-matching vcol expression segfault
+--echo #
+set @old_mode= @@sql_mode;
+set sql_mode='';
+create table t1 (a int, key(a)) partition by range (a) (partition p values less than (1));
+create table t (a int generated always as (1) virtual, key(a));
+--error ER_TABLES_DIFFERENT_METADATA
+alter table t1 exchange partition p with table t;
+create or replace table t (a int, key(a));
+alter table t1 exchange partition p with table t;
+create or replace table t1 (a int generated always as (1) virtual, key(a)) partition by range (a) (partition p values less than (1));
+create or replace table t (a int generated always as (1) virtual, key(a));
+alter table t1 exchange partition p with table t;
+create or replace table t (a int generated always as (1) stored, key(a));
+--error ER_TABLES_DIFFERENT_METADATA
+alter table t1 exchange partition p with table t;
+insert into t values (1);
+drop tables t1, t;
+set sql_mode= @old_mode;
diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test
index ab75703f..bc8fcbd2 100644
--- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test
+++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test
@@ -313,3 +313,32 @@ create or replace table t2 (pk int, b int, c int as (b) virtual, primary key (pk
--error ER_DUP_ENTRY
insert into t2 (pk) select a from t1;
drop tables t1, t2;
+
+--echo #
+--echo # MDEV-23294 Segfault or assertion upon MyISAM repair
+--echo #
+set @old_mode= @@sql_mode;
+set @old_myisam_repair_threads= @@myisam_repair_threads;
+set sql_mode='', myisam_repair_threads=2;
+create table t (a binary,b blob,c blob as (concat (a,b)),h char,index (c)) engine=innodb;
+insert into t values (0,0,default,0);
+create table ti like t;
+alter table ti engine=myisam;
+insert into ti select * from t;
+drop tables ti, t;
+
+create table t (id int,a varchar(1),b varchar(1),c varchar(1) generated always as (concat (a,b)),key(c)) engine=myisam;
+insert into t values (0,0,9687,0);
+repair table t quick;
+drop table t;
+
+create table t1 (b varchar(1024), c char(3), unique(b,c)) engine=myisam;
+insert into t1 values ('foo','baz');
+alter table t1 disable keys;
+set session myisam_repair_threads= 2;
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+insert into t1 select 'qux';
+# cleanup
+drop table t1;
+set sql_mode= @old_mode;
+set myisam_repair_threads= @old_myisam_repair_threads;
diff --git a/mysql-test/suite/vcol/t/vcol_syntax.test b/mysql-test/suite/vcol/t/vcol_syntax.test
index c26c4897..4f6130a9 100644
--- a/mysql-test/suite/vcol/t/vcol_syntax.test
+++ b/mysql-test/suite/vcol/t/vcol_syntax.test
@@ -187,3 +187,13 @@ insert into t values (1, 1, 1);
drop trigger tr;
drop table t;
+
+--echo #
+--echo # MDEV-29932 Invalid expr in cleanup_session_expr() upon INSERT DELAYED
+--echo #
+create table t (f timestamp default from_unixtime(1), g timestamp as (from_unixtime(2)));
+insert delayed into t values ();
+flush table t;
+select unix_timestamp(f), unix_timestamp(g) from t;
+# Cleanup
+drop table t;
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index 9751f7c7..b3c342fd 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -787,6 +787,68 @@ modify row_start varchar(8);
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `row_start` and `row_end`
drop table t1;
#
+# MDEV-20545 Assertion (col.vers_sys_end()) upon inplace ALTER with virtual columns
+#
+create table t1 (
+a int,
+va int as (a) virtual,
+b int,
+vb int as (b) virtual,
+c int,
+vc int as (c) virtual,
+d int,
+e int,
+index(va)
+) engine=innodb with system versioning;
+replace into t1 () values (),();
+set statement system_versioning_alter_history=keep for alter table t1 drop e;
+alter table t1 algorithm=inplace, drop system versioning;
+drop table t1;
+#
+# MDEV-20765 Assertion (type.vers_sys_end()) upon inplace ALTER with virtual columns
+#
+create table t1 (
+a int,
+b int as (a) virtual,
+c int,
+d int as (c) virtual,
+e int,
+f int as (e) virtual,
+g int,
+h int,
+i int,
+index(d),
+key(h),
+foreign key (g) references t1 (h)
+) engine=innodb with system versioning;
+set system_versioning_alter_history= keep;
+alter table t1 drop column i;
+insert into t1 (g,h) values (1,1);
+drop table t1;
+#
+# MDEV-29034 Assertion (o->ind == vers_start) upon inplace ALTER with virtual columns
+#
+create table b (
+pk integer auto_increment,
+col_int_key integer,
+col_varchar_key varchar(1),
+o bit, n bit,
+h float as ( n + 2 ) virtual,
+v bit,
+primary key (pk),
+key (col_varchar_key, col_int_key)
+) engine = innodb;
+set `system_versioning_alter_history`= keep;
+alter table `b` add system versioning;
+alter table `b` add column if not exists ( w bit, v serial );
+Warnings:
+Note 1060 Duplicate column name 'v'
+alter table `b` add column if not exists ( p bit );
+drop table `b`;
+#
+# End of 10.4 tests
+#
+#
# MDEV-21941 RENAME doesn't work for system time or period fields
#
create or replace table t1 (a int) with system versioning;
@@ -809,4 +871,6 @@ t1 CREATE TABLE `t1` (
PERIOD FOR SYSTEM_TIME (`x`, `y`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
drop table t1;
+#
# End of 10.5 tests
+#
diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result
index 4e8c6f8b..d2ebcd72 100644
--- a/mysql-test/suite/versioning/r/delete_history.result
+++ b/mysql-test/suite/versioning/r/delete_history.result
@@ -193,7 +193,7 @@ drop table t1;
# MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
#
create table t1 (a integer, c0 varchar(255), fulltext key (c0))
-with system versioning engine innodb;
+with system versioning engine innodb stats_persistent=0;
set system_versioning_alter_history= keep;
alter table t1 drop system versioning;
alter table t1 add system versioning;
@@ -203,7 +203,7 @@ InnoDB 0 transactions not purged
delete history from t1;
drop table t1;
create table t1 (id int primary key, ftx varchar(255))
-with system versioning engine innodb;
+with system versioning engine innodb stats_persistent=0;
insert into t1 values (1, 'c');
delete from t1;
alter table t1 add fulltext key(ftx);
diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result
index 90c99d1b..714455b6 100644
--- a/mysql-test/suite/versioning/r/select.result
+++ b/mysql-test/suite/versioning/r/select.result
@@ -443,7 +443,7 @@ create or replace table t1 (x int) with system versioning;
select * from t1 for system_time as of current_timestamp;
x
select * from t1 for system_time as of now;
-ERROR 42S22: Unknown column 'now' in 'FOR SYSTEM_TIME'
+ERROR HY000: Illegal parameter data type now for operation 'FOR SYSTEM_TIME'
### Issue #405, NATURAL JOIN failure
create or replace table t1 (a int) with system versioning;
create or replace table t2 (b int);
@@ -708,3 +708,12 @@ No A B C D
33 1 1 1 1
34 1 1 1 1
SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;
+#
+# MDEV-32082 Server crash in find_field_in_table
+#
+create table t0 (c0 int) with system versioning;
+select x0 from (
+select c0 x0 from t0
+) for system_time as of nowasdf deriv;
+ERROR HY000: Illegal parameter data type nowasdf for operation 'FOR SYSTEM_TIME'
+drop table t0;
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 61653550..44f52ddf 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -680,6 +680,71 @@ alter table t1
# cleanup
drop table t1;
+--echo #
+--echo # MDEV-20545 Assertion (col.vers_sys_end()) upon inplace ALTER with virtual columns
+--echo #
+create table t1 (
+ a int,
+ va int as (a) virtual,
+ b int,
+ vb int as (b) virtual,
+ c int,
+ vc int as (c) virtual,
+ d int,
+ e int,
+ index(va)
+) engine=innodb with system versioning;
+replace into t1 () values (),();
+set statement system_versioning_alter_history=keep for alter table t1 drop e;
+alter table t1 algorithm=inplace, drop system versioning;
+# cleanup
+drop table t1;
+
+--echo #
+--echo # MDEV-20765 Assertion (type.vers_sys_end()) upon inplace ALTER with virtual columns
+--echo #
+create table t1 (
+ a int,
+ b int as (a) virtual,
+ c int,
+ d int as (c) virtual,
+ e int,
+ f int as (e) virtual,
+ g int,
+ h int,
+ i int,
+ index(d),
+ key(h),
+ foreign key (g) references t1 (h)
+) engine=innodb with system versioning;
+set system_versioning_alter_history= keep;
+alter table t1 drop column i;
+insert into t1 (g,h) values (1,1);
+# cleanup
+drop table t1;
+
+--echo #
+--echo # MDEV-29034 Assertion (o->ind == vers_start) upon inplace ALTER with virtual columns
+--echo #
+create table b (
+ pk integer auto_increment,
+ col_int_key integer,
+ col_varchar_key varchar(1),
+ o bit, n bit,
+ h float as ( n + 2 ) virtual,
+ v bit,
+ primary key (pk),
+ key (col_varchar_key, col_int_key)
+) engine = innodb;
+set `system_versioning_alter_history`= keep;
+alter table `b` add system versioning;
+alter table `b` add column if not exists ( w bit, v serial );
+alter table `b` add column if not exists ( p bit );
+drop table `b`;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
--echo #
--echo # MDEV-21941 RENAME doesn't work for system time or period fields
@@ -702,4 +767,6 @@ show create table t1;
# cleanup
drop table t1;
+--echo #
--echo # End of 10.5 tests
+--echo #
diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test
index f82fe9bd..66c28568 100644
--- a/mysql-test/suite/versioning/t/delete_history.test
+++ b/mysql-test/suite/versioning/t/delete_history.test
@@ -195,7 +195,7 @@ drop table t1;
--echo # MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
--echo #
create table t1 (a integer, c0 varchar(255), fulltext key (c0))
-with system versioning engine innodb;
+with system versioning engine innodb stats_persistent=0;
set system_versioning_alter_history= keep;
alter table t1 drop system versioning;
alter table t1 add system versioning;
@@ -206,7 +206,7 @@ delete history from t1;
drop table t1;
create table t1 (id int primary key, ftx varchar(255))
-with system versioning engine innodb;
+with system versioning engine innodb stats_persistent=0;
insert into t1 values (1, 'c');
delete from t1;
alter table t1 add fulltext key(ftx);
diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test
index 9142a8fa..5603d1a3 100644
--- a/mysql-test/suite/versioning/t/select.test
+++ b/mysql-test/suite/versioning/t/select.test
@@ -314,7 +314,7 @@ select * from t1 where (a, 2) in ((1, 1), (2, 2)) and b = 1;
--echo ### Issue #398, NOW is now non-magic
create or replace table t1 (x int) with system versioning;
select * from t1 for system_time as of current_timestamp;
---error ER_BAD_FIELD_ERROR
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
select * from t1 for system_time as of now;
--echo ### Issue #405, NATURAL JOIN failure
@@ -487,4 +487,14 @@ call verify_trt_dummy(34);
SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;
+--echo #
+--echo # MDEV-32082 Server crash in find_field_in_table
+--echo #
+create table t0 (c0 int) with system versioning;
+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
+select x0 from (
+ select c0 x0 from t0
+) for system_time as of nowasdf deriv;
+drop table t0;
+
-- source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index 991109d7..f4145211 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -11,7 +11,3 @@
##############################################################################
-mdev_6832: wsrep_provider is read-only for security reasons
-MDEV-23092: wsrep_provider is read-only for security reasons
-wsrep_variables_no_provider: wsrep_provider is read-only for security reasons
-MDEV-22443: it is no longer allowed enable wsrep_on if wsrep_provider is 'none'
diff --git a/mysql-test/suite/wsrep/r/MDEV-22443.result b/mysql-test/suite/wsrep/r/MDEV-22443.result
deleted file mode 100644
index ea07cbec..00000000
--- a/mysql-test/suite/wsrep/r/MDEV-22443.result
+++ /dev/null
@@ -1,3 +0,0 @@
-SET SESSION wsrep_sync_wait=15;
-SET SESSION wsrep_on=1;
-START TRANSACTION READ WRITE;
diff --git a/mysql-test/suite/wsrep/r/MDEV-23092.result b/mysql-test/suite/wsrep/r/MDEV-23092.result
deleted file mode 100644
index d88aacf7..00000000
--- a/mysql-test/suite/wsrep/r/MDEV-23092.result
+++ /dev/null
@@ -1,13 +0,0 @@
-SET COLLATION_CONNECTION='utf16le_bin';
-SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
-ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/'
-SET GLOBAL wsrep_cluster_address='OFF';
-SET GLOBAL wsrep_slave_threads=10;
-SELECT 1;
-1
-1
-SET GLOBAL wsrep_cluster_address='gcomm://';
-SET GLOBAL wsrep_slave_threads=DEFAULT;
-CALL mtr.add_suppression("wsrep_load()");
-CALL mtr.add_suppression("Failed to create a new provider");
-CALL mtr.add_suppression("Failed to load provider");
diff --git a/mysql-test/suite/wsrep/r/mdev_6832.result b/mysql-test/suite/wsrep/r/mdev_6832.result
deleted file mode 100644
index 43894a6e..00000000
--- a/mysql-test/suite/wsrep/r/mdev_6832.result
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS
-#
-SHOW STATUS LIKE 'wsrep_ready';
-Variable_name Value
-wsrep_ready ON
-SHOW STATUS LIKE 'wsrep_ready';
-Variable_name Value
-wsrep_ready OFF
-SET @@global.wsrep_cluster_address='gcomm://';
-# End of test.
diff --git a/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result b/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result
deleted file mode 100644
index ad35dc8d..00000000
--- a/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result
+++ /dev/null
@@ -1,44 +0,0 @@
-SELECT @@wsrep_on;
-@@wsrep_on
-1
-SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
-SET @wsrep_debug_saved = @@global.wsrep_debug;
-SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
-SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
-SET GLOBAL wsrep_provider=none;
-SET SESSION wsrep_trx_fragment_size=DEFAULT;
-ERROR HY000: Incorrect arguments to SET
-SELECT @@session.wsrep_trx_fragment_size;
-@@session.wsrep_trx_fragment_size
-0
-SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
-ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
-SHOW WARNINGS;
-Level Code Message
-Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded
-Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
-SELECT @@global.wsrep_start_position;
-@@global.wsrep_start_position
-00000000-0000-0000-0000-000000000000:-1
-SET GLOBAL wsrep_debug=1;
-Warnings:
-Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
-SELECT @@global.wsrep_debug;
-@@global.wsrep_debug
-NONE
-SET GLOBAL wsrep_slave_threads=5;
-SELECT @@global.wsrep_slave_threads;
-@@global.wsrep_slave_threads
-5
-SET GLOBAL wsrep_desync=1;
-ERROR HY000: WSREP (galera) not started
-SELECT @@global.wsrep_desync;
-@@global.wsrep_desync
-0
-SET SESSION wsrep_trx_fragment_unit='rows';
-ERROR HY000: Incorrect arguments to SET
-SELECT @@session.wsrep_trx_fragment_unit;
-@@session.wsrep_trx_fragment_unit
-rows
-SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
-SET @@global.wsrep_debug = @wsrep_debug_saved;
diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.cnf b/mysql-test/suite/wsrep/t/MDEV-22443.cnf
deleted file mode 100644
index 851f2999..00000000
--- a/mysql-test/suite/wsrep/t/MDEV-22443.cnf
+++ /dev/null
@@ -1,8 +0,0 @@
-!include ../my.cnf
-
-[mysqld.1]
-wsrep-on=OFF
-binlog-format=ROW
-wsrep-provider=none
-wsrep-cluster-address='gcomm://'
-innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.test b/mysql-test/suite/wsrep/t/MDEV-22443.test
deleted file mode 100644
index 674cb5ae..00000000
--- a/mysql-test/suite/wsrep/t/MDEV-22443.test
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# MDEV-22443: terminate called after throwing an instance of
-# 'wsrep::runtime_error' in std::terminate on START TRANSACTION
-#
-
---source include/have_innodb.inc
---source include/have_wsrep.inc
---source include/have_binlog_format_row.inc
-
-SET SESSION wsrep_sync_wait=15;
-SET SESSION wsrep_on=1;
-START TRANSACTION READ WRITE;
diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.cnf b/mysql-test/suite/wsrep/t/MDEV-23092.cnf
deleted file mode 100644
index 851f2999..00000000
--- a/mysql-test/suite/wsrep/t/MDEV-23092.cnf
+++ /dev/null
@@ -1,8 +0,0 @@
-!include ../my.cnf
-
-[mysqld.1]
-wsrep-on=OFF
-binlog-format=ROW
-wsrep-provider=none
-wsrep-cluster-address='gcomm://'
-innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.test b/mysql-test/suite/wsrep/t/MDEV-23092.test
deleted file mode 100644
index 92a6e392..00000000
--- a/mysql-test/suite/wsrep/t/MDEV-23092.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting
-# invalid wsrep_provider (on optimized builds)
-#
-
---source include/have_innodb.inc
---source include/have_wsrep.inc
---source include/have_binlog_format_row.inc
-
-SET COLLATION_CONNECTION='utf16le_bin';
---error 1231
-SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
-SET GLOBAL wsrep_cluster_address='OFF';
-SET GLOBAL wsrep_slave_threads=10;
-SELECT 1;
-
-SET GLOBAL wsrep_cluster_address='gcomm://';
-SET GLOBAL wsrep_slave_threads=DEFAULT;
-
-CALL mtr.add_suppression("wsrep_load()");
-CALL mtr.add_suppression("Failed to create a new provider");
-CALL mtr.add_suppression("Failed to load provider");
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.cnf b/mysql-test/suite/wsrep/t/mdev_6832.cnf
deleted file mode 100644
index 0bf01f81..00000000
--- a/mysql-test/suite/wsrep/t/mdev_6832.cnf
+++ /dev/null
@@ -1,7 +0,0 @@
-!include ../my.cnf
-
-[mysqld.1]
-wsrep-on=ON
-wsrep-provider=@ENV.WSREP_PROVIDER
-wsrep-cluster-address=gcomm://
-
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.test b/mysql-test/suite/wsrep/t/mdev_6832.test
deleted file mode 100644
index d5303ce3..00000000
--- a/mysql-test/suite/wsrep/t/mdev_6832.test
+++ /dev/null
@@ -1,17 +0,0 @@
---source include/have_innodb.inc
---source include/have_wsrep_provider.inc
---source include/have_binlog_format_row.inc
-
---echo #
---echo # MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS
---echo #
-
-SHOW STATUS LIKE 'wsrep_ready';
---disable_query_log
-eval SET @@global.wsrep_provider='$WSREP_PROVIDER';
---enable_query_log
-SHOW STATUS LIKE 'wsrep_ready';
-SET @@global.wsrep_cluster_address='gcomm://';
---let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
---source include/wait_condition.inc
---echo # End of test.
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf
deleted file mode 100644
index b73146d2..00000000
--- a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf
+++ /dev/null
@@ -1,12 +0,0 @@
-# Use default setting for mysqld processes
-!include include/default_mysqld.cnf
-
-[mysqld.1]
-wsrep-on=ON
-binlog-format=ROW
-wsrep-provider=@ENV.WSREP_PROVIDER
-wsrep-cluster-address='gcomm://'
-#galera_port=@OPT.port
-#ist_port=@OPT.port
-#sst_port=@OPT.port
-
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test
deleted file mode 100644
index b44c9c5e..00000000
--- a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test
+++ /dev/null
@@ -1,38 +0,0 @@
---source include/have_wsrep.inc
---source include/have_innodb.inc
-
-SELECT @@wsrep_on;
-
-SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
-SET @wsrep_debug_saved = @@global.wsrep_debug;
-SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
-SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
-
-SET GLOBAL wsrep_provider=none;
-
---error ER_WRONG_ARGUMENTS
-SET SESSION wsrep_trx_fragment_size=DEFAULT;
-SELECT @@session.wsrep_trx_fragment_size;
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
-SHOW WARNINGS;
-SELECT @@global.wsrep_start_position;
-SET GLOBAL wsrep_debug=1;
-SELECT @@global.wsrep_debug;
-SET GLOBAL wsrep_slave_threads=5;
-SELECT @@global.wsrep_slave_threads;
---error ER_WRONG_ARGUMENTS
-SET GLOBAL wsrep_desync=1;
-SELECT @@global.wsrep_desync;
---error ER_WRONG_ARGUMENTS
-SET SESSION wsrep_trx_fragment_unit='rows';
-SELECT @@session.wsrep_trx_fragment_unit;
-
---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
-SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
-SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
---source include/galera_wait_ready.inc
-SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
-SET @@global.wsrep_debug = @wsrep_debug_saved;
---enable_query_log