From 86fbb58c3ac0865482819c10a3e81f2eea001c36 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 15:39:13 +0200 Subject: Merging upstream version 1:10.11.7. Signed-off-by: Daniel Baumann --- .../suite/binlog/r/binlog_gis_user_var_stm.result | 12 + .../binlog/r/binlog_mysqlbinlog_raw_flush.result | 1 + ...show_binlog_events_invalid_offset_silent.result | 21 + .../suite/binlog/t/binlog_gis_user_var_stm.test | 15 + .../binlog/t/binlog_mysqlbinlog_raw_flush.test | 4 +- ...g_show_binlog_events_invalid_offset_silent.test | 53 + mysql-test/suite/binlog/t/flashback.test | 16 +- ...pted_master_switch_to_unencrypted_coords.result | 2 +- ...rypted_master_switch_to_unencrypted_coords.test | 3 +- ...rypted_master_switch_to_unencrypted_gtid.result | 2 +- ...ncrypted_master_switch_to_unencrypted_gtid.test | 3 +- .../suite/binlog_encryption/rpl_gtid_basic.result | 7 + .../rpl_mixed_binlog_max_cache_size.result | 2 +- .../rpl_parallel_ignored_errors.result | 3 +- .../rpl_parallel_missed_error_handling.result | 1 - .../suite/binlog_encryption/rpl_semi_sync.result | 13 +- .../suite/compat/oracle/r/func_concat.result | 38 +- .../suite/compat/oracle/r/func_decode.result | 12 +- mysql-test/suite/compat/oracle/r/func_pad.result | 4 +- .../suite/compat/oracle/r/func_qualified.result | 2547 ++++++++++++++++++++ .../compat/oracle/r/func_regexp_replace.result | 34 + .../suite/compat/oracle/r/func_replace.result | 4 +- .../suite/compat/oracle/r/func_substr.result | 4 +- mysql-test/suite/compat/oracle/r/func_trim.result | 6 +- .../r/mysqldump_restore_func_qualified.result | 112 + mysql-test/suite/compat/oracle/r/parser.result | 16 +- mysql-test/suite/compat/oracle/r/ps.result | 4 +- .../suite/compat/oracle/r/sp-cursor-rowtype.result | 2 +- .../suite/compat/oracle/r/vcol_innodb.result | 54 + .../suite/compat/oracle/t/column_compression.test | 2 +- .../suite/compat/oracle/t/func_qualified.test | 248 ++ .../suite/compat/oracle/t/func_regexp_replace.test | 26 + .../oracle/t/mysqldump_restore_func_qualified.test | 50 + mysql-test/suite/compat/oracle/t/vcol_innodb.test | 47 + .../encryption/r/corrupted_during_recovery.result | 2 +- .../r/innodb_encrypt_temporary_tables.result | 16 +- .../r/innodb_encryption_discard_import.result | 67 +- .../suite/encryption/r/tempfiles_encrypted.result | 13 + .../encryption/t/corrupted_during_recovery.test | 2 +- .../t/innodb_encrypt_temporary_tables.test | 12 +- .../t/innodb_encryption_discard_import.test | 60 +- .../suite/engines/funcs/r/db_use_error.result | 2 +- .../suite/engines/funcs/r/rpl_row_until.result | 4 +- .../suite/engines/funcs/r/rpl_server_id1.result | 2 +- .../suite/engines/funcs/r/rpl_session_var.result | 11 + .../suite/engines/funcs/r/rpl_slave_status.result | 1 - .../suite/engines/funcs/t/rpl_server_id1.test | 2 +- mysql-test/suite/federated/update.result | 36 + mysql-test/suite/federated/update.test | 32 + mysql-test/suite/funcs_1/r/innodb_views.result | 2 +- mysql-test/suite/funcs_1/r/is_columns_is.result | 16 +- .../suite/funcs_1/r/is_columns_is_embedded.result | 16 +- mysql-test/suite/funcs_1/r/memory_views.result | 2 +- mysql-test/suite/funcs_1/r/myisam_views-big.result | 2 +- mysql-test/suite/funcs_1/r/storedproc.result | 150 +- mysql-test/suite/funcs_1/t/storedproc.test | 211 +- mysql-test/suite/funcs_1/views/views_master.inc | 9 +- mysql-test/suite/galera/disabled.def | 15 +- mysql-test/suite/galera/r/MDEV-22232.result | 27 + mysql-test/suite/galera/r/MDEV-27806.result | 52 + mysql-test/suite/galera/r/MDEV-31272.result | 36 + mysql-test/suite/galera/r/MDEV-32549.result | 24 + mysql-test/suite/galera/r/MDEV-32938.result | 21 + mysql-test/suite/galera/r/MW-388.result | 2 +- mysql-test/suite/galera/r/MW-86-wait1.result | 4 +- mysql-test/suite/galera/r/MW-86-wait8.result | 4 +- mysql-test/suite/galera/r/galera_as_master.result | 2 + .../suite/galera/r/galera_bf_lock_wait.result | 20 + .../galera/r/galera_gcache_recover_manytrx.result | 14 +- .../r/galera_ist_mariabackup_verify_ca.result | 21 + .../galera/r/galera_ist_rsync_verify_ca.result | 21 + .../suite/galera/r/galera_myisam_autocommit.result | 5 +- .../suite/galera/r/galera_var_node_address.result | 22 - .../galera/r/galera_var_retry_autocommit.result | 5 +- mysql-test/suite/galera/suite.pm | 6 +- mysql-test/suite/galera/t/MDEV-22232.test | 72 + mysql-test/suite/galera/t/MDEV-27806.opt | 1 + mysql-test/suite/galera/t/MDEV-27806.test | 51 + mysql-test/suite/galera/t/MDEV-27862.test | 3 + mysql-test/suite/galera/t/MDEV-31272.combinations | 5 + mysql-test/suite/galera/t/MDEV-31272.test | 58 + mysql-test/suite/galera/t/MDEV-32549.test | 28 + mysql-test/suite/galera/t/MDEV-32938.test | 57 + mysql-test/suite/galera/t/galera_as_master.test | 6 + mysql-test/suite/galera/t/galera_bf_lock_wait.test | 14 +- .../galera/t/galera_gcache_recover_manytrx.test | 14 +- .../galera/t/galera_ist_mariabackup_verify_ca.cnf | 20 + .../galera/t/galera_ist_mariabackup_verify_ca.test | 61 + .../suite/galera/t/galera_ist_rsync_verify_ca.cnf | 17 + .../suite/galera/t/galera_ist_rsync_verify_ca.test | 60 + .../suite/galera/t/galera_log_output_csv.test | 4 + .../suite/galera/t/galera_myisam_autocommit.test | 4 + mysql-test/suite/galera/t/galera_query_cache.test | 3 + .../galera/t/galera_query_cache_sync_wait.test | 4 + .../suite/galera/t/galera_restart_replica.test | 2 +- .../suite/galera/t/galera_var_node_address.cnf | 10 - .../suite/galera/t/galera_var_node_address.test | 32 - mysql-test/suite/galera_3nodes/disabled.def | 12 +- mysql-test/suite/galera_3nodes/r/MDEV-29171.result | 1 + .../galera_3nodes/r/galera_gtid_consistency.result | 219 ++ .../galera_3nodes/r/galera_var_node_address.result | 22 + .../r/galera_vote_rejoin_mysqldump.result | 16 +- mysql-test/suite/galera_3nodes/t/MDEV-29171.test | 12 +- .../galera_3nodes/t/galera_gtid_consistency.cnf | 35 + .../galera_3nodes/t/galera_gtid_consistency.test | 346 +++ .../galera_3nodes/t/galera_var_node_address.cnf | 8 + .../galera_3nodes/t/galera_var_node_address.test | 32 + .../t/galera_vote_rejoin_mysqldump.test | 21 +- mysql-test/suite/galera_3nodes_sr/disabled.def | 2 - mysql-test/suite/galera_3nodes_sr/r/GCF-832.result | 2 +- mysql-test/suite/galera_3nodes_sr/t/GCF-336.test | 5 + mysql-test/suite/galera_3nodes_sr/t/GCF-832.test | 2 +- .../t/galera_sr_isolate_master.test | 2 + mysql-test/suite/galera_sr/disabled.def | 4 +- mysql-test/suite/galera_sr/r/MDEV-27615.result | 2 +- mysql-test/suite/galera_sr/r/MDEV-28971.result | 17 + .../suite/galera_sr/r/galera_sr_cc_master.result | 30 +- .../galera_sr/r/mysql-wsrep-features#165.result | 16 + mysql-test/suite/galera_sr/t/MDEV-27615.test | 3 +- mysql-test/suite/galera_sr/t/MDEV-28971.test | 20 + .../suite/galera_sr/t/galera_sr_cc_master.test | 26 +- .../galera_sr/t/galera_sr_large_fragment.test | 3 + .../galera_sr/t/galera_sr_many_fragments.test | 4 + .../suite/galera_sr/t/mysql-wsrep-features#165.inc | 6 +- mysql-test/suite/gcol/r/gcol_bugfixes.result | 38 + .../suite/gcol/r/gcol_partition_innodb.result | 5 +- mysql-test/suite/gcol/r/gcol_purge.result | 2 +- mysql-test/suite/gcol/r/gcol_update.result | 3 + .../suite/gcol/r/innodb_prefix_index_check.result | 29 + .../suite/gcol/r/innodb_virtual_debug.result | 3 + .../suite/gcol/r/innodb_virtual_purge.result | 3 + mysql-test/suite/gcol/t/gcol_bugfixes.test | 35 + mysql-test/suite/gcol/t/gcol_partition_innodb.test | 7 +- mysql-test/suite/gcol/t/gcol_purge.test | 2 +- mysql-test/suite/gcol/t/gcol_update.test | 5 + .../suite/gcol/t/innodb_prefix_index_check.test | 43 + mysql-test/suite/gcol/t/innodb_virtual_debug.test | 6 + mysql-test/suite/gcol/t/innodb_virtual_purge.test | 5 + mysql-test/suite/innodb/include/crc32.pl | 23 + mysql-test/suite/innodb/include/innodb-util.pl | 19 + mysql-test/suite/innodb/r/add_foreign_key.result | 31 + mysql-test/suite/innodb/r/alter_kill.result | 1 + mysql-test/suite/innodb/r/alter_table.result | 14 +- mysql-test/suite/innodb/r/cascade_lock_wait.result | 76 + .../innodb/r/corrupted_during_recovery.result | 2 +- mysql-test/suite/innodb/r/dml_purge.result | 3 + mysql-test/suite/innodb/r/doublewrite.result | 256 +- mysql-test/suite/innodb/r/doublewrite_debug.result | 94 + mysql-test/suite/innodb/r/fk_col_alter.result | 13 + mysql-test/suite/innodb/r/fk_drop_alter.result | 44 + mysql-test/suite/innodb/r/foreign-keys.result | 7 + mysql-test/suite/innodb/r/foreign_key.result | 31 +- mysql-test/suite/innodb/r/full_crc32_import.result | 3 + mysql-test/suite/innodb/r/ibuf_not_empty.result | 1 + .../suite/innodb/r/import_update_stats.result | 72 + mysql-test/suite/innodb/r/index_length.result | 23 + .../suite/innodb/r/index_merge_threshold.result | 3 + mysql-test/suite/innodb/r/innodb-16k.result | 3 + mysql-test/suite/innodb/r/innodb-32k.result | 21 + mysql-test/suite/innodb/r/innodb-64k.result | 20 + .../innodb/r/innodb-ac-non-locking-select.result | 62 + .../suite/innodb/r/innodb-alter-tempfile.result | 2 - mysql-test/suite/innodb/r/innodb-alter.result | 56 + mysql-test/suite/innodb/r/innodb-blob.result | 6 - .../suite/innodb/r/innodb-index-debug.result | 2 - .../suite/innodb/r/innodb-index-online-fk.result | 67 + .../suite/innodb/r/innodb-index-online.result | 31 +- .../r/innodb-lock-inherit-read_commited.result | 121 + mysql-test/suite/innodb/r/innodb-read-view.result | 41 +- .../suite/innodb/r/innodb-system-table-view.result | 3 + .../suite/innodb/r/innodb-table-online.result | 36 +- mysql-test/suite/innodb/r/innodb-truncate.result | 9 +- mysql-test/suite/innodb/r/innodb-wl5522-1.result | 14 +- mysql-test/suite/innodb/r/innodb.result | 2 +- .../innodb/r/innodb_buffer_pool_dump_pct.result | 9 - .../suite/innodb/r/innodb_bug12902967.result | 6 - .../suite/innodb/r/innodb_force_recovery.result | 9 + .../suite/innodb/r/innodb_i_s_innodb_locks.result | Bin 0 -> 5451 bytes .../suite/innodb/r/innodb_i_s_innodb_trx.result | 90 + .../r/innodb_information_schema_tables.result | 1 + mysql-test/suite/innodb/r/innodb_mysql.result | 12 + .../r/innodb_prefix_index_restart_server.result | 16 + mysql-test/suite/innodb/r/innodb_scrub.result | 2 +- .../suite/innodb/r/innodb_stats_auto_recalc.result | 44 + .../innodb/r/innodb_stats_auto_recalc_ddl.result | 34 + .../innodb/r/innodb_stats_auto_recalc_lots.result | 202 ++ .../innodb_stats_auto_recalc_on_nonexistent.result | 60 + .../innodb/r/innodb_stats_external_pages.result | 10 + .../suite/innodb/r/innodb_stats_fetch.result | 24 + .../innodb/r/innodb_stats_flag_global,off.rdiff | 34 + .../suite/innodb/r/innodb_stats_flag_global.result | 207 ++ .../suite/innodb/r/innodb_stats_persistent.result | 28 +- .../innodb/r/innodb_stats_sample_pages.result | 29 + .../r/innodb_stats_table_flag_auto_recalc.result | 82 + .../r/innodb_stats_table_flag_sample_pages.result | 95 + .../suite/innodb/r/innodb_ut_format_name.result | 5 + mysql-test/suite/innodb/r/instant_alter.result | 3 + .../suite/innodb/r/instant_alter_bugs.result | 28 + .../suite/innodb/r/instant_alter_crash.result | 6 +- .../innodb/r/instant_alter_debug,redundant.rdiff | 4 +- .../suite/innodb/r/instant_alter_debug.result | 4 + .../suite/innodb/r/instant_alter_purge.result | 2 +- .../suite/innodb/r/instant_alter_rollback.result | 1 + .../suite/innodb/r/lock_move_wait_lock_race.result | 3 +- mysql-test/suite/innodb/r/log_file_name.result | 1 + mysql-test/suite/innodb/r/mem_pressure.result | 25 + mysql-test/suite/innodb/r/no_pad.result | 46 + .../suite/innodb/r/page_id_innochecksum.result | 2 +- mysql-test/suite/innodb/r/page_reorganize.result | 2 - mysql-test/suite/innodb/r/purge.result | 3 + mysql-test/suite/innodb/r/purge_secondary.result | 4 + .../suite/innodb/r/purge_thread_shutdown.result | 27 - .../suite/innodb/r/read_only_recovery.result | 2 + .../suite/innodb/r/records_in_range,4k.rdiff | 8 + .../suite/innodb/r/records_in_range,8k.rdiff | 8 + mysql-test/suite/innodb/r/records_in_range.result | 1275 ++++++++++ .../suite/innodb/r/row_format_redundant.result | 3 +- mysql-test/suite/innodb/r/scrub_debug.result | 2 +- mysql-test/suite/innodb/r/table_flags.result | 12 +- .../r/tablespace_per_table_not_windows.result | 128 + .../innodb/r/tablespace_per_table_windows.result | 48 + mysql-test/suite/innodb/r/truncate_crash.result | 2 +- mysql-test/suite/innodb/r/truncate_foreign.result | 9 +- mysql-test/suite/innodb/r/trx_id_future.result | 2 +- mysql-test/suite/innodb/r/undo_log.result | 3 + mysql-test/suite/innodb/t/add_foreign_key.test | 38 + mysql-test/suite/innodb/t/alter_kill.test | 1 + mysql-test/suite/innodb/t/alter_table.test | 15 +- mysql-test/suite/innodb/t/cascade_lock_wait.test | 45 + .../suite/innodb/t/corrupted_during_recovery.test | 2 +- mysql-test/suite/innodb/t/dml_purge.test | 5 + mysql-test/suite/innodb/t/doublewrite.test | 429 +--- .../suite/innodb/t/doublewrite_debug.combinations | 7 + mysql-test/suite/innodb/t/doublewrite_debug.test | 170 ++ mysql-test/suite/innodb/t/fk_col_alter.test | 14 + mysql-test/suite/innodb/t/fk_drop_alter.test | 35 + mysql-test/suite/innodb/t/foreign-keys.test | 4 + mysql-test/suite/innodb/t/foreign_key.test | 41 +- mysql-test/suite/innodb/t/full_crc32_import.test | 4 + mysql-test/suite/innodb/t/ibuf_not_empty.test | 1 + mysql-test/suite/innodb/t/import_update_stats.test | 80 + mysql-test/suite/innodb/t/index_length.test | 23 + .../suite/innodb/t/index_merge_threshold.test | 5 + mysql-test/suite/innodb/t/innodb-16k.test | 4 + mysql-test/suite/innodb/t/innodb-32k.test | 14 + mysql-test/suite/innodb/t/innodb-64k.test | 13 + .../innodb/t/innodb-ac-non-locking-select.test | 117 + .../suite/innodb/t/innodb-alter-tempfile.test | 5 +- mysql-test/suite/innodb/t/innodb-alter.test | 26 + .../suite/innodb/t/innodb-index-online-fk.test | 45 + mysql-test/suite/innodb/t/innodb-index-online.test | 33 +- .../t/innodb-lock-inherit-read_commited.test | 110 + mysql-test/suite/innodb/t/innodb-read-view.test | 48 +- .../suite/innodb/t/innodb-system-table-view.test | 5 + mysql-test/suite/innodb/t/innodb-table-online.test | 32 +- mysql-test/suite/innodb/t/innodb-truncate.test | 8 +- mysql-test/suite/innodb/t/innodb-wl5522-1.test | 21 +- .../innodb/t/innodb_buffer_pool_dump_pct.test | 47 +- mysql-test/suite/innodb/t/innodb_bug12902967.test | 25 - .../suite/innodb/t/innodb_force_recovery.test | 10 + .../suite/innodb/t/innodb_i_s_innodb_locks.test | 169 ++ .../suite/innodb/t/innodb_i_s_innodb_trx.test | 95 + .../innodb/t/innodb_information_schema_tables.opt | 1 + .../innodb/t/innodb_information_schema_tables.test | 4 + .../t/innodb_prefix_index_restart_server.test | 14 + mysql-test/suite/innodb/t/innodb_scrub.test | 2 +- .../suite/innodb/t/innodb_stats_auto_recalc.opt | 1 + .../suite/innodb/t/innodb_stats_auto_recalc.test | 48 + .../innodb/t/innodb_stats_auto_recalc_ddl.opt | 1 + .../innodb/t/innodb_stats_auto_recalc_ddl.test | 49 + .../innodb/t/innodb_stats_auto_recalc_lots.opt | 1 + .../innodb/t/innodb_stats_auto_recalc_lots.test | 45 + .../t/innodb_stats_auto_recalc_on_nonexistent.opt | 1 + .../t/innodb_stats_auto_recalc_on_nonexistent.test | 88 + .../innodb/t/innodb_stats_external_pages.test | 79 + mysql-test/suite/innodb/t/innodb_stats_fetch.opt | 7 + mysql-test/suite/innodb/t/innodb_stats_fetch.test | 15 + .../innodb/t/innodb_stats_flag_global.combinations | 4 + .../suite/innodb/t/innodb_stats_flag_global.test | 91 + .../innodb/t/innodb_stats_flag_global_analyze.inc | 13 + .../suite/innodb/t/innodb_stats_persistent.test | 41 +- .../suite/innodb/t/innodb_stats_sample_pages.opt | 1 + .../suite/innodb/t/innodb_stats_sample_pages.test | 53 + .../t/innodb_stats_table_flag_auto_recalc.test | 83 + .../t/innodb_stats_table_flag_sample_pages.test | 103 + .../suite/innodb/t/innodb_ut_format_name.test | 17 + mysql-test/suite/innodb/t/instant_alter.test | 4 + mysql-test/suite/innodb/t/instant_alter_bugs.test | 32 + mysql-test/suite/innodb/t/instant_alter_crash.test | 2 +- mysql-test/suite/innodb/t/instant_alter_debug.test | 7 + mysql-test/suite/innodb/t/instant_alter_purge.test | 2 +- .../suite/innodb/t/instant_alter_rollback.test | 2 + .../suite/innodb/t/lock_move_wait_lock_race.test | 3 +- mysql-test/suite/innodb/t/log_file_name.test | 5 + mysql-test/suite/innodb/t/mdev-14846.test | 2 + mysql-test/suite/innodb/t/mem_pressure.test | 44 + mysql-test/suite/innodb/t/no_pad.test | 46 + .../suite/innodb/t/page_id_innochecksum.test | 2 +- mysql-test/suite/innodb/t/purge.test | 5 + mysql-test/suite/innodb/t/purge_secondary.test | 7 + .../suite/innodb/t/purge_thread_shutdown.test | 43 - mysql-test/suite/innodb/t/read_only_recovery.test | 2 + mysql-test/suite/innodb/t/records_in_range.test | 432 ++++ mysql-test/suite/innodb/t/row_format_redundant.opt | 2 + .../innodb/t/row_size_error_log_warnings_3.test | 2 +- mysql-test/suite/innodb/t/scrub_debug.test | 2 +- mysql-test/suite/innodb/t/table_flags.opt | 1 + mysql-test/suite/innodb/t/table_flags.test | 2 + .../innodb/t/tablespace_per_table_not_windows.opt | 1 + .../innodb/t/tablespace_per_table_not_windows.test | 162 ++ .../innodb/t/tablespace_per_table_windows.opt | 1 + .../innodb/t/tablespace_per_table_windows.test | 77 + mysql-test/suite/innodb/t/truncate_crash.test | 2 +- mysql-test/suite/innodb/t/truncate_foreign.test | 10 +- mysql-test/suite/innodb/t/trx_id_future.test | 2 +- mysql-test/suite/innodb/t/undo_log.test | 5 + mysql-test/suite/innodb/t/undo_space_dblwr.opt | 1 + .../suite/innodb_fts/r/crash_recovery.result | 2 +- .../suite/innodb_fts/r/foreign_key_check.result | 27 + .../suite/innodb_fts/r/foreign_key_update.result | 34 + .../innodb_fts/r/ft_result_cache_limit.result | 2 - mysql-test/suite/innodb_fts/r/index_table.result | 265 ++ .../suite/innodb_fts/r/innodb_fts_proximity.result | 5 +- mysql-test/suite/innodb_fts/r/limit_union.result | 157 ++ mysql-test/suite/innodb_fts/r/misc.result | 1878 +++++++++++++++ mysql-test/suite/innodb_fts/r/misc_1.result | 922 +++++++ mysql-test/suite/innodb_fts/r/opt.result | 1654 +++++++++++++ mysql-test/suite/innodb_fts/r/phrase.result | 84 + .../suite/innodb_fts/r/result_cache_limit.result | 31 + mysql-test/suite/innodb_fts/r/savepoint.result | 318 +++ mysql-test/suite/innodb_fts/r/subexpr.result | 105 + mysql-test/suite/innodb_fts/t/crash_recovery.test | 2 +- .../suite/innodb_fts/t/foreign_key_check.test | 41 + .../suite/innodb_fts/t/foreign_key_update.test | 34 + mysql-test/suite/innodb_fts/t/index_table.opt | 2 + mysql-test/suite/innodb_fts/t/index_table.test | 121 + .../suite/innodb_fts/t/innodb_fts_proximity.test | 2 + mysql-test/suite/innodb_fts/t/limit_union.test | 143 ++ mysql-test/suite/innodb_fts/t/misc.test | 1511 ++++++++++++ mysql-test/suite/innodb_fts/t/misc_1.test | 894 +++++++ mysql-test/suite/innodb_fts/t/opt.opt | 1 + mysql-test/suite/innodb_fts/t/opt.test | 1086 +++++++++ mysql-test/suite/innodb_fts/t/phrase.opt | 2 + mysql-test/suite/innodb_fts/t/phrase.test | 39 + .../suite/innodb_fts/t/result_cache_limit.test | 52 + mysql-test/suite/innodb_fts/t/savepoint.test | 475 ++++ mysql-test/suite/innodb_fts/t/subexpr.test | 58 + mysql-test/suite/innodb_gis/r/check_rtree.result | 2 - mysql-test/suite/innodb_gis/r/rollback.result | 2 - .../suite/innodb_gis/r/rtree_add_index.result | 2 +- .../suite/innodb_gis/r/rtree_compress.result | 8 +- .../suite/innodb_gis/r/rtree_create_inplace.result | 36 +- mysql-test/suite/innodb_gis/r/rtree_purge.result | 2 +- mysql-test/suite/innodb_gis/r/rtree_undo.result | 12 +- mysql-test/suite/innodb_gis/t/rtree_add_index.test | 2 +- mysql-test/suite/innodb_gis/t/rtree_compress.test | 6 +- .../suite/innodb_gis/t/rtree_create_inplace.opt | 1 + .../suite/innodb_gis/t/rtree_create_inplace.test | 38 +- mysql-test/suite/innodb_gis/t/rtree_purge.test | 2 +- mysql-test/suite/innodb_gis/t/rtree_undo.test | 4 +- .../suite/innodb_zip/include/innodb_dml_ops.inc | 82 - mysql-test/suite/innodb_zip/r/blob.result | 2 +- .../suite/innodb_zip/r/innochecksum_3.result | 2 - mysql-test/suite/innodb_zip/r/restart.result | 37 - mysql-test/suite/innodb_zip/t/blob.test | 2 +- mysql-test/suite/innodb_zip/t/restart.opt | 7 +- mysql-test/suite/mariabackup/backup_grants.result | 5 +- mysql-test/suite/mariabackup/backup_grants.test | 23 +- mysql-test/suite/mariabackup/full_backup.result | 8 + mysql-test/suite/mariabackup/full_backup.test | 9 + .../suite/mariabackup/huge_lsn,strict_crc32.rdiff | 2 + .../suite/mariabackup/slave_provision_nolock.cnf | 13 + .../mariabackup/slave_provision_nolock.result | 48 + .../suite/mariabackup/slave_provision_nolock.test | 170 ++ .../mariabackup/unencrypted_page_compressed.result | 3 +- .../mariabackup/unencrypted_page_compressed.test | 3 +- .../suite/multi_source/gtid_slave_pos.result | 3 +- mysql-test/suite/multi_source/gtid_slave_pos.test | 4 +- mysql-test/suite/multi_source/mdev-9544.test | 1 + .../suite/parts/r/partition_alter_innodb.result | 3 +- mysql-test/suite/parts/r/partition_purge.result | 2 +- .../suite/parts/t/partition_alter_innodb.test | 3 +- mysql-test/suite/parts/t/partition_purge.test | 2 +- .../include/pfs_running_event_scheduler.inc | 6 +- mysql-test/suite/perfschema/r/digest_view.result | 50 +- mysql-test/suite/perfschema/r/mdl_func.result | 1 + .../suite/perfschema/r/misc_session_status.result | 20 + mysql-test/suite/perfschema/r/rpl_threads.result | 6 + .../r/start_server_low_digest_sql_length.result | 4 +- mysql-test/suite/perfschema/t/mdl_func.test | 8 +- .../suite/perfschema/t/misc_session_status.test | 20 + mysql-test/suite/perfschema/t/rpl_threads.test | 6 + .../suite/plugins/r/compression,innodb-lz4.rdiff | 12 +- .../suite/plugins/r/compression,innodb-lzma.rdiff | 12 +- .../suite/plugins/r/compression,innodb-lzo.rdiff | 12 +- .../plugins/r/compression,innodb-snappy.rdiff | 12 +- .../suite/plugins/r/compression,mroonga-lz4.rdiff | 11 +- mysql-test/suite/plugins/r/compression.result | 7 +- mysql-test/suite/plugins/r/sql_error_log.result | 1 + .../plugins/r/sql_error_log_withdbinfo.result | 41 + mysql-test/suite/plugins/r/test_sql_service.result | 2 +- .../suite/plugins/t/compression.combinations | 5 + mysql-test/suite/plugins/t/compression.test | 4 +- .../suite/plugins/t/sql_error_log_withdbinfo.opt | 1 + .../suite/plugins/t/sql_error_log_withdbinfo.test | 49 + mysql-test/suite/plugins/t/test_sql_service.test | 8 +- mysql-test/suite/roles/set_default_role_for.result | 2 +- .../suite/roles/set_default_role_invalid.result | 6 +- .../suite/roles/set_default_role_invalid.test | 1 - ...fault_role_invalid_skip_name_resolve-master.opt | 1 + ...t_default_role_invalid_skip_name_resolve.result | 85 + ...set_default_role_invalid_skip_name_resolve.test | 78 + .../suite/rpl/include/mdev-31448_conservative.inc | 7 +- .../suite/rpl/include/mdev-31448_optimistic.inc | 7 +- .../rpl/include/mysqlbinlog_slave_consistency.inc | 1 + .../rpl/include/rpl_binlog_max_cache_size.test | 5 +- .../suite/rpl/include/rpl_change_master_demote.inc | 11 + .../suite/rpl/include/rpl_parallel_29322.inc | 11 + .../suite/rpl/include/rpl_shutdown_wait_slaves.inc | 5 + .../suite/rpl/include/rpl_start_stop_slave.test | 2 +- .../suite/rpl/include/rpl_stop_middle_group.test | 7 +- .../r/mdev-31448_kill_ooo_finish_optimistic.result | 3 +- mysql-test/suite/rpl/r/parallel_backup.result | 4 - .../suite/rpl/r/parallel_backup_lsu_off.result | 4 - .../rpl/r/parallel_backup_slave_binlog_off.result | 4 - .../r/rpl_binlog_cache_disk_full_loaddata.result | 38 + .../rpl/r/rpl_binlog_cache_disk_full_row.result | 51 + .../r/rpl_binlog_dump_slave_gtid_state_info.result | 4 + .../suite/rpl/r/rpl_change_master_demote.result | 9 + .../suite/rpl/r/rpl_circular_semi_sync.result | 4 + mysql-test/suite/rpl/r/rpl_connection.result | 2 +- .../rpl/r/rpl_deadlock_show_slave_status.result | 66 + mysql-test/suite/rpl/r/rpl_delayed_slave.result | 3 + .../rpl/r/rpl_domain_id_filter_io_crash.result | 8 +- .../rpl/r/rpl_domain_id_filter_master_crash.result | 3 +- mysql-test/suite/rpl/r/rpl_fail_register.result | 5 +- mysql-test/suite/rpl/r/rpl_gis_user_var.result | 21 + mysql-test/suite/rpl/r/rpl_gtid_basic.result | 7 + .../suite/rpl/r/rpl_gtid_delete_domain.result | 2 +- mysql-test/suite/rpl/r/rpl_gtid_errorlog.result | 5 +- .../suite/rpl/r/rpl_gtid_slave_filtering.result | 78 + mysql-test/suite/rpl/r/rpl_gtid_startpos.result | 2 +- mysql-test/suite/rpl/r/rpl_heartbeat_basic.result | 2 +- mysql-test/suite/rpl/r/rpl_invoked_features.result | 4 +- .../rpl/r/rpl_mariadb_slave_capability.result | 5 + mysql-test/suite/rpl/r/rpl_mdev_17614.result | 6 +- .../rpl/r/rpl_mixed_binlog_max_cache_size.result | 2 +- .../suite/rpl/r/rpl_parallel_ignored_errors.result | 3 +- mysql-test/suite/rpl/r/rpl_parallel_kill.result | 6 +- .../r/rpl_parallel_missed_error_handling.result | 1 - mysql-test/suite/rpl/r/rpl_row_big_table_id.result | 12 +- .../rpl/r/rpl_row_binlog_max_cache_size.result | 2 +- mysql-test/suite/rpl/r/rpl_row_corruption.result | 2 +- mysql-test/suite/rpl/r/rpl_row_idempotency.result | 16 +- mysql-test/suite/rpl/r/rpl_row_until.result | 4 +- .../rpl/r/rpl_seconds_behind_master_spike.result | 8 +- mysql-test/suite/rpl/r/rpl_semi_sync.result | 13 +- .../suite/rpl/r/rpl_semi_sync_after_sync.result | 13 +- .../rpl/r/rpl_semi_sync_after_sync_row.result | 13 +- mysql-test/suite/rpl/r/rpl_semi_sync_event.result | 1 - .../rpl/r/rpl_semi_sync_event_after_sync.result | 1 - .../suite/rpl/r/rpl_semi_sync_fail_over.result | 2 +- .../rpl/r/rpl_semi_sync_master_shutdown.result | 8 +- ..._semi_sync_no_missed_ack_after_add_slave.result | 48 + .../rpl_semi_sync_slave_enabled_consistent.result | 35 + .../rpl/r/rpl_semi_sync_slave_reply_fail.result | 7 +- .../suite/rpl/r/rpl_semisync_ali_issues.result | 11 +- mysql-test/suite/rpl/r/rpl_session_var.result | 11 + mysql-test/suite/rpl/r/rpl_session_var2.result | 69 + .../rpl/r/rpl_set_statement_default_master.result | 1 + .../rpl/r/rpl_slave_load_tmpdir_not_exist.result | 1 + mysql-test/suite/rpl/r/rpl_slave_status.result | 1 - .../rpl/r/rpl_sql_thd_start_errno_cleared.result | 1 + mysql-test/suite/rpl/r/rpl_ssl1.result | 4 +- mysql-test/suite/rpl/r/rpl_start_alter_1.result | 1 + mysql-test/suite/rpl/r/rpl_start_alter_2.result | 1 + mysql-test/suite/rpl/r/rpl_start_alter_3.result | 1 + mysql-test/suite/rpl/r/rpl_start_alter_4.result | 1 + mysql-test/suite/rpl/r/rpl_start_alter_5.result | 1 + mysql-test/suite/rpl/r/rpl_start_alter_6.result | 1 + mysql-test/suite/rpl/r/rpl_start_alter_7.result | 4 + mysql-test/suite/rpl/r/rpl_start_alter_8.result | 4 + .../rpl/r/rpl_start_alter_mysqlbinlog_1.result | 2 + .../rpl/r/rpl_start_alter_mysqlbinlog_2.result | 4 + .../rpl/r/rpl_start_alter_restart_slave.result | 2 + .../rpl/r/rpl_stm_binlog_max_cache_size.result | 2 +- .../suite/rpl/r/rpl_stm_start_stop_slave.result | 2 +- .../suite/rpl/r/rpl_stm_stop_middle_group.result | 4 +- .../suite/rpl/r/rpl_using_gtid_default.result | 3 + mysql-test/suite/rpl/r/semisync_future-7591.result | 2 +- mysql-test/suite/rpl/t/create_or_replace.inc | 7 + .../t/mdev-31448_kill_ooo_finish_optimistic.test | 7 +- mysql-test/suite/rpl/t/parallel_backup_xa.inc | 2 + .../rpl/t/rpl_binlog_cache_disk_full_loaddata.test | 47 + .../rpl/t/rpl_binlog_cache_disk_full_row.test | 61 + .../t/rpl_binlog_dump_slave_gtid_state_info.test | 8 +- mysql-test/suite/rpl/t/rpl_checksum.test | 3 + mysql-test/suite/rpl/t/rpl_circular_semi_sync.test | 11 + mysql-test/suite/rpl/t/rpl_connection.test | 2 +- .../rpl/t/rpl_deadlock_show_slave_status.test | 121 + mysql-test/suite/rpl/t/rpl_delayed_slave.test | 6 + .../suite/rpl/t/rpl_domain_id_filter_io_crash.test | 9 +- .../rpl/t/rpl_domain_id_filter_master_crash.test | 20 +- mysql-test/suite/rpl/t/rpl_fail_register.test | 9 +- mysql-test/suite/rpl/t/rpl_gis_user_var.test | 18 + mysql-test/suite/rpl/t/rpl_gtid_basic.test | 7 + mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test | 2 +- mysql-test/suite/rpl/t/rpl_gtid_errorlog.test | 6 +- .../suite/rpl/t/rpl_gtid_slave_filtering.cnf | 28 + .../suite/rpl/t/rpl_gtid_slave_filtering.test | 109 + mysql-test/suite/rpl/t/rpl_gtid_startpos.test | 2 +- mysql-test/suite/rpl/t/rpl_gtid_stop_start.test | 2 +- mysql-test/suite/rpl/t/rpl_heartbeat_basic.test | 2 +- mysql-test/suite/rpl/t/rpl_invoked_features.test | 9 +- .../suite/rpl/t/rpl_mariadb_slave_capability.test | 15 +- mysql-test/suite/rpl/t/rpl_mdev_17614.test | 6 +- .../suite/rpl/t/rpl_parallel_ignored_errors.test | 4 +- .../rpl/t/rpl_parallel_missed_error_handling.test | 1 - mysql-test/suite/rpl/t/rpl_parallel_retry.test | 1 + ...l_perfschema_applier_status_by_coordinator.test | 1 + .../t/rpl_perfschema_applier_status_by_worker.test | 1 + .../suite/rpl/t/rpl_rewrite_db_sys_vars.test | 1 + mysql-test/suite/rpl/t/rpl_row_corruption.test | 2 +- mysql-test/suite/rpl/t/rpl_row_idempotency.test | 31 +- mysql-test/suite/rpl/t/rpl_row_until.test | 7 +- .../rpl/t/rpl_seconds_behind_master_spike.test | 10 +- mysql-test/suite/rpl/t/rpl_semi_sync.test | 20 +- mysql-test/suite/rpl/t/rpl_semi_sync_event.test | 1 - .../suite/rpl/t/rpl_semi_sync_fail_over.test | 2 +- .../suite/rpl/t/rpl_semi_sync_master_shutdown.test | 12 +- ...rpl_semi_sync_no_missed_ack_after_add_slave.cnf | 12 + ...pl_semi_sync_no_missed_ack_after_add_slave.test | 122 + .../rpl/t/rpl_semi_sync_shutdown_await_ack.inc | 2 + .../t/rpl_semi_sync_slave_compressed_protocol.test | 2 +- .../t/rpl_semi_sync_slave_enabled_consistent.test | 73 + .../rpl/t/rpl_semi_sync_slave_reply_fail.test | 7 +- .../suite/rpl/t/rpl_semisync_ali_issues.test | 1 - mysql-test/suite/rpl/t/rpl_session_var.test | 6 + mysql-test/suite/rpl/t/rpl_session_var2-master.opt | 1 + mysql-test/suite/rpl/t/rpl_session_var2-slave.opt | 1 + mysql-test/suite/rpl/t/rpl_session_var2.test | 3 + .../rpl/t/rpl_set_statement_default_master.test | 1 + .../rpl/t/rpl_shutdown_wait_semisync_slaves.test | 3 + .../rpl/t/rpl_slave_load_tmpdir_not_exist.test | 1 + mysql-test/suite/rpl/t/rpl_slave_status.test | 3 +- .../rpl/t/rpl_sql_thd_start_errno_cleared.test | 4 + mysql-test/suite/rpl/t/rpl_ssl1.test | 6 +- mysql-test/suite/rpl/t/rpl_start_alter_1.test | 1 + mysql-test/suite/rpl/t/rpl_start_alter_2.test | 2 + mysql-test/suite/rpl/t/rpl_start_alter_3.test | 2 + mysql-test/suite/rpl/t/rpl_start_alter_4.test | 1 + mysql-test/suite/rpl/t/rpl_start_alter_5.test | 1 + mysql-test/suite/rpl/t/rpl_start_alter_6.test | 1 + mysql-test/suite/rpl/t/rpl_start_alter_7.test | 4 + mysql-test/suite/rpl/t/rpl_start_alter_8.test | 4 + .../suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test | 2 + .../suite/rpl/t/rpl_start_alter_mysqlbinlog_2.test | 4 + .../suite/rpl/t/rpl_start_alter_restart_slave.test | 6 +- mysql-test/suite/rpl/t/rpl_temporary_errors.test | 4 +- mysql-test/suite/rpl/t/rpl_using_gtid_default.test | 3 + mysql-test/suite/rpl/t/semisync_future-7591.test | 2 +- .../rpl/t/show_status_stop_slave_race-7126.test | 3 + mysql-test/suite/s3/amazon.result | 10 + mysql-test/suite/s3/amazon.test | 18 +- mysql-test/suite/s3/debug.result | 32 + mysql-test/suite/s3/debug.test | 34 + mysql-test/suite/sql_sequence/alter.result | 58 +- mysql-test/suite/sql_sequence/alter.test | 45 +- mysql-test/suite/sys_vars/r/debug_basic.result | 2 - mysql-test/suite/sys_vars/r/old_mode_basic.result | 4 +- .../suite/sys_vars/r/old_passwords_func.result | 6 + .../r/pseudo_slave_mode_notembedded.result | 14 + .../suite/sys_vars/r/secure_auth_basic.result | 20 + .../suite/sys_vars/r/secure_auth_func.result | 6 + .../suite/sys_vars/r/secure_auth_grant.result | 6 + mysql-test/suite/sys_vars/r/sysvars_debug.result | 2 +- .../sys_vars/r/sysvars_server_embedded,32bit.rdiff | 161 +- .../sys_vars/r/sysvars_server_embedded.result | 14 +- .../r/sysvars_server_notembedded,32bit.rdiff | 177 +- .../r/sysvars_server_notembedded,win.rdiff | 1465 +++++++++++ .../sys_vars/r/sysvars_server_notembedded.result | 16 +- mysql-test/suite/sys_vars/t/old_mode_basic.test | 2 +- .../sys_vars/t/pseudo_slave_mode_notembedded.test | 20 + mysql-test/suite/sys_vars/t/sysvars_star.test | 4 +- mysql-test/suite/vcol/r/partition.result | 22 + mysql-test/suite/vcol/r/vcol_keys_myisam.result | 37 + mysql-test/suite/vcol/r/vcol_syntax.result | 10 + mysql-test/suite/vcol/t/partition.test | 21 + mysql-test/suite/vcol/t/vcol_keys_myisam.test | 29 + mysql-test/suite/vcol/t/vcol_syntax.test | 10 + mysql-test/suite/versioning/r/alter.result | 64 + .../suite/versioning/r/delete_history.result | 4 +- mysql-test/suite/versioning/r/select.result | 11 +- mysql-test/suite/versioning/t/alter.test | 67 + mysql-test/suite/versioning/t/delete_history.test | 4 +- mysql-test/suite/versioning/t/select.test | 12 +- mysql-test/suite/wsrep/disabled.def | 4 - mysql-test/suite/wsrep/r/MDEV-22443.result | 3 - mysql-test/suite/wsrep/r/MDEV-23092.result | 13 - mysql-test/suite/wsrep/r/mdev_6832.result | 11 - .../wsrep/r/wsrep_variables_no_provider.result | 44 - mysql-test/suite/wsrep/t/MDEV-22443.cnf | 8 - mysql-test/suite/wsrep/t/MDEV-22443.test | 12 - mysql-test/suite/wsrep/t/MDEV-23092.cnf | 8 - mysql-test/suite/wsrep/t/MDEV-23092.test | 22 - mysql-test/suite/wsrep/t/mdev_6832.cnf | 7 - mysql-test/suite/wsrep/t/mdev_6832.test | 17 - .../suite/wsrep/t/wsrep_variables_no_provider.cnf | 12 - .../suite/wsrep/t/wsrep_variables_no_provider.test | 38 - 609 files changed, 26229 insertions(+), 2185 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_gis_user_var_stm.result create mode 100644 mysql-test/suite/binlog/r/binlog_show_binlog_events_invalid_offset_silent.result create mode 100644 mysql-test/suite/binlog/t/binlog_gis_user_var_stm.test create mode 100644 mysql-test/suite/binlog/t/binlog_show_binlog_events_invalid_offset_silent.test create mode 100644 mysql-test/suite/compat/oracle/r/func_qualified.result create mode 100644 mysql-test/suite/compat/oracle/r/func_regexp_replace.result create mode 100644 mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result create mode 100644 mysql-test/suite/compat/oracle/r/vcol_innodb.result create mode 100644 mysql-test/suite/compat/oracle/t/func_qualified.test create mode 100644 mysql-test/suite/compat/oracle/t/func_regexp_replace.test create mode 100644 mysql-test/suite/compat/oracle/t/mysqldump_restore_func_qualified.test create mode 100644 mysql-test/suite/compat/oracle/t/vcol_innodb.test create mode 100644 mysql-test/suite/federated/update.result create mode 100644 mysql-test/suite/federated/update.test create mode 100644 mysql-test/suite/galera/r/MDEV-22232.result create mode 100644 mysql-test/suite/galera/r/MDEV-27806.result create mode 100644 mysql-test/suite/galera/r/MDEV-31272.result create mode 100644 mysql-test/suite/galera/r/MDEV-32549.result create mode 100644 mysql-test/suite/galera/r/MDEV-32938.result create mode 100644 mysql-test/suite/galera/r/galera_ist_mariabackup_verify_ca.result create mode 100644 mysql-test/suite/galera/r/galera_ist_rsync_verify_ca.result delete mode 100644 mysql-test/suite/galera/r/galera_var_node_address.result create mode 100644 mysql-test/suite/galera/t/MDEV-22232.test create mode 100644 mysql-test/suite/galera/t/MDEV-27806.opt create mode 100644 mysql-test/suite/galera/t/MDEV-27806.test create mode 100644 mysql-test/suite/galera/t/MDEV-31272.combinations create mode 100644 mysql-test/suite/galera/t/MDEV-31272.test create mode 100644 mysql-test/suite/galera/t/MDEV-32549.test create mode 100644 mysql-test/suite/galera/t/MDEV-32938.test create mode 100644 mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf create mode 100644 mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.test create mode 100644 mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf create mode 100644 mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.test delete mode 100644 mysql-test/suite/galera/t/galera_var_node_address.cnf delete mode 100644 mysql-test/suite/galera/t/galera_var_node_address.test create mode 100644 mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result create mode 100644 mysql-test/suite/galera_3nodes/r/galera_var_node_address.result create mode 100644 mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test create mode 100644 mysql-test/suite/galera_3nodes/t/galera_var_node_address.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_var_node_address.test create mode 100644 mysql-test/suite/galera_sr/r/MDEV-28971.result create mode 100644 mysql-test/suite/galera_sr/t/MDEV-28971.test create mode 100644 mysql-test/suite/innodb/r/add_foreign_key.result create mode 100644 mysql-test/suite/innodb/r/cascade_lock_wait.result create mode 100644 mysql-test/suite/innodb/r/doublewrite_debug.result create mode 100644 mysql-test/suite/innodb/r/fk_drop_alter.result create mode 100644 mysql-test/suite/innodb/r/import_update_stats.result create mode 100644 mysql-test/suite/innodb/r/index_length.result create mode 100644 mysql-test/suite/innodb/r/innodb-ac-non-locking-select.result create mode 100644 mysql-test/suite/innodb/r/innodb-lock-inherit-read_commited.result delete mode 100644 mysql-test/suite/innodb/r/innodb_bug12902967.result create mode 100644 mysql-test/suite/innodb/r/innodb_i_s_innodb_locks.result create mode 100644 mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_auto_recalc.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_auto_recalc_ddl.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_auto_recalc_lots.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_auto_recalc_on_nonexistent.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_external_pages.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_flag_global,off.rdiff create mode 100644 mysql-test/suite/innodb/r/innodb_stats_flag_global.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_sample_pages.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_table_flag_auto_recalc.result create mode 100644 mysql-test/suite/innodb/r/innodb_stats_table_flag_sample_pages.result create mode 100644 mysql-test/suite/innodb/r/innodb_ut_format_name.result create mode 100644 mysql-test/suite/innodb/r/mem_pressure.result delete mode 100644 mysql-test/suite/innodb/r/purge_thread_shutdown.result create mode 100644 mysql-test/suite/innodb/r/records_in_range,4k.rdiff create mode 100644 mysql-test/suite/innodb/r/records_in_range,8k.rdiff create mode 100644 mysql-test/suite/innodb/r/records_in_range.result create mode 100644 mysql-test/suite/innodb/r/tablespace_per_table_not_windows.result create mode 100644 mysql-test/suite/innodb/r/tablespace_per_table_windows.result create mode 100644 mysql-test/suite/innodb/t/add_foreign_key.test create mode 100644 mysql-test/suite/innodb/t/cascade_lock_wait.test create mode 100644 mysql-test/suite/innodb/t/doublewrite_debug.combinations create mode 100644 mysql-test/suite/innodb/t/doublewrite_debug.test create mode 100644 mysql-test/suite/innodb/t/fk_drop_alter.test create mode 100644 mysql-test/suite/innodb/t/import_update_stats.test create mode 100644 mysql-test/suite/innodb/t/index_length.test create mode 100644 mysql-test/suite/innodb/t/innodb-ac-non-locking-select.test create mode 100644 mysql-test/suite/innodb/t/innodb-lock-inherit-read_commited.test delete mode 100644 mysql-test/suite/innodb/t/innodb_bug12902967.test create mode 100644 mysql-test/suite/innodb/t/innodb_i_s_innodb_locks.test create mode 100644 mysql-test/suite/innodb/t/innodb_i_s_innodb_trx.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc.opt create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.opt create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc_ddl.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.opt create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc_lots.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.opt create mode 100644 mysql-test/suite/innodb/t/innodb_stats_auto_recalc_on_nonexistent.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_external_pages.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_fetch.opt create mode 100644 mysql-test/suite/innodb/t/innodb_stats_flag_global.combinations create mode 100644 mysql-test/suite/innodb/t/innodb_stats_flag_global.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_flag_global_analyze.inc create mode 100644 mysql-test/suite/innodb/t/innodb_stats_sample_pages.opt create mode 100644 mysql-test/suite/innodb/t/innodb_stats_sample_pages.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_table_flag_auto_recalc.test create mode 100644 mysql-test/suite/innodb/t/innodb_stats_table_flag_sample_pages.test create mode 100644 mysql-test/suite/innodb/t/innodb_ut_format_name.test create mode 100644 mysql-test/suite/innodb/t/mem_pressure.test delete mode 100644 mysql-test/suite/innodb/t/purge_thread_shutdown.test create mode 100644 mysql-test/suite/innodb/t/records_in_range.test create mode 100644 mysql-test/suite/innodb/t/tablespace_per_table_not_windows.opt create mode 100644 mysql-test/suite/innodb/t/tablespace_per_table_not_windows.test create mode 100644 mysql-test/suite/innodb/t/tablespace_per_table_windows.opt create mode 100644 mysql-test/suite/innodb/t/tablespace_per_table_windows.test create mode 100644 mysql-test/suite/innodb_fts/r/foreign_key_check.result create mode 100644 mysql-test/suite/innodb_fts/r/foreign_key_update.result create mode 100644 mysql-test/suite/innodb_fts/r/index_table.result create mode 100644 mysql-test/suite/innodb_fts/r/limit_union.result create mode 100644 mysql-test/suite/innodb_fts/r/misc.result create mode 100644 mysql-test/suite/innodb_fts/r/misc_1.result create mode 100644 mysql-test/suite/innodb_fts/r/opt.result create mode 100644 mysql-test/suite/innodb_fts/r/phrase.result create mode 100644 mysql-test/suite/innodb_fts/r/result_cache_limit.result create mode 100644 mysql-test/suite/innodb_fts/r/savepoint.result create mode 100644 mysql-test/suite/innodb_fts/r/subexpr.result create mode 100644 mysql-test/suite/innodb_fts/t/foreign_key_check.test create mode 100644 mysql-test/suite/innodb_fts/t/foreign_key_update.test create mode 100644 mysql-test/suite/innodb_fts/t/index_table.opt create mode 100644 mysql-test/suite/innodb_fts/t/index_table.test create mode 100644 mysql-test/suite/innodb_fts/t/limit_union.test create mode 100644 mysql-test/suite/innodb_fts/t/misc.test create mode 100644 mysql-test/suite/innodb_fts/t/misc_1.test create mode 100644 mysql-test/suite/innodb_fts/t/opt.opt create mode 100644 mysql-test/suite/innodb_fts/t/opt.test create mode 100644 mysql-test/suite/innodb_fts/t/phrase.opt create mode 100644 mysql-test/suite/innodb_fts/t/phrase.test create mode 100644 mysql-test/suite/innodb_fts/t/result_cache_limit.test create mode 100644 mysql-test/suite/innodb_fts/t/savepoint.test create mode 100644 mysql-test/suite/innodb_fts/t/subexpr.test create mode 100644 mysql-test/suite/innodb_gis/t/rtree_create_inplace.opt delete mode 100644 mysql-test/suite/innodb_zip/include/innodb_dml_ops.inc create mode 100644 mysql-test/suite/mariabackup/slave_provision_nolock.cnf create mode 100644 mysql-test/suite/mariabackup/slave_provision_nolock.result create mode 100644 mysql-test/suite/mariabackup/slave_provision_nolock.test create mode 100644 mysql-test/suite/perfschema/r/misc_session_status.result create mode 100644 mysql-test/suite/perfschema/t/misc_session_status.test create mode 100644 mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result create mode 100644 mysql-test/suite/plugins/t/sql_error_log_withdbinfo.opt create mode 100644 mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test create mode 100644 mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve-master.opt create mode 100644 mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.result create mode 100644 mysql-test/suite/roles/set_default_role_invalid_skip_name_resolve.test create mode 100644 mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_loaddata.result create mode 100644 mysql-test/suite/rpl/r/rpl_binlog_cache_disk_full_row.result create mode 100644 mysql-test/suite/rpl/r/rpl_deadlock_show_slave_status.result create mode 100644 mysql-test/suite/rpl/r/rpl_gis_user_var.result create mode 100644 mysql-test/suite/rpl/r/rpl_gtid_slave_filtering.result create mode 100644 mysql-test/suite/rpl/r/rpl_semi_sync_no_missed_ack_after_add_slave.result create mode 100644 mysql-test/suite/rpl/r/rpl_semi_sync_slave_enabled_consistent.result create mode 100644 mysql-test/suite/rpl/r/rpl_session_var2.result create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_loaddata.test create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row.test create mode 100644 mysql-test/suite/rpl/t/rpl_deadlock_show_slave_status.test create mode 100644 mysql-test/suite/rpl/t/rpl_gis_user_var.test create mode 100644 mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_gtid_slave_filtering.test create mode 100644 mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_semi_sync_no_missed_ack_after_add_slave.test create mode 100644 mysql-test/suite/rpl/t/rpl_semi_sync_slave_enabled_consistent.test create mode 100644 mysql-test/suite/rpl/t/rpl_session_var2-master.opt create mode 100644 mysql-test/suite/rpl/t/rpl_session_var2-slave.opt create mode 100644 mysql-test/suite/rpl/t/rpl_session_var2.test create mode 100644 mysql-test/suite/s3/debug.result create mode 100644 mysql-test/suite/s3/debug.test create mode 100644 mysql-test/suite/sys_vars/r/pseudo_slave_mode_notembedded.result create mode 100644 mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff create mode 100644 mysql-test/suite/sys_vars/t/pseudo_slave_mode_notembedded.test delete mode 100644 mysql-test/suite/wsrep/r/MDEV-22443.result delete mode 100644 mysql-test/suite/wsrep/r/MDEV-23092.result delete mode 100644 mysql-test/suite/wsrep/r/mdev_6832.result delete mode 100644 mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result delete mode 100644 mysql-test/suite/wsrep/t/MDEV-22443.cnf delete mode 100644 mysql-test/suite/wsrep/t/MDEV-22443.test delete mode 100644 mysql-test/suite/wsrep/t/MDEV-23092.cnf delete mode 100644 mysql-test/suite/wsrep/t/MDEV-23092.test delete mode 100644 mysql-test/suite/wsrep/t/mdev_6832.cnf delete mode 100644 mysql-test/suite/wsrep/t/mdev_6832.test delete mode 100644 mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf delete mode 100644 mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test (limited to 'mysql-test/suite') 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 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 (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 (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; @@ -4284,6 +4315,15 @@ delimiter ;// 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() @@ -4644,6 +4684,16 @@ delimiter ;// 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() @@ -4765,6 +4815,16 @@ delimiter ;// 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() @@ -4801,6 +4861,16 @@ delimiter ;// 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() @@ -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,11 +9806,20 @@ 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() @@ -10101,6 +10180,16 @@ delimiter ;// 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() @@ -10220,6 +10309,16 @@ delimiter ;// 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() @@ -10256,6 +10355,16 @@ delimiter ;// 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() @@ -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'; @@ -12360,6 +12469,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( ) @@ -12690,6 +12810,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( ) @@ -12799,6 +12930,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( ) @@ -12832,6 +12974,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( ) @@ -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; @@ -14850,6 +15003,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( ) @@ -15150,6 +15311,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( ) @@ -15250,6 +15419,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( ) @@ -15280,6 +15457,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( ) @@ -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_node_address.result b/mysql-test/suite/galera/r/galera_var_node_address.result deleted file mode 100644 index 6b91a9f3..00000000 --- a/mysql-test/suite/galera/r/galera_var_node_address.result +++ /dev/null @@ -1,22 +0,0 @@ -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; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE -4 -connection node_1; -CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; -connection node_2; -set global wsrep_sync_wait=15; -INSERT INTO t1 VALUES (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(*) -1 -connection node_1; -DROP TABLE t1; 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/t/galera_var_node_address.cnf b/mysql-test/suite/galera/t/galera_var_node_address.cnf deleted file mode 100644 index 0de0edaa..00000000 --- a/mysql-test/suite/galera/t/galera_var_node_address.cnf +++ /dev/null @@ -1,10 +0,0 @@ -!include ../galera_4nodes.cnf - -[mysqld.2] -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/t/galera_var_node_address.test deleted file mode 100644 index 99cb30e7..00000000 --- a/mysql-test/suite/galera/t/galera_var_node_address.test +++ /dev/null @@ -1,32 +0,0 @@ -# -# Test wsrep_node_address . The galera_var_node_address.cnf contains various settings for -# wsrep_node_address, so in this test we simply confirm that the cluster has started up correctly. -# - ---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'; ---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; -INSERT INTO t1 VALUES (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; - ---connection node_1 -DROP TABLE t1; 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_3nodes/r/galera_var_node_address.result b/mysql-test/suite/galera_3nodes/r/galera_var_node_address.result new file mode 100644 index 00000000..fe6c2a00 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_var_node_address.result @@ -0,0 +1,22 @@ +connection node_2; +connection node_1; +connection node_1; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE +3 +CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; +connection node_2; +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; +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_3nodes/t/galera_var_node_address.cnf b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.cnf new file mode 100644 index 00000000..aa0c47f1 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.cnf @@ -0,0 +1,8 @@ +!include ../galera_3nodes.cnf + +[mysqld.2] +wsrep_node_address=127.0.0.1 + +[mysqld.3] +wsrep_node_address=localhost + diff --git a/mysql-test/suite/galera_3nodes/t/galera_var_node_address.test b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.test new file mode 100644 index 00000000..08c0d2e4 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_var_node_address.test @@ -0,0 +1,32 @@ +# +# Test wsrep_node_address . The galera_var_node_address.cnf contains various settings for +# wsrep_node_address, so in this test we simply confirm that the cluster has started up correctly. +# + +--source include/galera_cluster.inc +--source include/have_innodb.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 + +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB; + +--connection node_2 +--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 +--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 Binary files /dev/null and b/mysql-test/suite/innodb/r/innodb_i_s_innodb_locks.result 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" where +# "" 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 souffle = 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 souffle 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 '' (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 '' (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 ''; +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 ; +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 ''/ +--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 ''/ +--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 ''; + +--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 "" +--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; @@ -163,6 +167,41 @@ ALTER TABLE s ORDER BY cache_size; 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 @@ @@ -721,6 +723,15 @@ NUMERIC_MIN_VALUE 0 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 @@ -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 @@ @@ -721,6 +723,15 @@ NUMERIC_MIN_VALUE 0 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 @@ -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 -- cgit v1.2.3