summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2021-04-06 12:52:44 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2021-04-06 12:52:44 +0200
commitc030f4c625b90baa17cb8c73a018a327aa12b557 (patch)
tree25466f53c50fc7d92e0b17f04c206f3ccf59eb47
parent28b76afceac1eb2c35e77439142daac53908cdc3 (diff)
parent6fe624b5acf51383d39eb0e547a03779d41cf4a8 (diff)
downloadmariadb-git-c030f4c625b90baa17cb8c73a018a327aa12b557.tar.gz
Commit last pull from origin
-rw-r--r--.gitignore11
-rw-r--r--CMakeLists.txt17
-rw-r--r--CREDITS13
-rw-r--r--VERSION2
-rw-r--r--client/completion_hash.cc3
-rw-r--r--client/mysql.cc6
-rw-r--r--client/mysqldump.c589
-rw-r--r--cmake/Internal/CPack/CPackRPM.cmake42
-rw-r--r--cmake/bison.cmake2
-rw-r--r--cmake/install_macros.cmake2
-rw-r--r--cmake/make_dist.cmake.in7
-rw-r--r--cmake/os/WindowsCache.cmake1
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake1
-rwxr-xr-xdebian/autobake-deb.sh6
-rw-r--r--debian/libmariadb3.install2
-rwxr-xr-xdebian/rules5
-rw-r--r--extra/mariabackup/backup_copy.cc46
-rw-r--r--extra/mariabackup/backup_copy.h3
-rw-r--r--extra/mariabackup/backup_debug.h32
-rw-r--r--extra/mariabackup/datasink.h6
-rw-r--r--extra/mariabackup/ds_archive.cc1
-rw-r--r--extra/mariabackup/ds_buffer.cc1
-rw-r--r--extra/mariabackup/ds_compress.cc1
-rw-r--r--extra/mariabackup/ds_local.cc6
-rw-r--r--extra/mariabackup/ds_stdout.cc1
-rw-r--r--extra/mariabackup/ds_tmpfile.cc1
-rw-r--r--extra/mariabackup/ds_xbstream.cc1
-rw-r--r--extra/mariabackup/encryption_plugin.cc1
-rw-r--r--extra/mariabackup/fil_cur.cc50
-rw-r--r--extra/mariabackup/fil_cur.h15
-rw-r--r--extra/mariabackup/innobackupex.cc21
-rw-r--r--extra/mariabackup/write_filt.cc26
-rw-r--r--extra/mariabackup/write_filt.h8
-rw-r--r--extra/mariabackup/xtrabackup.cc486
-rw-r--r--extra/mariabackup/xtrabackup.h29
-rw-r--r--include/my_sys.h7
-rw-r--r--include/mysql/plugin_ftparser.h4
-rw-r--r--include/mysql/service_wsrep.h3
-rw-r--r--include/mysql_com.h2
-rw-r--r--include/service_versions.h2
m---------libmariadb0
-rw-r--r--libmysqld/lib_sql.cc3
-rw-r--r--man/mysqldump.1116
-rw-r--r--mysql-test/extra/binlog_tests/binlog_xa_recover.inc281
-rw-r--r--mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_semi_sync.inc72
-rw-r--r--mysql-test/include/ctype_utf8mb4.inc2
-rw-r--r--mysql-test/lib/My/Debugger.pm266
-rw-r--r--mysql-test/lib/mtr_report.pm10
-rwxr-xr-xmysql-test/mysql-test-run.pl793
-rw-r--r--mysql-test/r/contributors.result13
-rw-r--r--mysql-test/r/create.result26
-rw-r--r--mysql-test/r/cte_nonrecursive.result85
-rw-r--r--mysql-test/r/cte_nonrecursive_not_embedded.result48
-rw-r--r--mysql-test/r/cte_recursive.result496
-rw-r--r--mysql-test/r/ctype_utf16.result2
-rw-r--r--mysql-test/r/ctype_utf16le.result2
-rw-r--r--mysql-test/r/ctype_utf32.result4
-rw-r--r--mysql-test/r/ctype_utf8.result4
-rw-r--r--mysql-test/r/ctype_utf8mb4.result10
-rw-r--r--mysql-test/r/ctype_utf8mb4_heap.result4
-rw-r--r--mysql-test/r/ctype_utf8mb4_innodb.result8
-rw-r--r--mysql-test/r/ctype_utf8mb4_myisam.result8
-rw-r--r--mysql-test/r/derived_cond_pushdown.result41
-rw-r--r--mysql-test/r/func_gconcat.result12
-rw-r--r--mysql-test/r/func_group.result34
-rw-r--r--mysql-test/r/func_like.result18
-rw-r--r--mysql-test/r/gis-json.result7
-rw-r--r--mysql-test/r/gis-precise.result111
-rw-r--r--mysql-test/r/group_by.result44
-rw-r--r--mysql-test/r/information_schema.result15
-rw-r--r--mysql-test/r/innodb_ext_key.result16
-rw-r--r--mysql-test/r/join_cache.result83
-rw-r--r--mysql-test/r/kill.result5
-rw-r--r--mysql-test/r/lock_view.result34
-rw-r--r--mysql-test/r/mix2_myisam.result2
-rw-r--r--mysql-test/r/myisam.result15
-rw-r--r--mysql-test/r/mysql_upgrade.result132
-rw-r--r--mysql-test/r/mysqldump-system,win.rdiff120
-rw-r--r--mysql-test/r/mysqldump-system.result467
-rw-r--r--mysql-test/r/mysqldump.result272
-rw-r--r--mysql-test/r/order_by.result22
-rw-r--r--mysql-test/r/partition_innodb.result2
-rw-r--r--mysql-test/r/precedence.result4
-rw-r--r--mysql-test/r/ps.result29
-rw-r--r--mysql-test/r/ps_show_log.result65
-rw-r--r--mysql-test/r/query_cache.result28
-rw-r--r--mysql-test/r/range.result42
-rw-r--r--mysql-test/r/range_mrr_icp.result42
-rw-r--r--mysql-test/r/selectivity.result58
-rw-r--r--mysql-test/r/selectivity_innodb.result58
-rw-r--r--mysql-test/r/set_statement.result25
-rw-r--r--mysql-test/r/skip_grants.result38
-rw-r--r--mysql-test/r/sp-ucs2.result6
-rw-r--r--mysql-test/r/sp.result20
-rw-r--r--mysql-test/r/stat_tables.result14
-rw-r--r--mysql-test/r/stat_tables_innodb.result14
-rw-r--r--mysql-test/r/status2.result10
-rw-r--r--mysql-test/r/subselect.result38
-rw-r--r--mysql-test/r/subselect4.result35
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result38
-rw-r--r--mysql-test/r/subselect_no_mat.result38
-rw-r--r--mysql-test/r/subselect_no_opts.result38
-rw-r--r--mysql-test/r/subselect_no_scache.result38
-rw-r--r--mysql-test/r/subselect_no_semijoin.result38
-rw-r--r--mysql-test/r/table_elim.result2
-rw-r--r--mysql-test/r/type_decimal.result89
-rw-r--r--mysql-test/r/type_year.result75
-rw-r--r--mysql-test/r/user_limits.result27
-rw-r--r--mysql-test/r/userstat.result15
-rw-r--r--mysql-test/r/view.result66
-rw-r--r--mysql-test/r/win.result26
-rw-r--r--mysql-test/r/xa.result28
-rw-r--r--mysql-test/suite/binlog/disabled.def2
-rw-r--r--mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result7
-rw-r--r--mysql-test/suite/binlog/r/binlog_truncate_innodb.result185
-rw-r--r--mysql-test/suite/binlog/r/binlog_xa_recover.result17
-rw-r--r--mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test1
-rw-r--r--mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_truncate_innodb.test3
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_recover.opt (renamed from mysql-test/suite/binlog/t/binlog_xa_recover-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_recover.test278
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt1
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_xa_recover.result18
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_xa_recover.test2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_semi_sync.result22
-rw-r--r--mysql-test/suite/encryption/r/tempfiles_encrypted.result26
-rw-r--r--mysql-test/suite/engines/funcs/disabled.def95
-rw-r--r--mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result5
-rw-r--r--mysql-test/suite/engines/funcs/r/ix_unique_lob.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl000011.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl000017.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000010.result (renamed from mysql-test/suite/engines/funcs/r/rpl000010.result)12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000011.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000013.result (renamed from mysql-test/suite/engines/funcs/r/rpl000013.result)19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000015.result69
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_000017.result (renamed from mysql-test/suite/engines/funcs/t/rpl000017.test)17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result41
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff72
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_alter.result125
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_alter_db.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_bit.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_bit_npk.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_change_master.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_create_database.result48
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_do_grant.result267
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_drop.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_drop_db.result23
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result22
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result21
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result38
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_free_items.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_get_lock.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result20
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_init_slave.result20
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_insert.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_insert_select.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata2.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_loadfile.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_log_pos.result51
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_many_optimize.result10
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_misc_functions.result59
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_multi_delete.result12
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_multi_update4.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_ps.result40
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result55
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_relayspace.result23
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_NOW.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_USER.result21
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_drop.result39
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_func001.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result60
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result35
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result49
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp001.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp005.result30
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp008.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp009.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp010.result15
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp011.result13
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_sp012.result28
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_trig001.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_trig002.result18
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_trig003.result19
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_until.result37
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_view01.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id1.result24
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_server_id2.result35
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_session_var.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sf.result9
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_skip_error.result14
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_slave_status.result107
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff476
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp.result995
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp004.result17
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_sp_effects.result96
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result23
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result35
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result22
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result33
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result49
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result116
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_temp_table.result29
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_temporary.result157
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_trigger.result186
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result16
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_user_variables.result243
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_variables.result9
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_view.result66
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000010-slave.opt1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000010.test19
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000011.test17
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000013.test61
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl000017-slave.opt1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000010.test2
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000011.test18
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000013.test2
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000015.test11
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_000017.test2
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test38
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test47
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_alter.test24
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_alter_db.test12
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_bit.test93
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_bit_npk.test116
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_change_master.test37
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_create_database.test72
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_do_grant.test98
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_drop.test16
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_drop_db.test61
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test17
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test15
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test68
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test24
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_free_items.test22
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_get_lock.test49
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test59
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test51
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test38
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_init_slave.test34
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_insert.test44
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_insert_select.test7
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata2.test5
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test52
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test30
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test19
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_loadfile.test6
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_log_pos.test58
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_many_optimize.test22
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test18
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_misc_functions.test46
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_multi_delete.test26
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test68
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_multi_update4.test45
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_ps.test49
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test47
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_relayspace.test34
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test30
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_NOW.test74
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_USER.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_drop.test48
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_func001.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test21
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test4
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp001.test146
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp005.test108
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp008.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp009.test102
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp010.test80
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp011.test111
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_sp012.test75
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test8
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_trig001.test100
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_trig002.test82
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_trig003.test152
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_until.test126
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_view01.test82
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id1.test22
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_server_id2.test26
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_session_var.test42
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sf.test3
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_skip_error.test13
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_slave_status.test58
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sp.test496
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sp004.test97
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_sp_effects.test208
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test23
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test20
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test93
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test565
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_temp_table.test69
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_temporary.test235
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_trigger.test107
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test35
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_user_variables.test57
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_variables.test3
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_view-slave.opt1
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_view.test155
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_decimal.result17
-rw-r--r--mysql-test/suite/federated/federatedx.result26
-rw-r--r--mysql-test/suite/federated/federatedx.test29
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraints.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_is.result8
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_is_embedded.result8
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraints.test4
-rw-r--r--mysql-test/suite/galera/disabled.def9
-rw-r--r--mysql-test/suite/galera/include/galera_base_port.inc8
-rw-r--r--mysql-test/suite/galera/include/galera_st_disconnect_slave.inc4
-rw-r--r--mysql-test/suite/galera/include/galera_start_replication.inc (renamed from mysql-test/suite/galera/include/galera_load_provider.inc)1
-rw-r--r--mysql-test/suite/galera/include/galera_stop_replication.inc (renamed from mysql-test/suite/galera/include/galera_unload_provider.inc)3
-rw-r--r--mysql-test/suite/galera/r/MDEV-24327.result33
-rw-r--r--mysql-test/suite/galera/r/galera#500.result2
-rw-r--r--mysql-test/suite/galera/r/galera_UK_conflict.result89
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_replay.result95
-rw-r--r--mysql-test/suite/galera/r/galera_bf_kill.result50
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete.result26
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result21
-rw-r--r--mysql-test/suite/galera/r/galera_fulltext.result28
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup.result2
-rw-r--r--mysql-test/suite/galera/r/galera_ist_restart_joiner.result3
-rw-r--r--mysql-test/suite/galera/r/galera_ist_rsync.result2
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_opt.result73
-rw-r--r--mysql-test/suite/galera/r/galera_ssl_upgrade.result10
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump.result2
-rw-r--r--mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result2
-rw-r--r--mysql-test/suite/galera/r/galera_trigger.result44
-rw-r--r--mysql-test/suite/galera/r/galera_var_sst_auth.result16
-rw-r--r--mysql-test/suite/galera/r/galera_virtual_blob.result19
-rw-r--r--mysql-test/suite/galera/r/lp1376747-4.result13
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33.result2
-rw-r--r--mysql-test/suite/galera/t/MDEV-24327.cnf6
-rw-r--r--mysql-test/suite/galera/t/MDEV-24327.test87
-rw-r--r--mysql-test/suite/galera/t/galera#500.test7
-rw-r--r--mysql-test/suite/galera/t/galera_UK_conflict.test148
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_replay.cnf11
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_replay.test200
-rw-r--r--mysql-test/suite/galera/t/galera_bf_kill.test74
-rw-r--r--mysql-test/suite/galera/t/galera_defaults.test2
-rw-r--r--mysql-test/suite/galera/t/galera_fk_cascade_delete.test27
-rw-r--r--mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test34
-rw-r--r--mysql-test/suite/galera/t/galera_fulltext.test23
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_ist_restart_joiner.test4
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.inc42
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.test43
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt.cnf15
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin_opt.test2
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_error.test3
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_simple.test3
-rw-r--r--mysql-test/suite/galera/t/galera_ssl_upgrade.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_ssl_upgrade.test20
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test2
-rw-r--r--mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test4
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_sequential.test3
-rw-r--r--mysql-test/suite/galera/t/galera_toi_lock_shared.test3
-rw-r--r--mysql-test/suite/galera/t/galera_trigger.test36
-rw-r--r--mysql-test/suite/galera/t/galera_truncate.test6
-rw-r--r--mysql-test/suite/galera/t/galera_truncate_temporary.test3
-rw-r--r--mysql-test/suite/galera/t/galera_var_sst_auth.test29
-rw-r--r--mysql-test/suite/galera/t/galera_virtual_blob.test10
-rw-r--r--mysql-test/suite/galera/t/lp1376747-4.test30
-rw-r--r--mysql-test/suite/galera_3nodes/disabled.def11
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test4
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test4
-rw-r--r--mysql-test/suite/gcol/inc/gcol_column_def_options.inc5
-rw-r--r--mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result14
-rw-r--r--mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result14
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_fk.result33
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_fk.test41
-rw-r--r--mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc152
-rw-r--r--mysql-test/suite/innodb/r/alter_large_dml.result10
-rw-r--r--mysql-test/suite/innodb/r/alter_mdl_timeout.result23
-rw-r--r--mysql-test/suite/innodb/r/alter_table.result16
-rw-r--r--mysql-test/suite/innodb/r/alter_varchar_change.result11
-rw-r--r--mysql-test/suite/innodb/r/file_format_defaults.result2
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb.result23
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug60049.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb_multi_update.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result17
-rw-r--r--mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result17
-rw-r--r--mysql-test/suite/innodb/r/truncate_foreign.result11
-rw-r--r--mysql-test/suite/innodb/t/alter_large_dml.test10
-rw-r--r--mysql-test/suite/innodb/t/alter_mdl_timeout.opt1
-rw-r--r--mysql-test/suite/innodb/t/alter_mdl_timeout.test32
-rw-r--r--mysql-test/suite/innodb/t/alter_table.test15
-rw-r--r--mysql-test/suite/innodb/t/alter_varchar_change.test12
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb.test18
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60049-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60049.test49
-rw-r--r--mysql-test/suite/innodb/t/innodb_multi_update.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test8
-rw-r--r--mysql-test/suite/innodb/t/truncate_foreign.test13
-rw-r--r--mysql-test/suite/innodb_fts/r/create.result10
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result32
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug.result26
-rw-r--r--mysql-test/suite/innodb_fts/t/create.test11
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test41
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug.test31
-rw-r--r--mysql-test/suite/innodb_gis/t/1.test13
-rw-r--r--mysql-test/suite/innodb_gis/t/bug16236208.test1
-rw-r--r--mysql-test/suite/innodb_gis/t/create_spatial_index.test1
-rw-r--r--mysql-test/suite/innodb_gis/t/gis.test13
-rw-r--r--mysql-test/suite/innodb_gis/t/precise.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree.test6
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_purge.test6
-rw-r--r--mysql-test/suite/innodb_zip/r/index_large_prefix.result6
-rw-r--r--mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result2
-rw-r--r--mysql-test/suite/maria/maria-ucs2.result4
-rw-r--r--mysql-test/suite/maria/maria.result14
-rw-r--r--mysql-test/suite/maria/maria3.result2
-rw-r--r--mysql-test/suite/maria/mrr.result4
-rw-r--r--mysql-test/suite/mariabackup/error_during_copyback.result9
-rw-r--r--mysql-test/suite/mariabackup/error_during_copyback.test25
-rw-r--r--mysql-test/suite/mariabackup/include/corrupt-page.pl146
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_during_backup.test2
-rw-r--r--mysql-test/suite/mariabackup/innodb_force_recovery.result26
-rw-r--r--mysql-test/suite/mariabackup/innodb_force_recovery.test138
-rw-r--r--mysql-test/suite/mariabackup/log_page_corruption.opt1
-rw-r--r--mysql-test/suite/mariabackup/log_page_corruption.result142
-rw-r--r--mysql-test/suite/mariabackup/log_page_corruption.test430
-rw-r--r--mysql-test/suite/perfschema/r/schema.result22
-rw-r--r--mysql-test/suite/perfschema/r/table_schema.result22
-rw-r--r--mysql-test/suite/perfschema/r/threads_mysql.result22
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result22
-rw-r--r--mysql-test/suite/plugins/t/server_audit.test11
-rw-r--r--mysql-test/suite/roles/show_grants.result15
-rw-r--r--mysql-test/suite/roles/show_grants.test13
-rw-r--r--mysql-test/suite/rpl/disabled.def3
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_grant.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_master_pos_wait.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_relay_max_extension.result37
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_USER.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_utf32.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_vcol_crash.result380
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_spec_variables.result60
-rw-r--r--mysql-test/suite/rpl/r/rpl_table_options.result9
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_grant.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table_update.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_master_pos_wait.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_retry.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_max_extension.test109
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_USER.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_trig002.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_vcol_crash.test425
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_spec_variables.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_table_options.test1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result77
-rw-r--r--mysql-test/suite/sys_vars/r/max_sort_length_basic.result199
-rw-r--r--mysql-test/suite/sys_vars/r/max_sort_length_func.result442
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result16
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result6
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result6
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result4
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result47
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_provider_basic.result40
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result49
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test65
-rw-r--r--mysql-test/suite/sys_vars/t/max_sort_length_basic.test225
-rw-r--r--mysql-test/suite/sys_vars/t/max_sort_length_func.test157
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test43
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_provider_basic.test39
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test51
-rw-r--r--mysql-test/suite/wsrep/disabled.def2
-rw-r--r--mysql-test/suite/wsrep/r/variables.result81
-rw-r--r--mysql-test/suite/wsrep/t/variables.test43
-rw-r--r--mysql-test/t/create.test148
-rw-r--r--mysql-test/t/cte_nonrecursive.test60
-rw-r--r--mysql-test/t/cte_nonrecursive_not_embedded.test58
-rw-r--r--mysql-test/t/cte_recursive.test179
-rw-r--r--mysql-test/t/ctype_utf8mb4.test2
-rw-r--r--mysql-test/t/derived_cond_pushdown.test28
-rw-r--r--mysql-test/t/func_gconcat.test10
-rw-r--r--mysql-test/t/func_group.test28
-rw-r--r--mysql-test/t/func_like.test29
-rw-r--r--mysql-test/t/gis-json.test2
-rw-r--r--mysql-test/t/gis-precise.test78
-rw-r--r--mysql-test/t/group_by.test33
-rw-r--r--mysql-test/t/information_schema.test18
-rw-r--r--mysql-test/t/innodb_ext_key.test20
-rw-r--r--mysql-test/t/join_cache.test60
-rw-r--r--mysql-test/t/kill.test6
-rw-r--r--mysql-test/t/lock_view.test18
-rw-r--r--mysql-test/t/myisam.test1
-rw-r--r--mysql-test/t/mysql_upgrade.test32
-rw-r--r--mysql-test/t/mysqldump-system.test157
-rw-r--r--mysql-test/t/mysqldump.test23
-rw-r--r--mysql-test/t/order_by.test8
-rw-r--r--mysql-test/t/precedence.test3
-rw-r--r--mysql-test/t/ps.test24
-rw-r--r--mysql-test/t/ps_show_log.test73
-rw-r--r--mysql-test/t/query_cache.test10
-rw-r--r--mysql-test/t/range.test48
-rw-r--r--mysql-test/t/selectivity.test45
-rw-r--r--mysql-test/t/set_statement.test23
-rw-r--r--mysql-test/t/skip_grants.opt (renamed from mysql-test/t/skip_grants-master.opt)0
-rw-r--r--mysql-test/t/skip_grants.test60
-rw-r--r--mysql-test/t/sp-ucs2.test6
-rw-r--r--mysql-test/t/sp.test25
-rw-r--r--mysql-test/t/stat_tables.test12
-rw-r--r--mysql-test/t/status2.test11
-rw-r--r--mysql-test/t/subselect.test35
-rw-r--r--mysql-test/t/subselect4.test35
-rw-r--r--mysql-test/t/type_decimal.test44
-rw-r--r--mysql-test/t/type_year.test38
-rw-r--r--mysql-test/t/user_limits.test26
-rw-r--r--mysql-test/t/userstat.test22
-rw-r--r--mysql-test/t/view.test68
-rw-r--r--mysql-test/t/win.test20
-rw-r--r--mysql-test/t/xa.test44
-rw-r--r--mysql-test/unstable-tests294
-rw-r--r--mysys/array.c5
-rw-r--r--mysys/lf_hash.c28
-rw-r--r--mysys/my_addr_resolve.c2
-rw-r--r--mysys/my_alloc.c2
-rw-r--r--mysys/my_seek.c2
-rw-r--r--plugin/auth_pam/CMakeLists.txt7
-rw-r--r--plugin/feedback/sender_thread.cc2
-rw-r--r--plugin/server_audit/server_audit.c44
-rw-r--r--plugin/userstat/index_stats.cc2
-rw-r--r--plugin/userstat/table_stats.cc3
-rw-r--r--scripts/CMakeLists.txt1
-rw-r--r--scripts/mysql_system_tables_fix.sql25
-rw-r--r--scripts/mysql_to_mariadb.sql22
-rw-r--r--scripts/mysqld_multi.sh15
-rw-r--r--scripts/mysqld_safe.sh10
-rw-r--r--scripts/wsrep_sst_common.sh3
-rw-r--r--scripts/wsrep_sst_mariabackup.sh6
-rw-r--r--scripts/wsrep_sst_rsync.sh8
-rw-r--r--scripts/wsrep_sst_xtrabackup-v2.sh6
-rw-r--r--sql/contributors.h13
-rw-r--r--sql/create_options.cc5
-rw-r--r--sql/field.cc14
-rw-r--r--sql/field.h3
-rw-r--r--sql/filesort.cc14
-rw-r--r--sql/ha_partition.cc6
-rw-r--r--sql/handler.cc9
-rw-r--r--sql/handler.h14
-rw-r--r--sql/item.cc47
-rw-r--r--sql/item.h35
-rw-r--r--sql/item_cmpfunc.cc33
-rw-r--r--sql/item_cmpfunc.h7
-rw-r--r--sql/item_create.cc36
-rw-r--r--sql/item_func.cc3
-rw-r--r--sql/item_geofunc.cc146
-rw-r--r--sql/item_geofunc.h14
-rw-r--r--sql/item_subselect.cc71
-rw-r--r--sql/item_subselect.h7
-rw-r--r--sql/item_sum.cc25
-rw-r--r--sql/key.cc9
-rw-r--r--sql/log.cc4
-rw-r--r--sql/log.h4
-rw-r--r--sql/log_event.cc48
-rw-r--r--sql/mdl.cc11
-rw-r--r--sql/mf_iocache_encr.cc15
-rw-r--r--sql/mysqld.cc47
-rw-r--r--sql/mysqld.h4
-rw-r--r--sql/opt_range.cc159
-rw-r--r--sql/opt_sum.cc3
-rw-r--r--sql/partition_info.cc4
-rw-r--r--sql/protocol.cc6
-rw-r--r--sql/rpl_gtid.cc4
-rw-r--r--sql/rpl_injector.cc56
-rw-r--r--sql/rpl_parallel.cc5
-rw-r--r--sql/rpl_rli.cc22
-rw-r--r--sql/signal_handler.cc14
-rw-r--r--sql/slave.cc196
-rw-r--r--sql/sp_head.cc8
-rw-r--r--sql/spatial.cc189
-rw-r--r--sql/spatial.h22
-rw-r--r--sql/sql_acl.cc9
-rw-r--r--sql/sql_admin.cc20
-rw-r--r--sql/sql_base.cc156
-rw-r--r--sql/sql_cache.cc4
-rw-r--r--sql/sql_cache.h2
-rw-r--r--sql/sql_class.cc28
-rw-r--r--sql/sql_class.h75
-rw-r--r--sql/sql_connect.cc4
-rw-r--r--sql/sql_cte.cc27
-rw-r--r--sql/sql_derived.cc33
-rw-r--r--sql/sql_handler.cc5
-rw-r--r--sql/sql_help.cc3
-rw-r--r--sql/sql_insert.cc7
-rw-r--r--sql/sql_join_cache.cc93
-rw-r--r--sql/sql_join_cache.h11
-rw-r--r--sql/sql_lex.cc11
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_manager.cc87
-rw-r--r--sql/sql_manager.h2
-rw-r--r--sql/sql_parse.cc323
-rw-r--r--sql/sql_parse.h1
-rw-r--r--sql/sql_plugin.h5
-rw-r--r--sql/sql_plugin_services.ic1
-rw-r--r--sql/sql_prepare.cc36
-rw-r--r--sql/sql_repl.cc17
-rw-r--r--sql/sql_repl.h1
-rw-r--r--sql/sql_select.cc56
-rw-r--r--sql/sql_select.h18
-rw-r--r--sql/sql_show.cc33
-rw-r--r--sql/sql_statistics.cc108
-rw-r--r--sql/sql_statistics.h11
-rw-r--r--sql/sql_string.cc11
-rw-r--r--sql/sql_table.cc13
-rw-r--r--sql/sql_test.cc7
-rw-r--r--sql/sql_truncate.cc9
-rw-r--r--sql/sql_type.h2
-rw-r--r--sql/sql_union.cc107
-rw-r--r--sql/sql_update.cc10
-rw-r--r--sql/sql_view.cc2
-rw-r--r--sql/sql_yacc.yy72
-rw-r--r--sql/structs.h2
-rw-r--r--sql/sys_vars.cc12
-rw-r--r--sql/table.cc10
-rw-r--r--sql/table.h49
-rw-r--r--sql/transaction.cc7
-rw-r--r--sql/unireg.cc12
-rw-r--r--sql/unireg.h3
-rw-r--r--sql/wsrep_applier.cc4
-rw-r--r--sql/wsrep_dummy.cc8
-rw-r--r--sql/wsrep_mysqld.cc24
-rw-r--r--sql/wsrep_notify.cc10
-rw-r--r--sql/wsrep_sst.cc68
-rw-r--r--sql/wsrep_thd.cc52
-rw-r--r--storage/archive/ha_archive.cc4
-rw-r--r--storage/cassandra/ha_cassandra.cc42
-rw-r--r--storage/connect/bson.cpp37
-rw-r--r--storage/connect/bson.h16
-rw-r--r--storage/connect/bsonudf.cpp11
-rw-r--r--storage/connect/filamtxt.cpp2
-rw-r--r--storage/connect/ha_connect.cc19
-rw-r--r--storage/connect/jsonudf.cpp4
-rw-r--r--storage/connect/mysql-test/connect/r/xml.result3
-rw-r--r--storage/connect/mysql-test/connect/t/xml.test1
-rw-r--r--storage/connect/plugutil.cpp6
-rw-r--r--storage/csv/ha_tina.cc9
-rw-r--r--storage/federated/ha_federated.cc19
-rw-r--r--storage/federatedx/federatedx_io_mysql.cc16
-rw-r--r--storage/federatedx/federatedx_io_null.cc10
-rw-r--r--storage/federatedx/ha_federatedx.cc23
-rw-r--r--storage/federatedx/ha_federatedx.h7
-rw-r--r--storage/innobase/.clang-format-old (renamed from storage/innobase/.clang-format)0
-rw-r--r--storage/innobase/btr/btr0btr.cc12
-rw-r--r--storage/innobase/btr/btr0cur.cc30
-rw-r--r--storage/innobase/btr/btr0sea.cc71
-rw-r--r--storage/innobase/buf/buf0buf.cc58
-rw-r--r--storage/innobase/dict/dict0dict.cc139
-rw-r--r--storage/innobase/dict/dict0stats.cc10
-rw-r--r--storage/innobase/fil/fil0fil.cc81
-rw-r--r--storage/innobase/fts/fts0fts.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc763
-rw-r--r--storage/innobase/handler/ha_innodb.h7
-rw-r--r--storage/innobase/handler/handler0alter.cc57
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc137
-rw-r--r--storage/innobase/include/dict0dict.h24
-rw-r--r--storage/innobase/include/dyn0buf.h20
-rw-r--r--storage/innobase/include/ha_prototypes.h4
-rw-r--r--storage/innobase/include/ibuf0ibuf.h8
-rw-r--r--storage/innobase/include/mtr0mtr.h7
-rw-r--r--storage/innobase/include/os0file.h3
-rw-r--r--storage/innobase/include/que0que.h3
-rw-r--r--storage/innobase/include/row0log.h4
-rw-r--r--storage/innobase/include/row0log.ic2
-rw-r--r--storage/innobase/include/row0mysql.h8
-rw-r--r--storage/innobase/include/srv0srv.h7
-rw-r--r--storage/innobase/include/sync0rw.h2
-rw-r--r--storage/innobase/include/trx0trx.h19
-rw-r--r--storage/innobase/include/univ.i4
-rw-r--r--storage/innobase/lock/lock0lock.cc228
-rw-r--r--storage/innobase/log/log0recv.cc9
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc72
-rw-r--r--storage/innobase/os/os0file.cc9
-rw-r--r--storage/innobase/page/page0zip.cc27
-rw-r--r--storage/innobase/que/que0que.cc3
-rw-r--r--storage/innobase/rem/rem0rec.cc17
-rw-r--r--storage/innobase/row/row0import.cc85
-rw-r--r--storage/innobase/row/row0ins.cc2
-rw-r--r--storage/innobase/row/row0log.cc5
-rw-r--r--storage/innobase/row/row0merge.cc6
-rw-r--r--storage/innobase/row/row0mysql.cc5
-rw-r--r--storage/innobase/row/row0sel.cc26
-rw-r--r--storage/innobase/row/row0upd.cc159
-rw-r--r--storage/innobase/srv/srv0srv.cc8
-rw-r--r--storage/innobase/srv/srv0start.cc13
-rw-r--r--storage/innobase/sync/sync0rw.cc2
-rw-r--r--storage/innobase/trx/trx0rec.cc22
-rw-r--r--storage/innobase/trx/trx0trx.cc18
-rw-r--r--storage/maria/ma_recovery_util.c1
-rw-r--r--storage/mroonga/ha_mroonga.cpp28
-rw-r--r--storage/mroonga/lib/mrn_debug_column_access.cpp2
-rw-r--r--storage/mroonga/lib/mrn_debug_column_access.hpp6
-rw-r--r--storage/myisam/mi_key.c7
-rw-r--r--storage/oqgraph/CMakeLists.txt4
-rw-r--r--storage/oqgraph/ha_oqgraph.cc10
-rw-r--r--storage/perfschema/pfs_engine_table.cc23
-rw-r--r--storage/perfschema/pfs_setup_object.cc14
-rw-r--r--storage/perfschema/table_accounts.cc4
-rw-r--r--storage/perfschema/table_esgs_by_account_by_event_name.cc4
-rw-r--r--storage/perfschema/table_esgs_by_host_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esgs_by_user_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_by_account_by_event_name.cc4
-rw-r--r--storage/perfschema/table_esms_by_host_by_event_name.cc2
-rw-r--r--storage/perfschema/table_esms_by_user_by_event_name.cc2
-rw-r--r--storage/perfschema/table_ews_by_account_by_event_name.cc4
-rw-r--r--storage/perfschema/table_ews_by_host_by_event_name.cc2
-rw-r--r--storage/perfschema/table_ews_by_user_by_event_name.cc2
-rw-r--r--storage/perfschema/table_hosts.cc2
-rw-r--r--storage/perfschema/table_setup_actors.cc6
-rw-r--r--storage/perfschema/table_threads.cc4
-rw-r--r--storage/perfschema/table_users.cc2
-rw-r--r--storage/rocksdb/ha_rocksdb.cc11
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/issue896.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result6
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_char_indexes.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/checkpoint.test2
-rw-r--r--storage/rocksdb/rdb_datadic.cc6
-rw-r--r--storage/sequence/sequence.cc4
-rw-r--r--storage/sphinx/ha_sphinx.cc4
-rw-r--r--storage/spider/ha_spider.cc12
-rw-r--r--storage/spider/spd_db_conn.cc48
-rw-r--r--storage/spider/spd_db_mysql.cc17
-rw-r--r--storage/tokudb/ha_tokudb.cc16
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_decimal.result5
-rw-r--r--strings/ctype-bin.c4
-rw-r--r--strings/ctype-tis620.c6
-rw-r--r--strings/ctype-ucs2.c10
-rw-r--r--strings/decimal.c63
-rw-r--r--support-files/mariadb.pc.in5
-rw-r--r--support-files/rpm/server-postin.sh6
-rw-r--r--support-files/rpm/server-posttrans.sh11
-rwxr-xr-xtests/grant.pl750
-rw-r--r--unittest/mysys/stacktrace-t.c2
-rw-r--r--unittest/sql/mf_iocache-t.cc2
-rw-r--r--vio/viossl.c74
-rw-r--r--win/packaging/heidisql.cmake2
-rw-r--r--zlib/CMakeLists.txt39
774 files changed, 18745 insertions, 13537 deletions
diff --git a/.gitignore b/.gitignore
index b9490fd8312..00754884d3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-bld2/
*-t
*.ctest
*.reject
@@ -508,3 +507,13 @@ FakesAssemblies/
# QtCreator && CodeBlocks
*.cbp
+compile_commands.json
+.clang-format
+.kscope/
+.vimrc
+.editorconfig
+.kateconfig
+*.kdev4
+
+# Visual Studio Code workspace
+.vscode/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4734c6f7d5f..80f87af2cb5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,9 @@ ENDIF()
IF(POLICY CMP0054)
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF()
+IF(POLICY CMP0075)
+ CMAKE_POLICY(SET CMP0075 NEW)
+ENDIF()
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
@@ -193,21 +196,17 @@ OPTION(WITH_ASAN "Enable address sanitizer" OFF)
IF (WITH_ASAN)
# this flag might be set by default on some OS
MY_CHECK_AND_SET_COMPILER_FLAG("-U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
- # gcc 4.8.1 and new versions of clang
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fPIC"
DEBUG RELWITHDEBINFO)
SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC})
SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC})
IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE)
+ OPTION(WITH_ASAN_SCOPE "Enable -fsanitize-address-use-after-scope" OFF)
SET(WITH_ASAN_OK 1)
- ELSE()
- # older versions of clang
- MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC"
- DEBUG RELWITHDEBINFO)
- SET(HAVE_C_FADDRESS ${have_C__faddress_sanitizer__fPIC})
- SET(HAVE_CXX_FADDRESS ${have_CXX__faddress_sanitizer__fPIC})
- IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS)
- SET(WITH_ASAN_OK 1)
+ IF(WITH_ASAN_SCOPE)
+ MY_CHECK_AND_SET_COMPILER_FLAG(
+ "-fsanitize=address -fsanitize-address-use-after-scope"
+ DEBUG RELWITHDEBINFO)
ENDIF()
ENDIF()
diff --git a/CREDITS b/CREDITS
index 9f03f7fc24e..f5e87e18752 100644
--- a/CREDITS
+++ b/CREDITS
@@ -4,24 +4,19 @@ organization registered in the USA.
The current main sponsors of the MariaDB Foundation are:
Alibaba Cloud https://www.alibabacloud.com/ (2017)
-Booking.com https://www.booking.com (2013)
MariaDB Corporation https://www.mariadb.com (2013)
Microsoft https://microsoft.com/ (2017)
+ServiceNow https://servicenow.com (2019)
Tencent Cloud https://cloud.tencent.com (2017)
Development Bank of Singapore https://dbs.com (2016)
IBM https://www.ibm.com (2017)
-Tencent Games http://game.qq.com/ (2018)
Visma https://visma.com (2015)
-Acronis https://acronis.com (2016)
-Nexedi https://www.nexedi.com (2016)
+Automattic https://automattic.com (2019)
+Galera Cluster https://galeracluster.com (2020)
Percona https://www.percona.com (2018)
-Tencent Game DBA http://tencentdba.com/about (2016)
-Tencent TDSQL http://tdsql.org (2016)
-Verkkokauppa.com https://www.verkkokauppa.com (2015)
-Virtuozzo https://virtuozzo.com (2016)
For a full list of sponsors, see
-https://mariadb.org/about/supporters/
+https://mariadb.org/about/#sponsors
and for individual contributors, see
https://mariadb.org/donate/individual-sponsors/
diff --git a/VERSION b/VERSION
index b451aa8a789..4619cee3174 100644
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=2
-MYSQL_VERSION_PATCH=36
+MYSQL_VERSION_PATCH=38
diff --git a/client/completion_hash.cc b/client/completion_hash.cc
index 553d0a1f926..30c0dc6260b 100644
--- a/client/completion_hash.cc
+++ b/client/completion_hash.cc
@@ -205,7 +205,8 @@ Bucket *find_longest_match(HashTable *ht, char *str, uint length,
void completion_hash_clean(HashTable *ht)
{
free_root(&ht->mem_root,MYF(0));
- bzero((char*) ht->arBuckets,ht->nTableSize*sizeof(Bucket *));
+ if (size_t s= ht->nTableSize)
+ bzero((char*) ht->arBuckets, s * sizeof(Bucket *));
}
diff --git a/client/mysql.cc b/client/mysql.cc
index f61fab416d5..2eb44d46512 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -4720,7 +4720,11 @@ sql_real_connect(char *host,char *database,char *user,char *password,
return -1; // Retryable
}
- charset_info= get_charset_by_name(mysql.charset->name, MYF(0));
+ if (!(charset_info= get_charset_by_name(mysql.charset->name, MYF(0))))
+ {
+ put_info("Unknown default character set", INFO_ERROR);
+ return 1;
+ }
connected=1;
diff --git a/client/mysqldump.c b/client/mysqldump.c
index b33c5ecc010..ecca380777f 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -39,7 +39,8 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
-#define DUMP_VERSION "10.16"
+/* on merge conflict, bump to a higher version again */
+#define DUMP_VERSION "10.19"
#include <my_global.h>
#include <my_sys.h>
@@ -116,6 +117,21 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
opt_events= 0, opt_comments_used= 0,
opt_alltspcs=0, opt_notspcs= 0, opt_logging,
opt_drop_trigger= 0 ;
+#define OPT_SYSTEM_ALL 1
+#define OPT_SYSTEM_USERS 2
+#define OPT_SYSTEM_PLUGINS 4
+#define OPT_SYSTEM_UDFS 8
+#define OPT_SYSTEM_SERVERS 16
+#define OPT_SYSTEM_STATS 32
+#define OPT_SYSTEM_TIMEZONES 64
+static const char *opt_system_type_values[]=
+ {"all", "users", "plugins", "udfs", "servers", "stats", "timezones"};
+static TYPELIB opt_system_types=
+{
+ array_elements(opt_system_type_values), "system dump options",
+ opt_system_type_values, NULL
+};
+static ulonglong opt_system= 0ULL;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*mysql=0;
@@ -525,6 +541,8 @@ static struct my_option my_long_options[] =
&opt_mysql_unix_port, &opt_mysql_unix_port, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
+ {"system", 256, "Dump system tables as portable SQL",
+ &opt_system, &opt_system, &opt_system_types, GET_SET, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tab",'T',
"Create tab-separated textfile for each table to given path. (Create .sql "
"and .txt files.) NOTE: This only works if mysqldump is run on the same "
@@ -567,7 +585,7 @@ static const char *load_default_groups[]=
static void maybe_exit(int error);
static void die(int error, const char* reason, ...);
static void maybe_die(int error, const char* reason, ...);
-static void write_header(FILE *sql_file, char *db_name);
+static void write_header(FILE *sql_file, const char *db_name);
static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
const char *prefix,const char *name,
int string_value);
@@ -578,6 +596,12 @@ static int init_dumping_tables(char *);
static int init_dumping(char *, int init_func(char*));
static int dump_databases(char **);
static int dump_all_databases();
+static int dump_all_users_roles_and_grants();
+static int dump_all_plugins();
+static int dump_all_udfs();
+static int dump_all_servers();
+static int dump_all_stats();
+static int dump_all_timezones();
static char *quote_name(const char *name, char *buff, my_bool force);
char check_if_ignore_table(const char *table_name, char *table_type);
static char *primary_key_fields(const char *table_name);
@@ -639,9 +663,10 @@ static void print_version(void)
static void short_usage_sub(FILE *f)
{
fprintf(f, "Usage: %s [OPTIONS] database [tables]\n", my_progname_short);
- fprintf(f, "OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
+ fprintf(f, "OR %s [OPTIONS] --databases DB1 [DB2 DB3...]\n",
my_progname_short);
- fprintf(f, "OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname_short);
+ fprintf(f, "OR %s [OPTIONS] --all-databases\n", my_progname_short);
+ fprintf(f, "OR %s [OPTIONS] --system=[SYSTEMOPTIONS]]\n", my_progname_short);
}
@@ -689,7 +714,7 @@ static const char *fix_for_comment(const char *ident)
}
-static void write_header(FILE *sql_file, char *db_name)
+static void write_header(FILE *sql_file, const char *db_name)
{
if (opt_xml)
{
@@ -1027,6 +1052,90 @@ static int get_options(int *argc, char ***argv)
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
return(ho_error);
+ /*
+ Dumping under --system=stats with --replace or --inser-ignore is safe and will not
+ retult into race condition. Otherwise dump only structure and ignore data by default
+ while dumping.
+ */
+ if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into))
+ {
+ if (my_hash_insert(&ignore_data,
+ (uchar*) my_strdup("mysql.innodb_index_stats", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_data,
+ (uchar*) my_strdup("mysql.innodb_table_stats", MYF(MY_WME))))
+ return(EX_EOM);
+ }
+
+ if (opt_system & OPT_SYSTEM_ALL)
+ opt_system|= ~0;
+
+ if (opt_system & OPT_SYSTEM_USERS &&
+ (my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.db", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.global_priv", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.tables_priv", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.columns_priv", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.procs_priv", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.user", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.host", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.proxies_priv", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.roles_mapping", MYF(MY_WME))) ||
+ /* and MySQL-8.0 role tables (role_edges and default_roles) as well */
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.role_edges", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.default_roles", MYF(MY_WME)))))
+ return(EX_EOM);
+
+ if (opt_system & OPT_SYSTEM_PLUGINS &&
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.plugin", MYF(MY_WME))))
+ return(EX_EOM);
+
+ if (opt_system & OPT_SYSTEM_UDFS &&
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.func", MYF(MY_WME))))
+ return(EX_EOM);
+
+ if (opt_system & OPT_SYSTEM_SERVERS &&
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.servers", MYF(MY_WME))))
+ return(EX_EOM);
+
+ if (opt_system & OPT_SYSTEM_STATS &&
+ (my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.column_stats", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.index_stats", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.table_stats", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.innodb_table_stats", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.innodb_index_stats", MYF(MY_WME)))))
+ return(EX_EOM);
+
+ if (opt_system & OPT_SYSTEM_TIMEZONES &&
+ (my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.time_zone", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.time_zone_leap_second", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.time_zone_name", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.time_zone_transition", MYF(MY_WME))) ||
+ my_hash_insert(&ignore_table,
+ (uchar*) my_strdup("mysql.time_zone_transition_type", MYF(MY_WME)))))
+ return(EX_EOM);
+
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
*mysql_params->p_net_buffer_length= opt_net_buffer_length;
if (debug_info_flag)
@@ -1084,7 +1193,7 @@ static int get_options(int *argc, char ***argv)
!(charset_info= get_charset_by_csname(default_charset,
MY_CS_PRIMARY, MYF(MY_WME))))
exit(1);
- if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
+ if ((*argc < 1 && (!opt_alldbs && !opt_system)) || (*argc > 0 && opt_alldbs))
{
short_usage(stderr);
return EX_USAGE;
@@ -1208,7 +1317,6 @@ static int fetch_db_collation(const char *db_name,
my_bool err_status= FALSE;
MYSQL_RES *db_cl_res;
MYSQL_ROW db_cl_row;
-
if (mysql_select_db(mysql, db_name))
{
DB_error(mysql, "when selecting the database");
@@ -2721,7 +2829,7 @@ static inline my_bool general_log_or_slow_log_tables(const char *db,
number of fields in table, 0 if error
*/
-static uint get_table_structure(char *table, char *db, char *table_type,
+static uint get_table_structure(const char *table, const char *db, char *table_type,
char *ignore_flag)
{
my_bool init=0, delayed, write_data, complete_insert;
@@ -3647,7 +3755,7 @@ static char *alloc_query_str(ulong size)
*/
-static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
+static void dump_table(const char *table, const char *db, const uchar *hash_key, size_t len)
{
char ignore_flag;
char buf[200], table_buff[NAME_LEN+3];
@@ -4166,6 +4274,448 @@ static char *getTableName(int reset)
/*
+ dump user/role grants
+ ARGS
+ user_role: is either a user, or a role
+*/
+
+static int dump_grants(const char *user_role)
+{
+ DYNAMIC_STRING sqlbuf;
+ MYSQL_ROW row;
+ MYSQL_RES *tableres;
+
+ init_dynamic_string_checked(&sqlbuf, "SHOW GRANTS FOR ", 256, 1024);
+ dynstr_append_checked(&sqlbuf, user_role);
+
+ if (mysql_query_with_error_report(mysql, &tableres, sqlbuf.str))
+ {
+ dynstr_free(&sqlbuf);
+ return 1;
+ }
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ if (strncmp(row[0], "SET DEFAULT ROLE", sizeof("SET DEFAULT ROLE") - 1) == 0)
+ continue;
+ fprintf(md_result_file, "%s;\n", row[0]);
+ }
+ mysql_free_result(tableres);
+ dynstr_free(&sqlbuf);
+ return 0;
+}
+
+
+/*
+ dump create user
+*/
+
+static int dump_create_user(const char *user)
+{
+ DYNAMIC_STRING sqlbuf;
+ MYSQL_ROW row;
+ MYSQL_RES *tableres;
+
+ init_dynamic_string_checked(&sqlbuf, "SHOW CREATE USER ", 256, 1024);
+ dynstr_append_checked(&sqlbuf, user);
+
+ if (mysql_query_with_error_report(mysql, &tableres, sqlbuf.str))
+ {
+ dynstr_free(&sqlbuf);
+ return 1;
+ }
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ fprintf(md_result_file, "CREATE %sUSER %s%s;\n", opt_replace_into ? "/*M!100103 OR REPLACE */ ": "",
+ opt_ignore ? "IF NOT EXISTS " : "",
+ row[0] + sizeof("CREATE USER"));
+ }
+ mysql_free_result(tableres);
+ dynstr_free(&sqlbuf);
+ return 0;
+}
+
+
+/*
+ dump all users, roles and their grants
+*/
+
+static int dump_all_users_roles_and_grants()
+{
+ MYSQL_ROW row;
+ MYSQL_RES *tableres;
+ int result= 0;
+ /* Roles added in MariaDB-10.0.5 or MySQL-8.0 */
+ my_bool maria_roles_exist= (mysql_get_server_version(mysql) >= 100005);
+ my_bool mysql_roles_exist= (mysql_get_server_version(mysql) >= 80001) && !maria_roles_exist;
+
+ if (mysql_query_with_error_report(mysql, &tableres,
+ "SELECT CONCAT(QUOTE(u.user), '@', QUOTE(u.Host)) AS u "
+ "FROM mysql.user u "
+ " /*!80001 LEFT JOIN mysql.role_edges e "
+ " ON u.user=e.from_user "
+ " AND u.host=e.from_host "
+ " WHERE e.from_user IS NULL */"
+ " /*M!100005 WHERE is_role='N' */"))
+ return 1;
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ if (opt_replace_into)
+ /* Protection against removing the current import user */
+ /* MySQL-8.0 export capability */
+ fprintf(md_result_file,
+ "DELIMITER |\n"
+ "/*M!100101 IF current_user()=\"%s\" THEN\n"
+ " SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001,"
+ " MESSAGE_TEXT=\"Don't remove current user %s'\";\n"
+ "END IF */|\n"
+ "DELIMITER ;\n"
+ "/*!50701 DROP USER IF EXISTS %s */;\n", row[0], row[0], row[0]);
+ if (dump_create_user(row[0]))
+ result= 1;
+ /* if roles exist, defer dumping grants until after roles created */
+ if (maria_roles_exist || mysql_roles_exist)
+ continue;
+ if (dump_grants(row[0]))
+ result= 1;
+ }
+ mysql_free_result(tableres);
+
+ if (!(maria_roles_exist || mysql_roles_exist))
+ goto exit;
+
+ /*
+ Preserve current role active role, in case this dump is imported
+ in the same connection that assumes the active role at the beginning
+ is the same as at the end of the connection. This is so:
+
+ #!/bin/sh
+ (
+ echo "set role special_role; ";
+ cat mysqldump.sql;
+ echo "$dosomethingspecial"
+ ) | mysql -h $host
+
+ doesn't end up with a suprise that the $dosomethingspecial cannot
+ be done because `special_role` isn't active.
+
+ We create a new role for importing that becomes the default admin for new
+ roles. This is because without being a admin on new roles we don't
+ have the necessary privileges to grant users to a created role or to
+ create new admins for the created role.
+
+ At the end of the import the mariadb_dump_import_role is be dropped,
+ which implictly drops all its admin aspects of the dropped role.
+ This is significiantly easlier than revoking the ADMIN of each role
+ from the current user.
+ */
+ fputs("SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;\n"
+ "CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;\n"
+ "GRANT mariadb_dump_import_role TO CURRENT_USER();\n"
+ "SET ROLE mariadb_dump_import_role;\n"
+ , md_result_file);
+ /* No show create role yet, MDEV-22311 */
+ /* Roles, with user admins first, then roles they administer, and recurse on that */
+ if (maria_roles_exist && mysql_query_with_error_report(mysql, &tableres,
+ "WITH RECURSIVE create_role_order AS"
+ " (SELECT 1 as n, roles_mapping.*"
+ " FROM mysql.roles_mapping"
+ " JOIN mysql.user USING (user,host)"
+ " WHERE is_role='N'"
+ " AND Admin_option='Y'"
+ " UNION SELECT c.n+1, r.*"
+ " FROM create_role_order c"
+ " JOIN mysql.roles_mapping r ON c.role=r.user"
+ " AND r.host=''"
+ " AND r.Admin_option='Y') "
+ "SELECT QUOTE(ROLE) AS r,"
+ " CONCAT(QUOTE(user),"
+ " IF(HOST='', '', CONCAT('@', QUOTE(HOST)))) AS c,"
+ " Admin_option "
+ "FROM create_role_order ORDER BY n, r, user"))
+ return 1;
+ /*
+ TODO Mysql - misses roles that have no admin or role members.
+ MySQL roles don't require an admin.
+ */
+ if (mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
+ "WITH RECURSIVE create_role_order AS"
+ " (SELECT 1 AS n,"
+ " re.*"
+ " FROM mysql.role_edges re"
+ " JOIN mysql.user u ON re.TO_HOST=u.HOST"
+ " AND re.TO_USER = u.USER"
+ " LEFT JOIN mysql.role_edges re2 ON re.TO_USER=re2.FROM_USER"
+ " AND re2.TO_HOST=re2.FROM_HOST"
+ " WHERE re2.FROM_USER IS NULL"
+ " UNION SELECT c.n+1,"
+ " re.*"
+ " FROM create_role_order c"
+ " JOIN mysql.role_edges re ON c.FROM_USER=re.TO_USER"
+ " AND c.FROM_HOST=re.TO_HOST) "
+ "SELECT CONCAT(QUOTE(FROM_USER), '/*!80001 @', QUOTE(FROM_HOST), '*/') AS r,"
+ " CONCAT(QUOTE(TO_USER), IF(n=1, CONCAT('@', QUOTE(TO_HOST)),"
+ " CONCAT('/*!80001 @', QUOTE(TO_HOST), ' */'))) AS u,"
+ " WITH_ADMIN_OPTION "
+ "FROM create_role_order "
+ "ORDER BY n,"
+ " FROM_USER,"
+ " FROM_HOST,"
+ " TO_USER,"
+ " TO_HOST,"
+ " WITH_ADMIN_OPTION"))
+ return 1;
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ /* MySQL-8.0 export capability */
+ if (opt_replace_into)
+ fprintf(md_result_file,
+ "/*!80001 DROP ROLE IF EXISTS %s */;\n", row[0]);
+ fprintf(md_result_file,
+ "/*!80001 CREATE ROLE %s%s */;\n", opt_ignore ? "IF NOT EXISTS " : "", row[0]);
+ /* By default created with current role */
+ fprintf(md_result_file,
+ "%sROLE %s%s WITH ADMIN mariadb_dump_import_role */;\n",
+ opt_replace_into ? "/*M!100103 CREATE OR REPLACE ": "/*M!100005 CREATE ",
+ opt_ignore ? "IF NOT EXISTS " : "", row[0]);
+ fprintf(md_result_file, "/*M!100005 GRANT %s TO %s%s*/;\n",
+ row[0], row[1], (row[2][0] == 'Y') ? " WITH ADMIN OPTION " : "");
+ }
+ mysql_free_result(tableres);
+
+ /* users and their default role */
+ if (maria_roles_exist && mysql_query_with_error_report(mysql, &tableres,
+ "select IF(default_role='', 'NONE', QUOTE(default_role)) as r,"
+ "concat(QUOTE(User), '@', QUOTE(Host)) as u FROM mysql.user "
+ "/*M!100005 WHERE is_role='N' */"))
+ return 1;
+ if (mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
+ "SELECT IF(DEFAULT_ROLE_HOST IS NULL, 'NONE', CONCAT(QUOTE(DEFAULT_ROLE_USER),"
+ " '@', QUOTE(DEFAULT_ROLE_HOST))) as r,"
+ " CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u "
+ "FROM mysql.user mu LEFT JOIN mysql.default_roles using (USER, HOST)"))
+ return 1;
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ if (dump_grants(row[1]))
+ result= 1;
+ fprintf(md_result_file, "/*M!100005 SET DEFAULT ROLE %s FOR %s */;\n", row[0], row[1]);
+ fprintf(md_result_file, "/*!80001 ALTER USER %s DEFAULT ROLE %s */;\n", row[1], row[0]);
+ }
+ mysql_free_result(tableres);
+
+ if (maria_roles_exist && mysql_query_with_error_report(mysql, &tableres,
+ "SELECT DISTINCT QUOTE(m.role) AS r "
+ " FROM mysql.roles_mapping m"
+ " JOIN mysql.user u ON u.user = m.role"
+ " WHERE is_role='Y'"
+ " AND Admin_option='Y'"
+ " ORDER BY m.role"))
+ return 1;
+ if (mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres,
+ "SELECT DISTINCT CONCAT(QUOTE(FROM_USER),'@', QUOTE(FROM_HOST)) AS r "
+ "FROM mysql.role_edges"))
+ return 1;
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ if (dump_grants(row[0]))
+ result= 1;
+ }
+ mysql_free_result(tableres);
+ /* switch back */
+ fputs("SET ROLE NONE;\n"
+ "DROP ROLE mariadb_dump_import_role;\n"
+ "/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */;\n",
+ md_result_file);
+exit:
+
+ return result;
+}
+
+
+/*
+ dump all plugins
+*/
+
+static int dump_all_plugins()
+{
+ MYSQL_ROW row;
+ MYSQL_RES *tableres;
+
+ if (mysql_query_with_error_report(mysql, &tableres, "SHOW PLUGINS"))
+ return 1;
+ /* Name, Status, Type, Library, License */
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ if (strcmp("ACTIVE", row[1]) != 0)
+ continue;
+ /* Should we be skipping builtins? */
+ if (row[3] == NULL)
+ continue;
+ if (opt_replace_into)
+ {
+ fprintf(md_result_file, "/*M!100401 UNINSTALL PLUGIN IF EXIST %s */;\n",
+ row[0]);
+ }
+ fprintf(md_result_file,
+ "INSTALL PLUGIN %s %s SONAME '%s';\n", row[0],
+ opt_ignore ? "/*M!100401 IF NOT EXISTS */" : "", row[3]);
+ }
+ mysql_free_result(tableres);
+
+ return 0;
+}
+
+
+/*
+ dump all udfs
+*/
+
+static int dump_all_udfs()
+{
+ /* we don't support all these types yet, but get prepared if we do */
+ static const char *udf_types[] = {"STRING", "REAL", "INT", "ROW", "DECIMAL", "TIME" };
+ MYSQL_ROW row;
+ MYSQL_RES *tableres;
+ int retresult, result= 0;
+
+ if (mysql_query_with_error_report(mysql, &tableres, "SELECT * FROM mysql.func"))
+ return 1;
+ /* Name, ret, dl, type*/
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ retresult= atoi(row[1]);
+ if (retresult < 0 || array_elements(udf_types) <= (size_t) retresult)
+ {
+ fprintf(stderr, "%s: Error: invalid return type on udf function '%s'\n",
+ my_progname_short, row[0]);
+ result= 1;
+ continue;
+ }
+ if (opt_replace_into)
+ {
+ fprintf(md_result_file, "/*!50701 DROP FUNCTION IF EXISTS %s */;\n",
+ row[0]);
+ }
+ fprintf(md_result_file,
+ "CREATE %s%sFUNCTION %s%s RETURNS %s SONAME '%s';\n",
+ opt_replace_into ? "/*M!100103 OR REPLACE */ ": "",
+ (strcmp("AGGREGATE", row[2])==0 ? "AGGREGATE " : ""),
+ opt_ignore ? "IF NOT EXISTS " : "", row[0], udf_types[retresult], row[2]);
+ }
+ mysql_free_result(tableres);
+
+ return result;
+}
+
+
+/*
+ dump all servers
+*/
+
+static int dump_all_servers()
+{
+ /* No create server yet - MDEV-15696 */
+ MYSQL_ROW row;
+ MYSQL_RES *tableres;
+ MYSQL_FIELD *f;
+ unsigned int num_fields, i;
+ my_bool comma_prepend= 0;
+ const char *qstring;
+
+ if (mysql_query_with_error_report(mysql, &tableres, "SELECT * FROM mysql.servers"))
+ return 1;
+ num_fields= mysql_num_fields(tableres);
+ while ((row= mysql_fetch_row(tableres)))
+ {
+ fprintf(md_result_file,"CREATE %sSERVER %s%s FOREIGN DATA WRAPPER %s OPTIONS (",
+ opt_replace_into ? "/*M!100103 OR REPLACE */ ": "",
+ opt_ignore ? "/*M!100103 IF NOT EXISTS */ " : "", row[0], row[7]);
+ for (i= 1; i < num_fields; i++)
+ {
+ if (i == 7 || row[i][0] == '\0') /* Wrapper or empty string */
+ continue;
+ f= &tableres->fields[i];
+ qstring= (f->type == MYSQL_TYPE_STRING || f->type == MYSQL_TYPE_VAR_STRING) ? "'" : "";
+ fprintf(md_result_file, "%s%s %s%s%s",
+ (comma_prepend ? ", " : ""), f->name, qstring, row[i], qstring);
+ comma_prepend= 1;
+ }
+ fputs(");\n", md_result_file);
+ }
+ mysql_free_result(tableres);
+
+ return 0;
+}
+
+
+/*
+ dump all system statistical tables
+*/
+
+static int dump_all_stats()
+{
+ my_bool prev_no_create_info, prev_opt_replace_into;
+
+ if (mysql_select_db(mysql, "mysql"))
+ {
+ DB_error(mysql, "when selecting the database");
+ return 1; /* If --force */
+ }
+ fprintf(md_result_file,"\nUSE mysql;\n");
+ prev_opt_replace_into= opt_replace_into;
+ opt_replace_into|= !opt_ignore;
+ prev_no_create_info= opt_no_create_info;
+ opt_no_create_info= 1; /* don't overwrite recreate tables */
+ /* EITS added in 10.0.1 */
+ if (mysql_get_server_version(mysql) >= 100001)
+ {
+ dump_table("column_stats", "mysql", NULL, 0);
+ dump_table("index_stats", "mysql", NULL, 0);
+ dump_table("table_stats", "mysql", NULL, 0);
+ }
+ /* Innodb may be disabled */
+ if (!mysql_query(mysql, "show fields from innodb_index_stats"))
+ {
+ MYSQL_RES *tableres= mysql_store_result(mysql);
+ mysql_free_result(tableres);
+ dump_table("innodb_index_stats", "mysql", NULL, 0);
+ dump_table("innodb_table_stats", "mysql", NULL, 0);
+ }
+ opt_no_create_info= prev_no_create_info;
+ opt_replace_into= prev_opt_replace_into;
+ return 0;
+}
+
+
+/*
+ dump all system timezones
+*/
+
+static int dump_all_timezones()
+{
+ my_bool opt_prev_no_create_info, opt_prev_replace_into;
+ if (mysql_select_db(mysql, "mysql"))
+ {
+ DB_error(mysql, "when selecting the database");
+ return 1; /* If --force */
+ }
+ opt_prev_replace_into= opt_replace_into;
+ opt_replace_into|= !opt_ignore;
+ opt_prev_no_create_info= opt_no_create_info;
+ opt_no_create_info= 1;
+ fprintf(md_result_file,"\nUSE mysql;\n");
+ dump_table("time_zone", "mysql", NULL, 0);
+ dump_table("time_zone_name", "mysql", NULL, 0);
+ dump_table("time_zone_leap_second", "mysql", NULL, 0);
+ dump_table("time_zone_transition", "mysql", NULL, 0);
+ dump_table("time_zone_transition_type", "mysql", NULL, 0);
+ opt_no_create_info= opt_prev_no_create_info;
+ opt_replace_into= opt_prev_replace_into;
+ return 0;
+}
+
+
+/*
dump all logfile groups and tablespaces
*/
@@ -6175,7 +6725,7 @@ int main(int argc, char **argv)
dump_tablespaces_for_tables(*argv, (argv + 1), (argc - 1));
dump_selected_tables(*argv, (argv + 1), (argc - 1));
}
- else
+ else if (argc > 0)
{
/* One or more databases, all tables */
if (!opt_alltspcs && !opt_notspcs)
@@ -6184,6 +6734,25 @@ int main(int argc, char **argv)
}
}
+ if (opt_system & OPT_SYSTEM_PLUGINS)
+ dump_all_plugins();
+
+ if (opt_system & OPT_SYSTEM_USERS)
+ dump_all_users_roles_and_grants();
+
+ if (opt_system & OPT_SYSTEM_UDFS)
+ dump_all_udfs();
+
+ if (opt_system & OPT_SYSTEM_SERVERS)
+ dump_all_servers();
+
+ /* These must be last as they explictly change the current database to mysql */
+ if (opt_system & OPT_SYSTEM_STATS)
+ dump_all_stats();
+
+ if (opt_system & OPT_SYSTEM_TIMEZONES)
+ dump_all_timezones();
+
/* add 'START SLAVE' to end of dump */
if (opt_slave_apply && add_slave_statements())
goto err;
diff --git a/cmake/Internal/CPack/CPackRPM.cmake b/cmake/Internal/CPack/CPackRPM.cmake
index 2729667e319..92bcc6c6c25 100644
--- a/cmake/Internal/CPack/CPackRPM.cmake
+++ b/cmake/Internal/CPack/CPackRPM.cmake
@@ -26,26 +26,28 @@ set_from_component(VENDOR)
# the scriptlet, if present, is appended (together with the %posttrans tag)
# to the pre-uninstall scriptlet
#
-set(base_time "PRE")
-set(base_type "UNINSTALL")
-set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE)
-set(acc)
+if(CMAKE_VERSION VERSION_LESS 3.18)
+ set(base_time "PRE")
+ set(base_type "UNINSTALL")
+ set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE)
+ set(acc)
-macro(read_one_file time_ type_ tag_)
- set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE)
- if (${var})
- file(READ ${${var}} content)
- set(acc "${tag_}\n${content}\n\n${acc}")
- endif()
-endmacro()
+ macro(read_one_file time_ type_ tag_)
+ set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE)
+ if (${var})
+ file(READ ${${var}} content)
+ set(acc "${tag_}\n${content}\n\n${acc}")
+ endif()
+ endmacro()
-read_one_file("POST" "TRANS" "%posttrans")
-if (acc)
- set(orig_${base_var} ${${base_var}})
- read_one_file(${base_time} ${base_type} "")
- set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet)
- file(WRITE ${${base_var}} "${acc}")
-endif()
+ read_one_file("POST" "TRANS" "%posttrans")
+ if (acc)
+ set(orig_${base_var} ${${base_var}})
+ read_one_file(${base_time} ${base_type} "")
+ set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet)
+ file(WRITE ${${base_var}} "${acc}")
+ endif()
+endif(CMAKE_VERSION VERSION_LESS 3.18)
# load the original CPackRPM.cmake
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
@@ -59,7 +61,9 @@ set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
restore(LICENSE)
restore(VENDOR)
-set(${base_var} ${orig_${base_var}})
+if(${orig_${base_var}})
+ set(${base_var} ${orig_${base_var}})
+endif()
# per-component cleanup
foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV)
diff --git a/cmake/bison.cmake b/cmake/bison.cmake
index 717cd50dedd..1b2d1c38bae 100644
--- a/cmake/bison.cmake
+++ b/cmake/bison.cmake
@@ -27,7 +27,7 @@ IF(WIN32)
C:/cygwin64/bin
C:/cygwin/bin)
ENDIF()
-FIND_PROGRAM(BISON_EXECUTABLE bison
+FIND_PROGRAM(BISON_EXECUTABLE NAMES bison win_bison
${BISON_PATH_HINTS}
DOC "path to the bison executable")
MARK_AS_ADVANCED(BISON_EXECUTABLE "")
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index c0802399e5d..3b74ad80ef8 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -182,7 +182,7 @@ IF(WIN32)
MARK_AS_ADVANCED(SIGNCODE)
IF(SIGNCODE)
SET(SIGNTOOL_PARAMETERS
- /a /t http://timestamp.verisign.com/scripts/timstamp.dll
+ /a /t http://timestamp.globalsign.com/?signature=sha2
CACHE STRING "parameters for signtool (list)")
FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool
PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin"
diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in
index 11b46f1c15b..4bc68d5edf9 100644
--- a/cmake/make_dist.cmake.in
+++ b/cmake/make_dist.cmake.in
@@ -43,6 +43,13 @@ IF(GIT_EXECUTABLE)
MESSAGE(STATUS "Running git checkout-index")
EXECUTE_PROCESS(
COMMAND "${GIT_EXECUTABLE}" checkout-index --all --prefix=${PACKAGE_DIR}/
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ RESULT_VARIABLE RESULT
+ )
+ IF(NOT RESULT EQUAL 0)
+ SET(GIT_EXECUTABLE)
+ ENDIF()
+ EXECUTE_PROCESS(
COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/$path/"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RESULT
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index fe976b96592..c6b334d10a3 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -94,6 +94,7 @@ SET(HAVE_LRAND48 CACHE INTERNAL "")
SET(HAVE_LSTAT CACHE INTERNAL "")
SET(HAVE_MADVISE CACHE INTERNAL "")
SET(HAVE_MALLINFO CACHE INTERNAL "")
+SET(HAVE_MALLINFO2 CACHE INTERNAL "")
SET(HAVE_MALLOC_H 1 CACHE INTERNAL "")
SET(HAVE_MEMALIGN CACHE INTERNAL "")
SET(HAVE_MEMCPY 1 CACHE INTERNAL "")
diff --git a/config.h.cmake b/config.h.cmake
index 0e19dd44694..c74592b4a65 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -177,6 +177,7 @@
#cmakedefine HAVE_DECL_MADVISE 1
#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA 1
#cmakedefine HAVE_MALLINFO 1
+#cmakedefine HAVE_MALLINFO2 1
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
#cmakedefine HAVE_MKSTEMP 1
diff --git a/configure.cmake b/configure.cmake
index 58e1111bfc7..1aa0827a503 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -358,6 +358,7 @@ CHECK_FUNCTION_EXISTS (localtime_r HAVE_LOCALTIME_R)
CHECK_FUNCTION_EXISTS (lstat HAVE_LSTAT)
CHECK_FUNCTION_EXISTS (madvise HAVE_MADVISE)
CHECK_FUNCTION_EXISTS (mallinfo HAVE_MALLINFO)
+CHECK_FUNCTION_EXISTS (mallinfo2 HAVE_MALLINFO2)
CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY)
CHECK_FUNCTION_EXISTS (memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS (mkstemp HAVE_MKSTEMP)
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index ddef69bb350..5cf2398575a 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -91,6 +91,12 @@ then
sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
fi
+## Skip TokuDB if arch is not amd64
+if [[ ! $(dpkg-architecture -q DEB_BUILD_ARCH) =~ amd64 ]]
+then
+ sed '/Package: mariadb-plugin-tokudb/,/^$/d' -i debian/control
+fi
+
# Always remove aws plugin, see -DNOT_FOR_DISTRIBUTION in CMakeLists.txt
sed '/Package: mariadb-plugin-aws-key-management-10.2/,/^$/d' -i debian/control
diff --git a/debian/libmariadb3.install b/debian/libmariadb3.install
index 065adc67a91..faeeb3026d6 100644
--- a/debian/libmariadb3.install
+++ b/debian/libmariadb3.install
@@ -4,3 +4,5 @@ usr/lib/*/libmariadb.so.*
usr/lib/mysql/plugin/dialog.so
usr/lib/mysql/plugin/mysql_clear_password.so
usr/lib/mysql/plugin/client_ed25519.so
+usr/lib/mysql/plugin/sha256_password.so
+usr/lib/mysql/plugin/caching_sha2_password.so
diff --git a/debian/rules b/debian/rules
index 809911d4179..35d5adf3f8a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -112,11 +112,6 @@ override_dh_auto_install:
dh_testdir
dh_testroot
-# Skip TokuDB if arch is not amd64
-ifneq ($(ARCH), amd64)
- sed -i -e "/Package: mariadb-plugin-tokudb/,+16d" debian/control
-endif
-
# Copy systemd files to a location available for dh_installinit
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service
cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.2.mariadb@.service
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 0ba220364e2..5637ec3d4d7 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -867,21 +867,14 @@ datafile_rsync_backup(const char *filepath, bool save_to_list, FILE *f)
return(true);
}
-
-static
-bool
-backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
+bool backup_file_print_buf(const char *filename, const char *buf, int buf_len)
{
ds_file_t *dstfile = NULL;
MY_STAT stat; /* unused for now */
- char *buf = 0;
- int buf_len;
const char *action;
memset(&stat, 0, sizeof(stat));
- buf_len = vasprintf(&buf, fmt, ap);
-
stat.st_size = buf_len;
stat.st_mtime = my_time(0);
@@ -905,7 +898,6 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
/* close */
msg(" ...done");
- free(buf);
if (ds_close(dstfile)) {
goto error_close;
@@ -914,7 +906,6 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
return(true);
error:
- free(buf);
if (dstfile != NULL) {
ds_close(dstfile);
}
@@ -922,8 +913,21 @@ error:
error_close:
msg("Error: backup file failed.");
return(false); /*ERROR*/
-}
+ return true;
+};
+
+static
+bool
+backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
+{
+ char *buf = 0;
+ int buf_len;
+ buf_len = vasprintf(&buf, fmt, ap);
+ bool result = backup_file_print_buf(filename, buf, buf_len);
+ free(buf);
+ return result;
+}
bool
backup_file_printf(const char *filename, const char *fmt, ...)
@@ -1062,6 +1066,7 @@ copy_file(ds_ctxt_t *datasink,
ds_file_t *dstfile = NULL;
datafile_cur_t cursor;
xb_fil_cur_result_t res;
+ DBUG_ASSERT(datasink->datasink->remove);
const char *dst_path =
(xtrabackup_copy_back || xtrabackup_move_back)?
dst_file_path : trim_dotslash(dst_file_path);
@@ -1087,6 +1092,7 @@ copy_file(ds_ctxt_t *datasink,
if (ds_write(dstfile, cursor.buf, cursor.buf_read)) {
goto error;
}
+ DBUG_EXECUTE_IF("copy_file_error", errno=ENOSPC;goto error;);
}
if (res == XB_FIL_CUR_ERROR) {
@@ -1108,6 +1114,7 @@ copy_file(ds_ctxt_t *datasink,
error:
datafile_close(&cursor);
if (dstfile != NULL) {
+ datasink->datasink->remove(dstfile->path);
ds_close(dstfile);
}
@@ -1152,17 +1159,18 @@ move_file(ds_ctxt_t *datasink,
if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) {
if (my_errno == EXDEV) {
- bool ret;
- ret = copy_file(datasink, src_file_path,
- dst_file_path, thread_n);
+ /* Fallback to copy/unlink */
+ if(!copy_file(datasink, src_file_path,
+ dst_file_path, thread_n))
+ return false;
msg(thread_n,"Removing %s", src_file_path);
if (unlink(src_file_path) != 0) {
my_strerror(errbuf, sizeof(errbuf), errno);
- msg("Error: unlink %s failed: %s",
+ msg("Warning: unlink %s failed: %s",
src_file_path,
errbuf);
}
- return(ret);
+ return true;
}
my_strerror(errbuf, sizeof(errbuf), my_errno);
msg("Can not move file %s to %s: %s",
@@ -1446,7 +1454,7 @@ out:
return(ret);
}
-void backup_fix_ddl(void);
+void backup_fix_ddl(CorruptedPages &);
lsn_t get_current_lsn(MYSQL *connection)
{
@@ -1471,7 +1479,7 @@ lsn_t get_current_lsn(MYSQL *connection)
lsn_t server_lsn_after_lock;
extern void backup_wait_for_lsn(lsn_t lsn);
/** Start --backup */
-bool backup_start()
+bool backup_start(CorruptedPages &corrupted_pages)
{
if (!opt_no_lock) {
if (opt_safe_slave_backup) {
@@ -1506,7 +1514,7 @@ bool backup_start()
msg("Waiting for log copy thread to read lsn %llu", (ulonglong)server_lsn_after_lock);
backup_wait_for_lsn(server_lsn_after_lock);
- backup_fix_ddl();
+ backup_fix_ddl(corrupted_pages);
// There is no need to stop slave thread before coping non-Innodb data when
// --no-lock option is used because --no-lock option requires that no DDL or
diff --git a/extra/mariabackup/backup_copy.h b/extra/mariabackup/backup_copy.h
index 7c886719f37..62b2b1bc232 100644
--- a/extra/mariabackup/backup_copy.h
+++ b/extra/mariabackup/backup_copy.h
@@ -33,7 +33,7 @@ copy_file(ds_ctxt_t *datasink,
uint thread_n);
/** Start --backup */
-bool backup_start();
+bool backup_start(CorruptedPages &corrupted_pages);
/** Release resources after backup_start() */
void backup_release();
/** Finish after backup_start() and backup_release() */
@@ -51,5 +51,6 @@ directory_exists(const char *dir, bool create);
lsn_t
get_current_lsn(MYSQL *connection);
+bool backup_file_print_buf(const char *filename, const char *buf, int buf_len);
#endif
diff --git a/extra/mariabackup/backup_debug.h b/extra/mariabackup/backup_debug.h
new file mode 100644
index 00000000000..cefbc287361
--- /dev/null
+++ b/extra/mariabackup/backup_debug.h
@@ -0,0 +1,32 @@
+#pragma once
+#include "my_dbug.h"
+#ifndef DBUG_OFF
+extern char *dbug_mariabackup_get_val(const char *event, const char *key);
+/*
+In debug mode, execute SQL statement that was passed via environment.
+To use this facility, you need to
+
+1. Add code DBUG_EXECUTE_MARIABACKUP_EVENT("my_event_name", key););
+ to the code. key is usually a table name
+2. Set environment variable my_event_name_$key SQL statement you want to execute
+ when event occurs, in DBUG_EXECUTE_IF from above.
+ In mtr , you can set environment via 'let' statement (do not use $ as the first char
+ for the variable)
+3. start mariabackup with --dbug=+d,debug_mariabackup_events
+*/
+extern void dbug_mariabackup_event(
+ const char *event,const char *key);
+#define DBUG_MARIABACKUP_EVENT(A, B) \
+ DBUG_EXECUTE_IF("mariabackup_events", \
+ dbug_mariabackup_event(A,B););
+#define DBUG_EXECUTE_FOR_KEY(EVENT, KEY, CODE) \
+ DBUG_EXECUTE_IF("mariabackup_inject_code", {\
+ char *dbug_val = dbug_mariabackup_get_val(EVENT, KEY); \
+ if (dbug_val && *dbug_val) CODE \
+ })
+#else
+#define DBUG_MARIABACKUP_EVENT(A,B)
+#define DBUG_MARIABACKUP_EVENT_LOCK(A,B)
+#define DBUG_EXECUTE_FOR_KEY(EVENT, KEY, CODE)
+#endif
+
diff --git a/extra/mariabackup/datasink.h b/extra/mariabackup/datasink.h
index 201bbfd3267..5c82556b9ba 100644
--- a/extra/mariabackup/datasink.h
+++ b/extra/mariabackup/datasink.h
@@ -50,9 +50,15 @@ struct datasink_struct {
ds_file_t *(*open)(ds_ctxt_t *ctxt, const char *path, MY_STAT *stat);
int (*write)(ds_file_t *file, const unsigned char *buf, size_t len);
int (*close)(ds_file_t *file);
+ int (*remove)(const char *path);
void (*deinit)(ds_ctxt_t *ctxt);
};
+
+static inline int dummy_remove(const char *) {
+ return 0;
+}
+
/* Supported datasink types */
typedef enum {
DS_TYPE_STDOUT,
diff --git a/extra/mariabackup/ds_archive.cc b/extra/mariabackup/ds_archive.cc
index 3826029e120..18f13fbcf3a 100644
--- a/extra/mariabackup/ds_archive.cc
+++ b/extra/mariabackup/ds_archive.cc
@@ -56,6 +56,7 @@ datasink_t datasink_archive = {
&archive_open,
&archive_write,
&archive_close,
+ &dummy_remove,
&archive_deinit
};
diff --git a/extra/mariabackup/ds_buffer.cc b/extra/mariabackup/ds_buffer.cc
index e906edc9e84..9dc040d533b 100644
--- a/extra/mariabackup/ds_buffer.cc
+++ b/extra/mariabackup/ds_buffer.cc
@@ -54,6 +54,7 @@ datasink_t datasink_buffer = {
&buffer_open,
&buffer_write,
&buffer_close,
+ &dummy_remove,
&buffer_deinit
};
diff --git a/extra/mariabackup/ds_compress.cc b/extra/mariabackup/ds_compress.cc
index fb4f3a75bb6..23de4d85116 100644
--- a/extra/mariabackup/ds_compress.cc
+++ b/extra/mariabackup/ds_compress.cc
@@ -74,6 +74,7 @@ datasink_t datasink_compress = {
&compress_open,
&compress_write,
&compress_close,
+ &dummy_remove,
&compress_deinit
};
diff --git a/extra/mariabackup/ds_local.cc b/extra/mariabackup/ds_local.cc
index 0f13ddfe9a9..2f0ad2d8705 100644
--- a/extra/mariabackup/ds_local.cc
+++ b/extra/mariabackup/ds_local.cc
@@ -44,12 +44,18 @@ static int local_write(ds_file_t *file, const uchar *buf, size_t len);
static int local_close(ds_file_t *file);
static void local_deinit(ds_ctxt_t *ctxt);
+static int local_remove(const char *path)
+{
+ return unlink(path);
+}
+
extern "C" {
datasink_t datasink_local = {
&local_init,
&local_open,
&local_write,
&local_close,
+ &local_remove,
&local_deinit
};
}
diff --git a/extra/mariabackup/ds_stdout.cc b/extra/mariabackup/ds_stdout.cc
index 9398482feb9..a4abbe426b6 100644
--- a/extra/mariabackup/ds_stdout.cc
+++ b/extra/mariabackup/ds_stdout.cc
@@ -39,6 +39,7 @@ datasink_t datasink_stdout = {
&stdout_open,
&stdout_write,
&stdout_close,
+ &dummy_remove,
&stdout_deinit
};
diff --git a/extra/mariabackup/ds_tmpfile.cc b/extra/mariabackup/ds_tmpfile.cc
index ddb23bf469d..9eadd36bec0 100644
--- a/extra/mariabackup/ds_tmpfile.cc
+++ b/extra/mariabackup/ds_tmpfile.cc
@@ -50,6 +50,7 @@ datasink_t datasink_tmpfile = {
&tmpfile_open,
&tmpfile_write,
&tmpfile_close,
+ &dummy_remove,
&tmpfile_deinit
};
diff --git a/extra/mariabackup/ds_xbstream.cc b/extra/mariabackup/ds_xbstream.cc
index 105c89d05f7..3b60456f8ed 100644
--- a/extra/mariabackup/ds_xbstream.cc
+++ b/extra/mariabackup/ds_xbstream.cc
@@ -50,6 +50,7 @@ datasink_t datasink_xbstream = {
&xbstream_open,
&xbstream_write,
&xbstream_close,
+ &dummy_remove,
&xbstream_deinit
};
diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc
index 8f1978e967a..d92e1b2d1cc 100644
--- a/extra/mariabackup/encryption_plugin.cc
+++ b/extra/mariabackup/encryption_plugin.cc
@@ -2,7 +2,6 @@
#include <mysql.h>
#include <xtrabackup.h>
#include <encryption_plugin.h>
-#include <backup_copy.h>
#include <sql_plugin.h>
#include <sstream>
#include <vector>
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index b229a37d934..3d48cb3e108 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "read_filt.h"
#include "xtrabackup.h"
#include "xb0xb.h"
+#include "backup_debug.h"
/* Size of read buffer in pages (640 pages = 10M for 16K sized pages) */
#define XB_FIL_CUR_PAGES 640
@@ -372,16 +373,15 @@ static bool page_is_corrupted(const byte *page, ulint page_no,
return buf_page_is_corrupted(true, page, cursor->page_size, space);
}
-/************************************************************************
-Reads and verifies the next block of pages from the source
+/** Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page.
-
+@param[in,out] cursor source file cursor
+@param[out] corrupted_pages adds corrupted pages if
+opt_log_innodb_page_corruption is set
@return XB_FIL_CUR_SUCCESS if some have been read successfully, XB_FIL_CUR_EOF
if there are no more pages to read and XB_FIL_CUR_ERROR on error. */
-xb_fil_cur_result_t
-xb_fil_cur_read(
-/*============*/
- xb_fil_cur_t* cursor) /*!< in/out: source file cursor */
+xb_fil_cur_result_t xb_fil_cur_read(xb_fil_cur_t* cursor,
+ CorruptedPages &corrupted_pages)
{
byte* page;
ulint i;
@@ -455,20 +455,40 @@ read_retry:
retry_count--;
if (retry_count == 0) {
+ const char *ignore_corruption_warn = opt_log_innodb_page_corruption ?
+ " WARNING!!! The corruption is ignored due to"
+ " log-innodb-page-corruption option, the backup can contain"
+ " corrupted data." : "";
msg(cursor->thread_n,
"Error: failed to read page after "
"10 retries. File %s seems to be "
- "corrupted.", cursor->abs_path);
- ret = XB_FIL_CUR_ERROR;
+ "corrupted.%s", cursor->abs_path, ignore_corruption_warn);
buf_page_print(page, cursor->page_size);
- break;
+ if (opt_log_innodb_page_corruption) {
+ corrupted_pages.add_page(cursor->node->name, cursor->node->space->id,
+ page_no);
+ retry_count = 1;
+ }
+ else {
+ ret = XB_FIL_CUR_ERROR;
+ break;
+ }
+ }
+ else {
+ msg(cursor->thread_n, "Database page corruption detected at page "
+ ULINTPF ", retrying...",
+ page_no);
+ os_thread_sleep(100000);
+ goto read_retry;
}
- msg(cursor->thread_n, "Database page corruption detected at page "
- ULINTPF ", retrying...",
- page_no);
- os_thread_sleep(100000);
- goto read_retry;
}
+ DBUG_EXECUTE_FOR_KEY("add_corrupted_page_for", cursor->node->space->name,
+ {
+ ulint corrupted_page_no = strtoul(dbug_val, NULL, 10);
+ if (page_no == corrupted_page_no)
+ corrupted_pages.add_page(cursor->node->name, cursor->node->space->id,
+ corrupted_page_no);
+ });
cursor->buf_read += page_size;
cursor->buf_npages++;
}
diff --git a/extra/mariabackup/fil_cur.h b/extra/mariabackup/fil_cur.h
index d4a7c0d5b39..d40610a6ca7 100644
--- a/extra/mariabackup/fil_cur.h
+++ b/extra/mariabackup/fil_cur.h
@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <my_dir.h>
#include "read_filt.h"
#include "srv0start.h"
+#include "xtrabackup.h"
struct xb_fil_cur_t {
pfs_os_file_t file; /*!< source file handle */
@@ -89,17 +90,15 @@ xb_fil_cur_open(
uint thread_n, /*!< thread number for diagnostics */
ulonglong max_file_size = ULLONG_MAX);
-/************************************************************************
-Reads and verifies the next block of pages from the source
+/** Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page.
-
+@param[in,out] cursor source file cursor
+@param[out] corrupted_pages adds corrupted pages if
+opt_log_innodb_page_corruption is set
@return XB_FIL_CUR_SUCCESS if some have been read successfully, XB_FIL_CUR_EOF
if there are no more pages to read and XB_FIL_CUR_ERROR on error. */
-xb_fil_cur_result_t
-xb_fil_cur_read(
-/*============*/
- xb_fil_cur_t* cursor); /*!< in/out: source file cursor */
-
+xb_fil_cur_result_t xb_fil_cur_read(xb_fil_cur_t *cursor,
+ CorruptedPages &corrupted_pages);
/************************************************************************
Close the source file cursor opened with xb_fil_cur_open() and its
associated read filter. */
diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc
index f1627dd1bc5..5bc320264e4 100644
--- a/extra/mariabackup/innobackupex.cc
+++ b/extra/mariabackup/innobackupex.cc
@@ -41,6 +41,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <my_global.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <mysql.h>
#include <my_dir.h>
@@ -206,7 +207,8 @@ enum innobackupex_options
OPT_STREAM,
OPT_TABLES_FILE,
OPT_THROTTLE,
- OPT_USE_MEMORY
+ OPT_USE_MEMORY,
+ OPT_INNODB_FORCE_RECOVERY,
};
ibx_mode_t ibx_mode = IBX_MODE_BACKUP;
@@ -624,6 +626,16 @@ static struct my_option ibx_long_options[] =
0, GET_LL, REQUIRED_ARG, 100*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
1024*1024L, 0},
+ {"innodb-force-recovery", OPT_INNODB_FORCE_RECOVERY,
+ "This option starts up the embedded InnoDB instance in crash "
+ "recovery mode to ignore page corruption; should be used "
+ "with the \"--apply-log\" option, in emergencies only. The "
+ "default value is 0. Refer to \"innodb_force_recovery\" server "
+ "system variable documentation for more details.",
+ (uchar*)&xtrabackup_innodb_force_recovery,
+ (uchar*)&xtrabackup_innodb_force_recovery,
+ 0, GET_ULONG, OPT_ARG, 0, 0, SRV_FORCE_IGNORE_CORRUPT, 0, 0, 0},
+
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -669,6 +681,7 @@ innobackupex [--compress] [--compress-threads=NUMBER-OF-THREADS] [--compress-chu
innobackupex --apply-log [--use-memory=B]\n\
[--defaults-file=MY.CNF]\n\
[--export] [--ibbackup=IBBACKUP-BINARY]\n\
+ [--innodb-force-recovery=1]\n\
BACKUP-DIR\n\
\n\
innobackupex --copy-back [--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME] BACKUP-DIR\n\
@@ -892,6 +905,12 @@ ibx_init()
opt_user = opt_ibx_user;
opt_password = opt_ibx_password;
+#if !defined(DONT_USE_MYSQL_PWD)
+ if (!opt_password)
+ {
+ opt_password=getenv("MYSQL_PWD");
+ }
+#endif
opt_host = opt_ibx_host;
opt_defaults_group = opt_ibx_defaults_group;
opt_socket = opt_ibx_socket;
diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc
index d72c11978a9..ae4c2251b00 100644
--- a/extra/mariabackup/write_filt.cc
+++ b/extra/mariabackup/write_filt.cc
@@ -26,13 +26,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "common.h"
#include "write_filt.h"
#include "fil_cur.h"
-#include "xtrabackup.h"
#include <os0proc.h>
/************************************************************************
Write-through page write filter. */
static my_bool wf_wt_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
- xb_fil_cur_t *cursor);
+ xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages);
static my_bool wf_wt_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile);
xb_write_filt_t wf_write_through = {
@@ -45,7 +44,7 @@ xb_write_filt_t wf_write_through = {
/************************************************************************
Incremental page write filter. */
static my_bool wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
- xb_fil_cur_t *cursor);
+ xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages);
static my_bool wf_incremental_process(xb_write_filt_ctxt_t *ctxt,
ds_file_t *dstfile);
static my_bool wf_incremental_finalize(xb_write_filt_ctxt_t *ctxt,
@@ -65,11 +64,11 @@ Initialize incremental page write filter.
@return TRUE on success, FALSE on error. */
static my_bool
wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
- xb_fil_cur_t *cursor)
+ xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages)
{
char meta_name[FN_REFLEN];
xb_wf_incremental_ctxt_t *cp =
- &(ctxt->u.wf_incremental_ctxt);
+ &(ctxt->wf_incremental_ctxt);
ctxt->cursor = cursor;
@@ -100,7 +99,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
strcat(dst_name, ".delta");
mach_write_to_4(cp->delta_buf, 0x78747261UL); /*"xtra"*/
+
cp->npages = 1;
+ cp->corrupted_pages = corrupted_pages;
return(TRUE);
}
@@ -117,15 +118,16 @@ wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile)
byte *page;
const ulint page_size
= cursor->page_size.physical();
- xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);
+ xb_wf_incremental_ctxt_t *cp = &(ctxt->wf_incremental_ctxt);
for (i = 0, page = cursor->buf; i < cursor->buf_npages;
i++, page += page_size) {
- if (incremental_lsn >= mach_read_from_8(page + FIL_PAGE_LSN)) {
-
+ if ((!cp->corrupted_pages ||
+ !cp->corrupted_pages->contains(cursor->node->space->id,
+ cursor->buf_page_no + i)) &&
+ incremental_lsn >= mach_read_from_8(page + FIL_PAGE_LSN))
continue;
- }
/* updated page */
if (cp->npages == page_size / 4) {
@@ -163,7 +165,7 @@ wf_incremental_finalize(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile)
xb_fil_cur_t *cursor = ctxt->cursor;
const ulint page_size
= cursor->page_size.physical();
- xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);
+ xb_wf_incremental_ctxt_t *cp = &(ctxt->wf_incremental_ctxt);
if (cp->npages != page_size / 4) {
mach_write_to_4(cp->delta_buf + cp->npages * 4, 0xFFFFFFFFUL);
@@ -185,7 +187,7 @@ Free the incremental page write filter's buffer. */
static void
wf_incremental_deinit(xb_write_filt_ctxt_t *ctxt)
{
- xb_wf_incremental_ctxt_t *cp = &(ctxt->u.wf_incremental_ctxt);
+ xb_wf_incremental_ctxt_t *cp = &(ctxt->wf_incremental_ctxt);
os_mem_free_large(cp->delta_buf, cp->delta_buf_size);
}
@@ -195,7 +197,7 @@ Initialize the write-through page write filter.
@return TRUE on success, FALSE on error. */
static my_bool
wf_wt_init(xb_write_filt_ctxt_t *ctxt, char *dst_name __attribute__((unused)),
- xb_fil_cur_t *cursor)
+ xb_fil_cur_t *cursor, CorruptedPages *)
{
ctxt->cursor = cursor;
diff --git a/extra/mariabackup/write_filt.h b/extra/mariabackup/write_filt.h
index febf25f2a8a..6c3ef24291f 100644
--- a/extra/mariabackup/write_filt.h
+++ b/extra/mariabackup/write_filt.h
@@ -27,26 +27,26 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "fil_cur.h"
#include "datasink.h"
+#include "xtrabackup.h"
/* Incremental page filter context */
typedef struct {
ulint delta_buf_size;
byte *delta_buf;
ulint npages;
+ CorruptedPages *corrupted_pages;
} xb_wf_incremental_ctxt_t;
/* Page filter context used as an opaque structure by callers */
typedef struct {
xb_fil_cur_t *cursor;
- union {
- xb_wf_incremental_ctxt_t wf_incremental_ctxt;
- } u;
+ xb_wf_incremental_ctxt_t wf_incremental_ctxt;
} xb_write_filt_ctxt_t;
typedef struct {
my_bool (*init)(xb_write_filt_ctxt_t *ctxt, char *dst_name,
- xb_fil_cur_t *cursor);
+ xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages);
my_bool (*process)(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile);
my_bool (*finalize)(xb_write_filt_ctxt_t *, ds_file_t *dstfile);
void (*deinit)(xb_write_filt_ctxt_t *);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 364d1242b29..59551a7d044 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -76,6 +76,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <list>
#include <sstream>
#include <set>
+#include <fstream>
#include <mysql.h>
#define G_PTR uchar*
@@ -104,6 +105,9 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <crc_glue.h>
#include <log.h>
#include <derror.h>
+#include "backup_debug.h"
+
+#define MB_CORRUPTED_PAGES_FILE "innodb_corrupted_pages"
int sys_var_init();
@@ -267,6 +271,12 @@ static char *xtrabackup_debug_sync = NULL;
my_bool xtrabackup_incremental_force_scan = FALSE;
+/*
+ * Ignore corrupt pages (disabled by default; used
+ * by "innobackupex" as a command line argument).
+ */
+ulong xtrabackup_innodb_force_recovery = 0;
+
/* The flushed lsn which is read from data files */
lsn_t flushed_lsn= 0;
@@ -304,6 +314,7 @@ my_bool opt_noversioncheck = FALSE;
my_bool opt_no_backup_locks = FALSE;
my_bool opt_decompress = FALSE;
my_bool opt_remove_original;
+my_bool opt_log_innodb_page_corruption;
my_bool opt_lock_ddl_per_table = FALSE;
static my_bool opt_check_privileges;
@@ -363,6 +374,207 @@ struct ddl_tracker_t {
static ddl_tracker_t ddl_tracker;
+// Convert non-null terminated filename to space name
+std::string filename_to_spacename(const byte *filename, size_t len);
+
+CorruptedPages::CorruptedPages() { ut_a(!pthread_mutex_init(&m_mutex, NULL)); }
+
+CorruptedPages::~CorruptedPages() { ut_a(!pthread_mutex_destroy(&m_mutex)); }
+
+void CorruptedPages::add_page_no_lock(const char *space_name, ulint space_id,
+ ulint page_no, bool convert_space_name)
+{
+ space_info_t &space_info = m_spaces[space_id];
+ if (space_info.space_name.empty())
+ space_info.space_name=
+ convert_space_name
+ ? filename_to_spacename(reinterpret_cast<const byte *>(space_name),
+ strlen(space_name))
+ : space_name;
+ (void)space_info.pages.insert(page_no);
+}
+
+void CorruptedPages::add_page(const char *file_name, ulint space_id,
+ ulint page_no)
+{
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ add_page_no_lock(file_name, space_id, page_no, true);
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+}
+
+bool CorruptedPages::contains(ulint space_id, ulint page_no) const
+{
+ bool result = false;
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ container_t::const_iterator space_it= m_spaces.find(space_id);
+ if (space_it != m_spaces.end())
+ result = space_it->second.pages.count(page_no);
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+ return result;
+}
+
+void CorruptedPages::drop_space(ulint space_id)
+{
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ m_spaces.erase(space_id);
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+}
+
+void CorruptedPages::rename_space(ulint space_id, const std::string &new_name)
+{
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ container_t::iterator space_it = m_spaces.find(space_id);
+ if (space_it != m_spaces.end())
+ space_it->second.space_name = new_name;
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+}
+
+bool CorruptedPages::print_to_file(const char *filename) const
+{
+ std::ostringstream out;
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ if (!m_spaces.size())
+ {
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+ return true;
+ }
+ for (container_t::const_iterator space_it=
+ m_spaces.begin();
+ space_it != m_spaces.end(); ++space_it)
+ {
+ out << space_it->second.space_name << " " << space_it->first << "\n";
+ bool first_page_no= true;
+ for (std::set<ulint>::const_iterator page_it=
+ space_it->second.pages.begin();
+ page_it != space_it->second.pages.end(); ++page_it)
+ if (first_page_no)
+ {
+ out << *page_it;
+ first_page_no= false;
+ }
+ else
+ out << " " << *page_it;
+ out << "\n";
+ }
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+ if (xtrabackup_backup)
+ return backup_file_print_buf(filename, out.str().c_str(),
+ out.str().size());
+ std::ofstream outfile;
+ outfile.open(filename);
+ if (!outfile.is_open())
+ die("Can't open %s, error number: %d, error message: %s", filename, errno,
+ strerror(errno));
+ outfile << out.str();
+ return true;
+}
+
+void CorruptedPages::read_from_file(const char *file_name)
+{
+ MY_STAT mystat;
+ if (!my_stat(file_name, &mystat, MYF(0)))
+ return;
+ std::ifstream infile;
+ infile.open(file_name);
+ if (!infile.is_open())
+ die("Can't open %s, error number: %d, error message: %s", file_name, errno,
+ strerror(errno));
+ std::string line;
+ std::string space_name;
+ ulint space_id;
+ ulint line_number= 0;
+ while (std::getline(infile, line))
+ {
+ ++line_number;
+ std::istringstream iss(line);
+ if (line_number & 1) {
+ if (!(iss >> space_name))
+ die("Can't parse space name from corrupted pages file at "
+ "line " ULINTPF,
+ line_number);
+ if (!(iss >> space_id))
+ die("Can't parse space id from corrupted pages file at line " ULINTPF,
+ line_number);
+ }
+ else
+ {
+ ulint page_no;
+ while ((iss >> page_no))
+ add_page_no_lock(space_name.c_str(), space_id, page_no, false);
+ if (!iss.eof())
+ die("Corrupted pages file parse error on line number " ULINTPF,
+ line_number);
+ }
+ }
+}
+
+bool CorruptedPages::empty() const
+{
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ bool result= !m_spaces.size();
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+ return result;
+}
+
+static void xb_load_single_table_tablespace(const std::string &space_name,
+ bool set_size);
+static void xb_data_files_close();
+
+void CorruptedPages::zero_out_free_pages()
+{
+ container_t non_free_pages;
+ byte* buf= static_cast<byte*>(ut_malloc_nokey(2 * UNIV_PAGE_SIZE));
+ byte* zero_page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
+ memset(zero_page, 0, UNIV_PAGE_SIZE);
+
+ ut_a(!pthread_mutex_lock(&m_mutex));
+ for (container_t::const_iterator space_it= m_spaces.begin();
+ space_it != m_spaces.end(); ++space_it)
+ {
+ ulint space_id = space_it->first;
+ const std::string &space_name = space_it->second.space_name;
+ // There is no need to close tablespaces explixitly as they will be closed
+ // in innodb_shutdown().
+ xb_load_single_table_tablespace(space_name, false);
+ mutex_enter(&fil_system->mutex);
+ fil_space_t *space = fil_space_get_by_name(space_name.c_str());
+ mutex_exit(&fil_system->mutex);
+ if (!space)
+ die("Can't find space object for space name %s to check corrupted page",
+ space_name.c_str());
+ for (std::set<ulint>::const_iterator page_it=
+ space_it->second.pages.begin();
+ page_it != space_it->second.pages.end(); ++page_it)
+ {
+ bool is_free= fseg_page_is_free(space, *page_it);
+ if (!is_free) {
+ space_info_t &space_info = non_free_pages[space_id];
+ space_info.pages.insert(*page_it);
+ if (space_info.space_name.empty())
+ space_info.space_name = space_name;
+ msg("Error: corrupted page " ULINTPF
+ " of tablespace %s can not be fixed",
+ *page_it, space_name.c_str());
+ }
+ else
+ {
+ const page_id_t page_id(space->id, *page_it);
+ dberr_t err= fil_io(IORequestWrite, true, page_id, univ_page_size, 0,
+ univ_page_size.physical(), zero_page, NULL);
+ if (err != DB_SUCCESS)
+ die("Can't zero out corrupted page " ULINTPF " of tablespace %s",
+ *page_it, space_name.c_str());
+ msg("Corrupted page " ULINTPF
+ " of tablespace %s was successfuly fixed.",
+ *page_it, space_name.c_str());
+ }
+ }
+ }
+ m_spaces.swap(non_free_pages);
+ ut_a(!pthread_mutex_unlock(&m_mutex));
+ ut_free(buf);
+}
+
/* Simple datasink creation tracking...add datasinks in the reverse order you
want them destroyed. */
#define XTRABACKUP_MAX_DATASINKS 10
@@ -376,11 +588,12 @@ xtrabackup_add_datasink(ds_ctxt_t *ds)
datasinks[actual_datasinks] = ds; actual_datasinks++;
}
-
-typedef void (*process_single_tablespace_func_t)(const char *dirname, const char *filname, bool is_remote);
+typedef void (*process_single_tablespace_func_t)(const char *dirname,
+ const char *filname,
+ bool is_remote,
+ bool set_size);
static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback);
-
/* ======== Datafiles iterator ======== */
struct datafiles_iter_t {
fil_system_t *system;
@@ -732,6 +945,7 @@ typedef struct {
uint *count;
pthread_mutex_t* count_mutex;
os_thread_id_t id;
+ CorruptedPages *corrupted_pages;
} data_thread_ctxt_t;
/* ======== for option and variables ======== */
@@ -837,7 +1051,9 @@ enum options_xtrabackup
OPT_LOCK_DDL_PER_TABLE,
OPT_ROCKSDB_DATADIR,
OPT_BACKUP_ROCKSDB,
- OPT_XTRA_CHECK_PRIVILEGES
+ OPT_XTRA_CHECK_PRIVILEGES,
+ OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION,
+ OPT_INNODB_FORCE_RECOVERY
};
struct my_option xb_client_options[]= {
@@ -1234,6 +1450,17 @@ struct my_option xb_client_options[]= {
" uses old (pre-4.1.1) protocol.",
&opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
+
+ {"log-innodb-page-corruption", OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION,
+ "Continue backup if innodb corrupted pages are found. The pages are "
+ "logged in " MB_CORRUPTED_PAGES_FILE
+ " and backup is finished with error. "
+ "--prepare will try to fix corrupted pages. If " MB_CORRUPTED_PAGES_FILE
+ " exists after --prepare in base backup directory, backup still contains "
+ "corrupted pages and can not be considered as consistent.",
+ &opt_log_innodb_page_corruption, &opt_log_innodb_page_corruption, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
#define MYSQL_CLIENT
#include "sslopt-longopts.h"
#undef MYSQL_CLIENT
@@ -1457,6 +1684,13 @@ struct my_option xb_server_options[] =
&opt_check_privileges, &opt_check_privileges,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
+ {"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY,
+ "(for --prepare): Crash recovery mode (ignores "
+ "page corruption; for emergencies only).",
+ (G_PTR*)&srv_force_recovery,
+ (G_PTR*)&srv_force_recovery,
+ 0, GET_ULONG, OPT_ARG, 0, 0, SRV_FORCE_IGNORE_CORRUPT, 0, 0, 0},
+
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1519,7 +1753,8 @@ debug_sync_point(const char *name)
static std::set<std::string> tables_for_export;
-static void append_export_table(const char *dbname, const char *tablename, bool is_remote)
+static void append_export_table(const char *dbname, const char *tablename,
+ bool is_remote, bool set_size)
{
if(dbname && tablename && !is_remote)
{
@@ -1587,24 +1822,26 @@ static int prepare_export()
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
- " --console --skip-log-error --skip-log-bin --bootstrap < "
+ " --console --skip-log-error --skip-log-bin --bootstrap %s < "
BOOTSTRAP_FILENAME IF_WIN("\"",""),
- mariabackup_exe,
+ mariabackup_exe,
orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""),
- xtrabackup_use_memory);
+ xtrabackup_use_memory,
+ (srv_force_recovery ? "--innodb-force-recovery=1" : ""));
}
else
{
- sprintf(cmdline,
+ snprintf(cmdline, sizeof cmdline,
IF_WIN("\"","") "\"%s\" --mysqld"
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
- " --console --log-error= --skip-log-bin --bootstrap < "
+ " --console --log-error= --skip-log-bin --bootstrap %s < "
BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe,
(my_defaults_group_suffix?my_defaults_group_suffix:""),
- xtrabackup_use_memory);
+ xtrabackup_use_memory,
+ (srv_force_recovery ? "--innodb-force-recovery=1" : ""));
}
msg("Prepare export : executing %s\n", cmdline);
@@ -1764,6 +2001,13 @@ xb_get_one_option(int optid,
ADD_PRINT_PARAM_OPT(innobase_buffer_pool_filename);
break;
+ case OPT_INNODB_FORCE_RECOVERY:
+
+ if (srv_force_recovery) {
+ ADD_PRINT_PARAM_OPT(srv_force_recovery);
+ }
+ break;
+
case OPT_XTRA_TARGET_DIR:
strmake(xtrabackup_real_target_dir,argument, sizeof(xtrabackup_real_target_dir)-1);
xtrabackup_target_dir= xtrabackup_real_target_dir;
@@ -2029,6 +2273,29 @@ innodb_init_param(void)
srv_undo_dir = (char*) ".";
}
+ compile_time_assert(SRV_FORCE_IGNORE_CORRUPT == 1);
+
+ /*
+ * This option can be read both from the command line, and the
+ * defaults file. The assignment should account for both cases,
+ * and for "--innobackupex". Since the command line argument is
+ * parsed after the defaults file, it takes precedence.
+ */
+ if (xtrabackup_innodb_force_recovery) {
+ srv_force_recovery = xtrabackup_innodb_force_recovery;
+ }
+
+ if (srv_force_recovery >= SRV_FORCE_IGNORE_CORRUPT) {
+ if (!xtrabackup_prepare) {
+ msg("mariabackup: The option \"innodb_force_recovery\""
+ " should only be used with \"%s\".",
+ (innobackupex_mode ? "--apply-log" : "--prepare"));
+ goto error;
+ } else {
+ msg("innodb_force_recovery = %lu", srv_force_recovery);
+ }
+ }
+
return(FALSE);
error:
@@ -2549,7 +2816,8 @@ for full backup, pages filter for incremental backup, etc.
@return FALSE on success and TRUE on error */
static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n,
const char *dest_name,
- const xb_write_filt_t &write_filter)
+ const xb_write_filt_t &write_filter,
+ CorruptedPages &corrupted_pages)
{
char dst_name[FN_REFLEN];
ds_file_t *dstfile = NULL;
@@ -2610,7 +2878,8 @@ static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n,
ut_a(write_filter.process != NULL);
if (write_filter.init != NULL &&
- !write_filter.init(&write_filt_ctxt, dst_name, &cursor)) {
+ !write_filter.init(&write_filt_ctxt, dst_name, &cursor,
+ opt_log_innodb_page_corruption ? &corrupted_pages : NULL)) {
msg (thread_n, "mariabackup: error: failed to initialize page write filter.");
goto error;
}
@@ -2630,7 +2899,8 @@ static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n,
}
/* The main copy loop */
- while ((res = xb_fil_cur_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
+ while ((res = xb_fil_cur_read(&cursor, corrupted_pages)) ==
+ XB_FIL_CUR_SUCCESS) {
if (!write_filter.process(&write_filt_ctxt, dstfile)) {
goto error;
}
@@ -2916,6 +3186,21 @@ static os_thread_ret_t io_watching_thread(void*)
}
#ifndef DBUG_OFF
+char *dbug_mariabackup_get_val(const char *event, const char *key)
+{
+ char envvar[FN_REFLEN];
+ if (key) {
+ snprintf(envvar, sizeof(envvar), "%s_%s", event, key);
+ char *slash = strchr(envvar, '/');
+ if (slash)
+ *slash = '_';
+ } else {
+ strncpy(envvar, event, sizeof envvar - 1);
+ envvar[sizeof envvar - 1] = '\0';
+ }
+ return getenv(envvar);
+}
+
/*
In debug mode, execute SQL statement that was passed via environment.
To use this facility, you need to
@@ -2928,35 +3213,15 @@ To use this facility, you need to
for the variable)
3. start mariabackup with --dbug=+d,debug_mariabackup_events
*/
-static void dbug_mariabackup_event(const char *event,const char *key)
+void dbug_mariabackup_event(const char *event,const char *key)
{
- char envvar[FN_REFLEN];
- if (key) {
- snprintf(envvar, sizeof(envvar), "%s_%s", event, key);
- char *slash = strchr(envvar, '/');
- if (slash)
- *slash = '_';
- } else {
- strncpy(envvar, event, sizeof envvar - 1);
- envvar[sizeof envvar - 1] = '\0';
- }
- char *sql = getenv(envvar);
- if (sql) {
+ char *sql = dbug_mariabackup_get_val(event, key);
+ if (sql && *sql) {
msg("dbug_mariabackup_event : executing '%s'", sql);
xb_mysql_query(mysql_connection, sql, false, true);
}
-
}
-#define DBUG_MARIABACKUP_EVENT(A, B) DBUG_EXECUTE_IF("mariabackup_events", dbug_mariabackup_event(A,B););
-#define DBUG_MB_INJECT_CODE(EVENT, KEY, CODE) \
- DBUG_EXECUTE_IF("mariabackup_inject_code", {\
- char *env = getenv(EVENT); \
- if (env && !strcmp(env, KEY)) { CODE } \
- })
-#else
-#define DBUG_MARIABACKUP_EVENT(A,B)
-#define DBUG_MB_INJECT_CODE(EVENT, KEY, CODE)
-#endif
+#endif // DBUG_OFF
/**************************************************************************
Datafiles copying thread.*/
@@ -2969,6 +3234,7 @@ data_copy_thread_func(
data_thread_ctxt_t *ctxt = (data_thread_ctxt_t *) arg;
uint num = ctxt->num;
fil_node_t* node;
+ ut_ad(ctxt->corrupted_pages);
/*
Initialize mysys thread-specific memory so we can
@@ -2980,11 +3246,12 @@ data_copy_thread_func(
while ((node = datafiles_iter_next(ctxt->it)) != NULL) {
DBUG_MARIABACKUP_EVENT("before_copy", node->space->name);
- DBUG_MB_INJECT_CODE("wait_innodb_redo_before_copy", node->space->name,
+ DBUG_EXECUTE_FOR_KEY("wait_innodb_redo_before_copy", node->space->name,
backup_wait_for_lsn(get_current_lsn(mysql_connection)););
/* copy the datafile */
if (xtrabackup_copy_datafile(node, num, NULL,
- xtrabackup_incremental ? wf_incremental : wf_write_through))
+ xtrabackup_incremental ? wf_incremental : wf_write_through,
+ *ctxt->corrupted_pages))
die("failed to copy datafile.");
DBUG_MARIABACKUP_EVENT("after_copy", node->space->name);
@@ -3120,15 +3387,22 @@ xb_new_datafile(const char *name, bool is_remote)
}
-static
-void
-xb_load_single_table_tablespace(
- const char *dirname,
- const char *filname,
- bool is_remote)
+/** Load tablespace.
+
+@param[in] dirname directory name of the tablespace to open
+@param[in] filname file name of the tablespece to open
+@param[in] is_remote true if tablespace file is .isl
+@param[in] set_size true if we need to set tablespace size in pages explixitly.
+If this parameter is set, the size and free pages limit will not be read
+from page 0.
+*/
+static void xb_load_single_table_tablespace(const char *dirname,
+ const char *filname,
+ bool is_remote, bool set_size)
{
ut_ad(srv_operation == SRV_OPERATION_BACKUP
- || srv_operation == SRV_OPERATION_RESTORE_DELTA);
+ || srv_operation == SRV_OPERATION_RESTORE_DELTA
+ || srv_operation == SRV_OPERATION_RESTORE);
/* Ignore .isl files on XtraBackup recovery. All tablespaces must be
local. */
if (is_remote && srv_operation == SRV_OPERATION_RESTORE_DELTA) {
@@ -3176,13 +3450,12 @@ xb_load_single_table_tablespace(
bool is_empty_file = file->exists() && file->is_empty_file();
if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) {
- os_offset_t node_size = os_file_get_size(file->handle());
- os_offset_t n_pages;
-
- ut_a(node_size != (os_offset_t) -1);
-
- n_pages = node_size / page_size_t(file->flags()).physical();
-
+ os_offset_t n_pages = 0;
+ if (set_size) {
+ os_offset_t node_size = os_file_get_size(file->handle());
+ ut_a(node_size != (os_offset_t) -1);
+ n_pages = node_size / page_size_t(file->flags()).physical();
+ }
space = fil_space_create(
name, file->space_id(), file->flags(),
FIL_TYPE_TABLESPACE, NULL/* TODO: crypt_data */);
@@ -3210,6 +3483,27 @@ xb_load_single_table_tablespace(
ut_free(name);
}
+static void xb_load_single_table_tablespace(const std::string &space_name,
+ bool set_size)
+{
+ std::string name(space_name);
+ bool is_remote= access((name + ".ibd").c_str(), R_OK) != 0;
+ const char *extension= is_remote ? ".isl" : ".ibd";
+ name.append(extension);
+ char buf[FN_REFLEN];
+ strncpy(buf, name.c_str(), sizeof buf - 1);
+ buf[sizeof buf - 1]= '\0';
+ const char *dbname= buf;
+ char *p= strchr(buf, '/');
+ if (p == 0)
+ die("Unexpected tablespace %s filename %s", space_name.c_str(),
+ name.c_str());
+ ut_a(p);
+ *p= 0;
+ const char *tablename= p + 1;
+ xb_load_single_table_tablespace(dbname, tablename, is_remote, set_size);
+}
+
/** Scan the database directories under the MySQL datadir, looking for
.ibd files and determining the space id in each of them.
@return DB_SUCCESS or error number */
@@ -3251,7 +3545,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
bool is_ibd = !is_isl && ends_with(dbinfo.name,".ibd");
if (is_isl || is_ibd) {
- (*callback)(NULL, dbinfo.name, is_isl);
+ (*callback)(NULL, dbinfo.name, is_isl, false);
}
}
@@ -3308,7 +3602,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
if (strlen(fileinfo.name) > 4) {
bool is_isl= false;
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".isl"))))
- (*callback)(dbinfo.name, fileinfo.name, is_isl);
+ (*callback)(dbinfo.name, fileinfo.name, is_isl, false);
}
}
@@ -4080,6 +4374,7 @@ static bool xtrabackup_backup_func()
uint i;
uint count;
pthread_mutex_t count_mutex;
+ CorruptedPages corrupted_pages;
data_thread_ctxt_t *data_threads;
pthread_mutex_init(&backup_mutex, NULL);
pthread_cond_init(&scanned_lsn_cond, NULL);
@@ -4401,6 +4696,7 @@ fail_before_log_copying_thread_start:
data_threads[i].num = i+1;
data_threads[i].count = &count;
data_threads[i].count_mutex = &count_mutex;
+ data_threads[i].corrupted_pages = &corrupted_pages;
os_thread_create(data_copy_thread_func, data_threads + i,
&data_threads[i].id);
}
@@ -4421,7 +4717,7 @@ fail_before_log_copying_thread_start:
datafiles_iter_free(it);
}
- bool ok = backup_start();
+ bool ok = backup_start(corrupted_pages);
if (ok) {
ok = xtrabackup_backup_low();
@@ -4438,6 +4734,9 @@ fail_before_log_copying_thread_start:
}
}
+ if (opt_log_innodb_page_corruption)
+ ok = corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE);
+
if (!ok) {
goto fail;
}
@@ -4465,6 +4764,11 @@ fail_before_log_copying_thread_start:
log_file_op = NULL;
pthread_mutex_destroy(&backup_mutex);
pthread_cond_destroy(&scanned_lsn_cond);
+ if (!corrupted_pages.empty()) {
+ ut_ad(opt_log_innodb_page_corruption);
+ msg("Error: corrupted innodb pages are found and logged to "
+ MB_CORRUPTED_PAGES_FILE " file");
+ }
return(true);
}
@@ -4487,7 +4791,7 @@ FTWRL. This ensures consistent backup in presence of DDL.
It is the responsibility of the prepare phase to deal with .new, .ren, and .del
files.
*/
-void backup_fix_ddl(void)
+void backup_fix_ddl(CorruptedPages &corrupted_pages)
{
std::set<std::string> new_tables;
std::set<std::string> dropped_tables;
@@ -4510,6 +4814,7 @@ void backup_fix_ddl(void)
if (ddl_tracker.drops.find(id) != ddl_tracker.drops.end()) {
dropped_tables.insert(name);
+ corrupted_pages.drop_space(id);
continue;
}
@@ -4530,15 +4835,21 @@ void backup_fix_ddl(void)
/* table was renamed, but we need a full copy
of it because of optimized DDL. We emulate a drop/create.*/
dropped_tables.insert(name);
+ if (opt_log_innodb_page_corruption)
+ corrupted_pages.drop_space(id);
new_tables.insert(new_name);
} else {
/* Renamed, and no optimized DDL*/
renamed_tables[name] = new_name;
+ if (opt_log_innodb_page_corruption)
+ corrupted_pages.rename_space(id, new_name);
}
} else if (has_optimized_ddl) {
/* Table was recreated, or optimized DDL ran.
In both cases we need a full copy in the backup.*/
new_tables.insert(name);
+ if (opt_log_innodb_page_corruption)
+ corrupted_pages.drop_space(id);
}
}
@@ -4558,6 +4869,8 @@ void backup_fix_ddl(void)
if (ddl_tracker.drops.find(id) == ddl_tracker.drops.end()) {
dropped_tables.erase(name);
new_tables.insert(name);
+ if (opt_log_innodb_page_corruption)
+ corrupted_pages.drop_space(id);
}
}
@@ -4600,23 +4913,7 @@ void backup_fix_ddl(void)
const char *space_name = iter->c_str();
if (check_if_skip_table(space_name))
continue;
- std::string name(*iter);
- bool is_remote = access((name + ".ibd").c_str(), R_OK) != 0;
- const char *extension = is_remote ? ".isl" : ".ibd";
- name.append(extension);
- char buf[FN_REFLEN];
- strncpy(buf, name.c_str(), sizeof buf - 1);
- buf[sizeof buf - 1] = '\0';
- const char *dbname = buf;
- char *p = strchr(buf, '/');
- if (p == 0) {
- msg("Unexpected tablespace %s filename %s", space_name, name.c_str());
- ut_a(0);
- }
- ut_a(p);
- *p = 0;
- const char *tablename = p + 1;
- xb_load_single_table_tablespace(dbname, tablename, is_remote);
+ xb_load_single_table_tablespace(*iter, false);
}
it = datafiles_iter_new(fil_system);
@@ -4629,7 +4926,8 @@ void backup_fix_ddl(void)
continue;
std::string dest_name(node->space->name);
dest_name.append(".new");
- xtrabackup_copy_datafile(node, 0, dest_name.c_str(), wf_write_through);
+ xtrabackup_copy_datafile(node, 0, dest_name.c_str(), wf_write_through,
+ corrupted_pages);
}
datafiles_iter_free(it);
@@ -5538,6 +5836,7 @@ static ibool prepare_handle_del_files(const char *datadir, const char *db, const
@return whether the operation succeeded */
static bool xtrabackup_prepare_func(char** argv)
{
+ CorruptedPages corrupted_pages;
char metadata_path[FN_REFLEN];
/* cd to target-dir */
@@ -5557,6 +5856,10 @@ static bool xtrabackup_prepare_func(char** argv)
ut_ad(inc_dir_tables_hash);
}
+ msg("open files limit requested %u, set to %u",
+ (uint) xb_open_files_limit,
+ xb_set_max_open_files(xb_open_files_limit));
+
/* Fix DDL for prepare. Process .del,.ren, and .new files.
The order in which files are processed, is important
(see MDEV-18185, MDEV-18201)
@@ -5711,6 +6014,30 @@ static bool xtrabackup_prepare_func(char** argv)
goto error_cleanup;
}
+ corrupted_pages.read_from_file(MB_CORRUPTED_PAGES_FILE);
+ if (xtrabackup_incremental)
+ {
+ char inc_filename[FN_REFLEN];
+ sprintf(inc_filename, "%s/%s", xtrabackup_incremental_dir,
+ MB_CORRUPTED_PAGES_FILE);
+ corrupted_pages.read_from_file(inc_filename);
+ }
+ if (!corrupted_pages.empty())
+ corrupted_pages.zero_out_free_pages();
+ if (corrupted_pages.empty())
+ {
+ if (!xtrabackup_incremental && unlink(MB_CORRUPTED_PAGES_FILE) &&
+ errno != ENOENT)
+ {
+ char errbuf[MYSYS_STRERROR_SIZE];
+ my_strerror(errbuf, sizeof(errbuf), errno);
+ die("Error: unlink %s failed: %s", MB_CORRUPTED_PAGES_FILE,
+ errbuf);
+ }
+ }
+ else
+ corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE);
+
if (xtrabackup_rollback_xa)
{
/* Please do not merge MDEV-21168 fix in 10.5+ */
@@ -5795,12 +6122,9 @@ static bool xtrabackup_prepare_func(char** argv)
srv_shutdown_bg_undo_sources();
srv_purge_shutdown();
buf_flush_sync_all_buf_pools();
- innodb_shutdown();
- innobase_space_shutdown();
}
- else
- innodb_shutdown();
+ innodb_shutdown();
innodb_free_param();
/* output to metadata file */
@@ -5839,7 +6163,7 @@ static bool xtrabackup_prepare_func(char** argv)
error_cleanup:
xb_filters_free();
- return ok && !ib::error::was_logged();
+ return ok && !ib::error::was_logged() && corrupted_pages.empty();
}
/**************************************************************************
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index 2dbdd442f95..e2955f58d6a 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -35,6 +35,32 @@ struct xb_delta_info_t
ulint space_id;
};
+class CorruptedPages
+{
+public:
+ CorruptedPages();
+ ~CorruptedPages();
+ void add_page(const char *file_name, ulint space_id, ulint page_no);
+ bool contains(ulint space_id, ulint page_no) const;
+ void drop_space(ulint space_id);
+ void rename_space(ulint space_id, const std::string &new_name);
+ bool print_to_file(const char *file_name) const;
+ void read_from_file(const char *file_name);
+ bool empty() const;
+ void zero_out_free_pages();
+
+private:
+ void add_page_no_lock(const char *space_name, ulint space_id, ulint page_no,
+ bool convert_space_name);
+ struct space_info_t {
+ std::string space_name;
+ std::set<ulint> pages;
+ };
+ typedef std::map<ulint, space_info_t> container_t;
+ mutable pthread_mutex_t m_mutex;
+ container_t m_spaces;
+};
+
/* value of the --incremental option */
extern lsn_t incremental_lsn;
@@ -110,6 +136,7 @@ extern my_bool opt_remove_original;
extern my_bool opt_extended_validation;
extern my_bool opt_encrypted_backup;
extern my_bool opt_lock_ddl_per_table;
+extern my_bool opt_log_innodb_page_corruption;
extern char *opt_incremental_history_name;
extern char *opt_incremental_history_uuid;
@@ -145,6 +172,8 @@ enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_ON,
extern ulong opt_binlog_info;
+extern ulong xtrabackup_innodb_force_recovery;
+
void xtrabackup_io_throttling(void);
my_bool xb_write_delta_metadata(const char *filename,
const xb_delta_info_t *info);
diff --git a/include/my_sys.h b/include/my_sys.h
index 08b06951d0d..ac1730eeaff 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -534,8 +534,11 @@ static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
if (info->write_pos + Count <= info->write_end)
{
- memcpy(info->write_pos, Buffer, Count);
- info->write_pos+= Count;
+ if (Count)
+ {
+ memcpy(info->write_pos, Buffer, Count);
+ info->write_pos+= Count;
+ }
return 0;
}
return _my_b_write(info, Buffer, Count);
diff --git a/include/mysql/plugin_ftparser.h b/include/mysql/plugin_ftparser.h
index 99bb6b24f3f..8db8712926f 100644
--- a/include/mysql/plugin_ftparser.h
+++ b/include/mysql/plugin_ftparser.h
@@ -158,7 +158,9 @@ typedef struct st_mysql_ftparser_boolean_info
the word to MySQL full-text index. When parsing a search query,
this function will add the new word to the list of words to search
for. The boolean_info argument can be NULL for all cases except
- when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
+ when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO. A plugin can replace this
+ callback to post-process every parsed word before passing it to the original
+ mysql_add_word function.
ftparser_state: A generic pointer. The plugin can set it to point
to information to be used internally for its own purposes.
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index 54b9eb9250c..8432526a78b 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -107,7 +107,6 @@ extern struct wsrep_service_st {
bool (*wsrep_thd_ignore_table_func)(THD *thd);
long long (*wsrep_thd_trx_seqno_func)(THD *thd);
struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd);
- void (*wsrep_thd_auto_increment_variables_func)(THD *thd, unsigned long long *offset, unsigned long long *increment);
void (*wsrep_set_load_multi_commit_func)(THD *thd, bool split);
bool (*wsrep_is_load_multi_commit_func)(THD *thd);
int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd);
@@ -155,7 +154,6 @@ extern struct wsrep_service_st {
#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T)
#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T)
-#define wsrep_thd_auto_increment_variables(T,O,I) wsrep_service->wsrep_thd_auto_increment_variables_func(T,O,I)
#define wsrep_set_load_multi_commit(T,S) wsrep_service->wsrep_set_load_multi_commit_func(T,S)
#define wsrep_is_load_multi_commit(T) wsrep_service->wsrep_is_load_multi_commit_func(T)
#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T)
@@ -212,7 +210,6 @@ my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool sync);
my_bool wsrep_thd_is_wsrep(MYSQL_THD thd);
struct wsrep *get_wsrep();
struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd);
-void wsrep_thd_auto_increment_variables(THD *thd, unsigned long long *offset, unsigned long long *increment);
void wsrep_set_load_multi_commit(THD *thd, bool split);
bool wsrep_is_load_multi_commit(THD *thd);
void wsrep_aborting_thd_enqueue(THD *thd);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index a63bcc9d87e..398bf9058df 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -26,7 +26,7 @@
#define HOSTNAME_LENGTH 60
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_CHAR_LEN 64U /* Field/table name length */
-#define USERNAME_CHAR_LENGTH 128U
+#define USERNAME_CHAR_LENGTH 128
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
#define DEFINER_CHAR_LENGTH (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 1)
diff --git a/include/service_versions.h b/include/service_versions.h
index 6e138fab5a4..3ad42de2f8f 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -41,4 +41,4 @@
#define VERSION_thd_specifics 0x0100
#define VERSION_thd_timezone 0x0100
#define VERSION_thd_wait 0x0100
-#define VERSION_wsrep 0x0202
+#define VERSION_wsrep 0x0300
diff --git a/libmariadb b/libmariadb
-Subproject e38244220646a7e95c9be22576460aa7a4eb715
+Subproject fc431a035a21ac1d4ef25d9d3cd8c4d7e64a8ee
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 229e4e69e6a..ddb3f2c71aa 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -623,7 +623,8 @@ int init_embedded_server(int argc, char **argv, char **groups)
(void) thr_setconcurrency(concurrency); // 10 by default
- start_handle_manager();
+ if (flush_time && flush_time != ~(ulong) 0L)
+ start_handle_manager();
// FIXME initialize binlog_filter and rpl_filter if not already done
// corresponding delete is in clean_up()
diff --git a/man/mysqldump.1 b/man/mysqldump.1
index 7594703d20a..2cfe308836a 100644
--- a/man/mysqldump.1
+++ b/man/mysqldump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLDUMP\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System"
+.TH "\FBMYSQLDUMP\FR" "1" "24 October 2020" "MariaDB 10\&.2" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -36,7 +36,7 @@ tables, consider using the
instead because it can accomplish faster backups and faster restores\&. See
\fBmysqlhotcopy\fR(1)\&.
.PP
-There are three general ways to invoke
+There are four general ways to invoke
\fBmysqldump\fR:
.sp
.if n \{\
@@ -46,6 +46,7 @@ There are three general ways to invoke
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR
+shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-system={options}\fR
.fi
.if n \{\
.RE
@@ -2192,6 +2193,109 @@ Verify server's "Common Name" in its cert against hostname used when connecting.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysqladmin: Dump system tables option
+.\" Dump system tables option: mysqladmin
+\fB\-\-system=\fR\fB\fI{all, users, plugins, udfs, servers, stats, timezones}\fR\fR
+.sp
+Dump the system tables in the mysql database in a logical form\&. This option is an empty set by default\&.
+.sp
+One or more options can be listed in comma separated list\&.
+.sp
+The options here are:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+all \- an alias to enabling all of the below options\&.
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+users \- the users, roles and their grants outputed as \fBCREATE USER\fB, \fBCREATE ROLE\fR, \fBGRANT\fR, and \fBSET DEFAULT ROLE\fR (\fBALTER USER\fR for MySQL-8.0+)\&.
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+plugins \- active plugins of the server outputed as \fBINSTALL PLUGIN\fR\&.
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+udfs \- user define functions outputed as \fBCREATE FUNCTION\fR\&.
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+servers \- remote (federated) servers as \fBCREATE SERVER\fR\&.
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+stats \- statistics tables, InnoDB and Engine Independent Table Statistics (EITS), are dumped as \fBREPLACE INTO\fR (or \fBINSERT IGNORE\fR if \fB\-\-insert\-into\fR is specified) statements without (re)creating tables\&.
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+timezones \- timezone related system tables dumped as \fBREPLACE INTO\fR (or \fBINSERT IGNORE\fR if \fB\-\-insert\-into\fR is specified) statements without (re)creating tables\&.
+.RE
+.sp
+The format of the output is affected by \fB\-\-replace\fR and \fB\-\-insert\-into\fR\&. The \fB\-\-replace\fR option will output \fBCREATE OR REPLACE\fR
+forms of SQL, and also \fBDROP IF EXISTS\fR prior to \fBCREATE\fR, if a \fBCREATE OR REPLACE\fR option isn't available.
+.sp
+With \fB\-\-system=user\fR (or \fBall\fR), and \fB\-\-replace\fR, SQL is generated to generate an error if attempting to import the dump with a connection user that is being replaced within the dump\&.
+.sp
+The \fB\-\-insert\-into\fR option will cause \fBCREATE IF NOT EXIST\fR forms of SQL to generated if available.
+.sp
+For stats, and timezones, \fB\-\-replace\fR and \fB\-\-insert\-into\fR have the usual effects.
+.sp
+Enabling specific options here will cause the relevant tables in the mysql database to be ignored when dumping the mysql database or \fB\-\-all\-databases\fR\&.
+.sp
+To help in migrating from MySQL to MariaDB, this option is designed to be able to dump system information from MySQL-5\&.7 and 8\&.0 servers\&. SQL generated is also experimentally compatible with MySQL-5\&.7/8\&.0. Mappings of implementation specific grants/plugins isn't always one-to-one however between MariaDB and MySQL and will require manual changes\&.
+.sp
+.RE
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysqldump: tab option
.\" tab option: mysqldump
\fB\-\-tab=\fR\fB\fIpath\fR\fR,
@@ -2673,7 +2777,7 @@ If you encounter problems backing up views, please read the section that covers
.SH "COPYRIGHT"
.br
.PP
-Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
+Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
@@ -2681,12 +2785,6 @@ This documentation is distributed in the hope that it will be useful, but WITHOU
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.
.sp
-.SH "NOTES"
-.IP " 1." 4
-Bug#30123
-.RS 4
-\%http://bugs.mysql.com/bug.php?id=30123
-.RE
.SH "SEE ALSO"
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
.SH AUTHOR
diff --git a/mysql-test/extra/binlog_tests/binlog_xa_recover.inc b/mysql-test/extra/binlog_tests/binlog_xa_recover.inc
deleted file mode 100644
index de2703377cc..00000000000
--- a/mysql-test/extra/binlog_tests/binlog_xa_recover.inc
+++ /dev/null
@@ -1,281 +0,0 @@
-#
-# This include file is used by more than one test suite
-# (currently binlog and binlog_encryption).
-# Please check all dependent tests after modifying it
-#
-
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/have_debug_sync.inc
---source include/have_binlog_format_row.inc
-# Valgrind does not work well with test that crashes the server
---source include/not_valgrind.inc
-
-# (We do not need to restore these settings, as we crash the server).
-SET GLOBAL max_binlog_size= 4096;
-SET GLOBAL innodb_flush_log_at_trx_commit= 1;
-RESET MASTER;
-
-CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
-# Insert some data to force a couple binlog rotations (3), so we get some
-# normal binlog checkpoints before starting the test.
-INSERT INTO t1 VALUES (100, REPEAT("x", 4100));
-# Wait for the master-bin.000002 binlog checkpoint to appear.
---let $wait_for_all= 0
---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002"
---let $field= Info
---let $condition= = "master-bin.000002"
---source include/wait_show_condition.inc
-INSERT INTO t1 VALUES (101, REPEAT("x", 4100));
---let $wait_for_all= 0
---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
---let $field= Info
---let $condition= = "master-bin.000003"
---source include/wait_show_condition.inc
-INSERT INTO t1 VALUES (102, REPEAT("x", 4100));
---let $wait_for_all= 0
---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
---let $field= Info
---let $condition= = "master-bin.000004"
---source include/wait_show_condition.inc
-
-# Now start a bunch of transactions that span multiple binlog
-# files. Leave then in the state prepared-but-not-committed in the engine
-# and crash the server. Check that crash recovery is able to recover all
-# of them.
-#
-# We use debug_sync to get all the transactions into the prepared state before
-# we commit any of them. This is because the prepare step flushes the InnoDB
-# redo log - including any commits made before, so recovery would become
-# unnecessary, decreasing the value of this test.
-#
-# We arrange to have con1 with a prepared transaction in master-bin.000004,
-# con2 and con3 with a prepared transaction in master-bin.000005, and a new
-# empty master-bin.000006. So the latest binlog checkpoint should be
-# master-bin.000006.
-
-connect(con1,localhost,root,,);
-# First wait after prepare and before write to binlog.
-SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont";
-# Then complete InnoDB commit in memory (but not commit checkpoint / write to
-# disk), and hang until crash, leaving a transaction to be XA recovered.
-SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever";
-send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con1_wait";
-
-connect(con2,localhost,root,,);
-SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont";
-SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever";
-send INSERT INTO t1 VALUES (2, NULL);
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con2_wait";
-
-connect(con3,localhost,root,,);
-SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont";
-SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever";
-send INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con3_wait";
-
-connect(con4,localhost,root,,);
-SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont";
-SET SESSION debug_dbug="+d,crash_commit_after_log";
-send INSERT INTO t1 VALUES (4, NULL);
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con4_wait";
-
-SET DEBUG_SYNC= "now SIGNAL con1_cont";
-SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
-SET DEBUG_SYNC= "now SIGNAL con2_cont";
-SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
-SET DEBUG_SYNC= "now SIGNAL con3_cont";
-SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
-
-# Check that everything is committed in binary log.
---source include/show_binary_logs.inc
---let $binlog_file= master-bin.000003
---let $binlog_start= 4
---source include/show_binlog_events.inc
---let $binlog_file= master-bin.000004
---source include/show_binlog_events.inc
---let $binlog_file= master-bin.000005
---source include/show_binlog_events.inc
---let $binlog_file= master-bin.000006
---source include/show_binlog_events.inc
-
-
-# Check that server will not purge too much.
-PURGE BINARY LOGS TO "master-bin.000006";
---source include/show_binary_logs.inc
-
-# Now crash the server with one more transaction in prepared state.
---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-wait-binlog_xa_recover.test
-EOF
---error 0,2006,2013
-SET DEBUG_SYNC= "now SIGNAL con4_cont";
-connection con4;
---error 2006,2013
-reap;
-
---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-restart-group_commit_binlog_pos.test
-EOF
-
-connection default;
---enable_reconnect
---source include/wait_until_connected_again.inc
-
-# Check that all transactions are recovered.
-SELECT a FROM t1 ORDER BY a;
-
---echo Test that with multiple binlog checkpoints, recovery starts from the last one.
-SET GLOBAL max_binlog_size= 4096;
-SET GLOBAL innodb_flush_log_at_trx_commit= 1;
-RESET MASTER;
-
-# Rotate to binlog master-bin.000003 while delaying binlog checkpoints.
-# So we get multiple binlog checkpoints in master-bin.000003.
-# Then complete the checkpoints, crash, and check that we only scan
-# the necessary binlog file (ie. that we use the _last_ checkpoint).
-
-connect(con10,localhost,root,,);
-SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont";
-send INSERT INTO t1 VALUES (10, REPEAT("x", 4100));
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
-
-connect(con11,localhost,root,,);
-SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont";
-send INSERT INTO t1 VALUES (11, REPEAT("x", 4100));
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
-
-connect(con12,localhost,root,,);
-SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont";
-send INSERT INTO t1 VALUES (12, REPEAT("x", 4100));
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR con12_ready";
-INSERT INTO t1 VALUES (13, NULL);
-
---source include/show_binary_logs.inc
---let $binlog_file= master-bin.000004
---let $binlog_start= 4
---source include/show_binlog_events.inc
-
-SET DEBUG_SYNC= "now SIGNAL con10_cont";
-connection con10;
-reap;
-connection default;
-
-# We need to sync the test case with the background processing of the
-# commit checkpoint, otherwise we get nondeterministic results.
-SET @old_dbug= @@global.DEBUG_DBUG;
-SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
-
-SET DEBUG_SYNC= "now SIGNAL con12_cont";
-connection con12;
-reap;
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
-SET GLOBAL debug_dbug= @old_dbug;
-
-SET DEBUG_SYNC= "now SIGNAL con11_cont";
-connection con11;
-reap;
-
-connection default;
-# Wait for the last (master-bin.000004) binlog checkpoint to appear.
---let $wait_for_all= 0
---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
---let $field= Info
---let $condition= = "master-bin.000004"
---source include/wait_show_condition.inc
-
---echo Checking that master-bin.000004 is the last binlog checkpoint
---source include/show_binlog_events.inc
-
---echo Now crash the server
-# It is not too easy to test XA recovery, as it runs early during server
-# startup, before any connections can be made.
-# What we do is set a DBUG error insert which will crash if XA recovery
-# starts from any other binlog than master-bin.000004 (check the file
-# binlog_xa_recover-master.opt). Then we will fail here if XA recovery
-# would start from the wrong place.
---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-wait-binlog_xa_recover.test
-EOF
-SET SESSION debug_dbug="+d,crash_commit_after_log";
---error 2006,2013
-INSERT INTO t1 VALUES (14, NULL);
-
---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-restart-group_commit_binlog_pos.test
-EOF
-
-connection default;
---enable_reconnect
---source include/wait_until_connected_again.inc
-
-# Check that all transactions are recovered.
-SELECT a FROM t1 ORDER BY a;
-
-
---echo *** Check that recovery works if we crashed early during rotate, before
---echo *** binlog checkpoint event could be written.
-
-SET GLOBAL max_binlog_size= 4096;
-SET GLOBAL innodb_flush_log_at_trx_commit= 1;
-RESET MASTER;
-
-# We need some initial data to reach binlog master-bin.000004. Otherwise
-# crash recovery fails due to the error insert used for previous test.
-INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
-INSERT INTO t1 VALUES (22, REPEAT("x", 4100));
-# Wait for the master-bin.000003 binlog checkpoint to appear.
---let $wait_for_all= 0
---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
---let $field= Info
---let $condition= = "master-bin.000003"
---source include/wait_show_condition.inc
-INSERT INTO t1 VALUES (23, REPEAT("x", 4100));
-# Wait for the last (master-bin.000004) binlog checkpoint to appear.
---let $wait_for_all= 0
---let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
---let $field= Info
---let $condition= = "master-bin.000004"
---source include/wait_show_condition.inc
-
---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-wait-binlog_xa_recover.test
-EOF
-SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
---error 2006,2013
-INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
-
---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-restart-group_commit_binlog_pos.test
-EOF
-
---enable_reconnect
---source include/wait_until_connected_again.inc
-
-# Check that all transactions are recovered.
-SELECT a FROM t1 ORDER BY a;
-
---source include/show_binary_logs.inc
---let $binlog_file= master-bin.000004
---let $binlog_start= 4
---source include/show_binlog_events.inc
-
-# Cleanup
-connection default;
-DROP TABLE t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
index 0f46b00f683..4c93ad86209 100644
--- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
@@ -49,14 +49,14 @@ connection master;
--echo *** Single statement on transactional table ***
--disable_query_log
---error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
+--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE, 1534
eval INSERT INTO t1 (a, data) VALUES (1,
CONCAT($data, $data, $data, $data, $data));
--enable_query_log
--echo *** Single statement on non-transactional table ***
--disable_query_log
---error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
+--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE, 1534
eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data));
--enable_query_log
diff --git a/mysql-test/extra/rpl_tests/rpl_semi_sync.inc b/mysql-test/extra/rpl_tests/rpl_semi_sync.inc
index 12053c54f4e..85a83167d42 100644
--- a/mysql-test/extra/rpl_tests/rpl_semi_sync.inc
+++ b/mysql-test/extra/rpl_tests/rpl_semi_sync.inc
@@ -10,7 +10,6 @@ source include/have_innodb.inc;
source include/master-slave.inc;
let $engine_type= InnoDB;
-#let $engine_type= MyISAM;
# Suppress warnings that might be generated during the test
connection master;
@@ -94,7 +93,6 @@ enable_query_log;
echo [ status of semi-sync on master should be OFF ];
show status like 'Rpl_semi_sync_master_clients';
show status like 'Rpl_semi_sync_master_status';
---replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx';
# reset master to make sure the following test will start with a clean environment
@@ -201,16 +199,23 @@ connection slave;
source include/stop_slave.inc;
connection master;
+--source include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000;
# The first semi-sync check should be on because after slave stop,
# there are no transactions on the master.
echo [ master status should be ON ];
-show status like 'Rpl_semi_sync_master_status';
+
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= ON;
+source include/wait_for_status_var.inc;
+
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 0;
+source include/wait_for_status_var.inc;
+
show status like 'Rpl_semi_sync_master_no_tx';
---replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx';
-show status like 'Rpl_semi_sync_master_clients';
echo [ semi-sync replication of these transactions will fail ];
insert into t1 values (500);
@@ -225,7 +230,6 @@ source include/wait_for_status_var.inc;
echo [ master status should be OFF ];
show status like 'Rpl_semi_sync_master_status';
show status like 'Rpl_semi_sync_master_no_tx';
---replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx';
# Semi-sync status on master is now OFF, so all these transactions
@@ -246,7 +250,6 @@ insert into t1 values (100);
echo [ master status should be OFF ];
show status like 'Rpl_semi_sync_master_status';
show status like 'Rpl_semi_sync_master_no_tx';
---replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx';
--echo #
@@ -274,9 +277,11 @@ connection master;
# The master semi-sync status should be on again after slave catches up.
echo [ master status should be ON again after slave catches up ];
-show status like 'Rpl_semi_sync_master_status';
+
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= ON;
+source include/wait_for_status_var.inc;
show status like 'Rpl_semi_sync_master_no_tx';
---replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx';
show status like 'Rpl_semi_sync_master_clients';
@@ -332,11 +337,7 @@ replace_result $engine_type ENGINE_TYPE;
eval create table t1 (a int) engine = $engine_type;
drop table t1;
-##show status like 'Rpl_semi_sync_master_status';
-
sync_slave_with_master;
---replace_column 2 #
-show status like 'Rpl_relay%';
echo [ test reset master ];
connection master;
@@ -353,19 +354,7 @@ source include/stop_slave.inc;
reset slave;
# Kill the dump thread on master for previous slave connection and
-# wait for it to exit
-connection master;
-let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
-if ($_tid)
-{
- --replace_result $_tid _tid
- eval kill query $_tid;
-
- # After dump thread exit, Rpl_semi_sync_master_clients will be 0
- let $status_var= Rpl_semi_sync_master_clients;
- let $status_var_value= 0;
- source include/wait_for_status_var.inc;
-}
+--source include/kill_binlog_dump_threads.inc
connection slave;
source include/start_slave.inc;
@@ -404,17 +393,7 @@ connection master;
reset master;
# Kill the dump thread on master for previous slave connection and wait for it to exit
-let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
-if ($_tid)
-{
- --replace_result $_tid _tid
- eval kill query $_tid;
-
- # After dump thread exit, Rpl_semi_sync_master_clients will be 0
- let $status_var= Rpl_semi_sync_master_clients;
- let $status_var_value= 0;
- source include/wait_for_status_var.inc;
-}
+--source include/kill_binlog_dump_threads.inc
# Do not binlog the following statement because it will generate
# different events for ROW and STATEMENT format
@@ -459,21 +438,16 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
connection master;
# Kill the dump thread on master for previous slave connection and wait for it to exit
-let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
-if ($_tid)
-{
- --replace_result $_tid _tid
- eval kill query $_tid;
-
- # After dump thread exit, Rpl_semi_sync_master_clients will be 0
- let $status_var= Rpl_semi_sync_master_clients;
- let $status_var_value= 0;
- source include/wait_for_status_var.inc;
-}
+--source include/kill_binlog_dump_threads.inc
echo [ Semi-sync status on master should be ON ];
-show status like 'Rpl_semi_sync_master_clients';
+let $status_var= Rpl_semi_sync_master_clients;
+let $status_var_value= 0;
+source include/wait_for_status_var.inc;
show status like 'Rpl_semi_sync_master_status';
+let $status_var= Rpl_semi_sync_master_status;
+let $status_var_value= ON;
+source include/wait_for_status_var.inc;
set global rpl_semi_sync_master_enabled= 0;
connection slave;
diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc
index 862afe96f6c..2e924d6ddde 100644
--- a/mysql-test/include/ctype_utf8mb4.inc
+++ b/mysql-test/include/ctype_utf8mb4.inc
@@ -1585,7 +1585,7 @@ drop table t1;
--echo #
--echo # Check strnxfrm() with odd length
--echo #
-set max_sort_length=9;
+set max_sort_length=65;
select @@max_sort_length;
eval create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine $engine;
insert into t1 values ('a'),('b'),('c');
diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm
new file mode 100644
index 00000000000..7331238e1c8
--- /dev/null
+++ b/mysql-test/lib/My/Debugger.pm
@@ -0,0 +1,266 @@
+package My::Debugger;
+
+use strict;
+use warnings;
+use Text::Wrap;
+use Cwd;
+use My::Platform;
+
+# 1. options to support:
+# --xxx[=ARGS]
+# --manual-xxx[=ARGS]
+# --client-xxx[=ARGS]
+# --boot-xxx[=ARGS]
+# TODO --manual-client-xxx[=ARGS]
+# TODO --manual-boot-xxx[=ARGS]
+# TODO --exec-xxx[=ARGS] (for $ENV{MYSQL}, etc)
+#
+# ARGS is a semicolon-separated list of commands for the
+# command file. If the first command starts from '-' it'll
+# be for a command line, not for a command file.
+#
+# 2. terminal to use: xterm
+# TODO MTR_TERM="xterm -title {title} -e {command}"
+#
+# 3. debugger combinations are *not allowed*
+# (thus no --valgrind --gdb)
+#
+# 4. variables for the command line / file templates:
+# {vardir} -> vardir
+# {exe} -> /path/to/binary/to/execute
+# {args} -> command-line arguments, "-quoted
+# {input}
+# {type} -> client, mysqld.1, etc
+# {script} -> vardir/tmp/{debugger}init.$type
+# {log} -> vardir/log/$type.{debugger}
+# {options} -> user options for the debugger.
+#
+# if {options} isn't used, they're auto-placed before {exe}
+# or at the end if no {exe}
+
+my %debuggers = (
+ gdb => {
+ term => 1,
+ options => '-x {script} {exe}',
+ script => 'set args {args} < {input}',
+ },
+ ddd => {
+ options => '--command {script} {exe}',
+ script => 'set args {args} < {input}',
+ },
+ dbx => {
+ term => 1,
+ options => '-c "stop in main; run {exe} {args} < {input}"',
+ },
+ devenv => {
+ options => '/debugexe {exe} {args}',
+ },
+ windbg => {
+ options => '{exe} {args}',
+ },
+ lldb => {
+ term => 1,
+ options => '-s {script} {exe}',
+ script => 'process launch --stop-at-entry -- {args}',
+ },
+ valgrind => {
+ options => '--tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions='.cwd().'/valgrind.supp {exe} {args} --loose-wait-for-pos-timeout=1500',
+ pre => sub {
+ my $debug_libraries_path= "/usr/lib/debug";
+ $ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path;
+ }
+ },
+ strace => {
+ options => '-f -o {log} {exe} {args}',
+ },
+ rr => {
+ options => '_RR_TRACE_DIR={log} rr record {exe} {args}',
+ run => 'env',
+ pre => sub {
+ ::mtr_error('rr requires kernel.perf_event_paranoid <= 1')
+ if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1;
+ }
+ },
+ valgdb => {
+ term => 1,
+ run => 'gdb',
+ options => '-x {script} {exe}',
+ script => <<EEE,
+py
+import subprocess,shlex,time
+valg=subprocess.Popen(shlex.split("""valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions=valgrind.supp --vgdb-error=0 {exe} {args} --loose-wait-for-pos-timeout=1500"""))
+time.sleep(2)
+gdb.execute("target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=" + str(valg.pid))
+EEE
+ pre => sub {
+ my $debug_libraries_path= "/usr/lib/debug";
+ $ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path;
+ }
+ },
+
+ # aliases
+ vsjitdebugger => 'windbg',
+ ktrace => 'strace',
+);
+
+my %opts;
+my %opt_vals;
+my $help = "\n\nOptions for running debuggers\n\n";
+
+for my $k (sort keys %debuggers) {
+ my $v = $debuggers{$k};
+ $v = $debuggers{$k} = $debuggers{$v} if not ref $v; # resolve aliases
+
+ sub register_opt($$) {
+ my ($name, $msg) = @_;
+ $opts{"$name=s"} = \$opt_vals{$name};
+ $help .= wrap(sprintf(" %-23s", $name), ' 'x25, "$msg under $name\n");
+ }
+
+ $v->{script} = '' unless $v->{script};
+ $v->{options} =~ s/(\{exe\}|$)/ {options} $&/ unless $v->{options} =~ /\{options\}/;
+
+ register_opt "$k" => "Start mysqld";
+ register_opt "client-$k" => "Start mysqltest client";
+ register_opt "boot-$k" => "Start bootstrap server";
+ register_opt "manual-$k" => "Before running test(s) let user manually start mysqld";
+}
+
+sub subst($%) {
+ use warnings FATAL => 'uninitialized';
+ my ($templ, %vars) = @_;
+ $templ =~ s/\{(\w+)\}/$vars{$1}/g;
+ $templ;
+}
+
+sub do_args($$$$$) {
+ my ($args, $exe, $input, $type, $opt) = @_;
+ my $k = $opt =~ /^(?:client|boot|manual)-(.*)$/ ? $1 : $opt;
+ my $v = $debuggers{$k};
+
+ # on windows mtr args are quoted (for system), otherwise not (for exec)
+ sub quote($) { $_[0] =~ / / ? "\"$_[0]\"" : $_[0] }
+ sub unquote($) { $_[0] =~ s/^"(.*)"$/$1/; $_[0] }
+ sub quote_from_mtr($) { IS_WINDOWS() ? $_[0] : quote($_[0]) }
+ sub unquote_for_mtr($) { IS_WINDOWS() ? $_[0] : unquote($_[0]) }
+
+ my %vars = (
+ vardir => $::opt_vardir,
+ exe => $$exe,
+ args => join(' ', map { quote_from_mtr $_ } @$$args, '--gdb'),
+ input => $input,
+ script => "$::opt_vardir/tmp/${k}init.$type",
+ log => "$::opt_vardir/log/$type.$k",
+ options => '',
+ );
+ my @params = split /;/, $opt_vals{$opt};
+ $vars{options} = shift @params if @params and $params[0] =~ /^-/;
+
+ my $script = join "\n", @params;
+ if ($v->{script}) {
+ ::mtr_tofile($vars{script}, subst($v->{script}, %vars)."\n".$script);
+ } elsif ($script) {
+ die "$k is not using a script file, nowhere to write the script \n---\n$script\n---\n";
+ }
+
+ my $options = subst($v->{options}, %vars);
+ @$$args = map { unquote_for_mtr $_ } $options =~ /("[^"]+"|\S+)/g;
+ my $run = $v->{run} || $k;
+
+ if ($opt =~ /^manual-/) {
+ print "\nTo start $k for $type, type in another window:\n";
+ print "$run $options\n";
+ $$exe= undef; # Indicate the exe should not be started
+ } elsif ($v->{term}) {
+ unshift @$$args, '-title', $type, '-e', $run;
+ $$exe = 'xterm';
+ } else {
+ $$exe = $run;
+ }
+}
+
+sub options() { %opts }
+sub help() { $help }
+
+sub fix_options(@) {
+ my $re=join '|', keys %opts;
+ $re =~ s/=s//g;
+ map { $_ . (/^--($re)$/ and '=;') } @_;
+}
+
+sub pre_setup() {
+ my $used;
+ for my $k (keys %debuggers) {
+ for my $opt ($k, "manual-$k", "boot-$k", "client-$k") {
+ if ($opt_vals{$opt})
+ {
+ $used = 1;
+ if ($debuggers{$k}->{pre}) {
+ $debuggers{$k}->{pre}->();
+ delete $debuggers{$k}->{pre};
+ }
+ }
+ }
+ }
+
+ if ($used) {
+ $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || '');
+ ::mtr_error("Can't use --extern when using debugger") if $ENV{USE_RUNNING_SERVER};
+
+ $::opt_retry= 1;
+ $::opt_retry_failure= 1;
+ $::opt_testcase_timeout= 7 * 24 * 60; # in minutes
+ $::opt_suite_timeout= 7 * 24 * 60; # in minutes
+ $::opt_shutdown_timeout= 24 * 60 *60; # in seconds
+ $::opt_start_timeout= 24 * 60 * 60; # in seconds
+ }
+}
+
+sub setup_boot_args($$$) {
+ my ($args, $exe, $input) = @_;
+ my $found;
+
+ for my $k (keys %debuggers) {
+ if ($opt_vals{"boot-$k"}) {
+ die "--boot-$k and --$found cannot be used at the same time\n" if $found;
+
+ $found="boot-$k";
+ do_args($args, $exe, $input, 'bootstrap', $found);
+ }
+ }
+}
+
+sub setup_client_args($$) {
+ my ($args, $exe) = @_;
+ my $found;
+ my $embedded = $::opt_embedded_server ? ' with --embedded' : '';
+
+ for my $k (keys %debuggers) {
+ my @opt_names=("client-$k");
+ push @opt_names, $k if $embedded;
+ for my $opt (@opt_names) {
+ if ($opt_vals{$opt}) {
+ die "--$opt and --$found cannot be used at the same time$embedded\n" if $found;
+ $found=$opt;
+ do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', 'client', $found);
+ }
+ }
+ }
+}
+
+sub setup_args($$$) {
+ my ($args, $exe, $type) = @_;
+ my $found;
+
+ for my $k (keys %debuggers) {
+ for my $opt ($k, "manual-$k") {
+ if ($opt_vals{$opt}) {
+ die "--$opt and --$found cannot be used at the same time\n" if $found;
+ $found=$opt;
+ do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', $type, $found);
+ }
+ }
+ }
+}
+
+1;
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index a58fb369a13..98ed77eea0f 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -514,6 +514,10 @@ sub mtr_report_stats ($$$$) {
# if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'} > 0) {
my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};
+ # remove any double ] that would end the cdata
+ $logcontents =~ s/]]/\x{fffd}/g;
+ # replace wide characters that aren't allowed in XML 1.0
+ $logcontents =~ s/[\x00-\x08\x0B\x0C\x0E-\x1F]/\x{fffd}/g;
$xml_report .= qq(>\n\t\t\t<failure message="" type="MTR_RES_FAILED">\n<![CDATA[$logcontents]]>\n\t\t\t</failure>\n\t\t</testcase>\n);
} elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) {
@@ -530,9 +534,9 @@ sub mtr_report_stats ($$$$) {
# save to file
my $xml_file = $::opt_xml_report;
- open XML_FILE, ">", $xml_file or die "Cannot create file $xml_file: $!";
- print XML_FILE $xml_report;
- close XML_FILE;
+ open (my $XML_UFILE, '>:encoding(UTF-8)', $xml_file) or die 'Cannot create file $xml_file: $!';
+ print $XML_UFILE $xml_report;
+ close $XML_UFILE or warn "File close failed!";
}
if (@$extra_warnings)
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 900ef736a45..fd25c28dc06 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -48,9 +48,7 @@ BEGIN {
"Could not find the lib/ directory \n";
exit(1);
}
-}
-BEGIN {
# Check backward compatibility support
# By setting the environment variable MTR_VERSION
# it's possible to use a previous version of
@@ -95,6 +93,7 @@ use My::Tee;
use My::Find;
use My::SysInfo;
use My::CoreDump;
+use My::Debugger;
use mtr_cases;
use mtr_report;
use mtr_match;
@@ -108,6 +107,9 @@ require "mtr_io.pl";
require "mtr_gprof.pl";
require "mtr_misc.pl";
+my $opt_valgrind;
+my $valgrind_reports= 0;
+
$SIG{INT}= sub { mtr_error("Got ^C signal"); };
$SIG{HUP}= sub { mtr_error("Hangup detected on controlling terminal"); };
@@ -259,28 +261,6 @@ our $opt_gcov;
our $opt_gprof;
our %gprof_dirs;
-our $glob_debugger= 0;
-our $opt_gdb;
-my $opt_rr;
-my $opt_rr_dir;
-my @rr_record_args;
-our $opt_client_gdb;
-my $opt_boot_gdb;
-my $opt_boot_rr;
-our $opt_dbx;
-our $opt_client_dbx;
-my $opt_boot_dbx;
-our $opt_ddd;
-our $opt_client_ddd;
-my $opt_boot_ddd;
-our $opt_manual_gdb;
-our $opt_manual_lldb;
-our $opt_manual_dbx;
-our $opt_manual_ddd;
-our $opt_manual_debug;
-our $opt_debugger;
-our $opt_client_debugger;
-
my $config; # The currently running config
my $current_config_name; # The currently running config file template
@@ -306,49 +286,28 @@ our $opt_report_times= 0;
my $opt_sleep;
-my $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes
-my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes
-my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds
-my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds
+our $opt_retry= 1;
+our $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
+our $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes
+our $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes
+our $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds
+our $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds
sub suite_timeout { return $opt_suite_timeout * 60; };
my $opt_wait_all;
my $opt_user_args;
my $opt_repeat= 1;
-my $opt_retry= 1;
-my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2);
my $opt_reorder= 1;
my $opt_force_restart= 0;
our $opt_user = "root";
-our $opt_valgrind= 0;
-my $opt_valgrind_mysqld= 0;
-my $opt_valgrind_mysqltest= 0;
-my @valgrind_args;
-my $opt_strace= 0;
-my $opt_stracer;
-my $opt_client_strace = 0;
-my @strace_args;
-my $opt_valgrind_path;
-my $valgrind_reports= 0;
-my $opt_callgrind;
my %mysqld_logs;
my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions.
my $warn_seconds = 60;
-sub testcase_timeout ($) {
- my ($tinfo)= @_;
- if (exists $tinfo->{'case-timeout'}) {
- # Return test specific timeout if *longer* that the general timeout
- my $test_to= $tinfo->{'case-timeout'};
- $test_to*= 10 if $opt_valgrind;
- return $test_to * 60 if $test_to > $opt_testcase_timeout;
- }
- return $opt_testcase_timeout * 60;
-}
-
+sub testcase_timeout ($) { return $opt_testcase_timeout * 60; }
sub check_timeout ($) { return testcase_timeout($_[0]); }
our $opt_warnings= 1;
@@ -802,6 +761,7 @@ sub run_test_server ($$$) {
# Client disconnected
mtr_verbose("Child closed socket");
$s->remove($sock);
+ $sock->close;
if (--$childs == 0){
return ("Completed", $test_failure, $completed, $extra_warnings);
}
@@ -971,6 +931,7 @@ sub run_test_server ($$$) {
# Test failure due to warnings, force is off
return ("Warnings in log", 1, $completed, $extra_warnings);
}
+ next;
}
elsif ($line =~ /^SPENT/) {
add_total_times($line);
@@ -1164,7 +1125,7 @@ sub run_worker ($) {
}
mark_time_used('restart');
my $valgrind_reports= 0;
- if ($opt_valgrind_mysqld) {
+ if ($opt_valgrind) {
$valgrind_reports= valgrind_exit_reports();
print $server "VALGREP\n" if $valgrind_reports;
}
@@ -1226,8 +1187,6 @@ sub print_global_resfile {
resfile_global("debug", $opt_debug ? 1 : 0);
resfile_global("gcov", $opt_gcov ? 1 : 0);
resfile_global("gprof", $opt_gprof ? 1 : 0);
- resfile_global("valgrind", $opt_valgrind ? 1 : 0);
- resfile_global("callgrind", $opt_callgrind ? 1 : 0);
resfile_global("mem", $opt_mem);
resfile_global("tmpdir", $opt_tmpdir);
resfile_global("vardir", $opt_vardir);
@@ -1317,30 +1276,6 @@ sub command_line_setup {
'debug' => \$opt_debug,
'debug-common' => \$opt_debug_common,
'debug-server' => \$opt_debug_server,
- 'gdb=s' => \$opt_gdb,
- 'rr' => \$opt_rr,
- 'rr-arg=s' => \@rr_record_args,
- 'rr-dir=s' => \$opt_rr_dir,
- 'client-gdb' => \$opt_client_gdb,
- 'manual-gdb' => \$opt_manual_gdb,
- 'manual-lldb' => \$opt_manual_lldb,
- 'boot-gdb' => \$opt_boot_gdb,
- 'boot-rr' => \$opt_boot_rr,
- 'manual-debug' => \$opt_manual_debug,
- 'ddd' => \$opt_ddd,
- 'client-ddd' => \$opt_client_ddd,
- 'manual-ddd' => \$opt_manual_ddd,
- 'boot-ddd' => \$opt_boot_ddd,
- 'dbx' => \$opt_dbx,
- 'client-dbx' => \$opt_client_dbx,
- 'manual-dbx' => \$opt_manual_dbx,
- 'debugger=s' => \$opt_debugger,
- 'boot-dbx' => \$opt_boot_dbx,
- 'client-debugger=s' => \$opt_client_debugger,
- 'strace' => \$opt_strace,
- 'strace-option=s' => \@strace_args,
- 'client-strace' => \$opt_client_strace,
- 'stracer=s' => \$opt_stracer,
'max-save-core=i' => \$opt_max_save_core,
'max-save-datadir=i' => \$opt_max_save_datadir,
'max-test-fail=i' => \$opt_max_test_fail,
@@ -1349,23 +1284,6 @@ sub command_line_setup {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof,
- 'valgrind|valgrind-all' => \$opt_valgrind,
- 'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
- 'valgrind-mysqld' => \$opt_valgrind_mysqld,
- 'valgrind-options=s' => sub {
- my ($opt, $value)= @_;
- # Deprecated option unless it's what we know pushbuild uses
- if ($value eq "--gen-suppressions=all --show-reachable=yes") {
- push(@valgrind_args, $_) for (split(' ', $value));
- return;
- }
- die("--valgrind-options=s is deprecated. Use ",
- "--valgrind-option=s, to be specified several",
- " times if necessary");
- },
- 'valgrind-option=s' => \@valgrind_args,
- 'valgrind-path=s' => \$opt_valgrind_path,
- 'callgrind' => \$opt_callgrind,
'debug-sync-timeout=i' => \$opt_debug_sync_timeout,
# Directories
@@ -1414,12 +1332,13 @@ sub command_line_setup {
# list-options is internal, not listed in help
'list-options' => \$opt_list_options,
'skip-test-list=s' => \@opt_skip_test_list,
- 'xml-report=s' => \$opt_xml_report
+ 'xml-report=s' => \$opt_xml_report,
+
+ My::Debugger::options()
);
# fix options (that take an optional argument and *only* after = sign
- my %fixopt = ( '--gdb' => '--gdb=#' );
- @ARGV = map { $fixopt{$_} or $_ } @ARGV;
+ @ARGV = My::Debugger::fix_options(@ARGV);
GetOptions(%options) or usage("Can't read options");
usage("") if $opt_usage;
list_options(\%options) if $opt_list_options;
@@ -1744,39 +1663,6 @@ sub command_line_setup {
{
mtr_error("Can't use --extern with --embedded-server");
}
-
-
- if ($opt_gdb)
- {
- $opt_client_gdb= $opt_gdb;
- $opt_gdb= undef;
- }
-
- if ($opt_ddd)
- {
- $opt_client_ddd= $opt_ddd;
- $opt_ddd= undef;
- }
-
- if ($opt_dbx) {
- mtr_warning("Silently converting --dbx to --client-dbx in embedded mode");
- $opt_client_dbx= $opt_dbx;
- $opt_dbx= undef;
- }
-
- if ($opt_debugger)
- {
- $opt_client_debugger= $opt_debugger;
- $opt_debugger= undef;
- }
-
- if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_lldb ||
- $opt_manual_ddd || $opt_manual_debug || $opt_debugger || $opt_dbx ||
- $opt_manual_dbx)
- {
- mtr_error("You need to use the client debug options for the",
- "embedded server. Ex: --client-gdb");
- }
}
# --------------------------------------------------------------------------
@@ -1797,42 +1683,6 @@ sub command_line_setup {
}
# --------------------------------------------------------------------------
- # Check debug related options
- # --------------------------------------------------------------------------
- if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || $opt_rr ||
- $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
- $opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
- $opt_debugger || $opt_client_debugger )
- {
- $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || '');
- if ( using_extern() )
- {
- mtr_error("Can't use --extern when using debugger");
- }
- # Indicate that we are using debugger
- $glob_debugger= 1;
- $opt_retry= 1;
- $opt_retry_failure= 1;
- # Set one week timeout (check-testcase timeout will be 1/10th)
- $opt_testcase_timeout= 7 * 24 * 60;
- $opt_suite_timeout= 7 * 24 * 60;
- # One day to shutdown
- $opt_shutdown_timeout= 24 * 60;
- # One day for PID file creation (this is given in seconds not minutes)
- $opt_start_timeout= 24 * 60 * 60;
- if ($opt_rr && open(my $fh, '<', '/proc/sys/kernel/perf_event_paranoid'))
- {
- my $perf_event_paranoid= <$fh>;
- close $fh;
- chomp $perf_event_paranoid;
- if ($perf_event_paranoid == 0)
- {
- mtr_error("rr requires kernel.perf_event_paranoid set to 1");
- }
- }
- }
-
- # --------------------------------------------------------------------------
# Modified behavior with --start options
# --------------------------------------------------------------------------
if ($opt_start or $opt_start_dirty or $opt_start_exit) {
@@ -1893,87 +1743,6 @@ sub command_line_setup {
"for option --testsuite-timeout")
if ($opt_suite_timeout <= 0);
- # --------------------------------------------------------------------------
- # Check valgrind arguments
- # --------------------------------------------------------------------------
- if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args)
- {
- mtr_report("Turning on valgrind for all executables");
- $opt_valgrind= 1;
- $opt_valgrind_mysqld= 1;
- $opt_valgrind_mysqltest= 1;
- }
- elsif ( $opt_valgrind_mysqld )
- {
- mtr_report("Turning on valgrind for mysqld(s) only");
- $opt_valgrind= 1;
- }
- elsif ( $opt_valgrind_mysqltest )
- {
- mtr_report("Turning on valgrind for mysqltest and mysql_client_test only");
- $opt_valgrind= 1;
- }
-
- if ($opt_valgrind)
- {
- # Increase the timeouts when running with valgrind
- $opt_testcase_timeout*= 10;
- $opt_suite_timeout*= 6;
- $opt_start_timeout*= 10;
- $warn_seconds*= 10;
- }
-
- if ( $opt_callgrind )
- {
- mtr_report("Turning on valgrind with callgrind for mysqld(s)");
- $opt_valgrind= 1;
- $opt_valgrind_mysqld= 1;
-
- # Set special valgrind options unless options passed on command line
- push(@valgrind_args, "--trace-children=yes")
- unless @valgrind_args;
- unshift(@valgrind_args, "--tool=callgrind");
- }
-
- # default to --tool=memcheck
- if ($opt_valgrind && ! grep(/^--tool=/i, @valgrind_args))
- {
- # Set valgrind_option unless already defined
- push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes",
- "--num-callers=16"))
- unless @valgrind_args;
- unshift(@valgrind_args, "--tool=memcheck");
- }
-
- if ( $opt_valgrind )
- {
- # Make valgrind run in quiet mode so it only print errors
- push(@valgrind_args, "--quiet" );
-
- push(@valgrind_args, "--suppressions=${glob_mysql_test_dir}/valgrind.supp")
- if -f "$glob_mysql_test_dir/valgrind.supp";
-
- mtr_report("Running valgrind with options \"",
- join(" ", @valgrind_args), "\"");
- }
-
- if (@strace_args || $opt_stracer)
- {
- $opt_strace=1;
- }
-
- # InnoDB does not bother to do individual de-allocations at exit. Instead it
- # relies on a custom allocator to track every allocation, and frees all at
- # once during exit.
- # In XtraDB, an option use-sys-malloc is introduced (and on by default) to
- # disable this (for performance). But this exposes Valgrind to all the
- # missing de-allocations, so we need to disable it to at least get
- # meaningful leak checking for the rest of the server.
- if ($opt_valgrind_mysqld)
- {
- push(@opt_extra_mysqld_opt, "--loose-skip-innodb-use-sys-malloc");
- }
-
if ($opt_debug_common)
{
$opt_debug= 1;
@@ -2188,21 +1957,6 @@ sub executable_setup () {
$exe_patch='patch' if `patch -v`;
- #
- # Check if libtool is available in this distribution/clone
- # we need it when valgrinding or debugging non installed binary
- # Otherwise valgrind will valgrind the libtool wrapper or bash
- # and gdb will not find the real executable to debug
- #
- if ( -x "../libtool")
- {
- $exe_libtool= "../libtool";
- if ($opt_valgrind or $glob_debugger or $opt_strace)
- {
- mtr_report("Using \"$exe_libtool\" when running valgrind, strace or debugger");
- }
- }
-
# Look for the client binaries
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
@@ -2327,9 +2081,6 @@ sub mysql_client_test_arguments(){
my $args;
mtr_init_args(\$args);
- if ( $opt_valgrind_mysqltest ) {
- valgrind_arguments($args, \$exe);
- }
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--testcase");
mtr_add_arg($args, "--vardir=$opt_vardir");
@@ -2375,6 +2126,8 @@ sub environment_setup {
umask(022);
+ $ENV{'USE_RUNNING_SERVER'}= using_extern();
+
my @ld_library_paths;
if ($path_client_libdir)
@@ -2405,30 +2158,12 @@ sub environment_setup {
}
}
- # --------------------------------------------------------------------------
- # Valgrind need to be run with debug libraries otherwise it's almost
- # impossible to add correct supressions, that means if "/usr/lib/debug"
- # is available, it should be added to
- # LD_LIBRARY_PATH
- #
- # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian
- # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035),
- # so don't change LD_LIBRARY_PATH on that platform.
- # --------------------------------------------------------------------------
- my $debug_libraries_path= "/usr/lib/debug";
- my $deb_version;
- if ( $opt_valgrind and -d $debug_libraries_path and
- (! -e '/etc/debian_version' or
- ($deb_version=
- mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
- $deb_version > 3.1 ) )
- {
- push(@ld_library_paths, $debug_libraries_path);
- }
-
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
$ENV{'LD_LIBRARY_PATH'} ?
split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
+
+ My::Debugger::pre_setup();
+
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
$ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
@@ -2463,7 +2198,6 @@ sub environment_setup {
$ENV{'LC_CTYPE'}= "C";
$ENV{'LC_COLLATE'}= "C";
- $ENV{'USE_RUNNING_SERVER'}= using_extern();
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'port'};
$ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
@@ -2614,10 +2348,6 @@ sub environment_setup {
$ENV{'INNOCHECKSUM'}= native_path($exe_innochecksum);
}
- # Create an environment variable to make it possible
- # to detect that valgrind is being used from test cases
- $ENV{'VALGRIND_TEST'}= $opt_valgrind;
-
# Add dir of this perl to aid mysqltest in finding perl
my $perldir= dirname($^X);
my $pathsep= ":";
@@ -3363,6 +3093,7 @@ sub mysql_install_db {
mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
mtr_add_arg($args, "--core-file");
mtr_add_arg($args, "--console");
+ mtr_add_arg($args, "--character-set-server=latin1");
if ( $opt_debug )
{
@@ -3413,25 +3144,7 @@ sub mysql_install_db {
if (! -e $bootstrap_sql_file)
{
- if ($opt_boot_gdb) {
- gdb_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
- $bootstrap_sql_file);
- }
- if ($opt_boot_dbx) {
- dbx_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
- $bootstrap_sql_file);
- }
- if ($opt_boot_ddd) {
- ddd_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
- $bootstrap_sql_file);
- }
- if ($opt_boot_rr) {
- $args= ["record", @rr_record_args, $exe_mysqld_bootstrap, @$args];
- $exe_mysqld_bootstrap= "rr";
- my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr.boot";
- $ENV{'_RR_TRACE_DIR'}= $rr_dir;
- mkpath($rr_dir);
- }
+ My::Debugger::setup_boot_args(\$args, \$exe_mysqld_bootstrap, $bootstrap_sql_file);
my $path_sql= my_find_file($install_basedir,
["mysql", "sql/share", "share/mariadb",
@@ -4184,6 +3897,7 @@ sub run_testcase ($$) {
if (start_servers($tinfo))
{
report_failure_and_restart($tinfo);
+ unlink $path_current_testlog;
return 1;
}
}
@@ -5148,7 +4862,7 @@ sub after_failure ($) {
sub report_failure_and_restart ($) {
my $tinfo= shift;
- if ($opt_valgrind_mysqld && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) &&
+ if ($opt_valgrind && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) &&
$opt_core_on_failure == 0)
{
# In these cases we may want valgrind report from normal termination
@@ -5278,12 +4992,6 @@ sub mysqld_arguments ($$$) {
# Check if "extra_opt" contains --log-bin
my $skip_binlog= not grep /^--(loose-)?log-bin/, @$extra_opts;
- # Indicate to mysqld it will be debugged in debugger
- if ( $glob_debugger )
- {
- mtr_add_arg($args, "--gdb");
- }
-
my $found_skip_core= 0;
foreach my $arg ( @$extra_opts )
{
@@ -5332,7 +5040,6 @@ sub mysqld_start ($$) {
mtr_verbose(My::Options::toStr("mysqld_start", @$extra_opts));
my $exe= find_mysqld($mysqld->value('basedir'));
- my $wait_for_pid_file= 1;
mtr_error("Internal error: mysqld should never be started for embedded")
if $opt_embedded_server;
@@ -5340,15 +5047,6 @@ sub mysqld_start ($$) {
my $args;
mtr_init_args(\$args);
- if ( $opt_valgrind_mysqld and not $opt_gdb and not $opt_manual_gdb )
- {
- valgrind_arguments($args, \$exe);
- }
- if ( $opt_strace)
- {
- strace_arguments($args, \$exe, $mysqld->name());
- }
-
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
# Add any additional options from an in-test restart
@@ -5372,49 +5070,8 @@ sub mysqld_start ($$) {
# options from *.opt and *.combination files.
$ENV{'MYSQLD_LAST_CMD'}= "$exe @$args";
- if ( $opt_gdb || $opt_manual_gdb )
- {
- gdb_arguments(\$args, \$exe, $mysqld->name());
- }
- elsif ( $opt_manual_lldb )
- {
- lldb_arguments(\$args, \$exe, $mysqld->name());
- }
- elsif ( $opt_ddd || $opt_manual_ddd )
- {
- ddd_arguments(\$args, \$exe, $mysqld->name());
- }
- elsif ( $opt_dbx || $opt_manual_dbx ) {
- dbx_arguments(\$args, \$exe, $mysqld->name());
- }
- elsif ( $opt_debugger )
- {
- debugger_arguments(\$args, \$exe, $mysqld->name());
- }
- elsif ( $opt_manual_debug )
- {
- print "\nStart " .$mysqld->name()." in your debugger\n" .
- "dir: $glob_mysql_test_dir\n" .
- "exe: $exe\n" .
- "args: " . join(" ", @$args) . "\n\n" .
- "Waiting ....\n";
-
- # Indicate the exe should not be started
- $exe= undef;
- }
- elsif ( $opt_rr )
- {
- $args= ["record", @rr_record_args, "$exe", @$args];
- $exe= "rr";
- my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr". $mysqld->after('mysqld');
- $ENV{'_RR_TRACE_DIR'}= $rr_dir;
- mkpath($rr_dir);
- }
- else
- {
- # Default to not wait until pid file has been created
- $wait_for_pid_file= 0;
- }
+ My::Debugger::setup_args(\$args, \$exe, $mysqld->name());
+ $ENV{'VALGRIND_TEST'}= $opt_valgrind = int(($exe || '') eq 'valgrind');
# Remove the old pidfile if any
unlink($mysqld->value('pid-file'));
@@ -5463,11 +5120,8 @@ sub mysqld_start ($$) {
mtr_verbose("Started $mysqld->{proc}");
}
- if ( $wait_for_pid_file &&
- !sleep_until_file_created($mysqld->value('pid-file'),
- $opt_start_timeout,
- $mysqld->{'proc'},
- $warn_seconds))
+ if (!sleep_until_file_created($mysqld->value('pid-file'),
+ $opt_start_timeout, $mysqld->{'proc'}, $warn_seconds))
{
my $mname= $mysqld->name();
mtr_error("Failed to start mysqld $mname with command $exe");
@@ -5914,13 +5568,6 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "--sleep=%d", $opt_sleep);
}
- if ( $opt_valgrind )
- {
- # We are running server under valgrind, which causes some replication
- # test to be much slower, notable rpl_mdev6020. Increase timeout.
- mtr_add_arg($args, "--wait-for-pos-timeout=1500");
- }
-
if ( $opt_ssl )
{
# Turn on SSL for _all_ test cases if option --ssl was used
@@ -5953,31 +5600,6 @@ sub start_mysqltest ($) {
# ----------------------------------------------------------------------
$ENV{'MYSQL_TEST'}= mtr_args2str($exe_mysqltest, @$args);
- # ----------------------------------------------------------------------
- # Add arguments that should not go into the MYSQL_TEST env var
- # ----------------------------------------------------------------------
- if ( $opt_valgrind_mysqltest )
- {
- # Prefix the Valgrind options to the argument list.
- # We do this here, since we do not want to Valgrind the nested invocations
- # of mysqltest; that would mess up the stderr output causing test failure.
- my @args_saved = @$args;
- mtr_init_args(\$args);
- valgrind_arguments($args, \$exe);
- mtr_add_arg($args, "%s", $_) for @args_saved;
- }
-
- # ----------------------------------------------------------------------
- # Prefix the strace options to the argument list.
- # ----------------------------------------------------------------------
- if ( $opt_client_strace )
- {
- my @args_saved = @$args;
- mtr_init_args(\$args);
- strace_arguments($args, \$exe, "mysqltest");
- mtr_add_arg($args, "%s", $_) for @args_saved;
- }
-
if ($opt_force > 1)
{
mtr_add_arg($args, "--continue-on-error");
@@ -6013,21 +5635,7 @@ sub start_mysqltest ($) {
}
}
- if ( $opt_client_gdb )
- {
- gdb_arguments(\$args, \$exe, "client");
- }
- elsif ( $opt_client_ddd )
- {
- ddd_arguments(\$args, \$exe, "client");
- }
- if ( $opt_client_dbx ) {
- dbx_arguments(\$args, \$exe, "client");
- }
- elsif ( $opt_client_debugger )
- {
- debugger_arguments(\$args, \$exe, "client");
- }
+ My::Debugger::setup_client_args(\$args, \$exe);
my $proc= My::SafeProcess->new
(
@@ -6043,287 +5651,6 @@ sub start_mysqltest ($) {
}
#
-# Modify the exe and args so that program is run in gdb in xterm
-#
-sub gdb_arguments {
- my $args= shift;
- my $exe= shift;
- my $type= shift;
- my $input= shift;
-
- my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
-
- # Remove the old gdbinit file
- unlink($gdb_init_file);
-
- # Put $args into a single string
- $input = $input ? "< $input" : "";
-
- if ($type eq 'client') {
- mtr_tofile($gdb_init_file, "set args @$$args $input");
- } elsif ($opt_valgrind_mysqld) {
- my $v = $$exe;
- my $vargs = [];
- valgrind_arguments($vargs, \$v);
- mtr_tofile($gdb_init_file, <<EOF);
-shell @My::SafeProcess::safe_process_cmd --parent-pid=`pgrep -x gdb` -- $v --vgdb-error=0 @$vargs @$$args &
-shell sleep 1
-target remote | /usr/lib64/valgrind/../../bin/vgdb
-EOF
- } else {
- mtr_tofile($gdb_init_file,
- join("\n",
- "set args @$$args $input",
- split /;/, $opt_gdb || ""
- ));
- }
-
- if ( $opt_manual_gdb )
- {
- print "\nTo start gdb for $type, type in another window:\n";
- print "gdb -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n";
-
- # Indicate the exe should not be started
- $$exe= undef;
- return;
- }
-
- $$args= [];
- mtr_add_arg($$args, "-title");
- mtr_add_arg($$args, "$type");
- mtr_add_arg($$args, "-e");
-
- if ( $exe_libtool )
- {
- mtr_add_arg($$args, $exe_libtool);
- mtr_add_arg($$args, "--mode=execute");
- }
-
- mtr_add_arg($$args, "gdb");
- mtr_add_arg($$args, "-x");
- mtr_add_arg($$args, "$gdb_init_file");
- mtr_add_arg($$args, "$$exe");
-
- $$exe= "xterm";
-}
-
-#
-# Modify the exe and args so that program is run in lldb
-#
-sub lldb_arguments {
- my $args= shift;
- my $exe= shift;
- my $type= shift;
- my $input= shift;
-
- my $lldb_init_file= "$opt_vardir/tmp/lldbinit.$type";
- unlink($lldb_init_file);
-
- # Put $args into a single string
- my $str= join(" ", @$$args);
- $input = $input ? "< $input" : "";
-
- # write init file for mysqld or client
- mtr_tofile($lldb_init_file, "process launch --stop-at-entry -- $str $input\n");
-
- print "\nTo start lldb for $type, type in another window:\n";
- print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n";
-
- # Indicate the exe should not be started
- $$exe= undef;
- return;
-}
-
-#
-# Modify the exe and args so that program is run in ddd
-#
-sub ddd_arguments {
- my $args= shift;
- my $exe= shift;
- my $type= shift;
- my $input= shift;
-
- my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
-
- # Remove the old gdbinit file
- unlink($gdb_init_file);
-
- # Put $args into a single string
- my $str= join(" ", @$$args);
- $input = $input ? "< $input" : "";
-
- # write init file for mysqld or client
- mtr_tofile($gdb_init_file, "file $$exe\nset args $str $input\n");
-
- if ( $opt_manual_ddd )
- {
- print "\nTo start ddd for $type, type in another window:\n";
- print "ddd -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n";
-
- # Indicate the exe should not be started
- $$exe= undef;
- return;
- }
-
- my $save_exe= $$exe;
- $$args= [];
- if ( $exe_libtool )
- {
- $$exe= $exe_libtool;
- mtr_add_arg($$args, "--mode=execute");
- mtr_add_arg($$args, "ddd");
- }
- else
- {
- $$exe= "ddd";
- }
- mtr_add_arg($$args, "--command=$gdb_init_file");
- mtr_add_arg($$args, "$save_exe");
-}
-
-
-#
-# Modify the exe and args so that program is run in dbx in xterm
-#
-sub dbx_arguments {
- my $args= shift;
- my $exe= shift;
- my $type= shift;
- my $input= shift;
-
- # Put $args into a single string
- my $str= join " ", @$$args;
- my $runline= $input ? "run $str < $input" : "run $str";
-
- if ( $opt_manual_dbx ) {
- print "\nTo start dbx for $type, type in another window:\n";
- print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " .
- "$runline\" $$exe\n";
-
- # Indicate the exe should not be started
- $$exe= undef;
- return;
- }
-
- $$args= [];
- mtr_add_arg($$args, "-title");
- mtr_add_arg($$args, "$type");
- mtr_add_arg($$args, "-e");
-
- if ( $exe_libtool ) {
- mtr_add_arg($$args, $exe_libtool);
- mtr_add_arg($$args, "--mode=execute");
- }
-
- mtr_add_arg($$args, "dbx");
- mtr_add_arg($$args, "-c");
- mtr_add_arg($$args, "stop in main; $runline");
- mtr_add_arg($$args, "$$exe");
-
- $$exe= "xterm";
-}
-
-
-#
-# Modify the exe and args so that program is run in the selected debugger
-#
-sub debugger_arguments {
- my $args= shift;
- my $exe= shift;
- my $debugger= $opt_debugger || $opt_client_debugger;
-
- if ( $debugger =~ /vcexpress|vc|devenv/ )
- {
- # vc[express] /debugexe exe arg1 .. argn
-
- # Add name of the exe and /debugexe before args
- unshift(@$$args, "$$exe");
- unshift(@$$args, "/debugexe");
-
- # Set exe to debuggername
- $$exe= $debugger;
-
- }
- elsif ( $debugger =~ /windbg|vsjitdebugger/ )
- {
- # windbg exe arg1 .. argn
-
- # Add name of the exe before args
- unshift(@$$args, "$$exe");
-
- # Set exe to debuggername
- $$exe= $debugger;
-
- }
- else
- {
- mtr_error("Unknown argument \"$debugger\" passed to --debugger");
- }
-}
-
-#
-# Modify the exe and args so that program is run in valgrind
-#
-sub valgrind_arguments {
- my $args= shift;
- my $exe= shift;
-
- # Ensure the jemalloc works with mysqld
- if ($$exe =~ /mysqld/)
- {
- my %somalloc=(
- 'system jemalloc' => 'libjemalloc*',
- 'bundled jemalloc' => 'NONE'
- );
- my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}};
- mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn;
- }
-
- # Add valgrind options, can be overridden by user
- mtr_add_arg($args, '%s', $_) for (@valgrind_args);
-
- mtr_add_arg($args, $$exe);
-
- $$exe= $opt_valgrind_path || "valgrind";
-
- if ($exe_libtool)
- {
- # Add "libtool --mode-execute" before the test to execute
- # if running in valgrind(to avoid valgrinding bash)
- unshift(@$args, "--mode=execute", $$exe);
- $$exe= $exe_libtool;
- }
-}
-
-#
-# Modify the exe and args so that program is run in strace
-#
-sub strace_arguments {
- my $args= shift;
- my $exe= shift;
- my $mysqld_name= shift;
- my $output= sprintf("%s/log/%s.strace", $path_vardir_trace, $mysqld_name);
-
- mtr_add_arg($args, "-f");
- mtr_add_arg($args, "-o%s", $output);
-
- # Add strace options
- mtr_add_arg($args, '%s', $_) for (@strace_args);
-
- mtr_add_arg($args, $$exe);
-
- $$exe= $opt_stracer || "strace";
-
- if ($exe_libtool)
- {
- # Add "libtool --mode-execute" before the test to execute
- # if running in valgrind(to avoid valgrinding bash)
- unshift(@$args, "--mode=execute", $$exe);
- $$exe= $exe_libtool;
- }
-}
-
-#
# Search server logs for valgrind reports printed at mysqld termination
#
sub valgrind_exit_reports() {
@@ -6404,7 +5731,7 @@ sub usage ($) {
local $"= ','; # for @DEFAULT_SUITES below
- print <<HERE;
+ print <<HERE . My::Debugger::help() . <<HERE;
$0 [ OPTIONS ] [ TESTCASE ]
@@ -6531,32 +5858,11 @@ Options to run test on running server
Options for debugging the product
- boot-dbx Start bootstrap server in dbx
- boot-ddd Start bootstrap server in ddd
- boot-gdb Start bootstrap server in gdb
- client-dbx Start mysqltest client in dbx
- client-ddd Start mysqltest client in ddd
- client-debugger=NAME Start mysqltest in the selected debugger
- client-gdb Start mysqltest client in gdb
- dbx Start the mysqld(s) in dbx
- ddd Start the mysqld(s) in ddd
debug Dump trace output for all servers and client programs
debug-common Same as debug, but sets 'd' debug flags to
"query,info,error,enter,exit"
debug-server Use debug version of server, but without turning on
tracing
- debugger=NAME Start mysqld in the selected debugger
- gdb[=gdb_arguments] Start the mysqld(s) in gdb
- manual-debug Let user manually start mysqld in debugger, before
- running test(s)
- manual-gdb Let user manually start mysqld in gdb, before running
- test(s)
- manual-ddd Let user manually start mysqld in ddd, before running
- test(s)
- manual-dbx Let user manually start mysqld in dbx, before running
- test(s)
- manual-lldb Let user manually start mysqld in lldb, before running
- test(s)
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_core. Set its default with
@@ -6570,38 +5876,7 @@ Options for debugging the product
$opt_max_test_fail, set to 0 for no limit. Set
it's default with MTR_MAX_TEST_FAIL
core-in-failure Generate a core even if run server is run with valgrind
-
-Options for valgrind
-
- valgrind Run the "mysqltest" and "mysqld" executables using
- valgrind with default options
- valgrind-all Synonym for --valgrind
- valgrind-mysqltest Run the "mysqltest" and "mysql_client_test" executable
- with valgrind
- valgrind-mysqld Run the "mysqld" executable with valgrind
- valgrind-options=ARGS Deprecated, use --valgrind-option
- valgrind-option=ARGS Option to give valgrind, replaces default option(s),
- can be specified more then once
- valgrind-path=<EXE> Path to the valgrind executable
- callgrind Instruct valgrind to use callgrind
-
-Options for strace
-
- strace Run the "mysqld" executables using strace. Default
- options are -f -o 'vardir'/log/'mysqld-name'.strace.
- client-strace Trace the "mysqltest".
- strace-option=ARGS Option to give strace, appends to existing options.
- stracer=<EXE> Specify name and path to the trace program to use.
- Default is "strace". Example: $0 --stracer=ktrace.
-
-Options for rr (Record and Replay)
- rr Run the "mysqld" executables using rr. Default run
- option is "rr record mysqld mysqld_options"
- boot-rr Start bootstrap server in rr
- rr-arg=ARG Option to give rr record, can be specified more then once
- rr-dir=DIR The directory where rr recordings are stored. Defaults
- to 'vardir'/rr.0 (rr.boot for bootstrap instance and
- rr.1, ..., rr.N for slave instances).
+HERE
Misc options
user=USER User for connecting to mysqld(default: $opt_user)
diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result
index 3e4bf5f0d43..0c7ca03a2c5 100644
--- a/mysql-test/r/contributors.result
+++ b/mysql-test/r/contributors.result
@@ -1,21 +1,16 @@
SHOW CONTRIBUTORS;
Name Location Comment
-Booking.com https://www.booking.com Founding member, Platinum Sponsor of the MariaDB Foundation
Alibaba Cloud https://www.alibabacloud.com/ Platinum Sponsor of the MariaDB Foundation
Tencent Cloud https://cloud.tencent.com Platinum Sponsor of the MariaDB Foundation
Microsoft https://microsoft.com/ Platinum Sponsor of the MariaDB Foundation
MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the MariaDB Foundation
+ServiceNow https://servicenow.com Platinum Sponsor of the MariaDB Foundation
Visma https://visma.com Gold Sponsor of the MariaDB Foundation
DBS https://dbs.com Gold Sponsor of the MariaDB Foundation
IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation
-Tencent Games http://game.qq.com/ Gold Sponsor of the MariaDB Foundation
-Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation
-Acronis https://www.acronis.com Silver Sponsor of the MariaDB Foundation
-Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation
-Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation
-Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation
-Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation
-Percona https://www.percona.com/ Bronze Sponsor of the MariaDB Foundation
+Automattic https://automattic.com Silver Sponsor of the MariaDB Foundation
+Percona https://www.percona.com/ Sponsor of the MariaDB Foundation
+Galera Cluster https://galeracluster.com Sponsor of the MariaDB Foundation
Google USA Sponsoring encryption, parallel replication and GTID
Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 3e5efbe74dd..edbceba7ee5 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1,7 +1,4 @@
call mtr.add_suppression("table or database name 't-1'");
-drop table if exists t1,t2,t3,t4,t5;
-drop database if exists mysqltest;
-drop view if exists v1;
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
@@ -1290,7 +1287,7 @@ drop table if exists t1,t2,t3;
# Fix modified for MariaDB: we support this syntax
create table t1 (a int) transactional=0;
Warnings:
-Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
+Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=0'
create table t2 (a int) page_checksum=1;
create table t3 (a int) row_format=page;
drop table t1,t2,t3;
@@ -2066,10 +2063,29 @@ alter table t1 add
key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy';
ERROR HY000: Cannot create table `t1`: index information is too long. Decrease number of indexes or use shorter index names or shorter comments.
drop table t1;
-End of 5.5 tests
+#
+# End of 5.5 tests
+#
+#
+# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
+#
create table t1;
ERROR 42000: A table must have at least 1 column
+#
+# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
+#
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
Warnings:
Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release
drop table t1;
+#
+# End of 10.0 tests
+#
+#
+# MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE
+#
+create table t1 (c int(10) unsigned) engine=memory transactional=0;
+ERROR HY000: Table storage engine 'MEMORY' does not support the create option 'TRANSACTIONAL=0'
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 746fcbcf051..da954c1f14b 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -571,7 +571,7 @@ with t as (select a from t1 where b >= 'c')
select * from t2,t where t2.c=t.a;
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 with t as (select `t1`.`a` AS `a` from `t1` where `t1`.`b` >= 'c')select `t2`.`c` AS `c`,`t`.`a` AS `a` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with t as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
select * from v1;
c a
4 4
@@ -588,7 +588,7 @@ with t as (select a, count(*) from t1 where b >= 'c' group by a)
select * from t2,t where t2.c=t.a;
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 with t as (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` where `t1`.`b` >= 'c' group by `t1`.`a`)select `t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`t2` join `t`) where `t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with t as (select `test`.`t1`.`a` AS `a`,count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` >= 'c' group by `test`.`t1`.`a`)select `test`.`t2`.`c` AS `c`,`t`.`a` AS `a`,`t`.`count(*)` AS `count(*)` from (`test`.`t2` join `t`) where `test`.`t2`.`c` = `t`.`a` latin1 latin1_swedish_ci
select * from v2;
c a count(*)
4 4 2
@@ -606,7 +606,7 @@ with t(c) as (select a from t1 where b >= 'c')
select * from t r1 where r1.c=4;
show create view v3;
View Create View character_set_client collation_connection
-v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `t1`.`a` AS `c` from `t1` where `t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c` from `t` `r1` where `r1`.`c` = 4 latin1 latin1_swedish_ci
select * from v3;
c
4
@@ -618,7 +618,7 @@ with t(c) as (select a from t1 where b >= 'c')
select * from t r1, t r2 where r1.c=r2.c and r2.c=4;
show create view v4;
View Create View character_set_client collation_connection
-v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c') `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS with t as (select `test`.`t1`.`a` AS `c` from `test`.`t1` where `test`.`t1`.`b` >= 'c')select `r1`.`c` AS `c`,`r2`.`c` AS `d` from (`t` `r1` join `t` `r2`) where `r1`.`c` = `r2`.`c` and `r2`.`c` = 4 latin1 latin1_swedish_ci
select * from v4;
c d
4 4
@@ -1126,7 +1126,7 @@ NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7) `cte_e2`
+Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
drop table t1;
#
# MDEV-13753: embedded CTE in a VIEW created in prepared statement
@@ -1349,7 +1349,7 @@ r.r_regionkey in
select r_regionkey from t where r_name <> "ASIA");
show create view v;
View Create View character_set_client collation_connection
-v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`nation` `n` join `region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `region`.`r_regionkey` AS `r_regionkey`,`region`.`r_name` AS `r_name` from `region` where `region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci
+v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `n`.`n_nationkey` AS `n_nationkey`,`n`.`n_name` AS `n_name`,`n`.`n_regionkey` AS `n_regionkey`,`r`.`r_regionkey` AS `r_regionkey`,`r`.`r_name` AS `r_name` from (`test`.`nation` `n` join `test`.`region` `r`) where `n`.`n_regionkey` = `r`.`r_regionkey` and `r`.`r_regionkey` in (with t as (select `test`.`region`.`r_regionkey` AS `r_regionkey`,`test`.`region`.`r_name` AS `r_name` from `test`.`region` where `test`.`region`.`r_regionkey` <= 3)select `t`.`r_regionkey` from `t` where `t`.`r_name` <> 'ASIA') latin1 latin1_swedish_ci
select * from v;
n_nationkey n_name n_regionkey r_regionkey r_name
0 ALGERIA 0 0 AFRICA
@@ -1690,4 +1690,77 @@ ERROR 3D000: No database selected
DROP TABLE test.t;
connection default;
disconnect con1;
+#
+# MDEV-22781: create view with CTE without default database
+#
+drop database test;
+create database db1;
+create table db1.t1 (a int);
+insert into db1.t1 values (3),(7),(1);
+create view db1.v1 as with t as (select * from db1.t1) select * from t;
+show create view db1.v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS with t as (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
+select * from db1.v1;
+a
+3
+7
+1
+drop view db1.v1;
+prepare stmt from "
+create view db1.v1 as with t as (select * from db1.t1) select * from t;
+";
+execute stmt;
+deallocate prepare stmt;
+show create view db1.v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS with t as (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`)select `t`.`a` AS `a` from `t` latin1 latin1_swedish_ci
+select * from db1.v1;
+a
+3
+7
+1
+drop view db1.v1;
+drop table db1.t1;
+drop database db1;
+create database test;
+use test;
+#
+# MDEV-24597: CTE with union used multiple times in query
+#
+with cte(a) as
+(select 1 as d union select 2 as d)
+select a from cte as r1
+union
+select a from cte as r2;
+a
+1
+2
+create table t1 (a int, b int) engine=myisam;
+insert into t1 values
+(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44),
+(5,50), (4,40), (3,33), (4,42), (4,43), (5,51);
+with cte(c) as
+(select a from t1 where b < 30 union select a from t1 where b > 40)
+select * from cte as r1, cte as r2 where r1.c = r2.c;
+c c
+1 1
+2 2
+7 7
+4 4
+5 5
+with cte(a,c) as
+(
+select a, count(*) from t1 group by a having count(*) = 1
+union
+select a, count(*) from t1 group by a having count(*) = 3
+)
+select a, c from cte as r1 where a < 3
+union
+select a, c from cte as r2 where a > 4;
+a c
+1 1
+2 1
+7 3
+drop table t1;
# End of 10.2 tests
diff --git a/mysql-test/r/cte_nonrecursive_not_embedded.result b/mysql-test/r/cte_nonrecursive_not_embedded.result
new file mode 100644
index 00000000000..c96a1ec2849
--- /dev/null
+++ b/mysql-test/r/cte_nonrecursive_not_embedded.result
@@ -0,0 +1,48 @@
+#
+# MDEV-20751: query using many CTEs with grant_tables enabled
+#
+connection default;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (3), (7), (1);
+CREATE TABLE t2 (a int) ENGINE=MYISAM;
+INSERT INTO t2 VALUES (2), (8), (4);
+CREATE USER 'u1'@'localhost';
+GRANT USAGE ON db.* TO 'u1'@'localhost';
+GRANT SELECT ON db.t1 TO 'u1'@'localhost';
+FLUSH PRIVILEGES;
+connect u1,'localhost',u1,,;
+connection u1;
+USE db;
+WITH
+cte1 AS
+(SELECT a FROM t1),
+cte2 AS
+(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a),
+cte3 AS
+(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a),
+cte4 AS
+(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a)
+SELECT * FROM cte4 as r;
+a
+3
+7
+1
+WITH
+cte1 AS
+(SELECT a FROM t2),
+cte2 AS
+(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a),
+cte3 AS
+(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a),
+cte4 AS
+(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a)
+SELECT * FROM cte4 as r;
+ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't2'
+disconnect u1;
+connection default;
+DROP USER 'u1'@'localhost';
+DROP DATABASE db;
+USE test;
+# End of 10.2 tests
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index 640493142bd..b6b4ed7fb37 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -818,7 +818,7 @@ where p.id = a.father or p.id = a.mother
select * from ancestors;
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 with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' and `folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' and `test`.`folks`.`dob` = '2000-01-01' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `a`) where `p`.`id` = `a`.`father` or `p`.`id` = `a`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci
select * from v1;
id name dob father mother
100 Me 2000-01-01 20 30
@@ -849,7 +849,7 @@ where p.id = ma.mother
select * from ancestors;
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 with recursive ancestors as (select `folks`.`id` AS `id`,`folks`.`name` AS `name`,`folks`.`dob` AS `dob`,`folks`.`father` AS `father`,`folks`.`mother` AS `mother` from `folks` where `folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS with recursive ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `fa`) where `p`.`id` = `fa`.`father` union select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from (`test`.`folks` `p` join `ancestors` `ma`) where `p`.`id` = `ma`.`mother`)select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` latin1 latin1_swedish_ci
select * from v2;
id name dob father mother
100 Me 2000-01-01 20 30
@@ -1301,7 +1301,7 @@ select ancestors.name, ancestors.dob from ancestors;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24
4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
-6 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12
+6 UNION <derived3> ALL NULL NULL NULL NULL 12
5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
@@ -3964,5 +3964,495 @@ YEAR d1 d2
DROP PROCEDURE p;
DROP TABLE t1,t2,t3,t4;
#
+# MDEV-23619: recursive CTE used only in the second operand of UNION
+#
+create table t1 (
+a bigint(10) not null auto_increment,
+b int(5) not null,
+c bigint(10) default null,
+primary key (a)
+) engine myisam;
+insert into t1 values
+(1,3,12), (2,7,15), (3,1,3), (4,3,1);
+explain with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DERIVED s ALL NULL NULL NULL NULL 4
+3 RECURSIVE UNION t1 ALL NULL NULL NULL NULL 4 Using where
+3 RECURSIVE UNION <derived2> ref key0 key0 8 test.t1.c 2
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+4 UNION <derived2> ALL NULL NULL NULL NULL 4
+with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t;
+b
+0
+3
+7
+1
+3
+analyze format=json with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t;
+ANALYZE
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,4>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "s",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.c is not null"
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "8",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.c"],
+ "r_loops": 4,
+ "rows": 2,
+ "r_rows": 0.5,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
+prepare stmt from "with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t";
+execute stmt;
+b
+0
+3
+7
+1
+3
+execute stmt;
+b
+0
+3
+7
+1
+3
+deallocate prepare stmt;
+#checking hanging cte that uses a recursive cte
+explain with h_cte as
+( with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t)
+select * from t1 as tt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY tt ALL NULL NULL NULL NULL 4
+with h_cte as
+( with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t)
+select * from t1 as tt;
+a b c
+1 3 12
+2 7 15
+3 1 3
+4 3 1
+analyze format=json with h_cte as
+( with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t)
+select * from t1 as tt;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "tt",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+}
+prepare stmt from "with h_cte as
+( with recursive r_cte as
+( select * from t1 as s
+union
+select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t)
+select * from t1 as tt";
+execute stmt;
+a b c
+1 3 12
+2 7 15
+3 1 3
+4 3 1
+execute stmt;
+a b c
+1 3 12
+2 7 15
+3 1 3
+4 3 1
+deallocate prepare stmt;
+drop table t1;
+#
+# MDEV-24019: query with recursive CTE when no default database is set
+#
+drop database test;
+with recursive a as
+(select 1 from dual union select * from a as r)
+select * from a;
+1
+1
+create database db1;
+create table db1.t1 (a int);
+insert into db1.t1 values (3), (7), (1);
+with recursive cte as
+(select * from db1.t1 union select * from (select * from cte) as t)
+select * from cte;
+a
+3
+7
+1
+explain with recursive cte as
+(select * from db1.t1 union select * from (select * from cte) as t)
+select * from cte;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
+2 DERIVED t1 ALL NULL NULL NULL NULL 3
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 3
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+prepare stmt from "with recursive cte as
+(select * from db1.t1 union select * from (select * from cte) as t)
+select * from cte";
+execute stmt;
+a
+3
+7
+1
+execute stmt;
+a
+3
+7
+1
+deallocate prepare stmt;
+drop database db1;
+create database test;
+use test;
+#
+# MDEV-23406: query with mutually recursive CTEs when big_tables=1
+#
+set @save_big_tables=@@big_tables;
+set big_tables=1;
+create table folks(id int, name char(32), dob date, father int, mother int);
+insert into folks values
+(100, 'Me', '2000-01-01', 20, 30),
+(20, 'Dad', '1970-02-02', 10, 9),
+(30, 'Mom', '1975-03-03', 8, 7),
+(10, 'Grandpa Bill', '1940-04-05', null, null),
+(9, 'Grandma Ann', '1941-10-15', null, null),
+(25, 'Uncle Jim', '1968-11-18', 8, 7),
+(98, 'Sister Amy', '2001-06-20', 20, 30),
+(7, 'Grandma Sally', '1943-08-23', null, 6),
+(8, 'Grandpa Ben', '1940-10-21', null, null),
+(6, 'Grandgrandma Martha', '1923-05-17', null, null),
+(67, 'Cousin Eddie', '1992-02-28', 25, 27),
+(27, 'Auntie Melinda', '1971-03-29', null, null);
+with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+select h.*, w.*
+from folks h, folks w, coupled_ancestors a
+where a.father = h.id AND a.mother = w.id
+union
+select h.*, w.*
+from folks v, folks h, folks w
+where v.name = 'Me' and
+(v.father = h.id AND v.mother= w.id)
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+select h_id, h_name, h_dob, h_father, h_mother
+from ancestor_couples
+union
+select w_id, w_name, w_dob, w_father, w_mother
+from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+from ancestor_couples;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+explain with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+select h.*, w.*
+from folks h, folks w, coupled_ancestors a
+where a.father = h.id AND a.mother = w.id
+union
+select h.*, w.*
+from folks v, folks h, folks w
+where v.name = 'Me' and
+(v.father = h.id AND v.mother= w.id)
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+select h_id, h_name, h_dob, h_father, h_mother
+from ancestor_couples
+union
+select w_id, w_name, w_dob, w_father, w_mother
+from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+from ancestor_couples;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 1728
+4 DERIVED <derived3> ALL NULL NULL NULL NULL 1728
+5 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 1728
+NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
+3 DERIVED v ALL NULL NULL NULL NULL 12 Using where
+3 DERIVED h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+3 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
+2 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 2
+2 RECURSIVE UNION h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+2 RECURSIVE UNION w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
+NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL
+prepare stmt from "with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+select h.*, w.*
+from folks h, folks w, coupled_ancestors a
+where a.father = h.id AND a.mother = w.id
+union
+select h.*, w.*
+from folks v, folks h, folks w
+where v.name = 'Me' and
+(v.father = h.id AND v.mother= w.id)
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+select h_id, h_name, h_dob, h_father, h_mother
+from ancestor_couples
+union
+select w_id, w_name, w_dob, w_father, w_mother
+from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+from ancestor_couples";
+execute stmt;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+execute stmt;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+deallocate prepare stmt;
+with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+select h.*, w.*
+from folks h, folks w, coupled_ancestors a
+where a.father = h.id AND a.mother = w.id
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+select *
+from folks
+where name = 'Me'
+ union all
+select h_id, h_name, h_dob, h_father, h_mother
+from ancestor_couples
+union all
+select w_id, w_name, w_dob, w_father, w_mother
+from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+from ancestor_couples;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+explain with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+select h.*, w.*
+from folks h, folks w, coupled_ancestors a
+where a.father = h.id AND a.mother = w.id
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+select *
+from folks
+where name = 'Me'
+ union all
+select h_id, h_name, h_dob, h_father, h_mother
+from ancestor_couples
+union all
+select w_id, w_name, w_dob, w_father, w_mother
+from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+from ancestor_couples;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
+4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2
+5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL
+2 DERIVED h ALL NULL NULL NULL NULL 12
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
+2 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join)
+prepare stmt from "with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+select h.*, w.*
+from folks h, folks w, coupled_ancestors a
+where a.father = h.id AND a.mother = w.id
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+select *
+from folks
+where name = 'Me'
+ union all
+select h_id, h_name, h_dob, h_father, h_mother
+from ancestor_couples
+union all
+select w_id, w_name, w_dob, w_father, w_mother
+from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+from ancestor_couples";
+execute stmt;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+execute stmt;
+h_name h_dob w_name w_dob
+Dad 1970-02-02 Mom 1975-03-03
+Grandpa Bill 1940-04-05 Grandma Ann 1941-10-15
+Grandpa Ben 1940-10-21 Grandma Sally 1943-08-23
+deallocate prepare stmt;
+drop table folks;
+set big_tables=@save_big_tables;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index 491e01b7361..9fa055b9526 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -1492,6 +1492,8 @@ ab
AE
AE
SET max_sort_length=8;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '8'
SELECT * FROM t1 ORDER BY s1;
s1
ab
diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result
index d98c113840b..a43ed6ee538 100644
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@ -1765,6 +1765,8 @@ ab
AE
AE
SET max_sort_length=8;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '8'
SELECT * FROM t1 ORDER BY s1;
s1
ab
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 8f40a90859b..584ca12f8c3 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1306,7 +1306,7 @@ create table t1 (a varchar(334) character set utf32 primary key);
ERROR 42000: Specified key was too long; max key length is 1000 bytes
create table t1 (a varchar(333) character set utf32, key(a));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
insert into t1 values (repeat('a',333)), (repeat('b',333));
flush tables;
check table t1;
@@ -1505,6 +1505,8 @@ ab
AE
AE
SET max_sort_length=8;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '8'
SELECT * FROM t1 ORDER BY s1;
s1
ab
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index d7f13b4053f..7189629b570 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -6755,9 +6755,11 @@ DFFFDFFF9CFF9DFF9EFF
# Checking strnxfrm() with odd length
#
set max_sort_length=9;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '9'
select @@max_sort_length;
@@max_sort_length
-9
+64
create table t1 (a varchar(128) character set utf8 collate utf8_general_ci);
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index 691ac51e241..2762873b9c7 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -1478,7 +1478,7 @@ a varchar(255) NOT NULL default '',
KEY a (a)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
insert into t1 values (_utf8mb4 0xe880bd);
insert into t1 values (_utf8mb4 0x5b);
select hex(a) from t1;
@@ -1526,7 +1526,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t1 VALUES('uu');
check table t1;
@@ -2371,10 +2371,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=9;
+set max_sort_length=65;
select @@max_sort_length;
@@max_sort_length
-9
+65
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci);
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
@@ -2726,7 +2726,7 @@ DEFAULT CHARACTER SET utf8,
MODIFY subject varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
MODIFY p varchar(255) CHARACTER SET utf8;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result
index 4aef2d8cb66..9eb7d48370f 100644
--- a/mysql-test/r/ctype_utf8mb4_heap.result
+++ b/mysql-test/r/ctype_utf8mb4_heap.result
@@ -2203,10 +2203,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=9;
+set max_sort_length=65;
select @@max_sort_length;
@@max_sort_length
-9
+65
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine heap;
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result
index 7c95906a742..e9e54cb86fc 100644
--- a/mysql-test/r/ctype_utf8mb4_innodb.result
+++ b/mysql-test/r/ctype_utf8mb4_innodb.result
@@ -1438,7 +1438,7 @@ a varchar(255) NOT NULL default '',
KEY a (a)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
insert into t1 values (_utf8mb4 0xe880bd);
insert into t1 values (_utf8mb4 0x5b);
select hex(a) from t1;
@@ -1486,7 +1486,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t1 VALUES('uu');
check table t1;
@@ -2331,10 +2331,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=9;
+set max_sort_length=65;
select @@max_sort_length;
@@max_sort_length
-9
+65
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine InnoDB;
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result
index f06a1fc53f3..408b4f9c68b 100644
--- a/mysql-test/r/ctype_utf8mb4_myisam.result
+++ b/mysql-test/r/ctype_utf8mb4_myisam.result
@@ -1438,7 +1438,7 @@ a varchar(255) NOT NULL default '',
KEY a (a)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
insert into t1 values (_utf8mb4 0xe880bd);
insert into t1 values (_utf8mb4 0x5b);
select hex(a) from t1;
@@ -1486,7 +1486,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
INSERT INTO t1 VALUES('uu');
check table t1;
@@ -2331,10 +2331,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=9;
+set max_sort_length=65;
select @@max_sort_length;
@@max_sort_length
-9
+65
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine MyISAM;
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index d4e8feff740..25237aa11a9 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -10593,4 +10593,45 @@ a
abc
DROP VIEW v1;
DROP TABLE t1;
+#
+# MDEV-19179: pushdown into UNION of aggregation selects whose
+# corresponding columns have different names
+#
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+select *
+from (select min(a) as x from t1 union all select max(a) as y from t1) t
+where x>0;
+x
+1
+7
+explain extended select *
+from (select min(a) as x from t1 union all select max(a) as y from t1) t
+where x>0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 100.00 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00
+3 UNION t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select `t`.`x` AS `x` from (select min(`test`.`t1`.`a`) AS `x` from `test`.`t1` having `x` > 0 union all select max(`test`.`t1`.`a`) AS `x` from `test`.`t1` having `x` > 0) `t` where `t`.`x` > 0
+prepare stmt from "select *
+from (select min(a) as x from t1 union all select max(a) as y from t1) t
+where x>0";
+execute stmt;
+x
+1
+7
+execute stmt;
+x
+1
+7
+deallocate prepare stmt;
+create view v1(m) as
+select min(a) as x from t1 union all select max(a) as y from t1;
+select * from v1 where m > 0;
+m
+1
+7
+drop view v1;
+drop table t1;
# End of 10.2 tests
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 992f935b14e..da33e7bbc2c 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1280,5 +1280,17 @@ Name_exp_1
DROP VIEW v1;
DROP TABLE t1;
#
+# MDEV-4677 GROUP_CONCAT not showing any output with group_concat_max_len >= 4Gb
+#
+set group_concat_max_len=1024*1024*1024*4;
+Warnings:
+Warning 1292 Truncated incorrect group_concat_max_len value: '4294967296'
+create table t1 (i int, j int);
+insert into t1 values (1,1),(1,2);
+select i, group_concat(j) from t1 group by i;
+i group_concat(j)
+1 1,2
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 0f9fdefb81a..fb07ba76fb2 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2458,3 +2458,37 @@ select count(*)+sleep(0) from t1;
count(*)+sleep(0)
2
drop table t1;
+#
+# MDEV-25112: MIN/MAX optimization for query containing BETWEEN in WHERE
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (267), (273), (287), (303), (308);
+select max(a) from t1 where a < 303 and (a between 267 AND 287);
+max(a)
+287
+explain select max(a) from t1 where a < 303 and (a between 267 AND 287);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
+select min(a) from t1 where a > 267 and (a between 273 AND 303);
+min(a)
+273
+explain select min(a) from t1 where a > 267 and (a between 273 AND 303);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
+create index idx on t1(a);
+select max(a) from t1 where a < 303 and (a between 267 AND 287);
+max(a)
+287
+explain select max(a) from t1 where a < 303 and (a between 267 AND 287);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+select min(a) from t1 where a > 267 and (a between 273 AND 303);
+min(a)
+273
+explain select min(a) from t1 where a > 267 and (a between 273 AND 303);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 0ba8e41f164..5bcd98ca238 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -289,3 +289,21 @@ a b c d
3 f_ 1 0 1
3 f\_ 0 1 0
drop table t1;
+create table t1 (f int);
+insert t1 values (1),(2);
+select 1 from (select distinct * from t1) as x where f < (select 1 like 2 escape (3=1));
+1
+drop table t1;
+create table t1(f1 int);
+insert into t1 values(1);
+update (select 1 like 2 escape (1 in (select 1 from t1))) x, t1 as d set d.f1 = 1;
+ERROR HY000: Incorrect arguments to ESCAPE
+select * from (select 1 like 2 escape (1 in (select 1 from t1))) x;
+1 like 2 escape (1 in (select 1 from t1))
+0
+drop table t1;
+create table t1 (f int);
+insert t1 values (1),(2);
+create view v1 as select * from t1 where (1 like 2 escape (3 in (('h', 'b') in (select 'k', 'k' union select 'g', 'j'))) and f >= 0);
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result
index 1d6e2193fc9..e52a7c809c6 100644
--- a/mysql-test/r/gis-json.result
+++ b/mysql-test/r/gis-json.result
@@ -62,9 +62,9 @@ SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features":
st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
GEOMETRYCOLLECTION(POINT(102 0.5))
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
-ERROR HY000: Incorrect option value: '5' for function ST_GeometryFromJSON
+ERROR HY000: Incorrect option value: '5' for function ST_GeomFromGeoJSON
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
-ERROR 22023: Invalid GIS data provided to function ST_GeometryFromJSON.
+ERROR 22023: Invalid GIS data provided to function ST_GeomFromGeoJSON.
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2))
POINT(5.3 15)
@@ -104,6 +104,9 @@ a
NULL
Warnings:
Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array.
+SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
+ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }")
+NULL
#
# End of 10.2 tests
#
diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result
index d5e1751d800..aaeb6e852a1 100644
--- a/mysql-test/r/gis-precise.result
+++ b/mysql-test/r/gis-precise.result
@@ -807,3 +807,114 @@ SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))))
POLYGON((9 9,5 2,4 5,9 9))
+#
+# MDEV-13467 Feature request: Support for ST_Distance_Sphere()
+#
+SELECT ST_DISTANCE_SPHERE();
+ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE'
+SELECT ST_DISTANCE_SPHERE(NULL);
+ERROR 42000: Incorrect parameter count in the call to native function 'ST_DISTANCE_SPHERE'
+SELECT ST_DISTANCE_SPHERE(NULL, NULL);
+ST_DISTANCE_SPHERE(NULL, NULL)
+NULL
+SELECT ST_DISTANCE_SPHERE(NULL, NULL, 3);
+ST_DISTANCE_SPHERE(NULL, NULL, 3)
+NULL
+SELECT ST_DISTANCE_SPHERE(NULL, 1, 3);
+ST_DISTANCE_SPHERE(NULL, 1, 3)
+NULL
+SELECT ST_DISTANCE_SPHERE(1, NULL, 3);
+ST_DISTANCE_SPHERE(1, NULL, 3)
+NULL
+SELECT ST_DISTANCE_SPHERE(1, 1);
+ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere.
+SELECT ST_DISTANCE_SPHERE(1, 1, 3);
+ERROR 22023: Invalid GIS data provided to function ST_Distance_Sphere.
+SELECT ST_DISTANCE_SPHERE(1, 1, NULL);
+ST_DISTANCE_SPHERE(1, 1, NULL)
+NULL
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'));
+ERROR HY000: Internal error: st_distance_sphere
+# Test Points and radius
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'))
+157249.0357231545
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10)
+157225.0865419108
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1);
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1)
+0.024682056391766436
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0);
+ERROR HY000: Internal error: Radius must be greater than zero.
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1);
+ERROR HY000: Internal error: Radius must be greater than zero.
+# Test longitude/lattitude
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10)
+157225.0865419108
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10)
+222355.4901806686
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10)
+222389.3645969269
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)'))
+157249.0357231545
+# Test Points - Multipoints
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'))
+157249.0357231545
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'))
+157249.0357231545
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'))
+157249.0357231545
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'))
+157249.0357231545
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1);
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1)
+0.024682056391766436
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1);
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1)
+0.024682056391766436
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1);
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1)
+0.024682056391766436
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1);
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1)
+0.024682056391766436
+# Test Multipoints - Multipoints
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'));
+ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'))
+0
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10)
+314282.5644496733
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10)
+314282.5644496733
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17);
+TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17)
+0.04933028646581131
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0);
+ERROR HY000: Internal error: Radius must be greater than zero.
+set @pt1 = ST_GeomFromText('POINT(190 -30)');
+set @pt2 = ST_GeomFromText('POINT(-30 50)');
+SELECT ST_Distance_Sphere(@pt1, @pt2);
+ERROR HY000: Out of range error: Longitude should be [-180,180] in function ST_Distance_Sphere.
+set @pt1 = ST_GeomFromText('POINT(135 -30)');
+set @pt2 = ST_GeomFromText('POINT(-30 91)');
+SELECT ST_Distance_Sphere(@pt1, @pt2);
+ERROR HY000: Out of range error: Latitude should be [-90,90] in function ST_Distance_Sphere.
+set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)');
+set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');
+SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10);
+TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10)
+55878.5933759170
+SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10);
+TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10)
+55878.5933759170
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index c996627486c..55e7703a377 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2875,3 +2875,47 @@ WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY c
GROUP BY t.table_name;
ERROR HY001: Out of sort memory, consider increasing server sort buffer size
SET max_sort_length= @save_max_sort_length;
+#
+# MDEV-23826: ORDER BY in view definition leads to wrong result with GROUP BY on query using view
+#
+CREATE TABLE t1
+(
+id INT PRIMARY KEY AUTO_INCREMENT,
+dt datetime,
+INDEX(dt),
+foo int
+);
+INSERT INTO t1 VALUES (1,'2020-09-26 12:00:00',1);
+INSERT INTO t1 VALUES (2,'2020-09-26 13:00:00',1);
+INSERT INTO t1 VALUES (3,'2020-09-27 13:00:00',1);
+INSERT INTO t1 VALUES (4,'2020-09-27 12:00:00',1);
+INSERT INTO t1 VALUES (5,'2020-09-28 12:00:00',1);
+INSERT INTO t1 VALUES (6,'2020-09-28 13:00:00',1);
+INSERT INTO t1 VALUES (7,'2020-09-25 12:00:00',1);
+INSERT INTO t1 VALUES (8,'2020-09-25 13:00:00',1);
+INSERT INTO t1 VALUES (9,'2020-09-26 13:00:00',1);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t1 ORDER BY dt;
+SELECT dt, sum(foo) AS foo FROM v1 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt;
+dt foo
+2020-09-25 12:00:00 1
+2020-09-25 13:00:00 1
+2020-09-26 12:00:00 1
+2020-09-26 13:00:00 2
+2020-09-27 12:00:00 1
+2020-09-27 13:00:00 1
+2020-09-28 12:00:00 1
+2020-09-28 13:00:00 1
+SELECT dt, sum(foo) AS foo FROM v2 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt;
+dt foo
+2020-09-25 12:00:00 1
+2020-09-25 13:00:00 1
+2020-09-26 12:00:00 1
+2020-09-26 13:00:00 2
+2020-09-27 12:00:00 1
+2020-09-27 13:00:00 1
+2020-09-28 12:00:00 1
+2020-09-28 13:00:00 1
+DROP TABLE t1;
+DROP VIEW v1,v2;
+# End of 10.2 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 7644ff4e7a2..1594ebf75e0 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -843,6 +843,7 @@ information_schema.columns
where data_type = 'longtext' and table_schema != 'performance_schema';
table_schema table_name column_name
information_schema ALL_PLUGINS PLUGIN_DESCRIPTION
+information_schema CHECK_CONSTRAINTS CHECK_CLAUSE
information_schema COLUMNS COLUMN_DEFAULT
information_schema COLUMNS COLUMN_TYPE
information_schema COLUMNS GENERATION_EXPRESSION
@@ -2193,7 +2194,19 @@ SCHEMA_NAME
SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 666 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
+Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
+#
+# MDEV-24179: AAssertion `m_status == DA_ERROR || m_status == DA_OK ||
+# m_status == DA_OK_BULK' failed in Diagnostics_area::message()
+#
+call mtr.add_suppression("Sort aborted.*");
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
+SELECT * FROM v LIMIT ROWS EXAMINED 9;
+ERROR HY000: Sort aborted:
+DROP VIEW v;
#
# End of 10.2 Test
#
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index c7a5b1a80ca..76e6cd000f9 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -790,3 +790,19 @@ EXPLAIN
}
drop table t1;
SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+#
+# MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t2 (
+pk VARCHAR(50),
+a VARCHAR(20),
+KEY k1(a),
+PRIMARY KEY(pk)
+)ENGINE=INNODB;
+INSERT INTO t2 SELECT a,a FROM t1;
+EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL k1 23 NULL # Using index
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index e41c79a59f9..6b458e0733a 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -6054,4 +6054,87 @@ select f2 from t2,t1 where f2 = 0;
f2
drop table t1, t2;
set join_buffer_size=@save_join_buffer_size;
+#
+# MDEV-21104: BNLH used for multi-join query with embedded outer join
+# and possible 'not exists' optimization
+#
+set join_cache_level=4;
+CREATE TABLE t1 (a int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b int, c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2),(2,4);
+CREATE TABLE t3 (d int, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1),(2);
+CREATE TABLE t4 (e int primary key) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (1),(2);
+ANALYZE TABLE t1,t2,t3,t4;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+test.t3 analyze status OK
+test.t4 analyze status OK
+SELECT * FROM t2 LEFT JOIN t3 ON c = d;
+b c d
+1 2 2
+2 4 NULL
+SELECT * FROM (t2 LEFT JOIN t3 ON c = d ) JOIN t4;
+b c d e
+1 2 2 1
+2 4 NULL 1
+1 2 2 2
+2 4 NULL 2
+EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using index; Using join buffer (incremental, BNLH join)
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
+a b c d e
+1 1 2 2 1
+2 1 2 2 1
+1 2 4 NULL 2
+2 2 4 NULL 2
+EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
+WHERE e IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join)
+1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using where; Using index; Not exists; Using join buffer (incremental, BNLH join)
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
+WHERE e IS NULL;
+a b c d e
+DROP TABLE t1,t2,t3,t4;
+set join_cache_level=@save_join_cache_level;
+#
+# MDEV-24767: forced BNLH used for equi-join supported by compound index
+#
+create table t1 (a int, b int, c int ) engine=myisam ;
+create table t2 (a int, b int, c int, primary key (c,a,b)) engine=myisam ;
+insert into t1 values (3,4,2), (5,6,4);
+insert into t2 values (3,4,2), (5,6,4);
+select t1.a, t1.b, t1.c from t1,t2
+where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
+a b c
+3 4 2
+5 6 4
+explain select t1.a, t1.b, t1.c from t1,t2
+where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.c,test.t1.a,test.t1.b 1 Using index
+set join_cache_level=3;
+select t1.a, t1.b, t1.c from t1,t2
+where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
+a b c
+3 4 2
+5 6 4
+explain select t1.a, t1.b, t1.c from t1,t2
+where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 12:12 test.t1.c,test.t1.a,test.t1.b 2 Using index; Using join buffer (flat, BNLH join)
+drop table t1,t2;
+set join_cache_level=@save_join_cache_level;
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index e3fbb830df5..bda6bddb7de 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -415,3 +415,8 @@ ALTER TABLE t2 DROP c;
UNLOCK TABLES;
DROP VIEW v1;
DROP TABLE t1, t2;
+#
+# KILL QUERY ID USER
+#
+kill query id user 'foo';
+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 ''foo'' at line 1
diff --git a/mysql-test/r/lock_view.result b/mysql-test/r/lock_view.result
index 4d375bace42..364c2cddf60 100644
--- a/mysql-test/r/lock_view.result
+++ b/mysql-test/r/lock_view.result
@@ -229,3 +229,37 @@ drop user definer@localhost;
drop database mysqltest1;
drop database mysqltest2;
drop database mysqltest3;
+#
+# MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery
+#
+create user u1@localhost;
+grant all privileges on test.* to u1@localhost;
+connect con1,localhost,u1;
+use test;
+create table t1 (id int not null);
+create view v1 as select * from (select * from t1) dt;
+lock table v1 read;
+disconnect con1;
+connection default;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v1` (
+ `id` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+/*!50001 DROP TABLE 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=`u1`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `dt`.`id` AS `id` from (select `test`.`t1`.`id` AS `id` from `test`.`t1`) `dt` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+drop view v1;
+drop table t1;
+drop user u1@localhost;
diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result
index 34764466d2a..dbc992ece23 100644
--- a/mysql-test/r/mix2_myisam.result
+++ b/mysql-test/r/mix2_myisam.result
@@ -1989,7 +1989,7 @@ a b
drop table t1;
create table t1 (v varchar(65530), key(v));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
drop table t1;
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 (v varchar(65536));
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index dc99dc06b6d..1a0fb5f0c04 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1695,7 +1695,7 @@ a b
drop table t1;
create table t1 (v varchar(65530), key(v));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
drop table if exists t1;
set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
create table t1 (v varchar(65536));
@@ -1968,7 +1968,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1978,7 +1978,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1988,7 +1988,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2034,7 +2034,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2046,7 +2046,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2076,7 +2076,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -2322,6 +2322,7 @@ Key Start Len Index Type
1 2 30 multip. varchar
2 33 30 multip. char NULL
DROP TABLE t1;
+set statement sql_mode='' for
create table t1 (n int not null, c char(1)) transactional=1;
Warnings:
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index b6fb56a63e0..3961c7e8c27 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -476,8 +476,6 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr;
use test;
-call mtr.add_suppression('Column last_update in table `mysql`.`innodb_table_stats` is INT NOT NULL but should be');
-alter table mysql.innodb_table_stats modify last_update int not null;
create table extralongname_extralongname_extralongname_extralongname_ext (
id int(10) unsigned not null,
created_date date not null,
@@ -713,9 +711,9 @@ user CREATE TABLE `user` (
`is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
`default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
`max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
- `password_last_changed` timestamp NULL DEFAULT NULL,
+ `password_last_changed` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`password_lifetime` smallint(5) unsigned DEFAULT NULL,
- `account_locked` enum('N','Y') COLLATE utf8_bin NOT NULL DEFAULT 'N',
+ `account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
CREATE ROLE `aRole`;
@@ -728,6 +726,132 @@ mysql.session N
root N
mysql.sys N
aRole Y
+DROP ROLE aRole;
+#
+# MDEV-24122: Fix previously MySQL-5.7 data directories that upgraded prior to MDEV-23201
+#
+#
+DROP TABLE IF EXISTS mysql.user;
+FLUSH TABLES mysql.user;
+ALTER TABLE mysql.user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ALTER TABLE mysql.user ADD default_role char(80) binary DEFAULT '' NOT NULL;
+ALTER TABLE mysql.user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;
+FLUSH PRIVILEGES;
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.index_stats OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+SHOW CREATE TABLE mysql.user;
+Table Create Table
+user CREATE TABLE `user` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
+ `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `ssl_cipher` blob NOT NULL,
+ `x509_issuer` blob NOT NULL,
+ `x509_subject` blob NOT NULL,
+ `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
+ `max_user_connections` int(11) NOT NULL DEFAULT 0,
+ `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
+ `authentication_string` text COLLATE utf8_bin NOT NULL,
+ `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
+ `password_last_changed` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `password_lifetime` smallint(5) unsigned DEFAULT NULL,
+ `account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
+CREATE ROLE `aRole`;
+SET DEFAULT ROLE aRole;
+SHOW GRANTS;
+Grants for root@localhost
+GRANT aRole TO 'root'@'localhost' WITH ADMIN OPTION
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON *.* TO 'aRole'
+SET DEFAULT ROLE aRole FOR 'root'@'localhost'
+SET DEFAULT ROLE NONE;
+SHOW GRANTS;
+Grants for root@localhost
+GRANT aRole TO 'root'@'localhost' WITH ADMIN OPTION
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON *.* TO 'aRole'
DROP ROLE `aRole`;
FLUSH PRIVILEGES;
End of 10.2 tests
diff --git a/mysql-test/r/mysqldump-system,win.rdiff b/mysql-test/r/mysqldump-system,win.rdiff
new file mode 100644
index 00000000000..5a80c71ae57
--- /dev/null
+++ b/mysql-test/r/mysqldump-system,win.rdiff
@@ -0,0 +1,120 @@
+diff --git a/mysql-test/r/mysqldump-system.result b/mysql-test/r/mysqldump-system.result
+index 88cf950c621..5f8b579fa67 100644
+--- a/mysql-test/r/mysqldump-system.result
++++ b/mysql-test/r/mysqldump-system.result
+@@ -7,8 +7,6 @@
+ delete from mysql.user where host not in ('localhost');
+ flush privileges;
+ create user USER;
+-install plugin /*M!100401 IF NOT EXISTS */ unix_socket soname 'auth_socket.so';;
+-alter user USER identified via unix_socket;
+ CREATE ROLE role_1;
+ CREATE ROLE role_2 WITH ADMIN role_1;
+ GRANT SHOW DATABASES ON *.* TO role_1;
+@@ -48,9 +46,8 @@
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+-INSTALL PLUGIN unix_socket SONAME 'auth_socket.so';
+ CREATE USER 'root'@'localhost';
+-CREATE USER 'USER'@'%' IDENTIFIED VIA unix_socket;
++CREATE USER 'USER'@'%';
+ SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
+ CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
+ GRANT mariadb_dump_import_role TO CURRENT_USER();
+@@ -68,7 +65,7 @@
+ /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
+ GRANT role_1 TO 'USER'@'%';
+ GRANT role_2 TO 'USER'@'%';
+-GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket;
++GRANT USAGE ON *.* TO 'USER'@'%';
+ /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
+ /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
+ GRANT role_2 TO 'role_1' WITH ADMIN OPTION;
+@@ -168,8 +165,6 @@
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+-/*M!100401 UNINSTALL PLUGIN IF EXIST unix_socket */;
+-INSTALL PLUGIN unix_socket SONAME 'auth_socket.so';
+ DELIMITER |
+ /*M!100101 IF current_user()="'root'@'localhost'" THEN
+ SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''";
+@@ -183,7 +178,7 @@
+ END IF */|
+ DELIMITER ;
+ /*!50701 DROP USER IF EXISTS 'USER'@'%' */;
+-CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%' IDENTIFIED VIA unix_socket;
++CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%';
+ SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
+ CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
+ GRANT mariadb_dump_import_role TO CURRENT_USER();
+@@ -203,7 +198,7 @@
+ /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
+ GRANT role_1 TO 'USER'@'%';
+ GRANT role_2 TO 'USER'@'%';
+-GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket;
++GRANT USAGE ON *.* TO 'USER'@'%';
+ /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
+ /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
+ GRANT role_2 TO 'role_1' WITH ADMIN OPTION;
+@@ -304,9 +299,8 @@
+ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+-INSTALL PLUGIN unix_socket /*M!100401 IF NOT EXISTS */ SONAME 'auth_socket.so';
+ CREATE USER IF NOT EXISTS 'root'@'localhost';
+-CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED VIA unix_socket;
++CREATE USER IF NOT EXISTS 'USER'@'%';
+ SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
+ CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
+ GRANT mariadb_dump_import_role TO CURRENT_USER();
+@@ -324,7 +318,7 @@
+ /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
+ GRANT role_1 TO 'USER'@'%';
+ GRANT role_2 TO 'USER'@'%';
+-GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket;
++GRANT USAGE ON *.* TO 'USER'@'%';
+ /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
+ /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
+ GRANT role_2 TO 'role_1' WITH ADMIN OPTION;
+@@ -413,12 +407,12 @@
+ CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
+ mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
+ Table Checksum
+-mysql.user 205632094
++mysql.user 926820922
+ mysql.roles_mapping 3150178430
+ mysql.time_zone_transition 3895294076
+-mysql.plugin 1520695737
++mysql.plugin 0
+ mysql.servers 2783974349
+-mysql.func 3241572444
++mysql.func 310494789
+ mysql.innodb_table_stats 347867921
+ mysql.table_stats 664320059
+ # Opps....
+@@ -442,12 +436,12 @@
+ CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
+ mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
+ Table Checksum
+-mysql.user 205632094
++mysql.user 926820922
+ mysql.roles_mapping 3150178430
+ mysql.time_zone_transition 3895294076
+-mysql.plugin 1520695737
++mysql.plugin 0
+ mysql.servers 2783974349
+-mysql.func 3241572444
++mysql.func 310494789
+ mysql.innodb_table_stats 347867921
+ mysql.table_stats 664320059
+ DROP FUNCTION IF EXISTS metaphon;
+@@ -461,7 +455,6 @@
+ DROP ROLE role_2;
+ DROP ROLE role_1;
+ drop user USER;
+-uninstall plugin unix_socket;
+ insert into mysql.user select * from backup_users;
+ flush privileges;
+ drop table backup_users;
diff --git a/mysql-test/r/mysqldump-system.result b/mysql-test/r/mysqldump-system.result
new file mode 100644
index 00000000000..74cfc4e9882
--- /dev/null
+++ b/mysql-test/r/mysqldump-system.result
@@ -0,0 +1,467 @@
+#
+# MDEV-23630: mysqldump to logically dump system tables
+#
+#
+create table backup_users like mysql.user;
+insert into backup_users select * from mysql.user where host not in ('localhost');
+delete from mysql.user where host not in ('localhost');
+flush privileges;
+create user USER;
+install plugin /*M!100401 IF NOT EXISTS */ unix_socket soname 'auth_socket.so';;
+alter user USER identified via unix_socket;
+CREATE ROLE role_1;
+CREATE ROLE role_2 WITH ADMIN role_1;
+GRANT SHOW DATABASES ON *.* TO role_1;
+GRANT role_1 TO USER;
+GRANT role_2 TO USER;
+SET DEFAULT ROLE role_2 FOR USER;
+ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
+set @save_innodb_stats_persistent= @@innodb_stats_persistent;
+create table mysql.tz like mysql.time_zone_transition;
+alter table mysql.tz engine=innodb;
+insert into mysql.tz select * from mysql.time_zone_transition;
+set global innodb_stats_persistent=1;
+ANALYZE TABLE mysql.tz PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+mysql.tz analyze status Engine-independent statistics collected
+mysql.tz analyze status OK
+delete from mysql.index_stats where prefix_arity!=1;
+delete from mysql.column_stats where column_name!='Time_zone_id';
+set time_zone="+03:00";
+update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
+update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
+set global innodb_stats_persistent= @save_innodb_stats_persistent;
+alter table mysql.time_zone_name ORDER BY Name;
+CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost');
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+#
+# mysqldump of system tables with --system=all
+#
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+INSTALL PLUGIN unix_socket SONAME 'auth_socket.so';
+CREATE USER 'root'@'localhost';
+CREATE USER 'USER'@'%' IDENTIFIED VIA unix_socket;
+SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
+CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
+GRANT mariadb_dump_import_role TO CURRENT_USER();
+SET ROLE mariadb_dump_import_role;
+/*!80001 CREATE ROLE 'role_1' */;
+/*M!100005 CREATE ROLE 'role_1' WITH ADMIN mariadb_dump_import_role */;
+/*M!100005 GRANT 'role_1' TO 'root'@'localhost' WITH ADMIN OPTION */;
+/*!80001 CREATE ROLE 'role_2' */;
+/*M!100005 CREATE ROLE 'role_2' WITH ADMIN mariadb_dump_import_role */;
+/*M!100005 GRANT 'role_2' TO 'role_1' WITH ADMIN OPTION */;
+GRANT role_1 TO 'root'@'localhost' WITH ADMIN OPTION;
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;
+/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */;
+/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
+GRANT role_1 TO 'USER'@'%';
+GRANT role_2 TO 'USER'@'%';
+GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket;
+/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
+/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
+GRANT role_2 TO 'role_1' WITH ADMIN OPTION;
+GRANT SHOW DATABASES ON *.* TO 'role_1';
+GRANT USAGE ON *.* TO 'role_2';
+GRANT USAGE ON *.* TO 'role_2';
+SET ROLE NONE;
+DROP ROLE mariadb_dump_import_role;
+/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */;
+CREATE FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB';
+CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306);
+
+USE mysql;
+
+LOCK TABLES `column_stats` WRITE;
+/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
+REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,0,NULL,NULL);
+/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `index_stats` WRITE;
+/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
+REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500);
+/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `table_stats` WRITE;
+/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
+REPLACE INTO `table_stats` VALUES ('mysql','tz',393);
+/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `innodb_index_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
+REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
+/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `innodb_table_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
+REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0);
+/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+USE mysql;
+
+LOCK TABLES `time_zone` WRITE;
+/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
+REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N');
+/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_name` WRITE;
+/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
+REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2);
+/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_leap_second` WRITE;
+/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
+REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22);
+/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_transition` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
+REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1);
+/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_transition_type` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
+REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST');
+/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+#
+# mysqldump of system tables with --system=all --replace
+#
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+/*M!100401 UNINSTALL PLUGIN IF EXIST unix_socket */;
+INSTALL PLUGIN unix_socket SONAME 'auth_socket.so';
+DELIMITER |
+/*M!100101 IF current_user()="'root'@'localhost'" THEN
+ SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''";
+END IF */|
+DELIMITER ;
+/*!50701 DROP USER IF EXISTS 'root'@'localhost' */;
+CREATE /*M!100103 OR REPLACE */ USER 'root'@'localhost';
+DELIMITER |
+/*M!100101 IF current_user()="'USER'@'%'" THEN
+ SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'USER'@'%''";
+END IF */|
+DELIMITER ;
+/*!50701 DROP USER IF EXISTS 'USER'@'%' */;
+CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%' IDENTIFIED VIA unix_socket;
+SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
+CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
+GRANT mariadb_dump_import_role TO CURRENT_USER();
+SET ROLE mariadb_dump_import_role;
+/*!80001 DROP ROLE IF EXISTS 'role_1' */;
+/*!80001 CREATE ROLE 'role_1' */;
+/*M!100103 CREATE OR REPLACE ROLE 'role_1' WITH ADMIN mariadb_dump_import_role */;
+/*M!100005 GRANT 'role_1' TO 'root'@'localhost' WITH ADMIN OPTION */;
+/*!80001 DROP ROLE IF EXISTS 'role_2' */;
+/*!80001 CREATE ROLE 'role_2' */;
+/*M!100103 CREATE OR REPLACE ROLE 'role_2' WITH ADMIN mariadb_dump_import_role */;
+/*M!100005 GRANT 'role_2' TO 'role_1' WITH ADMIN OPTION */;
+GRANT role_1 TO 'root'@'localhost' WITH ADMIN OPTION;
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;
+/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */;
+/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
+GRANT role_1 TO 'USER'@'%';
+GRANT role_2 TO 'USER'@'%';
+GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket;
+/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
+/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
+GRANT role_2 TO 'role_1' WITH ADMIN OPTION;
+GRANT SHOW DATABASES ON *.* TO 'role_1';
+GRANT USAGE ON *.* TO 'role_2';
+GRANT USAGE ON *.* TO 'role_2';
+SET ROLE NONE;
+DROP ROLE mariadb_dump_import_role;
+/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */;
+/*!50701 DROP FUNCTION IF EXISTS metaphon */;
+CREATE /*M!100103 OR REPLACE */ FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB';
+CREATE /*M!100103 OR REPLACE */ SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306);
+
+USE mysql;
+
+LOCK TABLES `column_stats` WRITE;
+/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
+REPLACE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,0,NULL,NULL);
+/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `index_stats` WRITE;
+/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
+REPLACE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500);
+/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `table_stats` WRITE;
+/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
+REPLACE INTO `table_stats` VALUES ('mysql','tz',393);
+/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `innodb_index_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
+REPLACE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
+/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `innodb_table_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
+REPLACE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0);
+/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+USE mysql;
+
+LOCK TABLES `time_zone` WRITE;
+/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
+REPLACE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N');
+/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_name` WRITE;
+/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
+REPLACE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2);
+/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_leap_second` WRITE;
+/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
+REPLACE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22);
+/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_transition` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
+REPLACE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1);
+/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_transition_type` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
+REPLACE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST');
+/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+#
+# mysqldump of system tables with --system=all --insert-ignore
+#
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+INSTALL PLUGIN unix_socket /*M!100401 IF NOT EXISTS */ SONAME 'auth_socket.so';
+CREATE USER IF NOT EXISTS 'root'@'localhost';
+CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED VIA unix_socket;
+SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;
+CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;
+GRANT mariadb_dump_import_role TO CURRENT_USER();
+SET ROLE mariadb_dump_import_role;
+/*!80001 CREATE ROLE IF NOT EXISTS 'role_1' */;
+/*M!100005 CREATE ROLE IF NOT EXISTS 'role_1' WITH ADMIN mariadb_dump_import_role */;
+/*M!100005 GRANT 'role_1' TO 'root'@'localhost' WITH ADMIN OPTION */;
+/*!80001 CREATE ROLE IF NOT EXISTS 'role_2' */;
+/*M!100005 CREATE ROLE IF NOT EXISTS 'role_2' WITH ADMIN mariadb_dump_import_role */;
+/*M!100005 GRANT 'role_2' TO 'role_1' WITH ADMIN OPTION */;
+GRANT role_1 TO 'root'@'localhost' WITH ADMIN OPTION;
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION;
+/*M!100005 SET DEFAULT ROLE NONE FOR 'root'@'localhost' */;
+/*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */;
+GRANT role_1 TO 'USER'@'%';
+GRANT role_2 TO 'USER'@'%';
+GRANT USAGE ON *.* TO 'USER'@'%' IDENTIFIED VIA unix_socket;
+/*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */;
+/*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */;
+GRANT role_2 TO 'role_1' WITH ADMIN OPTION;
+GRANT SHOW DATABASES ON *.* TO 'role_1';
+GRANT USAGE ON *.* TO 'role_2';
+GRANT USAGE ON *.* TO 'role_2';
+SET ROLE NONE;
+DROP ROLE mariadb_dump_import_role;
+/*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */;
+CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB';
+CREATE SERVER /*M!100103 IF NOT EXISTS */ s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306);
+
+USE mysql;
+
+LOCK TABLES `column_stats` WRITE;
+/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
+INSERT IGNORE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,0,NULL,NULL);
+/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `index_stats` WRITE;
+/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
+INSERT IGNORE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500);
+/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `table_stats` WRITE;
+/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
+INSERT IGNORE INTO `table_stats` VALUES ('mysql','tz',393);
+/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `innodb_index_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
+INSERT IGNORE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
+/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `innodb_table_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
+INSERT IGNORE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0);
+/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+
+USE mysql;
+
+LOCK TABLES `time_zone` WRITE;
+/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
+INSERT IGNORE INTO `time_zone` VALUES (1,'N'),(2,'N'),(3,'N'),(4,'Y'),(5,'N');
+/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_name` WRITE;
+/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
+INSERT IGNORE INTO `time_zone_name` VALUES ('Europe/Moscow',3),('Japan',5),('leap/Europe/Moscow',4),('MET',1),('Universal',2),('UTC',2);
+/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_leap_second` WRITE;
+/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
+INSERT IGNORE INTO `time_zone_leap_second` VALUES (78796800,1),(94694401,2),(126230402,3),(157766403,4),(189302404,5),(220924805,6),(252460806,7),(283996807,8),(315532808,9),(362793609,10),(394329610,11),(425865611,12),(489024012,13),(567993613,14),(631152014,15),(662688015,16),(709948816,17),(741484817,18),(773020818,19),(820454419,20),(867715220,21),(915148821,22);
+/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_transition` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
+INSERT IGNORE INTO `time_zone_transition` VALUES (1,-1693706400,0),(1,-1680483600,1),(1,-1663455600,2),(1,-1650150000,3),(1,-1632006000,2),(1,-1618700400,3),(1,-938905200,2),(1,-857257200,3),(1,-844556400,2),(1,-828226800,3),(1,-812502000,2),(1,-796777200,3),(1,228877200,2),(1,243997200,3),(1,260326800,2),(1,276051600,3),(1,291776400,2),(1,307501200,3),(1,323830800,2),(1,338950800,3),(1,354675600,2),(1,370400400,3),(1,386125200,2),(1,401850000,3),(1,417574800,2),(1,433299600,3),(1,449024400,2),(1,465354000,3),(1,481078800,2),(1,496803600,3),(1,512528400,2),(1,528253200,3),(1,543978000,2),(1,559702800,3),(1,575427600,2),(1,591152400,3),(1,606877200,2),(1,622602000,3),(1,638326800,2),(1,654656400,3),(1,670381200,2),(1,686106000,3),(1,701830800,2),(1,717555600,3),(1,733280400,2),(1,749005200,3),(1,764730000,2),(1,780454800,3),(1,796179600,2),(1,811904400,3),(1,828234000,2),(1,846378000,3),(1,859683600,2),(1,877827600,3),(1,891133200,2),(1,909277200,3),(1,922582800,2),(1,941331600,3),(1,954032400,2),(1,972781200,3),(1,985482000,2),(1,1004230800,3),(1,1017536400,2),(1,1035680400,3),(1,1048986000,2),(1,1067130000,3),(1,1080435600,2),(1,1099184400,3),(1,1111885200,2),(1,1130634000,3),(1,1143334800,2),(1,1162083600,3),(1,1174784400,2),(1,1193533200,3),(1,1206838800,2),(1,1224982800,3),(1,1238288400,2),(1,1256432400,3),(1,1269738000,2),(1,1288486800,3),(1,1301187600,2),(1,1319936400,3),(1,1332637200,2),(1,1351386000,3),(1,1364691600,2),(1,1382835600,3),(1,1396141200,2),(1,1414285200,3),(1,1427590800,2),(1,1445734800,3),(1,1459040400,2),(1,1477789200,3),(1,1490490000,2),(1,1509238800,3),(1,1521939600,2),(1,1540688400,3),(1,1553994000,2),(1,1572138000,3),(1,1585443600,2),(1,1603587600,3),(1,1616893200,2),(1,1635642000,3),(1,1648342800,2),(1,1667091600,3),(1,1679792400,2),(1,1698541200,3),(1,1711846800,2),(1,1729990800,3),(1,1743296400,2),(1,1761440400,3),(1,1774746000,2),(1,1792890000,3),(1,1806195600,2),(1,1824944400,3),(1,1837645200,2),(1,1856394000,3),(1,1869094800,2),(1,1887843600,3),(1,1901149200,2),(1,1919293200,3),(1,1932598800,2),(1,1950742800,3),(1,1964048400,2),(1,1982797200,3),(1,1995498000,2),(1,2014246800,3),(1,2026947600,2),(1,2045696400,3),(1,2058397200,2),(1,2077146000,3),(1,2090451600,2),(1,2108595600,3),(1,2121901200,2),(1,2140045200,3),(3,-1688265000,2),(3,-1656819048,1),(3,-1641353448,2),(3,-1627965048,3),(3,-1618716648,1),(3,-1596429048,3),(3,-1593829848,5),(3,-1589860800,4),(3,-1542427200,5),(3,-1539493200,6),(3,-1525323600,5),(3,-1522728000,4),(3,-1491188400,7),(3,-1247536800,4),(3,354920400,5),(3,370728000,4),(3,386456400,5),(3,402264000,4),(3,417992400,5),(3,433800000,4),(3,449614800,5),(3,465346800,8),(3,481071600,9),(3,496796400,8),(3,512521200,9),(3,528246000,8),(3,543970800,9),(3,559695600,8),(3,575420400,9),(3,591145200,8),(3,606870000,9),(3,622594800,8),(3,638319600,9),(3,654649200,8),(3,670374000,10),(3,686102400,11),(3,695779200,8),(3,701812800,5),(3,717534000,4),(3,733273200,9),(3,748998000,8),(3,764722800,9),(3,780447600,8),(3,796172400,9),(3,811897200,8),(3,828226800,9),(3,846370800,8),(3,859676400,9),(3,877820400,8),(3,891126000,9),(3,909270000,8),(3,922575600,9),(3,941324400,8),(3,954025200,9),(3,972774000,8),(3,985474800,9),(3,1004223600,8),(3,1017529200,9),(3,1035673200,8),(3,1048978800,9),(3,1067122800,8),(3,1080428400,9),(3,1099177200,8),(3,1111878000,9),(3,1130626800,8),(3,1143327600,9),(3,1162076400,8),(3,1174777200,9),(3,1193526000,8),(3,1206831600,9),(3,1224975600,8),(3,1238281200,9),(3,1256425200,8),(3,1269730800,9),(3,1288479600,8),(3,1301180400,9),(3,1319929200,8),(3,1332630000,9),(3,1351378800,8),(3,1364684400,9),(3,1382828400,8),(3,1396134000,9),(3,1414278000,8),(3,1427583600,9),(3,1445727600,8),(3,1459033200,9),(3,1477782000,8),(3,1490482800,9),(3,1509231600,8),(3,1521932400,9),(3,1540681200,8),(3,1553986800,9),(3,1572130800,8),(3,1585436400,9),(3,1603580400,8),(3,1616886000,9),(3,1635634800,8),(3,1648335600,9),(3,1667084400,8),(3,1679785200,9),(3,1698534000,8),(3,1711839600,9),(3,1729983600,8),(3,1743289200,9),(3,1761433200,8),(3,1774738800,9),(3,1792882800,8),(3,1806188400,9),(3,1824937200,8),(3,1837638000,9),(3,1856386800,8),(3,1869087600,9),(3,1887836400,8),(3,1901142000,9),(3,1919286000,8),(3,1932591600,9),(3,1950735600,8),(3,1964041200,9),(3,1982790000,8),(3,1995490800,9),(3,2014239600,8),(3,2026940400,9),(3,2045689200,8),(3,2058390000,9),(3,2077138800,8),(3,2090444400,9),(3,2108588400,8),(3,2121894000,9),(3,2140038000,8),(4,-1688265000,2),(4,-1656819048,1),(4,-1641353448,2),(4,-1627965048,3),(4,-1618716648,1),(4,-1596429048,3),(4,-1593829848,5),(4,-1589860800,4),(4,-1542427200,5),(4,-1539493200,6),(4,-1525323600,5),(4,-1522728000,4),(4,-1491188400,7),(4,-1247536800,4),(4,354920409,5),(4,370728010,4),(4,386456410,5),(4,402264011,4),(4,417992411,5),(4,433800012,4),(4,449614812,5),(4,465346812,8),(4,481071612,9),(4,496796413,8),(4,512521213,9),(4,528246013,8),(4,543970813,9),(4,559695613,8),(4,575420414,9),(4,591145214,8),(4,606870014,9),(4,622594814,8),(4,638319615,9),(4,654649215,8),(4,670374016,10),(4,686102416,11),(4,695779216,8),(4,701812816,5),(4,717534017,4),(4,733273217,9),(4,748998018,8),(4,764722818,9),(4,780447619,8),(4,796172419,9),(4,811897219,8),(4,828226820,9),(4,846370820,8),(4,859676420,9),(4,877820421,8),(4,891126021,9),(4,909270021,8),(4,922575622,9),(4,941324422,8),(4,954025222,9),(4,972774022,8),(4,985474822,9),(4,1004223622,8),(4,1017529222,9),(4,1035673222,8),(4,1048978822,9),(4,1067122822,8),(4,1080428422,9),(4,1099177222,8),(4,1111878022,9),(4,1130626822,8),(4,1143327622,9),(4,1162076422,8),(4,1174777222,9),(4,1193526022,8),(4,1206831622,9),(4,1224975622,8),(4,1238281222,9),(4,1256425222,8),(4,1269730822,9),(4,1288479622,8),(4,1301180422,9),(4,1319929222,8),(4,1332630022,9),(4,1351378822,8),(4,1364684422,9),(4,1382828422,8),(4,1396134022,9),(4,1414278022,8),(4,1427583622,9),(4,1445727622,8),(4,1459033222,9),(4,1477782022,8),(4,1490482822,9),(4,1509231622,8),(4,1521932422,9),(4,1540681222,8),(4,1553986822,9),(4,1572130822,8),(4,1585436422,9),(4,1603580422,8),(4,1616886022,9),(4,1635634822,8),(4,1648335622,9),(4,1667084422,8),(4,1679785222,9),(4,1698534022,8),(4,1711839622,9),(4,1729983622,8),(4,1743289222,9),(4,1761433222,8),(4,1774738822,9),(4,1792882822,8),(4,1806188422,9),(4,1824937222,8),(4,1837638022,9),(4,1856386822,8),(4,1869087622,9),(4,1887836422,8),(4,1901142022,9),(4,1919286022,8),(4,1932591622,9),(4,1950735622,8),(4,1964041222,9),(4,1982790022,8),(4,1995490822,9),(4,2014239622,8),(4,2026940422,9),(4,2045689222,8),(4,2058390022,9),(4,2077138822,8),(4,2090444422,9),(4,2108588422,8),(4,2121894022,9),(4,2140038022,8),(5,-1009875600,1);
+/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `time_zone_transition_type` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
+INSERT IGNORE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'),(1,1,3600,0,'MET'),(1,2,7200,1,'MEST'),(1,3,3600,0,'MET'),(2,0,0,0,'UTC'),(3,0,9000,0,'MMT'),(3,1,12648,1,'MST'),(3,2,9048,0,'MMT'),(3,3,16248,1,'MDST'),(3,4,10800,0,'MSK'),(3,5,14400,1,'MSD'),(3,6,18000,1,'MSD'),(3,7,7200,0,'EET'),(3,8,10800,0,'MSK'),(3,9,14400,1,'MSD'),(3,10,10800,1,'EEST'),(3,11,7200,0,'EET'),(4,0,9000,0,'MMT'),(4,1,12648,1,'MST'),(4,2,9048,0,'MMT'),(4,3,16248,1,'MDST'),(4,4,10800,0,'MSK'),(4,5,14400,1,'MSD'),(4,6,18000,1,'MSD'),(4,7,7200,0,'EET'),(4,8,10800,0,'MSK'),(4,9,14400,1,'MSD'),(4,10,10800,1,'EEST'),(4,11,7200,0,'EET'),(5,0,32400,0,'CJT'),(5,1,32400,0,'JST');
+/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
+mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
+Table Checksum
+mysql.user 205632094
+mysql.roles_mapping 3150178430
+mysql.time_zone_transition 3895294076
+mysql.plugin 1520695737
+mysql.servers 2783974349
+mysql.func 3241572444
+mysql.innodb_table_stats 347867921
+mysql.table_stats 664320059
+# Opps....
+CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback';
+GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION;
+GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION;
+GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION;
+drop user USER;
+delete from mysql.table_stats;
+delete from mysql.innodb_table_stats;
+delete from mysql.time_zone_transition;
+delete from mysql.time_zone_transition_type;
+delete from mysql.time_zone;
+delete from mysql.time_zone_name;
+delete from mysql.time_zone_leap_second;
+DROP FUNCTION IF EXISTS metaphon;
+DROP SERVER s1;
+set time_zone= @@global.time_zone;
+# Restore from mysqldump
+DROP USER mariadb_test_restore;
+CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
+mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
+Table Checksum
+mysql.user 205632094
+mysql.roles_mapping 3150178430
+mysql.time_zone_transition 3895294076
+mysql.plugin 1520695737
+mysql.servers 2783974349
+mysql.func 3241572444
+mysql.innodb_table_stats 347867921
+mysql.table_stats 664320059
+DROP FUNCTION IF EXISTS metaphon;
+DROP SERVER s1;
+DELETE FROM mysql.column_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
+DELETE FROM mysql.index_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
+DELETE FROM mysql.table_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
+DELETE FROM mysql.innodb_index_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
+DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
+drop table mysql.tz;
+DROP ROLE role_2;
+DROP ROLE role_1;
+drop user USER;
+uninstall plugin unix_socket;
+insert into mysql.user select * from backup_users;
+flush privileges;
+drop table backup_users;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index e527dbffe43..da80ff09db9 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -5410,8 +5410,9 @@ proc
one
DROP DATABASE bug25717383;
Usage: mysqldump [OPTIONS] database [tables]
-OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
-OR mysqldump [OPTIONS] --all-databases [OPTIONS]
+OR mysqldump [OPTIONS] --databases DB1 [DB2 DB3...]
+OR mysqldump [OPTIONS] --all-databases
+OR mysqldump [OPTIONS] --system=[SYSTEMOPTIONS]]
For more options, use mysqldump --help
#
# MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
@@ -5713,4 +5714,271 @@ DELIMITER ;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
+#
+# MDEV-20939: Race condition between mysqldump import and InnoDB
+# persistent statistics calculation
+#
+#
+# Without --replace and --insert-ignore
+#
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `innodb_index_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_index_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `stat_value` bigint(20) unsigned NOT NULL,
+ `sample_size` bigint(20) unsigned DEFAULT NULL,
+ `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+DROP TABLE IF EXISTS `innodb_table_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_table_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `n_rows` bigint(20) unsigned NOT NULL,
+ `clustered_index_size` bigint(20) unsigned NOT NULL,
+ `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+#
+# With --replace
+#
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `innodb_index_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_index_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `stat_value` bigint(20) unsigned NOT NULL,
+ `sample_size` bigint(20) unsigned DEFAULT NULL,
+ `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `innodb_index_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
+/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `innodb_table_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_table_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `n_rows` bigint(20) unsigned NOT NULL,
+ `clustered_index_size` bigint(20) unsigned NOT NULL,
+ `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `innodb_table_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
+/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+#
+# With --insert-ignore
+#
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `innodb_index_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_index_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `stat_value` bigint(20) unsigned NOT NULL,
+ `sample_size` bigint(20) unsigned DEFAULT NULL,
+ `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `innodb_index_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
+/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `innodb_table_stats`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `innodb_table_stats` (
+ `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
+ `table_name` varchar(199) COLLATE utf8_bin NOT NULL,
+ `last_update` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `n_rows` bigint(20) unsigned NOT NULL,
+ `clustered_index_size` bigint(20) unsigned NOT NULL,
+ `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`database_name`,`table_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `innodb_table_stats` WRITE;
+/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
+/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `general_log` (
+ `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `command_type` varchar(64) NOT NULL,
+ `argument` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE IF NOT EXISTS `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
# End of 10.2 tests
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 7bc8f562f1b..b1441013bc8 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -763,18 +763,20 @@ col2 col col
2 2 2
1 3 3
drop table t1, t2;
-create table t1 (a char(25));
+create table t1 (a char(70));
insert into t1 set a = repeat('x', 20);
-insert into t1 set a = concat(repeat('x', 19), 'z');
-insert into t1 set a = concat(repeat('x', 19), 'ab');
-insert into t1 set a = concat(repeat('x', 19), 'aa');
+insert into t1 set a = concat(repeat('x', 63), 'z');
+insert into t1 set a = concat(repeat('x', 63), 'ab');
+insert into t1 set a = concat(repeat('x', 63), 'aa');
set max_sort_length=20;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '20'
select a from t1 order by a;
a
-xxxxxxxxxxxxxxxxxxxab
-xxxxxxxxxxxxxxxxxxxaa
xxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxz
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaa
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz
drop table t1;
create table t1 (
`sid` decimal(8,0) default null,
@@ -3241,6 +3243,8 @@ drop table t1;
SET @save_sort_buffer_size= @@sort_buffer_size;
SET @save_max_sort_length= @@max_sort_length;
SET max_sort_length=8;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '8'
SET sort_buffer_size=1024;
CREATE TABLE t1(a INT, b DECIMAL(65), c BLOB);
INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_25;
@@ -3308,6 +3312,8 @@ SET @save_max_sort_length= @@max_sort_length;
SET @save_sort_buffer_size= @@sort_buffer_size;
SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
SET max_sort_length=8;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '8'
SET sort_buffer_size=1024;
SET max_length_for_sort_data=7000;
CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
@@ -3443,6 +3449,8 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
SET max_length_for_sort_data= 30;
SET sql_select_limit = 3;
SET max_sort_length=8;
+Warnings:
+Warning 1292 Truncated incorrect max_sort_length value: '8'
SELECT * FROM t1 ORDER BY a+1;
a b
1 1
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 6770b64552f..a4405882189 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -853,7 +853,7 @@ PARTITION p0 VALUES IN (1,3,9,null),
PARTITION p1 VALUES IN (2,4,0)
);
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
INSERT INTO t2 VALUES
('k','s',3,'b','j'),('a','b',NULL,'v','j'),('c','m',9,'t',NULL),
('b','l',9,'b',NULL),('i','y',3,'o','w'),('c','m',NULL,'a','m'),
diff --git a/mysql-test/r/precedence.result b/mysql-test/r/precedence.result
index 986af631346..65c32ba2b04 100644
--- a/mysql-test/r/precedence.result
+++ b/mysql-test/r/precedence.result
@@ -8017,4 +8017,8 @@ create or replace view v1 as select 1 IS TRUE IS FALSE, 2 IS FALSE IS UNKNOWN, 3
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
view_definition
select 1 is true is false AS `1 IS TRUE IS FALSE`,/*always not null*/ 1 is null AS `2 IS FALSE IS UNKNOWN`,/*always not null*/ 1 is null AS `3 IS UNKNOWN IS NULL`,/*always not null*/ 1 is null is true AS `4 IS NULL IS TRUE`
+create or replace view v1 as select 2 IS TRUE = 3, 2 IS FALSE = 3, 2 IS UNKNOWN = 3, 2 IS NULL = 3, ISNULL(2) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 is true = 3 AS `2 IS TRUE = 3`,2 is false = 3 AS `2 IS FALSE = 3`,/*always not null*/ 1 is null = 3 AS `2 IS UNKNOWN = 3`,/*always not null*/ 1 is null = 3 AS `2 IS NULL = 3`,/*always not null*/ 1 is null = 1 AS `ISNULL(2) = 1`
drop view v1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 8d4b52e1b2e..17284a3cad8 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -5390,5 +5390,34 @@ ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
Database
#
+# MDEV-24779: main.subselect fails in buildbot with --ps-protocol
+#
+CREATE TABLE t1(a INT);
+PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))";
+EXECUTE stmt;
+EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))
+0
+EXECUTE stmt;
+EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))
+0
+DROP TABLE t1;
+#
+# MDEV-25006: Failed assertion on executing EXPLAIN DELETE statement as a prepared statement
+#
+CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY);
+PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE a system NULL NULL NULL NULL 0 const row not found
+1 SIMPLE b system NULL NULL NULL NULL 0 const row not found
+DROP TABLE t1;
+CREATE TABLE t1(a INT);
+PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/ps_show_log.result b/mysql-test/r/ps_show_log.result
new file mode 100644
index 00000000000..54eabaeded6
--- /dev/null
+++ b/mysql-test/r/ps_show_log.result
@@ -0,0 +1,65 @@
+#
+# MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared
+# statement protocol yet
+#
+CREATE USER u1;
+include/master-slave.inc
+[connection master]
+connection master;
+CREATE TABLE t1(n INT);
+DROP TABLE t1;
+connection slave;
+PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
+EXECUTE stmt_1;
+Log_name Pos Event_type Server_id End_log_pos Info
+# # Format_desc # # #
+# # Gtid_list # # []
+# # Binlog_checkpoint # # #
+# # Gtid # # GTID 0-1-1
+# # Query # # use `test`; CREATE TABLE t1(n INT)
+# # Gtid # # GTID 0-1-2
+# # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+# Execute the same prepared statement the second time to check that
+# no internal structures used for handling the statement
+# 'SHOW BINLOG EVENTS' were damaged.
+EXECUTE stmt_1;
+Log_name Pos Event_type Server_id End_log_pos Info
+# # Format_desc # # #
+# # Gtid_list # # []
+# # Binlog_checkpoint # # #
+# # Gtid # # GTID 0-1-1
+# # Query # # use `test`; CREATE TABLE t1(n INT)
+# # Gtid # # GTID 0-1-2
+# # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+DEALLOCATE PREPARE stmt_1;
+connection slave;
+PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
+EXECUTE stmt_1;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000001 # Format_desc # # #
+slave-relay-bin.000001 # Rotate # # #
+# Execute the same prepared statement the second time to check that
+# no internal structures used for handling the statement
+# 'SHOW RELAYLOG EVENTS' were damaged.
+EXECUTE stmt_1;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-relay-bin.000001 # Format_desc # # #
+slave-relay-bin.000001 # Rotate # # #
+DEALLOCATE PREPARE stmt_1;
+# Create the user u1 without the REPLICATION SLAVE privilege required
+# for running the statements SHOW BINLOG EVENTS/SHOW RELAYLOG EVENTS
+# and check that attempt to execute the statements SHOW BINLOG EVENTS/
+# SHOW RELAYLOG EVENTS as a prepred statements by a user without required
+# privileges results in error.
+connect con2,localhost,u1,,test;
+PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
+EXECUTE stmt_1;
+ERROR 42000: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation
+PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
+EXECUTE stmt_1;
+ERROR 42000: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation
+DEALLOCATE PREPARE stmt_1;
+include/rpl_end.inc
+connection default;
+DROP USER u1;
+# End of 10.2 tests
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index d872735e507..11d9cead143 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -814,33 +814,33 @@ select @@character_set_results;
NULL
set character_set_results=default;
set GLOBAL query_cache_size=1355776;
-create table t1 (id int auto_increment primary key, c char(25));
+create table t1 (id int auto_increment primary key, c char(65));
insert into t1 set c = repeat('x',24);
-insert into t1 set c = concat(repeat('x',24),'x');
-insert into t1 set c = concat(repeat('x',24),'w');
-insert into t1 set c = concat(repeat('x',24),'y');
+insert into t1 set c = concat(repeat('x',64),'x');
+insert into t1 set c = concat(repeat('x',64),'w');
+insert into t1 set c = concat(repeat('x',64),'y');
set max_sort_length=200;
select c from t1 order by c, id;
c
xxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxw
-xxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy
reset query cache;
-set max_sort_length=20;
+set max_sort_length=64;
select c from t1 order by c, id;
c
xxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxw
-xxxxxxxxxxxxxxxxxxxxxxxxy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy
set max_sort_length=200;
select c from t1 order by c, id;
c
xxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxw
-xxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy
set max_sort_length=default;
select '1' || '3' from t1;
'1' || '3'
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 9ea0dc12a0b..6a3850c0ed9 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -3158,6 +3158,48 @@ pk a b
1 5 50
65 5 50
drop table t1;
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (
+pk int primary key,
+key1 int,
+col1 varchar(255),
+key (key1, pk)
+);
+insert into t2 (pk, key1)
+select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C;
+# This must use ALL, not range:
+explain select * from t2 force index (primary) where pk not in (1,2,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where
+drop table t1,t2;
+#
+# MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN
+#
+CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a));
+INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20);
+CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code));
+INSERT INTO t2 VALUES ('100',1),('111',2);
+SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3;
+id a b code num
+DROP TABLE t1, t2;
+#
+# MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value
+#
+create table t1 (pk int, i int, v int, primary key (pk), key(v));
+insert into t1 (pk,i,v) values (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,5,10),(6,6,12),(7,7,14),(8,8,16);
+create table t2 (a int, b int);
+insert into t2 values (1,2),(2,4);
+EXPLAIN
+select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3)
+select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
+pk i v a b
+1 1 2 1 2
+2 2 4 2 4
+drop table t1, t2;
#
# End of 10.2 tests
#
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index 55613261ce9..24f42f34ce5 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -3170,6 +3170,48 @@ pk a b
70 4 40
71 2 20
drop table t1;
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (
+pk int primary key,
+key1 int,
+col1 varchar(255),
+key (key1, pk)
+);
+insert into t2 (pk, key1)
+select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C;
+# This must use ALL, not range:
+explain select * from t2 force index (primary) where pk not in (1,2,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where
+drop table t1,t2;
+#
+# MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN
+#
+CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a));
+INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20);
+CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code));
+INSERT INTO t2 VALUES ('100',1),('111',2);
+SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3;
+id a b code num
+DROP TABLE t1, t2;
+#
+# MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value
+#
+create table t1 (pk int, i int, v int, primary key (pk), key(v));
+insert into t1 (pk,i,v) values (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,5,10),(6,6,12),(7,7,14),(8,8,16);
+create table t2 (a int, b int);
+insert into t2 values (1,2),(2,4);
+EXPLAIN
+select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3)
+select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
+pk i v a b
+1 1 2 1 2
+2 2 4 2 4
+drop table t1, t2;
#
# End of 10.2 tests
#
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result
index 10af9265649..0f519c53f3e 100644
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@ -1887,4 +1887,62 @@ a b
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1;
# End of 10.1 tests
+#
+# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
+#
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size=255;
+CREATE TABLE t1 (a BIT(32), b INT);
+INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81
+SELECT HEX(a), b from t1 where t1.a >= 81;
+HEX(a) b
+51 81
+52 82
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+DROP TABLE t1;
+#
+# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
+#
+CREATE TABLE t1(a int);
+INSERT INTO t1 values (1),(2),(2),(3),(4);
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size= 255;
+set use_stat_tables='preferably';
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+SET optimizer_use_condition_selectivity=3;
+# filtered should show 25 %
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+FLUSH TABLES;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+DROP TABLE t1;
+# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result
index ee0f56ae7ed..5452919aa6d 100644
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@ -1897,6 +1897,64 @@ a b
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1;
# End of 10.1 tests
+#
+# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
+#
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size=255;
+CREATE TABLE t1 (a BIT(32), b INT);
+INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81
+SELECT HEX(a), b from t1 where t1.a >= 81;
+HEX(a) b
+51 81
+52 82
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+DROP TABLE t1;
+#
+# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
+#
+CREATE TABLE t1(a int);
+INSERT INTO t1 values (1),(2),(2),(3),(4);
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size= 255;
+set use_stat_tables='preferably';
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+SET optimizer_use_condition_selectivity=3;
+# filtered should show 25 %
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+FLUSH TABLES;
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+DROP TABLE t1;
+# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
set @tmp_ust= @@use_stat_tables;
diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result
index 845c0f21e3e..cd4859c32e8 100644
--- a/mysql-test/r/set_statement.result
+++ b/mysql-test/r/set_statement.result
@@ -1217,3 +1217,28 @@ set @rnd=1;
select @rnd;
@rnd
0
+#
+# MDEV-24860: Incorrect behaviour of SET STATEMENT in case
+# it is executed as a prepared statement
+#
+PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1";
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+# Show definition of the table t1 created using Prepared Statement
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+# Create the table t1 with the same definition as it used before
+# using regular statement execution mode.
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1;
+# Show that the table has the same definition as it is in case the table
+# created in prepared statement mode.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index 1c055ef7385..b058c8f001e 100644
--- a/mysql-test/r/skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -1,14 +1,4 @@
use test;
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
-DROP VIEW IF EXISTS v3;
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP FUNCTION IF EXISTS f3;
CREATE TABLE t1(c INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
FOR EACH ROW
@@ -58,10 +48,16 @@ DROP PROCEDURE p3;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
+#
+# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
+#
set global event_scheduler=1;
Warnings:
Note 1408 Event Scheduler: Loaded 0 events
set global event_scheduler=0;
+#
+# Bug#26285 Selecting information_schema crahes server
+#
select count(*) from information_schema.COLUMN_PRIVILEGES;
count(*)
0
@@ -74,14 +70,21 @@ count(*)
select count(*) from information_schema.USER_PRIVILEGES;
count(*)
0
-End of 5.0 tests
+#
+# End of 5.0 tests
+#
#
# Bug#29817 Queries with UDF fail with non-descriptive error
# if mysql.proc is missing
#
select no_such_function(1);
ERROR 42000: FUNCTION test.no_such_function does not exist
-End of 5.1 tests
+#
+# End of 5.1 tests
+#
+#
+# MDEV-8280 crash in 'show global status' with --skip-grant-tables
+#
show global status like 'Acl%';
Variable_name Value
Acl_column_grants 0
@@ -93,3 +96,14 @@ Acl_role_grants 0
Acl_roles 0
Acl_table_grants 0
Acl_users 0
+#
+# End of 10.1 tests
+#
+#
+# MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
+#
+set role x;
+ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result
index ca448efa535..6c94a111f6f 100644
--- a/mysql-test/r/sp-ucs2.result
+++ b/mysql-test/r/sp-ucs2.result
@@ -100,20 +100,20 @@ RETURNS VARCHAR(64) CHARACTER SET ucs2
BEGIN
RETURN 'str';
END|
-ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1'
+DROP FUNCTION f|
CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2)
RETURNS VARCHAR(64) COLLATE ucs2_unicode_ci
BEGIN
RETURN 'str';
END|
-ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1'
+DROP FUNCTION f|
CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2)
RETURNS VARCHAR(64) CHARACTER SET ucs2
BEGIN
DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci;
RETURN 'str';
END|
-ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1'
+DROP FUNCTION f|
SET NAMES utf8;
DROP FUNCTION IF EXISTS bug48766;
CREATE FUNCTION bug48766 ()
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index c4d3779e484..b679f3f54fc 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -8467,3 +8467,23 @@ $$
ERROR 22007: Incorrect integer value: 'y' for column ``.``.`a` at row 1
DROP TABLE t1;
SET sql_mode=DEFAULT;
+#
+# MDEV-24220: error when opening a table for the second call of SP
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2);
+CREATE VIEW v1 AS SELECT MAX(a) as f FROM t1;
+CREATE PROCEDURE p1()
+BEGIN
+SELECT * FROM v1;
+END $
+CALL p1;
+f
+2
+ALTER TABLE t1 DROP a;
+CALL p1;
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1;
+#End of 10.2 tests
diff --git a/mysql-test/r/stat_tables.result b/mysql-test/r/stat_tables.result
index bb3a0a80f7e..a52db46d119 100644
--- a/mysql-test/r/stat_tables.result
+++ b/mysql-test/r/stat_tables.result
@@ -825,5 +825,19 @@ length(a)
set names latin1;
set @@use_stat_tables=@save_use_stat_tables;
drop table t1;
+#
+# MDEV-23753: SIGSEGV in Column_stat::store_stat_fields
+#
+CREATE TABLE t1 (a INT, b INT) PARTITION BY HASH (b) PARTITIONS 2;
+LOCK TABLES t1 WRITE;
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (nonexisting) INDEXES (nonexisting);
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze error Invalid argument
+DROP TABLE t1;
# please keep this at the last
set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/r/stat_tables_innodb.result b/mysql-test/r/stat_tables_innodb.result
index 23b952cc891..3be6b0bd4b3 100644
--- a/mysql-test/r/stat_tables_innodb.result
+++ b/mysql-test/r/stat_tables_innodb.result
@@ -852,6 +852,20 @@ length(a)
set names latin1;
set @@use_stat_tables=@save_use_stat_tables;
drop table t1;
+#
+# MDEV-23753: SIGSEGV in Column_stat::store_stat_fields
+#
+CREATE TABLE t1 (a INT, b INT) PARTITION BY HASH (b) PARTITIONS 2;
+LOCK TABLES t1 WRITE;
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (nonexisting) INDEXES (nonexisting);
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze error Invalid argument
+DROP TABLE t1;
# please keep this at the last
set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result
index fa0fc4e1061..60309e14fe3 100644
--- a/mysql-test/r/status2.result
+++ b/mysql-test/r/status2.result
@@ -74,4 +74,12 @@ DROP TRIGGER trigg1;
DROP FUNCTION testQuestion;
DROP EVENT ev1;
DROP TABLE t1,t2;
-End of 6.0 tests
+#
+# End of 5.5 tests
+#
+select variable_value < 1024*1024*1024 from information_schema.global_status where variable_name='memory_used';
+variable_value < 1024*1024*1024
+1
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index d4d61eb4247..a03a2cff207 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7331,4 +7331,42 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index c0df4f626b1..2e24cbcb40c 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -2686,4 +2686,39 @@ SELECT * FROM t2;
f
bar
DROP TABLE t1, t2;
+#
+# MDEV-23449: alias do not exist and a query do not report an error
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
+SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
+ERROR 42S22: Unknown column 's.id' in 'group statement'
+DROP TABLE t1;
+#
+# MDEV-24519: Server crashes in Charset::set_charset upon SELECT
+#
+CREATE TABLE t1 (a VARBINARY(8));
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE TABLE t2 (b VARBINARY(8));
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+a
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b VARBINARY(8));
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+a
+DROP TABLE t1,t2;
# End of 10.2 tests
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index fa9ab8bec1d..f7da3fdb2e2 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -7331,6 +7331,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index c4d5b2813fd..6ab304c190b 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -7324,6 +7324,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index fd1c5279f4d..338ddd5808b 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -7322,5 +7322,43 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 48d5bc974a7..741b070a38b 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -7337,6 +7337,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 2df8073d8bf..ebabafb9c77 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -7322,6 +7322,44 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
+#
+# MDEV-25002: Outer reference in ON clause of subselect
+#
+create table t1 (
+pk int primary key,
+a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+create table t2 (
+pk int primary key,
+b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+create table t3 (a int);
+insert into t3 values (1),(2);
+select a,
+(select count(*) from t1, t2
+where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a,
+(select count(*) from t1 join t2 on t2.pk=t3.a
+where t1.pk=1) as sq
+from t3;
+a sq
+1 1
+2 1
+select a from t3
+where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+a
+1
+select a from t3
+where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+a
+1
+drop table t1,t2,t3;
# End of 10.2 tests
#
# MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result
index 764a1b2780e..8e4210c06fb 100644
--- a/mysql-test/r/table_elim.result
+++ b/mysql-test/r/table_elim.result
@@ -544,7 +544,7 @@ drop table t0,t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (f1 int(11), PRIMARY KEY (f1)) ;
CREATE TABLE t2 (f4 varchar(1024), KEY (f4)) ;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
INSERT IGNORE INTO t2 VALUES ('xcddwntkbxyorzdv'),
('cnxxcddwntkbxyor'),('r'),('r'), ('did'),('I'),('when'),
('hczkfqjeggivdvac'),('e'),('okay'),('up');
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 2a410d2ce97..519f0d547a2 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -176,9 +176,8 @@ Note 1265 Data truncated for column 'a' at row 2
insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2
+Warning 1264 Out of range value for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4
insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -209,7 +208,7 @@ a
99999999.99
0.00
99999999.99
-0.00
+99999999.99
0.00
0.00
123.40
@@ -1078,5 +1077,89 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
DROP TABLE t1dec102;
#
+# MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result
+#
+SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a;
+a
+0
+SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a;
+a
+0
+SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a;
+a
+99999999999999999999999999999999999999
+Warnings:
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
+Warning 1292 Truncated incorrect DECIMAL value: '.00000000000000000000000000000000000001e111111111111111111111'
+Warning 1264 Out of range value for column 'a' at row 1
+CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128));
+INSERT INTO t1 VALUES
+('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'),
+('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'),
+('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'),
+('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent');
+BEGIN NOT ATOMIC
+DECLARE done INT DEFAULT FALSE;
+DECLARE vstr, vcomment VARCHAR(128);
+DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str;
+DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+OPEN cur1;
+read_loop:
+LOOP
+FETCH cur1 INTO vstr, vcomment;
+IF done THEN
+LEAVE read_loop;
+END IF;
+SELECT vstr AS `--------`, vcomment AS `--------`;
+SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
+SHOW WARNINGS;
+SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
+SHOW WARNINGS;
+END LOOP;
+END;
+$$
+-------- --------
+0e-111111111111111111111 Zero mantissa and a huge negative exponent
+CAST(str AS DECIMAL(38,0))
+0
+Level Code Message
+CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
+0
+Level Code Message
+Warning 1292 Truncated incorrect DECIMAL value: '0e-111111111111111111111garbage'
+-------- --------
+0e111111111111111111111 Zero mantissa and a huge positive exponent
+CAST(str AS DECIMAL(38,0))
+0
+Level Code Message
+CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
+0
+Level Code Message
+Warning 1292 Truncated incorrect DECIMAL value: '0e111111111111111111111garbage'
+-------- --------
+1e-111111111111111111111 Non-zero mantissa and a huge negative exponent
+CAST(str AS DECIMAL(38,0))
+0
+Level Code Message
+CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
+0
+Level Code Message
+Warning 1292 Truncated incorrect DECIMAL value: '1e-111111111111111111111garbage'
+-------- --------
+1e111111111111111111111 Non-zero mantissa, huge positive exponent
+CAST(str AS DECIMAL(38,0))
+99999999999999999999999999999999999999
+Level Code Message
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
+Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111'
+Warning 1264 Out of range value for column 'CAST(str AS DECIMAL(38,0))' at row 1
+CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
+99999999999999999999999999999999999999
+Level Code Message
+Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
+Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111garbage'
+Warning 1264 Out of range value for column 'CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))' at row 1
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 99c3c50ea8c..75876d2efad 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
create table t1 (y year,y2 year(2));
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
@@ -28,6 +27,9 @@ y y2
2001 01
2069 69
drop table t1;
+#
+# Bug 2335
+#
create table t1 (y year);
insert ignore into t1 values (now());
Warnings:
@@ -36,6 +38,9 @@ select if(y = now(), 1, 0) from t1;
if(y = now(), 1, 0)
1
drop table t1;
+#
+# Bug #27176: Assigning a string to an year column has unexpected results
+#
create table t1(a year);
insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
Warnings:
@@ -47,7 +52,9 @@ a
2001
2001
drop table t1;
-End of 5.0 tests
+#
+# End of 5.0 tests
+#
#
# Bug #49480: WHERE using YEAR columns returns unexpected results
#
@@ -373,7 +380,8 @@ Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Pleas
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
DROP TABLE t1;
#
-End of 5.1 tests
+# End of 5.1 tests
+#
create function y2k() returns int deterministic return 2000;
create table t1 (a year(2), b int);
Warnings:
@@ -456,9 +464,6 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
-# Start of 10.2 tests
-#
-#
# MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
#
CREATE TABLE t1 (a YEAR);
@@ -500,5 +505,63 @@ Warnings:
Warning 1264 Out of range value for column 'a' at row 1
DROP TABLE t1;
#
+# Various widths of the YEAR
+#
+create or replace table t1 (a YEAR(0));
+Warnings:
+Note 1287 'YEAR(0)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a YEAR(1));
+Warnings:
+Note 1287 'YEAR(1)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a YEAR(2));
+Warnings:
+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a YEAR(3));
+Warnings:
+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a YEAR(4));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a YEAR(5));
+Warnings:
+Note 1287 'YEAR(5)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create or replace table t1 (a YEAR(100));
+Warnings:
+Note 1287 'YEAR(100)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` year(4) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/user_limits.result b/mysql-test/r/user_limits.result
index bbf73d7c617..8658cc1497d 100644
--- a/mysql-test/r/user_limits.result
+++ b/mysql-test/r/user_limits.result
@@ -186,3 +186,30 @@ connection default;
drop user mysqltest_1@localhost;
drop table t1;
set global max_user_connections= @my_max_user_connections;
+#
+# End of 10.1 tests
+#
+#
+# MDEV-17852 Altered connection limits for user have no effect
+#
+create user foo@'%' with max_user_connections 1;
+connect con1,localhost,foo;
+select current_user();
+current_user()
+foo@%
+connect(localhost,foo,,test,MYSQL_PORT,MYSQL_SOCK);
+connect con2,localhost,foo;
+ERROR 42000: User 'foo' has exceeded the 'max_user_connections' resource (current value: 1)
+connection default;
+alter user foo with max_user_connections 2;
+connect con3,localhost,foo;
+select current_user();
+current_user()
+foo@%
+disconnect con3;
+disconnect con1;
+connection default;
+drop user foo@'%';
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/userstat.result b/mysql-test/r/userstat.result
index 01a66aa78ec..8aad76c3750 100644
--- a/mysql-test/r/userstat.result
+++ b/mysql-test/r/userstat.result
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS t1;
select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key;
show columns from information_schema.client_statistics;
Field Type Null Key Default Extra
@@ -234,3 +233,17 @@ select @@in_transaction;
0
drop table t1;
set @@global.general_log=@save_general_log;
+#
+# MDEV-25242 Server crashes in check_grant upon invoking function with userstat enabled
+#
+create function f() returns int return (select 1 from performance_schema.threads);
+set global userstat= 1;
+select f() from information_schema.table_statistics;
+ERROR 21000: Subquery returns more than 1 row
+select f() from information_schema.index_statistics;
+ERROR 21000: Subquery returns more than 1 row
+set global userstat= 0;
+drop function f;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 994d5949460..ef4f0a48534 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -6767,5 +6767,71 @@ DROP PROCEDURE sp;
DROP VIEW v1;
DROP TABLE t1;
#
+# MDEV-24314: create view with derived table without default database
+#
+drop database test;
+create database db1;
+create table db1.t1 (a int);
+insert into db1.t1 values (3),(7),(1);
+create view db1.v1 as select * from (select * from db1.t1) t;
+show create view db1.v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS select `t`.`a` AS `a` from (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`) `t` latin1 latin1_swedish_ci
+select * from db1.v1;
+a
+3
+7
+1
+drop view db1.v1;
+prepare stmt from "
+create view db1.v1 as select * from (select * from db1.t1) t;
+";
+execute stmt;
+deallocate prepare stmt;
+show create view db1.v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db1`.`v1` AS select `t`.`a` AS `a` from (select `db1`.`t1`.`a` AS `a` from `db1`.`t1`) `t` latin1 latin1_swedish_ci
+select * from db1.v1;
+a
+3
+7
+1
+drop view db1.v1;
+drop table db1.t1;
+drop database db1;
+create database test;
+use test;
+#
+# MDEV-16940: update of multi-table view returning error used in SP
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (2), (3);
+CREATE VIEW v1 AS SELECT a, b FROM t1,t2;
+CREATE PROCEDURE sp1() UPDATE v1 SET a = 8, b = 9;
+CALL sp1;
+ERROR HY000: Can not modify more than one base table through a join view 'test.v1'
+CALL sp1;
+ERROR HY000: Can not modify more than one base table through a join view 'test.v1'
+DROP PROCEDURE sp1;
+DROP VIEW v1;
+DROP TABLE t1, t2;
+#
+# MDEV-23291: SUM column from a derived table returns invalid values
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2);
+CREATE view v1 AS
+SELECT a as x, (select x) as y, (select y) as z FROM t1;
+SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q;
+sum(z)
+3
+SELECT sum(z) FROM v1;
+sum(z)
+3
+DROP TABLE t1;
+DROP VIEW v1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 3023a86eaad..dd74c5c77fd 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3866,5 +3866,31 @@ NULL
DROP VIEW v1;
DROP TABLE t1,t2;
#
+# MDEV-25032 Window functions without column references get removed from ORDER BY
+#
+create table t1 (id int, score double);
+insert into t1 values
+(1, 5),
+(1, 6),
+(1, 6),
+(1, 6),
+(1, 7),
+(1, 8.1),
+(1, 9),
+(1, 10);
+select id, row_number() over () rn
+from t1
+order by rn desc;
+id rn
+1 8
+1 7
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index 6ae4a06399c..8ff84862270 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -241,7 +241,7 @@ DROP TABLE t1;
#
# Bug#12352846 - TRANS_XA_START(THD*):
# ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
-# FAILED
+# FAILED
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
@@ -291,3 +291,29 @@ connection default;
XA END 'xid1';
XA ROLLBACK 'xid1';
DROP TABLE t1, t2, t3;
+#
+# MDEV 15532 XA: Assertion `!log->same_pk' failed in
+# row_log_table_apply_delete
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+connect con1,localhost,root,,test;
+XA START 'xid';
+UPDATE t1 SET a = 5;
+connection default;
+SET innodb_lock_wait_timeout= 2, lock_wait_timeout= 2;
+ALTER TABLE non_existing_table1;
+ERROR 42S02: Table 'test.non_existing_table1' doesn't exist
+ALTER TABLE t1 FORCE;;
+connection con1;
+ALTER TABLE non_existing_table2;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
+DELETE FROM t1 LIMIT 1;
+connection default;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection con1;
+XA END 'xid';
+XA ROLLBACK 'xid';
+DROP TABLE t1;
+disconnect con1;
+connection default;
diff --git a/mysql-test/suite/binlog/disabled.def b/mysql-test/suite/binlog/disabled.def
index 424e5549541..888298bbb09 100644
--- a/mysql-test/suite/binlog/disabled.def
+++ b/mysql-test/suite/binlog/disabled.def
@@ -9,5 +9,3 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
-binlog_spurious_ddl_errors : BUG#11761680 2013-01-18 astha Fixed on mysql-5.6 and trunk
diff --git a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result
index 1a81eee1a58..798bd8ab853 100644
--- a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result
+++ b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result
@@ -1,5 +1,5 @@
SET @old_binlog_format= @@global.binlog_format;
-INSTALL PLUGIN example SONAME 'ha_example.so';
+INSTALL PLUGIN example SONAME 'ha_example';
################################################################################
# Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog
# format to STATEMENT and the transaction isolation level to READ COMMITTED as
@@ -18,7 +18,7 @@ ALTER TABLE t_row ADD COLUMN b INT;
CREATE TRIGGER trig_row BEFORE INSERT ON t_row FOR EACH ROW INSERT INTO t_stmt VALUES (1);
CREATE INDEX i ON t_row(a);
CREATE TABLE t_row_new ENGINE = InnoDB SELECT * FROM t_row;
-ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
+ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.
DROP TABLE t_row;
@@ -36,12 +36,11 @@ DROP TABLE t_row;
SET binlog_format = ROW;
CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE;
ALTER TABLE t_stmt ADD COLUMN b INT;
-ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE'
CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1);
CREATE INDEX i ON t_stmt(a);
ERROR 42000: Too many key parts specified; max 0 parts allowed
CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt;
-ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging.
+ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging
DROP TABLE t_stmt;
diff --git a/mysql-test/suite/binlog/r/binlog_truncate_innodb.result b/mysql-test/suite/binlog/r/binlog_truncate_innodb.result
index 8beeeb1a428..87ce8e30dee 100644
--- a/mysql-test/suite/binlog/r/binlog_truncate_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_truncate_innodb.result
@@ -7,9 +7,11 @@ INSERT INTO t2 VALUES (1),(2),(3);
**** Truncate of empty table shall be logged
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -18,18 +20,17 @@ DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -37,16 +38,20 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
# Even though the isolation level might be permissive, truncate
# table follows a stricter isolation as its locking is based on
@@ -59,9 +64,11 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -71,18 +78,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -90,16 +96,20 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
@@ -109,9 +119,11 @@ SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -121,18 +133,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -140,16 +151,20 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
@@ -159,9 +174,11 @@ SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -171,18 +188,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -190,16 +206,20 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
@@ -209,9 +229,11 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -221,18 +243,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -240,16 +261,20 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Annotate_rows # # INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
SET BINLOG_FORMAT=STATEMENT;
RESET MASTER;
@@ -261,9 +286,11 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -273,18 +300,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -292,14 +318,16 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
# Truncate is not supported for SBR if the isolation level is
# READ UNCOMMITTED or READ COMMITTED. These specific isolation
@@ -312,9 +340,11 @@ SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -324,18 +354,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -343,14 +372,16 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
@@ -360,9 +391,11 @@ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
TRUNCATE TABLE t1;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
TRUNCATE TABLE t2;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t2
DROP TABLE t1,t2;
#
@@ -372,18 +405,17 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-# Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
-# Connection: truncate
+connect truncate,localhost,root,,;
TRUNCATE TABLE t1;
-# Connection: default
+connection default;
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COUNT(*)
4
COMMIT;
-# Connection: truncate
+connection truncate;
# Reaping TRUNCATE TABLE
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -391,13 +423,16 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
4
-# Connection: default
-show binlog events from <binlog_start>;
+connection default;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
+disconnect truncate;
DROP TABLE t1,t2;
-SET BINLOG_FORMAT=@old_binlog_format;
+SET @@global.binlog_format = @old_binlog_format;
+SET @@session.binlog_format = @old_binlog_format;
diff --git a/mysql-test/suite/binlog/r/binlog_xa_recover.result b/mysql-test/suite/binlog/r/binlog_xa_recover.result
index 25aa1389b71..f5060fd5160 100644
--- a/mysql-test/suite/binlog/r/binlog_xa_recover.result
+++ b/mysql-test/suite/binlog/r/binlog_xa_recover.result
@@ -146,29 +146,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */
SET DEBUG_SYNC= "now SIGNAL con10_cont";
connection con10;
connection default;
-SET @old_dbug= @@global.DEBUG_DBUG;
-SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now SIGNAL con12_cont";
connection con12;
connection default;
-SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
-SET GLOBAL debug_dbug= @old_dbug;
SET DEBUG_SYNC= "now SIGNAL con11_cont";
connection con11;
connection default;
-Checking that master-bin.000004 is the last binlog checkpoint
-include/show_binlog_events.inc
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-master-bin.000004 # Gtid_list # # [#-#-#]
-master-bin.000004 # Binlog_checkpoint # # master-bin.000001
-master-bin.000004 # Gtid # # BEGIN GTID #-#-#
-master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL)
-master-bin.000004 # Table_map # # table_id: # (test.t1)
-master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F
-master-bin.000004 # Xid # # COMMIT /* XID */
-master-bin.000004 # Binlog_checkpoint # # master-bin.000002
-master-bin.000004 # Binlog_checkpoint # # master-bin.000004
Now crash the server
SET SESSION debug_dbug="+d,crash_commit_after_log";
INSERT INTO t1 VALUES (14, NULL);
diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test
index e64e7838a31..29a860764a9 100644
--- a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test
+++ b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test
@@ -71,7 +71,6 @@ DROP TABLE t_row;
SET binlog_format = ROW;
CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE;
---error ER_NOT_SUPPORTED_YET
ALTER TABLE t_stmt ADD COLUMN b INT;
CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1);
diff --git a/mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt b/mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt
deleted file mode 100644
index 69cc489a969..00000000000
--- a/mysql-test/suite/binlog/t/binlog_truncate_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb \ No newline at end of file
diff --git a/mysql-test/suite/binlog/t/binlog_truncate_innodb.test b/mysql-test/suite/binlog/t/binlog_truncate_innodb.test
index 56dd5bda505..9e331738ab5 100644
--- a/mysql-test/suite/binlog/t/binlog_truncate_innodb.test
+++ b/mysql-test/suite/binlog/t/binlog_truncate_innodb.test
@@ -41,4 +41,5 @@ source extra/binlog_tests/binlog_truncate.test;
let $before_truncate = SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
source extra/binlog_tests/binlog_truncate.test;
-SET BINLOG_FORMAT=@old_binlog_format;
+SET @@global.binlog_format = @old_binlog_format;
+SET @@session.binlog_format = @old_binlog_format; \ No newline at end of file
diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt b/mysql-test/suite/binlog/t/binlog_xa_recover.opt
index 3c44f9fad10..3c44f9fad10 100644
--- a/mysql-test/suite/binlog/t/binlog_xa_recover-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_xa_recover.opt
diff --git a/mysql-test/suite/binlog/t/binlog_xa_recover.test b/mysql-test/suite/binlog/t/binlog_xa_recover.test
index 0e0b80433ff..3b2a7e45392 100644
--- a/mysql-test/suite/binlog/t/binlog_xa_recover.test
+++ b/mysql-test/suite/binlog/t/binlog_xa_recover.test
@@ -1 +1,277 @@
---source extra/binlog_tests/binlog_xa_recover.inc
+#
+# This include file is used by more than one test suite
+# (currently binlog and binlog_encryption).
+# Please check all dependent tests after modifying it
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_binlog_format_row.inc
+--source include/have_perfschema.inc
+# Valgrind does not work well with test that crashes the server
+--source include/not_valgrind.inc
+
+# (We do not need to restore these settings, as we crash the server).
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
+# Insert some data to force a couple binlog rotations (3), so we get some
+# normal binlog checkpoints before starting the test.
+INSERT INTO t1 VALUES (100, REPEAT("x", 4100));
+# Wait for the master-bin.000002 binlog checkpoint to appear.
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002"
+--let $field= Info
+--let $condition= = "master-bin.000002"
+--source include/wait_show_condition.inc
+INSERT INTO t1 VALUES (101, REPEAT("x", 4100));
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
+--let $field= Info
+--let $condition= = "master-bin.000003"
+--source include/wait_show_condition.inc
+INSERT INTO t1 VALUES (102, REPEAT("x", 4100));
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
+--let $field= Info
+--let $condition= = "master-bin.000004"
+--source include/wait_show_condition.inc
+
+# Now start a bunch of transactions that span multiple binlog
+# files. Leave then in the state prepared-but-not-committed in the engine
+# and crash the server. Check that crash recovery is able to recover all
+# of them.
+#
+# We use debug_sync to get all the transactions into the prepared state before
+# we commit any of them. This is because the prepare step flushes the InnoDB
+# redo log - including any commits made before, so recovery would become
+# unnecessary, decreasing the value of this test.
+#
+# We arrange to have con1 with a prepared transaction in master-bin.000004,
+# con2 and con3 with a prepared transaction in master-bin.000005, and a new
+# empty master-bin.000006. So the latest binlog checkpoint should be
+# master-bin.000006.
+
+connect(con1,localhost,root,,);
+# First wait after prepare and before write to binlog.
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont";
+# Then complete InnoDB commit in memory (but not commit checkpoint / write to
+# disk), and hang until crash, leaving a transaction to be XA recovered.
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever";
+send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con1_wait";
+
+connect(con2,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever";
+send INSERT INTO t1 VALUES (2, NULL);
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con2_wait";
+
+connect(con3,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont";
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever";
+send INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con3_wait";
+
+connect(con4,localhost,root,,);
+SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont";
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+send INSERT INTO t1 VALUES (4, NULL);
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con4_wait";
+
+SET DEBUG_SYNC= "now SIGNAL con1_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
+SET DEBUG_SYNC= "now SIGNAL con2_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
+SET DEBUG_SYNC= "now SIGNAL con3_cont";
+SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
+
+# Check that everything is committed in binary log.
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000003
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000004
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000005
+--source include/show_binlog_events.inc
+--let $binlog_file= master-bin.000006
+--source include/show_binlog_events.inc
+
+
+# Check that server will not purge too much.
+PURGE BINARY LOGS TO "master-bin.000006";
+--source include/show_binary_logs.inc
+
+# Now crash the server with one more transaction in prepared state.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover.test
+EOF
+--error 0,2006,2013
+SET DEBUG_SYNC= "now SIGNAL con4_cont";
+connection con4;
+--error 2006,2013
+reap;
+
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-group_commit_binlog_pos.test
+EOF
+
+connection default;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+--echo Test that with multiple binlog checkpoints, recovery starts from the last one.
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+# Rotate to binlog master-bin.000003 while delaying binlog checkpoints.
+# So we get multiple binlog checkpoints in master-bin.000003.
+# Then complete the checkpoints, crash, and check that we only scan
+# the necessary binlog file (ie. that we use the _last_ checkpoint).
+
+connect(con10,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont";
+send INSERT INTO t1 VALUES (10, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
+
+connect(con11,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont";
+send INSERT INTO t1 VALUES (11, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
+
+connect(con12,localhost,root,,);
+SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont";
+send INSERT INTO t1 VALUES (12, REPEAT("x", 4100));
+
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR con12_ready";
+INSERT INTO t1 VALUES (13, NULL);
+
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000004
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+
+SET DEBUG_SYNC= "now SIGNAL con10_cont";
+connection con10;
+reap;
+connection default;
+
+# We need to sync the test case with the background processing of the
+# commit checkpoint, otherwise we get nondeterministic results.
+let $wait_condition= select count(*) = 1 from performance_schema.threads where processlist_state = "Waiting for background binlog tasks";
+--source include/wait_condition.inc
+
+SET DEBUG_SYNC= "now SIGNAL con12_cont";
+connection con12;
+reap;
+connection default;
+
+SET DEBUG_SYNC= "now SIGNAL con11_cont";
+connection con11;
+reap;
+
+connection default;
+# Wait for the last (master-bin.000004) binlog checkpoint to appear.
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
+--let $field= Info
+--let $condition= = "master-bin.000004"
+--source include/wait_show_condition.inc
+
+--echo Now crash the server
+# It is not too easy to test XA recovery, as it runs early during server
+# startup, before any connections can be made.
+# What we do is set a DBUG error insert which will crash if XA recovery
+# starts from any other binlog than master-bin.000004 (check the file
+# binlog_xa_recover-master.opt). Then we will fail here if XA recovery
+# would start from the wrong place.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover.test
+EOF
+SET SESSION debug_dbug="+d,crash_commit_after_log";
+--error 2006,2013
+INSERT INTO t1 VALUES (14, NULL);
+
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-group_commit_binlog_pos.test
+EOF
+
+connection default;
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+
+--echo *** Check that recovery works if we crashed early during rotate, before
+--echo *** binlog checkpoint event could be written.
+
+SET GLOBAL max_binlog_size= 4096;
+SET GLOBAL innodb_flush_log_at_trx_commit= 1;
+RESET MASTER;
+
+# We need some initial data to reach binlog master-bin.000004. Otherwise
+# crash recovery fails due to the error insert used for previous test.
+INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
+INSERT INTO t1 VALUES (22, REPEAT("x", 4100));
+# Wait for the master-bin.000003 binlog checkpoint to appear.
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
+--let $field= Info
+--let $condition= = "master-bin.000003"
+--source include/wait_show_condition.inc
+INSERT INTO t1 VALUES (23, REPEAT("x", 4100));
+# Wait for the last (master-bin.000004) binlog checkpoint to appear.
+--let $wait_for_all= 0
+--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
+--let $field= Info
+--let $condition= = "master-bin.000004"
+--source include/wait_show_condition.inc
+
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait-binlog_xa_recover.test
+EOF
+SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
+--error 2006,2013
+INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
+
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart-group_commit_binlog_pos.test
+EOF
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+# Check that all transactions are recovered.
+SELECT a FROM t1 ORDER BY a;
+
+--source include/show_binary_logs.inc
+--let $binlog_file= master-bin.000004
+--let $binlog_start= 4
+--source include/show_binlog_events.inc
+
+# Cleanup
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt b/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt
deleted file mode 100644
index 3c44f9fad10..00000000000
--- a/mysql-test/suite/binlog_encryption/binlog_xa_recover-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004
diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result
index af36fe277a1..3e4ed42cf7c 100644
--- a/mysql-test/suite/binlog_encryption/binlog_xa_recover.result
+++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.result
@@ -151,30 +151,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */
SET DEBUG_SYNC= "now SIGNAL con10_cont";
connection con10;
connection default;
-SET @old_dbug= @@global.DEBUG_DBUG;
-SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now SIGNAL con12_cont";
connection con12;
connection default;
-SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
-SET GLOBAL debug_dbug= @old_dbug;
SET DEBUG_SYNC= "now SIGNAL con11_cont";
connection con11;
connection default;
-Checking that master-bin.000004 is the last binlog checkpoint
-include/show_binlog_events.inc
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
-master-bin.000004 # Start_encryption # #
-master-bin.000004 # Gtid_list # # [#-#-#]
-master-bin.000004 # Binlog_checkpoint # # master-bin.000001
-master-bin.000004 # Gtid # # BEGIN GTID #-#-#
-master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL)
-master-bin.000004 # Table_map # # table_id: # (test.t1)
-master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F
-master-bin.000004 # Xid # # COMMIT /* XID */
-master-bin.000004 # Binlog_checkpoint # # master-bin.000002
-master-bin.000004 # Binlog_checkpoint # # master-bin.000004
Now crash the server
SET SESSION debug_dbug="+d,crash_commit_after_log";
INSERT INTO t1 VALUES (14, NULL);
diff --git a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test
index 0e0b80433ff..c03adb6aff2 100644
--- a/mysql-test/suite/binlog_encryption/binlog_xa_recover.test
+++ b/mysql-test/suite/binlog_encryption/binlog_xa_recover.test
@@ -1 +1 @@
---source extra/binlog_tests/binlog_xa_recover.inc
+--source suite/binlog/t/binlog_xa_recover.test
diff --git a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result
index 6d574681d73..ad6a89648ad 100644
--- a/mysql-test/suite/binlog_encryption/rpl_semi_sync.result
+++ b/mysql-test/suite/binlog_encryption/rpl_semi_sync.result
@@ -163,20 +163,15 @@ connection slave;
connection slave;
include/stop_slave.inc
connection master;
+include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000;
[ master status should be ON ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 0
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 14
-show status like 'Rpl_semi_sync_master_clients';
-Variable_name Value
-Rpl_semi_sync_master_clients 1
[ semi-sync replication of these transactions will fail ]
insert into t1 values (500);
[ master status should be OFF ]
@@ -234,9 +229,6 @@ max(a)
500
connection master;
[ master status should be ON again after slave catches up ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 12
@@ -303,8 +295,6 @@ connection master;
create table t1 (a int) engine = ENGINE_TYPE;
drop table t1;
connection slave;
-show status like 'Rpl_relay%';
-Variable_name Value
[ test reset master ]
connection master;
reset master;
@@ -320,8 +310,7 @@ Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
reset slave;
-connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
@@ -353,7 +342,7 @@ include/stop_slave.inc
reset slave;
connection master;
reset master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
set sql_log_bin=0;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
@@ -404,11 +393,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
[ Semi-sync status on master should be ON ]
-show status like 'Rpl_semi_sync_master_clients';
-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 ON
diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
index 1856c30a36b..27eedc45028 100644
--- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result
+++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
@@ -3872,6 +3872,32 @@ NULL
DROP VIEW v1;
DROP TABLE t1,t2;
#
+# MDEV-25032 Window functions without column references get removed from ORDER BY
+#
+create table t1 (id int, score double);
+insert into t1 values
+(1, 5),
+(1, 6),
+(1, 6),
+(1, 6),
+(1, 7),
+(1, 8.1),
+(1, 9),
+(1, 10);
+select id, row_number() over () rn
+from t1
+order by rn desc;
+id rn
+1 8
+1 7
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+drop table t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/suite/engines/funcs/disabled.def b/mysql-test/suite/engines/funcs/disabled.def
index c43b0c92bc9..e1e2491b4a8 100644
--- a/mysql-test/suite/engines/funcs/disabled.def
+++ b/mysql-test/suite/engines/funcs/disabled.def
@@ -1,97 +1,4 @@
# List of disabled tests
# test name : comment
-rpl_redirect : Fails due to bug#49978
-crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb
-ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
-ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
-rpl_empty_master_crash : Test not applicable in 5.5+
-rpl_REDIRECT : Test not applicable in 5.5+
-rpl_create_database : Result Difference Due To Change In .inc file
-rpl_loaddata_m : Result Difference Due To Change In .inc file
-rpl_sp_effects : Result Difference Due To Change In .inc file
-rpl_variables : Result Difference Due To Change In .inc file
-rpl_loaddata_s : Result Difference Due To Change In .inc file
-rpl_dual_pos_advance : Result Difference Due To Change In .inc file
-rpl000011 : Result Difference Due To Change In .inc file
-rpl000013 : Result Difference Due To Change In .inc file
-rpl_000015 : Result Difference Due To Change In .inc file
-rpl_LD_INFILE : Result Difference Due To Change In .inc file
-rpl_alter : Result Difference Due To Change In .inc file
-rpl_alter_db : Result Difference Due To Change In .inc file
-rpl_alter_db : Result Difference Due To Change In .inc file
-rpl_bit : Result Difference Due To Change In .inc file
-rpl_bit_npk : Result Difference Due To Change In .inc file
-rpl_change_master : Result Difference Due To Change In .inc file
-rpl_do_grant : Result Difference Due To Change In .inc file
-rpl_drop : Result Difference Due To Change In .inc file
-rpl_drop_db : Result Difference Due To Change In .inc file
-rpl_flushlog_loop : Result Difference Due To Change In .inc file
-rpl_get_lock : Result Difference Due To Change In .inc file
-rpl_get_lock : Result Difference Due To Change In .inc file
-rpl_insert : Result Difference Due To Change In .inc file
-rpl_insert_select : Result Difference Due To Change In .inc file
-rpl_loaddata2 : Result Difference Due To Change In .inc file
-rpl_loaddatalocal : Result Difference Due To Change In .inc file
-rpl_loadfile : Result Difference Due To Change In .inc file
-rpl_log_pos : Result Difference Due To Change In .inc file
-rpl_many_optimize : Result Difference Due To Change In .inc file
-rpl_master_pos_wait : Result Difference Due To Change In .inc file
-rpl_misc_functions : Result Difference Due To Change In .inc file
-rpl_ps : Result Difference Due To Change In .inc file
-rpl_server_id1 : Result Difference Due To Change In .inc file
-rpl_session_var : Result Difference Due To Change In .inc file
-rpl_sf : Result Difference Due To Change In .inc file
-rpl_slave_status : Result Difference Due To Change In .inc file
-rpl_sp004 : Result Difference Due To Change In .inc file
-rpl_start_stop_slave : Result Difference Due To Change In .inc file
-rpl_stm_max_relay_size : Result Difference Due To Change In .inc file
-rpl_stm_mystery22 : Result Difference Due To Change In .inc file
-rpl_stm_no_op : Result Difference Due To Change In .inc file
-rpl_stm_reset_slave : Result Difference Due To Change In .inc file
-rpl_temp_table : Result Difference Due To Change In .inc file
-rpl_temporary : Result Difference Due To Change In .inc file
-rpl_trigger : Result Difference Due To Change In .inc file
-rpl_trunc_temp : Result Difference Due To Change In .inc file
-rpl_user_variables : Result Difference Due To Change In .inc file
-rpl_server_id2 : Result Difference Due To Change In .inc file
-rpl000010 : Result Difference Due To Change In .inc file
-rpl_init_slave : Result Difference Due To Change In .inc file
-rpl_multi_delete2 : Result Difference Due To Change In .inc file
-rpl_view : Result Difference Due To Change In .inc file
-rpl_ignore_table_update : Result Difference Due To Change In .inc file
-rpl_err_ignoredtable : Result Difference Due To Change In .inc file
-rpl_multi_update4 : Result Difference Due To Change In .inc file
-rpl_multi_delete : Result Difference Due To Change In .inc file
-rpl_ignore_grant : Result Difference Due To Change In .inc file
-rpl_ignore_revoke : Result Difference Due To Change In .inc file
-rpl_free_items : Result Difference Due To Change In .inc file
-rpl_replicate_ignore_db : Result Difference Due To Change In .inc file
-rpl000017 : Result Difference Due To Change In .inc file
-rpl_skip_error : Result Difference Due To Change In .inc file
-
-rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation.
-rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation.
-rpl_row_NOW : Result Difference Due To Change In .inc file
-rpl_row_USER : Result Difference Due To Change In .inc file
-rpl_row_drop : Result Difference Due To Change In .inc file
-rpl_row_func001 : Result Difference Due To Change In .inc file
-rpl_row_max_relay_size : Result Difference Due To Change In .inc file
-rpl_row_reset_slave : Result Difference Due To Change In .inc file
-rpl_row_sp001 : Result Difference Due To Change In .inc file
-rpl_row_sp005 : Result Difference Due To Change In .inc file
-rpl_row_sp008 : Result Difference Due To Change In .inc file
-rpl_row_sp009 : Result Difference Due To Change In .inc file
-rpl_row_sp010 : Result Difference Due To Change In .inc file
-rpl_row_sp011 : Result Difference Due To Change In .inc file
-rpl_row_sp012 : Result Difference Due To Change In .inc file
-rpl_row_stop_middle : Result Difference Due To Change In .inc file
-rpl_row_trig001 : Result Difference Due To Change In .inc file
-rpl_row_trig002 : Result Difference Due To Change In .inc file
-rpl_row_trig003 : Result Difference Due To Change In .inc file
-rpl_row_view01 : Result Difference Due To Change In .inc file
-rpl_switch_stm_row_mixed : Result Difference Due To Change In .inc file
-rpl_relayspace : Result Difference Due To Change In .inc file
-rpl_row_inexist_tbl : Result Difference Due To Change In .inc file
-rpl_sp : Result Difference Due To Change In .inc file
-rpl_rbr_to_sbr : Result Difference Due To Change In .inc file
+crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb [ERROR] InnoDB: Cannot add field `c726` in table `test`.`t1` because after adding it, the row size is 8135 which is greater than maximum allowed size (8126 bytes) for a record on index leaf page
diff --git a/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result b/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result
index 47079e34b38..6a2acb7ec86 100644
--- a/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result
+++ b/mysql-test/suite/engines/funcs/r/crash_manycolumns_string.result
@@ -1,5 +1,8 @@
-DROP TABLE IF EXISTS t1;
+SET SESSION innodb_strict_mode=off;
+call mtr.add_suppression("Row size too large (> 8126)*");
CREATE TABLE t1 (c1 VARCHAR(10),c2 VARCHAR(10),c3 VARCHAR(10),c4 VARCHAR(10),c5 VARCHAR(10),c6 VARCHAR(10),c7 VARCHAR(10),c8 VARCHAR(10),c9 VARCHAR(10),c10 VARCHAR(10),c11 VARCHAR(10),c12 VARCHAR(10),c13 VARCHAR(10),c14 VARCHAR(10),c15 VARCHAR(10),c16 VARCHAR(10),c17 VARCHAR(10),c18 VARCHAR(10),c19 VARCHAR(10),c20 VARCHAR(10),c21 VARCHAR(10),c22 VARCHAR(10),c23 VARCHAR(10),c24 VARCHAR(10),c25 VARCHAR(10),c26 VARCHAR(10),c27 VARCHAR(10),c28 VARCHAR(10),c29 VARCHAR(10),c30 VARCHAR(10),c31 VARCHAR(10),c32 VARCHAR(10),c33 VARCHAR(10),c34 VARCHAR(10),c35 VARCHAR(10),c36 VARCHAR(10),c37 VARCHAR(10),c38 VARCHAR(10),c39 VARCHAR(10),c40 VARCHAR(10),c41 VARCHAR(10),c42 VARCHAR(10),c43 VARCHAR(10),c44 VARCHAR(10),c45 VARCHAR(10),c46 VARCHAR(10),c47 VARCHAR(10),c48 VARCHAR(10),c49 VARCHAR(10),c50 VARCHAR(10),c51 VARCHAR(10),c52 VARCHAR(10),c53 VARCHAR(10),c54 VARCHAR(10),c55 VARCHAR(10),c56 VARCHAR(10),c57 VARCHAR(10),c58 VARCHAR(10),c59 VARCHAR(10),c60 VARCHAR(10),c61 VARCHAR(10),c62 VARCHAR(10),c63 VARCHAR(10),c64 VARCHAR(10),c65 VARCHAR(10),c66 VARCHAR(10),c67 VARCHAR(10),c68 VARCHAR(10),c69 VARCHAR(10),c70 VARCHAR(10),c71 VARCHAR(10),c72 VARCHAR(10),c73 VARCHAR(10),c74 VARCHAR(10),c75 VARCHAR(10),c76 VARCHAR(10),c77 VARCHAR(10),c78 VARCHAR(10),c79 VARCHAR(10),c80 VARCHAR(10),c81 VARCHAR(10),c82 VARCHAR(10),c83 VARCHAR(10),c84 VARCHAR(10),c85 VARCHAR(10),c86 VARCHAR(10),c87 VARCHAR(10),c88 VARCHAR(10),c89 VARCHAR(10),c90 VARCHAR(10),c91 VARCHAR(10),c92 VARCHAR(10),c93 VARCHAR(10),c94 VARCHAR(10),c95 VARCHAR(10),c96 VARCHAR(10),c97 VARCHAR(10),c98 VARCHAR(10),c99 VARCHAR(10),c100 VARCHAR(10),c101 VARCHAR(10),c102 VARCHAR(10),c103 VARCHAR(10),c104 VARCHAR(10),c105 VARCHAR(10),c106 VARCHAR(10),c107 VARCHAR(10),c108 VARCHAR(10),c109 VARCHAR(10),c110 VARCHAR(10),c111 VARCHAR(10),c112 VARCHAR(10),c113 VARCHAR(10),c114 VARCHAR(10),c115 VARCHAR(10),c116 VARCHAR(10),c117 VARCHAR(10),c118 VARCHAR(10),c119 VARCHAR(10),c120 VARCHAR(10),c121 VARCHAR(10),c122 VARCHAR(10),c123 VARCHAR(10),c124 VARCHAR(10),c125 VARCHAR(10),c126 VARCHAR(10),c127 VARCHAR(10),c128 VARCHAR(10),c129 VARCHAR(10),c130 VARCHAR(10),c131 VARCHAR(10),c132 VARCHAR(10),c133 VARCHAR(10),c134 VARCHAR(10),c135 VARCHAR(10),c136 VARCHAR(10),c137 VARCHAR(10),c138 VARCHAR(10),c139 VARCHAR(10),c140 VARCHAR(10),c141 VARCHAR(10),c142 VARCHAR(10),c143 VARCHAR(10),c144 VARCHAR(10),c145 VARCHAR(10),c146 VARCHAR(10),c147 VARCHAR(10),c148 VARCHAR(10),c149 VARCHAR(10),c150 VARCHAR(10),c151 VARCHAR(10),c152 VARCHAR(10),c153 VARCHAR(10),c154 VARCHAR(10),c155 VARCHAR(10),c156 VARCHAR(10),c157 VARCHAR(10),c158 VARCHAR(10),c159 VARCHAR(10),c160 VARCHAR(10),c161 VARCHAR(10),c162 VARCHAR(10),c163 VARCHAR(10),c164 VARCHAR(10),c165 VARCHAR(10),c166 VARCHAR(10),c167 VARCHAR(10),c168 VARCHAR(10),c169 VARCHAR(10),c170 VARCHAR(10),c171 VARCHAR(10),c172 VARCHAR(10),c173 VARCHAR(10),c174 VARCHAR(10),c175 VARCHAR(10),c176 VARCHAR(10),c177 VARCHAR(10),c178 VARCHAR(10),c179 VARCHAR(10),c180 VARCHAR(10),c181 VARCHAR(10),c182 VARCHAR(10),c183 VARCHAR(10),c184 VARCHAR(10),c185 VARCHAR(10),c186 VARCHAR(10),c187 VARCHAR(10),c188 VARCHAR(10),c189 VARCHAR(10),c190 VARCHAR(10),c191 VARCHAR(10),c192 VARCHAR(10),c193 VARCHAR(10),c194 VARCHAR(10),c195 VARCHAR(10),c196 VARCHAR(10),c197 VARCHAR(10),c198 VARCHAR(10),c199 VARCHAR(10),c200 VARCHAR(10),c201 VARCHAR(10),c202 VARCHAR(10),c203 VARCHAR(10),c204 VARCHAR(10),c205 VARCHAR(10),c206 VARCHAR(10),c207 VARCHAR(10),c208 VARCHAR(10),c209 VARCHAR(10),c210 VARCHAR(10),c211 VARCHAR(10),c212 VARCHAR(10),c213 VARCHAR(10),c214 VARCHAR(10),c215 VARCHAR(10),c216 VARCHAR(10),c217 VARCHAR(10),c218 VARCHAR(10),c219 VARCHAR(10),c220 VARCHAR(10),c221 VARCHAR(10),c222 VARCHAR(10),c223 VARCHAR(10),c224 VARCHAR(10),c225 VARCHAR(10),c226 VARCHAR(10),c227 VARCHAR(10),c228 VARCHAR(10),c229 VARCHAR(10),c230 VARCHAR(10),c231 VARCHAR(10),c232 VARCHAR(10),c233 VARCHAR(10),c234 VARCHAR(10),c235 VARCHAR(10),c236 VARCHAR(10),c237 VARCHAR(10),c238 VARCHAR(10),c239 VARCHAR(10),c240 VARCHAR(10),c241 VARCHAR(10),c242 VARCHAR(10),c243 VARCHAR(10),c244 VARCHAR(10),c245 VARCHAR(10),c246 VARCHAR(10),c247 VARCHAR(10),c248 VARCHAR(10),c249 VARCHAR(10),c250 VARCHAR(10),c251 VARCHAR(10),c252 VARCHAR(10),c253 VARCHAR(10),c254 VARCHAR(10),c255 VARCHAR(10),c256 VARCHAR(10),c257 VARCHAR(10),c258 VARCHAR(10),c259 VARCHAR(10),c260 VARCHAR(10),c261 VARCHAR(10),c262 VARCHAR(10),c263 VARCHAR(10),c264 VARCHAR(10),c265 VARCHAR(10),c266 VARCHAR(10),c267 VARCHAR(10),c268 VARCHAR(10),c269 VARCHAR(10),c270 VARCHAR(10),c271 VARCHAR(10),c272 VARCHAR(10),c273 VARCHAR(10),c274 VARCHAR(10),c275 VARCHAR(10),c276 VARCHAR(10),c277 VARCHAR(10),c278 VARCHAR(10),c279 VARCHAR(10),c280 VARCHAR(10),c281 VARCHAR(10),c282 VARCHAR(10),c283 VARCHAR(10),c284 VARCHAR(10),c285 VARCHAR(10),c286 VARCHAR(10),c287 VARCHAR(10),c288 VARCHAR(10),c289 VARCHAR(10),c290 VARCHAR(10),c291 VARCHAR(10),c292 VARCHAR(10),c293 VARCHAR(10),c294 VARCHAR(10),c295 VARCHAR(10),c296 VARCHAR(10),c297 VARCHAR(10),c298 VARCHAR(10),c299 VARCHAR(10),c300 VARCHAR(10),c301 VARCHAR(10),c302 VARCHAR(10),c303 VARCHAR(10),c304 VARCHAR(10),c305 VARCHAR(10),c306 VARCHAR(10),c307 VARCHAR(10),c308 VARCHAR(10),c309 VARCHAR(10),c310 VARCHAR(10),c311 VARCHAR(10),c312 VARCHAR(10),c313 VARCHAR(10),c314 VARCHAR(10),c315 VARCHAR(10),c316 VARCHAR(10),c317 VARCHAR(10),c318 VARCHAR(10),c319 VARCHAR(10),c320 VARCHAR(10),c321 VARCHAR(10),c322 VARCHAR(10),c323 VARCHAR(10),c324 VARCHAR(10),c325 VARCHAR(10),c326 VARCHAR(10),c327 VARCHAR(10),c328 VARCHAR(10),c329 VARCHAR(10),c330 VARCHAR(10),c331 VARCHAR(10),c332 VARCHAR(10),c333 VARCHAR(10),c334 VARCHAR(10),c335 VARCHAR(10),c336 VARCHAR(10),c337 VARCHAR(10),c338 VARCHAR(10),c339 VARCHAR(10),c340 VARCHAR(10),c341 VARCHAR(10),c342 VARCHAR(10),c343 VARCHAR(10),c344 VARCHAR(10),c345 VARCHAR(10),c346 VARCHAR(10),c347 VARCHAR(10),c348 VARCHAR(10),c349 VARCHAR(10),c350 VARCHAR(10),c351 VARCHAR(10),c352 VARCHAR(10),c353 VARCHAR(10),c354 VARCHAR(10),c355 VARCHAR(10),c356 VARCHAR(10),c357 VARCHAR(10),c358 VARCHAR(10),c359 VARCHAR(10),c360 VARCHAR(10),c361 VARCHAR(10),c362 VARCHAR(10),c363 VARCHAR(10),c364 VARCHAR(10),c365 VARCHAR(10),c366 VARCHAR(10),c367 VARCHAR(10),c368 VARCHAR(10),c369 VARCHAR(10),c370 VARCHAR(10),c371 VARCHAR(10),c372 VARCHAR(10),c373 VARCHAR(10),c374 VARCHAR(10),c375 VARCHAR(10),c376 VARCHAR(10),c377 VARCHAR(10),c378 VARCHAR(10),c379 VARCHAR(10),c380 VARCHAR(10),c381 VARCHAR(10),c382 VARCHAR(10),c383 VARCHAR(10),c384 VARCHAR(10),c385 VARCHAR(10),c386 VARCHAR(10),c387 VARCHAR(10),c388 VARCHAR(10),c389 VARCHAR(10),c390 VARCHAR(10),c391 VARCHAR(10),c392 VARCHAR(10),c393 VARCHAR(10),c394 VARCHAR(10),c395 VARCHAR(10),c396 VARCHAR(10),c397 VARCHAR(10),c398 VARCHAR(10),c399 VARCHAR(10),c400 VARCHAR(10),c401 VARCHAR(10),c402 VARCHAR(10),c403 VARCHAR(10),c404 VARCHAR(10),c405 VARCHAR(10),c406 VARCHAR(10),c407 VARCHAR(10),c408 VARCHAR(10),c409 VARCHAR(10),c410 VARCHAR(10),c411 VARCHAR(10),c412 VARCHAR(10),c413 VARCHAR(10),c414 VARCHAR(10),c415 VARCHAR(10),c416 VARCHAR(10),c417 VARCHAR(10),c418 VARCHAR(10),c419 VARCHAR(10),c420 VARCHAR(10),c421 VARCHAR(10),c422 VARCHAR(10),c423 VARCHAR(10),c424 VARCHAR(10),c425 VARCHAR(10),c426 VARCHAR(10),c427 VARCHAR(10),c428 VARCHAR(10),c429 VARCHAR(10),c430 VARCHAR(10),c431 VARCHAR(10),c432 VARCHAR(10),c433 VARCHAR(10),c434 VARCHAR(10),c435 VARCHAR(10),c436 VARCHAR(10),c437 VARCHAR(10),c438 VARCHAR(10),c439 VARCHAR(10),c440 VARCHAR(10),c441 VARCHAR(10),c442 VARCHAR(10),c443 VARCHAR(10),c444 VARCHAR(10),c445 VARCHAR(10),c446 VARCHAR(10),c447 VARCHAR(10),c448 VARCHAR(10),c449 VARCHAR(10),c450 VARCHAR(10),c451 VARCHAR(10),c452 VARCHAR(10),c453 VARCHAR(10),c454 VARCHAR(10),c455 VARCHAR(10),c456 VARCHAR(10),c457 VARCHAR(10),c458 VARCHAR(10),c459 VARCHAR(10),c460 VARCHAR(10),c461 VARCHAR(10),c462 VARCHAR(10),c463 VARCHAR(10),c464 VARCHAR(10),c465 VARCHAR(10),c466 VARCHAR(10),c467 VARCHAR(10),c468 VARCHAR(10),c469 VARCHAR(10),c470 VARCHAR(10),c471 VARCHAR(10),c472 VARCHAR(10),c473 VARCHAR(10),c474 VARCHAR(10),c475 VARCHAR(10),c476 VARCHAR(10),c477 VARCHAR(10),c478 VARCHAR(10),c479 VARCHAR(10),c480 VARCHAR(10),c481 VARCHAR(10),c482 VARCHAR(10),c483 VARCHAR(10),c484 VARCHAR(10),c485 VARCHAR(10),c486 VARCHAR(10),c487 VARCHAR(10),c488 VARCHAR(10),c489 VARCHAR(10),c490 VARCHAR(10),c491 VARCHAR(10),c492 VARCHAR(10),c493 VARCHAR(10),c494 VARCHAR(10),c495 VARCHAR(10),c496 VARCHAR(10),c497 VARCHAR(10),c498 VARCHAR(10),c499 VARCHAR(10),c500 VARCHAR(10),c501 VARCHAR(10),c502 VARCHAR(10),c503 VARCHAR(10),c504 VARCHAR(10),c505 VARCHAR(10),c506 VARCHAR(10),c507 VARCHAR(10),c508 VARCHAR(10),c509 VARCHAR(10),c510 VARCHAR(10),c511 VARCHAR(10),c512 VARCHAR(10),c513 VARCHAR(10),c514 VARCHAR(10),c515 VARCHAR(10),c516 VARCHAR(10),c517 VARCHAR(10),c518 VARCHAR(10),c519 VARCHAR(10),c520 VARCHAR(10),c521 VARCHAR(10),c522 VARCHAR(10),c523 VARCHAR(10),c524 VARCHAR(10),c525 VARCHAR(10),c526 VARCHAR(10),c527 VARCHAR(10),c528 VARCHAR(10),c529 VARCHAR(10),c530 VARCHAR(10),c531 VARCHAR(10),c532 VARCHAR(10),c533 VARCHAR(10),c534 VARCHAR(10),c535 VARCHAR(10),c536 VARCHAR(10),c537 VARCHAR(10),c538 VARCHAR(10),c539 VARCHAR(10),c540 VARCHAR(10),c541 VARCHAR(10),c542 VARCHAR(10),c543 VARCHAR(10),c544 VARCHAR(10),c545 VARCHAR(10),c546 VARCHAR(10),c547 VARCHAR(10),c548 VARCHAR(10),c549 VARCHAR(10),c550 VARCHAR(10),c551 VARCHAR(10),c552 VARCHAR(10),c553 VARCHAR(10),c554 VARCHAR(10),c555 VARCHAR(10),c556 VARCHAR(10),c557 VARCHAR(10),c558 VARCHAR(10),c559 VARCHAR(10),c560 VARCHAR(10),c561 VARCHAR(10),c562 VARCHAR(10),c563 VARCHAR(10),c564 VARCHAR(10),c565 VARCHAR(10),c566 VARCHAR(10),c567 VARCHAR(10),c568 VARCHAR(10),c569 VARCHAR(10),c570 VARCHAR(10),c571 VARCHAR(10),c572 VARCHAR(10),c573 VARCHAR(10),c574 VARCHAR(10),c575 VARCHAR(10),c576 VARCHAR(10),c577 VARCHAR(10),c578 VARCHAR(10),c579 VARCHAR(10),c580 VARCHAR(10),c581 VARCHAR(10),c582 VARCHAR(10),c583 VARCHAR(10),c584 VARCHAR(10),c585 VARCHAR(10),c586 VARCHAR(10),c587 VARCHAR(10),c588 VARCHAR(10),c589 VARCHAR(10),c590 VARCHAR(10),c591 VARCHAR(10),c592 VARCHAR(10),c593 VARCHAR(10),c594 VARCHAR(10),c595 VARCHAR(10),c596 VARCHAR(10),c597 VARCHAR(10),c598 VARCHAR(10),c599 VARCHAR(10),c600 VARCHAR(10),c601 VARCHAR(10),c602 VARCHAR(10),c603 VARCHAR(10),c604 VARCHAR(10),c605 VARCHAR(10),c606 VARCHAR(10),c607 VARCHAR(10),c608 VARCHAR(10),c609 VARCHAR(10),c610 VARCHAR(10),c611 VARCHAR(10),c612 VARCHAR(10),c613 VARCHAR(10),c614 VARCHAR(10),c615 VARCHAR(10),c616 VARCHAR(10),c617 VARCHAR(10),c618 VARCHAR(10),c619 VARCHAR(10),c620 VARCHAR(10),c621 VARCHAR(10),c622 VARCHAR(10),c623 VARCHAR(10),c624 VARCHAR(10),c625 VARCHAR(10),c626 VARCHAR(10),c627 VARCHAR(10),c628 VARCHAR(10),c629 VARCHAR(10),c630 VARCHAR(10),c631 VARCHAR(10),c632 VARCHAR(10),c633 VARCHAR(10),c634 VARCHAR(10),c635 VARCHAR(10),c636 VARCHAR(10),c637 VARCHAR(10),c638 VARCHAR(10),c639 VARCHAR(10),c640 VARCHAR(10),c641 VARCHAR(10),c642 VARCHAR(10),c643 VARCHAR(10),c644 VARCHAR(10),c645 VARCHAR(10),c646 VARCHAR(10),c647 VARCHAR(10),c648 VARCHAR(10),c649 VARCHAR(10),c650 VARCHAR(10),c651 VARCHAR(10),c652 VARCHAR(10),c653 VARCHAR(10),c654 VARCHAR(10),c655 VARCHAR(10),c656 VARCHAR(10),c657 VARCHAR(10),c658 VARCHAR(10),c659 VARCHAR(10),c660 VARCHAR(10),c661 VARCHAR(10),c662 VARCHAR(10),c663 VARCHAR(10),c664 VARCHAR(10),c665 VARCHAR(10),c666 VARCHAR(10),c667 VARCHAR(10),c668 VARCHAR(10),c669 VARCHAR(10),c670 VARCHAR(10),c671 VARCHAR(10),c672 VARCHAR(10),c673 VARCHAR(10),c674 VARCHAR(10),c675 VARCHAR(10),c676 VARCHAR(10),c677 VARCHAR(10),c678 VARCHAR(10),c679 VARCHAR(10),c680 VARCHAR(10),c681 VARCHAR(10),c682 VARCHAR(10),c683 VARCHAR(10),c684 VARCHAR(10),c685 VARCHAR(10),c686 VARCHAR(10),c687 VARCHAR(10),c688 VARCHAR(10),c689 VARCHAR(10),c690 VARCHAR(10),c691 VARCHAR(10),c692 VARCHAR(10),c693 VARCHAR(10),c694 VARCHAR(10),c695 VARCHAR(10),c696 VARCHAR(10),c697 VARCHAR(10),c698 VARCHAR(10),c699 VARCHAR(10),c700 VARCHAR(10),c701 VARCHAR(10),c702 VARCHAR(10),c703 VARCHAR(10),c704 VARCHAR(10),c705 VARCHAR(10),c706 VARCHAR(10),c707 VARCHAR(10),c708 VARCHAR(10),c709 VARCHAR(10),c710 VARCHAR(10),c711 VARCHAR(10),c712 VARCHAR(10),c713 VARCHAR(10),c714 VARCHAR(10),c715 VARCHAR(10),c716 VARCHAR(10),c717 VARCHAR(10),c718 VARCHAR(10),c719 VARCHAR(10),c720 VARCHAR(10),c721 VARCHAR(10),c722 VARCHAR(10),c723 VARCHAR(10),c724 VARCHAR(10),c725 VARCHAR(10),c726 VARCHAR(10),c727 VARCHAR(10),c728 VARCHAR(10),c729 VARCHAR(10),c730 VARCHAR(10),c731 VARCHAR(10),c732 VARCHAR(10),c733 VARCHAR(10),c734 VARCHAR(10),c735 VARCHAR(10),c736 VARCHAR(10),c737 VARCHAR(10),c738 VARCHAR(10),c739 VARCHAR(10),c740 VARCHAR(10),c741 VARCHAR(10),c742 VARCHAR(10),c743 VARCHAR(10),c744 VARCHAR(10),c745 VARCHAR(10),c746 VARCHAR(10),c747 VARCHAR(10),c748 VARCHAR(10),c749 VARCHAR(10),c750 VARCHAR(10),c751 VARCHAR(10),c752 VARCHAR(10),c753 VARCHAR(10),c754 VARCHAR(10),c755 VARCHAR(10),c756 VARCHAR(10),c757 VARCHAR(10),c758 VARCHAR(10),c759 VARCHAR(10),c760 VARCHAR(10),c761 VARCHAR(10),c762 VARCHAR(10),c763 VARCHAR(10),c764 VARCHAR(10),c765 VARCHAR(10),c766 VARCHAR(10),c767 VARCHAR(10),c768 VARCHAR(10),c769 VARCHAR(10),c770 VARCHAR(10),c771 VARCHAR(10),c772 VARCHAR(10),c773 VARCHAR(10),c774 VARCHAR(10),c775 VARCHAR(10),c776 VARCHAR(10),c777 VARCHAR(10),c778 VARCHAR(10),c779 VARCHAR(10),c780 VARCHAR(10),c781 VARCHAR(10),c782 VARCHAR(10),c783 VARCHAR(10),c784 VARCHAR(10),c785 VARCHAR(10),c786 VARCHAR(10),c787 VARCHAR(10),c788 VARCHAR(10),c789 VARCHAR(10),c790 VARCHAR(10),c791 VARCHAR(10),c792 VARCHAR(10),c793 VARCHAR(10),c794 VARCHAR(10),c795 VARCHAR(10),c796 VARCHAR(10),c797 VARCHAR(10),c798 VARCHAR(10),c799 VARCHAR(10),c800 VARCHAR(10),c801 VARCHAR(10),c802 VARCHAR(10),c803 VARCHAR(10),c804 VARCHAR(10),c805 VARCHAR(10),c806 VARCHAR(10),c807 VARCHAR(10),c808 VARCHAR(10),c809 VARCHAR(10),c810 VARCHAR(10),c811 VARCHAR(10),c812 VARCHAR(10),c813 VARCHAR(10),c814 VARCHAR(10),c815 VARCHAR(10),c816 VARCHAR(10),c817 VARCHAR(10),c818 VARCHAR(10),c819 VARCHAR(10),c820 VARCHAR(10),c821 VARCHAR(10),c822 VARCHAR(10),c823 VARCHAR(10),c824 VARCHAR(10),c825 VARCHAR(10),c826 VARCHAR(10),c827 VARCHAR(10),c828 VARCHAR(10),c829 VARCHAR(10),c830 VARCHAR(10),c831 VARCHAR(10),c832 VARCHAR(10),c833 VARCHAR(10),c834 VARCHAR(10),c835 VARCHAR(10),c836 VARCHAR(10),c837 VARCHAR(10),c838 VARCHAR(10),c839 VARCHAR(10),c840 VARCHAR(10),c841 VARCHAR(10),c842 VARCHAR(10),c843 VARCHAR(10),c844 VARCHAR(10),c845 VARCHAR(10),c846 VARCHAR(10),c847 VARCHAR(10),c848 VARCHAR(10),c849 VARCHAR(10),c850 VARCHAR(10),c851 VARCHAR(10),c852 VARCHAR(10),c853 VARCHAR(10),c854 VARCHAR(10),c855 VARCHAR(10),c856 VARCHAR(10),c857 VARCHAR(10),c858 VARCHAR(10),c859 VARCHAR(10),c860 VARCHAR(10),c861 VARCHAR(10),c862 VARCHAR(10),c863 VARCHAR(10),c864 VARCHAR(10),c865 VARCHAR(10),c866 VARCHAR(10),c867 VARCHAR(10),c868 VARCHAR(10),c869 VARCHAR(10),c870 VARCHAR(10),c871 VARCHAR(10),c872 VARCHAR(10),c873 VARCHAR(10),c874 VARCHAR(10),c875 VARCHAR(10),c876 VARCHAR(10),c877 VARCHAR(10),c878 VARCHAR(10),c879 VARCHAR(10),c880 VARCHAR(10),c881 VARCHAR(10),c882 VARCHAR(10),c883 VARCHAR(10),c884 VARCHAR(10),c885 VARCHAR(10),c886 VARCHAR(10),c887 VARCHAR(10),c888 VARCHAR(10),c889 VARCHAR(10),c890 VARCHAR(10),c891 VARCHAR(10),c892 VARCHAR(10),c893 VARCHAR(10),c894 VARCHAR(10),c895 VARCHAR(10),c896 VARCHAR(10),c897 VARCHAR(10),c898 VARCHAR(10),c899 VARCHAR(10),c900 VARCHAR(10),c901 VARCHAR(10),c902 VARCHAR(10),c903 VARCHAR(10),c904 VARCHAR(10),c905 VARCHAR(10),c906 VARCHAR(10),c907 VARCHAR(10),c908 VARCHAR(10),c909 VARCHAR(10),c910 VARCHAR(10),c911 VARCHAR(10),c912 VARCHAR(10),c913 VARCHAR(10),c914 VARCHAR(10),c915 VARCHAR(10),c916 VARCHAR(10),c917 VARCHAR(10),c918 VARCHAR(10),c919 VARCHAR(10),c920 VARCHAR(10),c921 VARCHAR(10),c922 VARCHAR(10),c923 VARCHAR(10),c924 VARCHAR(10),c925 VARCHAR(10),c926 VARCHAR(10),c927 VARCHAR(10),c928 VARCHAR(10),c929 VARCHAR(10),c930 VARCHAR(10),c931 VARCHAR(10),c932 VARCHAR(10),c933 VARCHAR(10),c934 VARCHAR(10),c935 VARCHAR(10),c936 VARCHAR(10),c937 VARCHAR(10),c938 VARCHAR(10),c939 VARCHAR(10),c940 VARCHAR(10),c941 VARCHAR(10),c942 VARCHAR(10),c943 VARCHAR(10),c944 VARCHAR(10),c945 VARCHAR(10),c946 VARCHAR(10),c947 VARCHAR(10),c948 VARCHAR(10),c949 VARCHAR(10),c950 VARCHAR(10),c951 VARCHAR(10),c952 VARCHAR(10),c953 VARCHAR(10),c954 VARCHAR(10),c955 VARCHAR(10),c956 VARCHAR(10),c957 VARCHAR(10),c958 VARCHAR(10),c959 VARCHAR(10),c960 VARCHAR(10),c961 VARCHAR(10),c962 VARCHAR(10),c963 VARCHAR(10),c964 VARCHAR(10),c965 VARCHAR(10),c966 VARCHAR(10),c967 VARCHAR(10),c968 VARCHAR(10),c969 VARCHAR(10),c970 VARCHAR(10),c971 VARCHAR(10),c972 VARCHAR(10),c973 VARCHAR(10),c974 VARCHAR(10),c975 VARCHAR(10),c976 VARCHAR(10),c977 VARCHAR(10),c978 VARCHAR(10),c979 VARCHAR(10),c980 VARCHAR(10),c981 VARCHAR(10),c982 VARCHAR(10),c983 VARCHAR(10),c984 VARCHAR(10),c985 VARCHAR(10),c986 VARCHAR(10),c987 VARCHAR(10),c988 VARCHAR(10),c989 VARCHAR(10),c990 VARCHAR(10),c991 VARCHAR(10),c992 VARCHAR(10),c993 VARCHAR(10),c994 VARCHAR(10),c995 VARCHAR(10),c996 VARCHAR(10),c997 VARCHAR(10),c998 VARCHAR(10),c999 VARCHAR(10),c1000 VARCHAR(10) ) ;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
INSERT INTO t1(c1) VALUES('abc');
SELECT * FROM t1;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54 c55 c56 c57 c58 c59 c60 c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73 c74 c75 c76 c77 c78 c79 c80 c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92 c93 c94 c95 c96 c97 c98 c99 c100 c101 c102 c103 c104 c105 c106 c107 c108 c109 c110 c111 c112 c113 c114 c115 c116 c117 c118 c119 c120 c121 c122 c123 c124 c125 c126 c127 c128 c129 c130 c131 c132 c133 c134 c135 c136 c137 c138 c139 c140 c141 c142 c143 c144 c145 c146 c147 c148 c149 c150 c151 c152 c153 c154 c155 c156 c157 c158 c159 c160 c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 c181 c182 c183 c184 c185 c186 c187 c188 c189 c190 c191 c192 c193 c194 c195 c196 c197 c198 c199 c200 c201 c202 c203 c204 c205 c206 c207 c208 c209 c210 c211 c212 c213 c214 c215 c216 c217 c218 c219 c220 c221 c222 c223 c224 c225 c226 c227 c228 c229 c230 c231 c232 c233 c234 c235 c236 c237 c238 c239 c240 c241 c242 c243 c244 c245 c246 c247 c248 c249 c250 c251 c252 c253 c254 c255 c256 c257 c258 c259 c260 c261 c262 c263 c264 c265 c266 c267 c268 c269 c270 c271 c272 c273 c274 c275 c276 c277 c278 c279 c280 c281 c282 c283 c284 c285 c286 c287 c288 c289 c290 c291 c292 c293 c294 c295 c296 c297 c298 c299 c300 c301 c302 c303 c304 c305 c306 c307 c308 c309 c310 c311 c312 c313 c314 c315 c316 c317 c318 c319 c320 c321 c322 c323 c324 c325 c326 c327 c328 c329 c330 c331 c332 c333 c334 c335 c336 c337 c338 c339 c340 c341 c342 c343 c344 c345 c346 c347 c348 c349 c350 c351 c352 c353 c354 c355 c356 c357 c358 c359 c360 c361 c362 c363 c364 c365 c366 c367 c368 c369 c370 c371 c372 c373 c374 c375 c376 c377 c378 c379 c380 c381 c382 c383 c384 c385 c386 c387 c388 c389 c390 c391 c392 c393 c394 c395 c396 c397 c398 c399 c400 c401 c402 c403 c404 c405 c406 c407 c408 c409 c410 c411 c412 c413 c414 c415 c416 c417 c418 c419 c420 c421 c422 c423 c424 c425 c426 c427 c428 c429 c430 c431 c432 c433 c434 c435 c436 c437 c438 c439 c440 c441 c442 c443 c444 c445 c446 c447 c448 c449 c450 c451 c452 c453 c454 c455 c456 c457 c458 c459 c460 c461 c462 c463 c464 c465 c466 c467 c468 c469 c470 c471 c472 c473 c474 c475 c476 c477 c478 c479 c480 c481 c482 c483 c484 c485 c486 c487 c488 c489 c490 c491 c492 c493 c494 c495 c496 c497 c498 c499 c500 c501 c502 c503 c504 c505 c506 c507 c508 c509 c510 c511 c512 c513 c514 c515 c516 c517 c518 c519 c520 c521 c522 c523 c524 c525 c526 c527 c528 c529 c530 c531 c532 c533 c534 c535 c536 c537 c538 c539 c540 c541 c542 c543 c544 c545 c546 c547 c548 c549 c550 c551 c552 c553 c554 c555 c556 c557 c558 c559 c560 c561 c562 c563 c564 c565 c566 c567 c568 c569 c570 c571 c572 c573 c574 c575 c576 c577 c578 c579 c580 c581 c582 c583 c584 c585 c586 c587 c588 c589 c590 c591 c592 c593 c594 c595 c596 c597 c598 c599 c600 c601 c602 c603 c604 c605 c606 c607 c608 c609 c610 c611 c612 c613 c614 c615 c616 c617 c618 c619 c620 c621 c622 c623 c624 c625 c626 c627 c628 c629 c630 c631 c632 c633 c634 c635 c636 c637 c638 c639 c640 c641 c642 c643 c644 c645 c646 c647 c648 c649 c650 c651 c652 c653 c654 c655 c656 c657 c658 c659 c660 c661 c662 c663 c664 c665 c666 c667 c668 c669 c670 c671 c672 c673 c674 c675 c676 c677 c678 c679 c680 c681 c682 c683 c684 c685 c686 c687 c688 c689 c690 c691 c692 c693 c694 c695 c696 c697 c698 c699 c700 c701 c702 c703 c704 c705 c706 c707 c708 c709 c710 c711 c712 c713 c714 c715 c716 c717 c718 c719 c720 c721 c722 c723 c724 c725 c726 c727 c728 c729 c730 c731 c732 c733 c734 c735 c736 c737 c738 c739 c740 c741 c742 c743 c744 c745 c746 c747 c748 c749 c750 c751 c752 c753 c754 c755 c756 c757 c758 c759 c760 c761 c762 c763 c764 c765 c766 c767 c768 c769 c770 c771 c772 c773 c774 c775 c776 c777 c778 c779 c780 c781 c782 c783 c784 c785 c786 c787 c788 c789 c790 c791 c792 c793 c794 c795 c796 c797 c798 c799 c800 c801 c802 c803 c804 c805 c806 c807 c808 c809 c810 c811 c812 c813 c814 c815 c816 c817 c818 c819 c820 c821 c822 c823 c824 c825 c826 c827 c828 c829 c830 c831 c832 c833 c834 c835 c836 c837 c838 c839 c840 c841 c842 c843 c844 c845 c846 c847 c848 c849 c850 c851 c852 c853 c854 c855 c856 c857 c858 c859 c860 c861 c862 c863 c864 c865 c866 c867 c868 c869 c870 c871 c872 c873 c874 c875 c876 c877 c878 c879 c880 c881 c882 c883 c884 c885 c886 c887 c888 c889 c890 c891 c892 c893 c894 c895 c896 c897 c898 c899 c900 c901 c902 c903 c904 c905 c906 c907 c908 c909 c910 c911 c912 c913 c914 c915 c916 c917 c918 c919 c920 c921 c922 c923 c924 c925 c926 c927 c928 c929 c930 c931 c932 c933 c934 c935 c936 c937 c938 c939 c940 c941 c942 c943 c944 c945 c946 c947 c948 c949 c950 c951 c952 c953 c954 c955 c956 c957 c958 c959 c960 c961 c962 c963 c964 c965 c966 c967 c968 c969 c970 c971 c972 c973 c974 c975 c976 c977 c978 c979 c980 c981 c982 c983 c984 c985 c986 c987 c988 c989 c990 c991 c992 c993 c994 c995 c996 c997 c998 c999 c1000
diff --git a/mysql-test/suite/engines/funcs/r/ix_unique_lob.result b/mysql-test/suite/engines/funcs/r/ix_unique_lob.result
index 4554a912906..1b03012a96f 100644
--- a/mysql-test/suite/engines/funcs/r/ix_unique_lob.result
+++ b/mysql-test/suite/engines/funcs/r/ix_unique_lob.result
@@ -7,7 +7,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` tinyblob,
+ `c1` tinyblob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -21,7 +21,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` blob,
+ `c1` blob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -35,7 +35,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` mediumblob,
+ `c1` mediumblob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -49,7 +49,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` longblob,
+ `c1` longblob DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -63,7 +63,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` tinytext,
+ `c1` tinytext DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -77,7 +77,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` text,
+ `c1` text DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -91,7 +91,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` mediumtext,
+ `c1` mediumtext DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
@@ -105,7 +105,7 @@ t4
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
- `c1` longtext,
+ `c1` longtext DEFAULT NULL,
UNIQUE KEY `i1` (`c1`(100))
) ENGINE=ENGINE DEFAULT CHARSET=latin1
DROP TABLE t4;
diff --git a/mysql-test/suite/engines/funcs/r/rpl000011.result b/mysql-test/suite/engines/funcs/r/rpl000011.result
deleted file mode 100644
index dd0fa2fbe74..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl000011.result
+++ /dev/null
@@ -1,16 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1 (n int);
-insert into t1 values(1);
-stop slave;
-start slave;
-insert into t1 values(2);
-select * from t1;
-n
-1
-2
-drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl000017.result b/mysql-test/suite/engines/funcs/r/rpl000017.result
deleted file mode 100644
index 1c611357e64..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl000017.result
+++ /dev/null
@@ -1,18 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
-grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
-grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
-start slave;
-drop table if exists t1;
-create table t1(n int);
-insert into t1 values(24);
-select * from t1;
-n
-24
-drop table t1;
-delete from mysql.user where user="replicate";
diff --git a/mysql-test/suite/engines/funcs/r/rpl000010.result b/mysql-test/suite/engines/funcs/r/rpl_000010.result
index 65191ea411f..ae989f25e1b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl000010.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000010.result
@@ -1,14 +1,14 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
+connection slave;
select n from t1;
n
1
2
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_000011.result b/mysql-test/suite/engines/funcs/r/rpl_000011.result
new file mode 100644
index 00000000000..83bc0c207ce
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/r/rpl_000011.result
@@ -0,0 +1,18 @@
+include/master-slave.inc
+[connection master]
+create table t1 (n int);
+insert into t1 values(1);
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+insert into t1 values(2);
+connection slave;
+select * from t1;
+n
+1
+2
+connection master;
+drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl000013.result b/mysql-test/suite/engines/funcs/r/rpl_000013.result
index 37838bb88e0..87103d7821f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl000013.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000013.result
@@ -1,17 +1,19 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t2(n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
insert into t2 select * from t1;
+connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1 as t10;
+disconnect master;
+connection slave;
+connection master1;
insert into t2 values(6);
+disconnect master1;
+connection slave;
select * from t2;
n
1
@@ -23,6 +25,9 @@ n
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+connect master2,localhost,root,,;
+connection master2;
drop table if exists t1,t2;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_000015.result b/mysql-test/suite/engines/funcs/r/rpl_000015.result
index bb3620ebc84..7d8fea8f195 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_000015.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result
@@ -1,14 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
reset master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 107
-stop slave;
+master-bin.000001 329
+connection slave;
+include/stop_slave.inc
reset slave;
show slave status;
Slave_IO_State #
@@ -51,6 +48,16 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State
change master to master_host='127.0.0.1';
show slave status;
Slave_IO_State #
@@ -93,6 +100,16 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
show slave status;
@@ -136,7 +153,17 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
-start slave;
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State
+include/start_slave.inc
show slave status;
Slave_IO_State Waiting for master to send event
Master_Host 127.0.0.1
@@ -144,9 +171,9 @@ Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
-Read_Master_Log_Pos 107
+Read_Master_Log_Pos 329
Relay_Log_File slave-relay-bin.000002
-Relay_Log_Pos 254
+Relay_Log_Pos 629
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
@@ -159,8 +186,8 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 107
-Relay_Log_Space 410
+Exec_Master_Log_Pos 329
+Relay_Log_Space 938
Until_Condition None
Until_Log_File
Until_Log_Pos 0
@@ -178,15 +205,31 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 1
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it
+connection master;
drop table if exists t1;
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
+connection slave;
+connection slave;
SELECT * FROM t1 ORDER BY n;
n 10
n 45
n 90
+connection master;
SELECT * FROM t1 ORDER BY n;
n 10
n 45
n 90
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl000017.test b/mysql-test/suite/engines/funcs/r/rpl_000017.result
index 2ba321cd8c3..d1c453208c7 100644
--- a/mysql-test/suite/engines/funcs/t/rpl000017.test
+++ b/mysql-test/suite/engines/funcs/r/rpl_000017.result
@@ -1,22 +1,19 @@
-source include/master-slave.inc;
+include/master-slave.inc
+[connection master]
connection slave;
-stop slave;
connection master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
connection slave;
-start slave;
+include/start_slave.inc
connection master;
---disable_warnings
-drop table if exists t1;
---enable_warnings
create table t1(n int);
insert into t1 values(24);
-sync_slave_with_master;
+connection slave;
select * from t1;
+n
+24
connection master;
drop table t1;
delete from mysql.user where user="replicate";
-sync_slave_with_master;
-
-# End of 4.1 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result b/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result
index b092dd9e088..7204122b669 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_LD_INFILE.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
@@ -62,6 +59,8 @@ abasements
abasement
abased
abase
+connection slave;
+connection slave;
SELECT * FROM test.t1 ORDER BY a DESC;
a
aberration
@@ -114,4 +113,7 @@ abasements
abasement
abased
abase
+connection master;
DROP TABLE test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
deleted file mode 100644
index 7a901b65810..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
+++ /dev/null
@@ -1,41 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-SHOW SLAVE HOSTS;
-Server_id Host Port Rpl_recovery_rank Master_id
-2 127.0.0.1 SLAVE_PORT 0 1
-create table t1 ( n int);
-insert into t1 values (1),(2),(3),(4);
-insert into t1 values(5);
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-5
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-SELECT * FROM t1 ORDER BY n;
-n
-1
-2
-3
-4
-5
-drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff b/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff
new file mode 100644
index 00000000000..0c70e2c0cfc
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/r/rpl_alter,innodb.rdiff
@@ -0,0 +1,72 @@
+@@ -29,7 +29,7 @@
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ insert into t1 (a) values (1),((1<<32)-1);
+ select * from t1;
+ a b
+@@ -42,7 +42,7 @@
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ select * from t1;
+ a b
+ 1 NULL
+@@ -54,7 +54,7 @@
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ select * from t1;
+ a b
+ 1 NULL
+@@ -66,7 +66,7 @@
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ select * from t1;
+ a b
+ 1 NULL
+@@ -83,7 +83,7 @@
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ connection master;
+ create table t2 (a int unsigned auto_increment primary key, b int);
+ show create table t2;
+@@ -92,7 +92,7 @@
+ `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ alter table t2 modify a bigint;
+ show create table t2;
+ Table Create Table
+@@ -100,7 +100,7 @@
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ alter table t2 modify a bigint auto_increment;
+ show create table t2;
+ Table Create Table
+@@ -108,7 +108,7 @@
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+-) ENGINE=MyISAM DEFAULT CHARSET=latin1
++) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ drop table t1,t2;
+ #
+ # MDEV-8432: Slave cannot replicate signed integer-type values
diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter.result b/mysql-test/suite/engines/funcs/r/rpl_alter.result
index 6ef5ce3462a..4f709db9624 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_alter.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_alter.result
@@ -1,10 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop database if exists mysqltest;
+include/master-slave.inc
+[connection master]
create database mysqltest;
create table mysqltest.t1 ( n int);
alter table mysqltest.t1 add m int;
@@ -12,10 +7,126 @@ insert into mysqltest.t1 values (1,2);
create table mysqltest.t2 (n int);
insert into mysqltest.t2 values (45);
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
+connection slave;
select * from mysqltest.t2;
n m
1 2
select * from mysqltest.t3;
n
45
+connection master;
drop database mysqltest;
+connection slave;
+connection master;
+use test;
+#
+# Test bug where ALTER TABLE MODIFY didn't replicate properly
+#
+create table t1 (a int unsigned primary key, b int);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 (a) values (1),((1<<32)-1);
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a bigint;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a int unsigned;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(10) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+alter table t1 modify a bigint unsigned;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+connection slave;
+use test;
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+connection master;
+create table t2 (a int unsigned auto_increment primary key, b int);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 modify a bigint;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+alter table t2 modify a bigint auto_increment;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1,t2;
+#
+# MDEV-8432: Slave cannot replicate signed integer-type values
+# with high bit set to 1
+# Test replication when we have int on master and bigint on slave
+#
+create table t1 (a int unsigned primary key, b int);
+connection slave;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+alter table t1 modify a bigint unsigned;
+connection master;
+insert into t1 (a) values (1),((1<<32)-1);
+connection slave;
+select * from t1;
+a b
+1 NULL
+4294967295 NULL
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_alter_db.result b/mysql-test/suite/engines/funcs/r/rpl_alter_db.result
index 80b1a0e983f..56e82712bec 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_alter_db.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_alter_db.result
@@ -1,9 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-use mysql;
+include/master-slave.inc
+[connection master]
+==== Verify that alter database does not stop replication ====
+create database temp_db;
+use temp_db;
alter database collate latin1_bin;
-alter database collate latin1_swedish_ci;
+connection slave;
+==== Clean up ====
+connection master;
+drop database temp_db;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_bit.result b/mysql-test/suite/engines/funcs/r/rpl_bit.result
index 924de8a65f8..b83faa4a28a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_bit.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_bit.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (
dummyKey INTEGER NOT NULL,
@@ -95,6 +92,7 @@ hex(bit3)
15
24
35
+connection slave;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
oSupp sSuppD GSuppDf VNotSupp x034
5 5 3 2 1
@@ -135,4 +133,7 @@ hex(bit3)
15
24
35
+connection master;
DROP TABLE IF EXISTS test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result b/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result
index 9599660f18f..5c7e6fc55b6 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_bit_npk.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (
dummyKey INTEGER NOT NULL,
@@ -98,6 +95,7 @@ hex(bit3)
15
24
35
+connection slave;
SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
FROM test.t1
ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
@@ -140,6 +138,7 @@ hex(bit3)
15
24
35
+connection master;
CREATE TABLE test.t2 (a INT, b BIT(1));
INSERT INTO test.t2 VALUES (1, b'0');
INSERT INTO test.t2 VALUES (1, b'1');
@@ -156,6 +155,7 @@ SELECT * FROM test.t3 ORDER BY a,b;
a b
1 NULL
2 0
+connection slave;
SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
a hex(b)
1 0
@@ -164,6 +164,9 @@ SELECT * FROM test.t3 ORDER BY a,b;
a b
1 NULL
2 0
+connection master;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_change_master.result b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
index c187f16cc83..48cec72d917 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result
@@ -1,26 +1,29 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
+connection master;
create table t1(n int);
+connection slave;
select * from t1;
n
stop slave sql_thread;
+connection master;
insert into t1 values(1);
insert into t1 values(2);
-stop slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1
+connection slave;
+include/wait_for_slave_param.inc [Read_Master_Log_Pos]
+include/stop_slave.inc
change master to master_user='root';
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 192 # None 0 No # No 0 0 1
start slave;
select * from t1;
n
1
2
+connection master;
drop table t1;
+connection slave;
+connection master;
+CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
+MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
+CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_create_database.result b/mysql-test/suite/engines/funcs/r/rpl_create_database.result
index 15bb939eb57..28c11525d00 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_create_database.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_create_database.result
@@ -1,13 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
+connection slave;
DROP DATABASE IF EXISTS mysqltest_bob;
+connection master;
CREATE DATABASE mysqltest_prometheus;
CREATE DATABASE mysqltest_sisyfos;
CREATE DATABASE mysqltest_bob;
@@ -20,25 +18,19 @@ INSERT INTO t2 VALUES(2);
ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
USE mysqltest_sisyfos;
ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
-SHOW DATABASES;
-Database
-information_schema
-mtr
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_bob
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
-SHOW DATABASES;
-Database
-information_schema
-mtr
+connection slave;
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
+connection master;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
USE mysqltest_prometheus;
CREATE TABLE t1 (a INT);
@@ -46,25 +38,18 @@ INSERT INTO t1 VALUES (1);
CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
-SHOW DATABASES;
-Database
-information_schema
-mtr
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_bob
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
-SHOW DATABASES;
-Database
-information_schema
-mtr
+connection slave;
+SHOW DATABASES LIKE 'mysql%';
+Database (mysql%)
mysql
mysqltest_prometheus
mysqltest_sisyfos
-performance_schema
-test
USE mysqltest_prometheus;
SHOW TABLES;
Tables_in_mysqltest_prometheus
@@ -73,6 +58,9 @@ USE mysqltest_sisyfos;
SHOW TABLES;
Tables_in_mysqltest_sisyfos
t2
+connection master;
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_do_grant.result b/mysql-test/suite/engines/funcs/r/rpl_do_grant.result
index 50d181be0ca..9eca21b38e4 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_do_grant.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_do_grant.result
@@ -1,80 +1,331 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
+connection slave;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection master;
+create user rpl_do_grant@localhost;
grant select on *.* to rpl_do_grant@localhost;
grant drop on test.* to rpl_do_grant@localhost;
+connection slave;
show grants for rpl_do_grant@localhost;
Grants for rpl_do_grant@localhost
GRANT SELECT ON *.* TO 'rpl_do_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_do_grant'@'localhost'
+connection master;
set password for rpl_do_grant@localhost=password("does it work?");
-select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
-password<>_binary''
+connection slave;
+select authentication_string<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
+authentication_string<>_binary''
+1
+connection master;
+update mysql.user set authentication_string='' where user='rpl_do_grant';
+flush privileges;
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
+authentication_string<>''
+0
+set sql_mode='ANSI_QUOTES';
+set password for rpl_do_grant@localhost=password('does it work?');
+set sql_mode='';
+connection slave;
+select authentication_string<>'' from mysql.user where user='rpl_do_grant';
+authentication_string<>''
1
+connection master;
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
+connection slave;
delete from mysql.user where user=_binary'rpl_do_grant';
delete from mysql.db where user=_binary'rpl_do_grant';
flush privileges;
+connection master;
show grants for rpl_do_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+connection slave;
show grants for rpl_do_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant' on host 'localhost'
+connection master;
create user rpl_do_grant@localhost;
show grants for rpl_do_grant@localhost;
Grants for rpl_do_grant@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection slave;
show grants for rpl_do_grant@localhost;
Grants for rpl_do_grant@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant'@'localhost'
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection master;
rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+connection master;
grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
GRANT INSERT, DELETE ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+connection master;
revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
GRANT INSERT ON `mysqltest1`.* TO 'rpl_do_grant2'@'localhost'
+connection master;
revoke all privileges, grant option from rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+connection slave;
show grants for rpl_do_grant2@localhost;
Grants for rpl_do_grant2@localhost
GRANT USAGE ON *.* TO 'rpl_do_grant2'@'localhost'
+connection master;
drop user rpl_do_grant2@localhost;
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection slave;
show grants for rpl_do_grant2@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost'
+connection master;
+call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' error.* 1396");
+connection slave;
+connection master;
+DROP DATABASE IF EXISTS bug42217_db;
+CREATE DATABASE bug42217_db;
+GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost'
+ IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION;
+connection slave;
+connection master;
+connect create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,;
+connect create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,;
+connection create_rout_db_master;
+USE bug42217_db;
+CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30)
+BEGIN
+RETURN "INSIDE upgrade_del_func()";
+END//
+connection master;
+USE bug42217_db;
+SELECT * FROM mysql.procs_priv;
+Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
+localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine #
+SELECT upgrade_del_func();
+upgrade_del_func()
+INSIDE upgrade_del_func()
+connection slave;
+SELECT * FROM mysql.procs_priv;
+Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
+localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine #
+SHOW GRANTS FOR 'create_rout_db'@'localhost';
+Grants for create_rout_db@localhost
+GRANT USAGE ON *.* TO 'create_rout_db'@'localhost' IDENTIFIED BY PASSWORD '*08792480350CBA057BDE781B9DF183B263934601'
+GRANT CREATE ROUTINE ON `bug42217_db`.* TO 'create_rout_db'@'localhost' WITH GRANT OPTION
+GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO 'create_rout_db'@'localhost'
+USE bug42217_db;
+SHOW CREATE FUNCTION upgrade_del_func;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
+BEGIN
+RETURN "INSIDE upgrade_del_func()";
+END latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT upgrade_del_func();
+upgrade_del_func()
+INSIDE upgrade_del_func()
+"Check whether the definer user will be able to execute the replicated routine on slave"
+connection create_rout_db_slave;
+USE bug42217_db;
+SHOW CREATE FUNCTION upgrade_del_func;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+upgrade_del_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1
+BEGIN
+RETURN "INSIDE upgrade_del_func()";
+END latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT upgrade_del_func();
+upgrade_del_func()
+INSIDE upgrade_del_func()
+connection slave;
+DELETE FROM mysql.procs_priv;
+FLUSH PRIVILEGES;
+USE bug42217_db;
+"Can't execute the replicated routine on slave like before after procs privilege is deleted "
+SELECT upgrade_del_func();
+ERROR 42000: execute command denied to user 'create_rout_db'@'localhost' for routine 'bug42217_db.upgrade_del_func'
+"Test the user who creates a function on master doesn't exist on slave."
+"Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted"
+DROP USER 'create_rout_db'@'localhost';
+connection create_rout_db_master;
+CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30)
+BEGIN
+RETURN "INSIDE upgrade_alter_func()";
+END//
+connection master;
+SELECT upgrade_alter_func();
+upgrade_alter_func()
+INSIDE upgrade_alter_func()
+connection slave;
+SHOW CREATE FUNCTION upgrade_alter_func;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+upgrade_alter_func STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1
+BEGIN
+RETURN "INSIDE upgrade_alter_func()";
+END latin1 latin1_swedish_ci latin1_swedish_ci
+"Should no privilege record for upgrade_alter_func in mysql.procs_priv"
+SELECT * FROM mysql.procs_priv;
+Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp
+SELECT upgrade_alter_func();
+ERROR HY000: The user specified as a definer ('create_rout_db'@'localhost') does not exist
+disconnect create_rout_db_master;
+disconnect create_rout_db_slave;
+connection master;
+USE bug42217_db;
+DROP FUNCTION upgrade_del_func;
+DROP FUNCTION upgrade_alter_func;
+DROP DATABASE bug42217_db;
+connection slave;
+connection master;
+SET SQL_LOG_BIN= 0;
+DROP USER 'create_rout_db'@'localhost';
+SET SQL_LOG_BIN= 1;
+include/rpl_reset.inc
+USE test;
+######## BUG#49119 #######
+### i) test case from the 'how to repeat section'
+connection master;
+CREATE TABLE t1(c1 INT);
+CREATE PROCEDURE p1() SELECT * FROM t1 |
+REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost';
+ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
+connection slave;
+connection master;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+connection slave;
+### ii) Test case in which REVOKE partially succeeds
+connection master;
+include/rpl_reset.inc
+connection master;
+CREATE TABLE t1(c1 INT);
+CREATE PROCEDURE p1() SELECT * FROM t1 |
+CREATE USER 'user49119'@'localhost';
+GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost';
+##############################################################
+### Showing grants for both users: root and user49119 (master)
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO 'user49119'@'localhost'
+GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost'
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection slave;
+##############################################################
+### Showing grants for both users: root and user49119 (master)
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO 'user49119'@'localhost'
+GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost'
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection master;
+## This statement will make the revoke fail because root has no
+## execute grant. However, it will still revoke the grant for
+## user49119.
+REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost';
+ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
+##############################################################
+### Showing grants for both users: root and user49119 (master)
+### after revoke statement failure
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO 'user49119'@'localhost'
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection slave;
+#############################################################
+### Showing grants for both users: root and user49119 (slave)
+### after revoke statement failure (should match
+SHOW GRANTS FOR 'user49119'@'localhost';
+Grants for user49119@localhost
+GRANT USAGE ON *.* TO 'user49119'@'localhost'
+SHOW GRANTS FOR CURRENT_USER;
+Grants for root@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+##############################################################
+connection master;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+DROP USER 'user49119'@'localhost';
+connection slave;
+include/rpl_reset.inc
+connection master;
+grant all on *.* to foo@"1.2.3.4";
+revoke all privileges, grant option from "foo";
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
+connection slave;
+include/check_slave_no_error.inc
+connection master;
+DROP USER foo@"1.2.3.4";
+connection slave;
+
+# Bug#27606 GRANT statement should be replicated with DEFINER information
+include/rpl_reset.inc
+connection master;
+GRANT SELECT, INSERT ON mysql.user TO user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection slave;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection master;
+REVOKE SELECT ON mysql.user FROM user_bug27606@localhost;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection slave;
+SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606';
+Grantor
+root@localhost
+connection master;
+DROP USER user_bug27606@localhost;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_drop.result b/mysql-test/suite/engines/funcs/r/rpl_drop.result
index b83594c9bb1..74514fe7f61 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_drop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_drop.result
@@ -1,10 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-drop table if exists t1, t2;
+include/master-slave.inc
+[connection master]
create table t1 (a int);
drop table t1, t2;
-ERROR 42S02: Unknown table 't2'
+ERROR 42S02: Unknown table 'test.t2'
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_drop_db.result b/mysql-test/suite/engines/funcs/r/rpl_drop_db.result
index b2d56af34bc..1b132c20afc 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_drop_db.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_drop_db.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
drop database if exists mysqltest1;
create database mysqltest1;
create table mysqltest1.t1 (n int);
@@ -12,18 +9,20 @@ select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
create table mysqltest1.t2 (n int);
create table mysqltest1.t3 (n int);
drop database mysqltest1;
-ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17)
+ERROR HY000: Error dropping database (can't rmdir './mysqltest1', errno: 39 "Directory not empty")
use mysqltest1;
show tables;
Tables_in_mysqltest1
drop database mysqltest1;
-ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17)
+ERROR HY000: Error dropping database (can't rmdir './mysqltest1', errno: 39 "Directory not empty")
use mysqltest1;
show tables;
Tables_in_mysqltest1
use test;
create table t1 (n int);
insert into t1 values (1234);
+connection slave;
+connection slave;
use mysqltest1;
show tables;
Tables_in_mysqltest1
@@ -31,9 +30,9 @@ use test;
select * from t1;
n
1234
-drop table t1;
-stop slave;
-drop database mysqltest1;
-drop database mysqltest1;
+connection master;
use test;
drop table t1;
+drop database mysqltest1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result b/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result
index 257baa81b74..ed9060f8307 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_dual_pos_advance.result
@@ -1,22 +1,28 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
+connection master;
change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
-start slave;
+include/start_slave.inc
+connection slave;
create table t1 (n int);
+connection master;
+connection master;
create table t4 (n int);
create table t5 (n int);
create table t6 (n int);
+connection slave;
+connection slave;
+connection master;
show tables;
Tables_in_test
t1
t4
t5
t6
-stop slave;
+include/stop_slave.inc
reset slave;
drop table t1,t4,t5,t6;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
deleted file mode 100644
index b5e14d3adac..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
+++ /dev/null
@@ -1,12 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error
-load table t1 from master;
-ERROR 08S01: Error connecting to master: Master is not configured
-load table t1 from master;
-ERROR HY000: Error from master: 'Table 'test.t1' doesn't exist'
diff --git a/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result b/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result
index f211d5d9a2f..2017252f5d1 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_err_ignoredtable.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (a int primary key);
create table t4 (a int primary key);
insert into t1 values (1),(1);
Got one of the listed errors
insert into t4 values (1),(2);
+connection slave;
show tables like 't1';
Tables_in_test (t1)
show tables like 't4';
@@ -18,25 +16,36 @@ SELECT * FROM test.t4 ORDER BY a;
a
1
2
+connection master;
drop table t1;
+connection slave;
+connection master1;
select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10)
1
+connection master;
create table t2 (a int primary key);
insert into t2 values(1);
create table t3 (id int);
insert into t3 values(connection_id());
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
+connection master1;
select (@id := id) - id from t3;
(@id := id) - id
0
kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
+connection master;
+connection master1;
+connection slave;
SELECT * FROM test.t4 ORDER BY a;
a
1
2
3
4
+connection master1;
DROP TABLE test.t4;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
index 53a521aaf85..4a56880d97f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
@@ -1,21 +1,14 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
-start slave;
-stop slave;
+include/start_slave.inc
+connection master;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
-start slave;
-
-let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
+include/start_slave.inc
flush logs;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -24,7 +17,7 @@ Master_User root
Master_Port SLAVE_PORT
Connect_Retry 60
Master_Log_File slave-bin.000001
-Read_Master_Log_Pos 107
+Read_Master_Log_Pos 328
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File slave-bin.000001
@@ -39,7 +32,7 @@ Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
-Exec_Master_Log_Pos 107
+Exec_Master_Log_Pos 328
Relay_Log_Space #
Until_Condition None
Until_Log_File
@@ -58,4 +51,15 @@ Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 2
-STOP SLAVE;
+Master_SSL_Crl
+Master_SSL_Crlpath
+Using_Gtid No
+Gtid_IO_Pos
+Replicate_Do_Domain_Ids
+Replicate_Ignore_Domain_Ids
+Parallel_Mode conservative
+SQL_Delay 0
+SQL_Remaining_Delay NULL
+Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it
+stop slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_free_items.result b/mysql-test/suite/engines/funcs/r/rpl_free_items.result
index 91c1e2aa6e5..af7a267266f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_free_items.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_free_items.result
@@ -1,10 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (a int);
create table t2 (a int);
+connection slave;
+connection master;
drop table t1;
drop table t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_get_lock.result b/mysql-test/suite/engines/funcs/r/rpl_get_lock.result
index f7c9541bd9f..b852546e1bf 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_get_lock.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_get_lock.result
@@ -1,17 +1,17 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
create table t1(n int);
insert into t1 values(get_lock("lock",2));
+disconnect master;
+connection master1;
select get_lock("lock",2);
get_lock("lock",2)
1
select release_lock("lock");
release_lock("lock")
1
+connection slave;
select get_lock("lock",3);
get_lock("lock",3)
1
@@ -32,4 +32,7 @@ is_free_lock("lock2")
select is_free_lock(NULL);
is_free_lock(NULL)
NULL
+connection master1;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result
index 5169cc8e888..29e6bb6d6a4 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_grant.result
@@ -1,21 +1,23 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection slave;
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection master;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
show grants for rpl_ignore_grant@localhost;
Grants for rpl_ignore_grant@localhost
GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost'
GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost'
+connection slave;
show grants for rpl_ignore_grant@localhost;
ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost'
select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
@@ -25,13 +27,19 @@ select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
count(*)
0
grant select on *.* to rpl_ignore_grant@localhost;
+connection master;
set password for rpl_ignore_grant@localhost=password("does it work?");
+connection slave;
select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
password<>_binary''
0
+connection master;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection slave;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
+connection master;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result
index b1ccd2f0442..c86f2f4e4df 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_revoke.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
select_priv
N
+connection slave;
grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
revoke select on *.* from 'user_foo'@'%';
select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
@@ -18,13 +16,19 @@ grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
select_priv
Y
+connection master;
revoke select on *.* from 'user_foo';
select select_priv from mysql.user where user='user_foo' /* master:must be N */;
select_priv
N
+connection slave;
select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
select_priv
Y
+connection slave;
revoke select on *.* FROM 'user_foo';
+connection master;
delete from mysql.user where user="user_foo";
+connection slave;
delete from mysql.user where user="user_foo";
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result b/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result
index a88a3c690ed..d4efa2dc42e 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ignore_table_update.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
use test;
drop table if exists mysqltest_foo;
drop table if exists mysqltest_bar;
create table mysqltest_foo (n int);
insert into mysqltest_foo values(4);
+connection master;
use test;
create table mysqltest_foo (n int);
insert into mysqltest_foo values(5);
@@ -16,8 +14,12 @@ create table mysqltest_bar (m int);
insert into mysqltest_bar values(15);
create table t1 (k int);
insert into t1 values(55);
+connection slave;
select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
n m k
4 15 55
+connection master;
drop table mysqltest_foo,mysqltest_bar,t1;
+connection slave;
drop table mysqltest_foo,mysqltest_bar,t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_init_slave.result b/mysql-test/suite/engines/funcs/r/rpl_init_slave.result
index 740c918976c..a90de76f139 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_init_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_init_slave.result
@@ -1,9 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+set global max_connections=151;
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+connection slave;
show variables like 'init_slave';
Variable_name Value
init_slave set global max_connections=500
@@ -11,17 +13,21 @@ show variables like 'max_connections';
Variable_name Value
max_connections 500
reset master;
+connection master;
show variables like 'init_slave';
Variable_name Value
init_slave
show variables like 'max_connections';
Variable_name Value
max_connections 151
+connection slave;
set @my_global_init_connect= @@global.init_connect;
set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
-stop slave;
+connection master;
+connection slave;
set global init_connect= @my_global_init_connect;
set global max_connections= default;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_insert.result b/mysql-test/suite/engines/funcs/r/rpl_insert.result
index b6a97926f73..1e790387e71 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_insert.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_insert.result
@@ -1,23 +1,25 @@
#
# Bug#20821: INSERT DELAYED fails to write some rows to binlog
#
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
CREATE SCHEMA IF NOT EXISTS mysqlslap;
USE mysqlslap;
-CREATE TABLE t1 (id INT, name VARCHAR(64));
+CREATE TABLE t1 (id INT, name VARCHAR(64)) ENGINE=MyISAM;
+connection slave;
+connection master;
SELECT COUNT(*) FROM mysqlslap.t1;
COUNT(*)
5000
+connection slave;
SELECT COUNT(*) FROM mysqlslap.t1;
COUNT(*)
5000
#
# Cleanup
#
+connection master;
USE test;
DROP SCHEMA mysqlslap;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_insert_select.result b/mysql-test/suite/engines/funcs/r/rpl_insert_select.result
index 1aff39e0026..3c9b31ded56 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_insert_select.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_insert_select.result
@@ -1,17 +1,21 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (n int not null primary key);
insert into t1 values (1);
create table t2 (n int);
insert into t2 values (1);
insert ignore into t1 select * from t2;
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
insert into t1 values (2);
+connection slave;
+connection slave;
select * from t1;
n
1
2
+connection master;
drop table t1,t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result
index 5e3923616ed..d7a9a5981dc 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata2.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
@@ -78,6 +74,7 @@ Aberdeen
Abernathy
aberrant
aberration
+connection slave;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
@@ -150,4 +147,7 @@ Aberdeen
Abernathy
aberrant
aberration
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
index 4639c717cea..8e2bc2f0b1c 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_m.result
@@ -1,10 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop database if exists mysqltest;
+connection master;
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
@@ -18,6 +15,7 @@ LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
+connection slave;
SHOW DATABASES;
Database
information_schema
@@ -36,5 +34,8 @@ t1
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
+connection master;
DROP DATABASE mysqltest;
-DROP TABLE test.t1;
+DROP TABLE IF EXISTS test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
index 8b2da7ff9a1..1eb37dd4899 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
@@ -1,15 +1,16 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
+connection master;
create table test.t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
+connection slave;
select count(*) from test.t1;
count(*)
2
-show binlog events from 107;
-Log_name Pos Event_type Server_id End_log_pos Info
+include/show_binlog_events.inc
+connection master;
drop table test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result b/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result
index 4dd4289b657..f7034cb7968 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddatalocal.result
@@ -1,31 +1,37 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1(a int);
select * into outfile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1;
truncate table t1;
load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
+connection slave;
select a,count(*) from t1 group by a;
a count(*)
1 10000
+connection master;
drop table t1;
+connection slave;
+connection master;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
select * into outfile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key);
load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY a;
a
1
2
3
+connection slave;
SELECT * FROM t1 ORDER BY a;
a
1
2
3
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_loadfile.result b/mysql-test/suite/engines/funcs/r/rpl_loadfile.result
index 7a5a7bc50c9..fb40cbf3220 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_loadfile.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_loadfile.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
@@ -119,6 +116,8 @@ Abernathy
aberrant
aberration
+connection slave;
+connection slave;
SELECT * FROM test.t1 ORDER BY blob_column;
a blob_column
1 abase
@@ -223,5 +222,8 @@ Abernathy
aberrant
aberration
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
index df4512fa0ea..7f5f34bf831 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result
@@ -1,46 +1,37 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+create table if not exists t1 (n int);
+drop table t1;
+call mtr.add_suppression ("Slave I/O: Got fatal error 1236 from master when reading data from binary");
+call mtr.add_suppression ("Error in Log_event::read_log_event");
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 107 <Binlog_Ignore_DB>
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1
-stop slave;
-change master to master_log_pos=107;
-start slave;
-stop slave;
-change master to master_log_pos=107;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 No No 0 0 107 # None 0 No # No 0 0 1
-start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 107 # # master-bin.000001 Yes Yes 0 0 107 # None 0 No # No 0 0 1
-stop slave;
-change master to master_log_pos=178;
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
+connection slave;
+include/stop_slave.inc
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No 1236 Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position' 0 1
+include/wait_for_slave_io_error.inc [errno=1236]
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; 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_sql.inc
+connection master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 107 <Binlog_Ignore_DB>
+master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
-stop slave;
-change master to master_log_pos=207;
+connection slave;
+change master to master_log_pos=MASTER_LOG_POS;
start slave;
select * from t1 ORDER BY n;
n
1
2
3
+connection master;
drop table t1;
+connection slave;
+End of 5.0 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result b/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result
index b2148892591..82b1f685ea8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_many_optimize.result
@@ -1,9 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (a int not null auto_increment primary key, b int, key(b));
INSERT INTO t1 (a) VALUES (1),(2);
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result b/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result
deleted file mode 100644
index ab9b8cdad9d..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_master_pos_wait.result
+++ /dev/null
@@ -1,18 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-select master_pos_wait('master-bin.999999',0,2);
-master_pos_wait('master-bin.999999',0,2)
--1
-explain extended select master_pos_wait('master-bin.999999',0,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
-Warnings:
-Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
-select master_pos_wait('master-bin.999999',0);
-stop slave sql_thread;
-master_pos_wait('master-bin.999999',0)
-NULL
diff --git a/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result b/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result
index 5003a3e7d65..6c20623d62b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_misc_functions.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
create table t1(id int, i int, r1 int, r2 int, p varchar(100));
insert into t1 values(1, connection_id(), 0, 0, "");
insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
@@ -13,12 +10,50 @@ delete from t1 where id=6;
set sql_log_bin=1;
insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
-select * into outfile '../../tmp/rpl_misc_functions.outfile' from t1;
-create table t2 like t1;
-load data local infile 'MYSQLTEST_VARDIR/tmp/rpl_misc_functions.outfile' into table t2;
+select * into outfile 'rpl_misc_functions.outfile' from t1;
+connection slave;
+create temporary table t2 like t1;
+load data local infile 'MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2;
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
id i r1 r2 p id i r1 r2 p
-stop slave;
-drop table t1;
-drop table t2;
+connection master;
drop table t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+col_a DOUBLE DEFAULT NULL);
+CREATE PROCEDURE test_replication_sp1()
+BEGIN
+INSERT INTO t1 (col_a) VALUES (rand()), (rand());
+INSERT INTO t1 (col_a) VALUES (rand());
+END|
+CREATE PROCEDURE test_replication_sp2()
+BEGIN
+CALL test_replication_sp1();
+CALL test_replication_sp1();
+END|
+CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC
+BEGIN
+RETURN (rand() + rand());
+END|
+CALL test_replication_sp1();
+CALL test_replication_sp2();
+INSERT INTO t1 (col_a) VALUES (test_replication_sf());
+INSERT INTO t1 (col_a) VALUES (test_replication_sf());
+INSERT INTO t1 (col_a) VALUES (test_replication_sf());
+connection slave;
+select * from t1 into outfile "../../tmp/t1_slave.txt";
+connection master;
+create temporary table t1_slave select * from t1 where 1=0;
+load data infile '../../tmp/t1_slave.txt' into table t1_slave;
+select count(*) into @aux from t1 join t1_slave using (id)
+where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ;
+SELECT @aux;
+@aux
+12
+connection master;
+DROP TABLE t1, t1_slave;
+DROP PROCEDURE test_replication_sp1;
+DROP PROCEDURE test_replication_sp2;
+DROP FUNCTION test_replication_sf;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result b/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result
index 4831502eb88..62a0d74225d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_multi_delete.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
@@ -14,9 +10,13 @@ a
select * from t2;
a
1
+connection slave;
select * from t1;
a
select * from t2;
a
1
+connection master;
drop table t1,t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result b/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
index 8e6a6a3d4d0..0a316ec3452 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_multi_delete2.result
@@ -1,13 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
set sql_log_bin=0;
create database mysqltest_from;
set sql_log_bin=1;
+connection slave;
create database mysqltest_to;
+connection master;
use mysqltest_from;
drop table if exists a;
CREATE TABLE a (i INT);
@@ -20,10 +19,12 @@ delete alias FROM a alias where alias.i=2;
select * from a;
i
3
+connection slave;
use mysqltest_to;
select * from a;
i
3
+connection master;
create table t1 (a int primary key);
create table t2 (a int);
insert into t1 values (1);
@@ -34,11 +35,15 @@ a
select * from t2;
a
1
+connection slave;
select * from t1;
ERROR 42S02: Table 'mysqltest_to.t1' doesn't exist
select * from t2;
ERROR 42S02: Table 'mysqltest_to.t2' doesn't exist
+connection master;
set sql_log_bin=0;
drop database mysqltest_from;
set sql_log_bin=1;
+connection slave;
drop database mysqltest_to;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result b/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result
index f6dde65a35d..256c1c503ab 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_multi_update4.result
@@ -1,12 +1,11 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
drop database if exists d1;
drop database if exists d2;
+connection slave;
drop database if exists d2;
+connection master;
create database d1;
create table d1.t0 (id int);
create database d2;
@@ -17,9 +16,13 @@ insert into t1 values (1), (2), (3), (4), (5);
insert into t2 select id + 3 from t1;
update t1 join t2 using (id) set t1.id = 0;
insert into d1.t0 values (0);
+connection slave;
use d1;
select * from t0 where id=0;
id
0
+connection master;
drop database d1;
drop database d2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_ps.result b/mysql-test/suite/engines/funcs/r/rpl_ps.result
index 73c36af4862..57c2db05811 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_ps.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_ps.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop table if exists t1;
create table t1(n char(30));
prepare stmt1 from 'insert into t1 values (?)';
@@ -19,12 +15,40 @@ set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
+connection slave;
SELECT * FROM t1 ORDER BY n;
n
from-master-1
from-master-2-'',
from-var-from-master-3
+connection master;
drop table t1;
+connection slave;
stop slave;
-reset master;
-reset slave;
+include/wait_for_slave_to_stop.inc
+
+########################################################################
+#
+# BUG#25843: Changing default database between PREPARE and EXECUTE of
+# statement breaks binlog.
+#
+########################################################################
+connection slave;
+START SLAVE;
+connection master;
+CREATE DATABASE mysqltest1;
+CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
+PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
+EXECUTE stmt_d_1;
+use mysqltest1;
+EXECUTE stmt_d_1;
+connection slave;
+SELECT * FROM t1;
+db_name db_col_name
+test latin1_swedish_ci
+test latin1_swedish_ci
+connection master;
+DROP DATABASE mysqltest1;
+use test;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
deleted file mode 100644
index 13f7fbfbdeb..00000000000
--- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
+++ /dev/null
@@ -1,55 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-**** On Master ****
-CREATE TABLE t1 (a INT, b LONG);
-INSERT INTO t1 VALUES (1,1), (2,2);
-INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-SHOW BINLOG EVENTS;
-**** On Slave ****
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-SHOW BINLOG EVENTS;
-DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_relayspace.result b/mysql-test/suite/engines/funcs/r/rpl_relayspace.result
index 1f2a739d3e3..90bf18aaa88 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_relayspace.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_relayspace.result
@@ -1,19 +1,18 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+connection master;
create table t1 (a int);
drop table t1;
create table t1 (a int);
drop table t1;
+connection slave;
reset slave;
start slave io_thread;
-stop slave io_thread;
+include/wait_for_slave_param.inc [Slave_IO_State]
+include/stop_slave_io.inc
reset slave;
-start slave;
-select master_pos_wait('master-bin.001',200,6)=-1;
-master_pos_wait('master-bin.001',200,6)=-1
-0
+include/start_slave.inc
+include/assert.inc [Assert that master_pos_wait does not timeout nor it returns NULL]
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result b/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result
index 0135804c02d..1192f9860f2 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_replicate_ignore_db.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop database if exists mysqltest1;
drop database if exists mysqltest2;
create database mysqltest1;
@@ -11,13 +7,19 @@ create database mysqltest2;
use mysqltest1;
create table t1 (a int);
insert into t1 values(1);
+connection slave;
select * from mysqltest1.t1;
ERROR 42S02: Table 'mysqltest1.t1' doesn't exist
+connection master;
use mysqltest2;
create table t1 (a int);
insert into t1 values(1);
+connection slave;
select * from mysqltest2.t1;
a
1
+connection master;
drop database mysqltest1;
drop database mysqltest2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result b/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result
index 23f95878608..480ad34ce69 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_NOW.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create database if not exists mysqltest1;
DROP TABLE IF EXISTS mysqltest1.t1;
CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
@@ -24,6 +21,10 @@ FOR EACH ROW BEGIN
SET new.b = mysqltest1.f1();
END|
INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
+connection slave;
+connection master;
DROP TABLE IF EXISTS mysqltest1.t1;
DROP FUNCTION mysqltest1.f1;
DROP DATABASE mysqltest1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_USER.result b/mysql-test/suite/engines/funcs/r/rpl_row_USER.result
index c4774665307..2771c674f44 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_USER.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_USER.result
@@ -1,15 +1,15 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+set local sql_mode="";
+connection master;
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
CREATE USER tester IDENTIFIED BY 'test';
GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
GRANT ALL ON mysqltest1.* TO ''@'localhost%';
FLUSH PRIVILEGES;
+connect m_1,localhost,tester,,mysqltest1;
+connection m_1;
CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
INSERT INTO mysqltest1.t1 VALUES(1,USER());
INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
@@ -19,21 +19,26 @@ INSERT INTO mysqltest1.t1 VALUES(3,USER());
INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
end|
CALL mysqltest1.p1();
+connection master;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a users
1 tester@localhost
2 @localhost%
3 tester@localhost
4 @localhost%
+connection slave;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a users
1 tester@localhost
2 @localhost%
3 tester@localhost
4 @localhost%
+connection master;
+DROP DATABASE mysqltest1;
REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
-DROP DATABASE mysqltest1;
-DROP USER 'tester';
+DROP USER tester@'%';
DROP USER ''@'localhost%';
FLUSH PRIVILEGES;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
index d45bbadf7df..8753764e81e 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result
@@ -1,10 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-**** On Master ****
+include/master-slave.inc
+[connection master]
+connection master;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE TEMPORARY TABLE t2 (a int, b int);
@@ -12,47 +8,48 @@ SHOW TABLES;
Tables_in_test
t1
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Master ****
+connection master;
DROP TABLE t2;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Master ****
+connection master;
CREATE TEMPORARY TABLE t2 (a int, b int);
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t1
t2
-**** On Master ****
+connection master;
DROP TABLE t1,t2;
-SHOW BINLOG EVENTS;
+include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 4 Format_desc 1 107 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a int)
-master-bin.000001 193 Query 1 279 use `test`; CREATE TABLE t2 (a int)
-master-bin.000001 279 Query 1 403 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001 403 Query 1 527 use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001 527 Query 1 631 use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
SHOW TABLES;
Tables_in_test
t2
-**** On Slave ****
+connection slave;
SHOW TABLES;
Tables_in_test
t2
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_func001.result b/mysql-test/suite/engines/funcs/r/rpl_row_func001.result
index b20f3f724d0..ae05b5cf3c0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_func001.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_func001.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP FUNCTION test.f1;
DROP TABLE IF EXISTS test.t1;
create table test.t1 (a int, PRIMARY KEY(a));
@@ -22,9 +19,14 @@ select * from test.t1;
a
1
2
+connection slave;
+connection slave;
select * from test.t1;
a
1
2
+connection master;
DROP FUNCTION test.f1;
DROP TABLE test.t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
index aff54e01b95..e2bd199ecab 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
@@ -1,14 +1,12 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (a int not null primary key);
insert into t1 values (1);
create table t2 (a int);
insert into t2 values (1);
update t1, t2 set t1.a = 0 where t1.a = t2.a;
+connection slave;
show tables;
Tables_in_test
t1
@@ -16,46 +14,14 @@ select * from t1;
a
0
drop table t1;
+connection master;
insert into t1 values (1);
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table test.t2
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1146
-Last_Error Error executing row event: 'Table 'test.t1' doesn't exist'
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 1146
-Last_SQL_Error Error executing row event: 'Table 'test.t1' doesn't exist'
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
+connection slave;
+call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., error.* 1146");
+include/wait_for_slave_sql_error.inc [errno=1146]
+==== Clean up ====
+include/stop_slave_io.inc
+RESET SLAVE;
+connection master;
drop table t1, t2;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
index 547dd8e1541..41d18d7f9fe 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_max_relay_size.result
@@ -1,20 +1,19 @@
+include/master-slave.inc
+[connection master]
+connection slave;
stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+connection master;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int);
drop table t1;
+connection slave;
reset slave;
#
# Test 1
#
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
Warnings:
@@ -23,7 +22,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 2
#
@@ -33,17 +32,19 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 3: max_relay_log_size = 0
#
stop slave;
reset slave;
set global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
select @@global.max_relay_log_size;
-@@global.max_relay_log_size 0
+@@global.max_relay_log_size 4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -56,19 +57,27 @@ flush logs;
reset slave;
start slave;
flush logs;
+connection master;
create table t1 (a int);
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
+connection master;
drop table t1;
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
+connection master;
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
+connection slave;
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
#
# End of 4.1 tests
#
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
index 5499d41bc1f..b9e98d5a97d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_reset_slave.result
@@ -1,41 +1,58 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-Master_User root
-Master_Host 127.0.0.1
+include/master-slave.inc
+[connection master]
+connection slave;
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
change master to master_user='test';
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
reset slave;
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
change master to master_user='root';
include/start_slave.inc
-Master_User root
-Master_Host 127.0.0.1
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
reset slave;
include/start_slave.inc
+connection master;
create temporary table t1 (a int);
+connection slave;
include/stop_slave.inc
reset slave;
include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+connection master;
+drop temporary table if exists t1;
+connection slave;
include/stop_slave.inc
reset slave;
+include/check_slave_no_error.inc
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
change master to master_user='root';
include/start_slave.inc
+include/check_slave_no_error.inc
stop slave;
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
reset slave;
+include/check_slave_no_error.inc
+change master to master_user='root';
+reset slave;
+include/start_slave.inc
+include/stop_slave.inc
+reset slave all;
+start slave;
+ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
+include/start_slave.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result
index 8c26c061376..d37425c43a8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp001.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
<Begin test section 1 (non deterministic SP)>
---------------------------------------------
@@ -34,12 +30,14 @@ a t
2 NEW
3 NEW
4 NEW
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 NEW
2 NEW
3 NEW
4 NEW
+connection master;
call test.p2(1);
SELECT * FROM t2 ORDER BY a;
a t
@@ -47,12 +45,14 @@ a t
2 Tex
3 Tex
4 Tex
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 Tex
2 Tex
3 Tex
4 Tex
+connection master;
call test.p2(2);
SELECT * FROM t2 ORDER BY a;
a t
@@ -60,12 +60,14 @@ a t
2 SQL
3 SQL
4 SQL
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 SQL
2 SQL
3 SQL
4 SQL
+connection master;
call test.p2(3);
SELECT * FROM t2 ORDER BY a;
a t
@@ -73,13 +75,17 @@ a t
2 NONE
3 NONE
4 NONE
+connection slave;
SELECT * FROM t2 ORDER BY a;
a t
1 NONE
2 NONE
3 NONE
4 NONE
+connection master;
DROP PROCEDURE test.p1;
DROP PROCEDURE test.p2;
DROP TABLE test.t1;
DROP TABLE test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
index 58c53b394b2..8acc2e20202 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp005.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t2;
@@ -42,9 +39,6 @@ INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
INSERT INTO test.t2 VALUES (4),(2),(1),(3);
UPDATE test.t1 SET id=id+4 WHERE id=4;
END|
-
-< ---- Master selects-- >
--------------------------
CALL test.p2();
SELECT * FROM test.t1 ORDER BY id;
id data
@@ -58,9 +52,7 @@ id2
2
3
4
-
-< ---- Slave selects-- >
-------------------------
+connection slave;
SELECT * FROM test.t1 ORDER BY id;
id data
8 MySQL
@@ -73,30 +65,28 @@ id2
2
3
4
-
-< ---- Master selects-- >
--------------------------
+connection master;
CALL test.p1();
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
2 kyle
3 Texas
4 ROCKS
-
-< ---- Slave selects-- >
-------------------------
+connection slave;
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
2 kyle
3 Texas
4 ROCKS
+connection master;
ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result
index 23197964a24..481c9b3f6cc 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp008.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t2;
CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
@@ -14,21 +11,19 @@ BEGIN
SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
INSERT INTO test.t2 VALUES(FOUND_ROWS());
END|
-
-< ---- Master selects-- >
--------------------------
CALL test.p1();
a
1
SELECT * FROM test.t2;
a
2
-
-< ---- Slave selects-- >
-------------------------
+connection slave;
SELECT * FROM test.t2;
a
2
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result
index 35ce0d7b420..d4bcfe9fcb6 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp009.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
@@ -53,25 +50,33 @@ SELECT * FROM test.t2 ORDER BY a;
a
1
3
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
1
3
+connection master;
truncate test.t2;
call test.p1('b');
select * from test.t2 ORDER BY a;
a
2
4
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
2
4
+connection master;
truncate test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
+connection master;
DROP PROCEDURE test.p1;
DROP TABLE test.t1;
DROP TABLE test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result
index 02567465428..6a15298eddf 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp010.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
@@ -26,8 +23,10 @@ SELECT * FROM test.t1 ORDER BY a;
a
1
2
+connection slave;
show tables;
Tables_in_test
+connection master;
CREATE PROCEDURE test.p3()
BEGIN
INSERT INTO test.t2 VALUES(7);
@@ -44,13 +43,17 @@ SELECT * FROM test.t2 ORDER BY a;
a
6
7
+connection slave;
SELECT * FROM test.t2 ORDER BY a;
a
6
7
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p4;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result
index e35c9f21adb..53a9a964b53 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp011.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
@@ -58,6 +55,8 @@ ALTER TABLE test.t2 DROP COLUMN to_drop;
INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
END|
CALL test.p1();
+connection slave;
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
@@ -67,3 +66,5 @@ DROP PROCEDURE IF EXISTS test.p6;
DROP PROCEDURE IF EXISTS test.p7;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result b/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result
index 4aa16cbf6bd..65cc566256a 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_sp012.result
@@ -1,12 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
+create user user1@localhost;
grant usage on *.* to user1@localhost;
flush privileges;
SELECT CURRENT_USER();
@@ -21,9 +19,10 @@ CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
-
-<******** Master user1 p3 & p2 calls *******>
-----------------------------------------------
+set sql_mode=default;
+connection slave;
+connect muser1,localhost,user1,,;
+connection muser1;
SELECT CURRENT_USER();
CURRENT_USER()
user1@localhost
@@ -36,9 +35,9 @@ user1@localhost user1@localhost
CALL test.p2();
CURRENT_USER() USER()
root@localhost user1@localhost
-
-<******** Slave user1 p3 & p2 calls *******>
----------------------------------------------
+connect suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,;
+connection master;
+connection suser1;
SELECT CURRENT_USER();
CURRENT_USER()
user1@localhost
@@ -51,9 +50,12 @@ user1@localhost user1@localhost
CALL test.p2();
CURRENT_USER() USER()
root@localhost user1@localhost
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
-DROP USER 'user1'@'localhost';
+DROP USER user1@localhost;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result b/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result
index 46ca5748174..07be1bfebfe 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_stop_middle.result
@@ -1,11 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create table t1 (a int not null auto_increment primary key, b int, key(b));
-stop slave;
+connection slave;
+include/stop_slave.inc
+connection master;
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
@@ -20,7 +19,9 @@ INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
-start slave;
-stop slave;
+connection slave;
+include/start_slave.inc
+include/stop_slave.inc
drop table t1;
+connection master;
drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result
index 6665dc6d555..142c6c61865 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig001.result
@@ -1,14 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
INSERT INTO test.t1 VALUES (1,NOW());
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
+CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1//
CREATE PROCEDURE test.p3()
BEGIN
INSERT INTO test.t3 (d) VALUES (NOW());
@@ -18,9 +14,15 @@ CREATE PROCEDURE test.p2()
BEGIN
INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
END//
+connection slave;
+connection master;
+connection master;
+INSERT INTO test.t1 VALUES (1+1, NOW());
+connection slave;
<End test section 2 (Tiggers & SP)>
-----------------------------------
+connection master;
DROP PROCEDURE test.p2;
DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai;
@@ -28,3 +30,5 @@ DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result
index 794104db750..8259edd56df 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig002.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TRIGGER test.t2_ai;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
@@ -20,6 +17,7 @@ id domain
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection slave;
SELECT * FROM test.t1 ORDER BY id;
id domain
1 example.com
@@ -27,6 +25,7 @@ id domain
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection master;
INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
@@ -37,6 +36,7 @@ select * from test.t3;
value domain_id mailaccount_id program keey
No 5 NULL spamfilter scan_incoming
Yes 1 NULL spamfilter scan_incoming
+connection slave;
select * from test.t2;
value domain_id mailaccount_id program keey
Yes 1 NULL spamfilter scan_incoming
@@ -44,6 +44,7 @@ select * from test.t3;
value domain_id mailaccount_id program keey
No 5 NULL spamfilter scan_incoming
Yes 1 NULL spamfilter scan_incoming
+connection master;
DELETE FROM test.t1 WHERE id = 1;
SELECT * FROM test.t1 ORDER BY id;
id domain
@@ -51,19 +52,24 @@ id domain
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection master;
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection slave;
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
+connection master;
DROP TRIGGER test.t2_ai;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
index 131af933b41..239d5917bc5 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_trig003.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
@@ -69,15 +66,11 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL C
UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
DELETE FROM test.t1 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DELETE FROM test.t2 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
+connection slave;
+connection master;
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
@@ -87,3 +80,5 @@ DROP TRIGGER test.t2_ad;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
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 457d83496bc..82268ce72eb 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
@@ -6,15 +6,14 @@ INSERT INTO t1 VALUES (1),(2),(3),(4);
DROP TABLE t1;
CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t2 VALUES (1),(2);
-connection slave;
-connection master;
INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
connection slave;
include/stop_slave.inc
RESET SLAVE;
+CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT;
connection slave;
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
@@ -23,7 +22,7 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
@@ -32,19 +31,12 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
-include/wait_for_slave_sql_to_stop.inc
-SELECT * FROM t2;
-n
-1
-2
-include/check_slave_param.inc [Exec_Master_Log_Pos]
START SLAVE;
include/wait_for_slave_to_start.inc
connection master;
connection slave;
include/stop_slave.inc
-START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
+START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
include/wait_for_slave_param.inc [Until_Log_Pos]
include/wait_for_slave_sql_to_stop.inc
include/check_slave_param.inc [Exec_Master_Log_Pos]
@@ -58,10 +50,25 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
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;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
-Warnings:
-Note 1254 Slave is already running
include/stop_slave.inc
RESET SLAVE;
+include/start_slave.inc
+include/rpl_reset.inc
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+connection slave;
+include/stop_slave_sql.inc
+connection master;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+include/sync_slave_io_with_master.inc
+start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=relay_log_pos;
+include/wait_for_slave_sql_to_stop.inc
+include/assert.inc [table t1 should have two rows.]
+include/start_slave.inc
+connection master;
+DROP TABLE t1;
+connection slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_view01.result b/mysql-test/suite/engines/funcs/r/rpl_row_view01.result
index a4b8d0a05e3..5c9944e75e0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_view01.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_view01.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
create database if not exists mysqltest1;
DROP VIEW IF EXISTS mysqltest1.v1;
DROP VIEW IF EXISTS mysqltest1.v2;
@@ -35,6 +32,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection slave;
SELECT * FROM mysqltest1.v2;
qty price value
3 50 150
@@ -45,6 +43,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection master;
INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
SELECT * FROM mysqltest1.t5 ORDER BY qty;
@@ -57,6 +56,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection slave;
SELECT * FROM mysqltest1.t5 ORDER BY qty;
qty price total
3 50 150
@@ -67,6 +67,7 @@ a c c2
1 Thank GOD
2 it is
3 Friday TGIF
+connection master;
INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
SELECT * FROM mysqltest1.t1 ORDER BY a;
a c
@@ -79,6 +80,7 @@ a c
2 it
3 Friday
4 TEST
+connection slave;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a c
1 Thank
@@ -90,6 +92,7 @@ a c
2 it
3 Friday
4 TEST
+connection master;
DROP VIEW IF EXISTS mysqltest1.v1;
DROP VIEW IF EXISTS mysqltest1.v2;
DROP VIEW IF EXISTS mysqltest1.v3;
@@ -99,3 +102,5 @@ DROP TABLE IF EXISTS mysqltest1.t1;
DROP TABLE IF EXISTS mysqltest1.t2;
DROP TABLE IF EXISTS mysqltest1.t4;
DROP DATABASE mysqltest1;
+connection slave;
+include/rpl_end.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 700bc270f07..3f318a0a664 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result
@@ -1,19 +1,19 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
create table t1 (n int);
reset master;
-stop slave;
+include/stop_slave.inc
change master to master_port=SLAVE_PORT;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 107 None 0 No NULL No 0 0 1
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 256 None 0 No NULL No 0 0 1 No conservative 0 NULL
start slave;
insert into t1 values (1);
-show status like "slave_running";
-Variable_name Value
-Slave_running OFF
+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 MySQL 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
+reset slave;
+reset master;
drop table t1;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
index f8d24f70776..74145645920 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result
@@ -1,21 +1,38 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
create table t1 (n int);
reset master;
stop slave;
+include/wait_for_slave_to_stop.inc
change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 107 None 0 No NULL No 0 0 1
start slave;
+include/wait_for_slave_to_start.inc
insert into t1 values (1);
select * from t1;
n
1
1
stop slave;
+include/wait_for_slave_to_stop.inc
+drop table t1;
+connection master;
+reset master;
+create table t1(n int);
+create table t2(n int);
+connection slave;
+change master to master_port=MASTER_PORT;
+start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS;
+include/wait_for_slave_io_to_start.inc
+include/wait_for_slave_sql_to_stop.inc
+*** checking until position execution: must be only t1 in the list ***
+show tables;
+Tables_in_test
+t1
+connection slave;
+start slave sql_thread;
+connection master;
drop table t1;
+drop table t2;
+connection slave;
+include/rpl_end.inc
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 b5b4b815ade..67863583f8d 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_session_var.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_session_var.result
@@ -1,12 +1,8 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop table if exists t1;
Warnings:
-Note 1051 Unknown table 't1'
+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);
@@ -16,10 +12,12 @@ 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;
@@ -37,7 +35,24 @@ 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/engines/funcs/r/rpl_sf.result b/mysql-test/suite/engines/funcs/r/rpl_sf.result
index 9cb9c9e8354..e692e31f908 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sf.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sf.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
set global log_bin_trust_function_creators=0;
set binlog_format=STATEMENT;
create function fn16456()
@@ -27,3 +23,4 @@ set binlog_format=STATEMENT;
select fn16456();
ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
drop function fn16456;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_skip_error.result b/mysql-test/suite/engines/funcs/r/rpl_skip_error.result
index 248ce5b52c3..98c165e7db0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_skip_error.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_skip_error.result
@@ -1,16 +1,18 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1 (n int not null primary key);
+connection slave;
insert into t1 values (1);
+connection master;
insert into t1 values (1);
insert into t1 values (2),(3);
+connection slave;
select * from t1 ORDER BY n;
n
1
2
3
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
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 0e438d294fd..1c81cec2577 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result
@@ -1,63 +1,48 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
-stop slave;
-change master to master_user='rpl',master_password='rpl';
-start slave;
-drop table if exists t1;
-create table t1 (n int);
-insert into t1 values (1);
-select * from t1;
+include/master-slave.inc
+[connection master]
+==== Create new replication user ====
+connection master;
+GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
+connection slave;
+include/stop_slave.inc
+set @save_relay_log_purge=@@global.relay_log_purge;
+set @@global.relay_log_purge=0;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+select @@global.relay_log_purge;
+@@global.relay_log_purge
+0
+set @@global.relay_log_purge=1;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+select @@global.relay_log_purge;
+@@global.relay_log_purge
+1
+set @@global.relay_log_purge=@save_relay_log_purge;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+include/start_slave.inc
+==== Do replication as new user ====
+connection master;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES (1);
+connection slave;
+SELECT * FROM t1;
n
1
-drop user rpl@127.0.0.1;
-flush privileges;
-stop slave;
-start slave;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User rpl
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Connecting
-Slave_SQL_Running Yes
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master NULL
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-drop table t1;
-drop table t1;
+==== Delete new replication user ====
+connection master;
+DROP USER rpl@127.0.0.1;
+FLUSH PRIVILEGES;
+connection slave;
+==== Restart slave without privileges =====
+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) ====
+include/stop_slave_sql.inc
+CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = '';
+include/rpl_reset.inc
+connection master;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff
new file mode 100644
index 00000000000..520a1e83e41
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff
@@ -0,0 +1,476 @@
+@@ -126,11 +126,14 @@
+ show warnings;
+ Level Code Message
+ Error 1062 Duplicate entry '20' for key 'a'
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ select * from t2;
+ a
++20
+ connection slave;
+ select * from t2;
+ a
++20
+ select * from mysql.proc where name="foo4" and db='mysqltest1';
+ db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+ mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
+@@ -170,20 +173,16 @@
+ insert into t2 values(fn1(21));
+ select * from t1;
+ a
+-15
+ 20
+ 21
+-5
+ select * from t2;
+ a
+ 23
+ connection slave;
+ select * from t1;
+ a
+-15
+ 20
+ 21
+-5
+ select * from t2;
+ a
+ 23
+@@ -290,13 +289,18 @@
+ do fn1(100);
+ Warnings:
+ Error 1062 Duplicate entry '100' for key 'a'
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ select fn1(20);
+ ERROR 23000: Duplicate entry '20' for key 'a'
+ select * from t2;
+ a
++20
++100
+ connection slave;
+ select * from t2;
+ a
++20
++100
+ connection con1;
+ create trigger trg before insert on t1 for each row set new.a= 10;
+ ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
+@@ -470,13 +474,13 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp())
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+ select * from mysqltest1.t1
+@@ -507,24 +511,24 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -535,6 +539,9 @@
+ begin
+ insert into t2 values(20),(20);
+ end
++master-bin.000001 # Gtid # # BEGIN GTID #-#-#
++master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(20),(20)
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -555,10 +562,10 @@
+ master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21))
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -569,10 +576,10 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1())
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+ NO SQL
+@@ -587,7 +594,7 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -599,21 +606,27 @@
+ return 10;
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
++master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100)
++master-bin.000001 # Query # # COMMIT
++master-bin.000001 # Gtid # # BEGIN GTID #-#-#
++master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
++master-bin.000001 # Query # # COMMIT
++master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+@@ -645,7 +658,7 @@
+ master-bin.000001 # Query # # use `test`; create table t1 (a int)
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1())
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `test`; drop view v1
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -661,7 +674,7 @@
+ INSERT INTO t1 VALUES(arg)
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+ master-bin.000001 # Gtid # # GTID #-#-#
+@@ -695,7 +708,7 @@
+ begin end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 )
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ master-bin.000001 # Gtid # # GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ begin
+@@ -704,7 +717,7 @@
+ end
+ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+ master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
+-master-bin.000001 # Xid # # COMMIT /* XID */
++master-bin.000001 # Query # # COMMIT
+ connection slave;
+ set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+ connection master;
+@@ -799,19 +812,25 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values ( NAME_CONST('b',8))
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (unix_timestamp())
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+ select * from mysqltest1.t1
+@@ -856,21 +875,27 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t2 values(3)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=0/*!*/;
+ insert into t1 values (15)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=1411383296/*!*/;
+ insert into t2 values(3)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=0/*!*/;
+ alter procedure foo4 sql security invoker
+@@ -881,20 +906,26 @@
+ SET @@session.sql_mode=1411383296/*!*/;
+ insert into t2 values(3)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (5)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=0/*!*/;
+ delete from t2
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ alter table t2 add unique (a)
+ /*!*/;
+@@ -908,6 +939,14 @@
+ insert into t2 values(20),(20);
+ end
+ /*!*/;
++BEGIN
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++insert into t2 values(20),(20)
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop procedure foo4
+ /*!*/;
+@@ -941,13 +980,17 @@
+ SET TIMESTAMP=t/*!*/;
+ SELECT `mysqltest1`.`fn1`(20)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t2 values(fn1(21))
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop function fn1
+ /*!*/;
+@@ -963,13 +1006,17 @@
+ SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values(fn1())
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ SET @@session.sql_mode=1411383296/*!*/;
+ CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+@@ -991,7 +1038,9 @@
+ SET TIMESTAMP=t/*!*/;
+ delete from t2
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ alter table t2 add unique (a)
+ /*!*/;
+@@ -1008,9 +1057,27 @@
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
++SELECT `mysqltest1`.`fn1`(100)
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
++BEGIN
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++SELECT `mysqltest1`.`fn1`(20)
++/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
++BEGIN
++/*!*/;
++SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+ /*!*/;
+@@ -1019,13 +1086,17 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (1)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ BEGIN
+ /*!*/;
+ SET TIMESTAMP=t/*!*/;
+ delete from t1
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop trigger trg
+ /*!*/;
+@@ -1034,7 +1105,9 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 values (1)
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+@@ -1079,7 +1152,9 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t1 (a) values (f1())
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop view v1
+ /*!*/;
+@@ -1104,7 +1179,9 @@
+ SET TIMESTAMP=t/*!*/;
+ INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ DROP PROCEDURE p1
+ /*!*/;
+@@ -1156,7 +1233,9 @@
+ SET TIMESTAMP=t/*!*/;
+ insert into t values ( 1 )
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ begin
+@@ -1170,7 +1249,9 @@
+ SET TIMESTAMP=t/*!*/;
+ SELECT `mysqltest2`.`f1`()
+ /*!*/;
+-COMMIT/*!*/;
++SET TIMESTAMP=t/*!*/;
++COMMIT
++/*!*/;
+ SET TIMESTAMP=t/*!*/;
+ drop database mysqltest
+ /*!*/;
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result
index 873ee6b03c5..e19732fe7ff 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sp.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result
@@ -1,14 +1,13 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+set local sql_mode='';
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
create table t1 (a varchar(100));
+connection slave;
use mysqltest1;
+connection master;
create procedure foo()
begin
declare b int;
@@ -29,6 +28,7 @@ set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end
+connection slave;
select * from mysql.proc where name='foo' and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
@@ -42,16 +42,19 @@ set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end
+connection master;
set timestamp=1000000000;
call foo();
select * from t1;
a
8
1000000000
+connection slave;
select * from t1;
a
8
1000000000
+connection master;
delete from t1;
create procedure foo2()
select * from mysqltest1.t1;
@@ -70,6 +73,8 @@ grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
SELECT 1;
1
1
+connect con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,;
+connection con1;
create procedure foo4()
deterministic
begin
@@ -78,6 +83,7 @@ insert into t1 values (5);
end|
call foo4();
Got one of the listed errors
+connection master;
call foo3();
show warnings;
Level Code Message
@@ -96,6 +102,7 @@ a
3
3
3
+connection slave;
select * from t1;
a
15
@@ -105,20 +112,40 @@ a
3
3
3
+connection master;
+delete from t2;
+alter table t2 add unique (a);
+drop procedure foo4;
+create procedure foo4()
+deterministic
+begin
+insert into t2 values(20),(20);
+end|
+call foo4();
+ERROR 23000: Duplicate entry '20' for key 'a'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry '20' for key 'a'
+select * from t2;
+a
+connection slave;
+select * from t2;
+a
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
-mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin
-insert into t2 values(3);
-insert into t1 values (5);
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
-insert into t2 values(3);
-insert into t1 values (5);
+mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
+insert into t2 values(20),(20);
+end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+insert into t2 values(20),(20);
end
+connection master;
drop procedure foo4;
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+connection slave;
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
+connection master;
drop procedure foo;
drop procedure foo2;
drop procedure foo3;
@@ -143,18 +170,24 @@ fn1(20)
insert into t2 values(fn1(21));
select * from t1;
a
+15
20
21
+5
select * from t2;
a
23
+connection slave;
select * from t1;
a
+15
20
21
+5
select * from t2;
a
23
+connection master;
drop function fn1;
create function fn1()
returns int
@@ -167,6 +200,7 @@ ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA
delete from t1;
set timestamp=1000000000;
insert into t1 values(fn1());
+connection con1;
create function fn2()
returns int
no sql
@@ -174,15 +208,21 @@ begin
return unix_timestamp();
end|
ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+connection master;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
+connection slave;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
+connection con1;
create function fn2()
returns int
no sql
begin
return unix_timestamp();
end|
+connection master;
create function fn3()
returns int
not deterministic
@@ -202,7 +242,7 @@ return unix_timestamp();
end
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
@@ -213,6 +253,7 @@ end
select * from t1;
a
1000000000
+connection slave;
use mysqltest1;
select * from t1;
a
@@ -226,7 +267,7 @@ return unix_timestamp();
end
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
@@ -234,39 +275,73 @@ return 0;
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
end
+connection master;
+delete from t2;
+alter table t2 add unique (a);
+Warnings:
+Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release
+drop function fn1;
+create function fn1(x int)
+returns int
+begin
+insert into t2 values(x),(x);
+return 10;
+end|
+do fn1(100);
+Warnings:
+Error 1062 Duplicate entry '100' for key 'a'
+select fn1(20);
+ERROR 23000: Duplicate entry '20' for key 'a'
+select * from t2;
+a
+connection slave;
+select * from t2;
+a
+connection con1;
create trigger trg before insert on t1 for each row set new.a= 10;
ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
+connection master;
delete from t1;
create trigger trg before insert on t1 for each row set new.a= 10;
insert into t1 values (1);
select * from t1;
a
10
+connection slave;
select * from t1;
a
10
+connection master;
delete from t1;
drop trigger trg;
insert into t1 values (1);
select * from t1;
a
1
+connection slave;
select * from t1;
a
1
+connection master;
create procedure foo()
not deterministic
reads sql data
select * from t1;
+connection slave;
call foo();
a
1
+connection master;
drop procedure foo;
+connection slave;
+connection master;
drop function fn1;
drop database mysqltest1;
drop user "zedjzlcsjhd"@127.0.0.1;
use test;
+connection slave;
use test;
+connection master;
drop function if exists f1;
create function f1() returns int reads sql data
begin
@@ -285,9 +360,12 @@ a
1
drop view v1;
drop function f1;
+connection slave;
+connection slave;
select * from t1;
a
1
+connection master;
DROP PROCEDURE IF EXISTS p1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(col VARCHAR(10));
@@ -297,21 +375,23 @@ CALL p1('test');
SELECT * FROM t1;
col
test
+connection slave;
SELECT * FROM t1;
col
test
+connection master;
DROP PROCEDURE p1;
---> Test for BUG#20438
---> Preparing environment...
----> connection: master
+connection master;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
---> Synchronizing slave with master...
-
----> connection: master
+connection slave;
+connection master;
---> Creating procedure...
/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
@@ -328,7 +408,7 @@ f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci
---> Synchronizing slave with master...
----> connection: master
+connection slave;
---> Checking on slave...
SHOW CREATE PROCEDURE p1;
@@ -339,17 +419,17 @@ SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci
-
----> connection: master
+connection master;
---> Cleaning up...
DROP PROCEDURE p1;
DROP FUNCTION f1;
+connection slave;
+connection master;
+connection master;
drop table t1;
-set global log_bin_trust_function_creators=0;
-set global log_bin_trust_function_creators=0;
-End of 5.0 tests
-reset master;
+connection slave;
+connection master;
drop database if exists mysqltest;
drop database if exists mysqltest2;
create database mysqltest;
@@ -360,6 +440,871 @@ create procedure mysqltest.test() begin end;
insert into t values ( 1 );
create procedure `\\`.test() begin end;
ERROR 42000: Unknown database '\\'
+connection master;
+create function f1 () returns int
+begin
+insert into t values (1);
+return 0;
+end|
+connection slave;
+connection master;
+use mysqltest;
+set @a:= mysqltest2.f1();
+connection slave;
+connection master;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # create database mysqltest1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a varchar(100))
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp())
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+select * from mysqltest1.t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo2 contains sql
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; create table t2 like t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
+ DETERMINISTIC
+insert into t1 values (15)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(3);
+insert into t1 values (5);
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(20),(20);
+end
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo3
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+ DETERMINISTIC
+begin
+insert into t1 values (x);
+return x+2;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete t1,t2 from t1,t2
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1())
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
+ READS SQL DATA
+begin
+return 0;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t2
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+begin
+insert into t2 values(x),(x);
+return 10;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; delete from t1
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+select * from t1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest1`; drop function fn1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database mysqltest1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop user "zedjzlcsjhd"@127.0.0.1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; drop function if exists f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ READS SQL DATA
+begin
+declare var integer;
+declare c cursor for select a from v1;
+open c;
+fetch c into var;
+close c;
+return var;
+end
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1())
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; drop view v1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; drop function f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1(col VARCHAR(10))
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP FUNCTION f1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database if exists mysqltest
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # drop database if exists mysqltest2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # create database mysqltest
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # create database mysqltest2
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; create table t ( t integer )
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
+begin end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 )
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+begin
+insert into t values (1);
+return 0;
+end
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
+master-bin.000001 # Xid # # COMMIT /* XID */
+connection slave;
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+connection master;
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;
-End of 5.1 tests
+connection slave;
+connection master;
+use test;
+/*!50001 create procedure `mysqltestbug36570_p1`() */
+begin
+select 1;
+end|
+use mysql|
+create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`:
+begin
+select a;
+end|
+/*!50001 create function test.mysqltestbug36570_f1() */
+returns int
+/*!50001 deterministic */
+begin
+return 3;
+end|
+use test|
+show procedure status like '%mysqltestbug36570%';
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+show create procedure ` mysqltestbug36570_p2`;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+ mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`( a int)
+`label`:
+begin
+select a;
+end latin1 latin1_swedish_ci latin1_swedish_ci
+connection slave;
+connection slave;
+show procedure status like '%mysqltestbug36570%';
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+test mysqltestbug36570_p2 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+test mysqltestbug36570_p1 PROCEDURE root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+show create procedure ` mysqltestbug36570_p2`;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+ mysqltestbug36570_p2 CREATE DEFINER=`root`@`localhost` PROCEDURE ` mysqltestbug36570_p2`( a int)
+`label`:
+begin
+select a;
+end latin1 latin1_swedish_ci latin1_swedish_ci
+call ` mysqltestbug36570_p2`(42);
+a
+42
+show function status like '%mysqltestbug36570%';
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+connection master;
+flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+drop database if exists mysqltest1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create database mysqltest1
+/*!*/;
+use `mysqltest1`/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t1 (a varchar(100))
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+begin
+declare b int;
+set b = 8;
+insert into t1 values (b);
+insert into t1 values (unix_timestamp());
+end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values ( NAME_CONST('b',8))
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (unix_timestamp())
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
+select * from mysqltest1.t1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+alter procedure foo2 contains sql
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP TABLE `t1` /* generated by server */
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t1 (a int)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t2 like t1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
+ DETERMINISTIC
+insert into t1 values (15)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(3);
+insert into t1 values (5);
+end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t2 values(3)
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+insert into t1 values (15)
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+insert into t2 values(3)
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+alter procedure foo4 sql security invoker
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+insert into t2 values(3)
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (5)
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+delete from t2
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+alter table t2 add unique (a)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo4
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`()
+ DETERMINISTIC
+begin
+insert into t2 values(20),(20);
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo4
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo2
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo3
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+ DETERMINISTIC
+begin
+insert into t1 values (x);
+return x+2;
+end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete t1,t2 from t1,t2
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+COMMIT
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SELECT `mysqltest1`.`fn1`(20)
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t2 values(fn1(21))
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function fn1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values(fn1())
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
+ NO SQL
+begin
+return unix_timestamp();
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
+ READS SQL DATA
+begin
+return 0;
+end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t2
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+alter table t2 add unique (a)
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function fn1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11)
+begin
+insert into t2 values(x),(x);
+return 10;
+end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (1)
+/*!*/;
+COMMIT/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+delete from t1
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop trigger trg
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 values (1)
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`()
+ READS SQL DATA
+select * from t1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop procedure foo
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function fn1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database mysqltest1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop user "zedjzlcsjhd"@127.0.0.1
+/*!*/;
+use `test`/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function if exists f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ READS SQL DATA
+begin
+declare var integer;
+declare c cursor for select a from v1;
+open c;
+fetch c into var;
+close c;
+return var;
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t1 (a int)
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t1 (a) values (f1())
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop view v1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop function f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE IF EXISTS p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP TABLE IF EXISTS `t1` /* generated by server */
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE TABLE t1(col VARCHAR(10))
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
+INSERT INTO t1 VALUES(arg)
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci'))
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE IF EXISTS p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP FUNCTION IF EXISTS f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @a = 1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 0
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP PROCEDURE p1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP FUNCTION f1
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+DROP TABLE `t1` /* generated by server */
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database if exists mysqltest
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database if exists mysqltest2
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create database mysqltest
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+create database mysqltest2
+/*!*/;
+use `mysqltest2`/*!*/;
+SET TIMESTAMP=t/*!*/;
+create table t ( t integer )
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`()
+begin end
+/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+insert into t values ( 1 )
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+begin
+insert into t values (1);
+return 0;
+end
+/*!*/;
+BEGIN
+/*!*/;
+use `mysqltest`/*!*/;
+SET TIMESTAMP=t/*!*/;
+SELECT `mysqltest2`.`f1`()
+/*!*/;
+COMMIT/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database mysqltest
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+drop database mysqltest2
+/*!*/;
+use `test`/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`()
+begin
+select 1;
+end
+/*!*/;
+use `mysql`/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int)
+`label`:
+begin
+select a;
+end
+/*!*/;
+SET TIMESTAMP=t/*!*/;
+CREATE DEFINER=`root`@`localhost` FUNCTION `test`.`mysqltestbug36570_f1`() RETURNS int(11)
+ DETERMINISTIC
+begin
+return 3;
+end
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+use test;
+drop procedure mysqltestbug36570_p1;
+drop procedure ` mysqltestbug36570_p2`;
+drop function mysqltestbug36570_f1;
+End of 5.0 tests
+# End of 5.1 tests
+#
+# Test Bug#30977 Concurrent statement using stored
+# function and DROP FUNCTION breaks SBR.
+#
+# Demonstrate that stored function DDL can not go through,
+# or, worse yet, make its way into the binary log, while
+# the stored function is in use.
+# For that, try to insert a result of a stored function
+# into a table. Block the insert in the beginning, waiting
+# on a table lock. While insert is blocked, attempt to
+# drop the routine. Verify that this attempt
+# blocks and waits for INSERT to complete. Commit and
+# reap the chain of events. Master and slave must contain
+# identical data. Statements in the binrary log must be
+# consistent with data in the table.
+#
+connection default;
+drop table if exists t1, t2;
+drop function if exists t1;
+create table t1 (a int);
+create table t2 (a int) as select 1 as a;
+create function f1() returns int deterministic return (select max(a) from t2);
+lock table t2 write;
+connection master;
+# Sending 'insert into t1 (a) values (f1())'...
+insert into t1 (a) values (f1());
+connection master1;
+# Waitng for 'insert into t1 ...' to get blocked on table lock...
+# Sending 'drop function f1'. It will wait till insert finishes.
+drop function f1;;
+connection default;
+# Check that 'drop function f1' gets blocked.
+# Now let's let 'insert' go through...
+unlock tables;
+connection master;
+# Reaping 'insert into t1 (a) values (f1())'...
+connection master1;
+# Reaping 'drop function f1'
+connection master;
+select * from t1;
+a
+1
+connection slave;
+connection slave;
+select * from t1;
+a
+1
+connection master;
+drop table t1, t2;
+drop function f1;
+ERROR 42000: FUNCTION test.f1 does not exist
+#
+# Bug #11918 Can't use a declared variable in LIMIT clause
+#
+include/rpl_reset.inc
+create table t1 (c1 int);
+insert into t1 (c1) values
+(1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+create procedure p1(p1 integer)
+delete from t1 limit p1;
+set @save_binlog_format=@@session.binlog_format;
+set @@session.binlog_format=STATEMENT;
+call p1(NULL);
+call p1(0);
+call p1(1);
+call p1(2);
+call p1(3);
+select * from t1;
+c1
+7
+8
+9
+10
+connection slave;
+connection slave;
+select * from t1;
+c1
+7
+8
+9
+10
+connection master;
+call p1(-1);
+select * from t1;
+c1
+connection slave;
+connection slave;
+select * from t1;
+c1
+connection master;
+# Cleanup
+set @@session.binlog_format=@save_binlog_format;
+drop table t1;
+drop procedure p1;
+# End of 5.5 tests.
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp004.result b/mysql-test/suite/engines/funcs/r/rpl_sp004.result
index 1c0ed3cc50a..72f0428ce0f 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sp004.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp004.result
@@ -1,9 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t2;
@@ -38,6 +35,7 @@ a
2
3
8
+connection slave;
SELECT * FROM test.t1 ORDER BY a;
a
1
@@ -50,15 +48,18 @@ a
2
3
8
+connection master;
CALL test.p2();
USE test;
SHOW TABLES;
Tables_in_test
t3
+connection slave;
USE test;
SHOW TABLES;
Tables_in_test
t3
+connection master;
CALL test.p1();
Warnings:
Note 1050 Table 't3' already exists
@@ -74,6 +75,7 @@ a
2
3
8
+connection slave;
SELECT * FROM test.t1 ORDER BY a;
a
1
@@ -86,8 +88,11 @@ a
2
3
8
+connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result b/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result
index 97cc0a78a23..d6890f22b02 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp_effects.result
@@ -1,9 +1,7 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection master;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
drop procedure if exists p1;
drop procedure if exists p2;
drop function if exists f1;
@@ -20,6 +18,8 @@ set spv=spv+1;
end while;
end//
call p1();
+connection slave;
+connection slave;
SELECT * FROM t1 ORDER BY a;
a
1
@@ -27,6 +27,7 @@ a
3
4
5
+connection master;
SELECT * FROM t1 ORDER BY a;
a
1
@@ -43,9 +44,12 @@ call p2();
SELECT * FROM t2 ORDER BY a;
a
4
+connection slave;
+connection slave;
SELECT * FROM t2 ORDER BY a;
a
4
+connection master;
drop procedure p1;
drop procedure p2;
drop table t2;
@@ -104,6 +108,8 @@ master: 7
master: 8
master: 10
master: 11
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 1
@@ -120,6 +126,7 @@ slave: 7
slave: 8
slave: 10
slave: 11
+connection master;
drop procedure p1;
delete from t1;
delete from t2;
@@ -134,10 +141,13 @@ SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 1
master: 2
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 1
slave: 2
+connection master;
drop view v1;
delete from t1;
prepare s1 from 'select f1(?)';
@@ -148,9 +158,12 @@ f1(?)
SELECT 'master:',a FROM t1 ORDER BY a;
master: a
master: 123
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 123
+connection master;
delete from t1;
create procedure p1(spv int)
begin
@@ -169,12 +182,15 @@ master: 6
master: 6
master: 15
master: 15
+connection slave;
+connection slave;
SELECT 'slave:',a FROM t1 ORDER BY a;
slave: a
slave: 6
slave: 6
slave: 15
slave: 15
+connection master;
drop procedure p1;
drop function f1;
drop table t1,t2;
@@ -220,6 +236,8 @@ master 100
master 101
master 101
master 102
+connection slave;
+connection slave;
SELECT 'slave', a FROM t1 ORDER BY a;
slave a
slave 10
@@ -231,7 +249,73 @@ slave 100
slave 101
slave 101
slave 102
+connection master;
drop table t1;
drop function f1;
drop function f2;
drop procedure p1;
+connection slave;
+connection master;
+create table t2 (b BIT(7));
+create procedure sp_bug26199(bitvalue BIT(7))
+begin
+insert into t2 set b = bitvalue;
+end //
+create function sf_bug26199(b BIT(7)) returns int
+begin
+insert into t2 values(b);
+return 0;
+end//
+call sp_bug26199(b'1110');
+call sp_bug26199('\0');
+select sf_bug26199(b'1111111');
+sf_bug26199(b'1111111')
+0
+SET STATEMENT sql_mode = '' FOR
+select sf_bug26199(b'101111111');
+sf_bug26199(b'101111111')
+0
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+select sf_bug26199('\'');
+sf_bug26199('\'')
+0
+select hex(b) from t2;
+hex(b)
+E
+0
+7F
+7F
+27
+connection slave;
+select hex(b) from t2;
+hex(b)
+E
+0
+7F
+7F
+27
+connection master;
+drop table t2;
+drop procedure sp_bug26199;
+drop function sf_bug26199;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+connection slave;
+set names utf8;
+CREATE FUNCTION f() RETURNS timestamp DETERMINISTIC
+BEGIN RETURN '2012-12-21 12:12:12'; END |
+CREATE PROCEDURE p(t timestamp)
+BEGIN
+SET @t = t;
+PREPARE stmt FROM "
+ UPDATE t1 SET a = @t WHERE '2012-12-31 08:00:00' < f() ";
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+END |
+create table t1 (a timestamp);
+call p('2012-12-31 08:00:00');
+drop table t1;
+drop procedure p;
+drop function f;
+end of the tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result b/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result
index 1fcb586d1fb..48c5e548fd2 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_start_stop_slave.result
@@ -1,12 +1,17 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+connection master;
create table t1(n int);
-start slave;
-stop slave io_thread;
+connection slave;
+include/start_slave.inc
+include/stop_slave_io.inc
start slave io_thread;
+include/wait_for_slave_io_to_start.inc
+connection master;
+connection slave;
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
index 547dd8e1541..41d18d7f9fe 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_max_relay_size.result
@@ -1,20 +1,19 @@
+include/master-slave.inc
+[connection master]
+connection slave;
stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
+connection master;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int);
drop table t1;
+connection slave;
reset slave;
#
# Test 1
#
-set @my_max_binlog_size= @@global.max_binlog_size;
+set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
set global max_binlog_size=8192;
set global max_relay_log_size=8192-1;
Warnings:
@@ -23,7 +22,7 @@ select @@global.max_relay_log_size;
@@global.max_relay_log_size
4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 2
#
@@ -33,17 +32,19 @@ set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size;
@@global.max_relay_log_size 20480
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 3: max_relay_log_size = 0
#
stop slave;
reset slave;
set global max_relay_log_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_relay_log_size value: '0'
select @@global.max_relay_log_size;
-@@global.max_relay_log_size 0
+@@global.max_relay_log_size 4096
start slave;
-Checking that both slave threads are running.
+include/check_slave_is_running.inc
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -56,19 +57,27 @@ flush logs;
reset slave;
start slave;
flush logs;
+connection master;
create table t1 (a int);
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs;
+connection master;
drop table t1;
-Checking that both slave threads are running.
+connection slave;
+include/check_slave_is_running.inc
+connection master;
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
+connection slave;
set global max_binlog_size= @my_max_binlog_size;
+set global max_relay_log_size= @my_max_relay_log_size;
#
# End of 4.1 tests
#
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result b/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result
index ea34b308ec2..0d99235e45c 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_mystery22.result
@@ -1,20 +1,20 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t1(n int auto_increment primary key, s char(10));
+connection slave;
insert into t1 values (2,'old');
+connection master;
insert into t1 values(NULL,'new');
insert into t1 values(NULL,'new');
+connection slave;
select * from t1 order by n;
n s
1 new
2 old
delete from t1 where n = 2;
-start slave;
-stop slave;
+include/start_slave.inc
+include/stop_slave.inc
+connection master;
create table t2(n int);
drop table t2;
insert into t1 values(NULL,'new');
@@ -22,10 +22,14 @@ set sql_log_bin=0;
insert into t1 values(NULL,'new');
set sql_log_bin=1;
delete from t1 where n=4;
-start slave;
+connection slave;
+include/start_slave.inc
select * from t1 order by n;
n s
1 new
2 new
3 new
+connection master;
drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result b/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
index 5a253d61fcb..2505660f863 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_no_op.result
@@ -1,52 +1,71 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
create database mysqltest;
+connection master;
drop database if exists mysqltest;
Warnings:
Note 1008 Can't drop database 'mysqltest'; database doesn't exist
+connection slave;
show tables from mysqltest;
ERROR 42000: Unknown database 'mysqltest'
+connection slave;
create table t1 (a int);
+connection master;
drop table if exists t1;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
+connection slave;
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
+connection master;
create table t1 (a int, b int);
+connection slave;
insert into t1 values(1,1);
+connection master;
delete from t1;
+connection slave;
select * from t1;
a b
insert into t1 values(1,1);
+connection master;
insert into t1 values(2,1);
update t1 set a=2;
+connection slave;
select * from t1;
a b
2 1
2 1
+connection master;
create table t2 (a int, b int);
delete from t1;
insert into t1 values(1,1);
insert into t2 values(1,1);
+connection slave;
update t1 set a=2;
+connection master;
UPDATE t1, t2 SET t1.a = t2.a;
+connection slave;
select * from t1;
a b
1 1
select * from t2;
a b
1 1
+connection master;
delete from t1;
delete from t2;
+connection slave;
insert into t1 values(1,1);
insert into t2 values(1,1);
+connection master;
DELETE t1.*, t2.* from t1, t2;
+connection slave;
select * from t1;
a b
select * from t2;
a b
+connection master;
drop table t1, t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
index c6c2c525098..1ba2d1b624b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_stm_reset_slave.result
@@ -1,41 +1,58 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-Master_User root
-Master_Host 127.0.0.1
+include/master-slave.inc
+[connection master]
+connection slave;
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
change master to master_user='test';
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
reset slave;
-Master_User test
-Master_Host 127.0.0.1
+Master_User = 'test'
+Master_Host = '127.0.0.1'
change master to master_user='root';
include/start_slave.inc
-Master_User root
-Master_Host 127.0.0.1
+Master_User = 'root'
+Master_Host = '127.0.0.1'
include/stop_slave.inc
reset slave;
include/start_slave.inc
+connection master;
create temporary table t1 (a int);
+connection slave;
include/stop_slave.inc
reset slave;
include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+connection master;
+drop temporary table if exists t1;
+connection slave;
include/stop_slave.inc
reset slave;
+include/check_slave_no_error.inc
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
change master to master_user='root';
include/start_slave.inc
+include/check_slave_no_error.inc
stop slave;
change master to master_user='impossible_user_name';
start slave;
-stop slave;
+include/wait_for_slave_io_error.inc [errno=1045]
+include/stop_slave_sql.inc
reset slave;
+include/check_slave_no_error.inc
+change master to master_user='root';
+reset slave;
+include/start_slave.inc
+include/stop_slave.inc
+reset slave all;
+start slave;
+ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
+include/start_slave.inc
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
index b0d92f3ca3f..2f7f1b07cb4 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
@@ -1,15 +1,36 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-set @saved_binlog_format = @@global.binlog_format;
+include/master-slave.inc
+[connection master]
+connection slave;
+connection master;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
+set @my_binlog_format= @@global.binlog_format;
+set session binlog_format=mixed;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set session binlog_format=statement;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
set session binlog_format=row;
-set global binlog_format=row;
+show session variables like "binlog_format%";
+Variable_name Value
+binlog_format ROW
+set global binlog_format=DEFAULT;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set global binlog_format=MIXED;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format MIXED
+set global binlog_format=STATEMENT;
+show global variables like "binlog_format%";
+Variable_name Value
+binlog_format STATEMENT
+set global binlog_format=ROW;
show global variables like "binlog_format%";
Variable_name Value
binlog_format ROW
@@ -68,11 +89,11 @@ execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values("for_10_");
insert into t1 select "yesterday_11_";
-set binlog_format=default;
+set binlog_format=statement;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
-set global binlog_format=default;
+set global binlog_format=statement;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
STATEMENT STATEMENT
@@ -87,11 +108,11 @@ execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values("for_15_");
insert into t1 select "yesterday_16_";
-set binlog_format=mixed;
+set global binlog_format=mixed;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
-STATEMENT MIXED
-set global binlog_format=mixed;
+MIXED STATEMENT
+set binlog_format=default;
select @@global.binlog_format, @@session.binlog_format;
@@global.binlog_format @@session.binlog_format
MIXED MIXED
@@ -112,11 +133,15 @@ execute stmt1 using @string;
deallocate prepare stmt1;
insert into t1 values(concat("for_23_",UUID()));
insert into t1 select "yesterday_24_";
-create table t2 select rpad(UUID(),100,' ');
+create table t2 ENGINE=MyISAM select rpad(UUID(),100,' ');
create table t3 select 1 union select UUID();
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
+Warnings:
+Warning 1292 Incorrect datetime value: '3'
+insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
create procedure foo()
begin
insert into t1 values("work_25_");
@@ -228,6 +253,14 @@ begin
set NEW.data = concat(NEW.data,UUID());
end|
insert into t11 values("try_560_");
+insert delayed into t2 values("delay_1_");
+insert delayed into t2 values(concat("delay_2_",UUID()));
+insert delayed into t2 values("delay_6_");
+insert delayed into t2 values(rand());
+set @a=2.345;
+insert delayed into t2 values(@a);
+connection slave;
+connection master;
create table t20 select * from t1;
create table t21 select * from t2;
create table t22 select * from t3;
@@ -244,14 +277,18 @@ end|
select f("try_41_");
f("try_41_")
1
+connection slave;
use mysqltest1;
insert into t2 values(2,null),(3,null),(4,null);
delete from t2 where a>=2;
+connection master;
select f("try_42_");
f("try_42_")
1
+connection slave;
insert into t2 values(3,null),(4,null);
delete from t2 where a>=3;
+connection master;
prepare stmt1 from 'select f(?)';
set @string="try_43_";
insert into t1 values(null,"try_44_");
@@ -259,6 +296,8 @@ execute stmt1 using @string;
f(?)
1
deallocate prepare stmt1;
+connection slave;
+connection master;
create table t12 select * from t1;
drop table t1;
create table t1 (a int, b varchar(100), key(a));
@@ -284,12 +323,16 @@ end|
select f1("try_46_"),f2("try_47_");
f1("try_46_") f2("try_47_")
1 1
+connection slave;
insert into t2 values(2,null),(3,null),(4,null);
delete from t2 where a>=2;
+connection master;
select f1("try_48_"),f2("try_49_");
f1("try_48_") f2("try_49_")
1 1
insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
+connection slave;
+connection master;
drop function f2;
create function f2 (x varchar(100)) returns int deterministic
begin
@@ -301,6 +344,8 @@ end|
select f1("try_53_"),f2("try_54_");
f1("try_53_") f2("try_54_")
1 3
+connection slave;
+connection master;
drop function f2;
create trigger t1_bi before insert on t1 for each row
begin
@@ -309,12 +354,16 @@ end|
insert into t1 values(null,"try_56_");
alter table t1 modify a int, drop primary key;
insert into t1 values(null,"try_57_");
+connection slave;
+connection master;
CREATE TEMPORARY TABLE t15 SELECT UUID();
create table t16 like t15;
INSERT INTO t16 SELECT * FROM t15;
insert into t16 values("try_65_");
drop table t15;
insert into t16 values("try_66_");
+connection slave;
+connection master;
select count(*) from t1;
count(*)
7
@@ -338,7 +387,7 @@ count(*)
66
select count(*) from t21;
count(*)
-14
+19
select count(*) from t22;
count(*)
2
@@ -354,6 +403,8 @@ count(*)
select count(*) from t16;
count(*)
3
+connection slave;
+connection master;
DROP TABLE IF EXISTS t11;
SET SESSION BINLOG_FORMAT=STATEMENT;
CREATE TABLE t11 (song VARCHAR(255));
@@ -366,17 +417,44 @@ UNLOCK TABLES;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
+connection slave;
USE mysqltest1;
SELECT * FROM t11;
song Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
song Careful With That Axe, Eugene
+connection master;
DROP TABLE IF EXISTS t12;
SET SESSION BINLOG_FORMAT=MIXED;
CREATE TABLE t12 (data LONG);
LOCK TABLES t12 WRITE;
INSERT INTO t12 VALUES(UUID());
UNLOCK TABLES;
-show binlog events;
-show binlog events;
+connection slave;
+connection master;
+CREATE FUNCTION my_user()
+RETURNS CHAR(64)
+BEGIN
+DECLARE user CHAR(64);
+SELECT USER() INTO user;
+RETURN user;
+END $$
+CREATE FUNCTION my_current_user()
+RETURNS CHAR(64)
+BEGIN
+DECLARE user CHAR(64);
+SELECT CURRENT_USER() INTO user;
+RETURN user;
+END $$
+DROP TABLE IF EXISTS t13;
+CREATE TABLE t13 (data CHAR(64));
+INSERT INTO t13 VALUES (USER());
+INSERT INTO t13 VALUES (my_user());
+INSERT INTO t13 VALUES (CURRENT_USER());
+INSERT INTO t13 VALUES (my_current_user());
+connection slave;
+connection master;
drop database mysqltest1;
-set global binlog_format= @saved_binlog_format;
+connection slave;
+connection master;
+set global binlog_format =@my_binlog_format;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_temp_table.result b/mysql-test/suite/engines/funcs/r/rpl_temp_table.result
index e4ca31d8908..ff3e52f77b5 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_temp_table.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_temp_table.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create table t2 (n int, PRIMARY KEY(n));
create temporary table t1 (n int);
create temporary table t3 (n int not null);
@@ -15,10 +11,16 @@ insert into t3 values (1010);
insert into t2 select * from t3;
drop table if exists t3;
insert into t2 values (1012);
+connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
+disconnect master;
+connection slave;
+connection master1;
insert into t2 values(61);
+disconnect master1;
+connection slave;
select * from t2;
n
1
@@ -43,6 +45,19 @@ sum(n)
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+*** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ***
+connect master2,localhost,root,,;
+INSERT INTO t2 VALUES (2000), (2001);
+CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
+CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2;
+disconnect master2;
+connection default;
+connection slave;
+connect master2,localhost,root,,;
+connection master2;
drop table if exists t1,t2;
Warnings:
-Note 1051 Unknown table 't1'
+Note 1051 Unknown table 'test.t1'
+drop function f;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_temporary.result b/mysql-test/suite/engines/funcs/r/rpl_temporary.result
index 27def773a30..e2999cdd225 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_temporary.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_temporary.result
@@ -1,11 +1,43 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+SET sql_log_bin = 0;
+SET sql_log_bin = 1;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
-CREATE USER ''@localhost;
+connection master;
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 (a char(1));
+INSERT INTO t1 VALUES ('a');
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+INSERT INTO t1 VALUES ('b');
+connection slave;
+connection master;
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE `t1`(`a` tinyint,`b` char(1))engine=myisam;
+INSERT IGNORE INTO `t1` set `a`=128,`b`='128';
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+connection slave;
+include/stop_slave.inc
+include/start_slave.inc
+connection master;
+INSERT IGNORE INTO `t1` set `a`=128,`b`='128';
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+connection slave;
+connection master;
+DROP TABLE t1;
+connection slave;
+connection master;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connect con3,localhost,zedjzlcsjhd,,;
+connection con3;
SET @save_select_limit=@@session.sql_select_limit;
SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
@@ -17,20 +49,33 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
SELECT @@session.sql_select_limit = @save_select_limit;
@@session.sql_select_limit = @save_select_limit
1
+connection con2;
+SET @save_conn_id= connection_id();
SET @@session.pseudo_thread_id=100;
SET @@session.pseudo_thread_id=connection_id();
+SET @@session.pseudo_thread_id=@save_conn_id;
SET @@session.sql_log_bin=0;
SET @@session.sql_log_bin=1;
+connection con3;
drop table if exists t1,t2;
create table t1(f int);
create table t2(f int);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+connection con1;
create temporary table t3(f int);
insert into t3 select * from t1 where f<6;
+connection con2;
create temporary table t3(f int);
+connection con1;
insert into t2 select count(*) from t3;
+connection con2;
insert into t3 select * from t1 where f>=4;
+connection con1;
drop temporary table t3;
+connection con2;
insert into t2 select count(*) from t3;
drop temporary table t3;
select * from t2 ORDER BY f;
@@ -75,15 +120,22 @@ f
7
drop table t1,t2;
create temporary table t3 (f int);
+connection slave;
+connection master;
create temporary table t4 (f int);
create table t5 (f int);
-select id from information_schema.processlist where command='Binlog Dump' into @id;
-kill @id;
+connection slave;
+stop slave;
+connection master;
insert into t5 select * from t4;
+connection slave;
+start slave;
select * from t5 /* must be 1 after reconnection */;
f
+connection master;
drop temporary table t4;
drop table t5;
+connection con1;
set @@session.pseudo_thread_id=100;
create temporary table t101 (id int);
create temporary table t102 (id int);
@@ -95,14 +147,99 @@ set @@session.pseudo_thread_id=300;
create temporary table t301 (id int);
create temporary table t302 (id int);
create temporary table `#sql_not_user_table303` (id int);
-DROP USER ''@localhost;
+disconnect con1;
+connection master;
create table t1(f int);
insert into t1 values (1);
+connection slave;
select * from t1 /* must be 1 */;
f
1
+connection master;
drop table t1;
+connection slave;
select * from t1;
a
1
+connection master;
drop table t1;
+connection slave;
+include/stop_slave.inc
+connection master;
+include/rpl_reset.inc
+-- Bug#43748
+-- make a user on the slave that can list but not kill system threads.
+connection slave;
+FLUSH PRIVILEGES;
+GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow';
+GRANT PROCESS ON *.* TO user43748@127.0.0.1;
+-- try to KILL system-thread as that non-privileged user (on slave).
+connect cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,;
+connection cont43748;
+SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1;
+KILL @id;
+Got one of the listed errors
+disconnect cont43748;
+-- throw out test-user on slave.
+connection slave;
+DROP USER user43748@127.0.0.1;
+#
+# MDEV-10216: Assertion `strcmp(share->unique_file_name,filename) ||
+# share->last_version' failed in myisam/mi_open.c:67: test_if_reopen
+#
+connection master;
+CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1);
+SELECT COUNT(*)=1 FROM t1;
+COUNT(*)=1
+1
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+LOCK TABLES t1 WRITE;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+LOCK TABLES t1 READ;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+FLUSH TABLES WITH READ LOCK;
+ALTER TABLE t1 RENAME t2;
+SELECT COUNT(*)=1 FROM t2;
+COUNT(*)=1
+1
+ALTER TABLE t2 RENAME t1;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+UNLOCK TABLES;
+ALTER TABLE t1 RENAME t2, LOCK SHARED;
+ALTER TABLE t2 RENAME t1, LOCK EXCLUSIVE;
+DROP TABLE t1;
+#
+# MDEV-10320: NO-OP ALTER TABLE on temporary tables getting logged
+# under row binlog format
+#
+connection master;
+CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM;
+ALTER TABLE t1;
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS I INT;
+Warnings:
+Note 1060 Duplicate column name 'I'
+DROP TABLE t1;
+End of 5.1 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_trigger.result b/mysql-test/suite/engines/funcs/r/rpl_trigger.result
index 7c7cda1f581..b5b88670fc6 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_trigger.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_trigger.result
@@ -1,12 +1,6 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
create table t1 (a int auto_increment, primary key (a), b int, rand_value double not null);
create table t2 (a int auto_increment, primary key (a), b int);
create table t3 (a int auto_increment, primary key (a), name varchar(64) not null, old_a int, old_b int, rand_value double not null);
@@ -22,8 +16,10 @@ insert into t3 values(100,"log",0,0,0);
SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
insert into t1 values(1,1,rand()),(NULL,2,rand());
insert into t2 (b) values(last_insert_id());
-insert into t2 values(3,0),(NULL,0);
-insert into t2 values(NULL,0),(500,0);
+insert into t2 values(3,0);
+insert into t2 values(NULL,0);
+insert into t2 values(NULL,0);
+insert into t2 values(500,0);
select a,b, truncate(rand_value,4) from t1;
a b truncate(rand_value,4)
1 1 0.4320
@@ -39,14 +35,13 @@ select a,name, old_a, old_b, truncate(rand_value,4) from t3;
a name old_a old_b truncate(rand_value,4)
100 log 0 0 0.0000
101 t1 1 1 0.3203
-102 t1 0 2 0.5666
+102 t1 NULL 2 0.5666
103 t2 1 2 0.9164
104 t2 3 0 0.8826
105 t2 4 0 0.6635
106 t2 5 0 0.6699
107 t2 500 0 0.3593
-
---- On slave --
+connection slave;
select a,b, truncate(rand_value,4) from t1;
a b truncate(rand_value,4)
1 1 0.4320
@@ -62,16 +57,20 @@ select a,name, old_a, old_b, truncate(rand_value,4) from t3;
a name old_a old_b truncate(rand_value,4)
100 log 0 0 0.0000
101 t1 1 1 0.3203
-102 t1 0 2 0.5666
+102 t1 NULL 2 0.5666
103 t2 1 2 0.9164
104 t2 3 0 0.8826
105 t2 4 0 0.6635
106 t2 5 0 0.6699
107 t2 500 0 0.3593
+connection master;
drop table t1,t2,t3;
+connect con2,localhost,root,,;
+connection con2;
select get_lock("bug12480",2);
get_lock("bug12480",2)
1
+connection default;
create table t1 (a datetime,b datetime, c datetime);
drop function if exists bug12480;
create function bug12480() returns datetime
@@ -91,40 +90,33 @@ select a=b && a=c from t1;
a=b && a=c
1
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
routine_name definer
-add_suppression root@localhost
-check_testcase root@localhost
-check_warnings root@localhost
-force_restart root@localhost
bug12480 root@localhost
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
trigger_name definer
-gs_insert root@localhost
-ts_insert root@localhost
t1_first root@localhost
-
---- On slave --
+connection slave;
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
routine_name definer
-add_suppression root@localhost
-check_testcase root@localhost
-check_warnings root@localhost
-force_restart root@localhost
bug12480 root@localhost
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
trigger_name definer
-gs_insert root@localhost
-ts_insert root@localhost
t1_first root@localhost
select a=b && a=c from t1;
a=b && a=c
1
test
1
+connection master;
+disconnect con2;
truncate table t1;
drop trigger t1_first;
insert into t1 values ("2003-03-03","2003-03-03","2003-03-03"),(bug12480(),bug12480(),bug12480()),(now(),now(),now());
@@ -144,6 +136,8 @@ end|
create database other;
use other;
insert into test.t1 values (1);
+connection slave;
+connection master;
use test;
drop table t1,t2;
drop database other;
@@ -151,14 +145,18 @@ test case for BUG#13227
-------------------
10
-------------------
+connection master;
drop table if exists t110;
+connection slave;
drop table if exists t210,t310;
+connection master;
create table t110 (f1 int) /* 2 replicate */;
insert into t110 values (-5);
insert into t110 values (-4);
insert into t110 values (-3);
insert into t110 values (-2);
insert into t110 values (-1);
+connection slave;
select * from t110;
f1
-5
@@ -198,11 +196,13 @@ f1
SELECT * from t310 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t110 SET f1=5 where f1=-5;
UPDATE t110 SET f1=4 where f1=-4;
UPDATE t110 SET f1=3 where f1=-3;
UPDATE t110 SET f1=2 where f1=-2;
UPDATE t110 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t110 /* must be f1 5 ... 1 */;
f1
5
@@ -219,18 +219,25 @@ f3
100
drop trigger trg110;
drop table t210,t310;
+connection master;
drop table t110;
+connection slave;
+connection master;
-------------------
9
-------------------
+connection master;
drop table if exists t19;
+connection slave;
drop table if exists t29,t39;
+connection master;
create table t19 (f1 int) /* 2 replicate */;
insert into t19 values (-5);
insert into t19 values (-4);
insert into t19 values (-3);
insert into t19 values (-2);
insert into t19 values (-1);
+connection slave;
select * from t19;
f1
-5
@@ -270,11 +277,13 @@ f1
SELECT * from t39 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t19 SET f1=5 where f1=-5;
UPDATE t19 SET f1=4 where f1=-4;
UPDATE t19 SET f1=3 where f1=-3;
UPDATE t19 SET f1=2 where f1=-2;
UPDATE t19 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t19 /* must be f1 5 ... 1 */;
f1
5
@@ -291,18 +300,25 @@ f3
100
drop trigger trg19;
drop table t29,t39;
+connection master;
drop table t19;
+connection slave;
+connection master;
-------------------
8
-------------------
+connection master;
drop table if exists t18;
+connection slave;
drop table if exists t28,t38;
+connection master;
create table t18 (f1 int) /* 2 replicate */;
insert into t18 values (-5);
insert into t18 values (-4);
insert into t18 values (-3);
insert into t18 values (-2);
insert into t18 values (-1);
+connection slave;
select * from t18;
f1
-5
@@ -342,11 +358,13 @@ f1
SELECT * from t38 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t18 SET f1=5 where f1=-5;
UPDATE t18 SET f1=4 where f1=-4;
UPDATE t18 SET f1=3 where f1=-3;
UPDATE t18 SET f1=2 where f1=-2;
UPDATE t18 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t18 /* must be f1 5 ... 1 */;
f1
5
@@ -363,18 +381,25 @@ f3
100
drop trigger trg18;
drop table t28,t38;
+connection master;
drop table t18;
+connection slave;
+connection master;
-------------------
7
-------------------
+connection master;
drop table if exists t17;
+connection slave;
drop table if exists t27,t37;
+connection master;
create table t17 (f1 int) /* 2 replicate */;
insert into t17 values (-5);
insert into t17 values (-4);
insert into t17 values (-3);
insert into t17 values (-2);
insert into t17 values (-1);
+connection slave;
select * from t17;
f1
-5
@@ -414,11 +439,13 @@ f1
SELECT * from t37 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t17 SET f1=5 where f1=-5;
UPDATE t17 SET f1=4 where f1=-4;
UPDATE t17 SET f1=3 where f1=-3;
UPDATE t17 SET f1=2 where f1=-2;
UPDATE t17 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t17 /* must be f1 5 ... 1 */;
f1
5
@@ -435,18 +462,25 @@ f3
100
drop trigger trg17;
drop table t27,t37;
+connection master;
drop table t17;
+connection slave;
+connection master;
-------------------
6
-------------------
+connection master;
drop table if exists t16;
+connection slave;
drop table if exists t26,t36;
+connection master;
create table t16 (f1 int) /* 2 replicate */;
insert into t16 values (-5);
insert into t16 values (-4);
insert into t16 values (-3);
insert into t16 values (-2);
insert into t16 values (-1);
+connection slave;
select * from t16;
f1
-5
@@ -486,11 +520,13 @@ f1
SELECT * from t36 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t16 SET f1=5 where f1=-5;
UPDATE t16 SET f1=4 where f1=-4;
UPDATE t16 SET f1=3 where f1=-3;
UPDATE t16 SET f1=2 where f1=-2;
UPDATE t16 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t16 /* must be f1 5 ... 1 */;
f1
5
@@ -507,18 +543,25 @@ f3
100
drop trigger trg16;
drop table t26,t36;
+connection master;
drop table t16;
+connection slave;
+connection master;
-------------------
5
-------------------
+connection master;
drop table if exists t15;
+connection slave;
drop table if exists t25,t35;
+connection master;
create table t15 (f1 int) /* 2 replicate */;
insert into t15 values (-5);
insert into t15 values (-4);
insert into t15 values (-3);
insert into t15 values (-2);
insert into t15 values (-1);
+connection slave;
select * from t15;
f1
-5
@@ -558,11 +601,13 @@ f1
SELECT * from t35 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t15 SET f1=5 where f1=-5;
UPDATE t15 SET f1=4 where f1=-4;
UPDATE t15 SET f1=3 where f1=-3;
UPDATE t15 SET f1=2 where f1=-2;
UPDATE t15 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t15 /* must be f1 5 ... 1 */;
f1
5
@@ -579,18 +624,25 @@ f3
100
drop trigger trg15;
drop table t25,t35;
+connection master;
drop table t15;
+connection slave;
+connection master;
-------------------
4
-------------------
+connection master;
drop table if exists t14;
+connection slave;
drop table if exists t24,t34;
+connection master;
create table t14 (f1 int) /* 2 replicate */;
insert into t14 values (-5);
insert into t14 values (-4);
insert into t14 values (-3);
insert into t14 values (-2);
insert into t14 values (-1);
+connection slave;
select * from t14;
f1
-5
@@ -630,11 +682,13 @@ f1
SELECT * from t34 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t14 SET f1=5 where f1=-5;
UPDATE t14 SET f1=4 where f1=-4;
UPDATE t14 SET f1=3 where f1=-3;
UPDATE t14 SET f1=2 where f1=-2;
UPDATE t14 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t14 /* must be f1 5 ... 1 */;
f1
5
@@ -651,18 +705,25 @@ f3
100
drop trigger trg14;
drop table t24,t34;
+connection master;
drop table t14;
+connection slave;
+connection master;
-------------------
3
-------------------
+connection master;
drop table if exists t13;
+connection slave;
drop table if exists t23,t33;
+connection master;
create table t13 (f1 int) /* 2 replicate */;
insert into t13 values (-5);
insert into t13 values (-4);
insert into t13 values (-3);
insert into t13 values (-2);
insert into t13 values (-1);
+connection slave;
select * from t13;
f1
-5
@@ -702,11 +763,13 @@ f1
SELECT * from t33 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t13 SET f1=5 where f1=-5;
UPDATE t13 SET f1=4 where f1=-4;
UPDATE t13 SET f1=3 where f1=-3;
UPDATE t13 SET f1=2 where f1=-2;
UPDATE t13 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t13 /* must be f1 5 ... 1 */;
f1
5
@@ -723,18 +786,25 @@ f3
100
drop trigger trg13;
drop table t23,t33;
+connection master;
drop table t13;
+connection slave;
+connection master;
-------------------
2
-------------------
+connection master;
drop table if exists t12;
+connection slave;
drop table if exists t22,t32;
+connection master;
create table t12 (f1 int) /* 2 replicate */;
insert into t12 values (-5);
insert into t12 values (-4);
insert into t12 values (-3);
insert into t12 values (-2);
insert into t12 values (-1);
+connection slave;
select * from t12;
f1
-5
@@ -774,11 +844,13 @@ f1
SELECT * from t32 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t12 SET f1=5 where f1=-5;
UPDATE t12 SET f1=4 where f1=-4;
UPDATE t12 SET f1=3 where f1=-3;
UPDATE t12 SET f1=2 where f1=-2;
UPDATE t12 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t12 /* must be f1 5 ... 1 */;
f1
5
@@ -795,18 +867,25 @@ f3
100
drop trigger trg12;
drop table t22,t32;
+connection master;
drop table t12;
+connection slave;
+connection master;
-------------------
1
-------------------
+connection master;
drop table if exists t11;
+connection slave;
drop table if exists t21,t31;
+connection master;
create table t11 (f1 int) /* 2 replicate */;
insert into t11 values (-5);
insert into t11 values (-4);
insert into t11 values (-3);
insert into t11 values (-2);
insert into t11 values (-1);
+connection slave;
select * from t11;
f1
-5
@@ -846,11 +925,13 @@ f1
SELECT * from t31 /* must be f3 5*100 */;
f3
500
+connection master;
UPDATE t11 SET f1=5 where f1=-5;
UPDATE t11 SET f1=4 where f1=-4;
UPDATE t11 SET f1=3 where f1=-3;
UPDATE t11 SET f1=2 where f1=-2;
UPDATE t11 SET f1=1 where f1=-1;
+connection slave;
SELECT * from t11 /* must be f1 5 ... 1 */;
f1
5
@@ -867,11 +948,20 @@ f3
100
drop trigger trg11;
drop table t21,t31;
+connection master;
drop table t11;
-STOP SLAVE;
+connection slave;
+connection master;
+connection slave;
+include/stop_slave.inc
+connection master;
FLUSH LOGS;
+include/rpl_stop_server.inc [server_number=1]
+include/rpl_start_server.inc [server_number=1]
+--> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4
+connection slave;
RESET SLAVE;
-START SLAVE;
+include/start_slave.inc
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
MASTER_POS_WAIT('master-bin.000001', 513) >= 0
1
@@ -881,7 +971,7 @@ t1
t2
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL latin1 latin1_swedish_ci latin1_swedish_ci
+trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER # latin1 latin1_swedish_ci latin1_swedish_ci
SELECT * FROM t1;
c
1
@@ -900,25 +990,28 @@ root@localhost
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE t2;
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
+connection master;
SHOW TABLES LIKE 't_';
Tables_in_test (t_)
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
RESET MASTER;
-START SLAVE;
+connection slave;
+include/start_slave.inc
---> Test for BUG#20438
---> Preparing environment...
----> connection: master
+connection master;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
---> Synchronizing slave with master...
+connection slave;
----> connection: master
+connection master;
---> Creating objects...
CREATE TABLE t1(c INT);
@@ -939,7 +1032,7 @@ c
10
---> Synchronizing slave with master...
----> connection: master
+connection slave;
---> Checking on slave...
SELECT * FROM t1;
@@ -949,11 +1042,14 @@ SELECT * FROM t2;
c
10
----> connection: master
+connection master;
---> Cleaning up...
DROP TABLE t1;
DROP TABLE t2;
+connection slave;
+connection master;
+connection master;
drop table if exists t1;
create table t1(a int, b varchar(50));
drop trigger not_a_trigger;
@@ -975,11 +1071,15 @@ a b
1 In trigger t1_bi
2 b
3 c
+connection slave;
select * from t1;
a b
1 In trigger t1_bi
2 b
3 c
+connection master;
drop table if exists t1,t11;
Warnings:
-Note 1051 Unknown table 't11'
+Note 1051 Unknown table 'test.t11'
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result b/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result
index 44624a38875..35cd91d795b 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_trunc_temp.result
@@ -1,22 +1,26 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
create temporary table t1 (n int);
insert into t1 values(1);
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+connection master;
delete from t1;
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+connection master;
truncate t1;
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
+disconnect master;
+connection slave;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_user_variables.result b/mysql-test/suite/engines/funcs/r/rpl_user_variables.result
index ed0d2782394..0efdbff5522 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_user_variables.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_user_variables.result
@@ -1,10 +1,8 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
+connection slave;
reset master;
+connection master;
create table t1(n char(30));
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
@@ -23,6 +21,7 @@ set @a:=5;
insert into t1 values (@a),(@a);
select * from t1 where n = '<nonexistant>';
n
+connection master1;
insert into t1 values (@a),(@a),(@a*5);
SELECT * FROM t1 ORDER BY n;
n
@@ -51,6 +50,7 @@ abcn1
abcn1n2
abc\def
This is a test
+connection slave;
SELECT * FROM t1 ORDER BY n;
n
NULL
@@ -78,6 +78,235 @@ abcn1
abcn1n2
abc\def
This is a test
+connection master;
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
drop table t1;
-stop slave;
+End of 4.1 tests.
+DROP TABLE IF EXISTS t20;
+DROP TABLE IF EXISTS t21;
+DROP PROCEDURE IF EXISTS test.insert;
+CREATE TABLE t20 (a VARCHAR(20));
+CREATE TABLE t21 (a VARCHAR(20));
+CREATE PROCEDURE test.insert()
+BEGIN
+IF (@VAR)
+THEN
+INSERT INTO test.t20 VALUES ('SP_TRUE');
+ELSE
+INSERT INTO test.t20 VALUES ('SP_FALSE');
+END IF;
+END|
+CREATE TRIGGER test.insert_bi BEFORE INSERT
+ON test.t20 FOR EACH ROW
+BEGIN
+IF (@VAR)
+THEN
+INSERT INTO test.t21 VALUES ('TRIG_TRUE');
+ELSE
+INSERT INTO test.t21 VALUES ('TRIG_FALSE');
+END IF;
+END|
+connection slave;
+connection master;
+SET @VAR=0;
+CALL test.insert();
+SET @VAR=1;
+CALL test.insert();
+Check the tables for correct data
+SELECT * FROM t20;
+a
+SP_FALSE
+SP_TRUE
+SELECT * FROM t21;
+a
+TRIG_FALSE
+TRIG_TRUE
+connection slave;
+Check the tables for correct data and it matches master
+SELECT * FROM t20;
+a
+SP_FALSE
+SP_TRUE
+SELECT * FROM t21;
+a
+TRIG_FALSE
+TRIG_TRUE
+connection master;
+DROP TABLE t20;
+DROP TABLE t21;
+DROP PROCEDURE test.insert;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS test.square;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN
+(@var * @var);
+SET @var = 1;
+INSERT INTO t1 VALUES (square());
+SET @var = 2;
+INSERT INTO t1 VALUES (square());
+SET @var = 3;
+INSERT INTO t1 VALUES (square());
+SET @var = 4;
+INSERT INTO t1 VALUES (square());
+SET @var = 5;
+INSERT INTO t1 VALUES (square());
+Retrieve the values from the table
+SELECT * FROM t1;
+i
+1
+4
+9
+16
+25
+connection slave;
+Retrieve the values from the table and verify they are the same as on master
+SELECT * FROM t1;
+i
+1
+4
+9
+16
+25
+connection master;
+DROP TABLE t1;
+DROP FUNCTION test.square;
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+CREATE TABLE t1(a int);
+CREATE FUNCTION f1() returns int deterministic BEGIN
+return @a;
+END |
+CREATE FUNCTION f2() returns int deterministic BEGIN
+IF (@b > 0) then
+SET @c = (@a + @b);
+else
+SET @c = (@a - 1);
+END if;
+return @c;
+END |
+connection slave;
+connection master;
+SET @a=500;
+INSERT INTO t1 values(f1());
+SET @b = 125;
+SET @c = 1;
+INSERT INTO t1 values(f2());
+Retrieve the values from the table
+connection slave;
+connection master;
+SELECT * from t1;
+a
+500
+625
+connection slave;
+Check the tables for correct data and it matches master
+SELECT * from t1;
+a
+500
+625
+connection master;
+DROP TABLE t1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (i int);
+CREATE TABLE t2 (k int);
+CREATE trigger t1_bi before INSERT on t1 for each row BEGIN
+INSERT INTO t2 values (@a);
+SET @a:=42;
+INSERT INTO t2 values (@a);
+END |
+connection slave;
+connection master;
+SET @a:=100;
+INSERT INTO t1 values (5);
+Check to see that data was inserted correctly in both tables
+SELECT * from t1;
+i
+5
+SELECT * from t2;
+k
+100
+42
+connection slave;
+Check the tables for correct data and it matches master
+SELECT * from t1;
+i
+5
+SELECT * from t2;
+k
+100
+42
+connection master;
+drop table t1, t2;
+connection master;
+create table t1(a int, b int);
+prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
+set @x=1;
+execute s1 using @x;
+select * from t1;
+a b
+2 1
+connection slave;
+connection slave;
+select * from t1;
+a b
+2 1
+connection master;
+drop table t1;
+connection master;
+create table t1(a int);
+insert into t1 values (1),(2);
+prepare s1 from 'insert into t1 select a from t1 limit ?';
+set @x='1.1';
+execute s1 using @x;
+select * from t1;
+a
+1
+2
+1
+connection slave;
+connection slave;
+select * from t1;
+a
+1
+2
+1
+connection master;
+drop table t1;
+End of 5.0 tests.
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+CREATE TABLE t1 (i INT);
+CREATE FUNCTION f1() RETURNS INT RETURN @a;
+CREATE
+FUNCTION f2() RETURNS INT BEGIN
+INSERT INTO t1 VALUES (10 + @a);
+RETURN 0;
+END|
+connection slave;
+connection master;
+SET @a:=123;
+SELECT f1(), f2();
+f1() f2()
+123 0
+Check to see that data was inserted correctly
+INSERT INTO t1 VALUES(f1());
+SELECT * FROM t1;
+i
+133
+123
+connection slave;
+Check the table for correct data and it matches master
+SELECT * FROM t1;
+i
+133
+123
+connection master;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_variables.result b/mysql-test/suite/engines/funcs/r/rpl_variables.result
index 6a9af27179e..547c324fdf8 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_variables.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_variables.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
set @my_slave_net_timeout =@@global.slave_net_timeout;
set @my_sql_slave_skip_counter =@@global.sql_slave_skip_counter;
set global slave_net_timeout=100;
@@ -19,3 +15,4 @@ Variable_name Value
slave_skip_errors 3,100,137,643,1752
set global slave_net_timeout=@my_slave_net_timeout;
set global sql_slave_skip_counter=@my_sql_slave_skip_counter;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/r/rpl_view.result b/mysql-test/suite/engines/funcs/r/rpl_view.result
index 00d9bfbf380..68a149720b0 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_view.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_view.result
@@ -1,12 +1,10 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
drop table if exists t1,v1;
drop view if exists t1,v1;
+connection slave;
reset master;
+connection master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
@@ -15,45 +13,57 @@ select * from v1 order by a;
a
1
2
+connection slave;
select * from v1 order by a;
a
1
2
+connection master;
update v1 set a=3 where a=1;
select * from v1 order by a;
a
2
3
+connection slave;
select * from v1 order by a;
a
2
3
+connection master;
delete from v1 where a=2;
select * from v1 order by a;
a
3
+connection slave;
select * from v1 order by a;
a
3
+connection master;
alter view v1 as select a as b from t1;
+connection slave;
select * from v1 order by 1;
b
3
+connection master;
drop view v1;
+connection slave;
select * from v1 order by a;
ERROR 42S02: Table 'test.v1' doesn't exist
+connection master;
drop table t1;
+connection slave;
---> Test for BUG#20438
---> Preparing environment...
----> connection: master
+connection master;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
---> Synchronizing slave with master...
+connection slave;
----> connection: master
+connection master;
---> Creating objects...
CREATE TABLE t1(c INT);
@@ -68,21 +78,22 @@ c
1
---> Synchronizing slave with master...
----> connection: master
-
----> Checking on slave...
+connection slave;
SELECT * FROM t1;
c
1
-
----> connection: master
+connection master;
---> Cleaning up...
DROP VIEW v1;
DROP TABLE t1;
+connection slave;
+connection master;
+connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
+connection slave;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
@@ -93,6 +104,35 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
select * from v1;
a b
1 6
+connection master;
drop table t1;
drop view v1;
+connection slave;
+connection master;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v1 AS SELECT * FROM t1;
+ERROR 42S01: Table 'v1' already exists
+DROP VIEW v1;
+DROP TABLE t1;
+connection slave;
+connection master;
+CREATE TABLE t1 (a INT);
+# create view as output from mysqldump 10.11 (5.0.62)
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` < 3) */
+/*!50002 WITH CASCADED CHECK OPTION */;
+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 `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci
+connection slave;
+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 `t1`.`a` AS `a` from `t1` where `t1`.`a` < 3 WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci
+connection master;
+DROP VIEW v1;
+DROP TABLE t1;
+connection slave;
End of 5.0 tests
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt b/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt
deleted file mode 100644
index 0dbfb311e33..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000010-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---disconnect-slave-event-count=2
diff --git a/mysql-test/suite/engines/funcs/t/rpl000010.test b/mysql-test/suite/engines/funcs/t/rpl000010.test
deleted file mode 100644
index 261b9148774..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000010.test
+++ /dev/null
@@ -1,19 +0,0 @@
-# This tests the offset off by 22 mystery bug
-# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
-
-source include/master-slave.inc;
-
-create table t1 (n int not null auto_increment primary key);
-insert into t1 values(NULL);
-insert into t1 values(2);
-save_master_pos;
-connection slave;
-sync_with_master;
-select n from t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl000011.test b/mysql-test/suite/engines/funcs/t/rpl000011.test
deleted file mode 100644
index 32f6227f7c5..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000011.test
+++ /dev/null
@@ -1,17 +0,0 @@
-source include/master-slave.inc;
-
-create table t1 (n int);
-insert into t1 values(1);
-sync_slave_with_master;
-stop slave;
-start slave;
-connection master;
-insert into t1 values(2);
-#let slave catch up
-sync_slave_with_master;
-select * from t1;
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl000013.test b/mysql-test/suite/engines/funcs/t/rpl000013.test
deleted file mode 100644
index 2c727107563..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000013.test
+++ /dev/null
@@ -1,61 +0,0 @@
-# This test is to verify that DROP TEMPORARY TABLE
-# is automatically binlogged and sent to slave
-# when a temp table is dropped by disconnection
-# of a master's conection.
-# So it does not apply to row-based, where we neither need
-# nor do this automatic binlogging. And if we run this test
-# in row-based, it hangs waiting for an offset which is never
-# reached (the "sync_with_master 1"), logically.
-
---source include/have_binlog_format_mixed_or_statement.inc
-source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master;
-
---disable_query_log
-CALL mtr.add_suppression(" Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-create table t2(n int);
-create temporary table t1 (n int);
-insert into t1 values(1),(2),(3);
---disable_warnings
-insert into t2 select * from t1;
---enable_warnings
-connection master1;
-create temporary table t1 (n int);
-insert into t1 values (4),(5);
---disable_warnings
-insert into t2 select * from t1 as t10;
---enable_warnings
-save_master_pos;
-disconnect master;
-connection slave;
-#add 1 to catch drop table
-sync_with_master 1;
-connection master1;
-insert into t2 values(6);
-save_master_pos;
-disconnect master1;
-connection slave;
-# same trick to go one more event
-sync_with_master 1;
-select * from t2;
-show status like 'Slave_open_temp_tables';
-#
-# Clean up
-#
-connect (master2,localhost,root,,);
-connection master2;
-
-# We will get a warning for t1 as this is a temporary table that doesn't
-# exist in this connection.
-
-drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt b/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt
deleted file mode 100644
index 58a964c90d0..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl000017-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-slave-start
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000010.test b/mysql-test/suite/engines/funcs/t/rpl_000010.test
new file mode 100644
index 00000000000..155b54572e3
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000010.test
@@ -0,0 +1,2 @@
+--source suite/rpl/t/rpl_000010.test
+
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000011.test b/mysql-test/suite/engines/funcs/t/rpl_000011.test
new file mode 100644
index 00000000000..f7fc0f4a310
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000011.test
@@ -0,0 +1,18 @@
+--source include/master-slave.inc
+
+create table t1 (n int);
+insert into t1 values(1);
+--sync_slave_with_master
+--source include/stop_slave.inc
+--source include/start_slave.inc
+connection master;
+insert into t1 values(2);
+#let slave catch up
+--sync_slave_with_master
+select * from t1;
+connection master;
+drop table t1;
+--sync_slave_with_master
+
+# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000013.test b/mysql-test/suite/engines/funcs/t/rpl_000013.test
new file mode 100644
index 00000000000..c2f6c114ad6
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000013.test
@@ -0,0 +1,2 @@
+--source suite/rpl/t/rpl_000013.test
+
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000015.test b/mysql-test/suite/engines/funcs/t/rpl_000015.test
index 817ed6f407c..8d76fc674e5 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_000015.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test
@@ -3,13 +3,13 @@
# Change Date: 2006-01-17
# Change: added order by in select
#####################
-source include/master-slave.inc;
+--source include/master-slave.inc
reset master;
show master status;
save_master_pos;
connection slave;
-stop slave;
+--source include/stop_slave.inc
reset slave;
--vertical_results
--replace_result $MASTER_MYPORT MASTER_PORT
@@ -29,7 +29,7 @@ eval change master to master_host='127.0.0.1',master_user='root',
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 5 # 8 # 9 # 23 # 33 #
show slave status;
-start slave;
+--source include/start_slave.inc
sync_with_master;
--vertical_results
--replace_result $MASTER_MYPORT MASTER_PORT
@@ -42,10 +42,11 @@ drop table if exists t1;
--enable_warnings
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
-sync_slave_with_master;
+--sync_slave_with_master
connection slave;
SELECT * FROM t1 ORDER BY n;
connection master;
SELECT * FROM t1 ORDER BY n;
drop table t1;
-sync_slave_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_000017.test b/mysql-test/suite/engines/funcs/t/rpl_000017.test
new file mode 100644
index 00000000000..f498ce10a58
--- /dev/null
+++ b/mysql-test/suite/engines/funcs/t/rpl_000017.test
@@ -0,0 +1,2 @@
+--source suite/rpl/t/rpl_000017.test
+
diff --git a/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test b/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test
index ae647ed6648..e896d62a0ab 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_LD_INFILE.test
@@ -1,38 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-#############################################################################
-# TEST: To test the LOAD DATA INFILE in rbr #
-#############################################################################
-
-# Includes
--- source include/master-slave.inc
-
-# Begin clean up test section
---disable_warnings
-connection master;
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-
-# Section 1 test
-CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
-LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
-DELETE FROM test.t1 WHERE a = 'abashed';
-DELETE FROM test.t1;
-LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
-
-
-SELECT * FROM test.t1 ORDER BY a DESC;
-save_master_pos;
-sync_slave_with_master;
-connection slave;
-SELECT * FROM test.t1 ORDER BY a DESC;
-
-# Cleanup
-#show binlog events;
-connection master;
-DROP TABLE test.t1;
-sync_slave_with_master;
-
-# End of 5.0 test case
+--source suite/rpl/t/rpl_LD_INFILE.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
deleted file mode 100644
index 078d1048794..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Test of automatic redirection of queries to master/slave.
-#
-
-source include/master-slave.inc;
-# We disable this for now as PS doesn't handle redirection
---disable_ps_protocol
-
-#first, make sure the slave has had enough time to register
-save_master_pos;
-connection slave;
-sync_with_master;
-
-#discover slaves
-connection master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-SHOW SLAVE STATUS;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-SHOW SLAVE HOSTS;
-rpl_probe;
-
-#turn on master/slave query direction auto-magic
-enable_rpl_parse;
-create table t1 ( n int);
-insert into t1 values (1),(2),(3),(4);
-disable_rpl_parse;
-save_master_pos;
-connection slave;
-sync_with_master;
-insert into t1 values(5);
-connection master;
-enable_rpl_parse;
-# The first of the queries will be sent to the slave, the second to the master.
-SELECT * FROM t1 ORDER BY n;
-SELECT * FROM t1 ORDER BY n;
-disable_rpl_parse;
-SELECT * FROM t1 ORDER BY n;
-connection slave;
-SELECT * FROM t1 ORDER BY n;
-
-# Cleanup
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_alter.test b/mysql-test/suite/engines/funcs/t/rpl_alter.test
index 576376a0264..12360f5a3e8 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_alter.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_alter.test
@@ -1,24 +1,2 @@
-source include/master-slave.inc;
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-create database mysqltest;
+--source suite/rpl/t/rpl_alter.test
-create table mysqltest.t1 ( n int);
-alter table mysqltest.t1 add m int;
-insert into mysqltest.t1 values (1,2);
-create table mysqltest.t2 (n int);
-insert into mysqltest.t2 values (45);
-rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from mysqltest.t2;
-select * from mysqltest.t3;
-connection master;
-drop database mysqltest;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_alter_db.test b/mysql-test/suite/engines/funcs/t/rpl_alter_db.test
index 17ba06ce063..097eaf9071b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_alter_db.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_alter_db.test
@@ -1,12 +1,2 @@
-source include/master-slave.inc;
-connection master;
-use mysql; # to be different from initial `test' db of mysqltest client
-alter database collate latin1_bin;
-save_master_pos;
+--source suite/rpl/t/rpl_alter_db.test
-connection slave;
-sync_with_master;
-
-# Restoring to the original state
-connection master;
-alter database collate latin1_swedish_ci;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit.test b/mysql-test/suite/engines/funcs/t/rpl_bit.test
index 7f85313ae4c..822fae57f68 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_bit.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_bit.test
@@ -1,93 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Sept/15/2005 #
-#############################################################################
-# Test: To test the replication of the bit field #
-#############################################################################
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
+--source suite/rpl/t/rpl_bit.test
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-
-CREATE TABLE test.t1 (
- dummyKey INTEGER NOT NULL,
- f01 TINYINT,
- f10 TINYINT,
- f12 TINYINT,
- f15 TINYINT,
- f16 TINYINT,
- f7 TINYINT,
- f9 TINYINT,
- f29 TINYINT,
- f0 TINYINT,
- fA1 TINYINT,
- C32 TINYINT,
- A42 TINYINT,
- CA3 TINYINT,
- A044 TINYINT,
- f001 TINYINT,
- A3002 TINYINT,
- fC003 TINYINT,
- CA300 TINYINT,
- A305 TINYINT,
- CA321 TINYINT,
- r001 TINYINT,
- bit1 BIT(6),
- bit2 BIT(6),
- bit3 BIT(6),
- State1 TINYINT,
- State2 TINYINT,
- State3 TINYINT,
- State4 TINYINT,
- SubState TINYINT,
- gState TINYINT,
- oSupp TINYINT,
- tSupp TINYINT,
- sSuppD TINYINT,
- mSuppf TINYINT,
- GSuppDf TINYINT,
- VNotSupp TINYINT,
- x034 TINYINT,
-PRIMARY KEY USING HASH (dummyKey) );
-
-LOCK TABLES test.t1 WRITE;
-INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-UNLOCK TABLES;
-
-
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
-SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-save_master_pos;
-
-connection slave;
-sync_with_master;
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034 FROM test.t1;
-SELECT hex(bit1) FROM test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-
-connection master;
-DROP TABLE IF EXISTS test.t1;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test b/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test
index 12b587919f9..d2214ada074 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_bit_npk.test
@@ -1,116 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Sept/15/2005 #
-#############################################################################
-# Test: To test the replication of the bit field #
-#############################################################################
+--source suite/rpl/t/rpl_bit_npk.test
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-
-CREATE TABLE test.t1 (
- dummyKey INTEGER NOT NULL,
- f01 TINYINT,
- f10 TINYINT,
- f12 TINYINT,
- f15 TINYINT,
- f16 TINYINT,
- f7 TINYINT,
- f9 TINYINT,
- f29 TINYINT,
- f0 TINYINT,
- fA1 TINYINT,
- C32 TINYINT,
- A42 TINYINT,
- CA3 TINYINT,
- A044 TINYINT,
- f001 TINYINT,
- A3002 TINYINT,
- fC003 TINYINT,
- CA300 TINYINT,
- A305 TINYINT,
- CA321 TINYINT,
- r001 TINYINT,
- bit1 BIT(6),
- bit2 BIT(6),
- bit3 BIT(6),
- State1 TINYINT,
- State2 TINYINT,
- State3 TINYINT,
- State4 TINYINT,
- SubState TINYINT,
- gState TINYINT,
- oSupp TINYINT,
- tSupp TINYINT,
- sSuppD TINYINT,
- mSuppf TINYINT,
- GSuppDf TINYINT,
- VNotSupp TINYINT,
- x034 TINYINT);
-
-LOCK TABLES test.t1 WRITE;
-INSERT INTO test.t1 VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'111110',b'110101',4,5,5,5,5,5,5,5,5,5,3,NULL,1);
-INSERT INTO test.t1 VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'100100',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'101010',b'010101',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'101010',b'111111',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'0',1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO test.t1 VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,4,5,5,5,5,5,5,5,5,5,3,2,1);
-UNLOCK TABLES;
-
-UPDATE test.t1 set x034 = 50 where bit3 = b'000000';
-UPDATE test.t1 set VNotSupp = 33 where bit1 = b'0';
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
- FROM test.t1
- ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
-SELECT hex(bit1) from test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-save_master_pos;
-
-connection slave;
-sync_with_master;
-SELECT oSupp, sSuppD, GSuppDf, VNotSupp, x034
- FROM test.t1
- ORDER BY oSupp, sSuppD, GSuppDf, VNotSupp, x034;
-SELECT hex(bit1) from test.t1 ORDER BY bit1;
-SELECT hex(bit2) from test.t1 ORDER BY bit2;
-SELECT hex(bit3) from test.t1 ORDER BY bit3;
-
-connection master;
-CREATE TABLE test.t2 (a INT, b BIT(1));
-INSERT INTO test.t2 VALUES (1, b'0');
-INSERT INTO test.t2 VALUES (1, b'1');
-UPDATE test.t2 SET a = 2 WHERE b = b'1';
-
-CREATE TABLE test.t3 (a INT, b INT);
-INSERT INTO test.t3 VALUES (1, NULL);
-INSERT INTO test.t3 VALUES (1, 0);
-UPDATE test.t3 SET a = 2 WHERE b = 0;
-
-SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
-SELECT * FROM test.t3 ORDER BY a,b;
-save_master_pos;
-
-connection slave;
-sync_with_master;
-SELECT a, hex(b) FROM test.t2 ORDER BY a,b;
-SELECT * FROM test.t3 ORDER BY a,b;
-
-connection master;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_change_master.test b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
index c031464c95e..e7e70bd2ac6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test
@@ -1,37 +1,2 @@
-# Verify that after CHANGE MASTER, replication (I/O thread and SQL
-# thread) restart from where SQL thread left, not from where
-# I/O thread left (some old bug fixed in 4.0.17)
+--source suite/rpl/t/rpl_change_master.test
-source include/master-slave.inc;
-
-connection master;
-# Make SQL slave thread advance a bit
-create table t1(n int);
-sync_slave_with_master;
-select * from t1;
-# Now stop it and make I/O slave thread be ahead
-stop slave sql_thread;
-connection master;
-insert into t1 values(1);
-insert into t1 values(2);
-save_master_pos;
-connection slave;
---real_sleep 3 # wait for I/O thread to have read updates
-stop slave;
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
-change master to master_user='root';
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 23 # 33 #
-show slave status;
-start slave;
-sync_with_master;
-select * from t1;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_create_database.test b/mysql-test/suite/engines/funcs/t/rpl_create_database.test
index 70cff8daca2..8690de2a604 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_create_database.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_create_database.test
@@ -1,72 +1,2 @@
-#
-# Tests for replication of statements that manipulate databases.
-#
-# For this test file, we have a number of databases. All databases
-# with "greek" names will be replicated on the slave, while other names
-# (e.g., american) will not be replicated.
-#
+--source suite/rpl/t/rpl_create_database.test
-source include/master-slave.inc;
-
-# Bug#6391 (binlog-do-db rules ignored)
-# In this case, 'mysqltest_bob' should not be replicated to the slave.
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_prometheus;
-DROP DATABASE IF EXISTS mysqltest_sisyfos;
-DROP DATABASE IF EXISTS mysqltest_bob;
-sync_slave_with_master;
-# This database is not replicated
-DROP DATABASE IF EXISTS mysqltest_bob;
---enable_warnings
-
-connection master;
-CREATE DATABASE mysqltest_prometheus;
-CREATE DATABASE mysqltest_sisyfos;
-CREATE DATABASE mysqltest_bob;
-
-USE mysqltest_sisyfos;
-# These should be replicated
-CREATE TABLE t1 (b int);
-INSERT INTO t1 VALUES(1);
-
-USE mysqltest_bob;
-# These should *not* be replicated
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES(2);
-
-# Current database is now 'mysqltest_bob'
-# The following should be replicated
-ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
-
-USE mysqltest_sisyfos;
-# The following should *not* be replicated
-ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
-
-SHOW DATABASES;
-sync_slave_with_master;
-SHOW DATABASES;
-
-connection master;
-DROP DATABASE IF EXISTS mysqltest_sisyfos;
-USE mysqltest_prometheus;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-CREATE DATABASE mysqltest_sisyfos;
-USE mysqltest_sisyfos;
-CREATE TABLE t2 (a INT);
-let $VERSION=`select version()`;
-SHOW DATABASES;
-sync_slave_with_master;
-SHOW DATABASES;
-USE mysqltest_prometheus;
-SHOW TABLES;
-USE mysqltest_sisyfos;
-SHOW TABLES;
-
-connection master;
-DROP DATABASE IF EXISTS mysqltest_prometheus;
-DROP DATABASE IF EXISTS mysqltest_sisyfos;
-DROP DATABASE IF EXISTS mysqltest_bob;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_do_grant.test b/mysql-test/suite/engines/funcs/t/rpl_do_grant.test
index 4e398114269..95e90ce1bc3 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_do_grant.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_do_grant.test
@@ -1,98 +1,2 @@
-# Works in statement-based and row-based binlogging.
-# Test that GRANT and other user management commands are replicated to the slave
+--source suite/rpl/t/rpl_do_grant.test
--- source include/master-slave.inc
-
-# do not be influenced by other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
-# if these DELETE did nothing on the master, we need to do them manually on the
-# slave.
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
-# test replication of GRANT
-connection master;
-grant select on *.* to rpl_do_grant@localhost;
-grant drop on test.* to rpl_do_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
-show grants for rpl_do_grant@localhost;
-
-# test replication of SET PASSWORD
-connection master;
-set password for rpl_do_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
-select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
-
-# clear what we have done, to not influence other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-sync_slave_with_master;
-# The mysql database is not replicated, so we have to do the deletes
-# manually on the slave as well.
-delete from mysql.user where user=_binary'rpl_do_grant';
-delete from mysql.db where user=_binary'rpl_do_grant';
-flush privileges;
-
-# End of 4.1 tests
-
-connection master;
---error 1141
-show grants for rpl_do_grant@localhost;
-connection slave;
---error 1141
-show grants for rpl_do_grant@localhost;
-
-connection master;
-create user rpl_do_grant@localhost;
-show grants for rpl_do_grant@localhost;
---error 1141
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant@localhost;
---error 1141
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-rename user rpl_do_grant@localhost to rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-grant DELETE,INSERT on mysqltest1.* to rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-revoke DELETE on mysqltest1.* from rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-revoke all privileges, grant option from rpl_do_grant2@localhost;
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
-show grants for rpl_do_grant2@localhost;
-
-connection master;
-drop user rpl_do_grant2@localhost;
---error 1141
-show grants for rpl_do_grant2@localhost;
-sync_slave_with_master;
---error 1141
-show grants for rpl_do_grant2@localhost;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_drop.test b/mysql-test/suite/engines/funcs/t/rpl_drop.test
index b38007a755f..7dda6987502 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_drop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_drop.test
@@ -1,16 +1,2 @@
-# Testcase for BUG#4552 (DROP on two tables, one of which does not
-# exist, must be binlogged with a non-zero error code)
-source include/master-slave.inc;
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
---error 1051
-drop table t1, t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
-
+--source suite/rpl/t/rpl_drop.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_drop_db.test b/mysql-test/suite/engines/funcs/t/rpl_drop_db.test
index fb26cc20f8a..54d5300be14 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_drop_db.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_drop_db.test
@@ -1,61 +1,2 @@
-# test case for BUG#4680 -- if there are extra files in the db directory
-# dropping the db on the master causes replication problems
+--source suite/rpl/t/rpl_drop_db.test
--- source include/master-slave.inc
-connection master;
-
---disable_warnings
-drop database if exists mysqltest1;
---enable_warnings
-create database mysqltest1;
-create table mysqltest1.t1 (n int);
-insert into mysqltest1.t1 values (1);
-select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
-create table mysqltest1.t2 (n int);
-create table mysqltest1.t3 (n int);
---replace_result \\ /
---error 1010
-drop database mysqltest1;
-use mysqltest1;
-show tables;
-
-# test the branch of the code that deals with the query buffer overflow
-
---disable_query_log
-let $1=50;
-while ($1)
-{
- eval create table mysqltest1.mysqltest_long_table_name$1 (n int);
- dec $1;
-}
---enable_query_log
-
---replace_result \\ /
---error 1010
-drop database mysqltest1;
-use mysqltest1;
-show tables;
-use test;
-create table t1 (n int);
-insert into t1 values (1234);
-sync_slave_with_master;
-
-connection slave;
-use mysqltest1;
-show tables;
-use test;
-select * from t1;
-drop table t1;
-
-#cleanup
-connection slave;
-stop slave;
-drop database mysqltest1;
-
-connection master;
-# Remove the "extra" file created above
---remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest1/f1.txt
-drop database mysqltest1;
-
-use test;
-drop table t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test b/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test
index 518fa9df885..bf5e84152bc 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_dual_pos_advance.test
@@ -6,7 +6,7 @@
# of their server id).
# It also will test BUG#13861.
-source include/master-slave.inc;
+--source include/master-slave.inc
# set up "dual head"
@@ -18,7 +18,7 @@ connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
-start slave;
+--source include/start_slave.inc
# now we test it
@@ -68,7 +68,7 @@ sync_with_master;
# show tables;
-# start slave;
+# --source include/start_slave.inc
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
@@ -78,9 +78,7 @@ create table t4 (n int); # create 3 ignored events
create table t5 (n int);
create table t6 (n int);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
connection slave;
@@ -97,12 +95,11 @@ show tables;
# cleanup
-stop slave;
+--source include/stop_slave.inc
reset slave;
drop table t1,t4,t5,t6; # add t2 and t3 later
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
deleted file mode 100644
index 707d1eca8c2..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
+++ /dev/null
@@ -1,15 +0,0 @@
-source include/master-slave.inc;
-
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
-show slave status;
-
-#
-# Load table should not succeed on the master as this is not a slave
-#
---error 1218
-load table t1 from master;
-connection slave;
---error 1188
-load table t1 from master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
index adf1526a657..1459b24799e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test
@@ -1,68 +1,2 @@
-# Test for
-# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
-# still checks that it has the same error as on the master.
-##########################################################################
+--source suite/rpl/t/rpl_err_ignoredtable.test
--- source include/master-slave.inc
-
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-connection master;
-create table t1 (a int primary key);
-create table t4 (a int primary key);
-# generate an error that goes to the binlog
---error 1022, 1062, 1582
-insert into t1 values (1),(1);
-insert into t4 values (1),(2);
-save_master_pos;
-connection slave;
-# as the t1 table is ignored on the slave, the slave should be able to sync
-sync_with_master;
-# check that the table has been ignored, because otherwise the test is nonsense
-show tables like 't1';
-show tables like 't4';
-SELECT * FROM test.t4 ORDER BY a;
-connection master;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# Now test that even critical errors (connection killed)
-# are ignored if rules allow it.
-# The "kill" idea was copied from rpl000001.test.
-
-connection master1;
-select get_lock('crash_lock%20C', 10);
-
-connection master;
-create table t2 (a int primary key);
-insert into t2 values(1);
-create table t3 (id int);
-insert into t3 values(connection_id());
-send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
-
-connection master1;
-real_sleep 2;
-select (@id := id) - id from t3;
-kill @id;
-drop table t2,t3;
-insert into t4 values (3),(4);
-connection master;
---error 0,1053,2013,1317
-reap;
-connection master1;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t4 ORDER BY a;
-
-connection master1;
-DROP TABLE test.t4;
-save_master_pos;
-connection slave;
-sync_with_master;
-# End of 4.1 tests
-# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed
diff --git a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
index 2e481f5e5e7..93207dfddf7 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
@@ -6,31 +6,22 @@
# Start replication master -> slave
#
connection slave;
---disable_warnings
-stop slave;
---enable_warnings
+
+--source include/stop_slave.inc
+
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
-start slave;
-
+--source include/start_slave.inc
#
# Start replication slave -> master
#
connection master;
---disable_warnings
-stop slave;
---enable_warnings
+
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
-start slave;
-
-#
-# Wait for start of slave IO and SQL threads
-#
-let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%';
--- source $MYSQL_TEST_DIR/suite/engines/funcs/t/wait_slave_status.inc
+--source include/start_slave.inc
#
# Flush logs of slave
@@ -45,4 +36,5 @@ sleep 5;
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--vertical_results
SHOW SLAVE STATUS;
-STOP SLAVE;
+stop slave;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_free_items.test b/mysql-test/suite/engines/funcs/t/rpl_free_items.test
index 043e84160b8..31d65396d36 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_free_items.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_free_items.test
@@ -1,22 +1,2 @@
-source include/master-slave.inc;
-create table t1 (a int);
-create table t2 (a int);
-disable_query_log;
-SET @query="INSERT INTO t2 SELECT * FROM t1 WHERE a REGEXP \"0\"";
-let $1 = 2000;
-while ($1)
-{
- eval SET @query=concat(@query, " OR a REGEXP '$1'");
- dec $1;
-}
-let $1=`select @query`;
-eval $1;
-enable_query_log;
-# I have seen the slave crash either now or at shutdown
-sync_slave_with_master;
-connection master;
-drop table t1;
-drop table t2;
-sync_slave_with_master;
+--source suite/rpl/t/rpl_free_items.test
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test
index c57e9313899..a9265c7f864 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_get_lock.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_get_lock.test
@@ -1,49 +1,2 @@
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_get_lock.test
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-create table t1(n int);
---disable_warnings
-insert into t1 values(get_lock("lock",2));
---enable_warnings
-dirty_close master;
-connection master1;
-select get_lock("lock",2);
-
-select release_lock("lock");
-#ignore
-disable_query_log;
-let $1=2000;
-while ($1)
-{
- do get_lock("lock",2);
- do release_lock("lock");
- dec $1;
-}
-enable_query_log;
-save_master_pos;
-connection slave;
-sync_with_master;
-select get_lock("lock",3);
-select * from t1;
-# There is no point in testing REPLICATIION of the IS_*_LOCK
-# functions; slave does not run with the same concurrency context as
-# master (generally in slave we can't know that on master this lock
-# was already held by another connection and so that the the
-# get_lock() we're replicating timed out on master hence returned 0,
-# or that the is_free_lock() we're playing returned 0 etc.
-# But here all we do is test these functions outside of replication.
-select is_free_lock("lock"), is_used_lock("lock") = connection_id();
-explain extended select is_free_lock("lock"), is_used_lock("lock");
-# Check lock functions
-select is_free_lock("lock2");
-select is_free_lock(NULL);
-connection master1;
-drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test
index 2e6e2ce9a31..234fec3361e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_grant.test
@@ -1,59 +1,2 @@
-# Test that GRANT is not replicated to the slave
-# when --replicate-wild-ignore-table=mysql.%
-# In BUG#980, this test would _randomly_ fail.
+--source suite/rpl/t/rpl_ignore_grant.test
-source include/master-slave.inc;
-
-# do not be influenced by other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
-# as these DELETE were not replicated, we need to do them manually on the
-# slave.
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
-# test non-replication of GRANT
-connection master;
-grant select on *.* to rpl_ignore_grant@localhost;
-grant drop on test.* to rpl_ignore_grant@localhost;
-show grants for rpl_ignore_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
---error 1141 #("no such grant for user")
-show grants for rpl_ignore_grant@localhost;
-# check it another way
-select count(*) from mysql.user where user=_binary'rpl_ignore_grant';
-select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
-
-# test non-replication of SET PASSWORD
-# first force creation of the user on slave (because as the user does not exist
-# on slave, the SET PASSWORD may be replicated but silently do nothing; this is
-# not what we want; we want it to be not-replicated).
-grant select on *.* to rpl_ignore_grant@localhost;
-connection master;
-set password for rpl_ignore_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
-select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
-
-# clear what we have done, to not influence other tests.
-connection master;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
-delete from mysql.user where user=_binary'rpl_ignore_grant';
-delete from mysql.db where user=_binary'rpl_ignore_grant';
-flush privileges;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test
index 00171605a92..1a981652645 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_revoke.test
@@ -1,51 +1,2 @@
-# test verifies that REVOKE must not be replicated when
-# slave server starts with --replicate-wild-ignore-table=mysql.%
-# the option is set in rpl_ignore_revoke-slave.opt
-# The first part of BUG#9483 for GRANT is checked by
-# existed specific rpl_ignore_grant test case (BUG#980)
+--source suite/rpl/t/rpl_ignore_revoke.test
-
-source include/master-slave.inc;
-
-### CLEAN-UP: create an account and manually duplicate it on the slave
-
-connection master;
-grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
-revoke select on *.* from 'user_foo'@'%';
-select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-
-sync_slave_with_master;
-#connection slave;
-grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
-revoke select on *.* from 'user_foo'@'%';
-select select_priv from mysql.user where user='user_foo' /* slave:must be N */;
-
-
-### TEST
-
-#connection slave;
-grant select on *.* to 'user_foo'@'%' identified by 'user_foopass';
-select select_priv from mysql.user where user='user_foo' /* slave:must be Y */;
-
-connection master;
-revoke select on *.* from 'user_foo';
-select select_priv from mysql.user where user='user_foo' /* master:must be N */;
-
-sync_slave_with_master;
-#connection slave;
-select select_priv from mysql.user where user='user_foo' /* slave:must get Y */;
-
-### CLEAN-UP
-
-connection slave;
---disable_abort_on_error
-revoke select on *.* FROM 'user_foo';
---enable_abort_on_error
-
-connection master;
-delete from mysql.user where user="user_foo";
-sync_slave_with_master;
-
-# Since changes to mysql.* are ignored, the revoke need to
-# be done on slave as well
-delete from mysql.user where user="user_foo";
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test b/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test
index fe030f90411..9ace16dd247 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ignore_table_update.test
@@ -1,38 +1,2 @@
-# This one assumes we are ignoring updates on table mysqltest_foo, but doing
-# the ones on all other tables
+--source suite/rpl/t/rpl_ignore_table_update.test
-source include/master-slave.inc;
-connection slave;
-
-#
-# For this test we must be in the test database
-#
-use test;
-
---disable_warnings
-drop table if exists mysqltest_foo;
-drop table if exists mysqltest_bar;
---enable_warnings
-
-create table mysqltest_foo (n int);
-insert into mysqltest_foo values(4);
-connection master;
-use test;
-create table mysqltest_foo (n int);
-insert into mysqltest_foo values(5);
-create table mysqltest_bar (m int);
-insert into mysqltest_bar values(15);
-create table t1 (k int);
-insert into t1 values(55);
-save_master_pos;
-connection slave;
-sync_with_master;
-select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
-connection master;
-drop table mysqltest_foo,mysqltest_bar,t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-drop table mysqltest_foo,mysqltest_bar,t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_init_slave.test b/mysql-test/suite/engines/funcs/t/rpl_init_slave.test
index 139b4902e12..85869ffbb99 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_init_slave.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_init_slave.test
@@ -1,34 +1,2 @@
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_init_slave.test
-#
-# Test of init_slave variable
-#
-
-save_master_pos;
-connection slave;
-sleep 1;
-show variables like 'init_slave';
-show variables like 'max_connections';
-sync_with_master;
-reset master;
-connection master;
-show variables like 'init_slave';
-show variables like 'max_connections';
-save_master_pos;
-connection slave;
-sync_with_master;
-# Save variable value
-set @my_global_init_connect= @@global.init_connect;
-set global init_connect="set @c=1";
-show variables like 'init_connect';
-connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-
-# Restore changed global variable
-set global init_connect= @my_global_init_connect;
-set global max_connections= default;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert.test b/mysql-test/suite/engines/funcs/t/rpl_insert.test
index f57a6e226d1..1a5d5ecba54 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_insert.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_insert.test
@@ -1,44 +1,2 @@
---echo #
---echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog
---echo #
+--source suite/rpl/t/rpl_insert.test
---source include/not_embedded.inc
---source include/not_windows.inc
---source include/master-slave.inc
-
---disable_warnings
-CREATE SCHEMA IF NOT EXISTS mysqlslap;
-USE mysqlslap;
---enable_warnings
-
-CREATE TABLE t1 (id INT, name VARCHAR(64));
-
-let $query = "INSERT INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')";
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
-
-# Wait until all the 5000 inserts has been inserted into the table
---disable_query_log
-let $counter= 300; # Max 30 seconds wait
-while (`select count(*)!=5000 from mysqlslap.t1`)
-{
- sleep 0.1;
- dec $counter;
- if (!$counter)
- {
- Number of records in t1 didnt reach 5000;
- }
-}
---enable_query_log
-
-SELECT COUNT(*) FROM mysqlslap.t1;
-sync_slave_with_master;
-SELECT COUNT(*) FROM mysqlslap.t1;
-
---echo #
---echo # Cleanup
---echo #
-
-connection master;
-USE test;
-DROP SCHEMA mysqlslap;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert_select.test b/mysql-test/suite/engines/funcs/t/rpl_insert_select.test
index 677be526982..bc9ec9da636 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_insert_select.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_insert_select.test
@@ -1,6 +1,6 @@
# Testcase for BUG#10456 - INSERT INTO ... SELECT violating a primary key
# breaks replication
-
+-- source include/have_binlog_format_mixed_or_row.inc
-- source include/master-slave.inc
connection master;
@@ -10,10 +10,11 @@ create table t2 (n int);
insert into t2 values (1);
insert ignore into t1 select * from t2;
insert into t1 values (2);
-sync_slave_with_master;
+--sync_slave_with_master
connection slave;
select * from t1;
connection master;
drop table t1,t2;
-sync_slave_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test
index 439c2b48ca5..b357054b4db 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata2.test
@@ -3,7 +3,7 @@
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
-sync_slave_with_master;
+--sync_slave_with_master
# Check
SELECT * FROM t1 ORDER BY word;
@@ -11,4 +11,5 @@ SELECT * FROM t1 ORDER BY word;
# Cleanup
connection master;
drop table t1;
-sync_slave_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test
index 42c3ad99f33..901c40b5079 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_m.test
@@ -1,52 +1,2 @@
-# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
-# exist.
-# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-######################################################
-# Change Author: JBM
-# Change Date: 2005-12-22
-# Change: Test rewritten to remove show binlog events
-# and to test the option better + Cleanup
-######################################################
--- source include/master-slave.inc
+--source suite/rpl/t/rpl_loaddata_m.test
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-
-connection master;
-# 'test' database should be ignored by the slave
-USE test;
-CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
-SELECT COUNT(*) FROM test.t1;
-
-# 'mysqltest' database should NOT be ignored by the slave
-CREATE DATABASE mysqltest;
-USE mysqltest;
-CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
-SELECT COUNT(*) FROM mysqltest.t1;
-
-# Now lets check the slave to see what we have :-)
-save_master_pos;
-connection slave;
-sync_with_master;
-
-SHOW DATABASES;
-
-USE test;
-SHOW TABLES;
-
-USE mysqltest;
-SHOW TABLES;
-SELECT COUNT(*) FROM mysqltest.t1;
-
-#show binlog events;
-
-# Cleanup
-connection master;
-DROP DATABASE mysqltest;
-DROP TABLE test.t1;
-sync_slave_with_master;
-
-# End of test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
index a06df3bbfc9..7521f62403e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
@@ -1,30 +1,2 @@
-# See if the slave logs (in its own binlog, with --log-slave-updates) a
-# replicated LOAD DATA INFILE correctly when it has binlog_*_db rules.
-# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
+--source suite/rpl/t/rpl_loaddata_s.test
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/master-slave.inc
-
-connection slave;
-# Not sure why we connect to slave and then try to reset master, but I will leave it [JBM]
-reset master;
-
-connection master;
-# 'test' is the current database
-create table test.t1(a int, b int, unique(b));
-load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
-
-# Test logging on slave;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-select count(*) from test.t1; # check that LOAD was replicated
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events from 107; # should be nothing
-
-# Cleanup
-connection master;
-drop table test.t1;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test b/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test
index e272be3c13b..36e863c4573 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddatalocal.test
@@ -6,7 +6,7 @@
# only the first 4KB, 8KB or 16KB usually.
# - the loaded file's first line was not written entirely to the
# master's binlog (1st char was absent)
-source include/master-slave.inc;
+--source include/master-slave.inc
create table t1(a int);
let $1=10000;
@@ -26,15 +26,11 @@ truncate table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select a,count(*) from t1 group by a;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
# End of 4.1 tests
@@ -54,12 +50,9 @@ create table t1(a int primary key);
eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile' into table t1;
remove_file $MYSQLTEST_VARDIR/tmp/rpl_loaddatalocal.select_outfile;
SELECT * FROM t1 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test
index 26235d89016..26829b265f1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test
@@ -41,7 +41,7 @@ CALL test.p1();
--enable_warnings
SELECT * FROM test.t1 ORDER BY blob_column;
save_master_pos;
-sync_slave_with_master;
+--sync_slave_with_master
connection slave;
SELECT * FROM test.t1 ORDER BY blob_column;
@@ -49,6 +49,6 @@ SELECT * FROM test.t1 ORDER BY blob_column;
connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE test.t1;
-sync_slave_with_master;
-
+--sync_slave_with_master
+--source include/rpl_end.inc
# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
index 22deee6b5f3..53b38d9a2de 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test
@@ -1,58 +1,2 @@
-##########
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
+--source suite/rpl/t/rpl_log_pos.test
-#
-# Testing of setting slave to wrong log position with master_log_pos
-#
-
-# Passes with rbr no problem, removed statement include [jbm]
-
-source include/master-slave.inc;
---replace_column 3 <Binlog_Ignore_DB>
-show master status;
-sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-change master to master_log_pos=107;
-start slave;
-sleep 5;
-stop slave;
-change master to master_log_pos=107;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-start slave;
-sleep 5;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-change master to master_log_pos=178;
-start slave;
-sleep 2;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-connection master;
---replace_column 3 <Binlog_Ignore_DB>
-show master status;
-create table if not exists t1 (n int);
-drop table if exists t1;
-create table t1 (n int);
-insert into t1 values (1),(2),(3);
-save_master_pos;
-connection slave;
-stop slave;
-change master to master_log_pos=207;
-start slave;
-sync_with_master;
-select * from t1 ORDER BY n;
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test b/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test
index 91fab0b27a8..337cc1b36be 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_many_optimize.test
@@ -1,22 +1,2 @@
-# Test for BUG#7658 "optimize crashes slave thread (1 in 1000)]"
+--source suite/rpl/t/rpl_many_optimize.test
-source include/master-slave.inc;
-
-create table t1 (a int not null auto_increment primary key, b int, key(b));
-INSERT INTO t1 (a) VALUES (1),(2);
-# Now many OPTIMIZE to test if we crash (BUG#7658)
-let $1=300;
-disable_query_log;
-disable_result_log;
-while ($1)
-{
- eval OPTIMIZE TABLE t1;
- dec $1;
-}
-enable_result_log;
-enable_query_log;
-drop table t1;
-# Bug was that slave segfaulted after ~ a hundred of OPTIMIZE (or ANALYZE)
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test b/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test
deleted file mode 100644
index 893c8746efc..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_master_pos_wait.test
+++ /dev/null
@@ -1,18 +0,0 @@
-# See if master_pos_wait(,,timeout)
-# Terminates with "timeout expired" (-1)
-source include/master-slave.inc;
-save_master_pos;
-connection slave;
-sync_with_master;
-# Ask for a master log that has certainly not been reached yet
-# timeout= 2 seconds
-select master_pos_wait('master-bin.999999',0,2);
-explain extended select master_pos_wait('master-bin.999999',0,2);
-# Testcase for bug 651 (master_pos_wait() hangs if slave idle and STOP SLAVE).
-send select master_pos_wait('master-bin.999999',0);
-connection slave1;
-stop slave sql_thread;
-connection slave;
-reap;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
index 6e4bedf7371..2f0786a9271 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_misc_functions.test
@@ -1,46 +1,2 @@
-#
-# Test of replicating some difficult functions
-#
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_misc_functions.test
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-create table t1(id int, i int, r1 int, r2 int, p varchar(100));
-insert into t1 values(1, connection_id(), 0, 0, "");
-# don't put rand and password in the same query, to see if they replicate
-# independently
-# Pure rand test
---disable_warnings
-insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
---enable_warnings
-# change the rand suite on the master (we do this because otherwise password()
-# benefits from the fact that the above rand() is well replicated :
-# it picks the same sequence element, which hides a possible bug in password() replication.
-set sql_log_bin=0;
-insert into t1 values(6, 0, rand(), rand(), "");
-delete from t1 where id=6;
-set sql_log_bin=1;
-# Pure password test
-insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
-# "altogether now"
---disable_warnings
-insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
---enable_warnings
-select * into outfile '../../tmp/rpl_misc_functions.outfile' from t1;
-sync_slave_with_master;
-create table t2 like t1;
-# read the values from the master table
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_misc_functions.outfile' into table t2;
-# compare them with the replica; the SELECT below should return no row
-select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
-stop slave;
-drop table t1;
-drop table t2;
-
-connection master;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test b/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test
index a251cbf8833..53347fbf127 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_multi_delete.test
@@ -1,26 +1,2 @@
-source include/master-slave.inc;
-create table t1 (a int primary key);
-create table t2 (a int);
+--source suite/rpl/t/rpl_multi_delete.test
-insert into t1 values (1);
-insert into t2 values (1);
-
-
-delete t1.* from t1, t2 where t1.a = t2.a;
-
-save_master_pos;
-select * from t1;
-select * from t2;
-
-connection slave;
-sync_with_master;
-select * from t1;
-select * from t2;
-
-connection master;
-drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test b/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
index e91fad1872a..17df048f930 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_multi_delete2.test
@@ -1,68 +1,2 @@
-#multi delete replication bugs
-
-
-source include/master-slave.inc;
-
-#BUG#11139 - improper wild-table and table rules
-#checking for multi deletes with an alias
-
-connection master;
-set sql_log_bin=0;
-create database mysqltest_from;
-set sql_log_bin=1;
-
-connection slave;
-create database mysqltest_to;
-
-
-connection master;
-use mysqltest_from;
---disable_warnings
-drop table if exists a;
---enable_warnings
-CREATE TABLE a (i INT);
-INSERT INTO a VALUES(1);
-DELETE alias FROM a alias WHERE alias.i=1;
-SELECT * FROM a;
-insert into a values(2),(3);
-delete alias FROM a alias where alias.i=2;
-select * from a;
-save_master_pos;
-connection slave;
-
-use mysqltest_to;
-sync_with_master;
-select * from a;
-
-# BUG#3461
-connection master;
-create table t1 (a int primary key);
-create table t2 (a int);
-
-insert into t1 values (1);
-insert into t2 values (1);
-
-delete t1.* from t1, t2 where t1.a = t2.a;
-
-save_master_pos;
-select * from t1;
-select * from t2;
-
-connection slave;
-# BUG#3461 would cause sync to fail
-sync_with_master;
-error 1146;
-select * from t1;
-error 1146;
-select * from t2;
-
-# cleanup
-connection master;
-set sql_log_bin=0;
-drop database mysqltest_from;
-set sql_log_bin=1;
-connection slave;
-drop database mysqltest_to;
-
-# End of 4.1 tests
+--source suite/rpl/t/rpl_multi_delete2.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test b/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test
index 4991a385f6f..5538e6cba77 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_multi_update4.test
@@ -1,45 +1,2 @@
-# Let's verify that multi-update is not always skipped by slave if
-# some replicate-* rules exist.
-# (BUG#15699)
+--source suite/rpl/t/rpl_multi_update4.test
-source include/master-slave.inc;
-
-### Clean-up
-
-connection master;
---disable_warnings
-drop database if exists d1;
-drop database if exists d2;
-
-connection slave;
-drop database if exists d2;
---enable_warnings
-
-### Do on master
-
-connection master;
-create database d1; # accepted by slave
-create table d1.t0 (id int);
-create database d2; # ignored by slave
-use d2;
-create table t1 (id int);
-create table t2 (id int);
-insert into t1 values (1), (2), (3), (4), (5);
-insert into t2 select id + 3 from t1;
-# a problematic query which must be filter out by slave
-update t1 join t2 using (id) set t1.id = 0;
-insert into d1.t0 values (0); # replication works
-
-### Check on slave
-
-sync_slave_with_master;
-use d1;
-select * from t0 where id=0; # must find
-
-### Clean-up
-connection master;
-drop database d1;
-drop database d2;
-sync_slave_with_master;
-
-# End of test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_ps.test b/mysql-test/suite/engines/funcs/t/rpl_ps.test
index 09c7b779f65..d40c5737912 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_ps.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_ps.test
@@ -1,49 +1,2 @@
-#
-# Test of replicating user variables
-#
-###########################################################
-source include/master-slave.inc;
+--source suite/rpl/t/rpl_ps.test
-#save_master_pos;
-#connection slave;
-#sync_with_master;
-#reset master;
-#connection master;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(n char(30));
-
-prepare stmt1 from 'insert into t1 values (?)';
-set @var1= "from-master-1";
-execute stmt1 using @var1;
-set @var1= "from-master-2-'',";
-execute stmt1 using @var1;
-SELECT * FROM t1 ORDER BY n;
-
-set @var2= 'insert into t1 values (concat("from-var-", ?))';
-prepare stmt2 from @var2;
-set @var1='from-master-3';
-execute stmt2 using @var1;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t1 ORDER BY n;
-
-connection master;
-
-drop table t1;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-
-# End of 4.1 tests
-
-reset master;
-reset slave;
-disconnect master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
deleted file mode 100644
index f4e6239c679..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
+++ /dev/null
@@ -1,47 +0,0 @@
--- source include/have_binlog_format_mixed.inc
--- source include/master-slave.inc
-
-# Test that the slave temporarily switches to ROW when seeing row
-# events when it is in MIXED mode
-
---echo **** On Master ****
-CREATE TABLE t1 (a INT, b LONG);
-INSERT INTO t1 VALUES (1,1), (2,2);
-INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-# Different number of binlog events are generated by different engines
---disable_result_log
-SHOW BINLOG EVENTS;
---enable_result_log
-sync_slave_with_master;
---echo **** On Slave ****
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---query_vertical SHOW SLAVE STATUS
---replace_result $VERSION VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-# Different number of binlog events are generated by different engines
---disable_result_log
-SHOW BINLOG EVENTS;
---enable_result_log
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
-
-connection master;
-DROP TABLE IF EXISTS t1;
-
-# Let's compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching
-
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
-
-# If all is good, we can remove the files
-
-remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_relayspace.test b/mysql-test/suite/engines/funcs/t/rpl_relayspace.test
index 70315c14f34..5c60f57b496 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_relayspace.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_relayspace.test
@@ -1,34 +1,2 @@
-# The slave is started with relay_log_space_limit=10 bytes,
-# to force the deadlock after one event.
+--source suite/rpl/t/rpl_relayspace.test
-source include/master-slave.inc;
-connection slave;
-stop slave;
-connection master;
-# This will generate a master's binlog > 10 bytes
-create table t1 (a int);
-drop table t1;
-create table t1 (a int);
-drop table t1;
-connection slave;
-reset slave;
-start slave io_thread;
-# Give the I/O thread time to block.
-sleep 2;
-# A bug caused the I/O thread to refuse stopping.
-stop slave io_thread;
-reset slave;
-start slave;
-# The I/O thread stops filling the relay log when
-# it's >10b. And the SQL thread cannot purge this relay log
-# as purge is done only when the SQL thread switches to another
-# relay log, which does not exist here.
-# So we should have a deadlock.
-# if it is not resolved automatically we'll detect
-# it with master_pos_wait that waits for farther than 1Ob;
-# it will timeout after 10 seconds;
-# also the slave will probably not cooperate to shutdown
-# (as 2 threads are locked)
-select master_pos_wait('master-bin.001',200,6)=-1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test b/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test
index bcfef919fad..edadb14a3ee 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_replicate_ignore_db.test
@@ -1,30 +1,2 @@
-# see if --replicate-ignore-db works
+--source suite/rpl/t/rpl_replicate_ignore_db.test
---source include/master-slave.inc
-
---disable_warnings
-drop database if exists mysqltest1;
-drop database if exists mysqltest2;
---enable_warnings
-create database mysqltest1;
-create database mysqltest2;
-
-use mysqltest1;
-create table t1 (a int);
-insert into t1 values(1);
-sync_slave_with_master;
---error 1146
-select * from mysqltest1.t1;
-
-connection master;
-use mysqltest2;
-create table t1 (a int);
-insert into t1 values(1);
-sync_slave_with_master;
-select * from mysqltest2.t1;
-
-# cleanup
-connection master;
-drop database mysqltest1;
-drop database mysqltest2;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test b/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test
index bf9576ae11b..b909062b8cc 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_NOW.test
@@ -1,74 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-# Updated 08/30/2005 Added dumps and diff #
-#############################################################################
-#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12480 #
-#############################################################################
+--source suite/rpl/t/rpl_row_NOW.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-create database if not exists mysqltest1;
-DROP TABLE IF EXISTS mysqltest1.t1;
---enable_warnings
-
-
-# Begin test section 1
-CREATE TABLE mysqltest1.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT,
- a TIMESTAMP DEFAULT '2005-05-05 01:01:01',
- b TIMESTAMP DEFAULT '2005-05-05 01:01:01',
- PRIMARY KEY(n));
-delimiter |;
-CREATE FUNCTION mysqltest1.f1() RETURNS TIMESTAMP
-BEGIN
- DECLARE v1 INT DEFAULT 300;
- WHILE v1 > 0 DO
- SET v1 = v1 - 1;
- END WHILE;
- RETURN NOW();
-END|
-delimiter ;|
-
-INSERT INTO mysqltest1.t1 VALUES(NULL,NOW(),mysqltest1.f1());
-
-delimiter |;
-CREATE TRIGGER mysqltest1.trig1 BEFORE INSERT ON mysqltest1.t1
-FOR EACH ROW BEGIN
- SET new.b = mysqltest1.f1();
-END|
-delimiter ;|
-
-INSERT INTO mysqltest1.t1 SET n = NULL, a = now();
-
-sync_slave_with_master;
-
-connection master;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
-
-# lets cleanup
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP FUNCTION mysqltest1.f1;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) The failed dump
-# files will be located in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
-
-# If all is good, when can cleanup our dump files.
-remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
-
-DROP DATABASE mysqltest1;
-sync_slave_with_master;
-# End of 5.1 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_USER.test b/mysql-test/suite/engines/funcs/t/rpl_row_USER.test
index c3639d05c48..e48b25293fa 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_USER.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_USER.test
@@ -1,57 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-#############################################################################
-# TEST: To test the UUID() in rbr #
-#############################################################################
-# Change Author: JBM
-# Change Date: 2006-01-16
-##########
+--source suite/rpl/t/rpl_row_USER.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-CREATE DATABASE mysqltest1;
---enable_warnings
-
-# Section 1 test
-CREATE USER tester IDENTIFIED BY 'test';
-GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
-GRANT ALL ON mysqltest1.* TO ''@'localhost%';
-FLUSH PRIVILEGES;
-connect (m_1,localhost,tester,,mysqltest1);
-
-connection m_1;
-CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
-INSERT INTO mysqltest1.t1 VALUES(1,USER());
-INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
-delimiter |;
-create procedure mysqltest1.p1()
-begin
- INSERT INTO mysqltest1.t1 VALUES(3,USER());
- INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
-end|
-delimiter ;|
-
-CALL mysqltest1.p1();
-connection master;
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-
-connection master;
-# Lets cleanup
-
-REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
-REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
-DROP DATABASE mysqltest1;
-DROP USER 'tester';
-DROP USER ''@'localhost%';
-FLUSH PRIVILEGES;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
index 20c217a7c3a..35090d7f32f 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test
@@ -1,48 +1,2 @@
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
+--source suite/rpl/t/rpl_row_drop.test
-# Bug#12415: DROP of temporary table on master stops slave
-connection master;
---echo **** On Master ****
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-CREATE TEMPORARY TABLE t2 (a int, b int);
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES;
-connection master;
---echo **** On Master ****
-DROP TABLE t2; # Dropping the temporary table
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES; # There should be two tables on the slave
-
-connection master;
---echo **** On Master ****
-CREATE TEMPORARY TABLE t2 (a int, b int);
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES;
-connection master;
---echo **** On Master ****
-# Should drop the non-temporary table t1 and the temporary table t2
-DROP TABLE t1,t2;
-let $VERSION=`select version()`;
---replace_result $VERSION VERSION
---replace_regex /table_id: [0-9]+/table_id: #/
-SHOW BINLOG EVENTS;
-SHOW TABLES;
-sync_slave_with_master;
---echo **** On Slave ****
-SHOW TABLES;
-
---disable_query_log
---disable_warnings
-connection master;
-DROP TABLE IF EXISTS t2;
-sync_slave_with_master;
---enable_warnings
---enable_query_log
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_func001.test b/mysql-test/suite/engines/funcs/t/rpl_row_func001.test
index 53fb55118e6..7671d9947c1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_func001.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_func001.test
@@ -1,57 +1,2 @@
-#############################################################################
-# This test is being created to test out the non deterministic items with #
-# row based replication. #
-# Original Author: JBM #
-# Original Date: Aug/10/2005 #
-# Update: 08/29/2005 change name to initails #
-#############################################################################
+--source suite/rpl/t/rpl_row_func001.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
---error 0,1305
-DROP FUNCTION test.f1;
-DROP TABLE IF EXISTS test.t1;
-
-
---enable_warnings
-
-# Section 1 test from bug #12487 Uses stored function to insert rows to see what is replicated.
-
-create table test.t1 (a int, PRIMARY KEY(a));
-
-delimiter //;
-create function test.f1(i int) returns int
-begin
-insert into test.t1 values(i);
-return 0;
-end//
-delimiter ;//
-
-select test.f1(1);
-select test.f1(2);
-select * from test.t1;
-
-save_master_pos;
-sync_slave_with_master;
-connection slave;
-#show create table test.t1;
-select * from test.t1;
-
-connection master;
-
-#Used for debugging
-#show binlog events;
-
-# Cleanup
-
-DROP FUNCTION test.f1;
-DROP TABLE test.t1;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
index 736071a8ece..793b94e63a6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
@@ -2,7 +2,7 @@
# not have
--source include/have_binlog_format_row.inc
-source include/master-slave.inc;
+--source include/master-slave.inc
connection master;
create table t1 (a int not null primary key);
@@ -11,7 +11,7 @@ create table t2 (a int);
insert into t2 values (1);
update t1, t2 set t1.a = 0 where t1.a = t2.a;
-sync_slave_with_master;
+--sync_slave_with_master
# t2 should not have been replicated
# t1 should have been properly updated
show tables;
@@ -23,13 +23,16 @@ insert into t1 values (1);
connection slave;
# slave should have stopped because can't find table t1
-wait_for_slave_to_stop;
-# see if we have a good error message:
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
---vertical_results
-show slave status;
+# 1146 = ER_NO_SUCH_TABLE
+call mtr.add_suppression("Slave SQL.*Error executing row event: .Table .test.t1. doesn.t exist., error.* 1146");
+--let $slave_sql_errno= 1146
+--source include/wait_for_slave_sql_error.inc
+
+--echo ==== Clean up ====
+--source include/stop_slave_io.inc
+RESET SLAVE;
-# cleanup
connection master;
drop table t1, t2;
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
index 3e057d48ec9..b1c01954293 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test
@@ -4,6 +4,6 @@
# Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging
-source include/have_binlog_format_row.inc;
+--source include/have_binlog_format_row.inc
-source extra/rpl_tests/rpl_max_relay_size.test;
+--source extra/rpl_tests/rpl_max_relay_size.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test
index ae6116bea4e..0610ef0274a 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp001.test
@@ -1,146 +1,2 @@
-#############################################################################
-# This test is being created to test out the non deterministic items with #
-# row based replication. #
-# Original Author: JBM #
-# Original Date: Aug/09/2005 #
-# Updated: Aug/29/2005
-#############################################################################
-# Test: Includes two stored procedure tests. First test uses SP to insert #
-# values from RAND() and NOW() into a table. #
-# The second test uses SP with CASE structure to decide what to text #
-# to update a given table with. #
-############################################################################
+--source suite/rpl/t/rpl_row_sp001.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
--- disable_query_log
--- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
--- enable_query_log
--- enable_result_log
-
-# Begin test section 1 for non deterministic SP
-let $message=<Begin test section 1 (non deterministic SP)>;
---source include/show_msg.inc
-
-create table test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
-
-delimiter //;
-create procedure test.p1()
-begin
- INSERT INTO test.t1 (f,d) VALUES (RAND(),NOW());
-end//
-delimiter ;//
-
-# show binlog events;
-
--- disable_query_log
--- disable_result_log
-let $1=10;
-while ($1)
-{
- call test.p1();
- sleep 1;
- dec $1;
-}
--- enable_result_log
--- enable_query_log
-
-## Used for debugging
-#show binlog events;
-#select * from test.t1;
-#sync_slave_with_master;
-#select * from test.t1;
-#connection master;
-
-let $message=<End test section 1 (non deterministic SP)>;
---source include/show_msg.inc
-
-
-CREATE TABLE test.t2 (a INT NOT NULL AUTO_INCREMENT, t CHAR(4), PRIMARY KEY(a));
-
-delimiter //;
-CREATE PROCEDURE test.p2(n int)
-begin
-CASE n
-WHEN 1 THEN
- UPDATE test.t2 set t ='Tex';
-WHEN 2 THEN
- UPDATE test.t2 set t ='SQL';
-ELSE
- UPDATE test.t2 set t ='NONE';
-END CASE;
-end//
-delimiter ;//
-
-INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
-
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-call test.p2(1);
-SELECT * FROM t2 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-
-connection master;
-call test.p2(2);
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-call test.p2(3);
-SELECT * FROM t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM t2 ORDER BY a;
-
-##Used for debugging
-#show binlog events;
-
-# time to dump the databases and so we can see if they match
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
-
-# First lets cleanup
-
-connection master;
-DROP PROCEDURE test.p1;
-DROP PROCEDURE test.p2;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-sync_slave_with_master;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) Failed dump files
-# will be located in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
-
-# If all is good, when can cleanup our dump files.
-remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test
index d8a5aacc5e6..a304dbe009b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test
@@ -1,108 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/15/2005 #
-# Updated: Aug/29/2005: Removed sleeps #
-#############################################################################
-# Test: Tests SPs with cursors, flow logic, and alter sp. In addition the #
-# tests SPs with insert and update operations. #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp005.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-CREATE TABLE IF NOT EXISTS test.t1(id INT, data CHAR(16),PRIMARY KEY(id));
-CREATE TABLE IF NOT EXISTS test.t2(id2 INT,PRIMARY KEY(id2));
-CREATE TABLE IF NOT EXISTS test.t3(id3 INT,PRIMARY KEY(id3), c CHAR(16));
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
-DECLARE done INT DEFAULT 0;
- DECLARE spa CHAR(16);
- DECLARE spb,spc INT;
- DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
- DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-
- OPEN cur1;
- OPEN cur2;
-
- REPEAT
- FETCH cur1 INTO spb, spa;
- FETCH cur2 INTO spc;
- IF NOT done THEN
- IF spb < spc THEN
- INSERT INTO test.t3 VALUES (spb,spa);
- ELSE
- INSERT INTO test.t3 VALUES (spc,spa);
- END IF;
- END IF;
- UNTIL done END REPEAT;
-
- CLOSE cur1;
- CLOSE cur2;
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- INSERT INTO test.t1 VALUES (4,'MySQL'),(20,'ROCKS'),(11,'Texas'),(10,'kyle');
- INSERT INTO test.t2 VALUES (4),(2),(1),(3);
- UPDATE test.t1 SET id=id+4 WHERE id=4;
-END|
-delimiter ;|
-
-let $message=< ---- Master selects-- >;
---source include/show_msg.inc
-CALL test.p2();
-SELECT * FROM test.t1 ORDER BY id;
-SELECT * FROM test.t2 ORDER BY id2;
-
-let $message=< ---- Slave selects-- >;
---source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY id;
-SELECT * FROM test.t2 ORDER BY id2;
-
-let $message=< ---- Master selects-- >;
---source include/show_msg.inc
-connection master;
-CALL test.p1();
-sleep 6;
-SELECT * FROM test.t3 ORDER BY id3;
-
-let $message=< ---- Slave selects-- >;
---source include/show_msg.inc
-connection slave;
-SELECT * FROM test.t3 ORDER BY id3;
-
-connection master;
-
-ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
-#show binlog events;
-
-# Cleanup
-
-connection master;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test
index b1295820c99..3cc0ed26ea2 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp008.test
@@ -1,57 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/15/2005 #
-# Update: 08/29/2005 Remove sleep #
-#############################################################################
-# TEST: Use SQL_CALC_FOUND_ROWS and insert results into a table inside a sp #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp008.test
-
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t2;
---enable_warnings
-# End of cleanup
-
-
-
-# Begin test section 1
-CREATE TABLE test.t1 (a INT,PRIMARY KEY(a));
-CREATE TABLE test.t2 (a INT,PRIMARY KEY(a));
-INSERT INTO test.t1 VALUES(1),(2);
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1;
- INSERT INTO test.t2 VALUES(FOUND_ROWS());
-END|
-delimiter ;|
-
-let $message=< ---- Master selects-- >;
---source include/show_msg.inc
-CALL test.p1();
-SELECT * FROM test.t2;
-
-let $message=< ---- Slave selects-- >;
---source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2;
-
-# Cleanup
-
-connection master;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test
index 505ed582ba9..56b42a0953d 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test
@@ -1,102 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-# Updated: 08/29/2005 removed sleeps and added master pos save and snyc #
-#############################################################################
-#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp009.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
-
-# Begin test section 1
-CREATE TABLE test.t1 (a INT, PRIMARY KEY(a));
-INSERT INTO test.t1 VALUES (1),(2),(3),(4);
-CREATE TABLE test.t2 (a INT, PRIMARY KEY(a));
-
-delimiter |;
-CREATE PROCEDURE test.p1 (arg1 CHAR(1))
-BEGIN
- DECLARE b, c INT;
- IF arg1 = 'a' THEN
- BEGIN
- DECLARE cur1 CURSOR FOR SELECT A FROM test.t1 WHERE a % 2;
- DECLARE continue handler for not found set b = 1;
- SET b = 0;
- OPEN cur1;
- c1_repeat: REPEAT
- FETCH cur1 INTO c;
- IF (b = 1) THEN
- LEAVE c1_repeat;
- END IF;
-
- INSERT INTO test.t2 VALUES (c);
- UNTIL b = 1
- END REPEAT;
- CLOSE cur1;
- END;
- END IF;
- IF arg1 = 'b' THEN
- BEGIN
- DECLARE cur2 CURSOR FOR SELECT a FROM test.t1 WHERE NOT a % 2;
- DECLARE continue handler for not found set b = 1;
- SET b = 0;
- OPEN cur2;
- c2_repeat: REPEAT
- FETCH cur2 INTO c;
- IF (b = 1) THEN
- LEAVE c2_repeat;
- END IF;
-
- INSERT INTO test.t2 VALUES (c);
- UNTIL b = 1
- END REPEAT;
- CLOSE cur2;
- END;
- END IF;
-END|
-delimiter ;|
-
-CALL test.p1('a');
-SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-connection master;
-truncate test.t2;
-
-# this next call fails, but should not
-call test.p1('b');
-select * from test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-
-connection master;
-truncate test.t2;
-SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-
-# Cleanup
-connection master;
-DROP PROCEDURE test.p1;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test
index 28b82217517..a52fc311315 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp010.test
@@ -1,80 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-# Update: 08/29/2005 remove sleep added master pos save and sync #
-#############################################################################
-#TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=11126 #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp010.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
-
-# Begin test section 1
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- INSERT INTO test.t1 VALUES(2);
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS test.t1;
- CREATE TEMPORARY TABLE test.t1 (a int, PRIMARY KEY(a));
- INSERT INTO test.t1 VALUES(1);
- CALL test.p1();
-END|
-delimiter ;|
-CALL test.p2();
-SELECT * FROM test.t1 ORDER BY a;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-show tables;
-
-connection master;
-delimiter |;
-CREATE PROCEDURE test.p3()
-BEGIN
- INSERT INTO test.t2 VALUES(7);
-END|
-CREATE PROCEDURE test.p4()
-BEGIN
- DROP TABLE IF EXISTS test.t2;
- CREATE TABLE test.t2 (a int, PRIMARY KEY(a));
- INSERT INTO test.t2 VALUES(6);
- CALL test.p3();
-END|
-delimiter ;|
-CALL test.p4();
-SELECT * FROM test.t2 ORDER BY a;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t2 ORDER BY a;
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test
index 1c24904dd5a..c24282c8f16 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp011.test
@@ -1,111 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/18/2005 #
-# Updated: 08/29/2005 turned on diff and commented out debug SQL statements#
-#############################################################################
-#TEST: SP to test alter table and nested SP calls #
-#############################################################################
+--source suite/rpl/t/rpl_row_sp011.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP PROCEDURE IF EXISTS test.p5;
-DROP PROCEDURE IF EXISTS test.p6;
-DROP PROCEDURE IF EXISTS test.p7;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-
-
-# Begin test section 1
-CREATE TABLE test.t1 (a int, PRIMARY KEY(a));
-INSERT INTO test.t1 VALUES (1);
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- ALTER TABLE test.t1 ADD COLUMN b CHAR(4) AFTER a;
- UPDATE test.t1 SET b = 'rbr' WHERE a = 1;
- CALL test.p2();
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- ALTER TABLE test.t1 ADD COLUMN f FLOAT AFTER b;
- UPDATE test.t1 SET f = RAND() WHERE a = 1;
- CALL test.p3();
-END|
-CREATE PROCEDURE test.p3()
-BEGIN
- ALTER TABLE test.t1 RENAME test.t2;
- CALL test.p4();
-END|
-CREATE PROCEDURE test.p4()
-BEGIN
- ALTER TABLE test.t2 ADD INDEX (f);
- ALTER TABLE test.t2 CHANGE a a INT UNSIGNED NOT NULL AUTO_INCREMENT;
- INSERT INTO test.t2 VALUES (NULL,'TEST',RAND());
- CALL test.p5();
-END|
-CREATE PROCEDURE test.p5()
-BEGIN
- ALTER TABLE test.t2 ORDER BY f;
- INSERT INTO test.t2 VALUES (NULL,'STM',RAND());
- CALL test.p6();
-END|
-CREATE PROCEDURE test.p6()
-BEGIN
- ALTER TABLE test.t2 ADD COLUMN b2 CHAR(4) FIRST;
- ALTER TABLE test.t2 ADD COLUMN to_drop BIT(8) AFTER b2;
- INSERT INTO test.t2 VALUES ('new',1,NULL,'STM',RAND());
- CALL test.p7();
-END|
-CREATE PROCEDURE test.p7()
-BEGIN
- ALTER TABLE test.t2 DROP COLUMN to_drop;
- INSERT INTO test.t2 VALUES ('gone',NULL,'STM',RAND());
-END|
-delimiter ;|
-CALL test.p1();
-
-#SELECT * FROM test.t2;
-sync_slave_with_master;
-#SELECT * FROM test.t2;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p4;
-DROP PROCEDURE IF EXISTS test.p5;
-DROP PROCEDURE IF EXISTS test.p6;
-DROP PROCEDURE IF EXISTS test.p7;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-sync_slave_with_master;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) Failed test
-# Will leave dump files in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
-
-# If all is good, when can cleanup our dump files.
-remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test
index f3963c7537a..f23e5c905a6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp012.test
@@ -1,75 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/22/2005 #
-# Update: 08/29/2005 Added save pos and sync #
-#############################################################################
-#TEST: SP to test security and current_user and user #
-#############################################################################
-
-
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/not_embedded.inc
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-
-
-# Begin test section 1
-# Create user user1 with no particular access rights
-grant usage on *.* to user1@localhost;
-flush privileges;
-
-SELECT CURRENT_USER();
-SELECT USER();
-CREATE PROCEDURE test.p1 () SQL SECURITY INVOKER SELECT CURRENT_USER(), USER();
-CREATE PROCEDURE test.p2 () SQL SECURITY DEFINER CALL test.p1();
-CREATE PROCEDURE test.p3 () SQL SECURITY INVOKER CALL test.p1();
-GRANT EXECUTE ON PROCEDURE p1 TO user1@localhost;
-GRANT EXECUTE ON PROCEDURE p2 TO user1@localhost;
-GRANT EXECUTE ON PROCEDURE p3 TO user1@localhost;
-
-# Need to wait for the rights to be applied at the slave
-sync_slave_with_master;
-
-let $message=<******** Master user1 p3 & p2 calls *******>;
---source include/show_msg.inc
-connect (muser1,localhost,user1,,);
-connection muser1;
-SELECT CURRENT_USER();
-SELECT USER();
-CALL test.p3();
-CALL test.p2();
-
-let $message=<******** Slave user1 p3 & p2 calls *******>;
---source include/show_msg.inc
-connect (suser1,127.0.0.1,user1,,test,$SLAVE_MYPORT,);
-
-connection master;
-save_master_pos;
-connection suser1;
-sync_with_master;
-
-SELECT CURRENT_USER();
-SELECT USER();
-CALL test.p3();
-CALL test.p2();
-
-# Cleanup
-connection master;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP USER 'user1'@'localhost';
-sync_slave_with_master;
-
-# End of 5.0 test case
+--source suite/rpl/t/rpl_row_sp012.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test b/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test
index da363736100..397bc9a1d61 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_stop_middle.test
@@ -9,8 +9,8 @@
connection master;
create table t1 (a int not null auto_increment primary key, b int, key(b));
-sync_slave_with_master;
-stop slave;
+--sync_slave_with_master
+--source include/stop_slave.inc
connection master;
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
INSERT INTO t1 (a) SELECT null FROM t1;
@@ -28,13 +28,13 @@ INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1;
connection slave;
-start slave;
+--source include/start_slave.inc
# hope one second is not enough for slave to reach the last
# Rows_log_event, so that test actually tests something.
real_sleep 1;
-stop slave;
+--source include/stop_slave.inc
# see if slave hangs on DROP TABLE
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test
index 7b1fca2d6a1..77fd9fbf90e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig001.test
@@ -1,100 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/09/2005 #
-#############################################################################
-# TEST: Use after insert and before inset triggers and stored procdures to #
-# Update and insert data #
-#############################################################################
+--source suite/rpl/t/rpl_row_trig001.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
--- disable_query_log
--- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
---error 0,1360
-DROP TRIGGER test.t2_ai;
---error 0,1360
-DROP TRIGGER test.t3_bi_t2;
---error 0,1360
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-
-
-# test section 1, lets add a trigger to the mix. Taken from bug #12280
-let $message=<Begin test section 1 (Tiggers & SP)>;
---source include/show_msg.inc
-
-CREATE TABLE test.t1 (n MEDIUMINT NOT NULL, d DATETIME, PRIMARY KEY(n));
-CREATE TABLE test.t2 (n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
-CREATE TABLE test.t3 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d DATETIME, PRIMARY KEY(n));
-
-INSERT INTO test.t1 VALUES (1,NOW());
-
-delimiter //;
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t1 SET d=NOW() where n = 1;//
-CREATE PROCEDURE test.p3()
-BEGIN
- INSERT INTO test.t3 (d) VALUES (NOW());
-END//
-CREATE TRIGGER test.t3_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW CALL test.p3()//
-CREATE PROCEDURE test.p2()
-BEGIN
- INSERT INTO test.t2 (f,d) VALUES (RAND(),NOW());
-END//
-delimiter ;//
-
--- disable_query_log
--- disable_result_log
-let $1=10;
-while ($1)
-{
- CALL test.p2();
- sleep 1;
- dec $1;
-}
--- enable_result_log
--- enable_query_log
-
-#show binlog events;
-#select * from test.t2;
-#select * from test.t3;
-#connection slave;
-#select * from test.t2;
-#select * from test.t3;
-
-let $message=<End test section 2 (Tiggers & SP)>;
---source include/show_msg.inc
-
-# time to dump the databases and so we can see if they match
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trig001_slave.sql
-
-# Cleanup
-connection master;
-DROP PROCEDURE test.p2;
-DROP PROCEDURE test.p3;
-DROP TRIGGER test.t2_ai;
-DROP TRIGGER test.t3_bi_t2;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-DROP TABLE test.t3;
-sync_slave_with_master;
-
-# Lets compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching :-) Failed tests
-# will leave dump files in $MYSQLTEST_VARDIR/tmp
-
-diff_files $MYSQLTEST_VARDIR/tmp/trig001_master.sql $MYSQLTEST_VARDIR/tmp/trig001_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test
index 44b7d8b1dc2..8b7342c32a1 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig002.test
@@ -1,82 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/14/2005 #
-# Updated: 08/29/2005 added save master pos and sync with master #
-#############################################################################
-# TEST: Taken and modified from BUG#12048 After Insert updates replication #
-#############################################################################
+--source suite/rpl/t/rpl_row_trig002.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-#-- disable_query_log
-#-- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
---error 0,1360
-DROP TRIGGER test.t2_ai;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-
-# test section 1, Taken from bug #12408
-
-CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
-
-CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id));
-
-CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
-
-delimiter |;
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
-delimiter ;|
-
-INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
-
-SELECT * FROM test.t1 ORDER BY id;
-#show binlog events;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY id;
-connection master;
-
-INSERT INTO test.t3 VALUES ('Yes', 5, NULL, 'spamfilter','scan_incoming');
-INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
-INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
-
-select * from test.t2;
---sorted_result
-select * from test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from test.t2;
---sorted_result
-select * from test.t3;
-connection master;
-
-DELETE FROM test.t1 WHERE id = 1;
-
-SELECT * FROM test.t1 ORDER BY id;
-connection master;
-SELECT * FROM test.t1 ORDER BY id;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY id;
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP TRIGGER test.t2_ai;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-DROP TABLE test.t3;
-sync_slave_with_master;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test b/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test
index 4a1bbc5ca89..2bb581995d0 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_trig003.test
@@ -1,152 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/16/2005 #
-# Updated: 8/29/2005 Remove sleep calls add dump and diff #
-#############################################################################
-# TEST: This test includes all trigger types. BEFORE/AFTER INSERT, UPDATE & #
-# DELETE. In addition, includes cursor, bit, varchar, flow control, #
-# looping, ROUND(), NOW(), YEAR(), TIMESTAMP #
-#############################################################################
+--source suite/rpl/t/rpl_row_trig003.test
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-#-- disable_query_log
-#-- disable_result_log
-
-# Begin clean up test section
-connection master;
---disable_warnings
---error 0,1360
-DROP TRIGGER test.t1_bi;
---error 0,1360
-DROP TRIGGER test.t2_ai;
---error 0,1360
-DROP TRIGGER test.t1_bu;
---error 0,1360
-DROP TRIGGER test.t2_au;
---error 0,1360
-DROP TRIGGER test.t1_bd;
---error 0,1360
-DROP TRIGGER test.t2_ad;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-
-# test section 1
-
-CREATE TABLE test.t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-CREATE TABLE test.t2 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-CREATE TABLE test.t3 (id MEDIUMINT NOT NULL AUTO_INCREMENT, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-
-# Note Most of these cause the slave to core or do not produce desired results. Currently commenting out the ones not working until they are fixed.
-
-delimiter |;
-CREATE TRIGGER test.t1_bi BEFORE INSERT ON test.t1 FOR EACH ROW UPDATE test.t3 SET b1=1 and y=YEAR(NOW())|
-CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW BEGIN
- INSERT INTO test.t3 VALUES(NULL,0,'MySQL Replication team rocks!', 'Dark beer in prague is #1',12345.34,12.51,0,1965,NOW());
- UPDATE test.t3 SET f = ROUND(f);
-END|
-CREATE TRIGGER test.t1_bu BEFORE UPDATE on test.t1 FOR EACH ROW BEGIN
- UPDATE test.t3 SET y = '2000';
- INSERT INTO test.t3 VALUES(NULL,1,'Testing MySQL databases before update ', 'Insert should work',621.43, 0105.21,0,1974,NOW());
-END|
-CREATE TRIGGER test.t2_au AFTER UPDATE on test.t2 FOR EACH ROW BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE a DECIMAL(10,4);
- DECLARE b FLOAT;
- DECLARE num MEDIUMINT;
- DECLARE cur1 CURSOR FOR SELECT t2.id, t2.d, t2.f FROM test.t2;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-
- OPEN cur1;
-
- REPEAT
- FETCH cur1 INTO num, a, b;
- IF NOT done THEN
- UPDATE test.t3 SET total =(a*b) WHERE ID = num;
- END IF;
- UNTIL done END REPEAT;
- CLOSE cur1;
-END|
-CREATE TRIGGER test.t1_bd BEFORE DELETE on test.t1 FOR EACH ROW BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE a BIT(8);
- DECLARE b VARCHAR(255);
- DECLARE c CHAR(255);
- DECLARE d DECIMAL(10,4);
- DECLARE e FLOAT;
- DECLARE f BIGINT UNSIGNED;
- DECLARE g YEAR;
- DECLARE h TIMESTAMP;
- DECLARE cur1 CURSOR FOR SELECT t1.b1, t1.vc, t1.bc, t1.d, t1.f, t1.total, t1.y, t1.t FROM test.t1;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-
- OPEN cur1;
-
- REPEAT
- FETCH cur1 INTO a, b, c, d, e, f, g, h;
- IF NOT done THEN
- INSERT INTO test.t3 VALUES(NULL, a, b, c, d, e, f, g, h);
- END IF;
- UNTIL done END REPEAT;
- CLOSE cur1;
-END|
-CREATE TRIGGER test.t2_ad AFTER DELETE ON test.t2 FOR EACH ROW
- DELETE FROM test.t1|
-delimiter ;|
-
-INSERT INTO test.t1 VALUES(NULL,1,'Testing MySQL databases is a cool ', 'Must make it bug free for the customer',654321.4321,15.21,0,1965,NOW());
-INSERT INTO test.t2 VALUES(NULL,0,'Testing MySQL databases is a cool ', 'MySQL Customers ROCK!',654321.4321,1.24521,0,YEAR(NOW()),NOW());
-
-UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
-
-INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
-UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
-
-INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
-
-# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger
-# (with the bug in, that caused differences in TIMESTAMP columns).
-# We just need to let the machine's clock advance, it's not
-# to do synchronization, so real_sleep is good.
-real_sleep 2;
-
-DELETE FROM test.t1 WHERE id = 1;
-
-DELETE FROM test.t2 WHERE id = 1;
-
-save_master_pos;
-connection slave;
-sync_with_master;
-connection master;
-
-# time to dump the databases and so we can see if they match
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/trg003_slave.sql
-
-# cleanup
---disable_warnings
---error 0,1360
-DROP TRIGGER test.t1_bi;
---error 0,1360
-DROP TRIGGER test.t2_ai;
---error 0,1360
-DROP TRIGGER test.t1_bu;
---error 0,1360
-DROP TRIGGER test.t2_au;
---error 0,1360
-DROP TRIGGER test.t1_bd;
---error 0,1360
-DROP TRIGGER test.t2_ad;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-
-diff_files $MYSQLTEST_VARDIR/tmp/trg003_master.sql $MYSQLTEST_VARDIR/tmp/trg003_slave.sql;
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
index 7f8b0000042..d919bf7773b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
@@ -1,126 +1,2 @@
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
+--source suite/rpl/t/rpl_row_until.test
-# Note: The test is dependent on binlog positions
-
-# Create some events on master
-connection master;
-CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-DROP TABLE t1;
-# Save master log position for query DROP TABLE t1
-save_master_pos;
-let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 11);
-let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 11);
-
-CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-# Save master log position for query CREATE TABLE t2
-save_master_pos;
-let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 12);
-
-INSERT INTO t2 VALUES (1),(2);
-save_master_pos;
-# Save master log position for query INSERT INTO t2 VALUES (1),(2);
-let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 19);
-sync_slave_with_master;
-
-# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
-let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
-
-connection master;
-INSERT INTO t2 VALUES (3),(4);
-DROP TABLE t2;
-# Save master log position for query DROP TABLE t2;
-let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 26);
-sync_slave_with_master;
-
---source include/stop_slave.inc
-# Reset slave.
-RESET SLAVE;
---disable_query_log
-eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
---enable_query_log
-
-# Try to replicate all queries until drop of t1
-connection slave;
-echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
---disable_query_log
-eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
---enable_query_log
---source include/wait_for_slave_sql_to_stop.inc
-
-# Here table should be still not deleted
-SELECT * FROM t1;
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_drop_t1
---source include/check_slave_param.inc
-
-# This should fail right after start
---replace_result 291 MASTER_LOG_POS
-START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
---source include/wait_for_slave_sql_to_stop.inc
-# again this table should be still not deleted
-SELECT * FROM t1;
-
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_drop_t1
---source include/check_slave_param.inc
-
-# Try replicate all up to and not including the second insert to t2;
-echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
---disable_query_log
-eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
---enable_query_log
---source include/wait_for_slave_sql_to_stop.inc
-SELECT * FROM t2;
-
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_insert1_t2
---source include/check_slave_param.inc
-
-# clean up
-START SLAVE;
---source include/wait_for_slave_to_start.inc
-connection master;
-sync_slave_with_master;
---source include/stop_slave.inc
-
-# This should stop immediately as we are already there
-echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
---disable_query_log
-eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
---enable_query_log
-let $slave_param= Until_Log_Pos;
-let $slave_param_value= $master_pos_create_t2;
---source include/wait_for_slave_param.inc
---source include/wait_for_slave_sql_to_stop.inc
-# here the sql slave thread should be stopped
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_drop_t2
---source include/check_slave_param.inc
-
-#testing various error conditions
---replace_result 561 MASTER_LOG_POS
---error 1277
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
---error 1277
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
---error 1277
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
---error 1277
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
---replace_result 561 MASTER_LOG_POS
---error 1277
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
-# Warning should be given for second command
-START SLAVE;
---replace_result 740 MASTER_LOG_POS
-START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
-
---source include/stop_slave.inc
-# Clear slave IO error.
-RESET SLAVE;
-
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test
index 1ccfcb4eb27..6d58666f883 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test
@@ -1,82 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/19/2005 #
-# Updated: 08/29/2005 Remove sleeps #
-#############################################################################
-#TEST: row based replication of views #
-#############################################################################
-# Includes
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-# Begin clean up test section
-connection master;
---disable_warnings
-create database if not exists mysqltest1;
-DROP VIEW IF EXISTS mysqltest1.v1;
-DROP VIEW IF EXISTS mysqltest1.v2;
-DROP VIEW IF EXISTS mysqltest1.v3;
-DROP VIEW IF EXISTS mysqltest1.v4;
-DROP TABLE IF EXISTS mysqltest1.t3;
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP TABLE IF EXISTS mysqltest1.t4;
-
-# Begin test section 1
-CREATE TABLE mysqltest1.t1 (a INT, c CHAR(6),PRIMARY KEY(a));
-CREATE TABLE mysqltest1.t2 (a INT, c CHAR(6),PRIMARY KEY(a));
-CREATE TABLE mysqltest1.t3 (a INT, c CHAR(6), c2 CHAR(6), PRIMARY KEY(a));
-CREATE TABLE mysqltest1.t4 (a INT, qty INT, price INT,PRIMARY KEY(a));
-CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty));
-INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday');
-INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF');
-INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4);
-
-
-CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty;
-CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
-CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
-CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
-
-
-SELECT * FROM mysqltest1.v2;
-SELECT * FROM mysqltest1.v1;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.v2;
-SELECT * FROM mysqltest1.v1;
-connection master;
-
-INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
-INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
-
-SELECT * FROM mysqltest1.t5 ORDER BY qty;
-SELECT * FROM mysqltest1.t3 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.t5 ORDER BY qty;
-SELECT * FROM mysqltest1.t3 ORDER BY a;
-connection master;
-
-INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
-
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-SELECT * FROM mysqltest1.v4 ORDER BY a;
-sync_slave_with_master;
-SELECT * FROM mysqltest1.t1 ORDER BY a;
-SELECT * FROM mysqltest1.v4 ORDER BY a;
-
-connection master;
-
-# lets cleanup
-DROP VIEW IF EXISTS mysqltest1.v1;
-DROP VIEW IF EXISTS mysqltest1.v2;
-DROP VIEW IF EXISTS mysqltest1.v3;
-DROP VIEW IF EXISTS mysqltest1.v4;
-DROP TABLE IF EXISTS mysqltest1.t3;
-DROP TABLE IF EXISTS mysqltest1.t1;
-DROP TABLE IF EXISTS mysqltest1.t2;
-DROP TABLE IF EXISTS mysqltest1.t4;
-DROP DATABASE mysqltest1;
-sync_slave_with_master;
-
-# End of 5.1 test case
+--source suite/rpl/t/rpl_row_view01.test
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 71310750b60..a1425531b2c 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test
@@ -4,12 +4,12 @@
# ignored, which has caught our customers), unless
# --replicate-same-server-id.
-source include/master-slave.inc;
+--source include/master-slave.inc
connection slave;
create table t1 (n int);
reset master;
# replicate ourselves
-stop slave;
+--source include/stop_slave.inc
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
--replace_result $SLAVE_MYPORT SLAVE_PORT
@@ -17,10 +17,16 @@ eval change master to master_port=$SLAVE_MYPORT;
show slave status;
start slave;
insert into t1 values (1);
-# can't MASTER_POS_WAIT(), it does not work in this weird setup
-# (when slave is its own master without --replicate-same-server-id)
-sleep 2; # enough time for the event to be replicated (it should not)
-show status like "slave_running";
-drop table t1;
-# End of 4.1 tests
+--let $slave_param=Last_IO_Errno
+--let $slave_param_value=1593
+--source include/wait_for_slave_param.inc
+
+--let $slave_field_result_replace= / at [0-9]*/ at XXX/
+--let $status_items= Last_IO_Errno, Last_IO_Error
+--source include/show_slave_status.inc
+
+--source include/stop_slave.inc
+reset slave;
+reset master;
+drop table t1;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
index 0f2eb560d18..8d48746ba5e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test
@@ -1,26 +1,2 @@
-# This test checks that a slave DOES execute queries originating
-# from itself, if running with --replicate-same-server-id.
+--source suite/rpl/t/rpl_server_id2.test
-source include/master-slave.inc;
-connection slave;
-create table t1 (n int);
-reset master;
-# replicate ourselves
-stop slave;
---replace_result $SLAVE_MYPORT SLAVE_PORT
-eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 18 #
-show slave status;
-start slave;
-insert into t1 values (1);
-save_master_pos;
-sync_with_master;
-select * from t1; # check that indeed 2 were inserted
-# We stop the slave before cleaning up otherwise we'll get
-# 'drop table t1' executed twice, so an error in the slave.err
-# (not critical).
-stop slave;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_session_var.test b/mysql-test/suite/engines/funcs/t/rpl_session_var.test
index a6f4b496a23..f1686e107b6 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_session_var.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_session_var.test
@@ -1,42 +1,2 @@
-# Replication of session variables.
-# FOREIGN_KEY_CHECKS is tested in rpl_insert_id.test
+--source suite/rpl/t/rpl_session_var.test
-source include/master-slave.inc;
-drop table if exists 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;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1 where b<3 order by a;
-connection master;
-# if the slave does the next sync_with_master fine, then it means it accepts the
-# two lines of ANSI syntax below, which is what we want to check.
-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;
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t2 order by b;
-connection master;
-drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sf.test b/mysql-test/suite/engines/funcs/t/rpl_sf.test
index 6a741d80172..7ce6dc002ae 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sf.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sf.test
@@ -1,5 +1,5 @@
# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
-source include/master-slave.inc;
+--source include/master-slave.inc
# save status
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
@@ -66,3 +66,4 @@ drop function fn16456;
eval set binlog_format=$oblf;
eval set global log_bin_trust_function_creators=$otfc;
--enable_query_log
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_skip_error.test b/mysql-test/suite/engines/funcs/t/rpl_skip_error.test
index ff81e2f010e..083dfaa2075 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_skip_error.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_skip_error.test
@@ -2,12 +2,10 @@
# 2006-02-07 By JBM: Added order by
#########################################
# Note that errors are ignored by opt file.
-source include/master-slave.inc;
+--source include/master-slave.inc
create table t1 (n int not null primary key);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
insert into t1 values (1);
connection master;
# Here we expect (ignored) error, since 1 is already in slave table
@@ -16,14 +14,13 @@ insert into t1 values (1);
# These should work fine
insert into t1 values (2),(3);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select * from t1 ORDER BY n;
# Cleanup
connection master;
drop table t1;
-sync_slave_with_master;
+--sync_slave_with_master
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
index b3d6e49e215..677d95117fc 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test
@@ -1,58 +1,2 @@
---source include/master-slave.inc
+--source suite/rpl/t/rpl_slave_status.test
-############################################################################
-# Test case for BUG#10780
-#
-# REQUIREMENT
-# A slave without replication privileges should have Slave_IO_Running = No
-
-# 1. Create new replication user
-connection master;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
-
-connection slave;
-stop slave;
-change master to master_user='rpl',master_password='rpl';
-start slave;
-
-# 2. Do replication as new user
-connection master;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (n int);
-insert into t1 values (1);
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1;
-
-# 3. Delete new replication user
-connection master;
-drop user rpl@127.0.0.1;
-sleep 1;
-flush privileges;
-connection slave;
-
-# 4. Restart slave without privileges
-# (slave.err will contain access denied error for this START SLAVE command)
-stop slave;
-start slave;
-
-# 5. Make sure Slave_IO_Running = No
---replace_result $MASTER_MYPORT MASTER_MYPORT
-# Column 1 is replaced, since the output can be either
-# "Connecting to master" or "Waiting for master update"
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
---vertical_results
-show slave status;
-
-# Cleanup (Note that slave IO thread is not running)
-connection slave;
-drop table t1;
-connection master;
-drop table t1;
-
-# end of test case for BUG#10780
-
-# end of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp.test b/mysql-test/suite/engines/funcs/t/rpl_sp.test
index ad2cc29375b..773062275c9 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sp.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sp.test
@@ -1,496 +1,2 @@
-# row-based and statement have expected binlog difference in result files
-
-# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
-# Modified by WL#2971.
-
-source include/have_binlog_format_mixed.inc;
-source include/master-slave.inc;
-
-# we need a db != test, where we don't have automatic grants
---disable_warnings
-drop database if exists mysqltest1;
---enable_warnings
-create database mysqltest1;
-use mysqltest1;
-create table t1 (a varchar(100));
-sync_slave_with_master;
-use mysqltest1;
-
-# ********************** PART 1 : STORED PROCEDURES ***************
-
-# Does the same proc as on master get inserted into mysql.proc ?
-# (same definer, same properties...)
-
-connection master;
-
-delimiter |;
-
-# Stored procedures don't have the limitations that functions have
-# regarding binlogging: it's ok to create a procedure as not
-# deterministic and updating data, while it's not ok to create such a
-# function. We test this.
-
-create procedure foo()
-begin
- declare b int;
- set b = 8;
- insert into t1 values (b);
- insert into t1 values (unix_timestamp());
-end|
-delimiter ;|
-
-# we replace columns having times
-# (even with fixed timestamp displayed time may changed based on TZ)
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where name='foo' and db='mysqltest1';
-sync_slave_with_master;
-# You will notice in the result that the definer does not match what
-# it is on master, it is a known bug on which Alik is working
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where name='foo' and db='mysqltest1';
-
-connection master;
-# see if timestamp used in SP on slave is same as on master
-set timestamp=1000000000;
-call foo();
-select * from t1;
-sync_slave_with_master;
-select * from t1;
-
-# Now a SP which is not updating tables
-
-connection master;
-delete from t1;
-create procedure foo2()
- select * from mysqltest1.t1;
-call foo2();
-
-# check that this is allowed (it's not for functions):
-alter procedure foo2 contains sql;
-
-# SP with definer's right
-
-drop table t1;
-create table t1 (a int);
-create table t2 like t1;
-
-create procedure foo3()
- deterministic
- insert into t1 values (15);
-
-# let's create a non-privileged user
-grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
-grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
-grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
-
-# ToDo: BUG#14931: There is a race between the last grant binlogging, and
-# the binlogging in the new connection made below, causing sporadic test
-# failures due to switched statement order in binlog. To fix this we do
-# SELECT 1 in the first connection before starting the second, ensuring
-# that binlogging is done in the expected order.
-# Please remove this SELECT 1 when BUG#14931 is fixed.
-SELECT 1;
-
-connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
-connection con1;
-
-# this routine will fail in the second INSERT because of privileges
-delimiter |;
-create procedure foo4()
- deterministic
- begin
- insert into t2 values(3);
- insert into t1 values (5);
- end|
-
-delimiter ;|
-
-# I add ,0 so that it does not print the error in the test output,
-# because this error is hostname-dependent
---error 1142,0
-call foo4(); # invoker has no INSERT grant on table t1 => failure
-
-connection master;
-call foo3(); # success (definer == root)
-show warnings;
-
---error 1142,0
-call foo4(); # definer's rights => failure
-
-# we test replication of ALTER PROCEDURE
-alter procedure foo4 sql security invoker;
-call foo4(); # invoker's rights => success
-show warnings;
-
-# Note that half-failed procedure calls are ok with binlogging;
-# if we compare t2 on master and slave we see they are identical:
-
-select * from t1;
-select * from t2;
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-# Test of DROP PROCEDURE
-
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where name="foo4" and db='mysqltest1';
-connection master;
-drop procedure foo4;
-select * from mysql.proc where name="foo4" and db='mysqltest1';
-sync_slave_with_master;
-select * from mysql.proc where name="foo4" and db='mysqltest1';
-
-# ********************** PART 2 : FUNCTIONS ***************
-
-connection master;
-drop procedure foo;
-drop procedure foo2;
-drop procedure foo3;
-
-delimiter |;
-# check that needs "deterministic"
---error 1418
-create function fn1(x int)
- returns int
-begin
- insert into t1 values (x);
- return x+2;
-end|
-create function fn1(x int)
- returns int
- deterministic
-begin
- insert into t1 values (x);
- return x+2;
-end|
-
-delimiter ;|
-delete t1,t2 from t1,t2;
-select fn1(20);
-insert into t2 values(fn1(21));
---sorted_result
-select * from t1;
-select * from t2;
-sync_slave_with_master;
---sorted_result
-select * from t1;
-select * from t2;
-
-connection master;
-delimiter |;
-
-drop function fn1;
-
-create function fn1()
- returns int
- no sql
-begin
- return unix_timestamp();
-end|
-
-delimiter ;|
-# check that needs "deterministic"
---error 1418
-alter function fn1 contains sql;
-
-delete from t1;
-set timestamp=1000000000;
-insert into t1 values(fn1());
-
-connection con1;
-
-delimiter |;
---error 1419 # only full-global-privs user can create a function
-create function fn2()
- returns int
- no sql
-begin
- return unix_timestamp();
-end|
-delimiter ;|
-connection master;
-set global log_bin_trust_function_creators=0;
-set global log_bin_trust_function_creators=1;
-# slave needs it too otherwise will not execute what master allowed:
-connection slave;
-set global log_bin_trust_function_creators=1;
-
-connection con1;
-
-delimiter |;
-create function fn2()
- returns int
- no sql
-begin
- return unix_timestamp();
-end|
-delimiter ;|
-
-connection master;
-
-# Now a function which is supposed to not update tables
-# as it's "reads sql data", so should not give error even if
-# non-deterministic.
-
-delimiter |;
-create function fn3()
- returns int
- not deterministic
- reads sql data
-begin
- return 0;
-end|
-delimiter ;|
-
-select fn3();
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where db='mysqltest1';
-select * from t1;
-
-sync_slave_with_master;
-use mysqltest1;
-select * from t1;
---replace_result localhost.localdomain localhost 127.0.0.1 localhost
---replace_column 13 # 14 #
-select * from mysql.proc where db='mysqltest1';
-
-# ********************** PART 3 : TRIGGERS ***************
-
-connection con1;
-# now fails due to missing trigger grant (err 1142 i/o 1227) due to new
-# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris
---error ER_TABLEACCESS_DENIED_ERROR
-create trigger trg before insert on t1 for each row set new.a= 10;
-
-connection master;
-delete from t1;
-# TODO: when triggers can contain an update, test that this update
-# does not go into binlog.
-# I'm not setting user vars in the trigger, because replication of user vars
-# would take care of propagating the user var's value to slave, so even if
-# the trigger was not executed on slave it would not be discovered.
-create trigger trg before insert on t1 for each row set new.a= 10;
-insert into t1 values (1);
-select * from t1;
-sync_slave_with_master;
-select * from t1;
-
-connection master;
-delete from t1;
-drop trigger trg;
-insert into t1 values (1);
-select * from t1;
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-#show binlog events in 'master-bin.000001' from 106;
-sync_slave_with_master;
-select * from t1;
-
-
-#
-# Test for bug #13969 "Routines which are replicated from master can't be
-# executed on slave".
-#
-connection master;
-create procedure foo()
- not deterministic
- reads sql data
- select * from t1;
-sync_slave_with_master;
-# This should not fail
-call foo();
-connection master;
-drop procedure foo;
-sync_slave_with_master;
-
-
-# Clean up
-connection master;
-drop function fn1;
-drop database mysqltest1;
-drop user "zedjzlcsjhd"@127.0.0.1;
-use test;
-sync_slave_with_master;
-use test;
-
-#
-# Bug#14077 "Failure to replicate a stored function with a cursor":
-# verify that stored routines with cursors work on slave.
-#
-connection master;
---disable_warnings
-drop function if exists f1;
---enable_warnings
-delimiter |;
-create function f1() returns int reads sql data
-begin
- declare var integer;
- declare c cursor for select a from v1;
- open c;
- fetch c into var;
- close c;
- return var;
-end|
-delimiter ;|
-create view v1 as select 1 as a;
-create table t1 (a int);
-insert into t1 (a) values (f1());
-select * from t1;
-drop view v1;
-drop function f1;
-sync_slave_with_master;
-connection slave;
-select * from t1;
-
-#
-# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary
-# Log for 5.0.18"
-#
-
-# Prepare environment.
-
-connection master;
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-# Test case.
-
-CREATE TABLE t1(col VARCHAR(10));
-
-CREATE PROCEDURE p1(arg VARCHAR(10))
- INSERT INTO t1 VALUES(arg);
-
-CALL p1('test');
-
-SELECT * FROM t1;
-
-sync_slave_with_master;
-SELECT * FROM t1;
-
-# Cleanup
-connection master;
-DROP PROCEDURE p1;
-
-
-#
-# BUG#20438: CREATE statements for views, stored routines and triggers can be
-# not replicable.
-#
-
---echo
---echo ---> Test for BUG#20438
-
-# Prepare environment.
-
---echo
---echo ---> Preparing environment...
---echo ---> connection: master
---connection master
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo
---echo ---> connection: master
---connection master
-
-# Test.
-
---echo
---echo ---> Creating procedure...
-
-/*!50003 CREATE PROCEDURE p1() SET @a = 1 */;
-
-/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */;
-
---echo
---echo ---> Checking on master...
-
-SHOW CREATE PROCEDURE p1;
-SHOW CREATE FUNCTION f1;
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo ---> connection: master
-
---echo
---echo ---> Checking on slave...
-
-SHOW CREATE PROCEDURE p1;
-SHOW CREATE FUNCTION f1;
-
-# Cleanup.
-
---echo
---echo ---> connection: master
---connection master
-
---echo
---echo ---> Cleaning up...
-
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
---save_master_pos
---connection slave
---sync_with_master
---connection master
-
-
-# cleanup
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# Restore log_bin_trust_function_creators to original value
-set global log_bin_trust_function_creators=0;
-connection master;
-set global log_bin_trust_function_creators=0;
---echo End of 5.0 tests
-
-#
-# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS"
-#
-connection master;
-reset master;
---disable_warnings
-drop database if exists mysqltest;
-drop database if exists mysqltest2;
---enable_warnings
-create database mysqltest;
-create database mysqltest2;
-use mysqltest2;
-create table t ( t integer );
-create procedure mysqltest.test() begin end;
-insert into t values ( 1 );
-#show binlog events in 'master-bin.000001' from 106;
---error ER_BAD_DB_ERROR
-create procedure `\\`.test() begin end;
-# Clean up
-drop database mysqltest;
-drop database mysqltest2;
-
---echo End of 5.1 tests
+--source suite/rpl/t/rpl_sp.test
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp004.test b/mysql-test/suite/engines/funcs/t/rpl_sp004.test
index 967e7007c15..ca5c802b279 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sp004.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sp004.test
@@ -1,97 +1,2 @@
-#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/14/2005 #
-#############################################################################
-# Test: This test contains two sp that create and drop tables, insert and #
-# updated data and uses the NOW() function. #
-#############################################################################
+--source suite/rpl/t/rpl_sp004.test
-
-# Includes
--- source include/master-slave.inc
-
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t3;
---enable_warnings
-# End of cleanup
-
-# Begin test section 1
-
-delimiter |;
-CREATE PROCEDURE test.p1()
-BEGIN
- CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a));
- CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a));
- INSERT INTO test.t1 VALUES (4),(2),(1),(3);
- UPDATE test.t1 SET a=a+4 WHERE a=4;
- INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1;
- UPDATE test.t1 SET a=a+4 WHERE a=8;
- CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n));
-END|
-CREATE PROCEDURE test.p2()
-BEGIN
- DROP TABLE IF EXISTS test.t1;
- DROP TABLE IF EXISTS test.t2;
- INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW());
-END|
-delimiter ;|
-
-CALL test.p1();
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-
-connection master;
-CALL test.p2();
-USE test;
-SHOW TABLES;
-#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-USE test;
-SHOW TABLES;
-#SELECT * FROM test.t3;
-
-connection master;
-CALL test.p1();
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-#SELECT * FROM test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
-SELECT * FROM test.t1 ORDER BY a;
-SELECT * FROM test.t2 ORDER BY a;
-#SELECT * FROM test.t3;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql
-
-# Cleanup
-connection master;
-#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
-
-# If the test fails, you will need to diff the dumps to see why.
-
-diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql;
-
-
-# End of 5.0 test case
diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test
index 94ce539291d..29b27c728e4 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test
@@ -1,208 +1,2 @@
-##########################################
-# Change Author: JBM
-# Change Date: 2006-05-02
-##########################################
+--source suite/rpl/t/rpl_sp_effects.test
-# Test of replication of stored procedures (WL#2146 for MySQL 5.0)
--- source include/master-slave.inc
-
-# ****************************************************************
-connection master;
-
-# cleanup
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop function if exists f1;
-drop table if exists t1,t2;
-drop view if exists v1;
---enable_warnings
-create table t1 (a int);
-
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-# 1. Test simple variables use.
-delimiter //;
-create procedure p1()
-begin
- declare spv int default 0;
- while spv < 5 do
- insert into t1 values(spv+1);
- set spv=spv+1;
- end while;
-end//
-delimiter ;//
-
-call p1();
-
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t1 ORDER BY a;
-connection master;
-SELECT * FROM t1 ORDER BY a;
-
-# 2. Test SP variable name
-delimiter //;
-create procedure p2()
-begin
- declare a int default 4;
- create table t2 as select a;
-end//
-delimiter ;//
-
-call p2();
-SELECT * FROM t2 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-SELECT * FROM t2 ORDER BY a;
-
-connection master;
-drop procedure p1;
-drop procedure p2;
-drop table t2;
-
-# 3. Test FUNCTIONs in various places
-
-delimiter //;
-create function f1(x int) returns int
-begin
- insert into t1 values(x);
- return x+1;
-end//
-
-create procedure p1(a int, b int)
-begin
- declare v int default f1(5);
- if (f1(6)) then
- select 'yes';
- end if;
- set v = f1(7);
- while f1(8) < 1 do
- select 'this cant be';
- end while;
-
-end//
-delimiter ;//
-
-call p1(f1(1), f1(2));
-SELECT * FROM t1 ORDER BY a;
-
-create table t2(a int);
-insert into t2 values (10),(11);
-SELECT a,f1(a) FROM t2 ORDER BY a;
-
-# This shouldn't put separate 'call f1(3)' into binlog:
-insert into t2 select f1(3);
-SELECT 'master:',a FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-drop procedure p1;
-delete from t1;
-delete from t2;
-
-# 4. VIEWs
-delete from t1;
-insert into t2 values(1),(2);
-create view v1 as select f1(a) as f from t2;
-select * from v1 order by f;
-SELECT 'master:',a FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-drop view v1;
-delete from t1;
-
-# 5. Prepared statements.
-prepare s1 from 'select f1(?)';
-set @xx=123;
-execute s1 using @xx;
-SELECT 'master:',a FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-delete from t1;
-
-# 5. Cursors.
-# t2 has (1),(2);
-delimiter //;
-create procedure p1(spv int)
-begin
- declare c cursor for select f1(spv) from t2;
- while (spv > 2) do
- open c;
- fetch c into spv;
- close c;
- set spv= spv - 10;
- end while;
-end//
-delimiter ;//
-call p1(15);
-SELECT 'master:',a FROM t1 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-SELECT 'slave:',a FROM t1 ORDER BY a;
-
-connection master;
-drop procedure p1;
-drop function f1;
-drop table t1,t2;
-
-# BUG#12637: User variables + SPs replication
-create table t1 (a int);
-delimiter //;
-create procedure p1()
-begin
- insert into t1 values(@x);
- set @x=@x+1;
- insert into t1 values(@x);
- if (f2()) then
- insert into t1 values(1243);
- end if;
-end//
-
-create function f2() returns int
-begin
- insert into t1 values(@z);
- set @z=@z+1;
- insert into t1 values(@z);
- return 0;
-end//
-
-create function f1() returns int
-begin
- insert into t1 values(@y);
- call p1();
- return 0;
-end//
-
-delimiter ;//
-
-set @x=10;
-set @y=20;
-set @z=100;
-select f1();
-
-set @x=30;
-call p1();
-
-SELECT 'master', a FROM t1 ORDER BY a;
-sync_slave_with_master;
-connection slave;
-SELECT 'slave', a FROM t1 ORDER BY a;
-
-connection master;
-drop table t1;
-drop function f1;
-drop function f2;
-drop procedure p1;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test b/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test
index 19988cf902a..632a1a0232c 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_start_stop_slave.test
@@ -1,10 +1,10 @@
-source include/master-slave.inc;
+--source include/master-slave.inc
#
# Bug#6148 ()
#
connection slave;
-stop slave;
+--source include/stop_slave.inc
# Let the master do lots of insertions
connection master;
@@ -17,20 +17,19 @@ while ($1)
dec $1;
}
enable_query_log;
-save_master_pos;
connection slave;
-start slave;
-sleep 1;
-stop slave io_thread;
+--source include/start_slave.inc
+--source include/stop_slave_io.inc
start slave io_thread;
-sync_with_master;
+--source include/wait_for_slave_io_to_start.inc
connection master;
-drop table t1;
-save_master_pos;
+--sync_slave_with_master
-connection slave;
-sync_with_master;
+connection master;
+drop table t1;
+--sync_slave_with_master
-# End of 4.1 tests
+# End of test
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test b/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test
index 017593fdfba..ca1b14201d3 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_stm_mystery22.test
@@ -20,7 +20,7 @@
# first, cause a duplicate key problem on the slave
create table t1(n int auto_increment primary key, s char(10));
-sync_slave_with_master;
+--sync_slave_with_master
insert into t1 values (2,'old');
connection master;
insert into t1 values(NULL,'new');
@@ -31,13 +31,13 @@ connection slave;
wait_for_slave_to_stop;
select * from t1 order by n;
delete from t1 where n = 2;
---disable_warnings
-start slave;
---enable_warnings
+
+--source include/start_slave.inc
+
sync_with_master;
#now the buggy slave would be confused on the offset but it can replicate
#in order to make it break, we need to stop/start the slave one more time
-stop slave;
+--source include/stop_slave.inc
connection master;
# to be able to really confuse the slave, we need some non-auto-increment
# events in the log
@@ -51,9 +51,9 @@ set sql_log_bin=1;
delete from t1 where n=4;
save_master_pos;
connection slave;
---disable_warnings
-start slave;
---enable_warnings
+
+--source include/start_slave.inc
+
#now the truth comes out - if the slave is buggy, it will never sync because
#the slave thread is not able to read events
sync_with_master;
@@ -61,6 +61,6 @@ select * from t1 order by n;
#clean up
connection master;
drop table t1;
-sync_slave_with_master;
-
+--sync_slave_with_master
+--source include/rpl_end.inc
# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test b/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test
index 66dc89bd712..e1f920b0928 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_stm_no_op.test
@@ -1,93 +1,2 @@
-# It's true only in statement-based replication that a statement which
-# updates no rows (UPDATE/DELETE) is binlogged; in row-based
-# replication, as we log modified rows, nothing is binlogged in this
-# case. So this test is meaningul only in statement-based (and if it was
-# enabled in row-based, it would fail as expected).
+--source suite/rpl/t/rpl_stm_no_op.test
--- source include/have_binlog_format_mixed_or_statement.inc
-
-source include/master-slave.inc;
-
-# see if DROP DATABASE is binlogged even if no effect
-connection slave;
-create database mysqltest;
-connection master;
-drop database if exists mysqltest;
-sync_slave_with_master;
-# can't read dir
---replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ /
---error 1049
-show tables from mysqltest;
-
-# see if DROP TABLE is binlogged even if no effect
-connection slave;
-create table t1 (a int);
-connection master;
-drop table if exists t1;
-sync_slave_with_master;
-# table does not exist
---error 1146
-select * from t1;
-
-# see if single-table DELETE is binlogged even if no effect
-connection master;
-create table t1 (a int, b int);
-sync_slave_with_master;
-insert into t1 values(1,1);
-connection master;
-delete from t1;
-sync_slave_with_master;
-select * from t1;
-
-# see if single-table UPDATE is binlogged even if no effect
-insert into t1 values(1,1);
-connection master;
-insert into t1 values(2,1);
-update t1 set a=2;
-sync_slave_with_master;
-select * from t1;
-
-# End of 4.1 tests
-
-# see if multi-table UPDATE is binlogged even if no effect (BUG#13348)
-
-connection master;
-create table t2 (a int, b int);
-delete from t1;
-insert into t1 values(1,1);
-insert into t2 values(1,1);
-
-sync_slave_with_master;
-# force a difference to see if master's multi-UPDATE will correct it
-update t1 set a=2;
-
-connection master;
-UPDATE t1, t2 SET t1.a = t2.a;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-# See if multi-table DELETE is binlogged even if no effect
-
-connection master;
-delete from t1;
-delete from t2;
-
-sync_slave_with_master;
-# force a difference to see if master's multi-DELETE will correct it
-insert into t1 values(1,1);
-insert into t2 values(1,1);
-
-connection master;
-DELETE t1.*, t2.* from t1, t2;
-
-sync_slave_with_master;
-select * from t1;
-select * from t2;
-
-
-# cleanup
-connection master;
-drop table t1, t2;
-sync_slave_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
index 396ba4073e4..cd826c6be1e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
@@ -1,564 +1 @@
--- source include/master-slave.inc
-
-connection default;
-set @saved_binlog_format = @@global.binlog_format;
-
-# Since this test generates row-based events in the binary log, the
-# slave SQL thread cannot be in STATEMENT mode to execute this test,
-# so we only execute it for MIXED and ROW as default value of
-# BINLOG_FORMAT.
-
-connection slave;
--- source include/have_binlog_format_mixed_or_row.inc
-
-connection master;
---disable_warnings
-drop database if exists mysqltest1;
-create database mysqltest1;
---enable_warnings
-use mysqltest1;
-set session binlog_format=row;
-set global binlog_format=row;
-
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-
-CREATE TABLE t1 (a varchar(100));
-
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
-set @string="emergency_1_";
-insert into t1 values("work_2_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_3_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_4_",UUID()));
-insert into t1 select "yesterday_5_";
-
-# verify that temp tables prevent a switch to SBR
-create temporary table tmp(a char(100));
-insert into tmp values("see_6_");
---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
-set binlog_format=statement;
-insert into t1 select * from tmp;
-drop temporary table tmp;
-
-# Now we go to SBR
-set binlog_format=statement;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-set global binlog_format=statement;
-show global variables like "binlog_format%";
-show session variables like "binlog_format%";
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select ?';
-set @string="emergency_7_";
-insert into t1 values("work_8_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values("work_9_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values("for_10_");
-insert into t1 select "yesterday_11_";
-
-# test SET DEFAULT (=statement at this point of test)
-set binlog_format=default;
-select @@global.binlog_format, @@session.binlog_format;
-# due to cluster it's hard to set back to default
-#--error ER_NO_DEFAULT
-set global binlog_format=default;
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select ?';
-set @string="emergency_12_";
-insert into t1 values("work_13_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values("work_14_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values("for_15_");
-insert into t1 select "yesterday_16_";
-
-# and now the mixed mode
-
-set binlog_format=mixed;
-select @@global.binlog_format, @@session.binlog_format;
-set global binlog_format=mixed;
-select @@global.binlog_format, @@session.binlog_format;
-
-prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
-set @string="emergency_17_";
-insert into t1 values("work_18_");
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_19_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_20_",UUID()));
-insert into t1 select "yesterday_21_";
-
-prepare stmt1 from 'insert into t1 select ?';
-insert into t1 values(concat(UUID(),"work_22_"));
-execute stmt1 using @string;
-deallocate prepare stmt1;
-
-insert into t1 values(concat("for_23_",UUID()));
-insert into t1 select "yesterday_24_";
-
-# Test of CREATE TABLE SELECT
-
-create table t2 select rpad(UUID(),100,' ');
-create table t3 select 1 union select UUID();
-create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
-create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-# what if UUID() is first:
---disable_warnings
-insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
---enable_warnings
-
-# inside a stored procedure
-
-delimiter |;
-create procedure foo()
-begin
-insert into t1 values("work_25_");
-insert into t1 values(concat("for_26_",UUID()));
-insert into t1 select "yesterday_27_";
-end|
-create procedure foo2()
-begin
-insert into t1 values(concat("emergency_28_",UUID()));
-insert into t1 values("work_29_");
-insert into t1 values(concat("for_30_",UUID()));
-set session binlog_format=row; # accepted for stored procs
-insert into t1 values("more work_31_");
-set session binlog_format=mixed;
-end|
-create function foo3() returns bigint unsigned
-begin
- set session binlog_format=row; # rejected for stored funcs
- insert into t1 values("alarm");
- return 100;
-end|
-create procedure foo4(x varchar(100))
-begin
-insert into t1 values(concat("work_250_",x));
-insert into t1 select "yesterday_270_";
-end|
-delimiter ;|
-call foo();
-call foo2();
-call foo4("hello");
-call foo4(UUID());
-call foo4("world");
-
-# test that can't SET in a stored function
---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
-select foo3();
-select * from t1 where a="alarm";
-
-# Tests of stored functions/triggers/views for BUG#20930 "Mixed
-# binlogging mode does not work with stored functions, triggers,
-# views"
-
-# Function which calls procedure
-drop function foo3;
-delimiter |;
-create function foo3() returns bigint unsigned
-begin
- insert into t1 values("foo3_32_");
- call foo();
- return 100;
-end|
-delimiter ;|
-insert into t2 select foo3();
-
-prepare stmt1 from 'insert into t2 select foo3()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# Test if stored function calls stored function which calls procedure
-# which requires row-based.
-
-delimiter |;
-create function foo4() returns bigint unsigned
-begin
- insert into t2 select foo3();
- return 100;
-end|
-delimiter ;|
-select foo4();
-
-prepare stmt1 from 'select foo4()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# A simple stored function
-delimiter |;
-create function foo5() returns bigint unsigned
-begin
- insert into t2 select UUID();
- return 100;
-end|
-delimiter ;|
-select foo5();
-
-prepare stmt1 from 'select foo5()';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# A simple stored function where UUID() is in the argument
-delimiter |;
-create function foo6(x varchar(100)) returns bigint unsigned
-begin
- insert into t2 select x;
- return 100;
-end|
-delimiter ;|
-select foo6("foo6_1_");
-select foo6(concat("foo6_2_",UUID()));
-
-prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-
-# Test of views using UUID()
-
-create view v1 as select uuid();
-create table t11 (data varchar(255));
-insert into t11 select * from v1;
-# Test of querying INFORMATION_SCHEMA which parses the view's body,
-# to verify that it binlogs statement-based (is not polluted by
-# the parsing of the view's body).
-insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
-prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-# Test of triggers with UUID()
-delimiter |;
-create trigger t11_bi before insert on t11 for each row
-begin
- set NEW.data = concat(NEW.data,UUID());
-end|
-delimiter ;|
-insert into t11 values("try_560_");
-
-# DELAYED option not supported by table created
-# using innodb.
-# Test that INSERT DELAYED works in mixed mode (BUG#20649)
-#insert delayed into t2 values("delay_1_");
-#insert delayed into t2 values(concat("delay_2_",UUID()));
-#insert delayed into t2 values("delay_6_");
-
-# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not
-# replicate fine in statement-based ; we test that in mixed mode it
-# works).
-#insert delayed into t2 values(rand());
-#set @a=2.345;
-#insert delayed into t2 values(@a);
-
-sleep 4; # time for the delayed inserts to reach disk
-
-# If you want to do manual testing of the mixed mode regarding UDFs (not
-# testable automatically as quite platform- and compiler-dependent),
-# you just need to set the variable below to 1, and to
-# "make udf_example.so" in sql/, and to copy sql/udf_example.so to
-# MYSQL_TEST_DIR/lib/mysql.
-let $you_want_to_test_UDF=0;
-if ($you_want_to_test_UDF)
-{
- CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
- prepare stmt1 from 'insert into t1 select metaphon(?)';
- set @string="emergency_133_";
- insert into t1 values("work_134_");
- execute stmt1 using @string;
- deallocate prepare stmt1;
- prepare stmt1 from 'insert into t1 select ?';
- insert into t1 values(metaphon("work_135_"));
- execute stmt1 using @string;
- deallocate prepare stmt1;
- insert into t1 values(metaphon("for_136_"));
- insert into t1 select "yesterday_137_";
- create table t6 select metaphon("for_138_");
- create table t7 select 1 union select metaphon("for_139_");
- create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3);
- create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
-}
-
-create table t20 select * from t1; # save for comparing later
-create table t21 select * from t2;
-create table t22 select * from t3;
-drop table t1,t2,t3;
-
-# This tests the fix to
-# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog
-# We verify that under the mixed binlog mode, a stored function
-# modifying at least two tables having an auto_increment column,
-# is binlogged row-based. Indeed in statement-based binlogging,
-# only the auto_increment value generated for the first table
-# is recorded in the binlog, the value generated for the 2nd table
-# lacking.
-
-create table t1 (a int primary key auto_increment, b varchar(100));
-create table t2 (a int primary key auto_increment, b varchar(100));
-create table t3 (b varchar(100));
-delimiter |;
-create function f (x varchar(100)) returns int deterministic
-begin
- insert into t1 values(null,x);
- insert into t2 values(null,x);
- return 1;
-end|
-delimiter ;|
-select f("try_41_");
-# Two operations which compensate each other except that their net
-# effect is that they advance the auto_increment counter of t2 on slave:
-sync_slave_with_master;
-use mysqltest1;
-insert into t2 values(2,null),(3,null),(4,null);
-delete from t2 where a>=2;
-
-connection master;
-# this is the call which didn't replicate well
-select f("try_42_");
-sync_slave_with_master;
-
-# now use prepared statement and test again, just to see that the RBB
-# mode isn't set at PREPARE but at EXECUTE.
-
-insert into t2 values(3,null),(4,null);
-delete from t2 where a>=3;
-
-connection master;
-prepare stmt1 from 'select f(?)';
-set @string="try_43_";
-insert into t1 values(null,"try_44_"); # should be SBB
-execute stmt1 using @string; # should be RBB
-deallocate prepare stmt1;
-sync_slave_with_master;
-
-# verify that if only one table has auto_inc, it does not trigger RBB
-# (we'll check in binlog further below)
-
-connection master;
-create table t12 select * from t1; # save for comparing later
-drop table t1;
-create table t1 (a int, b varchar(100), key(a));
-select f("try_45_");
-
-# restore table's key
-create table t13 select * from t1;
-drop table t1;
-create table t1 (a int primary key auto_increment, b varchar(100));
-
-# now test if it's two functions, each of them inserts in one table
-
-drop function f;
-# we need a unique key to have sorting of rows by mysqldump
-create table t14 (unique (a)) select * from t2;
-truncate table t2;
-delimiter |;
-create function f1 (x varchar(100)) returns int deterministic
-begin
- insert into t1 values(null,x);
- return 1;
-end|
-create function f2 (x varchar(100)) returns int deterministic
-begin
- insert into t2 values(null,x);
- return 1;
-end|
-delimiter ;|
-select f1("try_46_"),f2("try_47_");
-
-sync_slave_with_master;
-insert into t2 values(2,null),(3,null),(4,null);
-delete from t2 where a>=2;
-
-connection master;
-# Test with SELECT and INSERT
-select f1("try_48_"),f2("try_49_");
-insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
-sync_slave_with_master;
-
-# verify that if f2 does only read on an auto_inc table, this does not
-# switch to RBB
-connection master;
-drop function f2;
-delimiter |;
-create function f2 (x varchar(100)) returns int deterministic
-begin
- declare y int;
- insert into t1 values(null,x);
- set y = (select count(*) from t2);
- return y;
-end|
-delimiter ;|
-select f1("try_53_"),f2("try_54_");
-sync_slave_with_master;
-
-# And now, a normal statement with a trigger (no stored functions)
-
-connection master;
-drop function f2;
-delimiter |;
-create trigger t1_bi before insert on t1 for each row
-begin
- insert into t2 values(null,"try_55_");
-end|
-delimiter ;|
-insert into t1 values(null,"try_56_");
-# and now remove one auto_increment and verify SBB
-alter table t1 modify a int, drop primary key;
-insert into t1 values(null,"try_57_");
-sync_slave_with_master;
-
-# Test for BUG#20499 "mixed mode with temporary table breaks binlog"
-# Slave used to have only 2 rows instead of 3.
-connection master;
-CREATE TEMPORARY TABLE t15 SELECT UUID();
-create table t16 like t15;
-INSERT INTO t16 SELECT * FROM t15;
-# we'll verify that this one is done RBB
-insert into t16 values("try_65_");
-drop table t15;
-# we'll verify that this one is done SBB
-insert into t16 values("try_66_");
-sync_slave_with_master;
-
-# and now compare:
-
-connection master;
-
-# first check that data on master is sensible
-select count(*) from t1;
-select count(*) from t2;
-select count(*) from t3;
-select count(*) from t4;
-select count(*) from t5;
-select count(*) from t11;
-select count(*) from t20;
-select count(*) from t21;
-select count(*) from t22;
-select count(*) from t12;
-select count(*) from t13;
-select count(*) from t14;
-select count(*) from t16;
-if ($you_want_to_test_UDF)
-{
- select count(*) from t6;
- select count(*) from t7;
- select count(*) from t8;
- select count(*) from t9;
-}
-
-sync_slave_with_master;
-
-#
-# Bug#20863 If binlog format is changed between update and unlock of
-# tables, wrong binlog
-#
-
-connection master;
-DROP TABLE IF EXISTS t11;
-SET SESSION BINLOG_FORMAT=STATEMENT;
-CREATE TABLE t11 (song VARCHAR(255));
-LOCK TABLES t11 WRITE;
-SET SESSION BINLOG_FORMAT=ROW;
-INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
-SET SESSION BINLOG_FORMAT=STATEMENT;
-INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
-UNLOCK TABLES;
-
---query_vertical SELECT * FROM t11
-sync_slave_with_master;
-USE mysqltest1;
---query_vertical SELECT * FROM t11
-
-connection master;
-DROP TABLE IF EXISTS t12;
-SET SESSION BINLOG_FORMAT=MIXED;
-CREATE TABLE t12 (data LONG);
-LOCK TABLES t12 WRITE;
-INSERT INTO t12 VALUES(UUID());
-UNLOCK TABLES;
-
---disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
---enable_result_log
-sync_slave_with_master;
-
-# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
-
-# Let's compare. Note: If they match test will pass, if they do not match
-# the test will show that the diff statement failed and not reject file
-# will be created. You will need to go to the mysql-test dir and diff
-# the files your self to see what is not matching
-
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
-
-connection master;
---disable_result_log
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events;
---enable_result_log
-
-# Now test that mysqlbinlog works fine on a binlog generated by the
-# mixed mode
-
-# BUG#11312 "DELIMITER is not written to the binary log that causes
-# syntax error" makes that mysqlbinlog will fail if we pass it the
-# text of queries; this forces us to use --base64-output here.
-
-# BUG#20929 "BINLOG command causes invalid free plus assertion
-# failure" makes mysqld segfault when receiving --base64-output
-
-# So I can't enable this piece of test
-# SIGH
-
-if ($enable_when_11312_or_20929_fixed)
-{
---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
-drop database mysqltest1;
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql
-# the old mysqldump output on slave is the same as what it was on
-# master before restoring on master.
-diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql;
-}
-
-drop database mysqltest1;
-sync_slave_with_master;
-
-connection default;
-set global binlog_format= @saved_binlog_format;
+--source extra/rpl_tests/rpl_switch_stm_row_mixed.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test
index c13470f20b6..43b5ce49129 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_temp_table.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_temp_table.test
@@ -1,69 +1,2 @@
-# drop table t1 t2 t3 are included int master-slave.inc
-# meaningful only in statement-based:
+--source suite/rpl/t/rpl_temp_table.test
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/master-slave.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-
-create table t2 (n int, PRIMARY KEY(n));
-create temporary table t1 (n int);
-create temporary table t3 (n int not null);
-
-insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300);
---disable_warnings
-insert into t2 select * from t1;
---enable_warnings
-alter table t3 add primary key(n);
-
-flush logs;
-insert into t3 values (1010);
---disable_warnings
-insert into t2 select * from t3;
---enable_warnings
-
-drop table if exists t3;
-insert into t2 values (1012);
-
-connection master1;
-create temporary table t1 (n int);
-insert into t1 values (4),(5);
---disable_warnings
-insert into t2 select * from t1;
---enable_warnings
-
-save_master_pos;
-disconnect master;
-
-connection slave;
-#add 1 to the saved position, so we will catch drop table on disconnect
-#for sure
-sync_with_master 1;
-
-connection master1;
-insert into t2 values(61);
-
-save_master_pos;
-disconnect master1;
-
-connection slave;
-#same trick - make sure we catch drop of temporary table on disconnect
-sync_with_master 1;
-
-select * from t2;
-select count(*) from t2;
-select sum(n) from t2;
-show status like 'Slave_open_temp_tables';
-
-#
-# Clean up
-#
-connect (master2,localhost,root,,);
-connection master2;
-drop table if exists t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_temporary.test b/mysql-test/suite/engines/funcs/t/rpl_temporary.test
index aa90a5153bf..460ea55a675 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_temporary.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_temporary.test
@@ -1,235 +1,2 @@
+--source suite/rpl/t/rpl_temporary.test
--- source include/master-slave.inc
-
-# Clean up old slave's binlogs.
-# The slave is started with --log-slave-updates
-# and this test does SHOW BINLOG EVENTS on the slave's
-# binlog. But previous tests can influence the current test's
-# binlog (e.g. a temporary table in the previous test has not
-# been explicitly deleted, or it has but the slave hasn't had
-# enough time to catch it before STOP SLAVE,
-# and at the beginning of the current
-# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
-# We wait for the slave to have written all he wants to the binlog
-# (otherwise RESET MASTER may come too early).
-save_master_pos;
-connection slave;
-sync_with_master;
-reset master;
-connection master;
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-connect (con1,localhost,root,,);
-
-#added on 2007/5/18
-connection con1;
-CREATE USER ''@localhost;
-
-connect (con2,localhost,root,,);
-# We want to connect as an unprivileged user. But if we use user="" then this
-# will pick the Unix login, which will cause problems if you're running the test
-# as root.
-connect (con3,localhost,zedjzlcsjhd,,);
-
-# We are going to use SET PSEUDO_THREAD_ID in this test;
-# check that it requires the SUPER privilege.
-
-connection con3;
-SET @save_select_limit=@@session.sql_select_limit;
---error 1227
-SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
-SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
-# While we are here we also test that SQL_LOG_BIN can't be set
---error 1227
-SET @@session.sql_select_limit=10, @@session.sql_log_bin=0;
-SELECT @@session.sql_select_limit = @save_select_limit; #shouldn't have changed
-# Now as root, to be sure it works
-connection con2;
-SET @@session.pseudo_thread_id=100;
-SET @@session.pseudo_thread_id=connection_id();
-SET @@session.sql_log_bin=0;
-SET @@session.sql_log_bin=1;
-
-connection con3;
-let $VERSION=`select version()`;
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1(f int);
-create table t2(f int);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-connection con1;
-create temporary table t3(f int);
---disable_warnings
-insert into t3 select * from t1 where f<6;
---enable_warnings
-sleep 1;
-
-connection con2;
-create temporary table t3(f int);
-sleep 1;
-
-connection con1;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-sleep 1;
-
-connection con2;
---disable_warnings
-insert into t3 select * from t1 where f>=4;
---enable_warnings
-sleep 1;
-
-connection con1;
-drop temporary table t3;
-sleep 1;
-
-connection con2;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-drop temporary table t3;
-
-select * from t2 ORDER BY f;
-
-# Commented out 8/30/2005 to make compatable with both sbr and rbr
-#--replace_result $VERSION VERSION
-#--replace_column 2 # 5 #
-#show binlog events;
-
-drop table t1, t2;
-
-use test;
-SET TIMESTAMP=1040323920;
-create table t1(f int);
-SET TIMESTAMP=1040323931;
-create table t2(f int);
-SET TIMESTAMP=1040323938;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-SET TIMESTAMP=1040323945;
-SET @@session.pseudo_thread_id=1;
-create temporary table t3(f int);
-SET TIMESTAMP=1040323952;
-SET @@session.pseudo_thread_id=1;
---disable_warnings
-insert into t3 select * from t1 where f<6;
---enable_warnings
-SET TIMESTAMP=1040324145;
-SET @@session.pseudo_thread_id=2;
-create temporary table t3(f int);
-SET TIMESTAMP=1040324186;
-SET @@session.pseudo_thread_id=1;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-SET TIMESTAMP=1040324200;
-SET @@session.pseudo_thread_id=2;
---disable_warnings
-insert into t3 select * from t1 where f>=4;
---enable_warnings
-SET TIMESTAMP=1040324211;
-SET @@session.pseudo_thread_id=1;
-drop temporary table t3;
-SET TIMESTAMP=1040324219;
-SET @@session.pseudo_thread_id=2;
---disable_warnings
-insert into t2 select count(*) from t3;
---enable_warnings
-SET TIMESTAMP=1040324224;
-SET @@session.pseudo_thread_id=2;
-drop temporary table t3;
-
-select * from t2 ORDER BY f;
-drop table t1,t2;
-
-# Create last a temporary table that is not dropped at end to ensure that we
-# don't get any memory leaks for this
-
-create temporary table t3 (f int);
-#sync_with_master;
-
-# The server will now close done
-
-#
-# Bug#17284 erroneous temp table cleanup on slave
-#
-
-connection master;
-create temporary table t4 (f int);
-create table t5 (f int);
-#sync_with_master;
-# find dumper's $id
-select id from information_schema.processlist where command='Binlog Dump' into @id;
-kill @id; # to stimulate reconnection by slave w/o timeout
---disable_warnings
-insert into t5 select * from t4;
---enable_warnings
-save_master_pos;
-
-connection slave;
-sync_with_master;
-select * from t5 /* must be 1 after reconnection */;
-
-connection master;
-drop temporary table t4;
-drop table t5;
-
-#
-# BUG#17263 incorrect generation DROP temp tables
-# Temporary tables of connection are dropped in batches
-# where a batch correspond to pseudo_thread_id
-# value was set up at the moment of temp table creation
-#
-connection con1;
-set @@session.pseudo_thread_id=100;
-create temporary table t101 (id int);
-create temporary table t102 (id int);
-set @@session.pseudo_thread_id=200;
-create temporary table t201 (id int);
-create temporary table `t``201` (id int);
-# emulate internal temp table not to come to binlog
-create temporary table `#sql_not_user_table202` (id int);
-set @@session.pseudo_thread_id=300;
-create temporary table t301 (id int);
-create temporary table t302 (id int);
-create temporary table `#sql_not_user_table303` (id int);
-
-
-#Added on 2007/5/18
-DROP USER ''@localhost;
-
-disconnect con1;
-
-#now do something to show that slave is ok after DROP temp tables
-connection master;
-create table t1(f int);
-insert into t1 values (1);
-
-sync_slave_with_master;
-#connection slave;
-select * from t1 /* must be 1 */;
-
-connection master;
-drop table t1;
-
-#
-#14157: utf8 encoding in binlog without set character_set_client
-#
-exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test -e "create table t1 (a int); set names latin1; create temporary table äöüÄÖÜ (a int); insert into äöüÄÖÜ values (1); insert into t1 select * from äöüÄÖÜ";
-
-sync_slave_with_master;
-#connection slave;
-select * from t1;
-
-connection master;
-drop table t1;
-
-# End of 5.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_trigger.test b/mysql-test/suite/engines/funcs/t/rpl_trigger.test
index 77cc7a3b2c0..4f61e738200 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_trigger.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_trigger.test
@@ -5,16 +5,7 @@
--source include/have_binlog_format_mixed_or_statement.inc
--source include/master-slave.inc
-disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-enable_query_log;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
-
---enable_warnings
#
# #12482: Triggers has side effects with auto_increment values
@@ -45,19 +36,16 @@ SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
--disable_warnings
insert into t1 values(1,1,rand()),(NULL,2,rand());
insert into t2 (b) values(last_insert_id());
-insert into t2 values(3,0),(NULL,0);
-insert into t2 values(NULL,0),(500,0);
+insert into t2 values(3,0);
+insert into t2 values(NULL,0);
+insert into t2 values(NULL,0);
+insert into t2 values(500,0);
--enable_warnings
select a,b, truncate(rand_value,4) from t1;
select * from t2;
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
-save_master_pos;
-connection slave;
-sync_with_master;
---disable_query_log
-select "--- On slave --" as "";
---enable_query_log
+--sync_slave_with_master
select a,b, truncate(rand_value,4) from t1;
select * from t2;
select a,name, old_a, old_b, truncate(rand_value,4) from t3;
@@ -109,17 +97,14 @@ let $time=`select a from t1`;
# - dump definers on the slave;
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
-save_master_pos;
-connection slave;
-sync_with_master;
---disable_query_log
-select "--- On slave --" as "";
---enable_query_log
+--sync_slave_with_master
# XXX: Definers of stored procedures and functions are not replicated. WL#2897
# (Complete definer support in the stored routines) addresses this issue. So,
@@ -127,10 +112,12 @@ select "--- On slave --" as "";
# item.
SELECT routine_name, definer
-FROM information_schema.routines;
+FROM information_schema.routines
+WHERE routine_name = 'bug12480';
SELECT trigger_name, definer
-FROM information_schema.triggers;
+FROM information_schema.triggers
+WHERE trigger_name = 't1_first';
select a=b && a=c from t1;
--disable_query_log
@@ -170,9 +157,7 @@ create database other;
use other;
insert into test.t1 values (1);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
connection master;
use test;
@@ -219,7 +204,7 @@ while ($rnd)
dec $i;
}
- sync_slave_with_master;
+ --sync_slave_with_master
#connection slave;
eval select * from t1$rnd;
delimiter |;
@@ -258,7 +243,7 @@ while ($rnd)
dec $i;
}
- sync_slave_with_master;
+ --sync_slave_with_master
#connection slave;
eval SELECT * from t1$rnd /* must be f1 $max_rows ... 1 */;
eval SELECT * from t3$rnd /* must be f3 $max_rows * 100 ... 100 */;
@@ -270,6 +255,8 @@ while ($rnd)
connection master;
eval drop table t1$rnd;
+ --sync_slave_with_master
+ connection master;
dec $rnd;
}
@@ -300,26 +287,42 @@ while ($rnd)
# Stop the slave.
connection slave;
-STOP SLAVE;
+--source include/stop_slave.inc
# Replace master's binlog.
connection master;
+let $MYSQLD_DATADIR= `select @@datadir`;
FLUSH LOGS;
-let $DATADIR = `select @@datadir`;
-remove_file $DATADIR/master-bin.000001;
-copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $DATADIR/master-bin.000001;
+
+# Stop master server
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
+
+# Replace binlog
+remove_file $MYSQLD_DATADIR/master-bin.000001;
+copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001;
+
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+
+let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1);
+
+
+# Make the slave to replay the new binlog.
+--echo --> Master binlog: $binlog_version
# Make the slave to replay the new binlog.
connection slave;
RESET SLAVE;
-START SLAVE;
+--source include/start_slave.inc
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
# Check that the replication succeeded.
SHOW TABLES LIKE 't_';
+--replace_column 6 #
SHOW TRIGGERS;
SELECT * FROM t1;
SELECT * FROM t2;
@@ -338,7 +341,7 @@ DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE t2;
-STOP SLAVE;
+--source include/stop_slave.inc
RESET SLAVE;
# The master should be clean.
@@ -352,7 +355,7 @@ RESET MASTER;
# Restart slave.
connection slave;
-START SLAVE;
+--source include/start_slave.inc
#
@@ -367,7 +370,6 @@ START SLAVE;
--echo
--echo ---> Preparing environment...
---echo ---> connection: master
--connection master
--disable_warnings
@@ -378,12 +380,9 @@ DROP TABLE IF EXISTS t2;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--echo
---echo ---> connection: master
--connection master
# Test.
@@ -412,11 +411,7 @@ SELECT * FROM t2;
--echo
--echo ---> Synchronizing slave with master...
---save_master_pos
---connection slave
---sync_with_master
-
---echo ---> connection: master
+--sync_slave_with_master
--echo
--echo ---> Checking on slave...
@@ -427,7 +422,6 @@ SELECT * FROM t2;
# Cleanup.
--echo
---echo ---> connection: master
--connection master
--echo
@@ -436,9 +430,7 @@ SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
---save_master_pos
---connection slave
---sync_with_master
+--sync_slave_with_master
--connection master
#
@@ -469,9 +461,7 @@ insert into t1 values (3, "c");
select * from t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select * from t1;
@@ -481,6 +471,5 @@ drop table if exists t1,t11;
#
# End of tests
#
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test b/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test
index 28bcb0c06c3..fa072022824 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_trunc_temp.test
@@ -1,35 +1,2 @@
-# Requires statement logging
--- source include/have_binlog_format_mixed_or_statement.inc
+--source suite/rpl/t/rpl_trunc_temp.test
-source include/master-slave.inc;
-
-#
-# Bug#17137 Running "truncate table" on temporary table
-# leaves the table open on a slave
-#
-
-create temporary table t1 (n int);
-insert into t1 values(1);
-sync_slave_with_master;
-show status like 'Slave_open_temp_tables';
-
-# Perform a delete from temp table
-connection master;
-delete from t1;
-sync_slave_with_master;
-show status like 'Slave_open_temp_tables';
-
-# Perform truncate on temp table
-connection master;
-truncate t1;
-sync_slave_with_master;
-show status like 'Slave_open_temp_tables';
-
-# Disconnect the master, temp table on slave should dissapear
-disconnect master;
---real_sleep 3 # time for DROP to be read by slave
-connection slave;
-show status like 'Slave_open_temp_tables';
-
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/engines/funcs/t/rpl_user_variables.test b/mysql-test/suite/engines/funcs/t/rpl_user_variables.test
index 530cda3d87a..1b78f2b5fb5 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_user_variables.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_user_variables.test
@@ -1,57 +1,2 @@
-###################################
-#
-# Test of replicating user variables
-#
-###################################
+--source suite/rpl/t/rpl_user_variables.test
--- source include/master-slave.inc
-# Disable PS as the log positions differs
---disable_ps_protocol
-
-
-# Clean up old slave's binlogs.
-# The slave is started with --log-slave-updates
-# and this test does SHOW BINLOG EVENTS on the slave's
-# binlog. But previous tests can influence the current test's
-# binlog (e.g. a temporary table in the previous test has not
-# been explicitly deleted, or it has but the slave hasn't had
-# enough time to catch it before STOP SLAVE,
-# and at the beginning of the current
-# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
-# We wait for the slave to have written all he wants to the binlog
-# (otherwise RESET MASTER may come too early).
-save_master_pos;
-connection slave;
-sync_with_master;
-reset master;
-connection master;
-
-create table t1(n char(30));
-set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
-set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
-set @n1:=null;
-set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
-insert into t1 values (@i1), (@i2), (@i3), (@i4);
-insert into t1 values (@r1), (@r2);
-insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
-insert into t1 values (@n1);
-insert into t1 values (@n2); # not explicitly set before
-insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
-insert into t1 values (@a+(@b:=@a+1));
-set @q:='abc';
-insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
-set @a:=5;
-insert into t1 values (@a),(@a);
-# To flush the pending event, we add the following statement. RBR can
-# concatenate the result of several statements, which SBR cannot.
-select * from t1 where n = '<nonexistant>';
-connection master1; # see if variable is reset in binlog when thread changes
-insert into t1 values (@a),(@a),(@a*5);
-SELECT * FROM t1 ORDER BY n;
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY n;
-connection master;
-insert into t1 select * FROM (select @var1 union select @var2) AS t2;
-drop table t1;
-sync_slave_with_master;
-stop slave;
diff --git a/mysql-test/suite/engines/funcs/t/rpl_variables.test b/mysql-test/suite/engines/funcs/t/rpl_variables.test
index 031131a3f2b..ca612a5593b 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_variables.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_variables.test
@@ -1,4 +1,4 @@
-source include/master-slave.inc;
+--source include/master-slave.inc
# Init for restoration of variable values
set @my_slave_net_timeout =@@global.slave_net_timeout;
@@ -19,3 +19,4 @@ show variables like 'slave_skip_errors';
# Cleanup
set global slave_net_timeout=@my_slave_net_timeout;
set global sql_slave_skip_counter=@my_sql_slave_skip_counter;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt b/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt
deleted file mode 100644
index 79b3bf6174b..00000000000
--- a/mysql-test/suite/engines/funcs/t/rpl_view-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---replicate-ignore-table=test.foo
diff --git a/mysql-test/suite/engines/funcs/t/rpl_view.test b/mysql-test/suite/engines/funcs/t/rpl_view.test
index 3eff8f7550a..b81b22ece4e 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_view.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_view.test
@@ -1,155 +1,2 @@
-# NYI - row-based cannot use CREATE ... SELECT
+--source suite/rpl/t/rpl_view.test
-source include/master-slave.inc;
---disable_warnings
-drop table if exists t1,v1;
-drop view if exists t1,v1;
-sync_slave_with_master;
-reset master;
---enable_warnings
-
-#
-# Check that creation drop of view is replicated, also check replication of
-# updating of view
-#
-connection master;
-create table t1 (a int);
-insert into t1 values (1);
-create view v1 as select a from t1;
-insert into v1 values (2);
-select * from v1 order by a;
-sync_slave_with_master;
-# view already have to be on slave
-select * from v1 order by a;
-connection master;
-update v1 set a=3 where a=1;
-select * from v1 order by a;
-sync_slave_with_master;
-select * from v1 order by a;
-connection master;
-delete from v1 where a=2;
-select * from v1 order by a;
-sync_slave_with_master;
-select * from v1 order by a;
-connection master;
-# 'alter view' internally maped to creation, but still check that it works
-alter view v1 as select a as b from t1;
-sync_slave_with_master;
-select * from v1 order by 1;
-connection master;
-drop view v1;
-sync_slave_with_master;
-#error, because view have to be removed from slave
--- error 1146
-select * from v1 order by a;
-connection master;
-drop table t1;
-sync_slave_with_master;
-# Change Author: JBM
-# Change Date: 2005-12-22
-# Change: Commented out binlog events to work with SBR and RBR
-#--replace_column 2 # 5 #
-# show binlog events limit 1,100;
-
-#
-# BUG#20438: CREATE statements for views, stored routines and triggers can be
-# not replicable.
-#
-
---echo
---echo ---> Test for BUG#20438
-
-# Prepare environment.
-
---echo
---echo ---> Preparing environment...
---echo ---> connection: master
---connection master
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo
---echo ---> connection: master
---connection master
-
-# Test.
-
---echo
---echo ---> Creating objects...
-
-CREATE TABLE t1(c INT);
-
-/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
-
---echo
---echo ---> Inserting value...
-
-INSERT INTO t1 VALUES(1);
-
---echo
---echo ---> Checking on master...
-
-SELECT * FROM t1;
-
---echo
---echo ---> Synchronizing slave with master...
-
---save_master_pos
---connection slave
---sync_with_master
-
---echo ---> connection: master
-
---echo
---echo ---> Checking on slave...
-
-SELECT * FROM t1;
-
-# Cleanup.
-
---echo
---echo ---> connection: master
---connection master
-
---echo
---echo ---> Cleaning up...
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---save_master_pos
---connection slave
---sync_with_master
---connection master
-
-#
-# BUG#19419: "VIEW: View that the column name is different
-# by master and slave is made".
-#
-connection master;
-create table t1(a int, b int);
-insert into t1 values (1, 1), (1, 2), (1, 3);
-create view v1(a, b) as select a, sum(b) from t1 group by a;
-
-sync_slave_with_master;
-explain v1;
-show create table v1;
-select * from v1;
-
-connection master;
-drop table t1;
-drop view v1;
-
-sync_slave_with_master;
-
---echo End of 5.0 tests
diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result
index c0f3224e26f..4a6ad168a1d 100644
--- a/mysql-test/suite/engines/iuds/r/insert_decimal.result
+++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result
@@ -110,15 +110,12 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
Warning 1264 Out of range value for column 'c2' at row 1
Warning 1264 Out of range value for column 'c3' at row 1
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2
+Warning 1264 Out of range value for column 'c1' at row 2
+Warning 1264 Out of range value for column 'c2' at row 2
+Warning 1264 Out of range value for column 'c3' at row 2
Note 1265 Data truncated for column 'c1' at row 3
Note 1265 Data truncated for column 'c2' at row 3
Note 1265 Data truncated for column 'c3' at row 3
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4
SELECT * FROM t1;
c1 c2 c3 c4
0.00000 -0.10000 0 13
@@ -142,7 +139,6 @@ c1 c2 c3 c4
0 0 0 15
0 0 0 26
0 0 0 29
-0 0 0 31
0 0 0 32
0 0 0 33
0 0 0 7
@@ -160,6 +156,7 @@ c1 c2 c3 c4
9999999999 9999999999 9999999999 25
9999999999 9999999999 9999999999 28
9999999999 9999999999 9999999999 30
+9999999999 9999999999 9999999999 31
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t1;
total_rows min_value max_value sum avg
7 0.00000 99999.99999 212446.04999 30349.435712857
@@ -171,13 +168,13 @@ total_rows min_value max_value sum avg
7 0 111111111 111211212 18535202.0000
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t2;
total_rows min_value max_value sum avg
-30 -9999999999 9999999999 21322222222 710740740.7333
+30 -9999999999 9999999999 31322222221 1044074074.0333
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) as max_value, sum(c2) as sum, avg(c2) as avg FROM t2;
total_rows min_value max_value sum avg
-30 0 9999999999 33444444445 1114814814.8333
+30 0 9999999999 43444444444 1448148148.1333
SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c3) as sum, avg(c3) as avg FROM t2;
total_rows min_value max_value sum avg
-30 -9999999999 9999999999 43322222220 1444074074.0000
+30 -9999999999 9999999999 53322222219 1777407407.3000
SELECT * FROM t1;
c1 c2 c3 c4
0.00000 -0.10000 0 13
diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result
index 84dcb0d0a8c..af01bb3d90f 100644
--- a/mysql-test/suite/federated/federatedx.result
+++ b/mysql-test/suite/federated/federatedx.result
@@ -2283,6 +2283,32 @@ connection default;
connection master;
CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1';
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1'
+#
+# MDEV-17573 Assertion in federatedx on multi-update
+#
+create table t1 (
+x int,
+d datetime);
+create table t1f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1';
+create table t2 (
+x int, y int,
+d datetime);
+create table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t2';
+create table t3 (
+x int, y int, z int,
+d datetime);
+create table t3f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t3';
+insert into t1 values (1, "1990-01-01 00:00");
+insert into t1 values (1, "1991-01-01 11:11");
+insert into t2 values (2, 2, "1992-02-02 22:22");
+insert into t3 values (3, 3, 3, "1993-03-03 23:33");
+update t1f, t2f, t3f set t1f.x= 11, t2f.y= 22, t3f.z= 33;
+drop table t1f;
+drop table t2f;
+drop table t3f;
+drop table t1;
+drop table t2;
+drop table t3;
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test
index 29d1eaddc26..bd03f744639 100644
--- a/mysql-test/suite/federated/federatedx.test
+++ b/mysql-test/suite/federated/federatedx.test
@@ -2010,4 +2010,33 @@ connection master;
--error ER_CANT_CREATE_FEDERATED_TABLE
eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+--echo #
+--echo # MDEV-17573 Assertion in federatedx on multi-update
+--echo #
+create table t1 (
+ x int,
+ d datetime);
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+eval create table t1f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1';
+
+create table t2 (
+ x int, y int,
+ d datetime);
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+eval create table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t2';
+
+create table t3 (
+ x int, y int, z int,
+ d datetime);
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+eval create table t3f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t3';
+
+insert into t1 values (1, "1990-01-01 00:00");
+insert into t1 values (1, "1991-01-01 11:11");
+insert into t2 values (2, 2, "1992-02-02 22:22");
+insert into t3 values (3, 3, 3, "1993-03-03 23:33");
+update t1f, t2f, t3f set t1f.x= 11, t2f.y= 22, t3f.z= 33;
+
+drop table t1f; drop table t2f; drop table t3f; drop table t1; drop table t2; drop table t3;
+
source include/federated_cleanup.inc;
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result
index 4d7c7b446e6..fa2bf2d9201 100644
--- a/mysql-test/suite/funcs_1/r/is_check_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result
@@ -90,7 +90,9 @@ CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
-CONSTRAINT b check (b>10) # table constraint
+CONSTRAINT b check (b>10), # table constraint
+# `CHECK_CLAUSE` should allow more then `var(64)` constraints
+CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567890123456789)
) ENGINE=InnoDB;
SELECT * from information_schema.check_constraints;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
@@ -104,6 +106,7 @@ def foo t2 CHK_dates `start_date` is null
def foo t2 name char_length(`name`) > 2
def foo t3 b `b` > 0
def foo t3 b `b` > 10
+def foo t3 b1 `b` < 123456789012345678901234567890123456789012345678901234567890123456789
disconnect con1;
CONNECT con2, localhost, boo2,, test;
SELECT * from information_schema.check_constraints;
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 a34668daff3..672c8e0810a 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -24,7 +24,7 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N
def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select NEVER NULL
def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select NEVER NULL
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL
-def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
+def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
@@ -563,7 +563,7 @@ NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
+1.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
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 ac3130d58b0..85026160b41 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
@@ -24,7 +24,7 @@ def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 '' NO varchar 32 96 N
def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 '' NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) NEVER NULL
def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) NEVER NULL
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL
-def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
+def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
@@ -563,7 +563,7 @@ NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
+1.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
NULL information_schema CLIENT_STATISTICS CONCURRENT_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result
index 9022e057ae5..502b165cde3 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_is.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_is.result
@@ -85,9 +85,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
-ENGINE MEMORY
+ENGINE MYISAM_OR_MARIA
VERSION 11
-ROW_FORMAT Fixed
+ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
@@ -1044,9 +1044,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
-ENGINE MEMORY
+ENGINE MYISAM_OR_MARIA
VERSION 11
-ROW_FORMAT Fixed
+ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
index 9022e057ae5..502b165cde3 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
@@ -85,9 +85,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
-ENGINE MEMORY
+ENGINE MYISAM_OR_MARIA
VERSION 11
-ROW_FORMAT Fixed
+ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
@@ -1044,9 +1044,9 @@ TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME CHECK_CONSTRAINTS
TABLE_TYPE SYSTEM VIEW
-ENGINE MEMORY
+ENGINE MYISAM_OR_MARIA
VERSION 11
-ROW_FORMAT Fixed
+ROW_FORMAT DYNAMIC_OR_PAGE
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraints.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test
index eadfd817832..f66ba875024 100644
--- a/mysql-test/suite/funcs_1/t/is_check_constraints.test
+++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test
@@ -68,7 +68,9 @@ CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
-CONSTRAINT b check (b>10) # table constraint
+CONSTRAINT b check (b>10), # table constraint
+# `CHECK_CLAUSE` should allow more then `var(64)` constraints
+CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567890123456789)
) ENGINE=InnoDB;
--sorted_result
SELECT * from information_schema.check_constraints;
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 4d911c60a5e..a72c84564f0 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -10,20 +10,23 @@
#
##############################################################################
-MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-329 : MDEV-19962 Galera test failure on MW-329
-galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
+galera_concurrent_ctas : MDEV-24842 Galera test failure on galera_concurrent_ctas
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
+galera_mdl_race : MDEV-21524: galera.galera_mdl_race MTR failed: query 'reap' succeeded - should have failed with errno 1213
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
+galera_partition : MDEV-21806: galera.galera_partition MTR failed: failed to recover from DONOR state
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
-galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key
galera_var_node_address : MDEV-20485 Galera test failure
galera_wan : MDEV-17259 Test failure on galera.galera_wan
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
sql_log_bin : MDEV-21491 galera.sql_log_bin
+versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
+galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons
+pxc-421: wsrep_provider is read-only for security reasons
diff --git a/mysql-test/suite/galera/include/galera_base_port.inc b/mysql-test/suite/galera/include/galera_base_port.inc
new file mode 100644
index 00000000000..caf986ee950
--- /dev/null
+++ b/mysql-test/suite/galera/include/galera_base_port.inc
@@ -0,0 +1,8 @@
+#
+# Extract base_port from galera node.
+#
+
+# Convert "... base_port = N; ..." to "N; ..."
+--let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
+# Convert "N; ..." to "N"
+--let $_NODE_GALERAPORT = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)`
diff --git a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
index 4674fc7867f..830a170d50b 100644
--- a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
+++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
@@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
---source suite/galera/include/galera_unload_provider.inc
+--source suite/galera/include/galera_stop_replication.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
@@ -53,7 +53,7 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
--connection node_2
---source suite/galera/include/galera_load_provider.inc
+--source suite/galera/include/galera_start_replication.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_start_replication.inc
index aeab7e6ea19..e6ce6411193 100644
--- a/mysql-test/suite/galera/include/galera_load_provider.inc
+++ b/mysql-test/suite/galera/include/galera_start_replication.inc
@@ -1,7 +1,6 @@
--echo Loading wsrep provider ...
--disable_query_log
---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
--enable_query_log
diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_stop_replication.inc
index edc7eb31e0e..83438a947f0 100644
--- a/mysql-test/suite/galera/include/galera_unload_provider.inc
+++ b/mysql-test/suite/galera/include/galera_stop_replication.inc
@@ -1,7 +1,6 @@
--echo Unloading wsrep provider ...
--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
---let $wsrep_provider_orig = `SELECT @@wsrep_provider`
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
diff --git a/mysql-test/suite/galera/r/MDEV-24327.result b/mysql-test/suite/galera/r/MDEV-24327.result
new file mode 100644
index 00000000000..e7cd9d08f4b
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-24327.result
@@ -0,0 +1,33 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'f');
+INSERT INTO t1 VALUES (2, 'g');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = '1' WHERE f1 = 1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
+UPDATE t1 SET f2 = '2' WHERE f1 = 2;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 1
+2 2
+"node 1 is complete now"
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera#500.result b/mysql-test/suite/galera/r/galera#500.result
index 7ba02c56053..2e3f659bd79 100644
--- a/mysql-test/suite/galera/r/galera#500.result
+++ b/mysql-test/suite/galera/r/galera#500.result
@@ -1,3 +1,5 @@
+connection node_1;
+connection node_2;
connection node_2;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_provider_options="gmcast.isolate=2";
diff --git a/mysql-test/suite/galera/r/galera_UK_conflict.result b/mysql-test/suite/galera/r/galera_UK_conflict.result
new file mode 100644
index 00000000000..76649f1b268
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_UK_conflict.result
@@ -0,0 +1,89 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 int, unique key keyj (f2));
+INSERT INTO t1 VALUES (1, 1, 0);
+INSERT INTO t1 VALUES (3, 3, 0);
+INSERT INTO t1 VALUES (10, 10, 0);
+SET GLOBAL wsrep_slave_threads = 3;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+START TRANSACTION;
+DELETE FROM t1 WHERE f2 = 3;
+INSERT INTO t1 VALUES (3, 3, 1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+INSERT INTO t1 VALUES (5, 5, 2);
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (4, 4, 2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+10 10 0
+wsrep_local_replays
+1
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+connection node_2;
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+10 10 0
+INSERT INTO t1 VALUES (7,7,7);
+INSERT INTO t1 VALUES (8,8,8);
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+7 7 7
+8 8 8
+10 10 0
+connection node_1;
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+7 7 7
+10 10 0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_replay.result b/mysql-test/suite/galera/r/galera_as_slave_replay.result
new file mode 100644
index 00000000000..760617be5f7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_replay.result
@@ -0,0 +1,95 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_1;
+RESET MASTER;
+connection node_2a;
+START SLAVE;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+set binlog_format=STATEMENT;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 a
+3 a
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+SET SESSION wsrep_sync_wait = 0;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_3;
+INSERT INTO test.t1 VALUES (2, 'b');
+connection node_1;
+COMMIT;
+connection node_2a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+3 c
+connection node_2a;
+set session wsrep_sync_wait=15;
+set session wsrep_sync_wait=0;
+wsrep_local_replays
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+SET DEBUG_SYNC = "RESET";
+#
+# test phase with real abort
+#
+connection node_1;
+set binlog_format=ROW;
+insert into t1 values (4, 'd');
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_3;
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+connection node_1;
+COMMIT;
+connection node_2a;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET DEBUG_SYNC = "RESET";
+connection node_2a;
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+COUNT(*) = 1
+1
+set session wsrep_sync_wait=0;
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+connection node_1;
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result
new file mode 100644
index 00000000000..2c2e72db1e4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_kill.result
@@ -0,0 +1,50 @@
+connection node_2;
+CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
+insert into t1 values (NULL,1);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a = 5;
+connection node_2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a =5;
+connection node_2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a =5, b=2;
+connection node_2;
+ALTER TABLE t1 ADD UNIQUE KEY b1(b);
+ALTER TABLE t1 DROP KEY b1;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a =5, b=2;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2b;
+begin;
+update t1 set a =6, b=7;
+connection node_2;
+ALTER TABLE t1 ADD UNIQUE KEY b2(b);
+ALTER TABLE t1 DROP KEY b2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+disconnect node_2b;
+connection node_1;
+drop table t1;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
index a6c6504dc39..ba5feadb1ff 100644
--- a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
@@ -2,7 +2,6 @@
# test phase with cascading foreign key through 3 tables
#
connection node_1;
-set wsrep_sync_wait=0;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
@@ -24,15 +23,26 @@ INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
connection node_2;
-set wsrep_sync_wait=0;
DELETE FROM grandparent WHERE id = 1;
+SELECT * FROM grandparent;
+id
+2
+SELECT * FROM parent;
+id grandparent_id
+2 2
+SELECT * FROM child;
+id parent_id
+2 2
connection node_1;
-SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
-COUNT(*) COUNT(*) = 0
-0 1
-SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1;
-COUNT(*) COUNT(*) = 0
-0 1
+SELECT * FROM grandparent;
+id
+2
+SELECT * FROM parent;
+id grandparent_id
+2 2
+SELECT * FROM child;
+id parent_id
+2 2
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
index 89613b2856a..e2879c30a98 100644
--- a/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
@@ -18,12 +18,10 @@ INSERT INTO child VALUES (1,'row one'), (2,'row two');
connection node_2;
DELETE FROM parent;
connection node_1;
-SELECT COUNT(*), COUNT(*) = 0 FROM parent;
-COUNT(*) COUNT(*) = 0
-0 1
-SELECT COUNT(*), COUNT(*) = 0 FROM child;
-COUNT(*) COUNT(*) = 0
-0 1
+SELECT * FROM parent;
+id
+SELECT * FROM child;
+id parent_id
DROP TABLE child;
DROP TABLE parent;
#
@@ -44,6 +42,7 @@ ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,0,1);
+connection node_2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
connection node_2;
@@ -57,11 +56,9 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "RESET";
connection node_1;
-SELECT COUNT(*), COUNT(*) = 0 FROM parent;
-COUNT(*) COUNT(*) = 0
-0 1
-SELECT COUNT(*), COUNT(*) = 0 FROM child;
-COUNT(*) COUNT(*) = 0
-0 1
+SELECT * FROM parent;
+id
+SELECT * FROM child;
+id j parent_id
DROP TABLE child;
DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result
index 18e3bff40fc..af017083b4e 100644
--- a/mysql-test/suite/galera/r/galera_fulltext.result
+++ b/mysql-test/suite/galera/r/galera_fulltext.result
@@ -34,3 +34,31 @@ COUNT(f1) = 1000
1
DROP TABLE t1;
DROP TABLE ten;
+connection node_1;
+SET @value=REPEAT (1,5001);
+CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
+CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup.result b/mysql-test/suite/galera/r/galera_ist_mariabackup.result
index 8a7c02ab1b6..80a28d349ba 100644
--- a/mysql-test/suite/galera/r/galera_ist_mariabackup.result
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup.result
@@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
index d38d664b6fa..e58d04b30b3 100644
--- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
+++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
@@ -3,8 +3,9 @@ connection node_2;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a');
connection node_2;
+SET SESSION wsrep_sync_wait=0;
Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
connection node_1;
UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result
index 8a7c02ab1b6..80a28d349ba 100644
--- a/mysql-test/suite/galera/r/galera_ist_rsync.result
+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
@@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
diff --git a/mysql-test/suite/galera/r/galera_log_bin_opt.result b/mysql-test/suite/galera/r/galera_log_bin_opt.result
new file mode 100644
index 00000000000..eb009a620e0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_opt.result
@@ -0,0 +1,73 @@
+connection node_1;
+reset master;
+connection node_2;
+reset master;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result
index b24671d120d..8aab135c6a2 100644
--- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result
+++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result
@@ -1,15 +1,25 @@
+call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown");
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
+connection node_1;
+call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
+connection node_2;
+call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
+connection node_1;
+connection node_2;
+connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
+connection node_2;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
+connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
index 5c530c32ce6..6bdc933a9fc 100644
--- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
diff --git a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
index 8a86dfd11e2..68b67977550 100644
--- a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
+++ b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
@@ -1,5 +1,5 @@
connection node_1;
-CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 (f2) SELECT 1 FROM ten;
diff --git a/mysql-test/suite/galera/r/galera_trigger.result b/mysql-test/suite/galera/r/galera_trigger.result
index 112d3f39aa0..059f8ef13f9 100644
--- a/mysql-test/suite/galera/r/galera_trigger.result
+++ b/mysql-test/suite/galera/r/galera_trigger.result
@@ -30,3 +30,47 @@ id
200
DROP TRIGGER tr1;
DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
+CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
+create trigger log_insert after insert on t1
+for each row begin
+insert into t2(tbl, action) values ('t1', 'INSERT');
+end|
+insert into t1(value) values (1);
+insert into t1(value) values (2);
+connection node_2;
+set session wsrep_sync_wait=15;
+insert into t1(value) values (3);
+insert into t1(value) values (4);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_1;
+drop trigger if exists log_insert;
+insert into t1(value) values (5);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_2;
+insert into t1(value) values (6);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_1;
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+drop table t1, t2;
diff --git a/mysql-test/suite/galera/r/galera_var_sst_auth.result b/mysql-test/suite/galera/r/galera_var_sst_auth.result
index 1db83197870..89a27dce4f6 100644
--- a/mysql-test/suite/galera/r/galera_var_sst_auth.result
+++ b/mysql-test/suite/galera/r/galera_var_sst_auth.result
@@ -1,6 +1,3 @@
-#
-# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
-#
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
@@ -8,5 +5,14 @@ SET @@global.wsrep_sst_auth='foo:bar';
SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
********
-disconnect node_2;
-disconnect node_1;
+connection node_2;
+SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz';
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
+Shutdown node_2
+connection node_1;
+connection node_2;
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
diff --git a/mysql-test/suite/galera/r/galera_virtual_blob.result b/mysql-test/suite/galera/r/galera_virtual_blob.result
new file mode 100644
index 00000000000..91952b1d52d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_virtual_blob.result
@@ -0,0 +1,19 @@
+CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB);
+INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0);
+SELECT * from t;
+f a b h
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+connection node_2;
+SELECT * from t;
+f a b h
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+connection node_1;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/lp1376747-4.result b/mysql-test/suite/galera/r/lp1376747-4.result
index f1d32aa8f69..3370e1d3d8e 100644
--- a/mysql-test/suite/galera/r/lp1376747-4.result
+++ b/mysql-test/suite/galera/r/lp1376747-4.result
@@ -3,26 +3,23 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET session wsrep_sync_wait=0;
-SET session wsrep_causal_reads=OFF;
-Warnings:
-Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
-FLUSH TABLE WITH READ LOCK;
+FLUSH TABLES WITH READ LOCK;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
INSERT INTO t1 VALUES (2,3);
connection node_2a;
SET session wsrep_sync_wait=0;
-SET session wsrep_causal_reads=OFF;
-Warnings:
-Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2';
FLUSH TABLES t1 WITH READ LOCK;;
connection node_2;
+SET debug_sync='now WAIT_FOR parked2';
+SET debug_sync='now SIGNAL go2';
UNLOCK TABLES;
SHOW CREATE TABLE t1;
Table Create Table
@@ -30,8 +27,10 @@ t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
+set debug_sync= 'RESET';
connection node_2a;
UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
index 6a5251204b9..4cc49c0cf07 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#33.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+SET GLOBAL wsrep_cluster_address = '';
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
diff --git a/mysql-test/suite/galera/t/MDEV-24327.cnf b/mysql-test/suite/galera/t/MDEV-24327.cnf
new file mode 100644
index 00000000000..390a9aab0f4
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-24327.cnf
@@ -0,0 +1,6 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin=mariadb-bin
+log-slave-updates=OFF
+
diff --git a/mysql-test/suite/galera/t/MDEV-24327.test b/mysql-test/suite/galera/t/MDEV-24327.test
new file mode 100644
index 00000000000..fe3dbbe2870
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-24327.test
@@ -0,0 +1,87 @@
+#
+# MDEV-24327 wsrep XID checkpointing order violation with log_slave_updates=OFF
+#
+# Here we have configure two node cluster with --log-bin=ON and --log-slave_-updates=OFF
+#
+# a transaction in node executes so far that it has replicated and reached
+# commit phase, We have sync point before entering commit order monitor and
+# the transaction is parked there
+#
+# Then another transaction is executed in node 2, it replicates and commits in node 2
+# and is received and applied in node 1. After applying it will remain waiting for
+# commit order monitor, as it has later seqno than the first transaction in node 1.
+#
+# control connection in node 1 waits to see the
+#
+# With the buggy version of MDEV-24327, the applier has however, already synced the
+# wsrep XID checkpoint
+#
+#
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'f');
+INSERT INTO t1 VALUES (2, 'g');
+
+--connection node_1
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = '1' WHERE f1 = 1;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET SESSION wsrep_sync_wait=0;
+--connection node_1a
+--let $expected_wsrep_received = `SELECT VARIABLE_VALUE+1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_received'`
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# Block the commit, send the COMMIT and wait until it gets blocked
+
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send COMMIT
+
+--connection node_1a
+
+# wait for the commit to block in sync point
+
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+#
+# replicate non conflicting transaction from node 2
+# it will get later seqno and should sync XID checkpoint after transaction in node 1
+#
+--connection node_2
+UPDATE t1 SET f2 = '2' WHERE f1 = 2;
+
+#
+# wait until update from node 2 has been committed
+# if XID checkpointing order was violated, node 1 would crash for assert
+#
+
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $expected_wsrep_received FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_received'
+--source include/wait_condition.inc
+
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--connection node_1
+--reap
+SELECT * FROM t1;
+--echo "node 1 is complete now"
+
+
+--connection node_2
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera#500.test b/mysql-test/suite/galera/t/galera#500.test
index 3c8490b6907..471620b32c1 100644
--- a/mysql-test/suite/galera/t/galera#500.test
+++ b/mysql-test/suite/galera/t/galera#500.test
@@ -8,6 +8,11 @@
--source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
# Force node_2 gcomm background thread to terminate via exception.
--connection node_2
--let $wsrep_cluster_address = `SELECT @@wsrep_cluster_address`
@@ -36,3 +41,5 @@ SET SESSION wsrep_on=0;
--connection node_2
CALL mtr.add_suppression("WSREP: exception from gcomm, backend must be restarted: Gcomm backend termination was requested by setting gmcast.isolate=2.");
+
+--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_UK_conflict.test b/mysql-test/suite/galera/t/galera_UK_conflict.test
new file mode 100644
index 00000000000..57bafbf8ae0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_UK_conflict.test
@@ -0,0 +1,148 @@
+#
+# This test tests the operation of transaction replay with a scenario
+# where two subsequent write sets in applying conflict with local transaction
+# in commit phase. The conflict is "false positive" confict on GAP lock in
+# secondary unique index.
+# The first applier will cause BF abort for the local committer, which
+# starts replaying because of positive certification.
+# In buggy version, scenatio continues so that ehile the local transaction
+# is replaying, the latter applier experiences similar UK GAP lock conflict
+# and forces the replayer to abort second time.
+# In fixed version, this latter BF abort should not happen.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 int, unique key keyj (f2));
+INSERT INTO t1 VALUES (1, 1, 0);
+INSERT INTO t1 VALUES (3, 3, 0);
+INSERT INTO t1 VALUES (10, 10, 0);
+
+# we will need 2 appliers threads for applyin two write sets in parallel in node1
+# and 1 applier thread for handling replaying
+SET GLOBAL wsrep_slave_threads = 3;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+
+--connection node_1
+# starting a transaction, which deletes and inserts the middle row in test table
+# this will be victim of false positive conflict with appliers
+SET SESSION wsrep_sync_wait=0;
+START TRANSACTION;
+
+DELETE FROM t1 WHERE f2 = 3;
+INSERT INTO t1 VALUES (3, 3, 1);
+
+# Control connection to manage sync points for appliers
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET SESSION wsrep_sync_wait=0;
+
+# send from node 2 first INSERT transaction, which will conflict on GAP lock in node 1
+--connection node_2
+INSERT INTO t1 VALUES (5, 5, 2);
+
+--connection node_1a
+# wait to see the INSERT in apply_cb sync point
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+# first applier seen in wait point, set sync point for the second INSERT
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_2
+# send second insert into same GAP in test table
+INSERT INTO t1 VALUES (4, 4, 2);
+
+--connection node_1a
+# wait for the second insert to arrive in his sync point
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# both appliers are now waiting in separate sync points
+
+# Block the local commit, send the COMMIT and wait until it gets blocked
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send COMMIT
+
+--connection node_1a
+# wait for the local commit to enter in commit monitor wait state
+--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# release the local transaction to continue with commit
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# and now release the first applier, it should force local trx to abort
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+
+# set another sync point for second applier
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+
+# letting the second appier to move forward
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+
+# waiting until second applier is in wait
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+# stopping second applier before commit
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# releasing the second insert, with buggy version it will conflict with
+# replayer
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+
+# with fixed version, second applier has reached commit monitor, and we can
+# release it to complete
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# local commit should succeed
+--connection node_1
+--reap
+
+SELECT * FROM t1;
+
+# wsrep_local_replays has increased by 1
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
+# returning original slave thread count
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+
+--connection node_2
+SELECT * FROM t1;
+
+# replicate some transactions, so that wsrep slave thread count can reach
+# original state in node 1
+INSERT INTO t1 VALUES (7,7,7);
+INSERT INTO t1 VALUES (8,8,8);
+SELECT * FROM t1;
+
+--connection node_1
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_replay.cnf b/mysql-test/suite/galera/t/galera_as_slave_replay.cnf
new file mode 100644
index 00000000000..b1f9d7e9cbd
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_replay.cnf
@@ -0,0 +1,11 @@
+!include ../galera_2nodes_as_slave.cnf
+
+[mysqld]
+binlog-format=row
+
+[mysqld.1]
+wsrep_restart_slave=1
+
+[mysqld.2]
+wsrep_restart_slave=1
+
diff --git a/mysql-test/suite/galera/t/galera_as_slave_replay.test b/mysql-test/suite/galera/t/galera_as_slave_replay.test
new file mode 100644
index 00000000000..93f95349e6d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_replay.test
@@ -0,0 +1,200 @@
+#
+# This test tests the operation of transaction replay for async replication slave.
+# If a potentially conflicting galera transaction arrives at
+# just the right time during the commit and has lock conflict with async replication transaction
+# applied by slave SQL thread, then the async replication transaction should either abort
+# or rollback and replay (depending on the nature of lock conflict).
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--connection node_2a
+--source include/galera_cluster.inc
+#--source suite/galera/include/galera_have_debug_sync.inc
+
+#
+# node 1 is native MariaDB server operating as async replication master
+#
+--connection node_1
+RESET MASTER;
+
+--connection node_2a
+#
+# count the number of wsrep replay's done in the node
+#
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+
+#
+# nodes 2 and 3 form a galera cluster, node 2 operates as slave for native MariaDB naster in node 1
+#
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+
+#
+# use statement format replication to cause a false positive conflict with async replication transaction
+# and galera replication. The conflict will be on GAP lock, and slave SQL thread should rollback
+# and replay
+#
+set binlog_format=STATEMENT;
+
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+SELECT * FROM t1 FOR UPDATE;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+
+--connection node_2a
+# wait for create table and inserts to be replicated from master
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
+--source include/wait_condition.inc
+
+# wait for create table and inserts to be replicated in cluster
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
+--source include/wait_condition.inc
+
+--connection node_2a
+# Block the future commit of async replication
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+# block also the applier before applying begins
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+#
+# now inject a conflicting insert from node 3, it will replicate with
+# earlier seqno (than async transaction) and pause before applying in node 2
+#
+--connection node_3
+INSERT INTO test.t1 VALUES (2, 'b');
+
+#
+# send the update from master, this will succeed here, beceuase of async replication.
+# async replication will apply this in node 2 and pause before commit phase,
+--connection node_1
+--error 0
+COMMIT;
+
+# Wait until async slave commit is blocked in node_2
+--connection node_2a
+--source include/galera_wait_sync_point.inc
+
+#
+# release the applier
+# note: have to clear wsrep_apply_cb sync point first, as async replication will go for replay
+# and as this sync point, after BF applier is released to progress
+#
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+# Unblock the async slave commit
+--connection node_2a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+
+--connection node_1
+
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+SELECT * FROM t1;
+
+--connection node_2a
+
+# wsrep_local_replays has increased by 1
+set session wsrep_sync_wait=15;
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+set session wsrep_sync_wait=0;
+
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
+#
+# replaying of async transaction should be effective, and row 3 having 'c' in f2
+#
+SELECT * FROM t1;
+SET DEBUG_SYNC = "RESET";
+
+#********************************************************************************
+# test phase 2
+#********************************************************************************
+
+--echo #
+--echo # test phase with real abort
+--echo #
+
+--connection node_1
+
+set binlog_format=ROW;
+
+insert into t1 values (4, 'd');
+
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+
+--connection node_2a
+# wait for the last insert to be replicated from master
+--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
+--source include/wait_condition.inc
+
+# Block the commit
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+# block applier
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+# Inject a conflicting update from node 3
+--connection node_3
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+
+# send the update from master
+--connection node_1
+--error 0
+COMMIT;
+
+--connection node_2a
+
+# release the applier
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+
+# Unblock the async slave commit
+--connection node_2a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+SET DEBUG_SYNC = "RESET";
+
+--connection node_2a
+
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+set session wsrep_sync_wait=0;
+
+STOP SLAVE;
+RESET SLAVE;
+
+DROP TABLE t1;
+
+--connection node_1
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test
new file mode 100644
index 00000000000..f563554b787
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_kill.test
@@ -0,0 +1,74 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+#
+# Test case 1: Start a transaction on node_2a and kill it
+# from other connection on same node
+#
+--connection node_2
+CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
+insert into t1 values (NULL,1);
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+begin;
+update t1 set a = 5;
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
+--source include/wait_condition.inc
+--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
+--disable_query_log
+--eval KILL $k_thread
+--enable_query_log
+select * from t1;
+--disconnect node_2a
+#
+# Test case 2: Start a transaction on node_2a and use
+# kill query from other connection on same node
+#
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+begin;
+update t1 set a =5;
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
+--source include/wait_condition.inc
+--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
+--disable_query_log
+--eval KILL QUERY $k_thread
+--enable_query_log
+select * from t1;
+--disconnect node_2a
+#
+# Test case 3: Start a transaction on node_2a and start a DDL on other transaction
+# that will then abort node_2a transaction
+#
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+begin;
+update t1 set a =5, b=2;
+--connection node_2
+ALTER TABLE t1 ADD UNIQUE KEY b1(b);
+ALTER TABLE t1 DROP KEY b1;
+select * from t1;
+--disconnect node_2a
+#
+# Test case 4: Start a transaction on node_2a and conflicting transaction on node_2b
+# and start a DDL on other transaction that will then abort node_2a and node_2b
+# transactions
+#
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+begin;
+update t1 set a =5, b=2;
+--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2b
+begin;
+send update t1 set a =6, b=7;
+--connection node_2
+ALTER TABLE t1 ADD UNIQUE KEY b2(b);
+ALTER TABLE t1 DROP KEY b2;
+select * from t1;
+--disconnect node_2a
+--disconnect node_2b
+
+--connection node_1
+drop table t1;
diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test
index 3d4a7da7b54..a9e10de0176 100644
--- a/mysql-test/suite/galera/t/galera_defaults.test
+++ b/mysql-test/suite/galera/t/galera_defaults.test
@@ -13,7 +13,7 @@
# Make sure that the test is operating on the right version of galera library.
--disable_query_log
---let $galera_version=25.3.20
+--let $galera_version=25.3.31
source ../wsrep/include/check_galera_version.inc;
--enable_query_log
diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test
index 6f0de0a1f4a..49b54f0f7f0 100644
--- a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test
+++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test
@@ -9,7 +9,6 @@
--echo #
--connection node_1
-set wsrep_sync_wait=0;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
@@ -36,17 +35,35 @@ INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
--connection node_2
-set wsrep_sync_wait=0;
-
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'grandparent'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child'
+--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM child;
--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 2 FROM parent;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 2 FROM grandparent;
+--source include/wait_condition.inc
DELETE FROM grandparent WHERE id = 1;
+SELECT * FROM grandparent;
+SELECT * FROM parent;
+SELECT * FROM child;
+
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
--source include/wait_condition.inc
-SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
-SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM parent;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM grandparent;
+--source include/wait_condition.inc
+
+SELECT * FROM grandparent;
+SELECT * FROM parent;
+SELECT * FROM child;
DROP TABLE child;
DROP TABLE parent;
diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test
index f38c028b7d6..d902783ed64 100644
--- a/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test
+++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test
@@ -25,16 +25,25 @@ INSERT INTO parent VALUES ('row one'), ('row two');
INSERT INTO child VALUES (1,'row one'), (2,'row two');
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 2 FROM parent;
+--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM child;
--source include/wait_condition.inc
+
DELETE FROM parent;
--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 0 FROM parent;
+--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
-SELECT COUNT(*), COUNT(*) = 0 FROM parent;
-SELECT COUNT(*), COUNT(*) = 0 FROM child;
+SELECT * FROM parent;
+SELECT * FROM child;
DROP TABLE child;
DROP TABLE parent;
@@ -61,20 +70,27 @@ CREATE TABLE child (
INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,0,1);
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM parent;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
+--source include/wait_condition.inc
+
# block applier before applying
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 1 FROM child;
---source include/wait_condition.inc
DELETE FROM parent;
--connection node_1a
# wait until applier has reached the sync point
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
-
--connection node_1
# issue conflicting write to child table, it should fail in certification
--error ER_LOCK_DEADLOCK
@@ -88,11 +104,13 @@ SET DEBUG_SYNC = "RESET";
--connection node_1
--reap
-
+--let $wait_condition = SELECT COUNT(*) = 0 FROM parent;
+--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
-SELECT COUNT(*), COUNT(*) = 0 FROM parent;
-SELECT COUNT(*), COUNT(*) = 0 FROM child;
+
+SELECT * FROM parent;
+SELECT * FROM child;
DROP TABLE child;
DROP TABLE parent;
diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test
index a90cab1aa1a..19aa4f7a0a0 100644
--- a/mysql-test/suite/galera/t/galera_fulltext.test
+++ b/mysql-test/suite/galera/t/galera_fulltext.test
@@ -60,3 +60,26 @@ SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
DROP TABLE t1;
DROP TABLE ten;
+#
+# MDEV-24978 : SIGABRT in __libc_message
+#
+--connection node_1
+SET @value=REPEAT (1,5001);
+CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+SELECT COUNT(*) FROM t;
+
+--connection node_2
+SELECT COUNT(*) FROM t;
+
+--connection node_1
+DROP TABLE t;
+CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+SELECT COUNT(*) FROM t;
+
+--connection node_2
+SELECT COUNT(*) FROM t;
+
+--connection node_1
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf
index c7b59b6a27e..34c757de77e 100644
--- a/mysql-test/suite/galera/t/galera_gcache_recover.cnf
+++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf
@@ -4,4 +4,4 @@
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true'
[mysqld.2]
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes'
diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
index 633318629a6..15b47a328fc 100644
--- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
+++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test
@@ -21,7 +21,8 @@ INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a');
# Disconnect node #2
--connection node_2
---source suite/galera/include/galera_unload_provider.inc
+SET SESSION wsrep_sync_wait=0;
+--source suite/galera/include/galera_stop_replication.inc
--connection node_1
UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
@@ -45,7 +46,6 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
--disable_query_log
# base_port setting is lost for some reason when unloading provider, so we need to restore it
--eval SET GLOBAL wsrep_provider_options= 'base_port=$NODE_GALERAPORT_2';
---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
# Make sure IST will block ...
--let $galera_sync_point = recv_IST_after_apply_trx
--source include/galera_set_sync_point.inc
diff --git a/mysql-test/suite/galera/t/galera_log_bin.inc b/mysql-test/suite/galera/t/galera_log_bin.inc
new file mode 100644
index 00000000000..f1d2a12b9de
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin.inc
@@ -0,0 +1,42 @@
+--source include/galera_cluster.inc
+--source include/force_restart.inc
+
+--connection node_1
+reset master;
+--connection node_2
+reset master;
+
+#
+# Test Galera with --log-bin --log-slave-updates .
+# This way the actual MySQL binary log is used,
+# rather than Galera's own implementation
+#
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) = 2 FROM t2;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+--let $MASTER_MYPORT=$NODE_MYPORT_1
+--source include/show_binlog_events.inc
+
+--connection node_2
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+--let $MASTER_MYPORT=$NODE_MYPORT_2
+--source include/show_binlog_events.inc
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo #cleanup
+--connection node_1
+RESET MASTER;
+
diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test
index f1d2a12b9de..923bd623a8a 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.test
+++ b/mysql-test/suite/galera/t/galera_log_bin.test
@@ -1,42 +1 @@
---source include/galera_cluster.inc
---source include/force_restart.inc
-
---connection node_1
-reset master;
---connection node_2
-reset master;
-
-#
-# Test Galera with --log-bin --log-slave-updates .
-# This way the actual MySQL binary log is used,
-# rather than Galera's own implementation
-#
-
-CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (id INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1);
-INSERT INTO t2 VALUES (1);
-
---connection node_2
-SELECT COUNT(*) = 1 FROM t1;
-SELECT COUNT(*) = 2 FROM t2;
-
---connection node_1
-ALTER TABLE t1 ADD COLUMN f2 INTEGER;
---let $MASTER_MYPORT=$NODE_MYPORT_1
---source include/show_binlog_events.inc
-
---connection node_2
-SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
---let $MASTER_MYPORT=$NODE_MYPORT_2
---source include/show_binlog_events.inc
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #cleanup
---connection node_1
-RESET MASTER;
-
+--source galera_log_bin.inc
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt b/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt
new file mode 100644
index 00000000000..03fcb5d040d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt-master.opt
@@ -0,0 +1 @@
+--log-slave-updates --log-bin
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
new file mode 100644
index 00000000000..a09efd2e011
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf
@@ -0,0 +1,15 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+wsrep_sst_method=mariabackup
+wsrep_sst_auth="root:"
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
+
+[sst]
+transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.test b/mysql-test/suite/galera/t/galera_log_bin_opt.test
new file mode 100644
index 00000000000..f3d0afbc8bc
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin_opt.test
@@ -0,0 +1,2 @@
+--source include/have_mariabackup.inc
+--source galera_log_bin.inc
diff --git a/mysql-test/suite/galera/t/galera_rsu_error.test b/mysql-test/suite/galera/t/galera_rsu_error.test
index cad8154ac76..6de7607b6ec 100644
--- a/mysql-test/suite/galera/t/galera_rsu_error.test
+++ b/mysql-test/suite/galera/t/galera_rsu_error.test
@@ -9,6 +9,9 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
INSERT INTO t1 VALUES (1), (1);
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+
SET SESSION wsrep_OSU_method = "RSU";
--error ER_DUP_ENTRY
ALTER TABLE t1 ADD PRIMARY KEY (f1);
diff --git a/mysql-test/suite/galera/t/galera_rsu_simple.test b/mysql-test/suite/galera/t/galera_rsu_simple.test
index 5841dbd8006..aa6f25b6db6 100644
--- a/mysql-test/suite/galera/t/galera_rsu_simple.test
+++ b/mysql-test/suite/galera/t/galera_rsu_simple.test
@@ -8,6 +8,9 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
+--source include/wait_condition.inc
+
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf
index 3fd1c650c05..2954ae0f4cb 100644
--- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf
+++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf
@@ -1,7 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld.1]
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
[mysqld.2]
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test
index eb5f79c12b4..33c5a43df9d 100644
--- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test
+++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test
@@ -6,15 +6,33 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--source include/have_ssl_communication.inc
+
+call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown");
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--connection node_1
+call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
+--connection node_2
+call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
+
+# Setup galera ports
+--connection node_1
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
+
+--connection node_2
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
+
# 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate
--connection node_1
--source include/shutdown_mysqld.inc
---let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/cakey.pem
+--let $restart_noprint = 1
+--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test
index d1c30656139..e8dcbd849d8 100644
--- a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test
@@ -10,7 +10,7 @@
--connection node_2
#--connection node_2
-#--source suite/galera/include/galera_unload_provider.inc
+#--source suite/galera/include/galera_stop_replication.inc
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
diff --git a/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test
index 641d2101c80..793e87cb53e 100644
--- a/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test
+++ b/mysql-test/suite/galera/t/galera_toi_alter_auto_increment.test
@@ -7,7 +7,7 @@
--source include/have_innodb.inc
--connection node_1
-CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
@@ -83,6 +83,8 @@ SET GLOBAL auto_increment_offset = 1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
--connection node_2a
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
+--source include/wait_condition.inc
ALTER TABLE t1 AUTO_INCREMENT=100;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test
index 51eae7005df..89a1af845c9 100644
--- a/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_sequential.test
@@ -9,6 +9,9 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
INSERT INTO t1 VALUES (2, 3);
diff --git a/mysql-test/suite/galera/t/galera_toi_lock_shared.test b/mysql-test/suite/galera/t/galera_toi_lock_shared.test
index 6857a0e08ca..6b7feec6031 100644
--- a/mysql-test/suite/galera/t/galera_toi_lock_shared.test
+++ b/mysql-test/suite/galera/t/galera_toi_lock_shared.test
@@ -10,6 +10,9 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+
ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_trigger.test b/mysql-test/suite/galera/t/galera_trigger.test
index 54508583f4b..3c66b941e32 100644
--- a/mysql-test/suite/galera/t/galera_trigger.test
+++ b/mysql-test/suite/galera/t/galera_trigger.test
@@ -33,4 +33,40 @@ SELECT * FROM t1;
DROP TRIGGER tr1;
DROP TABLE t1;
+#
+# MDEV-23638 : DROP TRIGGER in Galera Cluster not replicating
+#
+--connection node_1
+CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
+
+CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
+
+--delimiter |
+create trigger log_insert after insert on t1
+for each row begin
+ insert into t2(tbl, action) values ('t1', 'INSERT');
+end|
+--delimiter ;
+
+insert into t1(value) values (1);
+insert into t1(value) values (2);
+
+--connection node_2
+set session wsrep_sync_wait=15;
+insert into t1(value) values (3);
+insert into t1(value) values (4);
+select tbl, action from t2;
+
+--connection node_1
+drop trigger if exists log_insert;
+insert into t1(value) values (5);
+select tbl, action from t2;
+
+--connection node_2
+insert into t1(value) values (6);
+select tbl, action from t2;
+
+--connection node_1
+select tbl, action from t2;
+drop table t1, t2;
diff --git a/mysql-test/suite/galera/t/galera_truncate.test b/mysql-test/suite/galera/t/galera_truncate.test
index 79f9bad1f1b..f490943db7c 100644
--- a/mysql-test/suite/galera/t/galera_truncate.test
+++ b/mysql-test/suite/galera/t/galera_truncate.test
@@ -14,6 +14,9 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+
TRUNCATE TABLE t1;
SELECT COUNT(*) = 0 FROM t1;
@@ -29,6 +32,9 @@ CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB;
INSERT INTO t2 VALUES ('abc');
--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t2';
+--source include/wait_condition.inc
+
TRUNCATE TABLE t2;
--connection node_2
diff --git a/mysql-test/suite/galera/t/galera_truncate_temporary.test b/mysql-test/suite/galera/t/galera_truncate_temporary.test
index 3ad94eb9930..ea20911bd5d 100644
--- a/mysql-test/suite/galera/t/galera_truncate_temporary.test
+++ b/mysql-test/suite/galera/t/galera_truncate_temporary.test
@@ -67,6 +67,9 @@ CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2);
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+
TRUNCATE TABLE t1;
SELECT COUNT(*) = 0 FROM t1;
diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.test b/mysql-test/suite/galera/t/galera_var_sst_auth.test
index 5c9b3f5a61e..ad7f46620ad 100644
--- a/mysql-test/suite/galera/t/galera_var_sst_auth.test
+++ b/mysql-test/suite/galera/t/galera_var_sst_auth.test
@@ -1,12 +1,33 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
---echo #
---echo # MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
---echo #
+#
+# MDEV-10492: Assertion failure on shutdown when wsrep_sst_auth set in config
+#
SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth='foo:bar';
SELECT @@global.wsrep_sst_auth;
---source include/galera_end.inc
+#
+# MDEV-24509 Warning: Memory not freed: 56 on SET @@global.wsrep_sst_auth
+#
+--connection node_2
+SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz';
+SELECT @@global.wsrep_sst_auth;
+--echo Shutdown node_2
+--source include/shutdown_mysqld.inc
+
+# On node_1, verify that the node has left the cluster.
+--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
+
+# Restart node_2
+--connection node_2
+--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 @@global.wsrep_sst_auth;
+
+
diff --git a/mysql-test/suite/galera/t/galera_virtual_blob.test b/mysql-test/suite/galera/t/galera_virtual_blob.test
new file mode 100644
index 00000000000..a10e3025668
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_virtual_blob.test
@@ -0,0 +1,10 @@
+--source include/galera_cluster.inc
+
+CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB);
+INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0);
+SELECT * from t;
+
+--connection node_2
+SELECT * from t;
+--connection node_1
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/t/lp1376747-4.test b/mysql-test/suite/galera/t/lp1376747-4.test
index 6ae89fe9df4..d19ff422ab0 100644
--- a/mysql-test/suite/galera/t/lp1376747-4.test
+++ b/mysql-test/suite/galera/t/lp1376747-4.test
@@ -5,7 +5,8 @@
# after provider is unpaused
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
--let $galera_connection_name = node_2a
--let $galera_server_number = 2
@@ -17,8 +18,7 @@ INSERT INTO t1 VALUES (1);
--connection node_2
SET session wsrep_sync_wait=0;
-SET session wsrep_causal_reads=OFF;
-FLUSH TABLE WITH READ LOCK;
+FLUSH TABLES WITH READ LOCK;
--connection node_1
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
@@ -26,25 +26,33 @@ INSERT INTO t1 VALUES (2,3);
--connection node_2a
SET session wsrep_sync_wait=0;
-SET session wsrep_causal_reads=OFF;
-
SHOW CREATE TABLE t1;
+SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2';
--send FLUSH TABLES t1 WITH READ LOCK;
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
---source include/wait_condition.inc
-
+SET debug_sync='now WAIT_FOR parked2';
+
+# let the flush table wait in pause state before we unlock
+# table otherwise there is window where-in flush table is
+# yet to wait in pause and unlock allows alter table to proceed.
+# this is because send is asynchronous.
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE Info LIKE 'FLUSH TABLES t1 WITH READ LOCK';
+--let $wait_condition_on_error_output = SHOW PROCESSLIST
+--source include/wait_condition_with_debug.inc
+
+SET debug_sync='now SIGNAL go2';
+# this will release existing lock but will not resume
+# the cluster as there is new FTRL that is still pausing it.
UNLOCK TABLES;
SHOW CREATE TABLE t1;
+set debug_sync= 'RESET';
--connection node_2a
--reap
UNLOCK TABLES;
---let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
---source include/wait_condition.inc
-
+SET SESSION wsrep_sync_wait = DEFAULT;
SHOW CREATE TABLE t1;
SELECT * from t1;
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
index 0e2706f2dc3..87eca207d5a 100644
--- a/mysql-test/suite/galera_3nodes/disabled.def
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -10,7 +10,16 @@
#
##############################################################################
+GAL-501 : MDEV-24645 galera_3nodes.GAL-501 MTR failed: failed to open gcomm backend connection: 110
galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster
+galera_ipv6_mariabackup : MDEV-24440: galera_3nodes.galera_ipv6_mariabackup MTR fails sporadically: Failed to read from: wsrep_sst_mariabackup --role 'donor' --address '[::1]:16028/xtrabackup_sst//1'
+galera_ipv6_mariabackup_section : MDEV-22195: galera_3nodes.galera_ipv6_mariabackup_section MTR failed: assert_grep.inc failed
+galera_ipv6_mysqldump : MDEV-24036: galera_3nodes.galera_ipv6_mysqldump: rare random crashes during shutdown
+galera_ipv6_rsync_section : MDEV-23580: galera_3nodes.galera_ipv6_rsync_section MTR failed: WSREP_SST: [ERROR] rsync daemon port '16008' has been taken
galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(}
-galera_slave_options_do :MDEV-8798
+galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query
+galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query
+galera_pc_bootstrap : MDEV-24650 galera_pc_bootstrap MTR failed: Could not execute 'check-testcase' before testcase
+galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
+galera_slave_options_do : MDEV-8798
galera_slave_options_ignore : MDEV-8798
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
index 4904a49c73b..79551aa185d 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
@@ -37,7 +37,7 @@ SET GLOBAL wsrep_sst_method = 'mysqldump';
#
#--connection node_2
-#--source suite/galera/include/galera_unload_provider.inc
+#--source suite/galera/include/galera_stop_replication.inc
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
@@ -62,7 +62,7 @@ INSERT INTO t1 VALUES (1);
--let $start_mysqld_params = --wsrep_sst_auth=sst: --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=[::1].1:$NODE_MYPORT_2
--source include/start_mysqld.inc
-#--source suite/galera/include/galera_load_provider.inc
+#--source suite/galera/include/galera_start_replication.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
index ebc756d60b1..0032f8d6ee1 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
@@ -29,10 +29,10 @@ INSERT INTO t1 VALUES (01), (02), (03), (04), (05);
# Disconnect nodes #2 and #3
--connection node_2
---source suite/galera/include/galera_unload_provider.inc
+--source suite/galera/include/galera_stop_replication.inc
--connection node_3
---source suite/galera/include/galera_unload_provider.inc
+--source suite/galera/include/galera_stop_replication.inc
--connection node_1
--source include/wait_until_connected_again.inc
diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
index 28c854c44f4..f4350d25ae9 100644
--- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
+++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
@@ -343,11 +343,12 @@ DELETE FROM t1 WHERE c=1;
DROP TABLE t1;
}
---error ER_PARSE_ERROR
CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
CREATE TABLE t1 (i INT);
---error ER_PARSE_ERROR
ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar");
+SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_PARSE_ERROR
CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10));
diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
index ee80e5f605a..48c4613f6ca 100644
--- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
@@ -426,10 +426,20 @@ INSERT INTO t1(a) VALUES(0);
DELETE FROM t1 WHERE c=1;
DROP TABLE t1;
CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"));
-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 'GENERATED ALWAYS AS ("foo bar"))' at line 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
CREATE TABLE t1 (i INT);
ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar");
-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 'GENERATED ALWAYS AS ("foo bar")' at line 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL,
+ `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10));
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 'GENERATED ALWAYS AS (10))' at line 1
diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
index 09e5b617af1..b7ae6488c95 100644
--- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
@@ -426,10 +426,20 @@ INSERT INTO t1(a) VALUES(0);
DELETE FROM t1 WHERE c=1;
DROP TABLE t1;
CREATE TABLE t1 (c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar"));
-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 'GENERATED ALWAYS AS ("foo bar"))' at line 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
CREATE TABLE t1 (i INT);
ALTER TABLE t1 ADD COLUMN c CHAR(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ("foo bar");
-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 'GENERATED ALWAYS AS ("foo bar")' at line 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL,
+ `c` char(10) CHARACTER SET utf8 COLLATE utf8_bin GENERATED ALWAYS AS ('foo bar') VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (i INT COLLATE utf8_bin, c INT COLLATE utf8_bin GENERATED ALWAYS AS (10));
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 'GENERATED ALWAYS AS (10))' at line 1
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
index 50685e04a69..252274f3e0a 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
@@ -790,3 +790,36 @@ t1 CREATE TABLE `t1` (
ALTER TABLE t1 DROP INDEX f1;
ALTER TABLE t1 DROP f3;
DROP TABLE t1;
+#
+# MDEV-24041 Generated column DELETE with FOREIGN KEY crash InnoDB
+#
+SET FOREIGN_KEY_CHECKS=1;
+CREATE DATABASE `a-b`;
+USE `a-b`;
+CREATE TABLE emails (
+id int,
+PRIMARY KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE email_stats (
+id int,
+email_id int,
+date_sent char(4),
+generated_email_id int as (email_id),
+#generated_sent_date DATE GENERATED ALWAYS AS (date_sent),
+PRIMARY KEY (id),
+KEY mautic_generated_sent_date_email_id (generated_email_id),
+FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
+) ENGINE=InnoDB;
+CREATE TABLE emails_metadata (
+email_id int,
+PRIMARY KEY (email_id),
+CONSTRAINT FK FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO emails VALUES (1);
+INSERT INTO email_stats (id, email_id, date_sent) VALUES (1,1,'Jan');
+INSERT INTO emails_metadata VALUES (1);
+DELETE FROM emails;
+DROP TABLE email_stats;
+DROP TABLE emails_metadata;
+DROP TABLE emails;
+DROP DATABASE `a-b`;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
index 23d3ee97290..24b6a4631e6 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_fk.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
@@ -649,3 +649,44 @@ SHOW CREATE TABLE t1;
ALTER TABLE t1 DROP INDEX f1;
ALTER TABLE t1 DROP f3;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-24041 Generated column DELETE with FOREIGN KEY crash InnoDB
+--echo #
+SET FOREIGN_KEY_CHECKS=1;
+CREATE DATABASE `a-b`;
+USE `a-b`;
+CREATE TABLE emails (
+ id int,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE email_stats (
+ id int,
+ email_id int,
+ date_sent char(4),
+ generated_email_id int as (email_id),
+ #generated_sent_date DATE GENERATED ALWAYS AS (date_sent),
+ PRIMARY KEY (id),
+ KEY mautic_generated_sent_date_email_id (generated_email_id),
+ FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
+) ENGINE=InnoDB;
+
+
+CREATE TABLE emails_metadata (
+ email_id int,
+ PRIMARY KEY (email_id),
+ CONSTRAINT FK FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+
+INSERT INTO emails VALUES (1);
+INSERT INTO email_stats (id, email_id, date_sent) VALUES (1,1,'Jan');
+INSERT INTO emails_metadata VALUES (1);
+
+DELETE FROM emails;
+
+DROP TABLE email_stats;
+DROP TABLE emails_metadata;
+DROP TABLE emails;
+DROP DATABASE `a-b`;
diff --git a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc b/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc
deleted file mode 100644
index d9c0294faf5..00000000000
--- a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc
+++ /dev/null
@@ -1,152 +0,0 @@
---echo #
---echo # Testing robustness against random compression failures
---echo #
-
---source include/not_embedded.inc
---source include/have_innodb.inc
-
---let $simulate_comp_failures_save = `SELECT @@innodb_simulate_comp_failures`
-
---disable_query_log
-call mtr.add_suppression("InnoDB: Simulating a compression failure for table `test`\\.`t1`");
---enable_query_log
-
-# create the table with compressed pages of size 8K.
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
-
-SHOW CREATE TABLE t1;
-
-# percentage of compressions that will be forced to fail
-SET GLOBAL innodb_simulate_comp_failures = 25;
-
---disable_query_log
---disable_result_log
-
-let $num_inserts_ind = $num_inserts;
-let $commit_iterations=50;
-
-while ($num_inserts_ind)
-{
- let $repeat = `select floor(rand() * 10)`;
- eval INSERT INTO t1(id, msg)
- VALUES ($num_inserts_ind, REPEAT('abcdefghijklmnopqrstuvwxyz', $repeat));
- dec $num_inserts_ind;
-}
-
---enable_query_log
---enable_result_log
-
-COMMIT;
-SELECT COUNT(id) FROM t1;
-
---disable_query_log
---disable_result_log
-
-# do random ops, making sure that some pages will get fragmented and reorganized.
-let $num_ops_ind = $num_ops;
-let $commit_count= $commit_iterations;
-
-BEGIN;
-
-while($num_ops_ind)
-{
- let $idx = `select floor(rand()*$num_inserts)`;
- let $insert_or_update = `select floor(rand()*3)`;
-
- let $repeat = `select floor(rand() * 9) + 1`;
-
- let $msg = query_get_value(`select repeat('abcdefghijklmnopqrstuvwxyz', $repeat) as x`, x, 1);
-
- let $single_or_multi = `select floor(rand()*10)`;
-
- if ($insert_or_update)
- {
- let $cnt = query_get_value(SELECT COUNT(*) cnt FROM t1 WHERE id=$idx, cnt, 1);
-
- if ($cnt)
- {
- let $update = `select floor(rand()*2)`;
-
- if ($update)
- {
- if ($single_or_multi)
- {
- eval UPDATE t1 SET msg=\"$msg\" WHERE id=$idx;
- }
-
- if (!$single_or_multi)
- {
- eval UPDATE t1 SET msg=\"$msg\" WHERE id >= $idx - 100 AND id <= $idx + 100;
- }
-
- }
-
- if (!$update)
- {
- if ($single_or_multi)
- {
- eval INSERT INTO t1(msg, id) VALUES (\"$msg\", $idx) ON DUPLICATE KEY UPDATE msg=VALUES(msg), id = VALUES(id);
- }
-
- if (!$single_or_multi)
- {
- let $diff = 200;
-
- while ($diff)
- {
- eval INSERT INTO t1(msg, id) VALUES (\"$msg\", $idx + 100 - $diff) ON DUPLICATE KEY UPDATE msg=VALUES(msg), id=VALUES(id);
-
- dec $diff;
- }
- }
- }
- }
-
- if (!$cnt)
- {
- let $null_msg = `select floor(rand()*2)`;
-
- if ($null_msg)
- {
- eval INSERT INTO t1(id,msg) VALUES ($idx, NULL);
- }
-
- if (!$null_msg)
- {
- eval INSERT INTO t1(id, msg) VALUES ($idx, \"$msg\");
- }
- }
- }
-
- if (!$insert_or_update)
- {
- if ($single_or_multi)
- {
- eval DELETE from t1 WHERE id=$idx;
- }
-
- if (!$single_or_multi)
- {
- eval DELETE from t1 WHERE id >= $idx - 100 AND id <= $idx + 100;
- }
- }
-
- dec $commit_count;
- if (!$commit_count)
- {
- let $commit_count= $commit_iterations;
- COMMIT;
- BEGIN;
- }
-
- dec $num_ops_ind;
-}
-
-COMMIT;
-
-# final cleanup
-DROP TABLE t1;
-
-eval SET GLOBAL innodb_simulate_comp_failures = $simulate_comp_failures_save;
-
---enable_query_log
diff --git a/mysql-test/suite/innodb/r/alter_large_dml.result b/mysql-test/suite/innodb/r/alter_large_dml.result
index 056e8fdd768..41f497a5591 100644
--- a/mysql-test/suite/innodb/r/alter_large_dml.result
+++ b/mysql-test/suite/innodb/r/alter_large_dml.result
@@ -14,16 +14,10 @@ SET DEBUG_SYNC = 'now SIGNAL dml_pause';
SET DEBUG_SYNC = 'now WAIT_FOR dml_restart';
ROLLBACK;
BEGIN;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
+INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920;
ROLLBACK;
BEGIN;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml_done';
connect con2, localhost,root,,test;
diff --git a/mysql-test/suite/innodb/r/alter_mdl_timeout.result b/mysql-test/suite/innodb/r/alter_mdl_timeout.result
new file mode 100644
index 00000000000..7af1362c69e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_mdl_timeout.result
@@ -0,0 +1,23 @@
+create table t1(f1 char(10), f2 char(10) not null, f3 int not null,
+f4 int not null, primary key(f3))engine=innodb;
+insert into t1 values('a','a', 1, 1), ('b','b', 2, 2), ('c', 'c', 3, 3), ('d', 'd', 4, 4);
+SET DEBUG_SYNC="row_merge_after_scan SIGNAL con1_start WAIT_FOR con1_insert";
+SET DEBUG_SYNC="innodb_commit_inplace_alter_table_wait SIGNAL con1_wait WAIT_FOR con1_update";
+ALTER TABLE t1 ADD UNIQUE INDEX(f1(3), f4), ADD UNIQUE INDEX(f2), ALGORITHM=INPLACE;
+connect con1,localhost,root,,,;
+SET DEBUG_SYNC="now WAIT_FOR con1_start";
+begin;
+INSERT INTO t1 VALUES('e','e',5, 5);
+SET DEBUG_SYNC="now SIGNAL con1_insert";
+SET DEBUG_SYNC="now WAIT_FOR con1_wait";
+SET DEBUG_SYNC="before_row_upd_sec_new_index_entry SIGNAL con1_update WAIT_FOR alter_rollback";
+UPDATE t1 set f4 = 10 order by f1 desc limit 2;
+connection default;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET DEBUG_SYNC="now SIGNAL alter_rollback";
+connection con1;
+commit;
+connection default;
+disconnect con1;
+DROP TABLE t1;
+SET DEBUG_SYNC="RESET";
diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result
index fc08f29e515..46162c167da 100644
--- a/mysql-test/suite/innodb/r/alter_table.result
+++ b/mysql-test/suite/innodb/r/alter_table.result
@@ -70,3 +70,19 @@ ERROR HY000: Tablespace has been discarded for table `t`
ALTER TABLE t FORCE;
ERROR HY000: Tablespace has been discarded for table `t`
DROP TABLE t;
+#
+# MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS
+#
+CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a))
+ENGINE=InnoDB;
+ALTER TABLE t1 CHANGE COLUMN a u INT;
+SELECT sf.* FROM information_schema.innodb_sys_fields sf
+INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id
+INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id
+WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos;
+INDEX_ID NAME POS
+ID b 0
+ID c 0
+ID u 1
+DROP TABLE t1;
+# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/r/alter_varchar_change.result b/mysql-test/suite/innodb/r/alter_varchar_change.result
index 8ffc6e5cfe2..e7793863ff8 100644
--- a/mysql-test/suite/innodb/r/alter_varchar_change.result
+++ b/mysql-test/suite/innodb/r/alter_varchar_change.result
@@ -460,11 +460,18 @@ DROP TABLE t1;
DROP PROCEDURE get_index_id;
DROP PROCEDURE get_table_id;
create table t (a varchar(100)) engine=innodb;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
+from information_schema.innodb_sys_columns sc
+inner join information_schema.innodb_sys_tables st
+on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
name pos mtype prtype len
a 0 1 524303 100
alter table t modify a varchar(110), algorithm=inplace;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
+from information_schema.innodb_sys_columns sc
+inner join information_schema.innodb_sys_tables st
+on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
name pos mtype prtype len
a 0 1 524303 110
drop table t;
+# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/r/file_format_defaults.result b/mysql-test/suite/innodb/r/file_format_defaults.result
index 5ea34ceb7b5..2be4e375eb2 100644
--- a/mysql-test/suite/innodb/r/file_format_defaults.result
+++ b/mysql-test/suite/innodb/r/file_format_defaults.result
@@ -12,7 +12,7 @@ Warning 131 Using innodb_large_prefix is deprecated and the parameter may be rem
SET SQL_MODE=strict_all_tables;
CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
Warnings:
-Warning 1071 Specified key was too long; max key length is 3072 bytes
+Note 1071 Specified key was too long; max key length is 3072 bytes
SHOW CREATE TABLE tab0;
Table Create Table
tab0 CREATE TABLE `tab0` (
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index 8101ae6bea2..ca27595ffa0 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -413,6 +413,7 @@ CREATE TABLE x AS SELECT * FROM t1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
connect con1,localhost,root,,test;
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
+SET lock_wait_timeout=5;
ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 87d7d1c60d3..6c405627e08 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
-) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index 921f9880d47..326aed06901 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -2302,7 +2302,7 @@ Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
create table t1 (v varchar(65530), key(v));
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
SET GLOBAL innodb_large_prefix=default;
Warnings:
Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
@@ -2477,11 +2477,11 @@ Warning 131 Using innodb_large_prefix is deprecated and the parameter may be rem
create table t1 (col1 varchar(768), index(col1))
character set = latin1 engine = innodb;
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
create table t2 (col1 varbinary(768), index(col1))
character set = latin1 engine = innodb;
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
create table t3 (col1 text, index(col1(768)))
character set = latin1 engine = innodb;
Warnings:
@@ -3373,3 +3373,20 @@ c1 c2
9 3
DROP TABLE t1;
DROP TABLE t2;
+#
+# MDEV-24748 Extern field check missing
+# in btr_index_rec_validate()
+#
+CREATE TABLE t1 (pk INT, c1 char(255),
+c2 char(255), c3 char(255), c4 char(255),
+c5 char(255), c6 char(255), c7 char(255),
+c8 char(255), primary key (pk)
+) CHARACTER SET utf32 ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'),
+(2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p');
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 FORCE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug60049.result b/mysql-test/suite/innodb/r/innodb_bug60049.result
deleted file mode 100644
index f34ebc0a955..00000000000
--- a/mysql-test/suite/innodb/r/innodb_bug60049.result
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0;
-RENAME TABLE t TO u;
-DROP TABLE u;
-SELECT @@innodb_fast_shutdown;
-@@innodb_fast_shutdown
-0
-Last record of ID_IND root page (9):
-18080000180500c0000000000000000c5359535f464f524549474e5f434f4c53
diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result
index 64f9ebc2fc2..93bd4e6716c 100644
--- a/mysql-test/suite/innodb/r/innodb_multi_update.result
+++ b/mysql-test/suite/innodb/r/innodb_multi_update.result
@@ -81,4 +81,5 @@ CREATE TABLE t1(f1 INT) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1;
ERROR 21000: Operand should contain 1 column(s)
+UPDATE (SELECT ((SELECT 1 FROM t1),1) = (1,1) FROM t1 WHERE (SELECT 1 FROM t1)) x, t1 AS d SET d.f1 = 1;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 0272ecd82b5..877f20cf195 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -1166,7 +1166,7 @@ drop table t1,t2;
create table t1(f1 varchar(800) binary not null, key(f1))
character set utf8 collate utf8_general_ci;
Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
+Note 1071 Specified key was too long; max key length is 767 bytes
insert into t1 values('aaa');
drop table t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
deleted file mode 100644
index f35e4159603..00000000000
--- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Testing robustness against random compression failures
-#
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `msg` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `msg_i` (`msg`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
-SET GLOBAL innodb_simulate_comp_failures = 25;
-COMMIT;
-SELECT COUNT(id) FROM t1;
-COUNT(id)
-1500
diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result
deleted file mode 100644
index 099c673bca7..00000000000
--- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Testing robustness against random compression failures
-#
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `msg` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `msg_i` (`msg`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
-SET GLOBAL innodb_simulate_comp_failures = 25;
-COMMIT;
-SELECT COUNT(id) FROM t1;
-COUNT(id)
-1000
diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result
index fc09b74d62f..12a41860708 100644
--- a/mysql-test/suite/innodb/r/truncate_foreign.result
+++ b/mysql-test/suite/innodb/r/truncate_foreign.result
@@ -57,3 +57,14 @@ disconnect dml;
connection default;
SET DEBUG_SYNC = RESET;
DROP TABLE child, parent;
+#
+# MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or
+# ER_CRASHED_ON_USAGE after ALTER on table with foreign key
+#
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE;
+LOCK TABLE t1 WRITE;
+TRUNCATE TABLE t1;
+ALTER TABLE t1 ADD c INT;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/alter_large_dml.test b/mysql-test/suite/innodb/t/alter_large_dml.test
index 5ab3f394115..54f5f171f05 100644
--- a/mysql-test/suite/innodb/t/alter_large_dml.test
+++ b/mysql-test/suite/innodb/t/alter_large_dml.test
@@ -25,17 +25,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR dml_restart';
ROLLBACK;
BEGIN;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
-INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
+INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920;
ROLLBACK;
BEGIN;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL dml_done';
diff --git a/mysql-test/suite/innodb/t/alter_mdl_timeout.opt b/mysql-test/suite/innodb/t/alter_mdl_timeout.opt
new file mode 100644
index 00000000000..9e0e38bd64a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_mdl_timeout.opt
@@ -0,0 +1 @@
+--lock_wait_timeout=2
diff --git a/mysql-test/suite/innodb/t/alter_mdl_timeout.test b/mysql-test/suite/innodb/t/alter_mdl_timeout.test
new file mode 100644
index 00000000000..15e7f524fd0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_mdl_timeout.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+create table t1(f1 char(10), f2 char(10) not null, f3 int not null,
+ f4 int not null, primary key(f3))engine=innodb;
+insert into t1 values('a','a', 1, 1), ('b','b', 2, 2), ('c', 'c', 3, 3), ('d', 'd', 4, 4);
+SET DEBUG_SYNC="row_merge_after_scan SIGNAL con1_start WAIT_FOR con1_insert";
+SET DEBUG_SYNC="innodb_commit_inplace_alter_table_wait SIGNAL con1_wait WAIT_FOR con1_update";
+send ALTER TABLE t1 ADD UNIQUE INDEX(f1(3), f4), ADD UNIQUE INDEX(f2), ALGORITHM=INPLACE;
+
+connect(con1,localhost,root,,,);
+SET DEBUG_SYNC="now WAIT_FOR con1_start";
+begin;
+INSERT INTO t1 VALUES('e','e',5, 5);
+SET DEBUG_SYNC="now SIGNAL con1_insert";
+SET DEBUG_SYNC="now WAIT_FOR con1_wait";
+SET DEBUG_SYNC="before_row_upd_sec_new_index_entry SIGNAL con1_update WAIT_FOR alter_rollback";
+SEND UPDATE t1 set f4 = 10 order by f1 desc limit 2;
+
+connection default;
+--error ER_LOCK_WAIT_TIMEOUT
+reap;
+SET DEBUG_SYNC="now SIGNAL alter_rollback";
+
+connection con1;
+reap;
+commit;
+
+connection default;
+disconnect con1;
+DROP TABLE t1;
+SET DEBUG_SYNC="RESET";
diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test
index 5050abdc087..5c06388cdba 100644
--- a/mysql-test/suite/innodb/t/alter_table.test
+++ b/mysql-test/suite/innodb/t/alter_table.test
@@ -79,3 +79,18 @@ ALTER TABLE t ENGINE INNODB;
--error ER_TABLESPACE_DISCARDED
ALTER TABLE t FORCE;
DROP TABLE t;
+
+--echo #
+--echo # MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS
+--echo #
+CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a))
+ENGINE=InnoDB;
+ALTER TABLE t1 CHANGE COLUMN a u INT;
+--replace_column 1 ID
+SELECT sf.* FROM information_schema.innodb_sys_fields sf
+INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id
+INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id
+WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos;
+DROP TABLE t1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/suite/innodb/t/alter_varchar_change.test b/mysql-test/suite/innodb/t/alter_varchar_change.test
index 6a5719a1ef0..98e32146b99 100644
--- a/mysql-test/suite/innodb/t/alter_varchar_change.test
+++ b/mysql-test/suite/innodb/t/alter_varchar_change.test
@@ -337,7 +337,15 @@ DROP PROCEDURE get_table_id;
# LEN must increase here
create table t (a varchar(100)) engine=innodb;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
+from information_schema.innodb_sys_columns sc
+inner join information_schema.innodb_sys_tables st
+on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
alter table t modify a varchar(110), algorithm=inplace;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
+from information_schema.innodb_sys_columns sc
+inner join information_schema.innodb_sys_tables st
+on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
drop table t;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 380d4520d87..7756d48046f 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -414,6 +414,7 @@ INSERT INTO t1 VALUES (1,2);
CREATE TABLE x AS SELECT * FROM t1;
--connect (con1,localhost,root,,test)
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
+SET lock_wait_timeout=5;
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;# Cleanup
--disconnect con1
diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test
index 7aa146d7d99..d494f40bcb6 100644
--- a/mysql-test/suite/innodb/t/innodb.test
+++ b/mysql-test/suite/innodb/t/innodb.test
@@ -2628,3 +2628,21 @@ SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
+
+--echo #
+--echo # MDEV-24748 Extern field check missing
+--echo # in btr_index_rec_validate()
+--echo #
+CREATE TABLE t1 (pk INT, c1 char(255),
+c2 char(255), c3 char(255), c4 char(255),
+c5 char(255), c6 char(255), c7 char(255),
+c8 char(255), primary key (pk)
+) CHARACTER SET utf32 ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+ (1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'),
+ (2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p');
+CHECK TABLE t1;
+ALTER TABLE t1 FORCE;
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug60049-master.opt b/mysql-test/suite/innodb/t/innodb_bug60049-master.opt
deleted file mode 100644
index 22a5d4ed221..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug60049-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_fast_shutdown=0
diff --git a/mysql-test/suite/innodb/t/innodb_bug60049.test b/mysql-test/suite/innodb/t/innodb_bug60049.test
deleted file mode 100644
index cb05ca297ea..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug60049.test
+++ /dev/null
@@ -1,49 +0,0 @@
-# Bug #60049 Verify that purge leaves no garbage in unique secondary indexes
-# This test requires a fresh server start-up and a slow shutdown.
-# This was a suspected bug (not a bug).
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
--- source include/have_innodb_16k.inc
-
--- disable_query_log
-call mtr.add_suppression('\\[ERROR\\] InnoDB: Table `mysql`.`innodb_(table|index)_stats` not found');
-call mtr.add_suppression('\\[ERROR\\] InnoDB: Fetch of persistent statistics requested for table `mysql`.`gtid_executed`');
-
-let $create1 = query_get_value(SHOW CREATE TABLE mysql.innodb_table_stats, Create Table, 1);
-let $create2 = query_get_value(SHOW CREATE TABLE mysql.innodb_index_stats, Create Table, 1);
-DROP TABLE mysql.innodb_index_stats;
-DROP TABLE mysql.innodb_table_stats;
--- enable_query_log
-
-CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0;
-RENAME TABLE t TO u;
-DROP TABLE u;
-SELECT @@innodb_fast_shutdown;
-let $MYSQLD_DATADIR=`select @@datadir`;
-
---source include/shutdown_mysqld.inc
-
-# Check the tail of ID_IND (SYS_TABLES.ID)
-let IBDATA1=$MYSQLD_DATADIR/ibdata1;
-perl;
-my $file = $ENV{'IBDATA1'};
-open(FILE, "<$file") || die "Unable to open $file";
-# Read DICT_HDR_TABLE_IDS, the root page number of ID_IND (SYS_TABLES.ID).
-seek(FILE, 7*16384+38+36, 0) || die "Unable to seek $file";
-die unless read(FILE, $_, 4) == 4;
-my $sys_tables_id_root = unpack("N", $_);
-print "Last record of ID_IND root page ($sys_tables_id_root):\n";
-# This should be the last record in ID_IND. Dump it in hexadecimal.
-seek(FILE, $sys_tables_id_root*16384 + 152, 0) || die "Unable to seek $file";
-read(FILE, $_, 32) || die "Unable to read $file";
-close(FILE);
-print unpack("H*", $_), "\n";
-EOF
-
---source include/start_mysqld.inc
-
--- disable_query_log
-USE mysql;
-eval $create1;
-eval $create2;
diff --git a/mysql-test/suite/innodb/t/innodb_multi_update.test b/mysql-test/suite/innodb/t/innodb_multi_update.test
index 8d5283a9ed5..74a7aea7d13 100644
--- a/mysql-test/suite/innodb/t/innodb_multi_update.test
+++ b/mysql-test/suite/innodb/t/innodb_multi_update.test
@@ -35,4 +35,5 @@ CREATE TABLE t1(f1 INT) ENGINE=INNODB;
INSERT INTO t1 VALUES(1);
--error ER_OPERAND_COLUMNS
UPDATE (SELECT ((SELECT 1 FROM t1), 1) FROM t1 WHERE (SELECT 1 FROM t1)) x, (SELECT 1) AS d SET d.f1 = 1;
+UPDATE (SELECT ((SELECT 1 FROM t1),1) = (1,1) FROM t1 WHERE (SELECT 1 FROM t1)) x, t1 AS d SET d.f1 = 1;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt
deleted file mode 100644
index 39b205c9b68..00000000000
--- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---innodb-file-per-table
---skip-innodb-doublewrite
diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
deleted file mode 100644
index 5a4978c9b37..00000000000
--- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/big_test.inc
-# test takes too long with valgrind
---source include/not_valgrind.inc
---source include/have_debug.inc
---let $num_inserts = 1500
---let $num_ops = 3500
---source suite/innodb/include/innodb_simulate_comp_failures.inc
-# clean exit
---exit
diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt
deleted file mode 100644
index fae32059249..00000000000
--- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---innodb-file-per-table
-
diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test
deleted file mode 100644
index 79a16d36917..00000000000
--- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test
+++ /dev/null
@@ -1,8 +0,0 @@
---source include/have_debug.inc
---source include/not_valgrind.inc
-
---let $num_inserts = 1000
---let $num_ops = 30
---source suite/innodb/include/innodb_simulate_comp_failures.inc
-# clean exit
---exit
diff --git a/mysql-test/suite/innodb/t/truncate_foreign.test b/mysql-test/suite/innodb/t/truncate_foreign.test
index d9d647e69f0..1c150e5db40 100644
--- a/mysql-test/suite/innodb/t/truncate_foreign.test
+++ b/mysql-test/suite/innodb/t/truncate_foreign.test
@@ -67,3 +67,16 @@ connection default;
SET DEBUG_SYNC = RESET;
DROP TABLE child, parent;
+
+--echo #
+--echo # MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or
+--echo # ER_CRASHED_ON_USAGE after ALTER on table with foreign key
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE;
+LOCK TABLE t1 WRITE;
+TRUNCATE TABLE t1;
+ALTER TABLE t1 ADD c INT;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result
index c3a14fa0281..963b31fdbd7 100644
--- a/mysql-test/suite/innodb_fts/r/create.result
+++ b/mysql-test/suite/innodb_fts/r/create.result
@@ -182,3 +182,13 @@ Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
+#
+# MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by multiple fields
+#
+create table t1 (
+f1 int, f2 text,
+FTS_DOC_ID bigint unsigned not null,
+unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1),
+fulltext (f2))
+engine=innodb;
+ERROR 42000: Incorrect index name 'FTS_DOC_ID_INDEX'
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
index f23813aed48..f1e625037f3 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
@@ -234,3 +234,35 @@ CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
DROP TABLE t1;
+#
+# MDEV-21478 Inplace alter fails to report error when
+# FTS_DOC_ID is added
+SET NAMES utf8;
+CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
+ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
+ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD;
+ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB;
+ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+ERROR 42000: Incorrect column name 'FTS_DOC_Ä°D'
+ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
+ERROR 42000: Incorrect column name 'FTS_DOC_Ä°D'
+ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY;
+ERROR 42000: Incorrect column name 'fts_doc_id'
+ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE;
+ERROR 42000: Incorrect column name 'fts_doc_id'
+ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
+ERROR 42000: Incorrect column name 'fts_doc_id'
+ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+ERROR 42000: Incorrect column name 'fts_doc_id'
+ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY;
+ERROR 42000: Incorrect column name 'FTS_DOC_ID'
+ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+ERROR 42000: Incorrect column name 'FTS_DOC_ID'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result
index 8ef2ac425fc..b162b2f7415 100644
--- a/mysql-test/suite/innodb_fts/r/misc_debug.result
+++ b/mysql-test/suite/innodb_fts/r/misc_debug.result
@@ -26,3 +26,29 @@ SET DEBUG_DBUG="+d,fts_instrument_sync";
INSERT INTO t1 VALUES(1, "mariadb");
ALTER TABLE t1 FORCE;
DROP TABLE t2, t1;
+#
+# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX
+#
+CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
+connect con1,localhost,root,,test;
+SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1';
+SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
+ALTER TABLE t1 ADD FULLTEXT(c);
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR s1';
+KILL QUERY @id;
+SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2';
+START TRANSACTION;
+SELECT * FROM t1;
+a b c
+SET DEBUG_SYNC='now SIGNAL s2';
+connection con1;
+ERROR 70100: Query execution was interrupted
+disconnect con1;
+connection default;
+SET DEBUG_SYNC=RESET;
+ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test
index 4e522994fcc..38c93de4982 100644
--- a/mysql-test/suite/innodb_fts/t/create.test
+++ b/mysql-test/suite/innodb_fts/t/create.test
@@ -106,3 +106,14 @@ SET GLOBAL innodb_optimize_fulltext_only= 1;
OPTIMIZE TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
+
+--echo #
+--echo # MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by multiple fields
+--echo #
+--error ER_WRONG_NAME_FOR_INDEX
+create table t1 (
+ f1 int, f2 text,
+ FTS_DOC_ID bigint unsigned not null,
+ unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1),
+ fulltext (f2))
+engine=innodb;
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
index cd292803fb3..e055acc4968 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
@@ -278,3 +278,44 @@ CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-21478 Inplace alter fails to report error when
+--echo # FTS_DOC_ID is added
+
+SET NAMES utf8;
+
+CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
+ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
+ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD;
+ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+DROP TABLE t1;
+
+CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY;
+
+--error ER_WRONG_COLUMN_NAME
+ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
+
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test
index aaf628abe6d..461e3f1d9d4 100644
--- a/mysql-test/suite/innodb_fts/t/misc_debug.test
+++ b/mysql-test/suite/innodb_fts/t/misc_debug.test
@@ -5,6 +5,8 @@
--source include/have_innodb.inc
--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/count_sessions.inc
# Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE(
# TABLE->FTS->INDEXES, ALTER TABLE
@@ -52,3 +54,32 @@ INSERT INTO t1 VALUES(1, "mariadb");
ALTER TABLE t1 FORCE;
# Cleanup
DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX
+--echo #
+CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
+connect(con1,localhost,root,,test);
+let $ID= `SELECT @id := CONNECTION_ID()`;
+SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1';
+SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
+send ALTER TABLE t1 ADD FULLTEXT(c);
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR s1';
+let $ignore= `SELECT @id := $ID`;
+KILL QUERY @id;
+SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2';
+START TRANSACTION;
+SELECT * FROM t1;
+SET DEBUG_SYNC='now SIGNAL s2';
+connection con1;
+--error ER_QUERY_INTERRUPTED
+reap;
+disconnect con1;
+connection default;
+SET DEBUG_SYNC=RESET;
+# Exploit MDEV-17468 to force the table definition to be reloaded
+ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL;
+CHECK TABLE t1;
+DROP TABLE t1;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test
index 256cd1ab0ad..0e5fba6fc34 100644
--- a/mysql-test/suite/innodb_gis/t/1.test
+++ b/mysql-test/suite/innodb_gis/t/1.test
@@ -393,7 +393,6 @@ insert into t1 values (1);
insert into t1 values (1.11);
--error 1416
insert into t1 values ("qwerty");
-# --error ER_GIS_INVALID_DATA
--error ER_BAD_NULL_ERROR
insert into t1 values (ST_pointfromtext('point(1,1)'));
@@ -437,7 +436,6 @@ select
ST_y(b) IS NULL
from t1;
-# --error ER_GIS_INVALID_DATA
select
MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL,
MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL,
@@ -466,7 +464,6 @@ DROP TABLE t1;
#
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
INSERT IGNORE INTO `t1` VALUES ('','0000-00-00');
-# --error ER_GIS_INVALID_DATA
select ST_geomfromtext(col9,col89) as a from t1;
DROP TABLE t1;
@@ -623,17 +620,11 @@ SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN
# MBROverlaps needs a few more tests, with point and line dimensions
-# --error ER_GIS_INVALID_DATA
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
-# --error ER_GIS_INVALID_DATA
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
-# --error ER_GIS_INVALID_DATA
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
-# --error ER_GIS_INVALID_DATA
SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
-# --error ER_GIS_INVALID_DATA
SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
-# --error ER_GIS_INVALID_DATA
SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
@@ -772,10 +763,8 @@ SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUA
--echo # BUG#51875: crash when loading data into geometry function ST_polyfromwkb
--echo #
SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
-# --error ER_GIS_INVALID_DATA
SET @a=ST_POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
-# --error ER_GIS_INVALID_DATA
SET @a=ST_POLYFROMWKB(@a);
@@ -899,7 +888,6 @@ DROP TABLE g1;
CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255)));
INSERT INTO g1 VALUES ('a'),('a');
-# --error ER_GIS_INVALID_DATA
SELECT 1 FROM g1 WHERE a >= ANY
(SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ;
@@ -1447,5 +1435,4 @@ DROP DATABASE gis_ogs;
--echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE
--echo #
-# --error ER_GIS_INVALID_DATA
SELECT ST_Union('', ''), md5(1);
diff --git a/mysql-test/suite/innodb_gis/t/bug16236208.test b/mysql-test/suite/innodb_gis/t/bug16236208.test
index b55ab1d0fd3..3a1fbefc52c 100644
--- a/mysql-test/suite/innodb_gis/t/bug16236208.test
+++ b/mysql-test/suite/innodb_gis/t/bug16236208.test
@@ -47,7 +47,6 @@ ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'));
CREATE INDEX linestring_index ON linestring(linestring_nokey(5));
ALTER TABLE linestring ADD KEY (linestring_key(5));
-# --error ER_GIS_INVALID_DATA
SELECT ST_AsText(linestring_nokey) FROM linestring FORCE KEY (
linestring_key ) WHERE ST_CONTAINS( ST_GeomFromText('POLYGON( ( 3923 2815 , 4246
2122 , 4028 2971 , 4017 3019 , 3923 2815 ) )') , linestring_key ) AND
diff --git a/mysql-test/suite/innodb_gis/t/create_spatial_index.test b/mysql-test/suite/innodb_gis/t/create_spatial_index.test
index 6a15b0f2d74..1c0a7e7aaa7 100644
--- a/mysql-test/suite/innodb_gis/t/create_spatial_index.test
+++ b/mysql-test/suite/innodb_gis/t/create_spatial_index.test
@@ -1141,7 +1141,6 @@ insert into `t1` values(
linestring(point(1,1),point(1,1))
);
-# --error ER_GIS_INVALID_DATA
--error ER_BAD_NULL_ERROR
insert into `t1` values
(
diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test
index 489934e957e..ba1b3b12ec2 100644
--- a/mysql-test/suite/innodb_gis/t/gis.test
+++ b/mysql-test/suite/innodb_gis/t/gis.test
@@ -388,7 +388,6 @@ insert into t1 values (1.11);
--error 1416
insert into t1 values ("qwerty");
--error 1048
-# --error ER_GIS_INVALID_DATA
insert into t1 values (ST_pointfromtext('point(1,1)'));
drop table t1;
@@ -431,7 +430,6 @@ select
ST_y(b) IS NULL
from t1;
-# --error ER_GIS_INVALID_DATA
select
MBRwithin(b, b) IS NULL, MBRcontains(b, b) IS NULL, MBRoverlaps(b, b) IS NULL,
MBRequals(b, b) IS NULL, MBRdisjoint(b, b) IS NULL, ST_touches(b, b) IS NULL,
@@ -460,7 +458,6 @@ DROP TABLE t1;
#
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
INSERT IGNORE INTO `t1` VALUES ('','0000-00-00');
-# --error ER_GIS_INVALID_DATA
select ST_geomfromtext(col9,col89) as a from t1;
DROP TABLE t1;
@@ -617,17 +614,11 @@ SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS MBRwithin FROM t1 a1 JOIN
# MBROverlaps needs a few more tests, with point and line dimensions
-# --error ER_GIS_INVALID_DATA
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
-# --error ER_GIS_INVALID_DATA
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
-# --error ER_GIS_INVALID_DATA
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
-# --error ER_GIS_INVALID_DATA
SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
-# --error ER_GIS_INVALID_DATA
SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
-# --error ER_GIS_INVALID_DATA
SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
@@ -766,10 +757,8 @@ SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUA
--echo # BUG#51875: crash when loading data into geometry function ST_polyfromwkb
--echo #
SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
-# --error ER_GIS_INVALID_DATA
SET @a=ST_POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
-# --error ER_GIS_INVALID_DATA
SET @a=ST_POLYFROMWKB(@a);
@@ -901,7 +890,6 @@ DROP TABLE g1;
CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255)));
INSERT INTO g1 VALUES ('a'),('a');
-# --error ER_GIS_INVALID_DATA
SELECT 1 FROM g1 WHERE a >= ANY
(SELECT 1 FROM g1 WHERE a = ST_geomfromtext('') OR a) ;
@@ -1440,5 +1428,4 @@ DROP DATABASE gis_ogs;
--echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE
--echo #
-# --error ER_GIS_INVALID_DATA
SELECT ST_Union('', ''), md5(1);
diff --git a/mysql-test/suite/innodb_gis/t/precise.test b/mysql-test/suite/innodb_gis/t/precise.test
index 9174a100003..3936610530f 100644
--- a/mysql-test/suite/innodb_gis/t/precise.test
+++ b/mysql-test/suite/innodb_gis/t/precise.test
@@ -122,7 +122,6 @@ SELECT ST_Equals(ST_PointFromText('POINT (12 13)'),ST_PointFromText('POINT (12 1
--echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
--echo #
-# --error ER_GIS_INVALID_DATA
SELECT ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('POLYGON((525000 183300,525400
183300,525400 18370, 525000 183700,525000 183300))'),
ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57
@@ -140,7 +139,6 @@ ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57
183491.55))'))) st_u;
SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
-# --error ER_GIS_INVALID_DATA
SELECT ST_ASTEXT(ST_TOUCHES(@a, ST_GEOMFROMTEXT('point(0 0)'))) t;
diff --git a/mysql-test/suite/innodb_gis/t/rtree.test b/mysql-test/suite/innodb_gis/t/rtree.test
index 58d81576b3e..98931e70e62 100644
--- a/mysql-test/suite/innodb_gis/t/rtree.test
+++ b/mysql-test/suite/innodb_gis/t/rtree.test
@@ -78,17 +78,11 @@ SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
# MBROverlaps needs a few more tests, with point and line dimensions
-# --error ER_GIS_INVALID_DATA
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
-# --error ER_GIS_INVALID_DATA
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
-# --error ER_GIS_INVALID_DATA
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
-# --error ER_GIS_INVALID_DATA
SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
-# --error ER_GIS_INVALID_DATA
SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
-# --error ER_GIS_INVALID_DATA
SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test
index 42f00428b88..60ecbe2e53a 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_purge.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test
@@ -1,7 +1,7 @@
# This test case will test R-tree purge.
--source include/innodb_page_size.inc
-# Valgrind takes too much time on PB2 even in the --big-test runs.
+--source include/have_sequence.inc
--source include/not_valgrind.inc
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
@@ -16,9 +16,7 @@ set @p=point(1,1);
let $n=200;
while ($n) {
begin;
-insert into t values(@p,@p),(@p,@p);
-insert into t select @p,@p
-from t a,t b,t c,t d,t e,t f,t g;
+insert into t select @p,@p from seq_1_to_130;
delete from t;
commit;
dec $n;
diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result
index fe03586546a..d125df09ae3 100644
--- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result
+++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result
@@ -407,10 +407,10 @@ ROW_FORMAT=DYNAMIC;
SET sql_mode='';
create index idx1 on worklog5743(a2);
Warnings:
-Warning 1071 Specified key was too long; max key length is 3072 bytes
+Note 1071 Specified key was too long; max key length is 3072 bytes
create index idx2 on worklog5743(a3);
Warnings:
-Warning 1071 Specified key was too long; max key length is 3072 bytes
+Note 1071 Specified key was too long; max key length is 3072 bytes
create index idx3 on worklog5743(a4);
show warnings;
Level Code Message
@@ -419,7 +419,7 @@ create index idx4 on worklog5743(a1, a2);
ERROR 42000: Specified key was too long; max key length is 3072 bytes
show warnings;
Level Code Message
-Error 1071 Specified key was too long; max key length is 3072 bytes
+Note 1071 Specified key was too long; max key length is 3072 bytes
Error 1071 Specified key was too long; max key length is 3072 bytes
create index idx5 on worklog5743(a1, a5);
ERROR 42000: Specified key was too long; max key length is 3072 bytes
diff --git a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
index 6cb0b09dee0..a5da38e24db 100644
--- a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
+++ b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
@@ -1221,7 +1221,7 @@ DROP INDEX prefix_idx ON worklog5743;
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE INDEX prefix_idx ON worklog5743(col_1_varbinary (4000));
Warnings:
-Warning 1071 Specified key was too long; max key length is 3072 bytes
+Note 1071 Specified key was too long; max key length is 3072 bytes
SET sql_mode = default;
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000));
SELECT col_1_varbinary = REPEAT("a", 4000) FROM worklog5743;
diff --git a/mysql-test/suite/maria/maria-ucs2.result b/mysql-test/suite/maria/maria-ucs2.result
index 7499b37279b..73c45759373 100644
--- a/mysql-test/suite/maria/maria-ucs2.result
+++ b/mysql-test/suite/maria/maria-ucs2.result
@@ -17,7 +17,7 @@ test.t1 check status OK
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 MODIFY a VARCHAR(800) CHARSET `ucs2`;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -30,7 +30,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(800),KEY(a)) ENGINE=Aria CHARACTER SET ucs2;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
INSERT INTO t1 VALUES (REPEAT('abc ',200));
CHECK TABLE t1;
Table Op Msg_type Msg_text
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index 35ec098f7a8..1e85ee8b50c 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -1585,7 +1585,7 @@ a b
drop table t1;
create table t1 (v varchar(65530), key(v));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
drop table if exists t1;
set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
create table t1 (v varchar(65536));
@@ -1855,7 +1855,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a));
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1865,7 +1865,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1875,7 +1875,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1921,7 +1921,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1933,7 +1933,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1963,7 +1963,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index e923039a07f..6005bedf7bb 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result
index 06be64566e5..5f9fcb4f937 100644
--- a/mysql-test/suite/maria/mrr.result
+++ b/mysql-test/suite/maria/mrr.result
@@ -393,7 +393,7 @@ PRIMARY KEY (pk),
KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
) ENGINE=Aria;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
INSERT INTO t1 VALUES
(1,'z'), (2,'abcdefjhjkl'), (3,'in'), (4,'abcdefjhjkl'), (6,'abcdefjhjkl'),
(11,'zx'), (12,'abcdefjhjm'), (13,'jn'), (14,'abcdefjhjp'), (16,'abcdefjhjr');
@@ -430,7 +430,7 @@ f5 varchar(1024) COLLATE latin1_bin,
KEY (f5)
) ENGINE=Aria TRANSACTIONAL=0 ;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
# Fill the table with some data
SELECT alias2.* , alias1.f2
FROM
diff --git a/mysql-test/suite/mariabackup/error_during_copyback.result b/mysql-test/suite/mariabackup/error_during_copyback.result
new file mode 100644
index 00000000000..9b12c1135d2
--- /dev/null
+++ b/mysql-test/suite/mariabackup/error_during_copyback.result
@@ -0,0 +1,9 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+# xtrabackup backup
+# xtrabackup prepare
+# restart server
+SELECT * FROM t;
+i
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/error_during_copyback.test b/mysql-test/suite/mariabackup/error_during_copyback.test
new file mode 100644
index 00000000000..3ec9fbfc3c3
--- /dev/null
+++ b/mysql-test/suite/mariabackup/error_during_copyback.test
@@ -0,0 +1,25 @@
+--source include/have_debug.inc
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+--enable_result_log
+echo # xtrabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+let $_datadir= `SELECT @@datadir`;
+--source include/shutdown_mysqld.inc
+rmdir $_datadir;
+error 1;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --dbug=+d,copy_file_error;
+list_files $_datadir;
+rmdir $_datadir;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir;
+echo # restart server;
+--source include/start_mysqld.inc
+SELECT * FROM t;
+DROP TABLE t;
+rmdir $targetdir;
+
diff --git a/mysql-test/suite/mariabackup/include/corrupt-page.pl b/mysql-test/suite/mariabackup/include/corrupt-page.pl
new file mode 100644
index 00000000000..d5c75dbde55
--- /dev/null
+++ b/mysql-test/suite/mariabackup/include/corrupt-page.pl
@@ -0,0 +1,146 @@
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
+
+sub corrupt_space_page_id {
+ my $file_name = shift;
+ my @pages_to_corrupt = @_;
+
+ my $page_size = $ENV{INNODB_PAGE_SIZE};
+
+ sysopen my $ibd_file, $file_name, O_RDWR || die "Cannot open $file_name\n";
+ sysread($ibd_file, $_, 38) || die "Cannot read $file_name\n";
+ my $space = unpack("x[34]N", $_);
+ foreach my $page_no (@pages_to_corrupt) {
+ $space += 10; # generate wrong space id
+ sysseek($ibd_file, $page_size * $page_no, SEEK_SET)
+ || die "Cannot seek $file_name\n";
+
+ my $head = pack("Nx[18]", $page_no + 10); # generate wrong page number
+ my $body = chr(0) x ($page_size - 38 - 8);
+
+ # Calculate innodb_checksum_algorithm=crc32 for the unencrypted page.
+ # The following bytes are excluded:
+ # bytes 0..3 (the checksum is stored there)
+ # bytes 26..37 (encryption key version, post-encryption checksum, tablespace id)
+ # bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN)
+ my $polynomial = 0x82f63b78; # CRC-32C
+ my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
+
+ my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck);
+ die unless syswrite($ibd_file, $page, $page_size) == $page_size;
+ }
+ close $ibd_file;
+}
+
+sub extend_space {
+ my $file_name = shift;
+ my $n_pages = shift;
+
+ my $page_size = $ENV{INNODB_PAGE_SIZE};
+ my $page;
+
+ sysopen my $ibd_file, $file_name, O_RDWR || die "Cannot open $file_name\n";
+ sysread($ibd_file, $page, $page_size)
+ || die "Cannot read $file_name\n";
+ my $size = unpack("N", substr($page, 46, 4));
+ my $packed_new_size = pack("N", $size + $n_pages);
+ substr($page, 46, 4, $packed_new_size);
+
+ my $head = substr($page, 4, 22);
+ my $body = substr($page, 38, $page_size - 38 - 8);
+ my $polynomial = 0x82f63b78; # CRC-32C
+ my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
+ my $packed_ck = pack("N", $ck);
+ substr($page, 0, 4, $packed_ck);
+ substr($page, $page_size - 8, 4, $packed_ck);
+
+ sysseek($ibd_file, 0, SEEK_SET)
+ || die "Cannot seek $file_name\n";
+ die unless syswrite($ibd_file, $page, $page_size) == $page_size;
+
+ sysseek($ibd_file, 0, SEEK_END)
+ || die "Cannot seek $file_name\n";
+ my $pages_size = $page_size*$n_pages;
+ my $pages = chr(0) x $pages_size;
+ die unless syswrite($ibd_file, $pages, $pages_size) == $pages_size;
+ close $ibd_file;
+ return $size;
+}
+
+sub die_if_page_is_not_zero {
+ my $file_name = shift;
+ my @pages_to_check = @_;
+
+ no locale;
+ my $page_size = $ENV{INNODB_PAGE_SIZE};
+ my $zero_page = chr(0) x $page_size;
+ sysopen my $ibd_file, $file_name, O_RDWR || die "Cannot open $file_name\n";
+ foreach my $page_no_to_check (@pages_to_check) {
+ sysseek($ibd_file, $page_size*$page_no_to_check, SEEK_SET) ||
+ die "Cannot seek $file_name\n";
+ sysread($ibd_file, my $read_page, $page_size) ||
+ die "Cannot read $file_name\n";
+ die "The page $page_no_to_check is not zero-filed in $file_name"
+ if ($read_page cmp $zero_page);
+ }
+ close $ibd_file;
+}
+
+sub print_corrupted_pages_file {
+ my $file_in = shift;
+ my $file_out = shift;
+ open my $fh, '<', $file_in || die $!;
+ my $line_number = 0;
+ my $space = {};
+ my @spaces;
+ while (my $line = <$fh>) {
+ ++$line_number;
+ if ($line_number & 1) {
+ my ($name, $id) = split(/ /, $line);
+ $space->{name} = $name;
+ }
+ else {
+ $space->{pages} = $line;
+ push (@spaces, $space);
+ $space = {};
+ }
+ }
+ close $fh;
+ my @sorted_spaces = sort { $a->{name} cmp $b->{name} } @spaces;
+ open $fh, '>', $file_out || die $!;
+ foreach my $space (@sorted_spaces) {
+ print $fh $space->{name};
+ print $fh "\n";
+ print $fh $space->{pages};
+ }
+ close $fh;
+}
+
+sub append_corrupted_pages {
+ my $file_name = shift;
+ my $space_name = shift;
+ my $pages = shift;
+ open my $fh, '<', $file_name || die $!;
+ my $line_number = 0;
+ my $space_line;
+ while (my $line = <$fh>) {
+ ++$line_number;
+ if ($line_number & 1) {
+ my ($name, $id) = split(/ /, $line);
+ if ($name eq $space_name) {
+ $space_line = $line;
+ last;
+ }
+ }
+ }
+ close $fh;
+ if (not defined $space_line) {
+ die "Can't find requested space $space_name in file $file_name";
+ }
+ open $fh, '>>', $file_name || die $!;
+ print $fh $space_line;
+ print $fh "$pages\n";
+ close $fh;
+}
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
index 49e952eefea..1ee6038f072 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
@@ -22,7 +22,7 @@ INSERT into t1 values(1);
--let after_copy_test_t2=DROP TABLE test.t2
--let after_copy_test_t3=CREATE INDEX a_i ON test.t3(i);
--let before_copy_test_t10=DROP TABLE test.t10
---let wait_innodb_redo_before_copy=test/t10
+--let wait_innodb_redo_before_copy_test_t10 = 1
# mariabackup should crash with assertion if MDEV-24026 is not fixed
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code;
diff --git a/mysql-test/suite/mariabackup/innodb_force_recovery.result b/mysql-test/suite/mariabackup/innodb_force_recovery.result
new file mode 100644
index 00000000000..94a265cfabe
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_force_recovery.result
@@ -0,0 +1,26 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+# "innodb_force_recovery=1" should be allowed with "--prepare" only (mariabackup)
+FOUND 1 /should only be used with "--prepare"/ in backup.log
+# "innodb_force_recovery=1" should be allowed with "--apply-log" only (innobackupex)
+FOUND 1 /should only be used with "--apply-log"/ in backup.log
+# "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (mariabackup)
+FOUND 1 /innodb_force_recovery = 1/ in backup.log
+# "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (innobackupex)
+FOUND 1 /innodb_force_recovery = 1/ in backup.log
+# "innodb_force_recovery" should be read from "backup-my.cnf" (mariabackup)
+FOUND 1 /innodb_force_recovery = 1/ in backup.log
+# "innodb_force_recovery=1" should be read from "backup-my.cnf" (innobackupex)
+FOUND 1 /innodb_force_recovery = 1/ in backup.log
+# "innodb_force_recovery" from the command line should override "backup-my.cnf" (mariabackup)
+NOT FOUND /innodb_force_recovery = 1/ in backup.log
+# "innodb_force_recovery" from the command line should override "backup-my.cnf" (innobackupex)
+NOT FOUND /innodb_force_recovery = 1/ in backup.log
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+SELECT * FROM t;
+i
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/innodb_force_recovery.test b/mysql-test/suite/mariabackup/innodb_force_recovery.test
new file mode 100644
index 00000000000..3a7b3c6106c
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_force_recovery.test
@@ -0,0 +1,138 @@
+# This test checks if "innodb_force_recovery" is only allowed with "--prepare"
+# (for mariabackup) and "--apply-log" (for innobackupex), and is limited to
+# "SRV_FORCE_IGNORE_CORRUPT" only.
+
+# Setup.
+--source include/have_innodb.inc
+
+--let targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--let backuplog=$MYSQLTEST_VARDIR/tmp/backup.log
+
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+
+# Check for command line arguments.
+--echo # "innodb_force_recovery=1" should be allowed with "--prepare" only (mariabackup)
+--disable_result_log
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --innodb-force-recovery=1 --target-dir=$targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=should only be used with "--prepare"
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--echo # "innodb_force_recovery=1" should be allowed with "--apply-log" only (innobackupex)
+--disable_result_log
+--error 1
+exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp --innodb-force-recovery=1 $targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=should only be used with "--apply-log"
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+--enable_result_log
+--echo # "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (mariabackup)
+--disable_result_log
+exec $XTRABACKUP --prepare --innodb-force-recovery=2 --target-dir=$targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=innodb_force_recovery = 1
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+rmdir $targetdir;
+
+--disable_result_log
+exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir;
+--enable_result_log
+--echo # "innodb_force_recovery" should be limited to "SRV_FORCE_IGNORE_CORRUPT" (innobackupex)
+--disable_result_log
+exec $XTRABACKUP --innobackupex --apply-log --innodb-force-recovery=2 $targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=innodb_force_recovery = 1
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+rmdir $targetdir;
+
+# Check for default file ("backup-my.cnf").
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+--enable_result_log
+perl;
+my $cfg_path="$ENV{'targetdir'}/backup-my.cnf";
+open(my $fd, '>>', "$cfg_path");
+print $fd "innodb_force_recovery=1\n";
+close $fd;
+EOF
+--echo # "innodb_force_recovery" should be read from "backup-my.cnf" (mariabackup)
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$targetdir/backup-my.cnf --prepare --export --target-dir=$targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=innodb_force_recovery = 1
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+rmdir $targetdir;
+
+--disable_result_log
+exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir;
+--enable_result_log
+perl;
+my $cfg_path="$ENV{'targetdir'}/backup-my.cnf";
+open(my $fd, '>>', "$cfg_path");
+print $fd "innodb_force_recovery=2\n";
+close $fd;
+EOF
+--echo # "innodb_force_recovery=1" should be read from "backup-my.cnf" (innobackupex)
+--disable_result_log
+exec $XTRABACKUP --innobackupex --defaults-file=$targetdir/backup-my.cnf --apply-log --export $targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=innodb_force_recovery = 1
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+rmdir $targetdir;
+
+# Check for command line argument precedence.
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+--enable_result_log
+perl;
+my $cfg_path="$ENV{'targetdir'}/backup-my.cnf";
+open(my $fd, '>>', "$cfg_path");
+print $fd "innodb_force_recovery=1\n";
+close $fd;
+EOF
+--echo # "innodb_force_recovery" from the command line should override "backup-my.cnf" (mariabackup)
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$targetdir/backup-my.cnf --prepare --innodb-force-recovery=0 --target-dir=$targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=innodb_force_recovery = 1
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+rmdir $targetdir;
+
+--disable_result_log
+exec $XTRABACKUP --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp $targetdir;
+--enable_result_log
+perl;
+my $cfg_path="$ENV{'targetdir'}/backup-my.cnf";
+open(my $fd, '>>', "$cfg_path");
+print $fd "innodb_force_recovery=2\n";
+close $fd;
+EOF
+--echo # "innodb_force_recovery" from the command line should override "backup-my.cnf" (innobackupex)
+--disable_result_log
+exec $XTRABACKUP --innobackupex --defaults-file=$targetdir/backup-my.cnf --apply-log --innodb-force-recovery=0 --export $targetdir >$backuplog;
+--enable_result_log
+--let SEARCH_PATTERN=innodb_force_recovery = 1
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--source include/restart_and_restore.inc
+
+# Check for restore.
+SELECT * FROM t;
+
+# Clean-up.
+DROP TABLE t;
+--rmdir $targetdir
+--remove_file $backuplog
diff --git a/mysql-test/suite/mariabackup/log_page_corruption.opt b/mysql-test/suite/mariabackup/log_page_corruption.opt
new file mode 100644
index 00000000000..c44c611ed60
--- /dev/null
+++ b/mysql-test/suite/mariabackup/log_page_corruption.opt
@@ -0,0 +1 @@
+--innodb-checksum-algorithm=crc32
diff --git a/mysql-test/suite/mariabackup/log_page_corruption.result b/mysql-test/suite/mariabackup/log_page_corruption.result
new file mode 100644
index 00000000000..01ad4422c6a
--- /dev/null
+++ b/mysql-test/suite/mariabackup/log_page_corruption.result
@@ -0,0 +1,142 @@
+########
+# Test for generating "innodb_corrupted_pages" file during full and
+# incremental backup, including DDL processing
+###
+
+CREATE TABLE t1_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t2_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t3(c INT) ENGINE INNODB;
+CREATE TABLE t5_corrupted_to_rename(c INT) ENGINE INNODB;
+CREATE TABLE t6_corrupted_to_drop(c INT) ENGINE INNODB;
+CREATE TABLE t7_corrupted_to_alter(c INT) ENGINE INNODB;
+CREATE TABLE t1_inc_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t2_inc_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t3_inc(c INT) ENGINE INNODB;
+CREATE TABLE t5_inc_corrupted_to_rename(c INT) ENGINE INNODB;
+CREATE TABLE t6_inc_corrupted_to_drop(c INT) ENGINE INNODB;
+CREATE TABLE t7_inc_corrupted_to_alter(c INT) ENGINE INNODB;
+INSERT INTO t1_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t2_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t3 VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t5_corrupted_to_rename VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t6_corrupted_to_drop VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t7_corrupted_to_alter VALUES (3), (4), (5), (6), (7), (8), (9);
+# Corrupt tables
+# Backup must fail due to page corruption
+FOUND 1 /Database page corruption detected.*/ in backup.log
+# "innodb_corrupted_pages" file must not exist
+# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option
+FOUND 1 /Database page corruption detected.*/ in backup.log
+FOUND 1 /completed OK!/ in backup.log
+--- "innodb_corrupted_pages" file content: ---
+test/t1_corrupted
+6 8 9
+test/t2_corrupted
+7 8 10
+test/t4_corrupted_new
+1
+test/t5_corrupted_to_rename_renamed
+6
+test/t7_corrupted_to_alter
+3
+------
+INSERT INTO t1_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t2_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9);
+# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option
+--- "innodb_corrupted_pages" file content: ---
+test/t1_corrupted
+6 8 9
+test/t1_inc_corrupted
+6 8 9
+test/t2_corrupted
+7 8 10
+test/t2_inc_corrupted
+7 8 10
+test/t4_inc_corrupted_new
+1
+test/t5_corrupted_to_rename_renamed
+6
+test/t5_inc_corrupted_to_rename_renamed
+6
+test/t7_inc_corrupted_to_alter
+3
+------
+# Check if corrupted pages were copied to delta files, and non-corrupted pages are not copied.
+DROP TABLE t1_corrupted;
+DROP TABLE t2_corrupted;
+DROP TABLE t4_corrupted_new;
+DROP TABLE t5_corrupted_to_rename_renamed;
+DROP TABLE t7_corrupted_to_alter;
+DROP TABLE t1_inc_corrupted;
+DROP TABLE t2_inc_corrupted;
+DROP TABLE t4_inc_corrupted_new;
+DROP TABLE t5_inc_corrupted_to_rename_renamed;
+DROP TABLE t7_inc_corrupted_to_alter;
+
+########
+# Test for --prepare with "innodb_corrupted_pages" file
+###
+
+# Extend some tablespace and corrupt extended pages for full backup
+# Full backup with --log-innodb-page-corruption
+--- "innodb_corrupted_pages" file content: ---
+test/t3
+6 8
+------
+# Extend some tablespace and corrupt extended pages for incremental backup
+# Incremental backup --log-innodb-page-corruption
+--- "innodb_corrupted_pages" file content: ---
+test/t3
+6 8
+test/t3_inc
+6 8
+------
+# Full backup prepare
+# "innodb_corrupted_pages" file must not exist after successful prepare
+FOUND 1 /was successfuly fixed.*/ in backup.log
+# Check that fixed pages are zero-filled
+# Incremental backup prepare
+# "innodb_corrupted_pages" file must not exist after successful prepare
+# do not remove "innodb_corrupted_pages" in incremental dir
+FOUND 1 /was successfuly fixed.*/ in backup.log
+# Check that fixed pages are zero-filled
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+SELECT * FROM t3;
+c
+3
+4
+5
+6
+7
+8
+9
+SELECT * FROM t3_inc;
+c
+3
+4
+5
+6
+7
+8
+9
+# Test the case when not all corrupted pages are fixed
+
+# Add some fake corrupted pages
+# Full backup prepare
+FOUND 1 /Error: corrupted page.*/ in backup.log
+--- "innodb_corrupted_pages" file content: ---
+test/t3
+3
+------
+# Incremental backup prepare
+FOUND 1 /Error: corrupted page.*/ in backup.log
+--- "innodb_corrupted_pages" file content: ---
+test/t3
+3
+------
+DROP TABLE t3;
+DROP TABLE t3_inc;
diff --git a/mysql-test/suite/mariabackup/log_page_corruption.test b/mysql-test/suite/mariabackup/log_page_corruption.test
new file mode 100644
index 00000000000..0151afb96b4
--- /dev/null
+++ b/mysql-test/suite/mariabackup/log_page_corruption.test
@@ -0,0 +1,430 @@
+--source include/have_debug.inc
+
+--echo ########
+--echo # Test for generating "innodb_corrupted_pages" file during full and
+--echo # incremental backup, including DDL processing
+--echo ###
+--echo
+
+CREATE TABLE t1_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t2_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t3(c INT) ENGINE INNODB;
+CREATE TABLE t5_corrupted_to_rename(c INT) ENGINE INNODB;
+CREATE TABLE t6_corrupted_to_drop(c INT) ENGINE INNODB;
+CREATE TABLE t7_corrupted_to_alter(c INT) ENGINE INNODB;
+
+CREATE TABLE t1_inc_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t2_inc_corrupted(c INT) ENGINE INNODB;
+CREATE TABLE t3_inc(c INT) ENGINE INNODB;
+CREATE TABLE t5_inc_corrupted_to_rename(c INT) ENGINE INNODB;
+CREATE TABLE t6_inc_corrupted_to_drop(c INT) ENGINE INNODB;
+CREATE TABLE t7_inc_corrupted_to_alter(c INT) ENGINE INNODB;
+
+# Fill tables with several pages
+INSERT INTO t1_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t2_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t3 VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t5_corrupted_to_rename VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t6_corrupted_to_drop VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t7_corrupted_to_alter VALUES (3), (4), (5), (6), (7), (8), (9);
+
+--let MYSQLD_DATADIR=`select @@datadir`
+--let INNODB_PAGE_SIZE=`select @@innodb_page_size`
+
+--source include/shutdown_mysqld.inc
+--echo # Corrupt tables
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+my $schema = "$ENV{MYSQLD_DATADIR}/test";
+
+my $last_page_no = extend_space("$schema/t1_corrupted.ibd", 4);
+corrupt_space_page_id("$schema/t1_corrupted.ibd",
+ $last_page_no, $last_page_no + 2, $last_page_no + 3);
+
+$last_page_no = extend_space("$schema/t2_corrupted.ibd", 5);
+corrupt_space_page_id("$schema/t2_corrupted.ibd",
+ $last_page_no + 1, $last_page_no + 2, $last_page_no + 4);
+
+$last_page_no = extend_space("$schema/t5_corrupted_to_rename.ibd", 1);
+corrupt_space_page_id("$schema/t5_corrupted_to_rename.ibd", $last_page_no);
+
+$last_page_no = extend_space("$schema/t6_corrupted_to_drop.ibd", );
+corrupt_space_page_id("$schema/t6_corrupted_to_drop.ibd", $last_page_no);
+EOF
+--source include/start_mysqld.inc
+
+--let targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log
+--let corrupted_pages_file = $targetdir/innodb_corrupted_pages
+--let corrupted_pages_file_filt = $MYSQLTEST_VARDIR/tmp/innodb_corrupted_pages_filt
+--let perl_result_file=$MYSQLTEST_VARDIR/tmp/perl_result
+
+--echo # Backup must fail due to page corruption
+--disable_result_log
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+--let SEARCH_PATTERN=Database page corruption detected.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--echo # "innodb_corrupted_pages" file must not exist
+--error 1
+--file_exists $corrupted_pages_file
+--rmdir $targetdir
+
+--let after_load_tablespaces=CREATE TABLE test.t4_corrupted_new ENGINE=INNODB SELECT UUID() from test.seq_1_to_10
+--let add_corrupted_page_for_test_t4_corrupted_new=1
+--let after_copy_test_t5_corrupted_to_rename=RENAME TABLE test.t5_corrupted_to_rename TO test.t5_corrupted_to_rename_renamed
+--let after_copy_test_t6_corrupted_to_drop=DROP TABLE test.t6_corrupted_to_drop
+--let after_copy_test_t7_corrupted_to_alter=ALTER TABLE test.t7_corrupted_to_alter ADD COLUMN (d INT)
+--let add_corrupted_page_for_test_t7_corrupted_to_alter=3
+
+--echo # Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$targetdir --dbug=+d,mariabackup_events,mariabackup_inject_code > $backuplog
+--enable_result_log
+
+--let SEARCH_PATTERN=Database page corruption detected.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--let SEARCH_PATTERN=completed OK!
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--echo --- "innodb_corrupted_pages" file content: ---
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+print_corrupted_pages_file($ENV{corrupted_pages_file},
+ $ENV{corrupted_pages_file_filt});
+EOF
+--cat_file $corrupted_pages_file_filt
+--echo ------
+--let after_load_tablespaces=
+--let add_corrupted_page_for_test_t4_corrupted_new=
+--let after_copy_test_t5_corrupted_to_rename=
+--let after_copy_test_t6_corrupted_to_drop=
+--let after_copy_test_t7_corrupted_to_alter=
+--let add_corrupted_page_for_test_t7_corrupted_to_alter=
+# Fill tables for incremental backup with several pages
+INSERT INTO t1_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t2_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
+INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9);
+
+--source include/shutdown_mysqld.inc
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+my $schema="$ENV{MYSQLD_DATADIR}/test";
+
+open(my $fh, '>', $ENV{perl_result_file}) or die $!;
+
+my $last_page_no = extend_space("$schema/t1_inc_corrupted.ibd", 4);
+corrupt_space_page_id("$schema/t1_inc_corrupted.ibd",
+ $last_page_no, $last_page_no + 2, $last_page_no + 3);
+print $fh "$last_page_no\n";
+
+$last_page_no = extend_space("$schema/t2_inc_corrupted.ibd", 5);
+corrupt_space_page_id("$schema/t2_inc_corrupted.ibd",
+ $last_page_no + 1, $last_page_no + 2, $last_page_no + 4);
+print $fh "$last_page_no\n";
+
+$last_page_no = extend_space("$schema/t5_inc_corrupted_to_rename.ibd", 1);
+corrupt_space_page_id("$schema/t5_inc_corrupted_to_rename.ibd", $last_page_no);
+print $fh "$last_page_no\n";
+
+$last_page_no = extend_space("$schema/t6_inc_corrupted_to_drop.ibd", );
+corrupt_space_page_id("$schema/t6_inc_corrupted_to_drop.ibd", $last_page_no);
+
+close $fh;
+EOF
+--source include/start_mysqld.inc
+
+--let incdir=$MYSQLTEST_VARDIR/tmp/backup_inc
+
+--let after_load_tablespaces=CREATE TABLE test.t4_inc_corrupted_new ENGINE=INNODB SELECT UUID() from test.seq_1_to_10
+--let add_corrupted_page_for_test_t4_inc_corrupted_new=1
+--let after_copy_test_t5_inc_corrupted_to_rename=RENAME TABLE test.t5_inc_corrupted_to_rename TO test.t5_inc_corrupted_to_rename_renamed
+--let after_copy_test_t6_inc_corrupted_to_drop=DROP TABLE test.t6_inc_corrupted_to_drop
+--let after_copy_test_t7_inc_corrupted_to_alter=ALTER TABLE test.t7_inc_corrupted_to_alter ADD COLUMN (d INT)
+--let add_corrupted_page_for_test_t7_inc_corrupted_to_alter=3
+
+--echo # Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$incdir --incremental-basedir=$targetdir --dbug=+d,mariabackup_events,mariabackup_inject_code > $backuplog
+--disable_result_log
+
+--let after_load_tablespaces=
+--let add_corrupted_page_for_test_t4_inc_corrupted_new=
+--let after_copy_test_t5_inc_corrupted_to_rename=
+--let after_copy_test_t6_inc_corrupted_to_drop=
+--let after_copy_test_t7_inc_corrupted_to_alter=
+--let add_corrupted_page_for_test_t7_inc_corrupted_to_alter=
+
+--let SEARCH_PATTERN=Database page corruption detected.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=completed OK!
+--source include/search_pattern_in_file.inc
+
+--let corrupted_pages_file = $incdir/innodb_corrupted_pages
+--echo --- "innodb_corrupted_pages" file content: ---
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+print_corrupted_pages_file($ENV{corrupted_pages_file},
+ $ENV{corrupted_pages_file_filt});
+EOF
+--cat_file $corrupted_pages_file_filt
+--echo ------
+
+--echo # Check if corrupted pages were copied to delta files, and non-corrupted pages are not copied.
+perl;
+use strict;
+use warnings;
+my $schema = "$ENV{incdir}/test";
+
+open(my $fh, '<', $ENV{perl_result_file}) or die $!;
+
+my $last_page_no = <$fh>;
+die_if_no_pages("$schema/t1_corrupted.ibd.delta",
+ $last_page_no, $last_page_no + 2, $last_page_no + 3);
+
+$last_page_no = <$fh>;
+die_if_no_pages("$schema/t2_corrupted.ibd.delta",
+ $last_page_no + 1, $last_page_no + 2, $last_page_no + 4);
+
+$last_page_no = <$fh>;
+die_if_no_pages("$schema/t5_corrupted_to_rename_renamed.ibd.delta",
+ $last_page_no);
+
+close $fh;
+
+die_if_not_empty("$schema/t3.ibd.delta");
+
+sub read_first_page_from_delta {
+ my $file_name = shift;
+ my $pages_count = shift;
+
+ open my $file, '<:raw', $file_name || die "Cannot open $file_name\n";
+ read $file, my $buffer, $pages_count*4 || die "Cannot read $file_name\n";
+ close $file;
+
+ return unpack("N[$pages_count]", $buffer);
+}
+
+sub die_if_no_pages {
+ my $file_name = shift;
+ my @check_pages = @_;
+ my @read_pages =
+ read_first_page_from_delta($file_name, scalar(@check_pages) + 1);
+ for (my $i = 1; $i < @check_pages + 1; ++$i) {
+ my $check_page_no = $check_pages[$i - 1];
+ die "Corrupted page $check_page_no was not copied to $file_name."
+ if ($i >= @read_pages || $read_pages[$i] != $check_page_no);
+ }
+}
+
+sub die_if_not_empty {
+ my $file_name = shift;
+ my ($magic, $full) = read_first_page_from_delta($file_name, 2);
+ die "Delta $file_name must be empty."
+ if ($full != 0xFFFFFFFF);
+}
+EOF
+--rmdir $incdir
+--rmdir $targetdir
+
+DROP TABLE t1_corrupted;
+DROP TABLE t2_corrupted;
+DROP TABLE t4_corrupted_new;
+DROP TABLE t5_corrupted_to_rename_renamed;
+DROP TABLE t7_corrupted_to_alter;
+DROP TABLE t1_inc_corrupted;
+DROP TABLE t2_inc_corrupted;
+DROP TABLE t4_inc_corrupted_new;
+DROP TABLE t5_inc_corrupted_to_rename_renamed;
+DROP TABLE t7_inc_corrupted_to_alter;
+
+--echo
+--echo ########
+--echo # Test for --prepare with "innodb_corrupted_pages" file
+--echo ###
+--echo
+
+--echo # Extend some tablespace and corrupt extended pages for full backup
+--source include/shutdown_mysqld.inc
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+my $schema="$ENV{MYSQLD_DATADIR}/test";
+my $last_page_no = extend_space("$schema/t3.ibd", 3);
+corrupt_space_page_id("$schema/t3.ibd", $last_page_no, $last_page_no + 2);
+open(my $fh, '>', $ENV{perl_result_file}) or die $!;
+print $fh "$last_page_no\n";
+close $fh;
+EOF
+--source include/start_mysqld.inc
+
+--echo # Full backup with --log-innodb-page-corruption
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$targetdir
+--enable_result_log
+--let corrupted_pages_file = $targetdir/innodb_corrupted_pages
+--echo --- "innodb_corrupted_pages" file content: ---
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+print_corrupted_pages_file($ENV{corrupted_pages_file},
+ $ENV{corrupted_pages_file_filt});
+EOF
+--cat_file $corrupted_pages_file_filt
+--echo ------
+
+--echo # Extend some tablespace and corrupt extended pages for incremental backup
+--source include/shutdown_mysqld.inc
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+my $schema="$ENV{MYSQLD_DATADIR}/test";
+my $last_page_no = extend_space("$schema/t3_inc.ibd", 3);
+corrupt_space_page_id("$schema/t3_inc.ibd", $last_page_no, $last_page_no + 2);
+open(my $fh, '>>', $ENV{perl_result_file}) or die $!;
+print $fh "$last_page_no";
+close $fh;
+EOF
+--source include/start_mysqld.inc
+
+--echo # Incremental backup --log-innodb-page-corruption
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --log-innodb-page-corruption --target-dir=$incdir --incremental-basedir=$targetdir --dbug=+d,mariabackup_events,mariabackup_inject_code > $backuplog
+--disable_result_log
+--let corrupted_pages_file = $incdir/innodb_corrupted_pages
+--echo --- "innodb_corrupted_pages" file content: ---
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+print_corrupted_pages_file($ENV{corrupted_pages_file},
+ $ENV{corrupted_pages_file_filt});
+EOF
+--cat_file $corrupted_pages_file_filt
+--echo ------
+
+--let targetdir2=$targetdir-2
+--let incdir2=$incdir-2
+perl;
+use lib "lib";
+use My::Handles { suppress_init_messages => 1 };
+use My::File::Path;
+copytree($ENV{'targetdir'}, $ENV{'targetdir2'});
+copytree($ENV{'incdir'}, $ENV{'incdir2'});
+EOF
+
+--echo # Full backup prepare
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+--echo # "innodb_corrupted_pages" file must not exist after successful prepare
+--error 1
+--file_exists $targetdir/innodb_corrupted_pages
+--let SEARCH_PATTERN=was successfuly fixed.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--echo # Check that fixed pages are zero-filled
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+open(my $fh, '<', $ENV{perl_result_file}) or die $!;
+my $last_page_no = <$fh>;
+close $fh;
+my $schema = "$ENV{targetdir}/test";
+die_if_page_is_not_zero("$schema/t3.ibd", $last_page_no, $last_page_no + 2);
+EOF
+
+--echo # Incremental backup prepare
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir --incremental-dir=$incdir > $backuplog;
+--enable_result_log
+
+--echo # "innodb_corrupted_pages" file must not exist after successful prepare
+--error 1
+--file_exists $targetdir/innodb_corrupted_pages
+--echo # do not remove "innodb_corrupted_pages" in incremental dir
+--file_exists $incdir/innodb_corrupted_pages
+--let SEARCH_PATTERN=was successfuly fixed.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+
+--echo # Check that fixed pages are zero-filled
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+open(my $fh, '<', $ENV{perl_result_file}) or die $!;
+my $last_page_no_full = <$fh>;
+my $last_page_no_inc = <$fh>;
+close $fh;
+my $schema = "$ENV{targetdir}/test";
+die_if_page_is_not_zero("$schema/t3.ibd",
+ $last_page_no_full, $last_page_no_full + 2);
+die_if_page_is_not_zero("$schema/t3_inc.ibd",
+ $last_page_no_inc, $last_page_no_inc + 2);
+EOF
+
+--source include/restart_and_restore.inc
+
+SELECT * FROM t3;
+SELECT * FROM t3_inc;
+
+--echo # Test the case when not all corrupted pages are fixed
+--echo
+--echo # Add some fake corrupted pages
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+append_corrupted_pages(
+ "$ENV{targetdir2}/innodb_corrupted_pages", 'test/t3', '3 4');
+append_corrupted_pages(
+ "$ENV{incdir2}/innodb_corrupted_pages", 'test/t3_inc', '4 5');
+EOF
+
+--echo # Full backup prepare
+--disable_result_log
+--error 1
+exec $XTRABACKUP --prepare --target-dir=$targetdir2 > $backuplog;
+--enable_result_log
+
+--let SEARCH_PATTERN=Error: corrupted page.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--let corrupted_pages_file = $targetdir2/innodb_corrupted_pages
+--echo --- "innodb_corrupted_pages" file content: ---
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+print_corrupted_pages_file($ENV{corrupted_pages_file},
+ $ENV{corrupted_pages_file_filt});
+EOF
+--cat_file $corrupted_pages_file_filt
+--echo ------
+
+--echo # Incremental backup prepare
+--disable_result_log
+--error 1
+exec $XTRABACKUP --prepare --target-dir=$targetdir2 --incremental-dir=$incdir2 > $backuplog;
+--enable_result_log
+
+--let SEARCH_PATTERN=Error: corrupted page.*
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--let corrupted_pages_file = $targetdir2/innodb_corrupted_pages
+--echo --- "innodb_corrupted_pages" file content: ---
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/corrupt-page.pl";
+print_corrupted_pages_file($ENV{corrupted_pages_file},
+ $ENV{corrupted_pages_file_filt});
+EOF
+--cat_file $corrupted_pages_file_filt
+--echo ------
+
+DROP TABLE t3;
+DROP TABLE t3_inc;
+--remove_file $backuplog
+--remove_file $perl_result_file
+--remove_file $corrupted_pages_file_filt
+--rmdir $targetdir
+--rmdir $targetdir2
+--rmdir $incdir
+--rmdir $incdir2
diff --git a/mysql-test/suite/perfschema/r/schema.result b/mysql-test/suite/perfschema/r/schema.result
index 1f331394df6..8ce4cad4f4b 100644
--- a/mysql-test/suite/perfschema/r/schema.result
+++ b/mysql-test/suite/perfschema/r/schema.result
@@ -62,7 +62,7 @@ users
show create table accounts;
Table Create Table
accounts CREATE TABLE `accounts` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`CURRENT_CONNECTIONS` bigint(20) NOT NULL,
`TOTAL_CONNECTIONS` bigint(20) NOT NULL
@@ -140,7 +140,7 @@ events_stages_summary_by_thread_by_event_name CREATE TABLE `events_stages_summar
show create table events_stages_summary_by_user_by_event_name;
Table Create Table
events_stages_summary_by_user_by_event_name CREATE TABLE `events_stages_summary_by_user_by_event_name` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -151,7 +151,7 @@ events_stages_summary_by_user_by_event_name CREATE TABLE `events_stages_summary_
show create table events_stages_summary_by_account_by_event_name;
Table Create Table
events_stages_summary_by_account_by_event_name CREATE TABLE `events_stages_summary_by_account_by_event_name` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
@@ -398,7 +398,7 @@ events_statements_summary_by_thread_by_event_name CREATE TABLE `events_statement
show create table events_statements_summary_by_user_by_event_name;
Table Create Table
events_statements_summary_by_user_by_event_name CREATE TABLE `events_statements_summary_by_user_by_event_name` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -428,7 +428,7 @@ events_statements_summary_by_user_by_event_name CREATE TABLE `events_statements_
show create table events_statements_summary_by_account_by_event_name;
Table Create Table
events_statements_summary_by_account_by_event_name CREATE TABLE `events_statements_summary_by_account_by_event_name` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
@@ -590,7 +590,7 @@ events_waits_summary_by_thread_by_event_name CREATE TABLE `events_waits_summary_
show create table events_waits_summary_by_user_by_event_name;
Table Create Table
events_waits_summary_by_user_by_event_name CREATE TABLE `events_waits_summary_by_user_by_event_name` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -601,7 +601,7 @@ events_waits_summary_by_user_by_event_name CREATE TABLE `events_waits_summary_by
show create table events_waits_summary_by_account_by_event_name;
Table Create Table
events_waits_summary_by_account_by_event_name CREATE TABLE `events_waits_summary_by_account_by_event_name` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`EVENT_NAME` varchar(128) NOT NULL,
`COUNT_STAR` bigint(20) unsigned NOT NULL,
@@ -762,8 +762,8 @@ show create table setup_actors;
Table Create Table
setup_actors CREATE TABLE `setup_actors` (
`HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
- `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+ `ROLE` char(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
show create table setup_consumers;
Table Create Table
@@ -1028,7 +1028,7 @@ threads CREATE TABLE `threads` (
`NAME` varchar(128) NOT NULL,
`TYPE` varchar(10) NOT NULL,
`PROCESSLIST_ID` bigint(20) unsigned DEFAULT NULL,
- `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
+ `PROCESSLIST_USER` varchar(128) DEFAULT NULL,
`PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
`PROCESSLIST_DB` varchar(64) DEFAULT NULL,
`PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
@@ -1042,7 +1042,7 @@ threads CREATE TABLE `threads` (
show create table users;
Table Create Table
users CREATE TABLE `users` (
- `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+ `USER` char(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`CURRENT_CONNECTIONS` bigint(20) NOT NULL,
`TOTAL_CONNECTIONS` bigint(20) NOT NULL
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
diff --git a/mysql-test/suite/perfschema/r/table_schema.result b/mysql-test/suite/perfschema/r/table_schema.result
index 5c4cf88e9a5..a9beee31f28 100644
--- a/mysql-test/suite/perfschema/r/table_schema.result
+++ b/mysql-test/suite/perfschema/r/table_schema.result
@@ -1,7 +1,7 @@
select * from information_schema.columns where table_schema="performance_schema"
order by table_name, ordinal_position;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
-def performance_schema accounts USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema accounts USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema accounts HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
def performance_schema accounts CURRENT_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL
def performance_schema accounts TOTAL_CONNECTIONS 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL
@@ -37,7 +37,7 @@ def performance_schema events_stages_history_long TIMER_END 7 NULL YES bigint NU
def performance_schema events_stages_history_long TIMER_WAIT 8 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_stages_history_long NESTING_EVENT_ID 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_stages_history_long NESTING_EVENT_TYPE 10 NULL YES enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references NEVER NULL
-def performance_schema events_stages_summary_by_account_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema events_stages_summary_by_account_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_account_by_event_name HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_account_by_event_name EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_account_by_event_name COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
@@ -59,7 +59,7 @@ def performance_schema events_stages_summary_by_thread_by_event_name SUM_TIMER_W
def performance_schema events_stages_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
-def performance_schema events_stages_summary_by_user_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema events_stages_summary_by_user_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_user_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_user_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_stages_summary_by_user_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
@@ -192,7 +192,7 @@ def performance_schema events_statements_history_long NO_INDEX_USED 37 NULL NO b
def performance_schema events_statements_history_long NO_GOOD_INDEX_USED 38 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_statements_history_long NESTING_EVENT_ID 39 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_statements_history_long NESTING_EVENT_TYPE 40 NULL YES enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('STATEMENT','STAGE','WAIT') select,insert,update,references NEVER NULL
-def performance_schema events_statements_summary_by_account_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema events_statements_summary_by_account_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_account_by_event_name HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_account_by_event_name EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_account_by_event_name COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
@@ -300,7 +300,7 @@ def performance_schema events_statements_summary_by_thread_by_event_name SUM_SOR
def performance_schema events_statements_summary_by_thread_by_event_name SUM_SORT_SCAN 24 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_thread_by_event_name SUM_NO_INDEX_USED 25 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_thread_by_event_name SUM_NO_GOOD_INDEX_USED 26 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
-def performance_schema events_statements_summary_by_user_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema events_statements_summary_by_user_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_user_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_user_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_statements_summary_by_user_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
@@ -408,7 +408,7 @@ def performance_schema events_waits_history_long NESTING_EVENT_TYPE 16 NULL YES
def performance_schema events_waits_history_long OPERATION 17 NULL NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select,insert,update,references NEVER NULL
def performance_schema events_waits_history_long NUMBER_OF_BYTES 18 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL
def performance_schema events_waits_history_long FLAGS 19 NULL YES int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL
-def performance_schema events_waits_summary_by_account_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema events_waits_summary_by_account_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_account_by_event_name HOST 2 NULL YES char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_account_by_event_name EVENT_NAME 3 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_account_by_event_name COUNT_STAR 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
@@ -437,7 +437,7 @@ def performance_schema events_waits_summary_by_thread_by_event_name SUM_TIMER_WA
def performance_schema events_waits_summary_by_thread_by_event_name MIN_TIMER_WAIT 5 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_thread_by_event_name AVG_TIMER_WAIT 6 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_thread_by_event_name MAX_TIMER_WAIT 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
-def performance_schema events_waits_summary_by_user_by_event_name USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema events_waits_summary_by_user_by_event_name USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_user_by_event_name EVENT_NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_user_by_event_name COUNT_STAR 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema events_waits_summary_by_user_by_event_name SUM_TIMER_WAIT 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
@@ -561,8 +561,8 @@ def performance_schema session_connect_attrs ATTR_NAME 2 NULL NO varchar 32 96 N
def performance_schema session_connect_attrs ATTR_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_bin varchar(1024) select,insert,update,references NEVER NULL
def performance_schema session_connect_attrs ORDINAL_POSITION 4 NULL YES int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
def performance_schema setup_actors HOST 1 '%' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
-def performance_schema setup_actors USER 2 '%' NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
-def performance_schema setup_actors ROLE 3 '%' NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema setup_actors USER 2 '%' NO char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
+def performance_schema setup_actors ROLE 3 '%' NO char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema setup_consumers NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NEVER NULL
def performance_schema setup_consumers ENABLED 2 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references NEVER NULL
def performance_schema setup_instruments NAME 1 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
@@ -783,7 +783,7 @@ def performance_schema threads THREAD_ID 1 NULL NO bigint NULL NULL 20 0 NULL NU
def performance_schema threads NAME 2 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema threads TYPE 3 NULL NO varchar 10 30 NULL NULL NULL utf8 utf8_general_ci varchar(10) select,insert,update,references NEVER NULL
def performance_schema threads PROCESSLIST_ID 4 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
-def performance_schema threads PROCESSLIST_USER 5 NULL YES varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select,insert,update,references NEVER NULL
+def performance_schema threads PROCESSLIST_USER 5 NULL YES varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema threads PROCESSLIST_HOST 6 NULL YES varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select,insert,update,references NEVER NULL
def performance_schema threads PROCESSLIST_DB 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NEVER NULL
def performance_schema threads PROCESSLIST_COMMAND 8 NULL YES varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select,insert,update,references NEVER NULL
@@ -793,7 +793,7 @@ def performance_schema threads PROCESSLIST_INFO 11 NULL YES longtext 4294967295
def performance_schema threads PARENT_THREAD_ID 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema threads ROLE 13 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references NEVER NULL
def performance_schema threads INSTRUMENTED 14 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references NEVER NULL
-def performance_schema users USER 1 NULL YES char 16 48 NULL NULL NULL utf8 utf8_bin char(16) select,insert,update,references NEVER NULL
+def performance_schema users USER 1 NULL YES char 128 384 NULL NULL NULL utf8 utf8_bin char(128) select,insert,update,references NEVER NULL
def performance_schema users CURRENT_CONNECTIONS 2 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL
def performance_schema users TOTAL_CONNECTIONS 3 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(20) select,insert,update,references NEVER NULL
select count(*) from information_schema.columns
diff --git a/mysql-test/suite/perfschema/r/threads_mysql.result b/mysql-test/suite/perfschema/r/threads_mysql.result
index 9f9c46fe6a6..169c22fb7a2 100644
--- a/mysql-test/suite/perfschema/r/threads_mysql.result
+++ b/mysql-test/suite/perfschema/r/threads_mysql.result
@@ -17,6 +17,16 @@ processlist_info NULL
unified_parent_thread_id NULL
role NULL
instrumented YES
+name thread/sql/manager
+type BACKGROUND
+processlist_user NULL
+processlist_host NULL
+processlist_db NULL
+processlist_command NULL
+processlist_info NULL
+unified_parent_thread_id unified parent_thread_id
+role NULL
+instrumented YES
name thread/sql/one_connection
type FOREGROUND
processlist_user root
@@ -44,16 +54,6 @@ processlist_info NULL
unified_parent_thread_id unified parent_thread_id
role NULL
instrumented YES
-name thread/sql/slave_background
-type BACKGROUND
-processlist_user NULL
-processlist_host NULL
-processlist_db NULL
-processlist_command NULL
-processlist_info NULL
-unified_parent_thread_id unified parent_thread_id
-role NULL
-instrumented YES
CREATE TEMPORARY TABLE t1 AS
SELECT thread_id FROM performance_schema.threads
WHERE name LIKE 'thread/sql%';
@@ -113,7 +113,7 @@ WHERE t1.name LIKE 'thread/sql%'
ORDER BY parent_thread_name, child_thread_name;
parent_thread_name child_thread_name
thread/sql/event_scheduler thread/sql/event_worker
+thread/sql/main thread/sql/manager
thread/sql/main thread/sql/one_connection
thread/sql/main thread/sql/signal_handler
-thread/sql/main thread/sql/slave_background
thread/sql/one_connection thread/sql/event_scheduler
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 7c287b369b1..b82b38f4f0a 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -118,6 +118,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098');
CREATE USER u3 IDENTIFIED BY '';
+ALTER USER u3 IDENTIFIED BY 'pwd-456';
drop user u1, u2, u3;
set global server_audit_events='query_ddl';
create table t1(id int);
@@ -139,6 +140,10 @@ select 2;
2
2
drop table t1;
+create procedure pr1() insert into test.t1 values ("foo", 42);
+create function fn1(i int) returns int deterministic return i+1;
+drop procedure pr1;
+drop function fn1;
set global server_audit_events='query_ddl,query_dml';
create table t1(id int);
insert into t1 values (1), (2);
@@ -210,6 +215,10 @@ select 2;
2
2
drop table t1;
+create procedure pr1() insert into test.t1 values ("foo", 42);
+create function fn1(i int) returns int deterministic return i+1;
+drop procedure pr1;
+drop function fn1;
set global server_audit_events='table';
set global server_audit_incl_users='user1';
create user user1@localhost;
@@ -227,6 +236,7 @@ set global server_audit_logging= on;
disconnect cn1;
drop user user1@localhost;
set global server_audit_events='';
+set global server_audit_incl_users='root, plug_dest';
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK);
@@ -277,7 +287,7 @@ server_audit_file_path
server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
-server_audit_incl_users root
+server_audit_incl_users root, plug_dest
server_audit_logging ON
server_audit_mode 1
server_audit_output_type file
@@ -381,6 +391,8 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'ALTER USER u3 IDENTIFIED BY \'pwd-456\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
@@ -390,6 +402,10 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create procedure pr1() insert into test.t1 values ("foo", 42)',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create function fn1(i int) returns int deterministic return i+1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop procedure pr1',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop function fn1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
@@ -419,6 +435,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_incl_users=\'root, plug_dest\'',0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
@@ -440,8 +457,9 @@ TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT PROXY ON plug_dest TO plug',0
-TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0
TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,test,,0
+TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0
+TIME,HOSTNAME,plug,localhost,ID,ID,QUERY,test,'select USER(),CURRENT_USER()',0
TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,test,,0
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test
index 397dd554962..eba3e5d6770 100644
--- a/mysql-test/suite/plugins/t/server_audit.test
+++ b/mysql-test/suite/plugins/t/server_audit.test
@@ -95,6 +95,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098');
CREATE USER u3 IDENTIFIED BY '';
+ALTER USER u3 IDENTIFIED BY 'pwd-456';
drop user u1, u2, u3;
set global server_audit_events='query_ddl';
@@ -106,6 +107,11 @@ select 2;
/*! select 2*/;
/*comment*/ select 2;
drop table t1;
+create procedure pr1() insert into test.t1 values ("foo", 42);
+create function fn1(i int) returns int deterministic return i+1;
+drop procedure pr1;
+drop function fn1;
+
set global server_audit_events='query_ddl,query_dml';
create table t1(id int);
insert into t1 values (1), (2);
@@ -145,6 +151,10 @@ insert into t1 values (1), (2);
select * from t1;
select 2;
drop table t1;
+create procedure pr1() insert into test.t1 values ("foo", 42);
+create function fn1(i int) returns int deterministic return i+1;
+drop procedure pr1;
+drop function fn1;
set global server_audit_events='table';
set global server_audit_incl_users='user1';
@@ -173,6 +183,7 @@ source include/wait_until_count_sessions.inc;
drop user user1@localhost;
set global server_audit_events='';
+set global server_audit_incl_users='root, plug_dest';
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
diff --git a/mysql-test/suite/roles/show_grants.result b/mysql-test/suite/roles/show_grants.result
index 5d46b038cf8..b523211420b 100644
--- a/mysql-test/suite/roles/show_grants.result
+++ b/mysql-test/suite/roles/show_grants.result
@@ -146,3 +146,18 @@ drop role test_role2;
delete from mysql.roles_mapping where Role='test_role1';
delete from mysql.roles_mapping where Role='test_role2';
flush privileges;
+#
+# MDEV-24289: show grants missing with grant option
+#
+create role anel;
+GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel';
+SHOW GRANTS for 'anel';
+Grants for anel
+GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel'
+create role MariaDB_admin;
+GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION;
+SHOW GRANTS for 'MariaDB_admin';
+Grants for MariaDB_admin
+GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION
+drop role MariaDB_admin;
+drop role anel;
diff --git a/mysql-test/suite/roles/show_grants.test b/mysql-test/suite/roles/show_grants.test
index 9c15d8b8b2b..fc2165ac53b 100644
--- a/mysql-test/suite/roles/show_grants.test
+++ b/mysql-test/suite/roles/show_grants.test
@@ -88,3 +88,16 @@ drop role test_role2;
delete from mysql.roles_mapping where Role='test_role1';
delete from mysql.roles_mapping where Role='test_role2';
flush privileges;
+
+--echo #
+--echo # MDEV-24289: show grants missing with grant option
+--echo #
+create role anel;
+GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel';
+SHOW GRANTS for 'anel';
+
+create role MariaDB_admin;
+GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION;
+SHOW GRANTS for 'MariaDB_admin';
+drop role MariaDB_admin;
+drop role anel;
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index 2bf2a69bd62..4508c8e4ca6 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -10,8 +10,7 @@
#
##############################################################################
-rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
-#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
+#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table
rpl_row_binlog_max_cache_size : MDEV-11092
rpl_row_index_choice : MDEV-11666
diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result
index 5439bdef72c..48cec72d917 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result
@@ -22,4 +22,8 @@ n
connection master;
drop table t1;
connection slave;
+connection master;
+CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
+MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
+CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
include/rpl_end.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 74648501fbe..9c36973427a 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_delete_domain.result
@@ -22,7 +22,7 @@ START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236]
connection master;
FLUSH BINARY LOGS;
-PURGE BINARY LOGS TO 'master-bin.000002';;
+include/wait_for_purge.inc "master-bin.000002"
FLUSH BINARY LOGS DELETE_DOMAIN_ID=(11);
SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
@@global.gtid_binlog_pos @@global.gtid_binlog_state
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_grant.result b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
index f3d69112efd..29e6bb6d6a4 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_grant.result
@@ -1,14 +1,12 @@
include/master-slave.inc
[connection master]
connection master;
-set global sql_mode="";
-set local sql_mode="";
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
connection slave;
-set global sql_mode="";
-set local sql_mode="";
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
@@ -43,7 +41,5 @@ connection slave;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-set global sql_mode=default;
connection master;
-set global sql_mode=default;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
index 18298986069..00ac06951ee 100644
--- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
+++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
@@ -12,6 +12,7 @@ Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('m
select master_pos_wait('master-bin.999999',0);
connection slave1;
stop slave sql_thread;
+include/wait_for_slave_sql_to_stop.inc
connection slave;
master_pos_wait('master-bin.999999',0)
NULL
diff --git a/mysql-test/suite/rpl/r/rpl_relay_max_extension.result b/mysql-test/suite/rpl/r/rpl_relay_max_extension.result
new file mode 100644
index 00000000000..4444398203e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_relay_max_extension.result
@@ -0,0 +1,37 @@
+include/rpl_init.inc [topology=1->2]
+connection server_2;
+include/stop_slave.inc
+RESET SLAVE;
+include/start_slave.inc
+include/stop_slave.inc
+#
+# Stop slave server
+#
+#
+# Simulate file number get close to 999997
+# by renaming relay logs and modifying index/info files
+#
+# Restart slave server
+#
+SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
+SET @save_max_relay_log_size= @@GLOBAL.max_relay_log_size;
+SET GLOBAL slave_parallel_threads=1;
+SET GLOBAL max_relay_log_size=100 * 1024;
+include/start_slave.inc
+connection server_1;
+create table t1 (i int, c varchar(1024));
+#
+# Insert some data to generate enough amount of binary logs
+#
+connection server_2;
+#
+# Assert that 'slave-relay-bin.999999' is purged.
+#
+NOT FOUND /slave-relay-bin.999999/ in slave-relay-bin.index
+include/stop_slave.inc
+SET GLOBAL slave_parallel_threads= @save_slave_parallel_threads;
+SET GLOBAL max_relay_log_size= @save_max_relay_log_size;
+include/start_slave.inc
+connection server_1;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_USER.result b/mysql-test/suite/rpl/r/rpl_row_USER.result
index 5a59bb57795..2771c674f44 100644
--- a/mysql-test/suite/rpl/r/rpl_row_USER.result
+++ b/mysql-test/suite/rpl/r/rpl_row_USER.result
@@ -1,6 +1,5 @@
include/master-slave.inc
[connection master]
-set global sql_mode="";
set local sql_mode="";
connection master;
DROP DATABASE IF EXISTS mysqltest1;
@@ -40,7 +39,6 @@ REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
DROP USER tester@'%';
DROP USER ''@'localhost%';
+FLUSH PRIVILEGES;
connection slave;
include/rpl_end.inc
-set global sql_mode=default;
-set local sql_mode=default;
diff --git a/mysql-test/suite/rpl/r/rpl_row_utf32.result b/mysql-test/suite/rpl/r/rpl_row_utf32.result
index af6e709860e..6d177b7cda0 100644
--- a/mysql-test/suite/rpl/r/rpl_row_utf32.result
+++ b/mysql-test/suite/rpl/r/rpl_row_utf32.result
@@ -3,7 +3,7 @@ include/master-slave.inc
SET SQL_LOG_BIN=0;
CREATE TABLE t1 (c1 char(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
SET SQL_LOG_BIN=1;
connection slave;
SET @saved_slave_type_conversions= @@global.slave_type_conversions;
@@ -13,7 +13,7 @@ include/start_slave.inc
SET SQL_LOG_BIN=0;
CREATE TABLE t1 ( c1 varchar(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32;
Warnings:
-Warning 1071 Specified key was too long; max key length is 1000 bytes
+Note 1071 Specified key was too long; max key length is 1000 bytes
SET SQL_LOG_BIN=1;
connection master;
INSERT INTO t1(c1) VALUES ('insert into t1');
diff --git a/mysql-test/suite/rpl/r/rpl_row_vcol_crash.result b/mysql-test/suite/rpl/r/rpl_row_vcol_crash.result
new file mode 100644
index 00000000000..f76d8935fa8
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_vcol_crash.result
@@ -0,0 +1,380 @@
+include/master-slave.inc
+[connection master]
+#
+# Test case 1: KEY on a virtual column with ON DELETE CASCADE
+#
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY,
+t1_id INT NOT NULL,
+v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (90,1,NULL);
+INSERT INTO t2 VALUES (91,2,default);
+DELETE FROM t1 WHERE id=1;
+connection slave;
+#
+# Verify data consistency on slave
+#
+include/diff_tables.inc [master:test.t1, slave:test.t1]
+include/diff_tables.inc [master:test.t2, slave:test.t2]
+connection master;
+DROP TABLE t2,t1;
+connection slave;
+#
+# Test case 2: Verify "ON DELETE CASCADE" for parent->child->child scenario
+# Parent table: users
+# Child tables: matchmaking_groups, matchmaking_group_users
+# Parent table: matchmaking_groups
+# Child tables: matchmaking_group_users, matchmaking_group_maps
+#
+# Deleting a row from parent table should be reflected in
+# child tables.
+# matchmaking_groups->matchmaking_group_users->matchmaking_group_maps
+# users->matchmaking_group_users->matchmaking_group_maps
+#
+connection master;
+CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+name VARCHAR(32) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_groups (
+id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+host_user_id INT UNSIGNED NOT NULL UNIQUE,
+v_col INT AS (host_user_id+1) VIRTUAL, KEY (v_col),
+CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_group_users (
+matchmaking_group_id BIGINT UNSIGNED NOT NULL,
+user_id INT UNSIGNED NOT NULL,
+v_col1 int as (user_id+1) virtual, KEY (v_col1),
+PRIMARY KEY (matchmaking_group_id,user_id),
+UNIQUE KEY user_id (user_id),
+CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE,
+CONSTRAINT FOREIGN KEY (user_id)
+REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE matchmaking_group_maps (
+matchmaking_group_id BIGINT UNSIGNED NOT NULL,
+map_id TINYINT UNSIGNED NOT NULL,
+v_col2 INT AS (map_id+1) VIRTUAL, KEY (v_col2),
+PRIMARY KEY (matchmaking_group_id,map_id),
+CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection slave;
+connection master;
+INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar');
+INSERT INTO matchmaking_groups VALUES (10,1,default),(11,2,default);
+INSERT INTO matchmaking_group_users VALUES (10,1,default),(11,2,default);
+INSERT INTO matchmaking_group_maps VALUES (10,55,default),(11,66,default);
+DELETE FROM matchmaking_groups WHERE id = 10;
+connection slave;
+#
+# No rows should be returned as ON DELETE CASCASE should have removed
+# corresponding rows from child tables. There should not any mismatch
+# of 'id' field between parent->child.
+#
+SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+matchmaking_group_id user_id v_col1
+SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+matchmaking_group_id map_id v_col2
+#
+# Rows with id=11 should be present
+#
+SELECT * FROM matchmaking_group_users;
+matchmaking_group_id user_id v_col1
+11 2 3
+SELECT * FROM matchmaking_group_maps;
+matchmaking_group_id map_id v_col2
+11 66 67
+connection master;
+DELETE FROM users WHERE id = 2;
+connection slave;
+#
+# No rows should be present in both the child tables
+#
+SELECT * FROM matchmaking_group_users;
+matchmaking_group_id user_id v_col1
+SELECT * FROM matchmaking_group_maps;
+matchmaking_group_id map_id v_col2
+connection master;
+DROP TABLE matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users;
+connection slave;
+#
+# Test case 3: KEY on a virtual column with ON UPDATE CASCADE
+#
+connection master;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 80);
+CREATE TABLE t2 (a INT KEY, b INT,
+v_col int as (b+1) virtual, KEY (v_col),
+CONSTRAINT b FOREIGN KEY (b) REFERENCES t1(a) ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (51, 1, default);
+connection slave;
+connection master;
+UPDATE t1 SET a = 50 WHERE a = 1;
+#
+# Master: Verify that ON UPDATE CASCADE works fine
+# old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51)
+#
+SELECT * FROM t2 WHERE b=50;
+a b v_col
+51 50 51
+connection slave;
+#
+# Slave: Verify that ON UPDATE CASCADE works fine
+# old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51)
+#
+SELECT * FROM t2 WHERE b=50;
+a b v_col
+51 50 51
+connection master;
+DROP TABLE t2, t1;
+connection slave;
+#
+# Test case 4: Define triggers on master, their results should be
+# replicated as part of row events and they should be
+# applied on slave with the default
+# slave_run_triggers_for_rbr=NO
+#
+connection master;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (count INT NOT NULL) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (2),(3);
+connection slave;
+SHOW GLOBAL VARIABLES LIKE 'slave_run_triggers_for_rbr';
+Variable_name Value
+slave_run_triggers_for_rbr NO
+#
+# As two rows are inserted in table 't1', two rows should get inserted
+# into table 't2' as part of trigger.
+#
+include/assert.inc [Table t2 should have two rows.]
+connection master;
+DROP TABLE t1,t2;
+connection slave;
+#
+# Test case 5: Define triggers + Foreign Keys on master, their results
+# should be replicated as part of row events and master
+# and slave should be in sync.
+#
+connection master;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (1);
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+connection slave;
+#
+# As two rows are inserted in table 't1', two rows should get inserted
+# into table 't3' as part of trigger.
+#
+include/assert.inc [Table t3 should have two rows.]
+#
+# Verify ON DELETE CASCASE correctness
+#
+connection master;
+DELETE FROM t1 WHERE id=2;
+connection slave;
+connection master;
+include/diff_tables.inc [master:test.t1, slave:test.t1]
+include/diff_tables.inc [master:test.t2, slave:test.t2]
+include/diff_tables.inc [master:test.t3, slave:test.t3]
+DROP TABLE t3,t2,t1;
+connection slave;
+#
+# Test case 6: Triggers are present only on slave and
+# 'slave_run_triggers_for_rbr=NO'
+#
+connection slave;
+SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr;
+SET GLOBAL slave_run_triggers_for_rbr= NO;;
+SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%';
+Variable_name Value
+slave_run_triggers_for_rbr NO
+connection master;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col),
+KEY (t1_id), CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+connection slave;
+CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1);
+connection master;
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+connection slave;
+#
+# Count must be 0
+#
+include/assert.inc [Table t3 should have zero rows.]
+connection master;
+DELETE FROM t1 WHERE id=2;
+connection slave;
+SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr;
+#
+# Verify t1, t2 are consistent on slave.
+#
+include/diff_tables.inc [master:test.t1, slave:test.t1]
+include/diff_tables.inc [master:test.t2, slave:test.t2]
+connection master;
+DROP TABLE t3,t2,t1;
+connection slave;
+#
+# Test case 7: Triggers are present only on slave and
+# 'slave_run_triggers_for_rbr=YES'
+#
+connection slave;
+SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr;
+SET GLOBAL slave_run_triggers_for_rbr= YES;;
+SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%';
+Variable_name Value
+slave_run_triggers_for_rbr YES
+connection master;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col),
+KEY (t1_id), CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+connection slave;
+CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1);
+connection master;
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+connection slave;
+#
+# Count must be 2
+#
+include/assert.inc [Table t3 should have two rows.]
+connection master;
+DELETE FROM t1 WHERE id=2;
+connection slave;
+SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr;
+#
+# Verify t1, t2 are consistent on slave.
+#
+include/diff_tables.inc [master:test.t1, slave:test.t1]
+include/diff_tables.inc [master:test.t2, slave:test.t2]
+connection master;
+DROP TABLE t3,t2,t1;
+connection slave;
+#
+# Test case 8: Triggers and Foreign Keys are present only on slave and
+# 'slave_run_triggers_for_rbr=NO'
+#
+connection slave;
+SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr;
+SET GLOBAL slave_run_triggers_for_rbr= NO;;
+SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%';
+Variable_name Value
+slave_run_triggers_for_rbr NO
+connection master;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET sql_log_bin=0;
+CREATE TABLE t2 (t1_id INT NOT NULL,v_col INT AS (t1_id+1) VIRTUAL) ENGINE=INNODB;
+SET sql_log_bin=1;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+connection slave;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1);
+connection master;
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+connection slave;
+#
+# Count must be 0
+#
+include/assert.inc [Table t3 should have zero rows.]
+connection master;
+DELETE FROM t1 WHERE id=2;
+# t1: Should have one row
+SELECT * FROM t1;
+id
+3
+# t2: Should have two rows
+SELECT * FROM t2;
+t1_id v_col
+2 3
+3 4
+connection slave;
+# t1: Should have one row
+SELECT * FROM t1;
+id
+3
+# t2: Should have one row on slave due to ON DELETE CASCASE
+SELECT * FROM t2;
+t1_id v_col
+3 4
+SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr;
+connection master;
+DROP TABLE t3,t2,t1;
+connection slave;
+#
+# Test case 9: Triggers are Foreign Keys are present only on slave and
+# 'slave_run_triggers_for_rbr=YES'
+#
+connection slave;
+SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr;
+SET GLOBAL slave_run_triggers_for_rbr= YES;;
+SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%';
+Variable_name Value
+slave_run_triggers_for_rbr YES
+connection master;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET sql_log_bin=0;
+CREATE TABLE t2 (t1_id INT NOT NULL,v_col INT AS (t1_id+1) VIRTUAL) ENGINE=INNODB;
+SET sql_log_bin=1;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+connection slave;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1);
+connection master;
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+connection slave;
+#
+# Count must be 2
+#
+include/assert.inc [Table t3 should have two rows.]
+connection master;
+DELETE FROM t1 WHERE id=2;
+# t1: Should have one row
+SELECT * FROM t1;
+id
+3
+# t2: Should have two rows
+SELECT * FROM t2;
+t1_id v_col
+2 3
+3 4
+connection slave;
+# t1: Should have one row
+SELECT * FROM t1;
+id
+3
+# t2: Should have one row on slave due to ON DELETE CASCASE
+SELECT * FROM t2;
+t1_id v_col
+3 4
+SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr;
+connection master;
+DROP TABLE t3,t2,t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index 6d574681d73..ad6a89648ad 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -163,20 +163,15 @@ connection slave;
connection slave;
include/stop_slave.inc
connection master;
+include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000;
[ master status should be ON ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 0
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 14
-show status like 'Rpl_semi_sync_master_clients';
-Variable_name Value
-Rpl_semi_sync_master_clients 1
[ semi-sync replication of these transactions will fail ]
insert into t1 values (500);
[ master status should be OFF ]
@@ -234,9 +229,6 @@ max(a)
500
connection master;
[ master status should be ON again after slave catches up ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 12
@@ -303,8 +295,6 @@ connection master;
create table t1 (a int) engine = ENGINE_TYPE;
drop table t1;
connection slave;
-show status like 'Rpl_relay%';
-Variable_name Value
[ test reset master ]
connection master;
reset master;
@@ -320,8 +310,7 @@ Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
reset slave;
-connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
@@ -353,7 +342,7 @@ include/stop_slave.inc
reset slave;
connection master;
reset master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
set sql_log_bin=0;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
@@ -404,11 +393,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
[ Semi-sync status on master should be ON ]
-show status like 'Rpl_semi_sync_master_clients';
-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 ON
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 927113726fa..11affc4d803 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
@@ -164,20 +164,15 @@ connection slave;
connection slave;
include/stop_slave.inc
connection master;
+include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000;
[ master status should be ON ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 0
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 16
-show status like 'Rpl_semi_sync_master_clients';
-Variable_name Value
-Rpl_semi_sync_master_clients 1
[ semi-sync replication of these transactions will fail ]
insert into t1 values (500);
[ master status should be OFF ]
@@ -235,9 +230,6 @@ max(a)
500
connection master;
[ master status should be ON again after slave catches up ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 12
@@ -304,8 +296,6 @@ connection master;
create table t1 (a int) engine = ENGINE_TYPE;
drop table t1;
connection slave;
-show status like 'Rpl_relay%';
-Variable_name Value
[ test reset master ]
connection master;
reset master;
@@ -321,8 +311,7 @@ Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
reset slave;
-connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
@@ -354,7 +343,7 @@ include/stop_slave.inc
reset slave;
connection master;
reset master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
set sql_log_bin=0;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
@@ -405,11 +394,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
[ Semi-sync status on master should be ON ]
-show status like 'Rpl_semi_sync_master_clients';
-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 ON
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 30280551ce2..1a550be05a7 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
@@ -164,20 +164,15 @@ connection slave;
connection slave;
include/stop_slave.inc
connection master;
+include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000;
[ master status should be ON ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 0
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 14
-show status like 'Rpl_semi_sync_master_clients';
-Variable_name Value
-Rpl_semi_sync_master_clients 1
[ semi-sync replication of these transactions will fail ]
insert into t1 values (500);
[ master status should be OFF ]
@@ -235,9 +230,6 @@ max(a)
500
connection master;
[ master status should be ON again after slave catches up ]
-show status like 'Rpl_semi_sync_master_status';
-Variable_name Value
-Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
Rpl_semi_sync_master_no_tx 12
@@ -304,8 +296,6 @@ connection master;
create table t1 (a int) engine = ENGINE_TYPE;
drop table t1;
connection slave;
-show status like 'Rpl_relay%';
-Variable_name Value
[ test reset master ]
connection master;
reset master;
@@ -321,8 +311,7 @@ Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
reset slave;
-connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
connection master;
@@ -354,7 +343,7 @@ include/stop_slave.inc
reset slave;
connection master;
reset master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
set sql_log_bin=0;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
@@ -405,11 +394,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
connection master;
-kill query _tid;
+include/kill_binlog_dump_threads.inc
[ Semi-sync status on master should be ON ]
-show status like 'Rpl_semi_sync_master_clients';
-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 ON
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 411a24278d5..f2f61ee0245 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -1,7 +1,6 @@
include/master-slave.inc
[connection master]
set local sql_mode='';
-set global sql_mode='';
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
@@ -174,16 +173,16 @@ fn1(20)
insert into t2 values(fn1(21));
select * from t1;
a
-21
20
+21
select * from t2;
a
23
connection slave;
select * from t1;
a
-21
20
+21
select * from t2;
a
23
@@ -242,7 +241,7 @@ return unix_timestamp();
end
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
@@ -267,7 +266,7 @@ return unix_timestamp();
end
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
-end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
+end zedjzlcsjhd@localhost # # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
@@ -863,6 +862,7 @@ SET TIMESTAMP=t/*!*/;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`()
DETERMINISTIC
begin
@@ -881,6 +881,7 @@ COMMIT
BEGIN
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
insert into t1 values (15)
/*!*/;
SET TIMESTAMP=t/*!*/;
@@ -889,17 +890,20 @@ COMMIT
BEGIN
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
insert into t2 values(3)
/*!*/;
SET TIMESTAMP=t/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
alter procedure foo4 sql security invoker
/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
insert into t2 values(3)
/*!*/;
SET TIMESTAMP=t/*!*/;
@@ -916,6 +920,7 @@ COMMIT
BEGIN
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
delete from t2
/*!*/;
SET TIMESTAMP=t/*!*/;
@@ -1013,6 +1018,7 @@ SET TIMESTAMP=t/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11)
NO SQL
begin
@@ -1020,6 +1026,7 @@ return unix_timestamp();
end
/*!*/;
SET TIMESTAMP=t/*!*/;
+SET @@session.sql_mode=0/*!*/;
CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11)
READS SQL DATA
begin
@@ -1382,4 +1389,3 @@ drop procedure p1;
# End of 5.5 tests.
connection slave;
include/rpl_end.inc
-set global sql_mode=default;
diff --git a/mysql-test/suite/rpl/r/rpl_spec_variables.result b/mysql-test/suite/rpl/r/rpl_spec_variables.result
index 96f63a50ea9..8b4c398f308 100644
--- a/mysql-test/suite/rpl/r/rpl_spec_variables.result
+++ b/mysql-test/suite/rpl/r/rpl_spec_variables.result
@@ -2,14 +2,17 @@ include/master-slave.inc
[connection master]
* auto_increment_increment, auto_increment_offset *
+connection master;
SET @@global.auto_increment_increment=2;
SET @@session.auto_increment_increment=2;
SET @@global.auto_increment_offset=10;
SET @@session.auto_increment_offset=10;
+connection slave;
SET @@global.auto_increment_increment=3;
SET @@session.auto_increment_increment=3;
SET @@global.auto_increment_offset=20;
SET @@session.auto_increment_offset=20;
+connection master;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
INSERT INTO t1 (b) VALUES ('master');
INSERT INTO t1 (b) VALUES ('master');
@@ -17,6 +20,7 @@ SELECT * FROM t1 ORDER BY a;
a b
2 master
4 master
+connection slave;
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
INSERT INTO t1 (b) VALUES ('slave');
INSERT INTO t1 (b) VALUES ('slave');
@@ -32,102 +36,123 @@ SELECT * FROM t2 ORDER BY a;
a b
1 slave
4 slave
+connection master;
DROP TABLE IF EXISTS t1,t2;
SET @@global.auto_increment_increment=1;
SET @@session.auto_increment_increment=1;
SET @@global.auto_increment_offset=1;
SET @@session.auto_increment_offset=1;
+connection slave;
SET @@global.auto_increment_increment=1;
SET @@session.auto_increment_increment=1;
SET @@global.auto_increment_offset=1;
SET @@session.auto_increment_offset=1;
+connection slave;
SET auto_increment_increment=1;
SET auto_increment_offset=1;
* character_set_database, collation_server *
+connection master;
SET @restore_master_character_set_database=@@global.character_set_database;
SET @restore_master_collation_server=@@global.collation_server;
SET @@global.character_set_database=latin1;
SET @@session.character_set_database=latin1;
SET @@global.collation_server=latin1_german1_ci;
SET @@session.collation_server=latin1_german1_ci;
+connection slave;
SET @restore_slave_character_set_database=@@global.character_set_database;
SET @restore_slave_collation_server=@@global.collation_server;
SET @@global.character_set_database=utf8;
SET @@session.character_set_database=utf8;
SET @@global.collation_server=utf8_bin;
SET @@session.collation_server=utf8_bin;
+connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+connection slave;
CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
- `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL,
- `b` varchar(10) COLLATE utf8_bin DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET @@global.collation_server=latin1_swedish_ci;
SET @@session.collation_server=latin1_swedish_ci;
+connection master;
SET @@global.collation_server=latin1_swedish_ci;
SET @@session.collation_server=latin1_swedish_ci;
DROP TABLE IF EXISTS t1,t2;
* default_week_format *
+connection master;
SET @@global.default_week_format=0;
SET @@session.default_week_format=0;
+connection slave;
SET @@global.default_week_format=1;
SET @@session.default_week_format=1;
+connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'master ', WEEK('2008-01-07'));
SELECT * FROM t1 ORDER BY a;
a b c
1 master 1
+connection slave;
INSERT INTO t1 VALUES (2, 'slave ', WEEK('2008-01-07'));
SELECT * FROM t1 ORDER BY a;
a b c
1 master 1
2 slave 2
+connection master;
DROP TABLE t1;
+connection slave;
SET @@global.default_week_format=0;
SET @@session.default_week_format=0;
* local_infile *
+connection slave;
SET @@global.local_infile=0;
+connection master;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(20), c CHAR(254)) ENGINE=MyISAM;
LOAD DATA LOCAL INFILE 'FILE' INTO TABLE t1 (b);
SELECT COUNT(*) FROM t1;
COUNT(*)
70
+connection slave;
LOAD DATA LOCAL INFILE 'FILE2' INTO TABLE t1 (b);
-ERROR 42000: The used command is not allowed with this MySQL version
+ERROR 42000: The used command is not allowed with this MariaDB version
SELECT COUNT(*) FROM t1;
COUNT(*)
70
SET @@global.local_infile=1;
+connection master;
DROP TABLE t1;
* max_heap_table_size *
+connection slave;
SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size;
SET @@global.max_heap_table_size=16384;
SET @@session.max_heap_table_size=16384;
+connection master;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY;
SELECT COUNT(*)=2000 FROM t1;
COUNT(*)=2000
1
+connection slave;
SELECT COUNT(*)=2000 FROM t1 WHERE b='master' GROUP BY b ORDER BY b;
COUNT(*)=2000
1
@@ -137,18 +162,24 @@ COUNT(*)<2000 AND COUNT(*)>0
SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b;
COUNT(*)<2000 AND COUNT(*)>0
1
+connection master;
DROP TABLE IF EXISTS t1,t2;
* storage_engine *
+connection master;
SET @restore_master_storage_engine=@@global.storage_engine;
SET @@global.storage_engine=InnoDB;
SET @@session.storage_engine=InnoDB;
+connection slave;
SET @restore_slave_storage_engine=@@global.storage_engine;
SET @@global.storage_engine=Memory;
SET @@session.storage_engine=Memory;
+connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
+connection slave;
CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10));
+connection master;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -163,6 +194,7 @@ t2 CREATE TABLE `t2` (
`b` varchar(10) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
+connection slave;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -186,37 +218,49 @@ t3 CREATE TABLE `t3` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1
SET @@global.storage_engine=InnoDB;
SET @@session.storage_engine=InnoDB;
+connection master;
DROP TABLE IF EXISTS t1,t2,t3;
* sql_mode *
+connection master;
+SET @old_sql_mode_master= @@global.sql_mode;
SET @@global.sql_mode=ANSI;
SET @@session.sql_mode=ANSI;
+connection slave;
+SET @old_sql_mode_slave= @@global.sql_mode;
SET @@global.sql_mode=TRADITIONAL;
SET @@session.sql_mode=TRADITIONAL;
+connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE);
INSERT INTO t1 VALUES (1, 'master', '0000-00-00');
SELECT * FROM t1 ORDER BY a;
a b c
1 master 0000-00-00
+connection slave;
INSERT INTO t1 VALUES (1, 'slave', '0000-00-00');
-ERROR 22007: Incorrect date value: '0000-00-00' for column 'c' at row 1
+ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`c` at row 1
SELECT * FROM t1 ORDER BY a;
a b c
1 master 0000-00-00
SET @@global.sql_mode='';
SET @@session.sql_mode='';
+connection master;
SET @@global.sql_mode='';
SET @@session.sql_mode='';
DROP TABLE t1;
*** clean up ***
+connection master;
SET @@global.character_set_database=@restore_master_character_set_database;
SET @@global.collation_server=@restore_master_collation_server;
SET @@global.storage_engine=@restore_master_storage_engine;
+SET @@global.sql_mode=@old_sql_mode_master;
+connection slave;
SET @@global.character_set_database=@restore_slave_character_set_database;
SET @@global.collation_server=@restore_slave_collation_server;
SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size;
SET @@global.storage_engine=@restore_slave_storage_engine;
+SET @@global.sql_mode=@old_sql_mode_slave;
call mtr.add_suppression("The table 't[12]' is full");
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_table_options.result b/mysql-test/suite/rpl/r/rpl_table_options.result
index 87fd8c2b2fb..14af4e390c2 100644
--- a/mysql-test/suite/rpl/r/rpl_table_options.result
+++ b/mysql-test/suite/rpl/r/rpl_table_options.result
@@ -5,24 +5,27 @@ set storage_engine=example;
connection slave;
connection master;
create table t1 (a int not null) ull=12340;
+alter table t1 ull=12350;
+Warnings:
+Note 1105 EXAMPLE DEBUG: ULL 12340 -> 12350
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12350
connection slave;
connection slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 /* `ull`=12340 */
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /* `ull`=12350 */
set sql_mode=ignore_bad_table_options;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12340
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 `ull`=12350
connection master;
drop table t1;
set storage_engine=default;
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index 5e170d5acce..9ab49a585e6 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -101,4 +101,11 @@ connection master;
drop table t1;
}
+--connection master
+# MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in
+# instrings/strmake.c:36 from change_master (on optimized builds)
+CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
+ MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
+CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
index 0262998798a..5537b6fbf86 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
@@ -53,17 +53,11 @@ START SLAVE IO_THREAD;
# adjust the master binlog state
FLUSH BINARY LOGS;
--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
---eval PURGE BINARY LOGS TO '$purge_to_binlog';
+--let $purge_binlogs_to=$purge_to_binlog
+--source include/wait_for_purge.inc
+
# with final removal of the extra domain
-###adding to debug info to catch the failure (1076):
---error 0,1076
--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id)
-
-if ($mysql_errno == 1076) {
- --echo ### Failure "Could not delete gtid domain"
- --source include/show_rpl_debug_info.inc
- }
-
SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
--connection slave
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_grant.test b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
index ee049a515d7..58457c14817 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_grant.test
@@ -6,16 +6,12 @@ source include/master-slave.inc;
# do not be influenced by other tests.
connection master;
-set global sql_mode="";
-set local sql_mode="";
+set sql_mode="";
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-save_master_pos;
-connection slave;
-set global sql_mode="";
-set local sql_mode="";
-sync_with_master;
+--sync_slave_with_master
+set sql_mode="";
# as these DELETE were not replicated, we need to do them manually on the
# slave.
delete from mysql.user where user=_binary'rpl_ignore_grant';
@@ -27,9 +23,7 @@ connection master;
grant select on *.* to rpl_ignore_grant@localhost;
grant drop on test.* to rpl_ignore_grant@localhost;
show grants for rpl_ignore_grant@localhost;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
--error 1141 #("no such grant for user")
show grants for rpl_ignore_grant@localhost;
# check it another way
@@ -43,9 +37,7 @@ select count(*) from mysql.db where user=_binary'rpl_ignore_grant';
grant select on *.* to rpl_ignore_grant@localhost;
connection master;
set password for rpl_ignore_grant@localhost=password("does it work?");
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select password<>_binary'' from mysql.user where user=_binary'rpl_ignore_grant';
# clear what we have done, to not influence other tests.
@@ -53,15 +45,11 @@ connection master;
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
delete from mysql.user where user=_binary'rpl_ignore_grant';
delete from mysql.db where user=_binary'rpl_ignore_grant';
flush privileges;
-set global sql_mode=default;
connection master;
-set global sql_mode=default;
# End of 4.1 tests
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
index 840052e2f25..6591dbbc6ad 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table_update.test
@@ -24,15 +24,11 @@ create table mysqltest_bar (m int);
insert into mysqltest_bar values(15);
create table t1 (k int);
insert into t1 values(55);
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1;
connection master;
drop table mysqltest_foo,mysqltest_bar,t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+--sync_slave_with_master
drop table mysqltest_foo,mysqltest_bar,t1;
# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
index a3f3ff56464..768a834514b 100644
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
@@ -10,6 +10,7 @@ explain extended select master_pos_wait('master-bin.999999',0,2);
send select master_pos_wait('master-bin.999999',0);
connection slave1;
stop slave sql_thread;
+--source include/wait_for_slave_sql_to_stop.inc
connection slave;
reap;
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
index 96863f9021d..0140784c8b9 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
@@ -436,6 +436,9 @@ SET @@DEBUG_SYNC='now SIGNAL proceed_by_1000';
--connection spoiler_21
ROLLBACK;
+--let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE '%debug sync point%';
+--source include/wait_condition.inc
+
--echo # Release the 2nd worker to proceed
--connection spoiler_22
ROLLBACK;
diff --git a/mysql-test/suite/rpl/t/rpl_relay_max_extension.test b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test
new file mode 100644
index 00000000000..e1e087f2e0e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test
@@ -0,0 +1,109 @@
+# ==== Purpose ====
+#
+# Test verifies that auto purging mechanism of relay logs works fine when the
+# file extension grows beyond 999999.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - In master-slave setup clear all the relay logs on the slave server.
+# 1 - Start the slave so that new relay logs starting from
+# 'slave-relay-bin.000001' are created.
+# 2 - Get the active relay-log file name by using SHOW SLAVE STATUS.
+# Shutdown the slave server.
+# 3 - Rename active relay log to '999997' in both 'relay-log.info' and
+# 'slave-relay-bin.index' files.
+# 4 - Restart the slave server by configuring 'slave_parallel_threads=1'
+# and 'max_relay_log_size=100K'.
+# 5 - Generate load on master such that few relay logs are generated on
+# slave. The relay log sequence number will change to 7 digits.
+# 6 - Sync slave with master to ensure that relay logs are applied on
+# slave. They should have been automatically purged.
+# 7 - Assert that there is no 'slave-relay-bin.999999' file in
+# 'relay-log.info'.
+#
+# ==== References ====
+#
+# MDEV-8134: The relay-log is not flushed after the slave-relay-log.999999
+# showed
+#
+
+--source include/have_innodb.inc
+--source include/have_binlog_format_row.inc
+--let $rpl_topology=1->2
+--source include/rpl_init.inc
+
+--connection server_2
+--source include/stop_slave.inc
+RESET SLAVE;
+--source include/start_slave.inc
+--source include/stop_slave.inc
+--let $relay_log=query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+
+--echo #
+--echo # Stop slave server
+--echo #
+
+--let $datadir = `select @@datadir`
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+--exec sed -i "s/$relay_log/slave-relay-bin.999997/g" $datadir/relay-log.info
+--exec sed -i "s/$relay_log/slave-relay-bin.999997/g" $datadir/slave-relay-bin.index
+
+--echo #
+--echo # Simulate file number get close to 999997
+--echo # by renaming relay logs and modifying index/info files
+
+--move_file $datadir/$relay_log $datadir/slave-relay-bin.999997
+
+--echo #
+--echo # Restart slave server
+--echo #
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
+SET @save_max_relay_log_size= @@GLOBAL.max_relay_log_size;
+
+SET GLOBAL slave_parallel_threads=1;
+SET GLOBAL max_relay_log_size=100 * 1024;
+--source include/start_slave.inc
+
+--connection server_1
+create table t1 (i int, c varchar(1024));
+--echo #
+--echo # Insert some data to generate enough amount of binary logs
+--echo #
+--let $count = 1000
+--disable_query_log
+while ($count)
+{
+ eval insert into t1 values (1001 - $count, repeat('a',1000));
+ dec $count;
+}
+--enable_query_log
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+
+--let $relay_log=query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+
+--echo #
+--echo # Assert that 'slave-relay-bin.999999' is purged.
+--echo #
+let SEARCH_FILE=$datadir/slave-relay-bin.index;
+let SEARCH_PATTERN=slave-relay-bin.999999;
+source include/search_pattern_in_file.inc;
+
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_threads= @save_slave_parallel_threads;
+SET GLOBAL max_relay_log_size= @save_max_relay_log_size;
+--source include/start_slave.inc
+
+--connection server_1
+DROP TABLE t1;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_USER.test b/mysql-test/suite/rpl/t/rpl_row_USER.test
index 31826812efa..405f609f0f6 100644
--- a/mysql-test/suite/rpl/t/rpl_row_USER.test
+++ b/mysql-test/suite/rpl/t/rpl_row_USER.test
@@ -11,7 +11,6 @@
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-set global sql_mode="";
set local sql_mode="";
# Begin clean up test section
@@ -43,23 +42,18 @@ delimiter ;|
CALL mysqltest1.p1();
connection master;
SELECT * FROM mysqltest1.t1 ORDER BY a;
-sync_slave_with_master;
+--sync_slave_with_master
SELECT * FROM mysqltest1.t1 ORDER BY a;
connection master;
# Lets cleanup
-#show binlog events;
DROP DATABASE mysqltest1;
REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
DROP USER tester@'%';
DROP USER ''@'localhost%';
-
-sync_slave_with_master;
-
+FLUSH PRIVILEGES;
+--sync_slave_with_master
# End of 5.0 test case
--source include/rpl_end.inc
-
-set global sql_mode=default;
-set local sql_mode=default;
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
index 65f14295c19..cb76d6c4dcb 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -7,11 +7,6 @@ connection slave;
--source include/have_innodb.inc
connection master;
-# Bug#18326: Do not lock table for writing during prepare of statement
-# The use of the ps protocol causes extra table maps in the binlog, so
-# we disable the ps-protocol for this statement.
---disable_ps_protocol
-
# Set the default storage engine to different values on master and
# slave. We need to stop the slave for the server variable to take
# effect, since the variable is only read on start-up.
diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
index 71cd4a5b9ae..4d786794f5f 100644
--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
@@ -4,10 +4,4 @@
let $rename_event_pos= `select @binlog_start_pos + 819`;
-# Bug#18326: Do not lock table for writing during prepare of statement
-# The use of the ps protocol causes extra table maps in the binlog, so
-# we disable the ps-protocol for this statement.
-
---disable_ps_protocol
-- source extra/rpl_tests/rpl_flsh_tbls.test
---enable_ps_protocol
diff --git a/mysql-test/suite/rpl/t/rpl_row_trig002.test b/mysql-test/suite/rpl/t/rpl_row_trig002.test
index 46f9ad91a3d..f04d1e6d478 100644
--- a/mysql-test/suite/rpl/t/rpl_row_trig002.test
+++ b/mysql-test/suite/rpl/t/rpl_row_trig002.test
@@ -48,9 +48,11 @@ INSERT INTO test.t3 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
select * from test.t2;
+--sorted_result
select * from test.t3;
sync_slave_with_master;
select * from test.t2;
+--sorted_result
select * from test.t3;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_vcol_crash.test b/mysql-test/suite/rpl/t/rpl_row_vcol_crash.test
new file mode 100644
index 00000000000..84ee14977f3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_vcol_crash.test
@@ -0,0 +1,425 @@
+# ==== Purpose ====
+#
+# Test verifies that, slave doesn't report any assert on UPDATE or DELETE of
+# row which tries to update the virtual columns with associated KEYs.
+#
+# Test scenarios are listed below.
+# 1) KEY on a virtual column with ON DELETE CASCADE
+# 2) Verify "ON DELETE CASCADE" for parent->child->child scenario
+# 3) KEY on a virtual column with ON UPDATE CASCADE
+# 4) Define triggers on master, their results should be replicated
+# as part of row events and they should be applied on slave with
+# the default slave_run_triggers_for_rbr=NO
+# 5) Define triggers + Foreign Keys on master, their results should be
+# replicated as part of row events and master and slave should be in sync.
+# 6) Triggers are present only on slave and 'slave_run_triggers_for_rbr=NO'
+# 7) Triggers are present only on slave and 'slave_run_triggers_for_rbr=YES'
+# 8) Triggers and Foreign Keys are present only on slave and
+# 'slave_run_triggers_for_rbr=NO'
+# 9) Triggers are Foreign Keys are present only on slave and
+# 'slave_run_triggers_for_rbr=YES'
+#
+# ==== References ====
+#
+# MDEV-23033: All slaves crash once in ~24 hours and loop restart with signal 11
+#
+
+--source include/have_binlog_format_row.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+
+--echo #
+--echo # Test case 1: KEY on a virtual column with ON DELETE CASCADE
+--echo #
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY,
+ t1_id INT NOT NULL,
+ v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+ CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES (90,1,NULL);
+INSERT INTO t2 VALUES (91,2,default);
+
+# Following query results in an assert on slave
+DELETE FROM t1 WHERE id=1;
+--sync_slave_with_master
+
+--echo #
+--echo # Verify data consistency on slave
+--echo #
+--let $diff_tables= master:test.t1, slave:test.t1
+--source include/diff_tables.inc
+--let $diff_tables= master:test.t2, slave:test.t2
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t2,t1;
+--sync_slave_with_master
+
+--echo #
+--echo # Test case 2: Verify "ON DELETE CASCADE" for parent->child->child scenario
+--echo # Parent table: users
+--echo # Child tables: matchmaking_groups, matchmaking_group_users
+--echo # Parent table: matchmaking_groups
+--echo # Child tables: matchmaking_group_users, matchmaking_group_maps
+--echo #
+--echo # Deleting a row from parent table should be reflected in
+--echo # child tables.
+--echo # matchmaking_groups->matchmaking_group_users->matchmaking_group_maps
+--echo # users->matchmaking_group_users->matchmaking_group_maps
+--echo #
+
+--connection master
+CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+ name VARCHAR(32) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_groups (
+ id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+ host_user_id INT UNSIGNED NOT NULL UNIQUE,
+ v_col INT AS (host_user_id+1) VIRTUAL, KEY (v_col),
+ CONSTRAINT FOREIGN KEY (host_user_id) REFERENCES users (id)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_group_users (
+ matchmaking_group_id BIGINT UNSIGNED NOT NULL,
+ user_id INT UNSIGNED NOT NULL,
+ v_col1 int as (user_id+1) virtual, KEY (v_col1),
+ PRIMARY KEY (matchmaking_group_id,user_id),
+ UNIQUE KEY user_id (user_id),
+ CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+ REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT FOREIGN KEY (user_id)
+ REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE matchmaking_group_maps (
+ matchmaking_group_id BIGINT UNSIGNED NOT NULL,
+ map_id TINYINT UNSIGNED NOT NULL,
+ v_col2 INT AS (map_id+1) VIRTUAL, KEY (v_col2),
+ PRIMARY KEY (matchmaking_group_id,map_id),
+ CONSTRAINT FOREIGN KEY (matchmaking_group_id)
+ REFERENCES matchmaking_groups (id) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+--sync_slave_with_master
+
+--connection master
+INSERT INTO users VALUES (NULL,'foo'),(NULL,'bar');
+INSERT INTO matchmaking_groups VALUES (10,1,default),(11,2,default);
+INSERT INTO matchmaking_group_users VALUES (10,1,default),(11,2,default);
+INSERT INTO matchmaking_group_maps VALUES (10,55,default),(11,66,default);
+
+DELETE FROM matchmaking_groups WHERE id = 10;
+--sync_slave_with_master
+
+--echo #
+--echo # No rows should be returned as ON DELETE CASCASE should have removed
+--echo # corresponding rows from child tables. There should not any mismatch
+--echo # of 'id' field between parent->child.
+--echo #
+SELECT * FROM matchmaking_group_users WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+SELECT * FROM matchmaking_group_maps WHERE matchmaking_group_id NOT IN (SELECT id FROM matchmaking_groups);
+
+--echo #
+--echo # Rows with id=11 should be present
+--echo #
+SELECT * FROM matchmaking_group_users;
+SELECT * FROM matchmaking_group_maps;
+
+--connection master
+DELETE FROM users WHERE id = 2;
+--sync_slave_with_master
+
+--echo #
+--echo # No rows should be present in both the child tables
+--echo #
+SELECT * FROM matchmaking_group_users;
+SELECT * FROM matchmaking_group_maps;
+
+--connection master
+DROP TABLE matchmaking_group_maps, matchmaking_group_users, matchmaking_groups, users;
+--sync_slave_with_master
+
+--echo #
+--echo # Test case 3: KEY on a virtual column with ON UPDATE CASCADE
+--echo #
+
+--connection master
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 80);
+
+CREATE TABLE t2 (a INT KEY, b INT,
+ v_col int as (b+1) virtual, KEY (v_col),
+ CONSTRAINT b FOREIGN KEY (b) REFERENCES t1(a) ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (51, 1, default);
+--sync_slave_with_master
+
+--connection master
+UPDATE t1 SET a = 50 WHERE a = 1;
+
+--echo #
+--echo # Master: Verify that ON UPDATE CASCADE works fine
+--echo # old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51)
+--echo #
+SELECT * FROM t2 WHERE b=50;
+--sync_slave_with_master
+
+--echo #
+--echo # Slave: Verify that ON UPDATE CASCADE works fine
+--echo # old_row: (51, 1, 2) ON UPDATE New_row: (51, 50, 51)
+--echo #
+SELECT * FROM t2 WHERE b=50;
+
+--connection master
+DROP TABLE t2, t1;
+--sync_slave_with_master
+
+--echo #
+--echo # Test case 4: Define triggers on master, their results should be
+--echo # replicated as part of row events and they should be
+--echo # applied on slave with the default
+--echo # slave_run_triggers_for_rbr=NO
+--echo #
+
+# In row-based replication, the binary log contains row changes. It will have
+# both the changes made by the statement itself, and the changes made by the
+# triggers that were invoked by the statement. Slave server(s) do not need to
+# run triggers for row changes they are applying. Hence verify that this
+# property remains the same and data should be available as if trigger was
+# executed. Please note by default slave_run_triggers_for_rbr=NO.
+
+--connection master
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (count INT NOT NULL) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (2),(3);
+--sync_slave_with_master
+
+SHOW GLOBAL VARIABLES LIKE 'slave_run_triggers_for_rbr';
+--echo #
+--echo # As two rows are inserted in table 't1', two rows should get inserted
+--echo # into table 't2' as part of trigger.
+--echo #
+--let $assert_cond= COUNT(*) = 2 FROM t2
+--let $assert_text= Table t2 should have two rows.
+--source include/assert.inc
+
+--connection master
+DROP TABLE t1,t2;
+--sync_slave_with_master
+
+--echo #
+--echo # Test case 5: Define triggers + Foreign Keys on master, their results
+--echo # should be replicated as part of row events and master
+--echo # and slave should be in sync.
+--echo #
+--connection master
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+ v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+ CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (1);
+
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+--sync_slave_with_master
+
+--echo #
+--echo # As two rows are inserted in table 't1', two rows should get inserted
+--echo # into table 't3' as part of trigger.
+--echo #
+--let $assert_cond= COUNT(*) = 2 FROM t3
+--let $assert_text= Table t3 should have two rows.
+--source include/assert.inc
+
+--echo #
+--echo # Verify ON DELETE CASCASE correctness
+--echo #
+--connection master
+DELETE FROM t1 WHERE id=2;
+--sync_slave_with_master
+
+--connection master
+--let $diff_tables= master:test.t1, slave:test.t1
+--source include/diff_tables.inc
+--let $diff_tables= master:test.t2, slave:test.t2
+--source include/diff_tables.inc
+--let $diff_tables= master:test.t3, slave:test.t3
+--source include/diff_tables.inc
+
+DROP TABLE t3,t2,t1;
+--sync_slave_with_master
+
+#
+# Test case: Triggers only on slave
+#
+--write_file $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc PROCEDURE
+ if ($slave_run_triggers_for_rbr == '') {
+ --die !!!ERROR IN TEST: you must set $slave_run_triggers_for_rbr
+ }
+
+--connection slave
+SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr;
+--eval SET GLOBAL slave_run_triggers_for_rbr= $slave_run_triggers_for_rbr;
+SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%';
+
+--connection master
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (t1_id INT NOT NULL,
+ v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col),
+ KEY (t1_id), CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+--sync_slave_with_master
+
+CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1);
+
+--connection master
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+--sync_slave_with_master
+
+if ($slave_run_triggers_for_rbr == 'NO') {
+--echo #
+--echo # Count must be 0
+--echo #
+--let $assert_cond= COUNT(*) = 0 FROM t3
+--let $assert_text= Table t3 should have zero rows.
+--source include/assert.inc
+}
+if ($slave_run_triggers_for_rbr == 'YES') {
+--echo #
+--echo # Count must be 2
+--echo #
+--let $assert_cond= COUNT(*) = 2 FROM t3
+--let $assert_text= Table t3 should have two rows.
+--source include/assert.inc
+}
+
+--connection master
+DELETE FROM t1 WHERE id=2;
+--sync_slave_with_master
+SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr;
+
+--echo #
+--echo # Verify t1, t2 are consistent on slave.
+--echo #
+--let $diff_tables= master:test.t1, slave:test.t1
+--source include/diff_tables.inc
+--let $diff_tables= master:test.t2, slave:test.t2
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t3,t2,t1;
+--sync_slave_with_master
+#END OF
+PROCEDURE
+
+--echo #
+--echo # Test case 6: Triggers are present only on slave and
+--echo # 'slave_run_triggers_for_rbr=NO'
+--echo #
+--let $slave_run_triggers_for_rbr=NO
+--source $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc
+
+--echo #
+--echo # Test case 7: Triggers are present only on slave and
+--echo # 'slave_run_triggers_for_rbr=YES'
+--echo #
+--let $slave_run_triggers_for_rbr=YES
+--source $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc
+--remove_file $MYSQLTEST_VARDIR/tmp/trig_on_slave.inc
+
+#
+# Test case: Trigger and Foreign Key are present only on slave
+#
+--write_file $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc PROCEDURE
+ if ($slave_run_triggers_for_rbr == '') {
+ --die !!!ERROR IN TEST: you must set $slave_run_triggers_for_rbr
+ }
+
+--connection slave
+SET @save_slave_run_triggers_for_rbr= @@GLOBAL.slave_run_triggers_for_rbr;
+--eval SET GLOBAL slave_run_triggers_for_rbr= $slave_run_triggers_for_rbr;
+SHOW GLOBAL VARIABLES LIKE '%slave_run_triggers_for_rbr%';
+
+--connection master
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET sql_log_bin=0;
+CREATE TABLE t2 (t1_id INT NOT NULL,v_col INT AS (t1_id+1) VIRTUAL) ENGINE=INNODB;
+SET sql_log_bin=1;
+CREATE TABLE t3 (count INT NOT NULL) ENGINE=InnoDB;
+--sync_slave_with_master
+
+# Have foreign key and trigger on slave.
+CREATE TABLE t2 (t1_id INT NOT NULL,
+ v_col INT AS (t1_id+1) VIRTUAL, KEY (v_col), KEY (t1_id),
+ CONSTRAINT a FOREIGN KEY (t1_id) REFERENCES t1 (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TRIGGER trg AFTER INSERT ON t2 FOR EACH ROW INSERT INTO t3 VALUES (1);
+
+--connection master
+INSERT INTO t1 VALUES (2),(3);
+INSERT INTO t2 VALUES (2, default), (3, default);
+--sync_slave_with_master
+
+if ($slave_run_triggers_for_rbr == 'NO') {
+--echo #
+--echo # Count must be 0
+--echo #
+--let $assert_cond= COUNT(*) = 0 FROM t3
+--let $assert_text= Table t3 should have zero rows.
+--source include/assert.inc
+}
+if ($slave_run_triggers_for_rbr == 'YES') {
+--echo #
+--echo # Count must be 2
+--echo #
+--let $assert_cond= COUNT(*) = 2 FROM t3
+--let $assert_text= Table t3 should have two rows.
+--source include/assert.inc
+}
+
+--connection master
+DELETE FROM t1 WHERE id=2;
+--echo # t1: Should have one row
+SELECT * FROM t1;
+--echo # t2: Should have two rows
+SELECT * FROM t2;
+--sync_slave_with_master
+--echo # t1: Should have one row
+SELECT * FROM t1;
+--echo # t2: Should have one row on slave due to ON DELETE CASCASE
+SELECT * FROM t2;
+SET GLOBAL slave_run_triggers_for_rbr= @save_slave_run_triggers_for_rbr;
+
+--connection master
+DROP TABLE t3,t2,t1;
+--sync_slave_with_master
+#END OF
+PROCEDURE
+
+--echo #
+--echo # Test case 8: Triggers and Foreign Keys are present only on slave and
+--echo # 'slave_run_triggers_for_rbr=NO'
+--echo #
+--let $slave_run_triggers_for_rbr=NO
+--source $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc
+
+--echo #
+--echo # Test case 9: Triggers are Foreign Keys are present only on slave and
+--echo # 'slave_run_triggers_for_rbr=YES'
+--echo #
+--let $slave_run_triggers_for_rbr=YES
+--source $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc
+--remove_file $MYSQLTEST_VARDIR/tmp/trig_fk_on_slave.inc
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test
index 2d91d2e4118..f8726deb61d 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test
@@ -1,4 +1,5 @@
--source include/have_binlog_format_statement.inc
+--source include/have_semisync.inc
set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
source rpl_semi_sync.test;
set global rpl_semi_sync_master_wait_point=default;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test
index 47af6c34fcf..3e89bed640b 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test
@@ -1,4 +1,5 @@
--source include/have_binlog_format_row.inc
+--source include/have_semisync.inc
set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
source rpl_semi_sync.test;
set global rpl_semi_sync_master_wait_point=default;
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test
index 527900fd949..9bca4965f15 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event_after_sync.test
@@ -1,3 +1,4 @@
+source include/have_semisync.inc;
set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
source rpl_semi_sync_event.test;
set global rpl_semi_sync_master_wait_point=default;
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index fb30c5708bc..637dda47489 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -7,8 +7,6 @@ source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
set local sql_mode='';
-set global sql_mode='';
-
# we need a db != test, where we don't have automatic grants
--disable_warnings
drop database if exists mysqltest1;
@@ -199,9 +197,11 @@ delimiter ;|
delete t1,t2 from t1,t2;
select fn1(20);
insert into t2 values(fn1(21));
+--sorted_result
select * from t1;
select * from t2;
sync_slave_with_master;
+--sorted_result
select * from t1;
select * from t2;
@@ -728,4 +728,3 @@ drop procedure p1;
# Cleanup
sync_slave_with_master;
--source include/rpl_end.inc
-set global sql_mode=default;
diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt b/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables.test b/mysql-test/suite/rpl/t/rpl_spec_variables.test
index 2cb580fce83..e2d5175036c 100644
--- a/mysql-test/suite/rpl/t/rpl_spec_variables.test
+++ b/mysql-test/suite/rpl/t/rpl_spec_variables.test
@@ -260,10 +260,12 @@ DROP TABLE IF EXISTS t1,t2,t3;
--echo * sql_mode *
--connection master
+SET @old_sql_mode_master= @@global.sql_mode;
SET @@global.sql_mode=ANSI;
SET @@session.sql_mode=ANSI;
--connection slave
+SET @old_sql_mode_slave= @@global.sql_mode;
SET @@global.sql_mode=TRADITIONAL;
SET @@session.sql_mode=TRADITIONAL;
@@ -292,14 +294,16 @@ DROP TABLE t1;
SET @@global.character_set_database=@restore_master_character_set_database;
SET @@global.collation_server=@restore_master_collation_server;
SET @@global.storage_engine=@restore_master_storage_engine;
+SET @@global.sql_mode=@old_sql_mode_master;
--sync_slave_with_master
SET @@global.character_set_database=@restore_slave_character_set_database;
SET @@global.collation_server=@restore_slave_collation_server;
SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size;
SET @@global.storage_engine=@restore_slave_storage_engine;
-
+SET @@global.sql_mode=@old_sql_mode_slave;
# Put at the end since the test otherwise emptied the table.
-
+remove_file $MYSQLTEST_VARDIR/tmp/words.dat;
+remove_file $MYSQLTEST_VARDIR/tmp/words2.dat;
--echo
call mtr.add_suppression("The table 't[12]' is full");
diff --git a/mysql-test/suite/rpl/t/rpl_table_options.test b/mysql-test/suite/rpl/t/rpl_table_options.test
index 3f52444a3c7..6dd1c9bd20d 100644
--- a/mysql-test/suite/rpl/t/rpl_table_options.test
+++ b/mysql-test/suite/rpl/t/rpl_table_options.test
@@ -18,6 +18,7 @@ connection master;
# the option is unknown.
#
create table t1 (a int not null) ull=12340;
+alter table t1 ull=12350;
show create table t1;
sync_slave_with_master;
diff --git a/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result
index a2c328f38fd..915343fcff2 100644
--- a/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_idle_flush_pct_basic.result
@@ -24,6 +24,8 @@ select * from information_schema.session_variables where variable_name='innodb_i
VARIABLE_NAME VARIABLE_VALUE
INNODB_IDLE_FLUSH_PCT 100
set global innodb_idle_flush_pct=10;
+Warnings:
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
select @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
10
@@ -44,6 +46,7 @@ ERROR 42000: Incorrect argument type to variable 'innodb_idle_flush_pct'
set global innodb_idle_flush_pct=-7;
Warnings:
Warning 1292 Truncated incorrect innodb_idle_flush_pct value: '-7'
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
select @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
0
@@ -53,6 +56,7 @@ INNODB_IDLE_FLUSH_PCT 0
set global innodb_idle_flush_pct=106;
Warnings:
Warning 1292 Truncated incorrect innodb_idle_flush_pct value: '106'
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
select @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
100
@@ -60,18 +64,26 @@ select * from information_schema.global_variables where variable_name='innodb_id
VARIABLE_NAME VARIABLE_VALUE
INNODB_IDLE_FLUSH_PCT 100
set global innodb_idle_flush_pct=0;
+Warnings:
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
select @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
0
set global innodb_idle_flush_pct=100;
+Warnings:
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
select @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
100
set global innodb_idle_flush_pct=DEFAULT;
+Warnings:
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
select @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
100
SET @@global.innodb_idle_flush_pct = @start_global_value;
+Warnings:
+Warning 131 innodb_idle_flush_pct is DEPRECATED and has no effect.
SELECT @@global.innodb_idle_flush_pct;
@@global.innodb_idle_flush_pct
100
diff --git a/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result b/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result
deleted file mode 100644
index 7a6c9ca2db6..00000000000
--- a/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result
+++ /dev/null
@@ -1,77 +0,0 @@
-SET @start_global_value = @@global.innodb_simulate_comp_failures;
-SELECT @start_global_value;
-@start_global_value
-0
-Valid values are between 0 and 99
-select @@global.innodb_simulate_comp_failures between 0 and 99;
-@@global.innodb_simulate_comp_failures between 0 and 99
-1
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-0
-select @@session.innodb_simulate_comp_failures;
-ERROR HY000: Variable 'innodb_simulate_comp_failures' is a GLOBAL variable
-show global variables like 'innodb_simulate_comp_failures';
-Variable_name Value
-innodb_simulate_comp_failures 0
-show session variables like 'innodb_simulate_comp_failures';
-Variable_name Value
-innodb_simulate_comp_failures 0
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_SIMULATE_COMP_FAILURES 0
-select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_SIMULATE_COMP_FAILURES 0
-set global innodb_simulate_comp_failures=10;
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-10
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_SIMULATE_COMP_FAILURES 10
-select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_SIMULATE_COMP_FAILURES 10
-set session innodb_simulate_comp_failures=1;
-ERROR HY000: Variable 'innodb_simulate_comp_failures' is a GLOBAL variable and should be set with SET GLOBAL
-set global innodb_simulate_comp_failures=1.1;
-ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures'
-set global innodb_simulate_comp_failures=1e1;
-ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures'
-set global innodb_simulate_comp_failures="foo";
-ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures'
-set global innodb_simulate_comp_failures=-7;
-Warnings:
-Warning 1292 Truncated incorrect innodb_simulate_comp_failures value: '-7'
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-0
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_SIMULATE_COMP_FAILURES 0
-set global innodb_simulate_comp_failures=106;
-Warnings:
-Warning 1292 Truncated incorrect innodb_simulate_comp_failures value: '106'
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-99
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_SIMULATE_COMP_FAILURES 99
-set global innodb_simulate_comp_failures=0;
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-0
-set global innodb_simulate_comp_failures=99;
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-99
-set global innodb_simulate_comp_failures=DEFAULT;
-select @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-0
-SET @@global.innodb_simulate_comp_failures = @start_global_value;
-SELECT @@global.innodb_simulate_comp_failures;
-@@global.innodb_simulate_comp_failures
-0
diff --git a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result
deleted file mode 100644
index b48b045897c..00000000000
--- a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result
+++ /dev/null
@@ -1,199 +0,0 @@
-SET @start_global_value = @@global.max_sort_length;
-SELECT @start_global_value;
-@start_global_value
-1024
-SET @start_session_value = @@session.max_sort_length;
-SELECT @start_session_value;
-@start_session_value
-1024
-'#--------------------FN_DYNVARS_084_01-------------------------#'
-SET @@global.max_sort_length = 1000;
-SET @@global.max_sort_length = DEFAULT;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-1024
-SET @@session.max_sort_length = 1000;
-SET @@session.max_sort_length = DEFAULT;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-1024
-'#--------------------FN_DYNVARS_084_02-------------------------#'
-SET @@global.max_sort_length = DEFAULT;
-SELECT @@global.max_sort_length = 1024;
-@@global.max_sort_length = 1024
-1
-SET @@session.max_sort_length = DEFAULT;
-SELECT @@session.max_sort_length = 1024;
-@@session.max_sort_length = 1024
-1
-'#--------------------FN_DYNVARS_084_03-------------------------#'
-SET @@global.max_sort_length = 8;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@global.max_sort_length = 9;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-9
-SET @@global.max_sort_length = 8388608;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8388608
-SET @@global.max_sort_length = 8388607;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8388607
-SET @@global.max_sort_length = 65536;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-65536
-'#--------------------FN_DYNVARS_084_04-------------------------#'
-SET @@session.max_sort_length = 8;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8
-SET @@session.max_sort_length = 9;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-9
-SET @@session.max_sort_length = 8388608;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8388608
-SET @@session.max_sort_length = 8388607;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8388607
-SET @@session.max_sort_length = 65536;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-65536
-'#------------------FN_DYNVARS_084_05-----------------------#'
-SET @@global.max_sort_length = -1024;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '-1024'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@global.max_sort_length = 3;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '3'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@global.max_sort_length = 8388609;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '8388609'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8388608
-SET @@global.max_sort_length = 0;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '0'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@global.max_sort_length = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'max_sort_length'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@global.max_sort_length = test;
-ERROR 42000: Incorrect argument type to variable 'max_sort_length'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@session.max_sort_length = 8388610;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '8388610'
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8388608
-SET @@session.max_sort_length = -1;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '-1'
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8
-SET @@session.max_sort_length = 3;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '3'
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8
-SET @@session.max_sort_length = 0;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '0'
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8
-SET @@session.max_sort_length = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'max_sort_length'
-SET @@session.max_sort_length = 10737418241;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '10737418241'
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8388608
-SET @@session.max_sort_length = test;
-ERROR 42000: Incorrect argument type to variable 'max_sort_length'
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-8388608
-'#------------------FN_DYNVARS_084_06-----------------------#'
-SELECT @@global.max_sort_length = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='max_sort_length';
-@@global.max_sort_length = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_084_07-----------------------#'
-SELECT @@session.max_sort_length = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='max_sort_length';
-@@session.max_sort_length = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_084_08-----------------------#'
-SET @@global.max_sort_length = TRUE;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '1'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-SET @@global.max_sort_length = FALSE;
-Warnings:
-Warning 1292 Truncated incorrect max_sort_length value: '0'
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-8
-'#---------------------FN_DYNVARS_084_09----------------------#'
-SET @@global.max_sort_length = 2048;
-SELECT @@max_sort_length = @@global.max_sort_length;
-@@max_sort_length = @@global.max_sort_length
-0
-'#---------------------FN_DYNVARS_084_10----------------------#'
-SET @@max_sort_length = 100000;
-SELECT @@max_sort_length = @@local.max_sort_length;
-@@max_sort_length = @@local.max_sort_length
-1
-SELECT @@local.max_sort_length = @@session.max_sort_length;
-@@local.max_sort_length = @@session.max_sort_length
-1
-'#---------------------FN_DYNVARS_084_11----------------------#'
-SET max_sort_length = 1024;
-SELECT @@max_sort_length;
-@@max_sort_length
-1024
-SELECT local.max_sort_length;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT session.max_sort_length;
-ERROR 42S02: Unknown table 'session' in field list
-SELECT max_sort_length = @@session.max_sort_length;
-ERROR 42S22: Unknown column 'max_sort_length' in 'field list'
-SET @@global.max_sort_length = @start_global_value;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-1024
-SET @@session.max_sort_length = @start_session_value;
-SELECT @@session.max_sort_length;
-@@session.max_sort_length
-1024
diff --git a/mysql-test/suite/sys_vars/r/max_sort_length_func.result b/mysql-test/suite/sys_vars/r/max_sort_length_func.result
index 36f5518287a..3ec8faf1b7e 100644
--- a/mysql-test/suite/sys_vars/r/max_sort_length_func.result
+++ b/mysql-test/suite/sys_vars/r/max_sort_length_func.result
@@ -1,301 +1,279 @@
SET @start_value= @@global.max_sort_length;
-SET @session_max_sort_length = @@Session.max_sort_length;
-DROP TABLE IF EXISTS t;
** creating tables **
-CREATE TABLE t
-(
-id INT AUTO_INCREMENT PRIMARY KEY,
-c TEXT(30)
-);
-CREATE TABLE t1
-(
-id INT AUTO_INCREMENT PRIMARY KEY,
-c BLOB(30)
-);
-CREATE TABLE t2
-(
-id INT AUTO_INCREMENT PRIMARY KEY,
-c TEXT(30)
-);
+CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, c BLOB);
+CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
'#--------------------FN_DYNVARS_098_01-------------------------#'
connect test_con1,localhost,root,,;
-connection test_con1;
-SELECT @@global.max_sort_length = 10;
-@@global.max_sort_length = 10
-0
-SELECT @@session.max_sort_length = 10;
-@@session.max_sort_length = 10
-0
-** Setting value to 30 and inserting data **
-SET @@global.max_sort_length = 30;
+** Setting value to 70 and inserting data **
+SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
@@global.max_sort_length
-30
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+70
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
** Results should be sorted **
-SET @@session.max_sort_length = 29;
+SET @@session.max_sort_length = 69;
SELECT @@session.max_sort_length;
@@session.max_sort_length
-29
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+69
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
** Results should be sorted **
'#--------------------FN_DYNVARS_098_02-------------------------#'
connect test_con2,localhost,root,,;
-connection test_con2;
-SET @@global.max_sort_length = 30;
+SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
@@global.max_sort_length
-30
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+70
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
** Results should be sorted **
-SET @@session.max_sort_length = 20;
+SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
@@session.max_sort_length
-20
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+64
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
** Results should not be sorted **
'#--------------------FN_DYNVARS_098_03-------------------------#'
-SET max_sort_length=20;
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+SET max_sort_length=64;
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
** Results should not be sorted **
RESET QUERY CACHE;
'#--------------------FN_DYNVARS_098_04-------------------------#'
-SET max_sort_length=29;
+SET max_sort_length=69;
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
** Results should be sorted **
'#--------------------FN_DYNVARS_098_05-------------------------#'
-SET max_sort_length=30;
+SET max_sort_length=70;
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
** Results should be sorted **
'#--------------------FN_DYNVARS_098_06-------------------------#'
SET max_sort_length=default;
+SELECT @@max_sort_length;
+@@max_sort_length
+70
SELECT c from t ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
** Results should be sorted **
'#--------------------FN_DYNVARS_098_07-------------------------#'
Testing type BLOB
-SET @@global.max_sort_length = 30;
-SELECT @@global.max_sort_length;
-@@global.max_sort_length
-30
-INSERT INTO t1 set c = repeat('x',29);
-INSERT INTO t1 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t1 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t1 set c = concat(repeat('x',28),'g','w');
-SELECT c from t1 ORDER BY c, id;
+SET @@max_sort_length = 70;
+SELECT @@max_sort_length;
+@@max_sort_length
+70
+INSERT INTO t1 set c = repeat('x',69);
+INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
+SELECT c from t1 ORDER BY c, id DESC;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
** Results should be sorted **
-SET @@session.max_sort_length = 20;
+SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
@@session.max_sort_length
-20
-INSERT INTO t1 set c = repeat('x',29);
-INSERT INTO t1 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t1 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t1 set c = concat(repeat('x',28),'g','w');
+64
+INSERT INTO t1 set c = repeat('x',69);
+INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
SELECT c from t1 ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
** Results should not be sorted **
'#--------------------FN_DYNVARS_098_08-------------------------#'
Testing type CHAR
-SET @@global.max_sort_length = 30;
+SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
@@global.max_sort_length
-30
-INSERT INTO t2 set c = repeat('x',29);
-INSERT INTO t2 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t2 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t2 set c = concat(repeat('x',28),'g','w');
+70
+INSERT INTO t2 set c = repeat('x',69);
+INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
SELECT c from t2 ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
** Results should not be sorted **
-SET @@session.max_sort_length = 20;
+SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
@@session.max_sort_length
-20
-INSERT INTO t2 set c = repeat('x',29);
-INSERT INTO t2 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t2 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t2 set c = concat(repeat('x',28),'g','w');
+64
+INSERT INTO t2 set c = repeat('x',69);
+INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
SELECT c from t2 ORDER BY c, id;
c
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrx
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsy
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw
** Results should not be sorted **
connection default;
disconnect test_con1;
disconnect test_con2;
-SET @@SESSION.max_sort_length = @session_max_sort_length;
-DROP TABLE IF EXISTS t;
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
+DROP TABLE t, t1, t2;
SET @@global.max_sort_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
index 0e4bb7cf7d6..0a1954f6cd5 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -331,7 +331,7 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so.
+ VARIABLE_COMMENT DEPRECATED. This setting has no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
@@ -1306,22 +1306,22 @@
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 89138c2fedd..440efc6a9cd 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -1283,7 +1283,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so.
+VARIABLE_COMMENT DEPRECATED. This setting has no effect.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
NUMERIC_BLOCK_SIZE 0
@@ -2202,18 +2202,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
-SESSION_VALUE NULL
-DEFAULT_VALUE 0
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Simulate compression failures.
-NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 99
-NUMERIC_BLOCK_SIZE 0
-ENUM_VALUE_LIST NULL
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_SORT_BUFFER_SIZE
SESSION_VALUE NULL
DEFAULT_VALUE 1048576
@@ -2603,7 +2591,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Enable atomic writes, instead of using the doublewrite buffer, for files on devices that supports atomic writes. To use this option one must use file_per_table=1, flush_method=O_DIRECT and use_fallocate=1. This option only works on Linux with either FusionIO cards using the directFS filesystem or with Shannon cards using any file system.
+VARIABLE_COMMENT Enable atomic writes, instead of using the doublewrite buffer, for files on devices that supports atomic writes. This option only works on Linux with either FusionIO cards using the directFS filesystem or with Shannon cards using any file system.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 87795f802e2..5ccabeecf2d 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -944,10 +944,10 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME GROUP_CONCAT_MAX_LEN
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT()
NUMERIC_MIN_VALUE 4
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1766,7 +1766,7 @@ VARIABLE_NAME MAX_SORT_LENGTH
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT 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 8
+NUMERIC_MIN_VALUE 64
NUMERIC_MAX_VALUE 8388608
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
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 aaaf1afb8b7..42c236bf54a 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -964,10 +964,10 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME GROUP_CONCAT_MAX_LEN
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT()
NUMERIC_MIN_VALUE 4
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1906,7 +1906,7 @@ VARIABLE_NAME MAX_SORT_LENGTH
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT 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 8
+NUMERIC_MIN_VALUE 64
NUMERIC_MAX_VALUE 8388608
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index e54afd2d64a..67e15405313 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -349,7 +349,7 @@ NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
-READ_ONLY NO
+READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_ON
SESSION_VALUE OFF
@@ -405,7 +405,7 @@ NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
-READ_ONLY NO
+READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_PROVIDER_OPTIONS
SESSION_VALUE NULL
diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
deleted file mode 100644
index 056ff8c817b..00000000000
--- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# wsrep_notify_cmd
-#
-call mtr.add_suppression("WSREP: Failed to get provider options");
-# save the initial value
-SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd;
-# default
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-
-
-# scope
-SELECT @@session.wsrep_notify_cmd;
-ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable
-SET @@global.wsrep_notify_cmd='notify_cmd';
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-notify_cmd
-
-# valid values
-SET @@global.wsrep_notify_cmd='command';
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-command
-SET @@global.wsrep_notify_cmd='hyphenated-command';
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-hyphenated-command
-SET @@global.wsrep_notify_cmd=default;
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-
-SET @@global.wsrep_notify_cmd=NULL;
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-NULL
-
-# invalid values
-SET @@global.wsrep_notify_cmd=1;
-ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd'
-SELECT @@global.wsrep_notify_cmd;
-@@global.wsrep_notify_cmd
-NULL
-
-# restore the initial value
-SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved;
-# End of test
diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
deleted file mode 100644
index 3e4ac8ca883..00000000000
--- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# wsrep_provider
-#
-# save the initial value
-SET @wsrep_provider_global_saved = @@global.wsrep_provider;
-# default
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# scope
-SELECT @@session.wsrep_provider;
-ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# valid values
-SET @@global.wsrep_provider=default;
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# invalid values
-SET @@global.wsrep_provider='/invalid/libgalera_smm.so';
-ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so'
-SET @@global.wsrep_provider=NULL;
-ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL'
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-SET @@global.wsrep_provider=1;
-ERROR 42000: Incorrect argument type to variable 'wsrep_provider'
-SELECT @@global.wsrep_provider;
-@@global.wsrep_provider
-none
-
-# restore the initial value
-SET @@global.wsrep_provider = @wsrep_provider_global_saved;
-# End of test
diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
deleted file mode 100644
index b2e07c55b38..00000000000
--- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# wsrep_provider_options
-#
-call mtr.add_suppression("WSREP: Failed to get provider options");
-SET @@global.wsrep_provider = @@global.wsrep_provider;
-# save the initial value
-SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options;
-# default
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-
-# scope
-SELECT @@session.wsrep_provider_options;
-ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable
-SET @@global.wsrep_provider_options='option1';
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-option1
-
-# valid values
-SET @@global.wsrep_provider_options='name1=value1;name2=value2';
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-name1=value1;name2=value2
-SET @@global.wsrep_provider_options='hyphenated-name:value';
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-hyphenated-name:value
-SET @@global.wsrep_provider_options=default;
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-
-# invalid values
-SET @@global.wsrep_provider_options=1;
-ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options'
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-
-SET @@global.wsrep_provider_options=NULL;
-Got one of the listed errors
-SELECT @@global.wsrep_provider_options;
-@@global.wsrep_provider_options
-NULL
-
-# restore the initial value
-SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved;
-# End of test
diff --git a/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test b/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test
deleted file mode 100644
index 07e70bf7343..00000000000
--- a/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test
+++ /dev/null
@@ -1,65 +0,0 @@
---source include/have_innodb.inc
---source include/have_debug.inc
-
-SET @start_global_value = @@global.innodb_simulate_comp_failures;
-SELECT @start_global_value;
-
-#
-# exists as global only
-#
-
---echo Valid values are between 0 and 99
-select @@global.innodb_simulate_comp_failures between 0 and 99;
-select @@global.innodb_simulate_comp_failures;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.innodb_simulate_comp_failures;
-
-show global variables like 'innodb_simulate_comp_failures';
-show session variables like 'innodb_simulate_comp_failures';
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures';
-
-#
-# show that it's writable
-#
-
-set global innodb_simulate_comp_failures=10;
-select @@global.innodb_simulate_comp_failures;
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures';
-
---error ER_GLOBAL_VARIABLE
-set session innodb_simulate_comp_failures=1;
-
-#
-# incorrect types
-#
-
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_simulate_comp_failures=1.1;
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_simulate_comp_failures=1e1;
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_simulate_comp_failures="foo";
-
-set global innodb_simulate_comp_failures=-7;
-select @@global.innodb_simulate_comp_failures;
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-set global innodb_simulate_comp_failures=106;
-select @@global.innodb_simulate_comp_failures;
-select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures';
-
-#
-# min/max/DEFAULT values
-#
-
-set global innodb_simulate_comp_failures=0;
-select @@global.innodb_simulate_comp_failures;
-set global innodb_simulate_comp_failures=99;
-select @@global.innodb_simulate_comp_failures;
-set global innodb_simulate_comp_failures=DEFAULT;
-select @@global.innodb_simulate_comp_failures;
-
-SET @@global.innodb_simulate_comp_failures = @start_global_value;
-SELECT @@global.innodb_simulate_comp_failures;
diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test
deleted file mode 100644
index fcd6db017f1..00000000000
--- a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test
+++ /dev/null
@@ -1,225 +0,0 @@
-############## mysql-test\t\max_sort_length_basic.test ###############
-# #
-# Variable Name: max_sort_length #
-# Scope: GLOBAL | SESSION #
-# Access Type: Dynamic #
-# Data Type: numeric #
-# Default Value: 1024 #
-# Range: 4-8388608 #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Salman #
-# #
-# Description: Test Cases of Dynamic System Variable max_sort_length #
-# that checks the behavior of this variable in the following ways#
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-###############################################################################
-
---source include/load_sysvars.inc
-
-
-############################################
-# START OF max_sort_length TESTS #
-############################################
-
-
-#############################################################
-# Save initial value #
-#############################################################
-
-SET @start_global_value = @@global.max_sort_length;
-SELECT @start_global_value;
-SET @start_session_value = @@session.max_sort_length;
-SELECT @start_session_value;
-
-
---echo '#--------------------FN_DYNVARS_084_01-------------------------#'
-#######################################################
-# Display the DEFAULT value of max_sort_length #
-#######################################################
-
-SET @@global.max_sort_length = 1000;
-SET @@global.max_sort_length = DEFAULT;
-SELECT @@global.max_sort_length;
-
-
-SET @@session.max_sort_length = 1000;
-SET @@session.max_sort_length = DEFAULT;
-SELECT @@session.max_sort_length;
-
-
---echo '#--------------------FN_DYNVARS_084_02-------------------------#'
-#######################################################
-# Check the DEFAULT value of max_sort_length #
-#######################################################
-
-SET @@global.max_sort_length = DEFAULT;
-SELECT @@global.max_sort_length = 1024;
-
-SET @@session.max_sort_length = DEFAULT;
-SELECT @@session.max_sort_length = 1024;
-
-
-
---echo '#--------------------FN_DYNVARS_084_03-------------------------#'
-#########################################################################
-# Change the value of max_sort_length to a valid value for GLOBAL Scope #
-#########################################################################
-
-SET @@global.max_sort_length = 8;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 9;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 8388608;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 8388607;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 65536;
-SELECT @@global.max_sort_length;
-
---echo '#--------------------FN_DYNVARS_084_04-------------------------#'
-##########################################################################
-# Change the value of max_sort_length to a valid value for SESSION Scope #
-##########################################################################
-
-SET @@session.max_sort_length = 8;
-SELECT @@session.max_sort_length;
-
-SET @@session.max_sort_length = 9;
-SELECT @@session.max_sort_length;
-
-SET @@session.max_sort_length = 8388608;
-SELECT @@session.max_sort_length;
-
-SET @@session.max_sort_length = 8388607;
-SELECT @@session.max_sort_length;
-
-SET @@session.max_sort_length = 65536;
-SELECT @@session.max_sort_length;
-
-
---echo '#------------------FN_DYNVARS_084_05-----------------------#'
-###########################################################
-# Change the value of max_sort_length to an invalid value #
-###########################################################
-
-SET @@global.max_sort_length = -1024;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 3;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 8388609;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 0;
-SELECT @@global.max_sort_length;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.max_sort_length = 65530.34;
-SELECT @@global.max_sort_length;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.max_sort_length = test;
-SELECT @@global.max_sort_length;
-
-SET @@session.max_sort_length = 8388610;
-SELECT @@session.max_sort_length;
-SET @@session.max_sort_length = -1;
-SELECT @@session.max_sort_length;
-SET @@session.max_sort_length = 3;
-SELECT @@session.max_sort_length;
-SET @@session.max_sort_length = 0;
-SELECT @@session.max_sort_length;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.max_sort_length = 65530.34;
-SET @@session.max_sort_length = 10737418241;
-SELECT @@session.max_sort_length;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.max_sort_length = test;
-SELECT @@session.max_sort_length;
-
-
---echo '#------------------FN_DYNVARS_084_06-----------------------#'
-####################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-####################################################################
-
-
-SELECT @@global.max_sort_length = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='max_sort_length';
-
---echo '#------------------FN_DYNVARS_084_07-----------------------#'
-####################################################################
-# Check if the value in SESSION Table matches value in variable #
-####################################################################
-
-SELECT @@session.max_sort_length = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='max_sort_length';
-
-
---echo '#------------------FN_DYNVARS_084_08-----------------------#'
-####################################################################
-# Check if TRUE and FALSE values can be used on variable #
-####################################################################
-
-SET @@global.max_sort_length = TRUE;
-SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = FALSE;
-SELECT @@global.max_sort_length;
-
-
---echo '#---------------------FN_DYNVARS_084_09----------------------#'
-#################################################################################
-# Check if accessing variable with and without GLOBAL point to same variable #
-#################################################################################
-
-SET @@global.max_sort_length = 2048;
-SELECT @@max_sort_length = @@global.max_sort_length;
-
-
---echo '#---------------------FN_DYNVARS_084_10----------------------#'
-########################################################################################################
-# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
-########################################################################################################
-
-SET @@max_sort_length = 100000;
-SELECT @@max_sort_length = @@local.max_sort_length;
-SELECT @@local.max_sort_length = @@session.max_sort_length;
-
-
---echo '#---------------------FN_DYNVARS_084_11----------------------#'
-##########################################################################
-# Check if max_sort_length can be accessed with and without @@ sign #
-##########################################################################
-
-
-SET max_sort_length = 1024;
-SELECT @@max_sort_length;
---Error ER_UNKNOWN_TABLE
-SELECT local.max_sort_length;
---Error ER_UNKNOWN_TABLE
-SELECT session.max_sort_length;
---Error ER_BAD_FIELD_ERROR
-SELECT max_sort_length = @@session.max_sort_length;
-
-
-####################################
-# Restore initial value #
-####################################
-
-SET @@global.max_sort_length = @start_global_value;
-SELECT @@global.max_sort_length;
-SET @@session.max_sort_length = @start_session_value;
-SELECT @@session.max_sort_length;
-
-
-####################################################
-# END OF max_sort_length TESTS #
-####################################################
-
diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_func.test b/mysql-test/suite/sys_vars/t/max_sort_length_func.test
index fd0b87750a1..d54453a57b6 100644
--- a/mysql-test/suite/sys_vars/t/max_sort_length_func.test
+++ b/mysql-test/suite/sys_vars/t/max_sort_length_func.test
@@ -26,70 +26,40 @@
SET @start_value= @@global.max_sort_length;
-SET @session_max_sort_length = @@Session.max_sort_length;
-
-
---disable_warnings
-DROP TABLE IF EXISTS t;
---enable_warnings
-
#########################
# Creating new table #
#########################
-
--echo ** creating tables **
-CREATE TABLE t
-(
-id INT AUTO_INCREMENT PRIMARY KEY,
-c TEXT(30)
-);
-
-CREATE TABLE t1
-(
-id INT AUTO_INCREMENT PRIMARY KEY,
-c BLOB(30)
-);
-
-CREATE TABLE t2
-(
-id INT AUTO_INCREMENT PRIMARY KEY,
-c TEXT(30)
-);
-
-
+CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, c BLOB);
+CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
--echo '#--------------------FN_DYNVARS_098_01-------------------------#'
##########################################################
# Test behavior of variable on new connection # 01 #
##########################################################
-
connect (test_con1,localhost,root,,);
-connection test_con1;
-
-# Value of session & global vairable here should be 10
-SELECT @@global.max_sort_length = 10;
-SELECT @@session.max_sort_length = 10;
# Setting global value of variable and inserting data in table
---echo ** Setting value to 30 and inserting data **
-SET @@global.max_sort_length = 30;
+--echo ** Setting value to 70 and inserting data **
+SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **
# Setting session value of variable and inserting data in table
-SET @@session.max_sort_length = 29;
+SET @@session.max_sort_length = 69;
SELECT @@session.max_sort_length;
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **
@@ -99,72 +69,69 @@ SELECT c from t ORDER BY c, id;
##########################################################
connect (test_con2,localhost,root,,);
-connection test_con2;
-
## Setting global value of variable and inserting data in table
-SET @@global.max_sort_length = 30;
+SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **
# Setting session value of variable and inserting data in table
-SET @@session.max_sort_length = 20;
+SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should not be sorted **
--echo '#--------------------FN_DYNVARS_098_03-------------------------#'
#########################################################
-#Check if sorting is applied with the max_sort_length=20#
+#Check if sorting is applied with the max_sort_length=64#
#########################################################
###########################################
# Setting new value for max_sort_length #
###########################################
-SET max_sort_length=20;
+SET max_sort_length=64;
###################################
# Inserting values in table t #
###################################
-INSERT INTO t set c = repeat('x',29);
-INSERT INTO t set c = concat(repeat('x',28),'r','x');
-INSERT INTO t set c = concat(repeat('x',28),'s','y');
-INSERT INTO t set c = concat(repeat('x',28),'g','w');
+INSERT INTO t set c = repeat('x',69);
+INSERT INTO t set c = concat(repeat('x',68),'r','x');
+INSERT INTO t set c = concat(repeat('x',68),'s','y');
+INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should not be sorted **
RESET QUERY CACHE;
-
--echo '#--------------------FN_DYNVARS_098_04-------------------------#'
#########################################################
-#Check if sorting is applied with the max_sort_length=29#
+#Check if sorting is applied with the max_sort_length=69#
#########################################################
-SET max_sort_length=29;
+SET max_sort_length=69;
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **
--echo '#--------------------FN_DYNVARS_098_05-------------------------#'
#########################################################
-#Check if sorting is applied with the max_sort_length=30#
+#Check if sorting is applied with the max_sort_length=70#
#########################################################
-SET max_sort_length=30;
+SET max_sort_length=70;
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **
@@ -173,34 +140,33 @@ SELECT c from t ORDER BY c, id;
#Check if sorting is applied with the max_sort_length=Default#
##############################################################
-
SET max_sort_length=default;
+SELECT @@max_sort_length;
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **
-
--echo '#--------------------FN_DYNVARS_098_07-------------------------#'
###########################################
#Check if sorting is applied on BLOB type #
###########################################
--echo Testing type BLOB
# Setting global value of variable and inserting data in table
-SET @@global.max_sort_length = 30;
-SELECT @@global.max_sort_length;
-INSERT INTO t1 set c = repeat('x',29);
-INSERT INTO t1 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t1 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t1 set c = concat(repeat('x',28),'g','w');
-SELECT c from t1 ORDER BY c, id;
+SET @@max_sort_length = 70;
+SELECT @@max_sort_length;
+INSERT INTO t1 set c = repeat('x',69);
+INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
+SELECT c from t1 ORDER BY c, id DESC;
--echo ** Results should be sorted **
# Setting session value of variable and inserting data in table
-SET @@session.max_sort_length = 20;
+SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
-INSERT INTO t1 set c = repeat('x',29);
-INSERT INTO t1 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t1 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t1 set c = concat(repeat('x',28),'g','w');
+INSERT INTO t1 set c = repeat('x',69);
+INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
SELECT c from t1 ORDER BY c, id;
--echo ** Results should not be sorted **
@@ -210,26 +176,25 @@ SELECT c from t1 ORDER BY c, id;
###########################################
--echo Testing type CHAR
# Setting global value of variable and inserting data in table
-SET @@global.max_sort_length = 30;
+SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
-INSERT INTO t2 set c = repeat('x',29);
-INSERT INTO t2 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t2 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t2 set c = concat(repeat('x',28),'g','w');
+INSERT INTO t2 set c = repeat('x',69);
+INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
SELECT c from t2 ORDER BY c, id;
--echo ** Results should not be sorted **
# Setting session value of variable and inserting data in table
-SET @@session.max_sort_length = 20;
+SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
-INSERT INTO t2 set c = repeat('x',29);
-INSERT INTO t2 set c = concat(repeat('x',28),'r','x');
-INSERT INTO t2 set c = concat(repeat('x',28),'s','y');
-INSERT INTO t2 set c = concat(repeat('x',28),'g','w');
+INSERT INTO t2 set c = repeat('x',69);
+INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
+INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
+INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
SELECT c from t2 ORDER BY c, id;
--echo ** Results should not be sorted **
-
#
# Cleanup
#
@@ -239,12 +204,6 @@ connection default;
disconnect test_con1;
disconnect test_con2;
-SET @@SESSION.max_sort_length = @session_max_sort_length;
-
---disable_warnings
-DROP TABLE IF EXISTS t;
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
+DROP TABLE t, t1, t2;
SET @@global.max_sort_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
deleted file mode 100644
index 6d1535ba148..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
+++ /dev/null
@@ -1,43 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_notify_cmd
---echo #
-
-call mtr.add_suppression("WSREP: Failed to get provider options");
-
---echo # save the initial value
-SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd;
-
---echo # default
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd='notify_cmd';
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # valid values
-SET @@global.wsrep_notify_cmd='command';
-SELECT @@global.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd='hyphenated-command';
-SELECT @@global.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd=default;
-SELECT @@global.wsrep_notify_cmd;
-SET @@global.wsrep_notify_cmd=NULL;
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # invalid values
---error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wsrep_notify_cmd=1;
-SELECT @@global.wsrep_notify_cmd;
-
---echo
---echo # restore the initial value
-SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
deleted file mode 100644
index 1190ab41bb0..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
+++ /dev/null
@@ -1,39 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_provider
---echo #
-
---echo # save the initial value
-SET @wsrep_provider_global_saved = @@global.wsrep_provider;
-
---echo # default
-SELECT @@global.wsrep_provider;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.wsrep_provider;
-SELECT @@global.wsrep_provider;
-
---echo
---echo # valid values
-SET @@global.wsrep_provider=default;
-SELECT @@global.wsrep_provider;
-
---echo
---echo # invalid values
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.wsrep_provider='/invalid/libgalera_smm.so';
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.wsrep_provider=NULL;
-SELECT @@global.wsrep_provider;
---error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wsrep_provider=1;
-SELECT @@global.wsrep_provider;
-
---echo
---echo # restore the initial value
-SET @@global.wsrep_provider = @wsrep_provider_global_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
deleted file mode 100644
index d2ea32a0637..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
+++ /dev/null
@@ -1,51 +0,0 @@
---source include/have_wsrep.inc
-
---echo #
---echo # wsrep_provider_options
---echo #
-
-call mtr.add_suppression("WSREP: Failed to get provider options");
-
-SET @@global.wsrep_provider = @@global.wsrep_provider;
-
---echo # save the initial value
-SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options;
-
---echo # default
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # scope
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.wsrep_provider_options;
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options='option1';
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # valid values
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options='name1=value1;name2=value2';
-SELECT @@global.wsrep_provider_options;
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options='hyphenated-name:value';
-SELECT @@global.wsrep_provider_options;
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options=default;
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # invalid values
---error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wsrep_provider_options=1;
-SELECT @@global.wsrep_provider_options;
---error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options=NULL;
-SELECT @@global.wsrep_provider_options;
-
---echo
---echo # restore the initial value
---error 0,ER_WRONG_ARGUMENTS
-SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved;
-
---echo # End of test
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index 11577bfe8b0..3d204db6945 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -10,3 +10,5 @@
#
##############################################################################
+
+mdev_6832: wsrep_provider is read-only for security reasons
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index c9c0c5af9c5..df7ca3787aa 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -14,79 +14,17 @@ SET SESSION wsrep_replicate_myisam= ON;
ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL wsrep_replicate_myisam= ON;
SET GLOBAL wsrep_replicate_myisam= OFF;
-SET GLOBAL wsrep_provider=none;
#
# MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
# variables when using "_"
#
CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
-# wsrep
-SHOW GLOBAL STATUS LIKE 'wsrep%';
-Variable_name Value
-wsrep_applier_thread_count #
-wsrep_apply_oooe #
-wsrep_apply_oool #
-wsrep_apply_window #
-wsrep_causal_reads #
-wsrep_cert_deps_distance #
-wsrep_cert_index_size #
-wsrep_cert_interval #
-wsrep_cluster_conf_id #
-wsrep_cluster_size #
-wsrep_cluster_state_uuid #
-wsrep_cluster_status #
-wsrep_commit_oooe #
-wsrep_commit_oool #
-wsrep_commit_window #
-wsrep_connected #
-wsrep_debug_sync_waiters #
-wsrep_flow_control_paused #
-wsrep_flow_control_paused_ns #
-wsrep_flow_control_recv #
-wsrep_flow_control_sent #
-wsrep_incoming_addresses #
-wsrep_last_committed #
-wsrep_local_bf_aborts #
-wsrep_local_cached_downto #
-wsrep_local_cert_failures #
-wsrep_local_commits #
-wsrep_local_index #
-wsrep_local_recv_queue #
-wsrep_local_recv_queue_avg #
-wsrep_local_recv_queue_max #
-wsrep_local_recv_queue_min #
-wsrep_local_replays #
-wsrep_local_send_queue #
-wsrep_local_send_queue_avg #
-wsrep_local_send_queue_max #
-wsrep_local_send_queue_min #
-wsrep_local_state #
-wsrep_local_state_comment #
-wsrep_local_state_uuid #
-wsrep_open_connections #
-wsrep_open_transactions #
-wsrep_protocol_version #
-wsrep_provider_name #
-wsrep_provider_vendor #
-wsrep_provider_version #
-wsrep_ready #
-wsrep_received #
-wsrep_received_bytes #
-wsrep_repl_data_bytes #
-wsrep_repl_keys #
-wsrep_repl_keys_bytes #
-wsrep_repl_other_bytes #
-wsrep_replicated #
-wsrep_replicated_bytes #
-wsrep_rollbacker_thread_count #
-wsrep_thread_count #
SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment #
# Should show nothing.
SHOW STATUS LIKE 'x';
Variable_name Value
-SET GLOBAL wsrep_provider=none;
SHOW STATUS LIKE 'wsrep_local_state_uuid';
Variable_name Value
@@ -95,7 +33,6 @@ wsrep_local_state_uuid #
SHOW STATUS LIKE 'wsrep_last_committed';
Variable_name Value
wsrep_last_committed #
-SET GLOBAL wsrep_provider=none;
#
# MDEV#6206: wsrep_slave_threads subtracts from max_connections
@@ -109,7 +46,7 @@ SELECT @@global.wsrep_slave_threads;
1
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
-
+gcomm://
SELECT @@global.wsrep_on;
@@global.wsrep_on
1
@@ -118,14 +55,14 @@ Variable_name Value
Threads_connected 1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name Value
-wsrep_thread_count 0
+wsrep_thread_count 2
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
-
+gcomm://
SELECT @@global.wsrep_on;
@@global.wsrep_on
1
@@ -134,11 +71,10 @@ Variable_name Value
Threads_connected 1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name Value
-wsrep_thread_count 0
+wsrep_thread_count 2
# Setting wsrep_cluster_address triggers the creation of
# applier/rollbacker threads.
-SET GLOBAL wsrep_cluster_address= 'gcomm://';
# Wait for applier thread to get created 1.
# Wait for applier thread to get created 2.
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
@@ -196,16 +132,7 @@ drop user test@localhost;
#
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= 'user:pass';
-SELECT @@global.wsrep_sst_auth;
-@@global.wsrep_sst_auth
-********
SET @@global.wsrep_sst_auth= '';
-SELECT @@global.wsrep_sst_auth;
-@@global.wsrep_sst_auth
-
SET @@global.wsrep_sst_auth= NULL;
-SELECT @@global.wsrep_sst_auth;
-@@global.wsrep_sst_auth
-NULL
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
# End of test.
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index 2556d8ede4f..0cf13650ce0 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -1,7 +1,6 @@
--source include/have_wsrep.inc
--source include/force_restart.inc
--source include/have_innodb.inc
---source include/galera_have_debug_sync.inc
call mtr.add_suppression("WSREP: Initial position was provided by configuration or SST, avoiding override");
@@ -23,7 +22,7 @@ SET GLOBAL wsrep_replicate_myisam= ON;
# Reset it back.
SET GLOBAL wsrep_replicate_myisam= OFF;
-SET GLOBAL wsrep_provider=none;
+#SET GLOBAL wsrep_provider=none;
--echo #
--echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
@@ -32,18 +31,9 @@ SET GLOBAL wsrep_provider=none;
CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
---disable_result_log
---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--let $galera_version=25.3.24
source include/check_galera_version.inc;
---enable_result_log
---enable_query_log
-
---echo # wsrep
---sorted_result
---replace_column 2 #
-SHOW GLOBAL STATUS LIKE 'wsrep%';
--replace_column 2 #
SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
@@ -52,11 +42,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
SHOW STATUS LIKE 'x';
# Reset it back.
-SET GLOBAL wsrep_provider=none;
+#SET GLOBAL wsrep_provider=none;
---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
# The following 2 variables are used by mariabackup
# SST.
@@ -68,7 +56,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid';
SHOW STATUS LIKE 'wsrep_last_committed';
# Reset it back.
-SET GLOBAL wsrep_provider=none;
+#SET GLOBAL wsrep_provider=none;
--echo
--echo #
@@ -76,9 +64,7 @@ SET GLOBAL wsrep_provider=none;
--echo #
call mtr.add_suppression("WSREP: Failed to get provider options");
---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
@@ -89,9 +75,7 @@ SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count';
--echo
---disable_query_log
-eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---enable_query_log
+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
@@ -103,7 +87,7 @@ SHOW STATUS LIKE 'wsrep_thread_count';
--echo # Setting wsrep_cluster_address triggers the creation of
--echo # applier/rollbacker threads.
-SET GLOBAL wsrep_cluster_address= 'gcomm://';
+#SET GLOBAL wsrep_cluster_address= 'gcomm://';
--echo # Wait for applier thread to get created 1.
--let $wait_timeout=600
@@ -158,21 +142,10 @@ drop user test@localhost;
--echo #
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= 'user:pass';
-SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= '';
-SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= NULL;
-SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
-# Reset (for mtr internal checks)
---disable_query_log
-SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
-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;
---enable_query_log
-
--source include/galera_wait_ready.inc
--echo # End of test.
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 11f641c6033..396de147ec2 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -5,12 +5,6 @@ call mtr.add_suppression("table or database name 't-1'");
# Check some special create statements.
#
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5;
-drop database if exists mysqltest;
-drop view if exists v1;
---enable_warnings
-
create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
@@ -29,30 +23,30 @@ drop table t1;
# Test of some CREATE TABLE'S that should fail
#
---error 1146
+--error ER_NO_SUCH_TABLE
create table t2 engine=heap select * from t1;
---error 1146
+--error ER_NO_SUCH_TABLE
create table t2 select auto+1 from t1;
drop table if exists t1,t2;
---error 1167
+--error ER_WRONG_KEY_COLUMN
create table t1 (b char(0) not null, index(b));
---error 1163
+--error ER_TABLE_CANT_HANDLE_BLOB
create table t1 (a int not null,b text) engine=heap;
drop table if exists t1;
---error 1075
+--error ER_WRONG_AUTO_KEY
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
--- error 1049
+--error ER_BAD_DB_ERROR
create table not_existing_database.test (a int);
create table `a/a` (a int);
show create table `a/a`;
create table t1 like `a/a`;
drop table `a/a`;
drop table `t1`;
---error 1103
+--error ER_WRONG_TABLE_NAME
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
---error 1059
+--error ER_TOO_LONG_IDENT
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
#
@@ -62,17 +56,17 @@ create table t1 (a datetime default now());
drop table t1;
create table t1 (a datetime on update now());
drop table t1;
---error 1067
+--error ER_INVALID_DEFAULT
create table t1 (a int default 100 auto_increment);
---error 1067
+--error ER_INVALID_DEFAULT
create table t1 (a tinyint default 1000);
---error 1067
+--error ER_INVALID_DEFAULT
create table t1 (a varchar(5) default 'abcdef');
create table t1 (a varchar(5) default 'abcde');
insert into t1 values();
select * from t1;
---error 1067
+--error ER_INVALID_DEFAULT
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
alter table t1 alter column a set default 'abcdef';
drop table t1;
@@ -97,13 +91,13 @@ create table mysqltest.test2$ (a int);
drop table mysqltest.test2$;
drop database mysqltest;
---error 1103
+--error ER_WRONG_TABLE_NAME
create table `` (a int);
---error 1103
+--error ER_WRONG_TABLE_NAME
drop table if exists ``;
---error 1166
+--error ER_WRONG_COLUMN_NAME
create table t1 (`` int);
---error 1280
+--error ER_WRONG_NAME_FOR_INDEX
create table t1 (i int, index `` (i));
#
@@ -158,13 +152,13 @@ create table t2 (a int) select * from t1;
describe t1;
describe t2;
drop table if exists t2;
---error 1060
+--error ER_DUP_FIELDNAME
create table t2 (a int, a float) select * from t1;
drop table if exists t2;
---error 1060
+--error ER_DUP_FIELDNAME
create table t2 (a int) select a as b, a+1 as b from t1;
drop table if exists t2;
---error 1060
+--error ER_DUP_FIELDNAME
create table t2 (b int) select a as b, a+1 as b from t1;
drop table if exists t1,t2;
@@ -176,7 +170,7 @@ CREATE TABLE t1 (a int not null);
INSERT INTO t1 values (1),(2),(1);
--error ER_DUP_ENTRY
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
SELECT * from t2;
DROP TABLE t1;
DROP TABLE IF EXISTS t2;
@@ -202,7 +196,7 @@ SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
---error 1286
+--error ER_UNKNOWN_STORAGE_ENGINE
SET SESSION storage_engine="gemini";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
@@ -216,11 +210,11 @@ drop table t1;
#
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
insert into t1 values ("a", 1), ("b", 2);
---error 1048
+--error ER_BAD_NULL_ERROR
insert into t1 values ("c", NULL);
---error 1048
+--error ER_BAD_NULL_ERROR
insert into t1 values (NULL, 3);
---error 1048
+--error ER_BAD_NULL_ERROR
insert into t1 values (NULL, NULL);
drop table t1;
@@ -262,11 +256,11 @@ drop table t1;
# "Table truncated when creating another table name with Spaces"
#
---error 1103
+--error ER_WRONG_TABLE_NAME
create table `t1 `(a int);
---error 1102
+--error ER_WRONG_DB_NAME
create database `db1 `;
---error 1166
+--error ER_WRONG_COLUMN_NAME
create table t1(`a ` int);
#
@@ -274,11 +268,11 @@ create table t1(`a ` int);
# "Parser permits multiple commas without syntax error"
#
---error 1064
+--error ER_PARSE_ERROR
create table t1 (a int,);
---error 1064
+--error ER_PARSE_ERROR
create table t1 (a int,,b int);
---error 1064
+--error ER_PARSE_ERROR
create table t1 (,b int);
#
@@ -320,13 +314,13 @@ create table t2 like t3;
show create table t2;
select * from t2;
create table t3 like t1;
---error 1050
+--error ER_TABLE_EXISTS_ERROR
create table t3 like mysqltest.t3;
---error 1049
+--error ER_BAD_DB_ERROR
create table non_existing_database.t1 like t1;
--error ER_NO_SUCH_TABLE
create table t3 like non_existing_table;
---error 1050
+--error ER_TABLE_EXISTS_ERROR
create temporary table t3 like t1;
drop table t1, t2, t3;
drop table t3;
@@ -360,7 +354,7 @@ SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
---error 1286
+--error ER_UNKNOWN_STORAGE_ENGINE
SET SESSION storage_engine="gemini";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
@@ -464,9 +458,9 @@ use test;
# Test for Bug 856 'Naming a key "Primary" causes trouble'
#
---error 1280
+--error ER_WRONG_NAME_FOR_INDEX
create table t1 (a int, index `primary` (a));
---error 1280
+--error ER_WRONG_NAME_FOR_INDEX
create table t1 (a int, index `PRIMARY` (a));
create table t1 (`primary` int, index(`primary`));
@@ -475,9 +469,9 @@ create table t2 (`PRIMARY` int, index(`PRIMARY`));
show create table t2;
create table t3 (a int);
---error 1280
+--error ER_WRONG_NAME_FOR_INDEX
alter table t3 add index `primary` (a);
---error 1280
+--error ER_WRONG_NAME_FOR_INDEX
alter table t3 add index `PRIMARY` (a);
create table t4 (`primary` int);
@@ -532,11 +526,11 @@ drop table t1;
#
# Bug#10413: Invalid column name is not rejected
#
---error 1103
+--error ER_WRONG_TABLE_NAME
create table t1(column.name int);
---error 1103
+--error ER_WRONG_TABLE_NAME
create table t1(test.column.name int);
---error 1102
+--error ER_WRONG_DB_NAME
create table t1(xyz.t1.name int);
create table t1(t1.name int);
create table t2(test.t2.name int);
@@ -575,7 +569,7 @@ drop table if exists test.t1;
create database mysqltest;
use mysqltest;
create view v1 as select 'foo' from dual;
---error 1347
+--error ER_WRONG_OBJECT
create table t1 like v1;
drop view v1;
drop database mysqltest;
@@ -696,7 +690,7 @@ drop table t1, t2;
#
# Bug #15316 SET value having comma not correctly handled
#
---error 1367
+--error ER_ILLEGAL_VALUE_FOR_TYPE
create table t1(a set("a,b","c,d") not null);
# End of 4.1 tests
@@ -894,9 +888,9 @@ INSERT IGNORE INTO t1 (b) VALUES (5);
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
SELECT a FROM t1;
---error 1062
+--error ER_DUP_ENTRY
INSERT INTO t2 SELECT a FROM t1;
---error 1062
+--error ER_DUP_ENTRY
INSERT INTO t2 SELECT a FROM t1;
DROP TABLE t1, t2;
@@ -956,24 +950,24 @@ drop table t1,t2;
# Test incorrect database names
#
---error 1102
+--error ER_WRONG_DB_NAME
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
---error 1102
+--error ER_WRONG_DB_NAME
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
# TODO: enable these tests when RENAME DATABASE is implemented.
-# --error 1049
+# --error ER_BAD_DB_ERROR
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
-# --error 1102
+# --error ER_WRONG_DB_NAME
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
# create database mysqltest;
-# --error 1102
+# --error ER_WRONG_DB_NAME
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
# drop database mysqltest;
---error 1102
+--error ER_WRONG_DB_NAME
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
---error 1102
+--error ER_WRONG_DB_NAME
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
#
@@ -1025,11 +1019,11 @@ before insert on имÑ_таблицы_в_кодировке_утф8_длиноÐ
select TRIGGER_NAME from information_schema.triggers where
trigger_schema='test';
drop trigger имÑ_триггера_в_кодировке_утф8_длиной_больше_чем_49;
---error 1059
+--error ER_TOO_LONG_IDENT
create trigger
очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66
before insert on имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
---error 1059
+--error ER_TOO_LONG_IDENT
drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66;
create procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
@@ -1038,7 +1032,7 @@ end;
select ROUTINE_NAME from information_schema.routines where
routine_schema='test';
drop procedure имÑ_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
---error 1059
+--error ER_TOO_LONG_IDENT
create procedure очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
begin
end;
@@ -1049,7 +1043,7 @@ return 0;
select ROUTINE_NAME from information_schema.routines where
routine_schema='test';
drop function имÑ_функции_в_кодировке_утф8_длиной_больше_чем_49;
---error 1059
+--error ER_TOO_LONG_IDENT
create function очень_очень_очень_очень_очень_очень_очень_очень_длиннаÑ_Ñтрока_66()
returns int
return 0;
@@ -1917,16 +1911,32 @@ alter table t1 add
key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy';
drop table t1;
---echo End of 5.5 tests
+--echo #
+--echo # End of 5.5 tests
+--echo #
-#
-# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
-#
+--echo #
+--echo # MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
+--echo #
--error ER_TABLE_MUST_HAVE_COLUMNS
create table t1;
-#
-# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
-#
+--echo #
+--echo # MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
+--echo #
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
drop table t1;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-18428 Memory: If transactional=0 is specified in CREATE TABLE, it is not possible to ALTER TABLE
+--echo #
+--error ER_ILLEGAL_HA_CREATE_OPTION
+create table t1 (c int(10) unsigned) engine=memory transactional=0;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index 41a5b815bc7..c2ebc92c858 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -1201,4 +1201,64 @@ DROP TABLE test.t;
--connection default
--disconnect con1
+--echo #
+--echo # MDEV-22781: create view with CTE without default database
+--echo #
+
+drop database test;
+create database db1;
+create table db1.t1 (a int);
+insert into db1.t1 values (3),(7),(1);
+
+create view db1.v1 as with t as (select * from db1.t1) select * from t;
+show create view db1.v1;
+select * from db1.v1;
+drop view db1.v1;
+
+prepare stmt from "
+create view db1.v1 as with t as (select * from db1.t1) select * from t;
+";
+execute stmt;
+deallocate prepare stmt;
+show create view db1.v1;
+select * from db1.v1;
+drop view db1.v1;
+
+drop table db1.t1;
+drop database db1;
+
+create database test;
+use test;
+
+--echo #
+--echo # MDEV-24597: CTE with union used multiple times in query
+--echo #
+
+with cte(a) as
+(select 1 as d union select 2 as d)
+select a from cte as r1
+union
+select a from cte as r2;
+
+create table t1 (a int, b int) engine=myisam;
+insert into t1 values
+(3,30), (7,70), (1,10), (7,71), (2,20), (7,72), (3,33), (4,44),
+(5,50), (4,40), (3,33), (4,42), (4,43), (5,51);
+
+with cte(c) as
+(select a from t1 where b < 30 union select a from t1 where b > 40)
+select * from cte as r1, cte as r2 where r1.c = r2.c;
+
+with cte(a,c) as
+(
+ select a, count(*) from t1 group by a having count(*) = 1
+ union
+ select a, count(*) from t1 group by a having count(*) = 3
+)
+select a, c from cte as r1 where a < 3
+union
+select a, c from cte as r2 where a > 4;
+
+drop table t1;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/cte_nonrecursive_not_embedded.test b/mysql-test/t/cte_nonrecursive_not_embedded.test
new file mode 100644
index 00000000000..e80baeaf591
--- /dev/null
+++ b/mysql-test/t/cte_nonrecursive_not_embedded.test
@@ -0,0 +1,58 @@
+-- source include/not_embedded.inc
+
+--echo #
+--echo # MDEV-20751: query using many CTEs with grant_tables enabled
+--echo #
+
+--connection default
+
+CREATE DATABASE db;
+USE db;
+
+CREATE TABLE t1 (a int) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (3), (7), (1);
+CREATE TABLE t2 (a int) ENGINE=MYISAM;
+INSERT INTO t2 VALUES (2), (8), (4);
+
+
+CREATE USER 'u1'@'localhost';
+GRANT USAGE ON db.* TO 'u1'@'localhost';
+GRANT SELECT ON db.t1 TO 'u1'@'localhost';
+FLUSH PRIVILEGES;
+
+--connect (u1,'localhost',u1,,)
+--connection u1
+USE db;
+
+WITH
+cte1 AS
+(SELECT a FROM t1),
+cte2 AS
+(SELECT cte1.a FROM t1,cte1 WHERE cte1.a = t1.a),
+cte3 AS
+(SELECT cte2.a FROM t1,cte1,cte2 WHERE cte1.a = t1.a AND t1.a = cte2.a),
+cte4 AS
+(SELECT cte2.a FROM t1,cte2 WHERE cte2.a = t1.a)
+SELECT * FROM cte4 as r;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+WITH
+cte1 AS
+(SELECT a FROM t2),
+cte2 AS
+(SELECT cte1.a FROM t2,cte1 WHERE cte1.a = t2.a),
+cte3 AS
+(SELECT cte2.a FROM t2,cte1,cte2 WHERE cte1.a = t2.a AND t2.a = cte2.a),
+cte4 AS
+(SELECT cte2.a FROM t2,cte2 WHERE cte2.a = t2.a)
+SELECT * FROM cte4 as r;
+
+--disconnect u1
+--connection default
+
+DROP USER 'u1'@'localhost';
+DROP DATABASE db;
+
+USE test;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index d1904586ffe..849e76b0436 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -2641,5 +2641,184 @@ DROP PROCEDURE p;
DROP TABLE t1,t2,t3,t4;
--echo #
+--echo # MDEV-23619: recursive CTE used only in the second operand of UNION
+--echo #
+
+create table t1 (
+ a bigint(10) not null auto_increment,
+ b int(5) not null,
+ c bigint(10) default null,
+ primary key (a)
+) engine myisam;
+insert into t1 values
+ (1,3,12), (2,7,15), (3,1,3), (4,3,1);
+
+let $q=
+with recursive r_cte as
+( select * from t1 as s
+ union
+ select t1.* from t1, r_cte as r where t1.c = r.a )
+select 0 as b FROM dual union all select b FROM r_cte as t;
+
+eval explain $q;
+eval $q;
+--source include/analyze-format.inc
+eval analyze format=json $q;
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+--echo #checking hanging cte that uses a recursive cte
+let $q1=
+with h_cte as
+( with recursive r_cte as
+ ( select * from t1 as s
+ union
+ select t1.* from t1, r_cte as r where t1.c = r.a )
+ select 0 as b FROM dual union all select b FROM r_cte as t)
+select * from t1 as tt;
+
+eval explain $q1;
+eval $q1;
+--source include/analyze-format.inc
+eval analyze format=json $q1;
+eval prepare stmt from "$q1";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop table t1;
+
+--echo #
+--echo # MDEV-24019: query with recursive CTE when no default database is set
+--echo #
+
+drop database test;
+
+let $q=
+with recursive a as
+ (select 1 from dual union select * from a as r)
+select * from a;
+
+eval $q;
+
+create database db1;
+create table db1.t1 (a int);
+insert into db1.t1 values (3), (7), (1);
+
+let $q=
+with recursive cte as
+ (select * from db1.t1 union select * from (select * from cte) as t)
+select * from cte;
+
+eval $q;
+eval explain $q;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop database db1;
+
+create database test;
+use test;
+
+--echo #
+--echo # MDEV-23406: query with mutually recursive CTEs when big_tables=1
+--echo #
+
+set @save_big_tables=@@big_tables;
+set big_tables=1;
+
+create table folks(id int, name char(32), dob date, father int, mother int);
+
+insert into folks values
+(100, 'Me', '2000-01-01', 20, 30),
+(20, 'Dad', '1970-02-02', 10, 9),
+(30, 'Mom', '1975-03-03', 8, 7),
+(10, 'Grandpa Bill', '1940-04-05', null, null),
+(9, 'Grandma Ann', '1941-10-15', null, null),
+(25, 'Uncle Jim', '1968-11-18', 8, 7),
+(98, 'Sister Amy', '2001-06-20', 20, 30),
+(7, 'Grandma Sally', '1943-08-23', null, 6),
+(8, 'Grandpa Ben', '1940-10-21', null, null),
+(6, 'Grandgrandma Martha', '1923-05-17', null, null),
+(67, 'Cousin Eddie', '1992-02-28', 25, 27),
+(27, 'Auntie Melinda', '1971-03-29', null, null);
+
+let q=
+with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+ w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+ select h.*, w.*
+ from folks h, folks w, coupled_ancestors a
+ where a.father = h.id AND a.mother = w.id
+ union
+ select h.*, w.*
+ from folks v, folks h, folks w
+ where v.name = 'Me' and
+ (v.father = h.id AND v.mother= w.id)
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+ select h_id, h_name, h_dob, h_father, h_mother
+ from ancestor_couples
+ union
+ select w_id, w_name, w_dob, w_father, w_mother
+ from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+ from ancestor_couples;
+
+eval $q;
+eval explain $q;
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+let $q=
+with recursive
+ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
+ w_id, w_name, w_dob, w_father, w_mother)
+as
+(
+ select h.*, w.*
+ from folks h, folks w, coupled_ancestors a
+ where a.father = h.id AND a.mother = w.id
+),
+coupled_ancestors (id, name, dob, father, mother)
+as
+(
+ select *
+ from folks
+ where name = 'Me'
+ union all
+ select h_id, h_name, h_dob, h_father, h_mother
+ from ancestor_couples
+ union all
+ select w_id, w_name, w_dob, w_father, w_mother
+ from ancestor_couples
+)
+select h_name, h_dob, w_name, w_dob
+ from ancestor_couples;
+
+eval $q;
+eval explain $q;
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop table folks;
+
+set big_tables=@save_big_tables;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
index 532729dafde..8fbbee872ce 100644
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@ -1520,7 +1520,7 @@ drop table t1;
--echo #
--echo # Check strnxfrm() with odd length
--echo #
-set max_sort_length=9;
+set max_sort_length=65;
select @@max_sort_length;
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci);
insert into t1 values ('a'),('b'),('c');
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index a7df65f2951..31b49047bf1 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -2184,4 +2184,32 @@ SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar');
DROP VIEW v1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-19179: pushdown into UNION of aggregation selects whose
+--echo # corresponding columns have different names
+--echo #
+
+create table t1 (a int);
+insert into t1 values (3), (7), (1);
+
+let $q=
+select *
+from (select min(a) as x from t1 union all select max(a) as y from t1) t
+where x>0;
+
+eval $q;
+eval explain extended $q;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+create view v1(m) as
+select min(a) as x from t1 union all select max(a) as y from t1;
+select * from v1 where m > 0;
+
+drop view v1;
+drop table t1;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index e752d9fcd50..b699d39e953 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -939,6 +939,16 @@ DROP VIEW v1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-4677 GROUP_CONCAT not showing any output with group_concat_max_len >= 4Gb
+--echo #
+set group_concat_max_len=1024*1024*1024*4;
+create table t1 (i int, j int);
+insert into t1 values (1,1),(1,2);
+select i, group_concat(j) from t1 group by i;
+drop table t1;
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 8bbc9e6a040..d7da9fe8c96 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1703,4 +1703,32 @@ select count(*)+sleep(0) from t1;
drop table t1;
+--echo #
+--echo # MDEV-25112: MIN/MAX optimization for query containing BETWEEN in WHERE
+--echo #
+
+create table t1 (a int) engine=myisam;
+insert into t1 values (267), (273), (287), (303), (308);
+
+let $q1=
+select max(a) from t1 where a < 303 and (a between 267 AND 287);
+let $q2=
+select min(a) from t1 where a > 267 and (a between 273 AND 303);
+
+eval $q1;
+eval explain $q1;
+eval $q2;
+eval explain $q2;
+
+create index idx on t1(a);
+eval $q1;
+eval explain $q1;
+eval $q2;
+eval explain $q2;
+
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 5026bb76aa3..c7a59a6fcbd 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -187,7 +187,7 @@ DROP TABLE t1;
--echo #
#
-# Item_func_line::print()
+# Item_func_like::print()
#
create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
show create view v1;
@@ -207,3 +207,30 @@ insert t1 (a) values ('3 f_'), ('3 f\_');
set sql_mode=default;
select * from t1;
drop table t1;
+
+#
+# Item_func_like::fix_fields()
+#
+create table t1 (f int);
+insert t1 values (1),(2);
+select 1 from (select distinct * from t1) as x where f < (select 1 like 2 escape (3=1));
+drop table t1;
+
+#
+# Item_func_like::fix_fields, ESCAPE, const_item()
+#
+create table t1(f1 int);
+insert into t1 values(1);
+--error ER_WRONG_ARGUMENTS
+update (select 1 like 2 escape (1 in (select 1 from t1))) x, t1 as d set d.f1 = 1;
+select * from (select 1 like 2 escape (1 in (select 1 from t1))) x;
+drop table t1;
+
+#
+# Item_func_like::walk
+#
+create table t1 (f int);
+insert t1 values (1),(2);
+create view v1 as select * from t1 where (1 like 2 escape (3 in (('h', 'b') in (select 'k', 'k' union select 'g', 'j'))) and f >= 0);
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test
index b91ef235fd0..a97e9411e5c 100644
--- a/mysql-test/t/gis-json.test
+++ b/mysql-test/t/gis-json.test
@@ -44,6 +44,8 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": [
SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
+SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }");
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test
index ede535596da..b75318e034b 100644
--- a/mysql-test/t/gis-precise.test
+++ b/mysql-test/t/gis-precise.test
@@ -393,3 +393,81 @@ with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 a
--source include/gis_debug.inc
+
+--echo #
+--echo # MDEV-13467 Feature request: Support for ST_Distance_Sphere()
+--echo #
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT ST_DISTANCE_SPHERE();
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT ST_DISTANCE_SPHERE(NULL);
+SELECT ST_DISTANCE_SPHERE(NULL, NULL);
+# NULL args and optional radius will return NULL
+SELECT ST_DISTANCE_SPHERE(NULL, NULL, 3);
+# At least 1 NULL arg and optional radius will return NULL
+SELECT ST_DISTANCE_SPHERE(NULL, 1, 3);
+# At least 1 NULL arg and optional radius will return NULL
+SELECT ST_DISTANCE_SPHERE(1, NULL, 3);
+# Return ER_GIS_INVALID_DATA for invalid geometry
+--error ER_GIS_INVALID_DATA
+SELECT ST_DISTANCE_SPHERE(1, 1);
+--error ER_GIS_INVALID_DATA
+SELECT ST_DISTANCE_SPHERE(1, 1, 3);
+# Return NULL if radius is NULL
+SELECT ST_DISTANCE_SPHERE(1, 1, NULL);
+# Wrong geometry
+--error ER_INTERNAL_ERROR
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)'));
+
+--echo # Test Points and radius
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'));
+# make bb x86 happy
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10);
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1);
+--error ER_INTERNAL_ERROR
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0);
+--error ER_INTERNAL_ERROR
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1);
+--echo # Test longitude/lattitude
+# make bb x86 happy
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10);
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(2 1)')), 10);
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10);
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('POINT(2 1)'));
+--echo # Test Points - Multipoints
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1)'));
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 1)'), ST_GEOMFROMTEXT('POINT(0 0)'));
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'));
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'));
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(1 1,2 2)'), 1);
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2,1 1)'), 1);
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1, 3 4)'), 1);
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('MULTIPOINT(2 2, 1 1,5 6)'), 1);
+--echo # Test Multipoints - Multipoints
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )'));
+# make bb x86 happy
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(3 4,8 9 )')), 10);
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10);
+# make bb x86 happy
+SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17);
+--error ER_INTERNAL_ERROR
+SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0);
+
+# Longitude out of range [-180,180]
+set @pt1 = ST_GeomFromText('POINT(190 -30)');
+set @pt2 = ST_GeomFromText('POINT(-30 50)');
+--error ER_STD_OUT_OF_RANGE_ERROR
+SELECT ST_Distance_Sphere(@pt1, @pt2);
+
+# Latitude out of range [-90, 90]
+set @pt1 = ST_GeomFromText('POINT(135 -30)');
+set @pt2 = ST_GeomFromText('POINT(-30 91)');
+--error ER_STD_OUT_OF_RANGE_ERROR
+SELECT ST_Distance_Sphere(@pt1, @pt2);
+
+# POINT in form (longitude[-180, 180] latitude[-90, 90])
+set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)');
+set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');
+SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10);
+SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10);
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 324b41ce23c..d4c6d6527d5 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1996,3 +1996,36 @@ ON t.table_schema=c.table_schema
WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type)
GROUP BY t.table_name;
SET max_sort_length= @save_max_sort_length;
+
+
+--echo #
+--echo # MDEV-23826: ORDER BY in view definition leads to wrong result with GROUP BY on query using view
+--echo #
+
+CREATE TABLE t1
+(
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ dt datetime,
+ INDEX(dt),
+ foo int
+);
+
+INSERT INTO t1 VALUES (1,'2020-09-26 12:00:00',1);
+INSERT INTO t1 VALUES (2,'2020-09-26 13:00:00',1);
+INSERT INTO t1 VALUES (3,'2020-09-27 13:00:00',1);
+INSERT INTO t1 VALUES (4,'2020-09-27 12:00:00',1);
+INSERT INTO t1 VALUES (5,'2020-09-28 12:00:00',1);
+INSERT INTO t1 VALUES (6,'2020-09-28 13:00:00',1);
+INSERT INTO t1 VALUES (7,'2020-09-25 12:00:00',1);
+INSERT INTO t1 VALUES (8,'2020-09-25 13:00:00',1);
+INSERT INTO t1 VALUES (9,'2020-09-26 13:00:00',1);
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t1 ORDER BY dt;
+SELECT dt, sum(foo) AS foo FROM v1 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt;
+SELECT dt, sum(foo) AS foo FROM v2 WHERE dt>DATE_SUB('2020-09-27 00:00:00', INTERVAL 3 DAY) GROUP BY dt;
+
+DROP TABLE t1;
+DROP VIEW v1,v2;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index df00ff26908..9ff94d2deb7 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1914,8 +1914,26 @@ SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a'
--echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
--echo #
+replace_regex /at least \d+ rows/at least ### rows/;
SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
--echo #
+--echo # MDEV-24179: AAssertion `m_status == DA_ERROR || m_status == DA_OK ||
+--echo # m_status == DA_OK_BULK' failed in Diagnostics_area::message()
+--echo #
+
+call mtr.add_suppression("Sort aborted.*");
+
+DROP DATABASE test;
+CREATE DATABASE test;
+USE test;
+CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
+
+--error ER_FILSORT_ABORT
+SELECT * FROM v LIMIT ROWS EXAMINED 9;
+
+DROP VIEW v;
+
+--echo #
--echo # End of 10.2 Test
--echo #
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index f5edd736490..04ebcc1e41b 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -606,3 +606,23 @@ explain format= json
select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3';
drop table t1;
SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+
+--echo #
+--echo # MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index
+--echo #
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE t2 (
+ pk VARCHAR(50),
+ a VARCHAR(20),
+ KEY k1(a),
+ PRIMARY KEY(pk)
+)ENGINE=INNODB;
+
+INSERT INTO t2 SELECT a,a FROM t1;
+--replace_column 9 #
+EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1);
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 9576d598125..55ae6afc436 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -4014,5 +4014,65 @@ select f2 from t2,t1 where f2 = 0;
drop table t1, t2;
set join_buffer_size=@save_join_buffer_size;
+
+--echo #
+--echo # MDEV-21104: BNLH used for multi-join query with embedded outer join
+--echo # and possible 'not exists' optimization
+--echo #
+
+set join_cache_level=4;
+
+CREATE TABLE t1 (a int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b int, c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2),(2,4);
+CREATE TABLE t3 (d int, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1),(2);
+CREATE TABLE t4 (e int primary key) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (1),(2);
+ANALYZE TABLE t1,t2,t3,t4;
+
+SELECT * FROM t2 LEFT JOIN t3 ON c = d;
+SELECT * FROM (t2 LEFT JOIN t3 ON c = d ) JOIN t4;
+
+let $q1=
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e;
+eval EXPLAIN $q1;
+eval $q1;
+
+let $q2=
+SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e
+ WHERE e IS NULL;
+eval EXPLAIN $q2;
+eval $q2;
+
+DROP TABLE t1,t2,t3,t4;
+
+set join_cache_level=@save_join_cache_level;
+
+--echo #
+--echo # MDEV-24767: forced BNLH used for equi-join supported by compound index
+--echo #
+
+create table t1 (a int, b int, c int ) engine=myisam ;
+create table t2 (a int, b int, c int, primary key (c,a,b)) engine=myisam ;
+insert into t1 values (3,4,2), (5,6,4);
+insert into t2 values (3,4,2), (5,6,4);
+
+let $q=
+select t1.a, t1.b, t1.c from t1,t2
+ where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c;
+
+eval $q;
+eval explain $q;
+
+set join_cache_level=3;
+eval $q;
+eval explain $q;
+
+drop table t1,t2;
+
+set join_cache_level=@save_join_cache_level;
+
# The following command must be the last one in the file
set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 78de8a784f3..6eb9d55f9b8 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -663,3 +663,9 @@ ALTER TABLE t2 DROP c;
UNLOCK TABLES;
DROP VIEW v1;
DROP TABLE t1, t2;
+
+--echo #
+--echo # KILL QUERY ID USER
+--echo #
+--error ER_PARSE_ERROR
+kill query id user 'foo';
diff --git a/mysql-test/t/lock_view.test b/mysql-test/t/lock_view.test
index dd8809ab89d..abb8d317946 100644
--- a/mysql-test/t/lock_view.test
+++ b/mysql-test/t/lock_view.test
@@ -1,4 +1,5 @@
source include/not_embedded.inc;
+source include/have_perfschema.inc;
#
# LOCK TABLES and privileges on views
#
@@ -74,3 +75,20 @@ drop user definer@localhost;
drop database mysqltest1;
drop database mysqltest2;
drop database mysqltest3;
+
+--echo #
+--echo # MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery
+--echo #
+create user u1@localhost;
+grant all privileges on test.* to u1@localhost;
+connect con1,localhost,u1;
+use test;
+create table t1 (id int not null);
+create view v1 as select * from (select * from t1) dt;
+lock table v1 read;
+disconnect con1;
+connection default;
+exec $MYSQL_DUMP test v1 -uu1 --compact;
+drop view v1;
+drop table t1;
+drop user u1@localhost;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 217789fccb2..d6efdea982f 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1539,6 +1539,7 @@ DROP TABLE t1;
# MariaDB: Note that the table will still have 'TRANSACTIONAL=1' attribute.
# That's the intended behavior atm.
#
+set statement sql_mode='' for
create table t1 (n int not null, c char(1)) transactional=1;
show create table t1;
drop table t1;
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 5dad8702fc5..c116af860a6 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -173,8 +173,6 @@ DROP PROCEDURE test.pr;
# MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars
#
use test;
-call mtr.add_suppression('Column last_update in table `mysql`.`innodb_table_stats` is INT NOT NULL but should be');
-alter table mysql.innodb_table_stats modify last_update int not null;
create table extralongname_extralongname_extralongname_extralongname_ext (
id int(10) unsigned not null,
@@ -248,6 +246,36 @@ FLUSH PRIVILEGES;
SET ROLE `aRole`;
SELECT `User`, `is_role` FROM `mysql`.`user`;
+DROP ROLE aRole;
+
+--echo #
+--echo # MDEV-24122: Fix previously MySQL-5.7 data directories that upgraded prior to MDEV-23201
+--echo #
+--echo #
+
+# For 10.4 merge - dropping the view.
+# DROP VIEW IF EXISTS mysql.user;
+DROP TABLE IF EXISTS mysql.user;
+--copy_file std_data/mysql57user.frm $MYSQLD_DATADIR/mysql/user.frm
+--copy_file std_data/mysql57user.MYI $MYSQLD_DATADIR/mysql/user.MYI
+--copy_file std_data/mysql57user.MYD $MYSQLD_DATADIR/mysql/user.MYD
+FLUSH TABLES mysql.user;
+
+# What prior to MDEV-23201 would of done:
+ALTER TABLE mysql.user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ALTER TABLE mysql.user ADD default_role char(80) binary DEFAULT '' NOT NULL;
+ALTER TABLE mysql.user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;
+FLUSH PRIVILEGES;
+
+--exec $MYSQL_UPGRADE --force 2>&1
+SHOW CREATE TABLE mysql.user;
+
+CREATE ROLE `aRole`;
+SET DEFAULT ROLE aRole;
+SHOW GRANTS;
+SET DEFAULT ROLE NONE;
+SHOW GRANTS;
+
DROP ROLE `aRole`;
--exec $MYSQL mysql < $MYSQLTEST_VARDIR/tmp/user.sql
FLUSH PRIVILEGES;
diff --git a/mysql-test/t/mysqldump-system.test b/mysql-test/t/mysqldump-system.test
new file mode 100644
index 00000000000..3efe8376e18
--- /dev/null
+++ b/mysql-test/t/mysqldump-system.test
@@ -0,0 +1,157 @@
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_udf.inc
+--source include/platform.inc
+
+if (!$AUTH_SOCKET_SO) {
+ --skip Need auth socket plugin
+}
+
+--echo #
+--echo # MDEV-23630: mysqldump to logically dump system tables
+--echo #
+--echo #
+
+# might need fixing in 10.4 to different mechanism
+create table backup_users like mysql.user;
+insert into backup_users select * from mysql.user where host not in ('localhost');
+delete from mysql.user where host not in ('localhost');
+flush privileges;
+
+create user USER;
+
+if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
+{
+--error 0,ER_PLUGIN_INSTALLED
+--eval install plugin /*M!100401 IF NOT EXISTS */ unix_socket soname '$AUTH_SOCKET_SO';
+alter user USER identified via unix_socket;
+}
+
+# time zone data already loaded
+
+CREATE ROLE role_1;
+CREATE ROLE role_2 WITH ADMIN role_1;
+
+GRANT SHOW DATABASES ON *.* TO role_1;
+GRANT role_1 TO USER;
+GRANT role_2 TO USER;
+SET DEFAULT ROLE role_2 FOR USER;
+
+ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
+
+# innodb and EITS tables statistics
+#
+set @save_innodb_stats_persistent= @@innodb_stats_persistent;
+create table mysql.tz like mysql.time_zone_transition;
+alter table mysql.tz engine=innodb;
+insert into mysql.tz select * from mysql.time_zone_transition;
+set global innodb_stats_persistent=1;
+ANALYZE TABLE mysql.tz PERSISTENT FOR ALL;
+# for predictable output in tests
+delete from mysql.index_stats where prefix_arity!=1;
+delete from mysql.column_stats where column_name!='Time_zone_id';
+set time_zone="+03:00";
+update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
+update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
+set global innodb_stats_persistent= @save_innodb_stats_persistent;
+alter table mysql.time_zone_name ORDER BY Name;
+
+CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost');
+
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
+
+
+#
+# Lets actually do some tests.
+#
+
+--echo #
+--echo # mysqldump of system tables with --system=all
+--echo #
+
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+--exec $MYSQL_DUMP --skip-comments --system=all
+
+
+--echo #
+--echo # mysqldump of system tables with --system=all --replace
+--echo #
+
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+--exec $MYSQL_DUMP --skip-comments --system=all --replace
+
+
+# save this for restore
+--exec $MYSQL_DUMP --system=users,servers,stats,timezones,udfs --replace > $MYSQLTEST_VARDIR/tmp/dump1.sql
+
+--echo #
+--echo # mysqldump of system tables with --system=all --insert-ignore
+--echo #
+
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+--exec $MYSQL_DUMP --skip-comments --system=all --insert-ignore
+
+
+CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
+ mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
+
+--echo # Opps....
+
+CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback';
+GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION;
+GRANT PROXY ON ''@'%' TO mariadb_test_restore WITH GRANT OPTION;
+GRANT SUPER, CREATE USER /*M!100502 ,FEDERATED ADMIN */ ON *.* TO mariadb_test_restore WITH GRANT OPTION;
+
+drop user USER;
+delete from mysql.table_stats;
+delete from mysql.innodb_table_stats;
+delete from mysql.time_zone_transition;
+delete from mysql.time_zone_transition_type;
+delete from mysql.time_zone;
+delete from mysql.time_zone_name;
+delete from mysql.time_zone_leap_second;
+DROP FUNCTION IF EXISTS metaphon;
+DROP SERVER s1;
+set time_zone= @@global.time_zone;
+
+--echo # Restore from mysqldump
+--exec $MYSQL --user mariadb_test_restore --password=getitback --show-warnings < $MYSQLTEST_VARDIR/tmp/dump1.sql
+#--remove_file $MYSQLTEST_VARDIR/tmp/dump1.sql;
+
+DROP USER mariadb_test_restore;
+
+# successful restore?
+
+CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin,
+ mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats;
+
+#
+# Cleanup
+#
+
+DROP FUNCTION IF EXISTS metaphon;
+
+DROP SERVER s1;
+
+# EITS && innodb stats
+DELETE FROM mysql.column_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
+DELETE FROM mysql.index_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
+DELETE FROM mysql.table_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
+DELETE FROM mysql.innodb_index_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
+DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
+drop table mysql.tz;
+
+DROP ROLE role_2;
+DROP ROLE role_1;
+
+drop user USER;
+
+if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
+{
+uninstall plugin unix_socket;
+}
+
+insert into mysql.user select * from backup_users;
+flush privileges;
+drop table backup_users;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 4478406b395..8249810d1e5 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2735,4 +2735,27 @@ INSERT INTO t1 (a) VALUES (1),(2),(3);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test
DROP TABLE t1;
+--echo #
+--echo # MDEV-20939: Race condition between mysqldump import and InnoDB
+--echo # persistent statistics calculation
+--echo #
+
+--let $ignore= --ignore-table=mysql.proxies_priv --ignore-table=mysql.user --ignore-table=mysql.column_stats --ignore-table=mysql.columns_priv --ignore-table=mysql.db --ignore-table=mysql.event --ignore-table=mysql.func --ignore-table=mysql.gtid_slave_pos --ignore-table=mysql.help_category --ignore-table=mysql.help_keyword --ignore-table=mysql.help_relation --ignore-table=mysql.help_topic --ignore-table=mysql.host --ignore-table=mysql.index_stats --ignore-table=mysql.plugin --ignore-table=mysql.proc --ignore-table=mysql.procs_priv --ignore-table=mysql.roles_mapping --ignore-table=mysql.servers --ignore-table=mysql.table_stats --ignore-table=mysql.tables_priv --ignore-table=mysql.time_zone --ignore-table=mysql.time_zone_leap_second --ignore-table=mysql.time_zone_name --ignore-table=mysql.time_zone_transition --ignore-table=mysql.time_zone_transition_type --ignore-table=mysql.general_log --ignore-table=mysql.slow_log
+--let $skip_opts= --skip-dump-date --skip-comments
+
+--echo #
+--echo # Without --replace and --insert-ignore
+--echo #
+--exec $MYSQL_DUMP $ignore $skip_opts mysql
+
+--echo #
+--echo # With --replace
+--echo #
+--exec $MYSQL_DUMP $ignore $skip_opts --replace mysql
+
+--echo #
+--echo # With --insert-ignore
+--echo #
+--exec $MYSQL_DUMP $ignore $skip_opts --insert-ignore mysql
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index e9802f95721..36c25ed37fb 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -531,11 +531,11 @@ drop table t1, t2;
# Bug #5428: a problem with small max_sort_length value
#
-create table t1 (a char(25));
+create table t1 (a char(70));
insert into t1 set a = repeat('x', 20);
-insert into t1 set a = concat(repeat('x', 19), 'z');
-insert into t1 set a = concat(repeat('x', 19), 'ab');
-insert into t1 set a = concat(repeat('x', 19), 'aa');
+insert into t1 set a = concat(repeat('x', 63), 'z');
+insert into t1 set a = concat(repeat('x', 63), 'ab');
+insert into t1 set a = concat(repeat('x', 63), 'aa');
set max_sort_length=20;
select a from t1 order by a;
drop table t1;
diff --git a/mysql-test/t/precedence.test b/mysql-test/t/precedence.test
index ad367c23603..cd7cee4f911 100644
--- a/mysql-test/t/precedence.test
+++ b/mysql-test/t/precedence.test
@@ -4785,4 +4785,7 @@ Select view_definition from information_schema.views where table_schema='test' a
create or replace view v1 as select 1 IS TRUE IS FALSE, 2 IS FALSE IS UNKNOWN, 3 IS UNKNOWN IS NULL, 4 IS NULL IS TRUE;
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+create or replace view v1 as select 2 IS TRUE = 3, 2 IS FALSE = 3, 2 IS UNKNOWN = 3, 2 IS NULL = 3, ISNULL(2) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
drop view v1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 90af3ff7ce1..a267c8b0e42 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -4903,5 +4903,29 @@ EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
--echo #
+--echo # MDEV-24779: main.subselect fails in buildbot with --ps-protocol
+--echo #
+
+CREATE TABLE t1(a INT);
+PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))";
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-25006: Failed assertion on executing EXPLAIN DELETE statement as a prepared statement
+--echo #
+
+CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY);
+PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b';
+EXECUTE stmt;
+DROP TABLE t1;
+CREATE TABLE t1(a INT);
+PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/ps_show_log.test b/mysql-test/t/ps_show_log.test
new file mode 100644
index 00000000000..95000d2d7e0
--- /dev/null
+++ b/mysql-test/t/ps_show_log.test
@@ -0,0 +1,73 @@
+--echo #
+--echo # MDEV-24208 SHOW RELAYLOG EVENTS command is not supported in the prepared
+--echo # statement protocol yet
+--echo #
+
+CREATE USER u1;
+
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+--connection master
+CREATE TABLE t1(n INT);
+
+DROP TABLE t1;
+
+--sync_slave_with_master
+PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
+
+--replace_column 2 # 4 # 5 #
+--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-bin.*/#/
+EXECUTE stmt_1;
+
+--echo # Execute the same prepared statement the second time to check that
+--echo # no internal structures used for handling the statement
+--echo # 'SHOW BINLOG EVENTS' were damaged.
+
+--replace_column 2 # 4 # 5 #
+--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-bin.*/#/
+EXECUTE stmt_1;
+
+DEALLOCATE PREPARE stmt_1;
+
+--connection slave
+PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
+--replace_column 2 # 4 # 5 #
+--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-relay-bin.*;pos=.*/#/
+EXECUTE stmt_1;
+
+--echo # Execute the same prepared statement the second time to check that
+--echo # no internal structures used for handling the statement
+--echo # 'SHOW RELAYLOG EVENTS' were damaged.
+
+--replace_column 2 # 4 # 5 #
+--replace_regex /Server ver:.*Binlog ver: .*/#/ /slave-relay-bin.*;pos=.*/#/
+EXECUTE stmt_1;
+
+DEALLOCATE PREPARE stmt_1;
+
+--echo # Create the user u1 without the REPLICATION SLAVE privilege required
+--echo # for running the statements SHOW BINLOG EVENTS/SHOW RELAYLOG EVENTS
+--echo # and check that attempt to execute the statements SHOW BINLOG EVENTS/
+--echo # SHOW RELAYLOG EVENTS as a prepred statements by a user without required
+--echo # privileges results in error.
+
+--connect (con2,localhost,u1,,test)
+PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS';
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+EXECUTE stmt_1;
+
+PREPARE stmt_1 FROM 'SHOW RELAYLOG EVENTS';
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+EXECUTE stmt_1;
+
+DEALLOCATE PREPARE stmt_1;
+
+--source include/rpl_end.inc
+
+--connection default
+# Clean up
+DROP USER u1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 7235c6af3b3..d518d7a3956 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -606,15 +606,15 @@ set character_set_results=default;
#
# max_sort_length
set GLOBAL query_cache_size=1355776;
-create table t1 (id int auto_increment primary key, c char(25));
+create table t1 (id int auto_increment primary key, c char(65));
insert into t1 set c = repeat('x',24);
-insert into t1 set c = concat(repeat('x',24),'x');
-insert into t1 set c = concat(repeat('x',24),'w');
-insert into t1 set c = concat(repeat('x',24),'y');
+insert into t1 set c = concat(repeat('x',64),'x');
+insert into t1 set c = concat(repeat('x',64),'w');
+insert into t1 set c = concat(repeat('x',64),'y');
set max_sort_length=200;
select c from t1 order by c, id;
reset query cache;
-set max_sort_length=20;
+set max_sort_length=64;
select c from t1 order by c, id;
set max_sort_length=200;
select c from t1 order by c, id;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 264f7c784ce..890377ed977 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -2183,6 +2183,54 @@ eval $q4;
drop table t1;
+#
+# MDEV-21958: Query having many NOT-IN clauses running forever (testcase 2)
+#
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (
+ pk int primary key,
+ key1 int,
+ col1 varchar(255),
+ key (key1, pk)
+);
+
+insert into t2 (pk, key1)
+select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C;
+
+--echo # This must use ALL, not range:
+explain select * from t2 force index (primary) where pk not in (1,2,3);
+
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN
+--echo #
+CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a));
+INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20);
+
+CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code));
+INSERT INTO t2 VALUES ('100',1),('111',2);
+
+SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3;
+
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value
+--echo #
+
+create table t1 (pk int, i int, v int, primary key (pk), key(v));
+insert into t1 (pk,i,v) values (1,1,2),(2,2,4),(3,3,6),(4,4,8),(5,5,10),(6,6,12),(7,7,14),(8,8,16);
+create table t2 (a int, b int);
+insert into t2 values (1,2),(2,4);
+EXPLAIN
+select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
+select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk);
+drop table t1, t2;
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index a31573edb8e..4d7dcdc9781 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -1286,6 +1286,51 @@ drop table t1;
--echo # End of 10.1 tests
+--echo #
+--echo # MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
+--echo #
+
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size=255;
+CREATE TABLE t1 (a BIT(32), b INT);
+INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
+SELECT HEX(a), b from t1 where t1.a >= 81;
+
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
+--echo #
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 values (1),(2),(2),(3),(4);
+SET optimizer_use_condition_selectivity=4;
+SET histogram_size= 255;
+
+set use_stat_tables='preferably';
+
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+SET optimizer_use_condition_selectivity=3;
+
+--echo # filtered should show 25 %
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+FLUSH TABLES;
+
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set histogram_size=@save_histogram_size;
+set use_stat_tables= @save_use_stat_tables;
+
+DROP TABLE t1;
+
+--echo # End of 10.2 tests
+
#
# Clean up
#
diff --git a/mysql-test/t/set_statement.test b/mysql-test/t/set_statement.test
index 1c70ed6281a..a5f5c03098d 100644
--- a/mysql-test/t/set_statement.test
+++ b/mysql-test/t/set_statement.test
@@ -1136,3 +1136,26 @@ while ($1)
--enable_query_log
--echo # @rnd should be 0
select @rnd;
+
+--echo #
+--echo # MDEV-24860: Incorrect behaviour of SET STATEMENT in case
+--echo # it is executed as a prepared statement
+--echo #
+PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1";
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+--echo # Show definition of the table t1 created using Prepared Statement
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--echo # Create the table t1 with the same definition as it used before
+--echo # using regular statement execution mode.
+SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1;
+
+--echo # Show that the table has the same definition as it is in case the table
+--echo # created in prepared statement mode.
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/skip_grants-master.opt b/mysql-test/t/skip_grants.opt
index 5699a3387b8..5699a3387b8 100644
--- a/mysql-test/t/skip_grants-master.opt
+++ b/mysql-test/t/skip_grants.opt
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
index 5f79404e7e4..0ecaa022fd4 100644
--- a/mysql-test/t/skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -17,24 +17,6 @@ use test;
# Prepare.
---disable_warnings
-
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
-DROP VIEW IF EXISTS v3;
-
-DROP TABLE IF EXISTS t1;
-
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP FUNCTION IF EXISTS f3;
-
---enable_warnings
-
# Test case.
CREATE TABLE t1(c INT);
@@ -109,20 +91,23 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
-#
-# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
-#
+--echo #
+--echo # Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
+--echo #
set global event_scheduler=1;
set global event_scheduler=0;
-#
-# Bug#26285 Selecting information_schema crahes server
-#
+--echo #
+--echo # Bug#26285 Selecting information_schema crahes server
+--echo #
select count(*) from information_schema.COLUMN_PRIVILEGES;
select count(*) from information_schema.SCHEMA_PRIVILEGES;
select count(*) from information_schema.TABLE_PRIVILEGES;
select count(*) from information_schema.USER_PRIVILEGES;
---echo End of 5.0 tests
+
+--echo #
+--echo # End of 5.0 tests
+--echo #
--echo #
--echo # Bug#29817 Queries with UDF fail with non-descriptive error
@@ -131,9 +116,26 @@ select count(*) from information_schema.USER_PRIVILEGES;
--error ER_SP_DOES_NOT_EXIST
select no_such_function(1);
---echo End of 5.1 tests
+--echo #
+--echo # End of 5.1 tests
+--echo #
-#
-# MDEV-8280 crash in 'show global status' with --skip-grant-tables
-#
+--echo #
+--echo # MDEV-8280 crash in 'show global status' with --skip-grant-tables
+--echo #
show global status like 'Acl%';
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
+--echo #
+
+--error ER_OPTION_PREVENTS_STATEMENT
+set role x;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/sp-ucs2.test b/mysql-test/t/sp-ucs2.test
index a1aec8071b4..95021bcb8ef 100644
--- a/mysql-test/t/sp-ucs2.test
+++ b/mysql-test/t/sp-ucs2.test
@@ -114,35 +114,35 @@ DROP FUNCTION f1|
#
# COLLATE with no CHARACTER SET in IN param
#
---error ER_COLLATION_CHARSET_MISMATCH
CREATE FUNCTION f(f1 VARCHAR(64) COLLATE ucs2_unicode_ci)
RETURNS VARCHAR(64) CHARACTER SET ucs2
BEGIN
RETURN 'str';
END|
+DROP FUNCTION f|
#
# COLLATE with no CHARACTER SET in RETURNS
#
---error ER_COLLATION_CHARSET_MISMATCH
CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2)
RETURNS VARCHAR(64) COLLATE ucs2_unicode_ci
BEGIN
RETURN 'str';
END|
+DROP FUNCTION f|
#
# COLLATE with no CHARACTER SET in DECLARE
#
---error ER_COLLATION_CHARSET_MISMATCH
CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2)
RETURNS VARCHAR(64) CHARACTER SET ucs2
BEGIN
DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci;
RETURN 'str';
END|
+DROP FUNCTION f|
delimiter ;|
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 99b843059ec..f13b3fbc281 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -10001,3 +10001,28 @@ $$
DELIMITER ;$$
DROP TABLE t1;
SET sql_mode=DEFAULT;
+
+--echo #
+--echo # MDEV-24220: error when opening a table for the second call of SP
+--echo #
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2);
+CREATE VIEW v1 AS SELECT MAX(a) as f FROM t1;
+--delimiter $
+CREATE PROCEDURE p1()
+BEGIN
+ SELECT * FROM v1;
+END $
+--delimiter ;
+
+CALL p1;
+ALTER TABLE t1 DROP a;
+-- error ER_VIEW_INVALID
+CALL p1;
+
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #End of 10.2 tests
diff --git a/mysql-test/t/stat_tables.test b/mysql-test/t/stat_tables.test
index 4c21e21ea70..f7c18637cdd 100644
--- a/mysql-test/t/stat_tables.test
+++ b/mysql-test/t/stat_tables.test
@@ -1,4 +1,5 @@
--source include/have_stat_tables.inc
+--source include/have_partition.inc
select @@global.use_stat_tables;
select @@session.use_stat_tables;
@@ -568,5 +569,16 @@ set names latin1;
set @@use_stat_tables=@save_use_stat_tables;
drop table t1;
+--echo #
+--echo # MDEV-23753: SIGSEGV in Column_stat::store_stat_fields
+--echo #
+
+CREATE TABLE t1 (a INT, b INT) PARTITION BY HASH (b) PARTITIONS 2;
+LOCK TABLES t1 WRITE;
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES ();
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (nonexisting) INDEXES (nonexisting);
+DROP TABLE t1;
+
+
--echo # please keep this at the last
set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test
index fa3b718efaa..ea674c2ed7c 100644
--- a/mysql-test/t/status2.test
+++ b/mysql-test/t/status2.test
@@ -64,5 +64,14 @@ DROP TRIGGER trigg1;
DROP FUNCTION testQuestion;
DROP EVENT ev1;
DROP TABLE t1,t2;
---echo End of 6.0 tests
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+select variable_value < 1024*1024*1024 from information_schema.global_status where variable_name='memory_used';
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 7e16321dac1..57ac43176bb 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -6188,4 +6188,39 @@ SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
DROP TABLE t;
+--echo #
+--echo # MDEV-25002: Outer reference in ON clause of subselect
+--echo #
+
+create table t1 (
+ pk int primary key,
+ a int
+) engine=myisam;
+insert into t1 values (1,1), (2,2);
+
+create table t2 (
+ pk int primary key,
+ b int
+) engine=myisam;
+insert into t2 values (1,1), (2,3);
+
+create table t3 (a int);
+insert into t3 values (1),(2);
+
+select a,
+ (select count(*) from t1, t2
+ where t2.pk=t3.a and t1.pk=1) as sq
+from t3;
+select a,
+ (select count(*) from t1 join t2 on t2.pk=t3.a
+ where t1.pk=1) as sq
+from t3;
+
+select a from t3
+ where a in (select t2.b from t1,t2 where t2.pk=t3.a and t1.pk=1);
+select a from t3
+ where a in (select t2.b from t1 join t2 on t2.pk=t3.a where t1.pk=1);
+
+drop table t1,t2,t3;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 6eada9b27d9..f19a654de64 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -2201,4 +2201,39 @@ SELECT * FROM t2;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-23449: alias do not exist and a query do not report an error
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
+
+--error ER_BAD_FIELD_ERROR
+SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-24519: Server crashes in Charset::set_charset upon SELECT
+--echo #
+
+CREATE TABLE t1 (a VARBINARY(8));
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE TABLE t2 (b VARBINARY(8));
+
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2);
+
+DROP TABLE t1,t2;
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b VARBINARY(8));
+
+EXPLAIN
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2);
+
+DROP TABLE t1,t2;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 77c9c2875e2..80c196b11f1 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -670,5 +670,49 @@ DROP TABLE t1;
DROP TABLE t1dec102;
--echo #
+--echo # MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result
+--echo #
+
+SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a;
+SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a;
+SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a;
+
+CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128));
+INSERT INTO t1 VALUES
+('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'),
+('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'),
+('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'),
+('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent');
+
+# The loop below issues SHOW WARNINGS manually, disable automatic warnings
+--disable_warnings
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE done INT DEFAULT FALSE;
+ DECLARE vstr, vcomment VARCHAR(128);
+ DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ OPEN cur1;
+read_loop:
+ LOOP
+ FETCH cur1 INTO vstr, vcomment;
+ IF done THEN
+ LEAVE read_loop;
+ END IF;
+ SELECT vstr AS `--------`, vcomment AS `--------`;
+ SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
+ SHOW WARNINGS;
+ SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
+ SHOW WARNINGS;
+ END LOOP;
+END;
+$$
+DELIMITER ;$$
+--enable_warnings
+
+
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index af26a69c581..34c417d9026 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -1,9 +1,6 @@
#
# Test year
#
---disable_warnings
-drop table if exists t1;
---enable_warnings
create table t1 (y year,y2 year(2));
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
@@ -12,24 +9,27 @@ select * from t1 order by y;
select * from t1 order by y2;
drop table t1;
-#
-# Bug 2335
-#
+--echo #
+--echo # Bug 2335
+--echo #
create table t1 (y year);
insert ignore into t1 values (now());
select if(y = now(), 1, 0) from t1;
drop table t1;
-#
-# Bug #27176: Assigning a string to an year column has unexpected results
-#
+--echo #
+--echo # Bug #27176: Assigning a string to an year column has unexpected results
+--echo #
+
create table t1(a year);
insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
select * from t1;
drop table t1;
---echo End of 5.0 tests
+--echo #
+--echo # End of 5.0 tests
+--echo #
--echo #
--echo # Bug #49480: WHERE using YEAR columns returns unexpected results
@@ -169,8 +169,9 @@ ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
DROP TABLE t1;
--echo #
+--echo # End of 5.1 tests
+--echo #
---echo End of 5.1 tests
#
# fun with convert_const_to_int
# in some cases 00 is equal to 2000, in others it is not.
@@ -230,10 +231,6 @@ DROP TABLE t1;
--echo #
--echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
--echo # MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
--echo #
CREATE TABLE t1 (a YEAR);
@@ -268,6 +265,17 @@ SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t1 MODIFY a YEAR;
DROP TABLE t1;
+--echo #
+--echo # Various widths of the YEAR
+--echo #
+create or replace table t1 (a YEAR(0)); SHOW CREATE TABLE t1;
+create or replace table t1 (a YEAR(1)); SHOW CREATE TABLE t1;
+create or replace table t1 (a YEAR(2)); SHOW CREATE TABLE t1;
+create or replace table t1 (a YEAR(3)); SHOW CREATE TABLE t1;
+create or replace table t1 (a YEAR(4)); SHOW CREATE TABLE t1;
+create or replace table t1 (a YEAR(5)); SHOW CREATE TABLE t1;
+create or replace table t1 (a YEAR(100)); SHOW CREATE TABLE t1;
+drop table t1;
--echo #
--echo # End of 10.2 tests
diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test
index ebb4fd4fb88..36524febd8d 100644
--- a/mysql-test/t/user_limits.test
+++ b/mysql-test/t/user_limits.test
@@ -216,3 +216,29 @@ drop table t1;
--source include/wait_until_count_sessions.inc
set global max_user_connections= @my_max_user_connections;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-17852 Altered connection limits for user have no effect
+--echo #
+create user foo@'%' with max_user_connections 1;
+--connect con1,localhost,foo
+select current_user();
+--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
+--error ER_USER_LIMIT_REACHED
+--connect con2,localhost,foo
+--connection default
+alter user foo with max_user_connections 2;
+--connect con3,localhost,foo
+select current_user();
+--disconnect con3
+--disconnect con1
+--connection default
+drop user foo@'%';
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/userstat.test b/mysql-test/t/userstat.test
index 547138cfeaa..6d486810db1 100644
--- a/mysql-test/t/userstat.test
+++ b/mysql-test/t/userstat.test
@@ -5,10 +5,7 @@
-- source include/have_innodb.inc
-- source include/have_log_bin.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
+-- source include/have_perfschema.inc
select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key;
show columns from information_schema.client_statistics;
@@ -115,5 +112,20 @@ set @@autocommit=1;
select @@in_transaction;
drop table t1;
-# Cleanup
set @@global.general_log=@save_general_log;
+
+--echo #
+--echo # MDEV-25242 Server crashes in check_grant upon invoking function with userstat enabled
+--echo #
+create function f() returns int return (select 1 from performance_schema.threads);
+set global userstat= 1;
+--error ER_SUBQUERY_NO_1_ROW
+select f() from information_schema.table_statistics;
+--error ER_SUBQUERY_NO_1_ROW
+select f() from information_schema.index_statistics;
+set global userstat= 0;
+drop function f;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index cd5cc6efade..8cb00f7a6f4 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -6492,5 +6492,73 @@ DROP VIEW v1;
DROP TABLE t1;
--echo #
+--echo # MDEV-24314: create view with derived table without default database
+--echo #
+
+drop database test;
+
+create database db1;
+create table db1.t1 (a int);
+insert into db1.t1 values (3),(7),(1);
+
+create view db1.v1 as select * from (select * from db1.t1) t;
+show create view db1.v1;
+select * from db1.v1;
+drop view db1.v1;
+
+prepare stmt from "
+create view db1.v1 as select * from (select * from db1.t1) t;
+";
+execute stmt;
+deallocate prepare stmt;
+show create view db1.v1;
+select * from db1.v1;
+drop view db1.v1;
+
+drop table db1.t1;
+drop database db1;
+
+create database test;
+use test;
+
+--echo #
+--echo # MDEV-16940: update of multi-table view returning error used in SP
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (2), (3);
+
+CREATE VIEW v1 AS SELECT a, b FROM t1,t2;
+
+CREATE PROCEDURE sp1() UPDATE v1 SET a = 8, b = 9;
+
+--error ER_VIEW_MULTIUPDATE
+CALL sp1;
+--error ER_VIEW_MULTIUPDATE
+CALL sp1;
+
+DROP PROCEDURE sp1;
+DROP VIEW v1;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-23291: SUM column from a derived table returns invalid values
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2);
+
+CREATE view v1 AS
+SELECT a as x, (select x) as y, (select y) as z FROM t1;
+
+SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q;
+SELECT sum(z) FROM v1;
+
+DROP TABLE t1;
+DROP VIEW v1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index c7e3dac598b..57214ab0165 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -2523,5 +2523,25 @@ DROP VIEW v1;
DROP TABLE t1,t2;
--echo #
+--echo # MDEV-25032 Window functions without column references get removed from ORDER BY
+--echo #
+
+create table t1 (id int, score double);
+insert into t1 values
+(1, 5),
+(1, 6),
+(1, 6),
+(1, 6),
+(1, 7),
+(1, 8.1),
+(1, 9),
+(1, 10);
+select id, row_number() over () rn
+from t1
+order by rn desc;
+
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
index 58ad1caaeef..ecce563b8c8 100644
--- a/mysql-test/t/xa.test
+++ b/mysql-test/t/xa.test
@@ -342,7 +342,7 @@ DROP TABLE t1;
--echo #
--echo # Bug#12352846 - TRANS_XA_START(THD*):
--echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
---echo # FAILED
+--echo # FAILED
--echo #
--disable_warnings
@@ -401,7 +401,7 @@ CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (i INT) ENGINE=InnoDB;
-
+
XA BEGIN 'xid1';
REPLACE INTO t1 SELECT * FROM t2;
@@ -430,5 +430,43 @@ XA END 'xid1';
XA ROLLBACK 'xid1';
DROP TABLE t1, t2, t3;
---source include/wait_until_count_sessions.inc
+--echo #
+--echo # MDEV 15532 XA: Assertion `!log->same_pk' failed in
+--echo # row_log_table_apply_delete
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+
+--connect (con1,localhost,root,,test)
+
+XA START 'xid';
+UPDATE t1 SET a = 5;
+
+--connection default
+SET innodb_lock_wait_timeout= 2, lock_wait_timeout= 2;
+
+--error ER_NO_SUCH_TABLE
+ALTER TABLE non_existing_table1;
+
+--send ALTER TABLE t1 FORCE;
+--connection con1
+--error ER_XAER_RMFAIL
+
+ALTER TABLE non_existing_table2;
+DELETE FROM t1 LIMIT 1;
+
+--connection default
+--error ER_LOCK_WAIT_TIMEOUT
+--reap
+
+# Cleanup
+--connection con1
+XA END 'xid';
+XA ROLLBACK 'xid';
+DROP TABLE t1;
+--disconnect con1
+connection default;
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 7eac636dc5d..286c99cba14 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,28 +23,31 @@
#
##############################################################################
#
-# Based on bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8
-# Fri Oct 30 12:58:16 2020 +0200
-# MDEV-23991 fixup: Initialize the memory
+# Based on 10.2 9c84852809214e97cf91327a798204c1b745881e
+# for main suite changes and failures, and
+# bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8
+# for the rest
-main.alter_table : Modified in 10.2.35
-main.alter_table_trans : MDEV-12084 - timeout
+main.alter_table_trans : MDEV-12084 - Timeout
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
-main.aria_icp_debug : Added in 10.2.35
main.auth_named_pipe : MDEV-14724 - System error 2
-main.blackhole : Modified in 10.2.35
-main.bootstrap_innodb : Added in 10.2.35
main.connect : MDEV-17282 - Wrong result
main.connect2 : MDEV-13885 - Server crash
-main.count_distinct2 : MDEV-11768 - timeout
+main.create : Modified in 10.2.37
main.create_delayed : MDEV-10605 - failed with timeout
main.create_drop_event : MDEV-16271 - Wrong result
+main.cte_nonrecursive : Modified in 10.2.37
+main.cte_nonrecursive_not_embedded : Added in 10.2.37
+main.cte_recursive : Modified in 10.2.37
main.ctype_ucs : MDEV-17681 - Data too long for column
main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade
main.ctype_utf16 : MDEV-10675: timeout or extra warnings
-main.ctype_utf8 : Modified in 10.2.35
+main.ctype_utf8mb4 : Modified in 10.2.37
+main.ctype_utf8mb4_heap : Include file modified in 10.2.37
+main.ctype_utf8mb4_innodb : Include file modified in 10.2.37
+main.ctype_utf8mb4_myisam : Include file modified in 10.2.37
main.debug_sync : MDEV-10607 - internal error
-main.derived_opt : MDEV-11768 - timeout
+main.derived_cond_pushdown : Modified in 10.2.37
main.dirty_close : MDEV-19368 - mysqltest failed but provided no output
main.distinct : MDEV-14194 - Crash
main.drop_bad_db_type : MDEV-15676 - Wrong result
@@ -52,104 +55,92 @@ main.events_2 : MDEV-13277 - Crash
main.events_bugs : MDEV-12892 - Crash
main.events_restart : MDEV-12236 - Server shutdown problem
main.events_slowlog : MDEV-12821 - Wrong result
-main.fast_prefix_index_fetch_innodb : Modified in 10.2.35
main.flush : MDEV-19368 - mysqltest failed but provided no output
-main.func_gconcat : MDEV-21379 - Valgrind warnings
-main.func_json : Modified in 10.2.35
-main.func_test : Modified in 10.2.35
+main.func_gconcat : MDEV-21379 - Valgrind warnings; modified in 10.2.37
+main.func_like : Modified in 10.2.37
main.gis : MDEV-13411 - wrong result on P8
+main.gis-json : Modified in 10.2.37
main.gis_notembedded : MDEV-21264 - Wrong result with different default charset
-main.grant : Modified in 10.2.35
-main.grant5 : Modified in 10.2.35
+main.group_by : Modified in 10.2.37
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
main.index_intersect_innodb : MDEV-10643 - failed with timeout
main.index_merge_innodb : MDEV-7142 - Plan mismatch
-main.information_schema : Modified in 10.2.35
-main.innodb_ext_key : Modified in 10.2.35
-main.innodb_icp_debug : Added in 10.2.35
+main.information_schema : Modified in 10.2.37
+main.innodb_mrr_cpk : MDEV-24737 - Server crash
main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure (Fixed in 10.3+, MDEV-22947)
+main.kill : Modified in 10.2.37
main.kill-2 : MDEV-13257 - Wrong result
main.kill_processlist-6619 : MDEV-10793 - Wrong result
-main.limit_rows_examined : Modified in 10.2.35
main.loaddata : MDEV-19368 - mysqltest failed but provided no output
main.locale : MDEV-20521 - Missing warning
-main.lock_view : Added in 10.2.35
+main.lock_tables_lost_commit : MDEV-24624 - Timeout
+main.lock_view : Modified in 10.2.37
main.log_slow : MDEV-13263 - Wrong result
-main.log_tables : Modified in 10.2.35
main.log_tables-big : MDEV-13408 - wrong result
main.mdev-504 : MDEV-15171 - warning
main.mdev375 : MDEV-10607 - sporadic "can't connect"
main.merge : MDEV-10607 - sporadic "can't connect"
-main.multi_update_big : Modified in 10.2.35
-main.myisam_icp_debug : Added in 10.2.35
+main.myisam : Modified in 10.2.37
main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2
main.mysql_client_test_comp : MDEV-16641 - Error in exec
main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed
-main.mysql_upgrade : Modified in 10.2.35
+main.mysql_upgrade : Modified in 10.2.37
main.mysql_upgrade_noengine : MDEV-14355 - Wrong result
-main.mysqlbinlog_row_minimal : Modified in 10.2.35
-main.mysqld--help : Modified in 10.2.35
main.mysqld_option_err : MDEV-21571 - Crash on bootstrap
-main.mysqldump : MDEV-14800 - Stack smashing detected
-main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug
+main.mysqldump : Modified in 10.2.37
+main.mysqldump-system : Added in 10.2.37
main.mysqlslap : MDEV-11801 - timeout
main.mysqltest : MDEV-9269 - fails on Alpha; MDEV-13887 - Wrong result
main.old-mode : MDEV-19373 - Wrong result
main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1
-main.order_by : Modified in 10.2.35
+main.order_by : Modified in 10.2.37
main.order_by_optimizer_innodb : MDEV-10683 - Wrong result
-main.parser : Modified in 10.2.35
-main.partition : Modified in 10.2.35
main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock
main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings
main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1
-main.plugin_innodb : Modified in 10.2.35
-main.pool_of_threads : Modified in 10.2.35
-main.precedence : Added in 10.2.35
-main.precedence_bugs : Added in 10.2.35
-main.processlist_notembedded : Modified in 10.2.35
+main.precedence : Modified in 10.2.37
+main.processlist_notembedded : MDEV-23752 - Not explainable command
main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
-main.query_cache : MDEV-16180 - Wrong result
+main.ps_show_log : Added in 10.2.37
+main.query_cache : MDEV-16180 - Wrong result; modified in 10.2.37
main.query_cache_debug : MDEV-15281 - Query cache is disabled
-main.range : Modified in 10.2.35
+main.range : Modified in 10.2.37
main.range_innodb : MDEV-23371 - Server crash
main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away
main.set_statement : MDEV-13183 - Wrong result
main.set_statement_notembedded : MDEV-19414 - Wrong result
main.shm : MDEV-12727 - Mismatch, ERROR 2013
main.show_explain : MDEV-10674 - Wrong result code
+main.skip_grants : Modified in 10.2.37
+main.sp : Modified in 10.2.37
main.sp-security : MDEV-10607 - sporadic "can't connect"
+main.sp-ucs2 : Modified in 10.2.37
main.sp_notembedded : MDEV-10607 - internal error
main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1
main.ssl_ca : MDEV-10895 - SSL connection error on Power
main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1
main.ssl_timeout : MDEV-11244 - Crash
+main.stat_tables : Modified in 10.2.37
main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding
main.status : MDEV-13255 - Wrong result
-main.subselect4 : Modified in 10.2.35
-main.subselect_innodb : MDEV-10614 - Sporadic wrong results; modified in 10.2.35
-main.sum_distinct-big : Modified in 10.2.35
+main.subselect_innodb : MDEV-10614 - Sporadic wrong results
main.tc_heuristic_recover : MDEV-14189 - Wrong result
-main.temp_table_symlink : MDEV-24058 - Wrong error code; added in 10.2.35
+main.temp_table_symlink : MDEV-24058 - Wrong error code
main.type_blob : MDEV-15195 - Wrong result
-main.type_date : Modified in 10.2.35
-main.type_datetime : Modified in 10.2.35
main.type_datetime_hires : MDEV-10687 - Timeout
-main.type_newdecimal : Modified in 10.2.35
main.type_temporal_innodb : MDEV-24025 - Wrong result
-main.udf : Modified in 10.2.35
+main.type_year : Modified in 10.2.37
+main.user_limits : Modified in 10.2.37
main.userstat : MDEV-12904 - SSL errors
-main.view : Modified in 10.2.35
+main.view : Modified in 10.2.37
main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query
-main.win : Modified in 10.2.35
-main.xa : MDEV-11769 - lock wait timeout
+main.xa : MDEV-11769 - lock wait timeout; modified in 10.2.37
#-----------------------------------------------------------------------
-archive.archive_bitfield : MDEV-11771 - table is marked as crashed
-archive.archive_symlink : MDEV-12170 - unexpected error on rmdir
-archive.discover : MDEV-10510 - Table is marked as crashed
-archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug
+archive.archive_bitfield : MDEV-11771 - table is marked as crashed
+archive.archive_symlink : MDEV-12170 - unexpected error on rmdir
+archive.discover : MDEV-10510 - Table is marked as crashed
#-----------------------------------------------------------------------
@@ -157,18 +148,14 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
#-----------------------------------------------------------------------
-binlog.binlog_commit_wait : MDEV-10150 - Mismatch
-binlog.binlog_killed : MDEV-12925 - Wrong result
-binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown
-binlog.binlog_mysqlbinlog_row : Modified in 10.2.35
-binlog.binlog_mysqlbinlog_row_frag : Modified in 10.2.35
-binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown
-binlog.binlog_recover_checksum_error : Added in 10.2.35
-binlog.binlog_show_binlog_event_random_pos : Modified in 10.2.35
-binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result
-binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
-binlog.flashback-largebinlog : MDEV-19764 - Out of memory
-binlog.load_data_stm_view : MDEV-16948 - Wrong result
+binlog.binlog_commit_wait : MDEV-10150 - Mismatch
+binlog.binlog_killed : MDEV-12925 - Wrong result
+binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown
+binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown
+binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result
+binlog.binlog_xa_recover : MDEV-12908 - Extra checkpoint
+binlog.flashback-largebinlog : MDEV-19764 - Out of memory
+binlog.load_data_stm_view : MDEV-16948 - Wrong result
#-----------------------------------------------------------------------
@@ -193,10 +180,9 @@ binlog_encryption.rpl_typeconv : MDEV-14362 - Lost con
#-----------------------------------------------------------------------
-connect.pivot : MDEV-14803 - Failed to discover table
-connect.updelx : Modified in 10.2.35
-connect.vcol : MDEV-12374 - Fails on Windows
-connect.zip : MDEV-13884 - Wrong result
+connect.pivot : MDEV-14803 - Failed to discover table
+connect.vcol : MDEV-12374 - Fails on Windows
+connect.zip : MDEV-13884 - Wrong result
#-----------------------------------------------------------------------
@@ -204,40 +190,34 @@ disks.disks_notembedded : MDEV-21587 - Wrong result
#-----------------------------------------------------------------------
-encryption.create_or_replace : Modified in 10.2.35
-encryption.create_or_replace_big : Added in 10.2.35
-encryption.debug_key_management : MDEV-13841 - Timeout
-encryption.encrypt_and_grep : MDEV-13765 - Wrong result
-encryption.innochecksum : MDEV-13644 - Assertion failure
-encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket
-encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
-encryption.innodb-discard-import : MDEV-19113 - Timeout
-encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout
-encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition
-encryption.innodb-force-corrupt : MDEV-17286 - SSL error
-encryption.innodb-missing-key : MDEV-17286 - SSL error
-encryption.innodb-page_encryption : MDEV-10641 - mutex problem
-encryption.innodb-page_encryption_compression : Modified in 10.2.35
-encryption.innodb-page_encryption_log_encryption : Modified in 10.2.35
-encryption.innodb-read-only : MDEV-16563 - Crash on startup
-encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup
-encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition
-encryption.innodb-spatial-index : MDEV-13746 - Wrong result
-encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout
-encryption.innodb_encrypt_log : MDEV-13725 - Wrong result
-encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash
-encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result
-encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout
-encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
-encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result
-encryption.innodb_encryption_is : MDEV-12898 - Server hang on startup
-encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash
-encryption.innodb_first_page : MDEV-10689 - Crash
-encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart
-encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
-encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
-encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
-encryption.tempfiles_encrypted : Added in 10.2.35
+encryption.create_or_replace : MDEV-24081 - Lock wait timeout exceeded
+encryption.debug_key_management : MDEV-13841 - Timeout
+encryption.encrypt_and_grep : MDEV-13765 - Wrong result
+encryption.innochecksum : MDEV-13644 - Assertion failure
+encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket
+encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
+encryption.innodb-discard-import : MDEV-19113 - Timeout
+encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout
+encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition
+encryption.innodb-force-corrupt : MDEV-17286 - SSL error
+encryption.innodb-missing-key : MDEV-17286 - SSL error
+encryption.innodb-page_encryption : MDEV-10641 - mutex problem
+encryption.innodb-read-only : MDEV-16563 - Crash on startup
+encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition
+encryption.innodb-spatial-index : MDEV-13746 - Wrong result
+encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout
+encryption.innodb_encrypt_log : MDEV-13725 - Wrong result
+encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash
+encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result
+encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout
+encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
+encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result
+encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash
+encryption.innodb_first_page : MDEV-10689 - Crash
+encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart
+encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
+encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
+encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
#-----------------------------------------------------------------------
@@ -285,33 +265,20 @@ galera_3nodes.* : Suite is not stable yet
#-----------------------------------------------------------------------
-gcol.gcol_keys_innodb : Include file modified in 10.2.35
-gcol.gcol_keys_myisam : Include file modified in 10.2.35
-gcol.gcol_partition_innodb : Include file modified in 10.2.35
-gcol.gcol_update : Include file modified in 10.2.35
-gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion
-gcol.innodb_virtual_debug : MDEV-23111 - Server crash
-gcol.innodb_virtual_debug_purge : Include file modified in 10.2.35
-gcol.innodb_virtual_fk : Modified in 10.2.35
-gcol.innodb_virtual_index : Modified in 10.2.35
-gcol.innodb_virtual_purge : Include file modified in 10.2.35
+gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion
+gcol.innodb_virtual_debug : MDEV-23111 - Server crash
#-----------------------------------------------------------------------
innodb.101_compatibility : MDEV-13891 - Wrong result
innodb.alter_copy : MDEV-16181 - Assertion failure
innodb.alter_crash : MDEV-16944 - The process cannot access the file
-innodb.alter_table : Modified in 10.2.35
innodb.binlog_consistent : MDEV-10618 - Server fails to start
innodb.blob-crash : MDEV-20481 - Failures upon recovery
innodb.doublewrite : MDEV-12905 - Server crash
-innodb.foreign-keys : Modified in 10.2.35
-innodb.foreign_key : Modified in 10.2.35
innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed
innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch
innodb.ibuf_not_empty : MDEV-19021 - Wrong result
-innodb.innodb : Modified in 10.2.35
-innodb.innodb-64k : Modified in 10.2.35
innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup
innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
@@ -319,18 +286,15 @@ innodb.innodb-blob : MDEV-12053 - Client crash
innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query
innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown
innodb.innodb-get-fk : MDEV-13276 - Server crash
-innodb.innodb-index : Include file modified in 10.2.35
-innodb.innodb-index-debug : Include file modified in 10.2.35
innodb.innodb-index-online : MDEV-14809 - Cannot save statistics
innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure
innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result
innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem
innodb.innodb-table-online : MDEV-13894 - Wrong result
+innodb.innodb-ucs2 : MDEV-24505 - Assertion failure
innodb.innodb-wl5522-1 : MDEV-22945 - Server crash
innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno
innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc
-innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure
-innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt
innodb.innodb_bug30423 : MDEV-7311 - Wrong result
innodb.innodb_bug47167 : MDEV-20524 - Table 'user' is marked as crashed and should be repaired
innodb.innodb_bug48024 : MDEV-14352 - Assertion failure
@@ -339,14 +303,11 @@ innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full
innodb.innodb_information_schema : MDEV-8851 - Wrong result
innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed
innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result
-innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb_mysql : MDEV-19873 - Wrong result
innodb.innodb_stats : MDEV-10682 - wrong result
-innodb.innodb_stats_drop_locked : Modified in 10.2.35
innodb.innodb_stats_persistent : MDEV-21567 - Wrong result in execution plan
innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed
innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait
-innodb.innodb_trx_weight : Configuration deleted in 10.2.35
innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks
innodb.log_corruption : MDEV-13251 - Wrong result
innodb.log_data_file_size : MDEV-14204 - Server failed to start
@@ -357,24 +318,19 @@ innodb.purge_secondary : MDEV-15681 - Wrong result
innodb.purge_thread_shutdown : MDEV-13792 - Wrong result
innodb.read_only_recovery : MDEV-13886 - Server crash
innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile
-innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace; modified in 10.2.35
-innodb.stats_persistent : Added in 10.2.35
+innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning
innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start
innodb.temp_table_savepoint : MDEV-24077 - Assertion failure
innodb.temporary_table : MDEV-13265 - Wrong result
-innodb.truncate : Modified in 10.2.35
innodb.undo_truncate : MDEV-17340 - Server hung
innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away
-innodb.update-cascade : Combinations added in 10.2.35
innodb.update_time : MDEV-14804 - Wrong result
innodb.xa_recovery : MDEV-15279 - mysqld got exception
#-----------------------------------------------------------------------
-innodb_fts.basic : Modified in 10.2.35
innodb_fts.fulltext2 : MDEV-24074 - Server crash
-innodb_fts.innodb_fts_misc_1 : Modified in 10.2.35
innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning
innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log
innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed
@@ -383,13 +339,11 @@ innodb_fts.sync_ddl : MDEV-21568 - Errno: 2000
#-----------------------------------------------------------------------
innodb_gis.gis_split_nan : MDEV-21678 - Cannot get geometry object
-innodb_gis.rtree_add_index : Include file modified in 10.2.35
-innodb_gis.rtree_compress : Include file modified in 10.2.35
innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded
-innodb_gis.rtree_purge : MDEV-15275 - Timeout; include file modified in 10.2.35
+innodb_gis.rtree_purge : MDEV-15275 - Timeout
innodb_gis.rtree_recovery : MDEV-15274 - Error on check
innodb_gis.rtree_split : MDEV-14208 - Too many arguments
-innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file; include file modified in 10.2.35
+innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file
innodb_gis.types : MDEV-15679 - Table is marked as crashed
#-----------------------------------------------------------------------
@@ -412,24 +366,18 @@ maria.maria : MDEV-14430 - Extra warning
#-----------------------------------------------------------------------
-mariabackup.apply-log-only : MDEV-20135 - Timeout
-mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown
-mariabackup.data_directory : MDEV-15270 - Error on exec
-mariabackup.ddl_incremental_encrypted : Added in 10.2.35
-mariabackup.full_backup : MDEV-16571 - Wrong result
-mariabackup.huge_lsn : MDEV-17286 - SSL error
-mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure
-mariabackup.incremental_ddl_during_backup : Modified in 10.2.35
-mariabackup.incremental_encrypted : MDEV-15667 - Timeout
-mariabackup.innodb_redo_overwrite : Added in 10.2.35
-mariabackup.mdev-14447 : MDEV-15201 - Timeout
-mariabackup.mlog_index_load : Modified in 10.2.35
-mariabackup.partial_exclude : MDEV-15270 - Error on exec
-mariabackup.rpl_slave_info : Added in 10.2.35
-mariabackup.unencrypted_page_compressed : Include file modified in 10.2.35
-mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
-mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11
-mariabackup.xb_partition : MDEV-17584 - Crash on shutdown
+mariabackup.apply-log-only : MDEV-20135 - Timeout
+mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown
+mariabackup.data_directory : MDEV-15270 - Error on exec
+mariabackup.full_backup : MDEV-16571 - Wrong result
+mariabackup.huge_lsn : MDEV-17286 - SSL error
+mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure
+mariabackup.incremental_encrypted : MDEV-15667 - Timeout
+mariabackup.mdev-14447 : MDEV-15201 - Timeout
+mariabackup.partial_exclude : MDEV-15270 - Error on exec
+mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
+mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11
+mariabackup.xb_partition : MDEV-17584 - Crash on shutdown
#-----------------------------------------------------------------------
@@ -453,8 +401,6 @@ multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - Wrong result, MDE
multi_source.mdev-8874 : MDEV-19415 - AddressSanitizer: heap-use-after-free
multi_source.mdev-9544 : MDEV-19415 - AddressSanitizer: heap-use-after-free
multi_source.multisource : MDEV-10417 - Fails on Mips
-multi_source.reset_slave : MDEV-10690 - Wrong result
-multi_source.simple : MDEV-4633 - Wrong result
multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats
#-----------------------------------------------------------------------
@@ -503,7 +449,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained
plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such
plugins.processlist : MDEV-16574 - Wrong result
-plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.2.35
+plugins.server_audit : MDEV-9562 - crashes on sol10-sparc
plugins.thread_pool_server_audit : MDEV-14295 - Wrong result
#-----------------------------------------------------------------------
@@ -553,7 +499,6 @@ rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
rpl.rpl_binlog_errors : MDEV-12742 - Crash
-rpl.rpl_binlog_index : Modified in 10.2.35
rpl.rpl_checksum_cache : MDEV-22510 - Server crash
rpl.rpl_colSize : MDEV-16112 - Server crash
rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac
@@ -563,13 +508,10 @@ rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start
rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning
-rpl.rpl_filter_tables_dynamic : Modified in 10.2.35
-rpl.rpl_filter_wild_tables_dynamic : Modified in 10.2.35
rpl.rpl_flushlog_loop : MDEV-21570 - Server crash
rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output
rpl.rpl_gtid_basic : MDEV-10681 - server startup problem
-rpl.rpl_gtid_crash : MDEV-13643 - Lost connection; modified in 10.2.35
-rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout; MDEV-23103 - Could not delete gtid domain; modified in 10.2.35
+rpl.rpl_gtid_crash : MDEV-13643 - Lost connection
rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash
rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings
rpl.rpl_gtid_reconnect : MDEV-14497 - Crash
@@ -587,12 +529,9 @@ rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog
rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors
rpl.rpl_mdev6020 : MDEV-23426 - Server crash, ASAN failures; MDEV-15272 - Server crash
rpl.rpl_mixed_mixing_engines : MDEV-21266 - Timeout
-rpl.rpl_mysql_upgrade : Modified in 10.2.35
rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait
rpl.rpl_parallel : MDEV-10653 - Timeouts
-rpl.rpl_parallel2 : Modified in 10.2.35
rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash
-rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure
rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout
rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master
rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master
@@ -613,19 +552,15 @@ rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed
rpl.rpl_row_index_choice : MDEV-15196 - Slave crash
rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum
-rpl.rpl_semi_sync : MDEV-11220 - Wrong result
-rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result
-rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result
rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings
-rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures
+rpl.rpl_semi_sync_uninstall_plugin : MDEV-24561 - Wrong usage of mutex; MDEV-7140 - Assorted failures
rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition
rpl.rpl_show_slave_hosts : MDEV-10681 - Crash
rpl.rpl_skip_replication : MDEV-23372 - Extra warning
-rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock; ; modified in 10.2.35
rpl.rpl_slave_load_tmpdir_not_exist : MDEV-23372 - Extra warning
rpl.rpl_slow_query_log : MDEV-13250 - Test abort
rpl.rpl_sp_effects : MDEV-13249 - Crash
-rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout; modified in 10.2.35
+rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout
rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion
rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash
rpl.rpl_sync : MDEV-10633 - Database page corruption
@@ -635,7 +570,6 @@ rpl.rpl_trigger : MDEV-18055 - Wrong result
rpl.rpl_truncate_3innodb : MDEV-19454 - Sporadic syntax error
rpl.rpl_user_variables : MDEV-20522 - Wrong result
rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result
-rpl.show_status_stop_slave_race-7126 : Modified in 10.2.35
#-----------------------------------------------------------------------
@@ -682,14 +616,9 @@ sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected err
sys_vars.innodb_checksum_algorithm_basic : MDEV-21568 - Errno: 2000
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash
-sys_vars.replicate_do_db_basic : Modified in 10.2.35
-sys_vars.rpl_init_slave_func : Modified in 10.2.35
-sys_vars.session_track_system_variables_basic : Modified in 10.2.35
sys_vars.slow_query_log_func : MDEV-14273 - Wrong result
sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result
sys_vars.wait_timeout_func : MDEV-12896 - Wrong result
-sys_vars.wsrep_cluster_address_basic : Modified in 10.2.35
-sys_vars.wsrep_on_basic : Configuration deleted in 10.2.35
#-----------------------------------------------------------------------
@@ -721,7 +650,7 @@ tokudb_alter_table.hcad_all_add2 : MDEV-15269 - Timeout
#-----------------------------------------------------------------------
-tokudb_backup.* : MDEV-11001 - Missing include file
+tokudb_backup.* : MDEV-11001 - Missing include file (Won't fix)
#-----------------------------------------------------------------------
@@ -738,11 +667,11 @@ tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
#-----------------------------------------------------------------------
-tokudb_rpl.* : MDEV-11001 - Missing include file
+tokudb_rpl.* : MDEV-11001 - Missing include file (Won't fix)
#-----------------------------------------------------------------------
-tokudb_sys_vars.* : MDEV-11001 - Missing include file
+tokudb_sys_vars.* : MDEV-11001 - Missing include file (Won't fix)
#-----------------------------------------------------------------------
@@ -760,14 +689,13 @@ unit.mf_iocache : MDEV-20952 - Buffer overflow
vcol.not_supported : MDEV-10639 - Testcase timeout
vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
-vcol.vcol_misc : MDEV-16651 - Wrong error message; modified in 10.2.35
+vcol.vcol_misc : MDEV-16651 - Wrong error message
#-----------------------------------------------------------------------
wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node
wsrep.mdev_6832 : MDEV-14195 - Check testcase failed
wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use
-wsrep.variables : Modified in 10.2.35
#-----------------------------------------------------------------------
diff --git a/mysys/array.c b/mysys/array.c
index 07abc460de7..e8b253a9e99 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -138,8 +138,9 @@ void *alloc_dynamic(DYNAMIC_ARRAY *array)
array->size_of_element,
MYF(array->malloc_flags | MY_WME))))
DBUG_RETURN(0);
- memcpy(new_ptr, array->buffer,
- array->elements * array->size_of_element);
+ if (array->elements)
+ memcpy(new_ptr, array->buffer,
+ array->elements * array->size_of_element);
array->malloc_flags&= ~MY_INIT_BUFFER_USED;
}
else if (!(new_ptr=(char*)
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index 0dd0c1a94c6..a7553b349de 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -31,10 +31,10 @@
/* An element of the list */
typedef struct {
- intptr volatile link; /* a pointer to the next element in a list and a flag */
- uint32 hashnr; /* reversed hash number, for sorting */
+ intptr link; /* a pointer to the next element in a list and a flag */
const uchar *key;
size_t keylen;
+ uint32 hashnr; /* reversed hash number, for sorting */
/*
data is stored here, directly after the keylen.
thus the pointer to data is (void*)(slist_element_ptr+1)
@@ -48,7 +48,7 @@ const int LF_HASH_OVERHEAD= sizeof(LF_SLIST);
in a list) from l_find to l_insert/l_delete
*/
typedef struct {
- intptr volatile *prev;
+ intptr *prev;
LF_SLIST *curr, *next;
} CURSOR;
@@ -85,7 +85,7 @@ typedef struct {
0 - ok
1 - error (callbck returned 1)
*/
-static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
+static int l_find(LF_SLIST **head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins,
my_hash_walk_action callback)
{
@@ -168,7 +168,7 @@ retry:
it uses pins[0..2], on return all pins are removed.
if there're nodes with the same key value, a new node is added before them.
*/
-static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
+static LF_SLIST *l_insert(LF_SLIST **head, CHARSET_INFO *cs,
LF_SLIST *node, LF_PINS *pins, uint flags)
{
CURSOR cursor;
@@ -220,7 +220,7 @@ static LF_SLIST *l_insert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
NOTE
it uses pins[0..2], on return all pins are removed.
*/
-static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
+static int l_delete(LF_SLIST **head, CHARSET_INFO *cs, uint32 hashnr,
const uchar *key, uint keylen, LF_PINS *pins)
{
CURSOR cursor;
@@ -278,7 +278,7 @@ static int l_delete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
it uses pins[0..2], on return the pin[2] keeps the node found
all other pins are removed.
*/
-static LF_SLIST *l_search(LF_SLIST * volatile *head, CHARSET_INFO *cs,
+static LF_SLIST *l_search(LF_SLIST **head, CHARSET_INFO *cs,
uint32 hashnr, const uchar *key, uint keylen,
LF_PINS *pins)
{
@@ -319,7 +319,7 @@ static inline my_hash_value_type calc_hash(CHARSET_INFO *cs,
#define MAX_LOAD 1.0 /* average number of elements in a bucket */
-static int initialize_bucket(LF_HASH *, LF_SLIST * volatile*, uint, LF_PINS *);
+static int initialize_bucket(LF_HASH *, LF_SLIST **, uint, LF_PINS *);
static void default_initializer(LF_HASH *hash, void *dst, const void *src)
{
@@ -398,7 +398,7 @@ void lf_hash_destroy(LF_HASH *hash)
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
{
int csize, bucket, hashnr;
- LF_SLIST *node, * volatile *el;
+ LF_SLIST *node, **el;
node= (LF_SLIST *)lf_alloc_new(pins);
if (unlikely(!node))
@@ -437,7 +437,7 @@ int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
*/
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
{
- LF_SLIST * volatile *el;
+ LF_SLIST **el;
uint bucket, hashnr;
hashnr= hash->hash_function(hash->charset, (uchar *)key, keylen) & INT_MAX32;
@@ -473,7 +473,7 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins,
my_hash_value_type hashnr,
const void *key, uint keylen)
{
- LF_SLIST * volatile *el, *found;
+ LF_SLIST **el, *found;
uint bucket;
/* hide OOM errors - if we cannot initialize a bucket, try the previous one */
@@ -507,7 +507,7 @@ int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins,
CURSOR cursor;
uint bucket= 0;
int res;
- LF_SLIST * volatile *el;
+ LF_SLIST **el;
el= lf_dynarray_lvalue(&hash->array, bucket);
if (unlikely(!el))
@@ -539,13 +539,13 @@ static const uchar *dummy_key= (uchar*)"";
0 - ok
-1 - out of memory
*/
-static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
+static int initialize_bucket(LF_HASH *hash, LF_SLIST **node,
uint bucket, LF_PINS *pins)
{
uint parent= my_clear_highest_bit(bucket);
LF_SLIST *dummy= (LF_SLIST *)my_malloc(sizeof(LF_SLIST), MYF(MY_WME));
LF_SLIST **tmp= 0, *cur;
- LF_SLIST * volatile *el= lf_dynarray_lvalue(&hash->array, parent);
+ LF_SLIST **el= lf_dynarray_lvalue(&hash->array, parent);
if (unlikely(!el || !dummy))
return -1;
if (*el == NULL && bucket &&
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 3a49c749010..f0c0d214171 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -170,7 +170,7 @@ static pid_t pid;
static char addr2line_binary[1024];
static char output[1024];
static struct pollfd poll_fds;
-Dl_info info;
+static Dl_info info;
int start_addr2line_fork(const char *binary_path)
{
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 5bfcb455b8a..d67b8be9bb8 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -461,7 +461,7 @@ char *strmake_root(MEM_ROOT *root, const char *str, size_t len)
void *memdup_root(MEM_ROOT *root, const void *str, size_t len)
{
char *pos;
- if ((pos=alloc_root(root,len)))
+ if ((pos=alloc_root(root,len)) && len)
memcpy(pos,str,len);
return pos;
}
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 6a370b0ad43..db364ccddda 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -86,7 +86,7 @@ my_off_t my_tell(File fd, myf MyFlags)
DBUG_ENTER("my_tell");
DBUG_PRINT("my",("fd: %d MyFlags: %lu",fd, MyFlags));
DBUG_ASSERT(fd >= 0);
-#if defined (HAVE_TELL) && !defined (_WIN32)
+#if defined (HAVE_TELL) && !defined (_WIN32) && !defined(_AIX)
pos= tell(fd);
#else
pos= my_seek(fd, 0L, MY_SEEK_CUR,0);
diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt
index dbb4701fbc4..1f58c7567b3 100644
--- a/plugin/auth_pam/CMakeLists.txt
+++ b/plugin/auth_pam/CMakeLists.txt
@@ -4,10 +4,11 @@ INCLUDE (CheckFunctionExists)
CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
+CHECK_FUNCTION_EXISTS (getgrouplist HAVE_GETGROUPLIST)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
-# Check whether getgrouplist uses git_t for second and third arguments.
+# Check whether getgrouplist uses gtid_t for second and third arguments.
SET(CMAKE_REQUIRED_FLAGS -Werror)
CHECK_C_SOURCE_COMPILES(
"
@@ -29,7 +30,7 @@ SET(CMAKE_REQUIRED_LIBRARIES pam)
CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
SET(CMAKE_REQUIRED_LIBRARIES)
-IF(HAVE_PAM_APPL_H)
+IF(HAVE_PAM_APPL_H AND HAVE_GETGROUPLIST)
FIND_LIBRARY(PAM_LIBRARY pam) # for srpm build-depends detection
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY)
@@ -42,7 +43,7 @@ IF(HAVE_PAM_APPL_H)
INSTALL(FILES mapper/user_map.conf DESTINATION ${INSTALL_PAMDATADIR} COMPONENT Server)
ENDIF()
ENDIF()
-ENDIF(HAVE_PAM_APPL_H)
+ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config_auth_pam.h)
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 3210c1c9e41..55a7306e7c3 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -47,7 +47,7 @@ static int table_to_string(TABLE *table, String *result)
res= table->file->ha_rnd_init(1);
- dbug_tmp_use_all_columns(table, table->read_set);
+ dbug_tmp_use_all_columns(table, &table->read_set);
while(!res && !table->file->ha_rnd_next(table->record[0]))
{
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index a029b426ea1..666c928d7cc 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.9"
+#define PLUGIN_STR_VERSION "1.4.12"
#define _my_thread_var loc_thread_var
@@ -706,6 +706,8 @@ static char *coll_search(struct user_coll *c, const char *n, size_t len)
{
struct user_name un;
struct user_name *found;
+ if (!c->n_users)
+ return 0;
un.name_len= len;
un.name= (char *) n;
found= (struct user_name*) bsearch(&un, c->users, c->n_users,
@@ -736,7 +738,8 @@ static int coll_insert(struct user_coll *c, char *n, size_t len)
static void coll_sort(struct user_coll *c)
{
- qsort(c->users, c->n_users, sizeof(c->users[0]), cmp_users);
+ if (c->n_users)
+ qsort(c->users, c->n_users, sizeof(c->users[0]), cmp_users);
}
@@ -851,12 +854,8 @@ struct sa_keyword keywords_to_skip[]=
struct sa_keyword not_ddl_keywords[]=
{
- {4, "DROP", &function_word, SQLCOM_QUERY_ADMIN},
- {4, "DROP", &procedure_word, SQLCOM_QUERY_ADMIN},
{4, "DROP", &user_word, SQLCOM_DCL},
{6, "CREATE", &user_word, SQLCOM_DCL},
- {6, "CREATE", &function_word, SQLCOM_QUERY_ADMIN},
- {6, "CREATE", &procedure_word, SQLCOM_QUERY_ADMIN},
{6, "RENAME", &user_word, SQLCOM_DCL},
{0, NULL, 0, SQLCOM_DDL}
};
@@ -967,7 +966,8 @@ static void get_str_n(char *dest, int *dest_len, size_t dest_size,
if (src_len >= dest_size)
src_len= dest_size - 1;
- memcpy(dest, src, src_len);
+ if (src_len)
+ memcpy(dest, src, src_len);
dest[src_len]= 0;
*dest_len= (int)src_len;
}
@@ -1574,22 +1574,27 @@ no_password:
-static int do_log_user(const char *name, int take_lock)
+static int do_log_user(const char *name, int len,
+ const char *proxy, int proxy_len, int take_lock)
{
- size_t len;
int result;
if (!name)
return 0;
- len= strlen(name);
if (take_lock)
flogger_mutex_lock(&lock_operations);
if (incl_user_coll.n_users)
- result= coll_search(&incl_user_coll, name, len) != 0;
+ {
+ result= coll_search(&incl_user_coll, name, len) != 0 ||
+ (proxy && coll_search(&incl_user_coll, proxy, proxy_len) != 0);
+ }
else if (excl_user_coll.n_users)
- result= coll_search(&excl_user_coll, name, len) == 0;
+ {
+ result= coll_search(&excl_user_coll, name, len) == 0 &&
+ (proxy && coll_search(&excl_user_coll, proxy, proxy_len) == 0);
+ }
else
result= 1;
@@ -2063,13 +2068,9 @@ static void update_connection_info(struct connection_info *cn,
{
case MYSQL_AUDIT_CONNECTION_CONNECT:
setup_connection_connect(cn, event);
- if (event->status == 0 && event->proxy_user && event->proxy_user[0])
- log_proxy(cn, event);
break;
case MYSQL_AUDIT_CONNECTION_CHANGE_USER:
*after_action= AA_CHANGE_USER;
- if (event->proxy_user && event->proxy_user[0])
- log_proxy(cn, event);
break;
default:;
}
@@ -2134,7 +2135,9 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
}
if (event_class == MYSQL_AUDIT_GENERAL_CLASS && FILTER(EVENT_QUERY) &&
- cn && (cn->log_always || do_log_user(cn->user, 1)))
+ cn && (cn->log_always || do_log_user(cn->user, cn->user_length,
+ cn->proxy, cn->proxy_length,
+ 1)))
{
const struct mysql_event_general *event =
(const struct mysql_event_general *) ev;
@@ -2154,7 +2157,8 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
{
const struct mysql_event_table *event =
(const struct mysql_event_table *) ev;
- if (do_log_user(event->user, 1))
+ if (do_log_user(event->user, (int) SAFE_STRLEN(event->user),
+ cn->proxy, cn->proxy_length, 1))
{
switch (event->event_subclass)
{
@@ -2187,6 +2191,8 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
{
case MYSQL_AUDIT_CONNECTION_CONNECT:
log_connection(cn, event, event->status ? "FAILED_CONNECT": "CONNECT");
+ if (event->status == 0 && event->proxy_user && event->proxy_user[0])
+ log_proxy(cn, event);
break;
case MYSQL_AUDIT_CONNECTION_DISCONNECT:
if (use_event_data_for_disconnect)
@@ -2196,6 +2202,8 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
break;
case MYSQL_AUDIT_CONNECTION_CHANGE_USER:
log_connection(cn, event, "CHANGEUSER");
+ if (event->proxy_user && event->proxy_user[0])
+ log_proxy(cn, event);
break;
default:;
}
diff --git a/plugin/userstat/index_stats.cc b/plugin/userstat/index_stats.cc
index 87e6da63e38..1a7b0bbfcbd 100644
--- a/plugin/userstat/index_stats.cc
+++ b/plugin/userstat/index_stats.cc
@@ -26,7 +26,7 @@ static int index_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
tmp_table.grant.privilege= 0;
if (check_access(thd, SELECT_ACL, tmp_table.db,
&tmp_table.grant.privilege, NULL, 0, 1) ||
- check_grant(thd, SELECT_ACL, &tmp_table, 1, UINT_MAX, 1))
+ check_grant(thd, SELECT_ACL, &tmp_table, 1, 1, 1))
continue;
index_name= strend(tmp_table.table_name)+1;
diff --git a/plugin/userstat/table_stats.cc b/plugin/userstat/table_stats.cc
index 7b522a388d7..241855bdc86 100644
--- a/plugin/userstat/table_stats.cc
+++ b/plugin/userstat/table_stats.cc
@@ -31,8 +31,7 @@ static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
tmp_table.grant.privilege= 0;
if (check_access(thd, SELECT_ACL, tmp_table.db,
&tmp_table.grant.privilege, NULL, 0, 1) ||
- check_grant(thd, SELECT_ACL, &tmp_table, 1, UINT_MAX,
- 1))
+ check_grant(thd, SELECT_ACL, &tmp_table, 1, 1, 1))
continue;
table->field[0]->store(table_stats->table, schema_length,
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index e2fd853ce13..190d9f774fb 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -99,7 +99,6 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_db.sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
- ${CMAKE_CURRENT_SOURCE_DIR}/mysql_to_mariadb.sql
${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql
${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql
${FIX_PRIVILEGES_SQL}
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 8e0894c41b3..8baee4fef17 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -646,16 +646,31 @@ UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePr
ALTER TABLE user ADD plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL AFTER max_user_connections,
ADD authentication_string TEXT NOT NULL AFTER plugin;
-ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
- MODIFY authentication_string TEXT NOT NULL;
+ALTER TABLE user CHANGE auth_string authentication_string TEXT NOT NULL;
+
ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER authentication_string;
ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER password_expired;
ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL AFTER is_role;
ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL AFTER default_role;
+
-- Somewhere above, we ran ALTER TABLE user .... CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin.
--- we want password_expired column to have collation utf8_general_ci.
-ALTER TABLE user MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
-ALTER TABLE user MODIFY is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+-- we want password_expired column to have collation utf8_general_ci.
+-- Order columns correctly that were not ordered until MDEV-23201 (ff8ffef3e1915d7a9caa07d9461cd8d47c4baf98)
+
+ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL AFTER max_user_connections,
+ MODIFY authentication_string TEXT NOT NULL AFTER plugin,
+ MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER authentication_string,
+ MODIFY is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER password_expired,
+ MODIFY default_role char(80) binary DEFAULT '' NOT NULL AFTER is_role,
+ MODIFY max_statement_time decimal(12,6) DEFAULT 0 NOT NULL AFTER default_role,
+-- MDEV-24122 formerly mysql5.7 users may have the following columns password_last_changed,
+-- password_lifetime and account_locked. Ensure they are beyond the end of the user columns
+-- used by MariaDB. MariaDB-10.4 will use these in the creation of mysql.global_priv.
+-- password_last_changed has a DEFAULT/ON UPDATE of CURRENT_TIMESTAMP to keep track of
+-- time until 10.4 added.
+ MODIFY IF EXISTS password_last_changed timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER max_statement_time,
+ MODIFY IF EXISTS password_lifetime smallint unsigned DEFAULT NULL AFTER password_last_changed,
+ MODIFY IF EXISTS account_locked enum('N', 'Y') CHARACTER SET utf8 DEFAULT 'N' NOT NULL after password_lifetime;
-- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
-- older versions
diff --git a/scripts/mysql_to_mariadb.sql b/scripts/mysql_to_mariadb.sql
deleted file mode 100644
index 4ee3f3a4214..00000000000
--- a/scripts/mysql_to_mariadb.sql
+++ /dev/null
@@ -1,22 +0,0 @@
--- Script that changes MySQL 5.7 privilege tables to MariaDB 10.x
--- This should be run first with
--- mysql --force mysql < mysql_to_mariadb.sql
--- It's ok to ignore any errors, as these usually means that the tables are
--- already fixed.
-
--- After this script s run, one should run at least:
--- mysql_upgrade --upgrade-system-tables
--- to get the other tables in the mysql database fixed.
-
--- Drop not existing columnms
-alter table mysql.user drop column `password_last_changed`, drop column `password_lifetime`, drop column `account_locked`;
-
--- Change existing columns
-alter table mysql.user change column `authentication_string` `auth_string` text COLLATE utf8_bin NOT NULL;
-
--- Add new columns
-alter table mysql.user add column `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' after `user`, add column `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N' after `auth_string`;
-alter table mysql.user add column `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', add column `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000';
-
--- Fix passwords
-update mysql.user set `password`=`auth_string`, plugin='' where plugin="mysql_native_password";
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 0b33f61710e..77ed36218d3 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -308,7 +308,9 @@ sub report_mysqlds
sub start_mysqlds()
{
- my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
+ my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $suffix_found, $info_sent);
+
+ $suffix_found= 0;
if (!$opt_no_log)
{
@@ -327,6 +329,7 @@ sub start_mysqlds()
$mysqld_found= 1; # The default
$mysqld_found= 0 if (!length($mysqld));
$com= "$mysqld";
+
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
@@ -347,6 +350,10 @@ sub start_mysqlds()
$options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]";
}
+ elsif ("--defaults-group-suffix=" eq substr($options[$j], 0, 24))
+ {
+ $suffix_found= 1;
+ }
else
{
$options[$j]= quote_shell_word($options[$j]);
@@ -363,6 +370,12 @@ sub start_mysqlds()
$info_sent= 1;
}
+ if (!$suffix_found)
+ {
+ $com.= " --defaults-group-suffix=";
+ $com.= substr($groups[$i],6);
+ }
+
$com.= $tmp;
if ($opt_wsrep_new_cluster) {
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 0110653be90..dc2c0db8e40 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -155,7 +155,7 @@ log_generic () {
case $logging in
init) ;; # Just echo the message, don't save it anywhere
file)
- if [ -n "$helper" ]; then
+ if [ "$helper_exist" -eq "0" ]; then
echo "$msg" | "$helper" "$user" log "$err_log"
fi
;;
@@ -179,7 +179,7 @@ eval_log_error () {
local cmd="$1"
case $logging in
file)
- if [ -n "$helper" ]; then
+ if [ "$helper_exist" -eq "0" ]; then
cmd="$cmd 2>&1 | "`shell_quote_string "$helper"`" $user log "`shell_quote_string "$err_log"`
fi
;;
@@ -551,10 +551,9 @@ fi
helper=`find_in_bin mysqld_safe_helper`
print_defaults=`find_in_bin my_print_defaults`
-
# Check if helper exists
-$helper --help >/dev/null 2>&1 || helper=""
-
+command -v $helper --help >/dev/null 2>&1
+helper_exist=$?
#
# Second, try to find the data directory
#
@@ -962,7 +961,6 @@ fi
# Avoid 'nohup: ignoring input' warning
test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
-
log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
# variable to track the current number of "fast" (a.k.a. subsecond) restarts
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index f5adf0b0fd8..443cb26ab64 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -212,6 +212,9 @@ case "$1" in
"$option" != "--port" && \
"$option" != "--socket" ]]; then
value=${1#*=}
+ if [ "$value" == "$1" ]; then
+ value=""
+ fi
case "$option" in
'--innodb-data-home-dir')
if [ -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 231cf6e3702..4354e341ca5 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -868,10 +868,10 @@ then
fi
if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then
- INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD"
+ export MYSQL_PWD=$WSREP_SST_OPT_PSWD
elif [[ $usrst -eq 1 ]];then
- # Empty password, used for testing, debugging etc.
- INNOEXTRA+=" --password="
+ # Empty password, used for testing, debugging etc.
+ unset MYSQL_PWD
fi
get_keys
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index f50f94d6560..7e3f7b73301 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -398,6 +398,14 @@ then
MODULE="rsync_sst"
RSYNC_PID="$WSREP_SST_OPT_DATA/$MODULE.pid"
+ # give some time for lingering rsync from previous SST to complete
+ check_round=0
+ while check_pid $RSYNC_PID && [ $check_round -lt 10 ]
+ do
+ wsrep_log_info "lingering rsync daemon found at startup, waiting for it to exit"
+ check_round=$(( check_round + 1 ))
+ sleep 1
+ done
if check_pid $RSYNC_PID
then
diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
index 8fbbeda170c..8c8af9a0219 100644
--- a/scripts/wsrep_sst_xtrabackup-v2.sh
+++ b/scripts/wsrep_sst_xtrabackup-v2.sh
@@ -958,10 +958,10 @@ then
fi
if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then
- INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD"
+ export MYSQL_PWD=$WSREP_SST_OPT_PSWD
elif [[ $usrst -eq 1 ]];then
- # Empty password, used for testing, debugging etc.
- INNOEXTRA+=" --password="
+ # Empty password, used for testing, debugging etc.
+ unset MYSQL_PWD
fi
get_keys
diff --git a/sql/contributors.h b/sql/contributors.h
index 34f06087c8c..e16448ee985 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -37,22 +37,17 @@ struct show_table_contributors_st {
struct show_table_contributors_st show_table_contributors[]= {
/* MariaDB foundation sponsors, in contribution, size , time order */
- {"Booking.com", "https://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
{"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
+ {"ServiceNow", "https://servicenow.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"},
{"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
{"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"},
- {"Tencent Games", "http://game.qq.com/", "Gold Sponsor of the MariaDB Foundation"},
- {"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Acronis", "https://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent TDSQL", "http://tdsql.org", "Bronze Sponsor of the MariaDB Foundation"},
- {"Percona", "https://www.percona.com/", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Automattic", "https://automattic.com", "Silver Sponsor of the MariaDB Foundation"},
+ {"Percona", "https://www.percona.com/", "Sponsor of the MariaDB Foundation"},
+ {"Galera Cluster", "https://galeracluster.com", "Sponsor of the MariaDB Foundation"},
/* Sponsors of important features */
{"Google", "USA", "Sponsoring encryption, parallel replication and GTID"},
diff --git a/sql/create_options.cc b/sql/create_options.cc
index 4049443de2a..63552e60c4b 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -97,14 +97,13 @@ static bool report_unknown_option(THD *thd, engine_option_value *val,
{
DBUG_ENTER("report_unknown_option");
- if (val->parsed || suppress_warning)
+ if (val->parsed || suppress_warning || thd->slave_thread)
{
DBUG_PRINT("info", ("parsed => exiting"));
DBUG_RETURN(FALSE);
}
- if (!(thd->variables.sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
- !thd->slave_thread)
+ if (!(thd->variables.sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS))
{
my_error(ER_UNKNOWN_OPTION, MYF(0), val->name.str);
DBUG_RETURN(TRUE);
diff --git a/sql/field.cc b/sql/field.cc
index bdaaecc2026..652228beceb 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8255,7 +8255,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
DBUG_ASSERT(length <= max_data_length());
new_length= length;
- copy_length= (uint)MY_MIN(UINT_MAX,table->in_use->variables.group_concat_max_len);
+ copy_length= table->in_use->variables.group_concat_max_len;
if (new_length > copy_length)
{
new_length= Well_formed_prefix(cs,
@@ -8446,7 +8446,10 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
b_length=get_length(b_ptr);
if (b_length > max_length)
b_length=max_length;
- diff=memcmp(a,b,MY_MIN(a_length,b_length));
+ if (uint32 len= MY_MIN(a_length,b_length))
+ diff= memcmp(a,b,len);
+ else
+ diff= 0;
return diff ? diff : (int) (a_length - b_length);
}
@@ -8503,7 +8506,8 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
length=(uint) blob_length;
}
int2store(buff,length);
- memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length);
+ if (length)
+ memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length);
return HA_KEY_BLOB_LENGTH+length;
}
@@ -11162,7 +11166,7 @@ key_map Field::get_possible_keys()
bool Field::validate_value_in_record_with_warn(THD *thd, const uchar *record)
{
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->read_set);
bool rc;
if ((rc= validate_value_in_record(thd, record)))
{
@@ -11174,7 +11178,7 @@ bool Field::validate_value_in_record_with_warn(THD *thd, const uchar *record)
ER_THD(thd, ER_INVALID_DEFAULT_VALUE_FOR_FIELD),
ErrConvString(&tmp).ptr(), field_name);
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
return rc;
}
diff --git a/sql/field.h b/sql/field.h
index fea40251587..18e44f1d9d4 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1339,8 +1339,6 @@ public:
virtual uint max_packed_col_length(uint max_length)
{ return max_length;}
- virtual bool is_packable() const { return false; }
-
uint offset(uchar *record) const
{
return (uint) (ptr - record);
@@ -1829,7 +1827,6 @@ public:
bool can_optimize_range(const Item_bool_func *cond,
const Item *item,
bool is_eq_func) const;
- bool is_packable() const { return true; }
};
/* base class for float and double and decimal (old one) */
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 96f9aa874da..d76c39c3bd4 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1971,14 +1971,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
if (sortorder->field)
{
CHARSET_INFO *cs= sortorder->field->sort_charset();
- sortorder->type= sortorder->field->is_packable() ?
- SORT_FIELD_ATTR::VARIABLE_SIZE :
- SORT_FIELD_ATTR::FIXED_SIZE;
-
sortorder->length= sortorder->field->sort_length();
- if (sortorder->is_variable_sized())
- set_if_smaller(sortorder->length, thd->variables.max_sort_length);
-
if (use_strnxfrm((cs=sortorder->field->sort_charset())))
{
*multi_byte_charset= true;
@@ -1989,10 +1982,6 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
}
else
{
- sortorder->type= sortorder->item->type_handler()->is_packable() ?
- SORT_FIELD_ATTR::VARIABLE_SIZE :
- SORT_FIELD_ATTR::FIXED_SIZE;
-
sortorder->item->sortlength(thd, sortorder->item, sortorder);
if (use_strnxfrm(sortorder->item->collation.collation))
{
@@ -2001,8 +1990,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
if (sortorder->item->maybe_null)
length++; // Place for NULL marker
}
- if (sortorder->is_variable_sized())
- set_if_smaller(sortorder->length, thd->variables.max_sort_length);
+ set_if_smaller(sortorder->length, thd->variables.max_sort_length);
length+=sortorder->length;
}
sortorder->field= (Field*) 0; // end marker
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index daac3f6a86d..523e76e511e 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4124,7 +4124,7 @@ int ha_partition::write_row(uchar * buf)
int error;
longlong func_value;
bool have_auto_increment= table->next_number_field && buf == table->record[0];
- my_bitmap_map *old_map;
+ MY_BITMAP *old_map;
THD *thd= ha_thd();
sql_mode_t saved_sql_mode= thd->variables.sql_mode;
bool saved_auto_inc_field_not_null= table->auto_increment_field_not_null;
@@ -4173,9 +4173,9 @@ int ha_partition::write_row(uchar * buf)
}
}
- old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ old_map= dbug_tmp_use_all_columns(table, &table->read_set);
error= m_part_info->get_partition_id(m_part_info, &part_id, &func_value);
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
if (unlikely(error))
{
m_part_info->err_value= func_value;
diff --git a/sql/handler.cc b/sql/handler.cc
index d2408767530..87592beb5d3 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -838,6 +838,7 @@ static my_bool kill_handlerton(THD *thd, plugin_ref plugin,
{
handlerton *hton= plugin_hton(plugin);
+ mysql_mutex_assert_owner(&thd->LOCK_thd_data);
if (hton->state == SHOW_OPTION_YES && hton->kill_query &&
thd_get_ha_data(thd, hton))
hton->kill_query(hton, thd, *(enum thd_kill_levels *) level);
@@ -3118,6 +3119,13 @@ int handler::update_auto_increment()
(table->auto_increment_field_not_null &&
thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO))
{
+
+ /*
+ There could be an error reported because value was truncated
+ when strict mode is enabled.
+ */
+ if (thd->is_error())
+ DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
/*
Update next_insert_id if we had already generated a value in this
statement (case of INSERT VALUES(null),(3763),(null):
@@ -4839,6 +4847,7 @@ int ha_create_table(THD *thd, const char *path,
char name_buff[FN_REFLEN];
const char *name;
TABLE_SHARE share;
+ Abort_on_warning_instant_set old_abort_on_warning(thd, 0);
bool temp_table __attribute__((unused)) =
create_info->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER);
diff --git a/sql/handler.h b/sql/handler.h
index 0aa56afe1a5..e0e0604176d 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -584,8 +584,10 @@ struct xid_t {
void set(long f, const char *g, long gl, const char *b, long bl)
{
formatID= f;
- memcpy(data, g, gtrid_length= gl);
- memcpy(data+gl, b, bqual_length= bl);
+ if ((gtrid_length= gl))
+ memcpy(data, g, gl);
+ if ((bqual_length= bl))
+ memcpy(data+gl, b, bl);
}
void set(ulonglong xid)
{
@@ -1235,7 +1237,7 @@ struct handlerton
enum handler_create_iterator_result
(*create_iterator)(handlerton *hton, enum handler_iterator_type type,
struct handler_iterator *fill_this_in);
- int (*abort_transaction)(handlerton *hton, THD *bf_thd,
+ void (*abort_transaction)(handlerton *hton, THD *bf_thd,
THD *victim_thd, my_bool signal);
int (*set_checkpoint)(handlerton *hton, const XID* xid);
int (*get_checkpoint)(handlerton *hton, XID* xid);
@@ -1417,6 +1419,12 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
// MySQL compatibility. Unused.
#define HTON_SUPPORTS_FOREIGN_KEYS (1 << 0) //Foreign key constraint supported.
+/*
+ Table requires and close and reopen after truncate
+ If the handler has HTON_CAN_RECREATE, this flag is not used
+*/
+#define HTON_REQUIRES_CLOSE_AFTER_TRUNCATE (1 << 18)
+
class Ha_trx_info;
struct THD_TRANS
diff --git a/sql/item.cc b/sql/item.cc
index 994d45a9dc3..45f40874ddb 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1486,7 +1486,7 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
TABLE *table= field->table;
THD *thd= table->in_use;
enum_check_fields tmp= thd->count_cuted_fields;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
sql_mode_t sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
@@ -1495,7 +1495,7 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
res= save_in_field(field, no_conversions);
thd->count_cuted_fields= tmp;
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
thd->variables.sql_mode= sql_mode;
return res;
}
@@ -8160,6 +8160,22 @@ bool Item_direct_ref::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
}
+longlong Item_direct_ref::val_time_packed()
+{
+ longlong tmp = (*ref)->val_time_packed();
+ null_value= (*ref)->null_value;
+ return tmp;
+}
+
+
+longlong Item_direct_ref::val_datetime_packed()
+{
+ longlong tmp = (*ref)->val_datetime_packed();
+ null_value= (*ref)->null_value;
+ return tmp;
+}
+
+
Item_cache_wrapper::~Item_cache_wrapper()
{
DBUG_ASSERT(expr_cache == 0);
@@ -9674,7 +9690,7 @@ bool Item_cache_int::cache_value()
return FALSE;
value_cached= TRUE;
value= example->val_int_result();
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
unsigned_flag= example->unsigned_flag;
return TRUE;
}
@@ -9844,7 +9860,7 @@ bool Item_cache_temporal::cache_value()
return true;
value= pack_time(&ltime);
}
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return true;
}
@@ -9939,7 +9955,7 @@ bool Item_cache_real::cache_value()
return FALSE;
value_cached= TRUE;
value= example->val_result();
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return TRUE;
}
@@ -10001,7 +10017,8 @@ bool Item_cache_decimal::cache_value()
return FALSE;
value_cached= TRUE;
my_decimal *val= example->val_decimal_result(&decimal_value);
- if (!(null_value= example->null_value) && val != &decimal_value)
+ if (!(null_value_inside= null_value= example->null_value) &&
+ val != &decimal_value)
my_decimal2decimal(val, &decimal_value);
return TRUE;
}
@@ -10067,11 +10084,14 @@ Item *Item_cache_decimal::convert_to_basic_const_item(THD *thd)
bool Item_cache_str::cache_value()
{
if (!example)
+ {
+ DBUG_ASSERT(value_cached == FALSE);
return FALSE;
+ }
value_cached= TRUE;
value_buff.set(buffer, sizeof(buffer), example->collation.collation);
value= example->str_result(&value_buff);
- if ((null_value= example->null_value))
+ if ((null_value= null_value_inside= example->null_value))
value= 0;
else if (value != &value_buff)
{
@@ -10170,6 +10190,8 @@ Item *Item_cache_str::convert_to_basic_const_item(THD *thd)
bool Item_cache_row::setup(THD *thd, Item *item)
{
example= item;
+ null_value= true;
+
if (!values && allocate(thd, item->cols()))
return 1;
for (uint i= 0; i < item_count; i++)
@@ -10202,12 +10224,19 @@ bool Item_cache_row::cache_value()
if (!example)
return FALSE;
value_cached= TRUE;
- null_value= 0;
+ null_value= TRUE;
+ null_value_inside= false;
example->bring_value();
+
+ /*
+ For Item_cache_row null_value is set to TRUE only when ALL the values
+ inside the cache are NULL
+ */
for (uint i= 0; i < item_count; i++)
{
values[i]->cache_value();
- null_value|= values[i]->null_value;
+ null_value&= values[i]->null_value;
+ null_value_inside|= values[i]->null_value;
}
return TRUE;
}
diff --git a/sql/item.h b/sql/item.h
index a49f9e8e5e4..cb1e8519b27 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -818,6 +818,12 @@ public:
void set_name_for_rollback(THD *thd, const char *str, uint length,
CHARSET_INFO *cs);
void rename(char *new_name);
+ void share_name_with(Item *item)
+ {
+ name= item->name;
+ name_length= item->name_length;
+ is_autogenerated_name= item->is_autogenerated_name;
+ }
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
virtual void cleanup();
virtual void make_field(THD *thd, Send_field *field);
@@ -4665,13 +4671,16 @@ public:
return Item_ref::fix_fields(thd, it);
}
void save_val(Field *to);
+ /* Below we should have all val() methods as in Item_ref */
double val_real();
longlong val_int();
- String *val_str(String* tmp);
my_decimal *val_decimal(my_decimal *);
bool val_bool();
+ String *val_str(String* tmp);
bool is_null();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
+ longlong val_datetime_packed();
+ longlong val_time_packed();
virtual Ref_Type ref_type() { return DIRECT_REF; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_direct_ref>(thd, mem_root, this); }
@@ -4986,6 +4995,20 @@ public:
}
return Item_direct_ref::get_date(ltime, fuzzydate);
}
+ longlong val_time_packed()
+ {
+ if (check_null_ref())
+ return 0;
+ else
+ return Item_direct_ref::val_time_packed();
+ }
+ longlong val_datetime_packed()
+ {
+ if (check_null_ref())
+ return 0;
+ else
+ return Item_direct_ref::val_datetime_packed();
+ }
bool send(Protocol *protocol, String *buffer);
void save_org_in_field(Field *field,
fast_field_copier data __attribute__ ((__unused__)))
@@ -5635,6 +5658,14 @@ protected:
*/
bool value_cached;
public:
+ /*
+ This is set if at least one of the values of a sub query is NULL
+ Item_cache_row returns this with null_inside().
+ For not row items, it's set to the value of null_value
+ It is set after cache_value() is called.
+ */
+ bool null_value_inside;
+
Item_cache(THD *thd):
Item_basic_constant(thd),
Type_handler_hybrid_field_type(MYSQL_TYPE_STRING),
@@ -5644,6 +5675,7 @@ public:
fixed= 1;
maybe_null= 1;
null_value= 1;
+ null_value_inside= true;
}
protected:
Item_cache(THD *thd, enum_field_types field_type_arg):
@@ -5655,6 +5687,7 @@ protected:
fixed= 1;
maybe_null= 1;
null_value= 1;
+ null_value_inside= true;
}
public:
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 2a0972216f8..7b7604053e3 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -428,13 +428,13 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
TABLE *table= field->table;
sql_mode_t orig_sql_mode= thd->variables.sql_mode;
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
- my_bitmap_map *old_maps[2] = { NULL, NULL };
+ MY_BITMAP *old_maps[2] = { NULL, NULL };
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
/* table->read_set may not be set if we come here from a CREATE TABLE */
if (table && table->read_set)
dbug_tmp_use_all_columns(table, old_maps,
- table->read_set, table->write_set);
+ &table->read_set, &table->write_set);
/* For comparison purposes allow invalid dates like 2000-01-32 */
thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) |
MODE_INVALID_DATES;
@@ -478,7 +478,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
thd->variables.sql_mode= orig_sql_mode;
thd->count_cuted_fields= orig_count_cuted_fields;
if (table && table->read_set)
- dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_maps);
+ dbug_tmp_restore_column_maps(&table->read_set, &table->write_set, old_maps);
}
return result;
}
@@ -1234,7 +1234,9 @@ longlong Item_func_truth::val_int()
bool Item_in_optimizer::is_top_level_item()
{
- return ((Item_in_subselect *)args[1])->is_top_level_item();
+ if (!invisible_mode())
+ return ((Item_in_subselect *)args[1])->is_top_level_item();
+ return false;
}
@@ -1596,7 +1598,7 @@ longlong Item_in_optimizer::val_int()
DBUG_RETURN(res);
}
- if (cache->null_value)
+ if (cache->null_value_inside)
{
DBUG_PRINT("info", ("Left NULL..."));
/*
@@ -5261,6 +5263,7 @@ void Item_func_like::print(String *str, enum_query_type query_type)
longlong Item_func_like::val_int()
{
DBUG_ASSERT(fixed == 1);
+ DBUG_ASSERT(escape != -1);
String* res= args[0]->val_str(&cmp_value1);
if (args[0]->null_value)
{
@@ -5347,15 +5350,29 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str,
bool escape_used_in_parsing, CHARSET_INFO *cmp_cs,
int *escape)
{
- if (!escape_item->const_during_execution())
+ /*
+ ESCAPE clause accepts only constant arguments and Item_param.
+
+ Subqueries during context_analysis_only might decide they're
+ const_during_execution, but not quite const yet, not evaluate-able.
+ This is fine, as most of context_analysis_only modes will never
+ reach val_int(), so we won't need the value.
+ CONTEXT_ANALYSIS_ONLY_DERIVED being a notable exception here.
+ */
+ if (!escape_item->const_during_execution() ||
+ (!escape_item->const_item() &&
+ !(thd->lex->context_analysis_only & ~CONTEXT_ANALYSIS_ONLY_DERIVED)))
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE");
return TRUE;
}
-
+
+ IF_DBUG(*escape= -1,);
+
if (escape_item->const_item())
{
/* If we are on execution stage */
+ /* XXX is it safe to evaluate is_expensive() items here? */
String *escape_str= escape_item->val_str(tmp_str);
if (escape_str)
{
@@ -5413,7 +5430,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
{
DBUG_ASSERT(fixed == 0);
if (Item_bool_func2::fix_fields(thd, ref) ||
- escape_item->fix_fields(thd, &escape_item) ||
+ (!escape_item->fixed && escape_item->fix_fields(thd, &escape_item)) ||
fix_escape_item(thd, escape_item, &cmp_value1, escape_used_in_parsing,
cmp_collation.collation, &escape))
return TRUE;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 22736339bf6..26469d88929 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -2013,6 +2013,13 @@ public:
return this;
}
+ bool walk(Item_processor processor, bool walk_subquery, void *arg)
+ {
+ return walk_args(processor, walk_subquery, arg)
+ || escape_item->walk(processor, walk_subquery, arg)
+ || (this->*processor)(arg);
+ }
+
bool find_selective_predicates_list_processor(void *arg);
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 1cf5a06a3a4..4bfb2615fbe 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -202,7 +202,6 @@ public:
@return An item representing the function call
*/
virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) = 0;
-
protected:
/** Constructor. */
Create_func_arg2() {}
@@ -229,7 +228,6 @@ public:
@return An item representing the function call
*/
virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0;
-
protected:
/** Constructor. */
Create_func_arg3() {}
@@ -975,6 +973,19 @@ class Create_func_distance : public Create_func_arg2
Create_func_distance() {}
virtual ~Create_func_distance() {}
};
+
+
+class Create_func_distance_sphere: public Create_native_func
+{
+ public:
+ virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
+ static Create_func_distance_sphere s_singleton;
+
+ protected:
+ Create_func_distance_sphere() {}
+ virtual ~Create_func_distance_sphere() {}
+};
+
#endif
@@ -4761,6 +4772,26 @@ Create_func_glength::create_1_arg(THD *thd, Item *arg1)
{
return new (thd->mem_root) Item_func_glength(thd, arg1);
}
+
+
+Create_func_distance_sphere Create_func_distance_sphere::s_singleton;
+
+Item*
+Create_func_distance_sphere::create_native(THD *thd, LEX_STRING name,
+ List<Item> *item_list)
+{
+ int arg_count= 0;
+
+ if (item_list != NULL)
+ arg_count= item_list->elements;
+
+ if (arg_count < 2)
+ {
+ my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
+ return NULL;
+ }
+ return new (thd->mem_root) Item_func_sphere_distance(thd, *item_list);
+}
#endif
@@ -7051,6 +7082,7 @@ static Native_func_registry func_array[] =
{ { C_STRING_WITH_LEN("ST_WITHIN") }, GEOM_BUILDER(Create_func_within)},
{ { C_STRING_WITH_LEN("ST_X") }, GEOM_BUILDER(Create_func_x)},
{ { C_STRING_WITH_LEN("ST_Y") }, GEOM_BUILDER(Create_func_y)},
+ { { C_STRING_WITH_LEN("ST_DISTANCE_SPHERE") }, GEOM_BUILDER(Create_func_distance_sphere)},
{ { C_STRING_WITH_LEN("SUBSTRING_INDEX") }, BUILDER(Create_func_substr_index)},
{ { C_STRING_WITH_LEN("SUBTIME") }, BUILDER(Create_func_subtime)},
{ { C_STRING_WITH_LEN("TAN") }, BUILDER(Create_func_tan)},
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4d03e209eab..7b39b7710fb 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4882,7 +4882,8 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
length--; // Fix length change above
entry->value[length]= 0; // Store end \0
}
- memmove(entry->value, ptr, length);
+ if (length)
+ memmove(entry->value, ptr, length);
if (type == DECIMAL_RESULT)
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 1c3fafc0582..0daf9da4a81 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -145,7 +145,7 @@ String *Item_func_geometry_from_json::val_str(String *str)
{
String *sv= args[1]->val_str(&tmp_js);
my_error(ER_WRONG_VALUE_FOR_TYPE, MYF(0),
- "option", sv->c_ptr_safe(), "ST_GeometryFromJSON");
+ "option", sv->c_ptr_safe(), "ST_GeomFromGeoJSON");
null_value= 1;
return 0;
}
@@ -182,7 +182,7 @@ String *Item_func_geometry_from_json::val_str(String *str)
code= ER_GEOJSON_NOT_CLOSED;
break;
case Geometry::GEOJ_DIMENSION_NOT_SUPPORTED:
- my_error(ER_GIS_INVALID_DATA, MYF(0), "ST_GeometryFromJSON");
+ my_error(ER_GIS_INVALID_DATA, MYF(0), "ST_GeomFromGeoJSON");
break;
default:
report_json_error_ex(js, &je, func_name(), 0, Sql_condition::WARN_LEVEL_WARN);
@@ -2537,11 +2537,151 @@ mem_error:
}
+double Item_func_sphere_distance::val_real()
+{
+ /* To test null_value of item, first get well-known bytes as a backups */
+ String bak1, bak2;
+ String *arg1= args[0]->val_str(&bak1);
+ String *arg2= args[1]->val_str(&bak2);
+ double distance= 0.0;
+ double sphere_radius= 6370986.0; // Default radius equals Earth radius
+
+ null_value= (args[0]->null_value || args[1]->null_value);
+ if (null_value)
+ {
+ return 0;
+ }
+
+ if (arg_count == 3)
+ {
+ sphere_radius= args[2]->val_real();
+ // Radius cannot be Null
+ if (args[2]->null_value)
+ {
+ null_value= true;
+ return 0;
+ }
+ if (sphere_radius <= 0)
+ {
+ my_error(ER_INTERNAL_ERROR, MYF(0), "Radius must be greater than zero.");
+ return 1;
+ }
+ }
+ Geometry_buffer buffer1, buffer2;
+ Geometry *g1, *g2;
+ if (!(g1= Geometry::construct(&buffer1, arg1->ptr(), arg1->length())) ||
+ !(g2= Geometry::construct(&buffer2, arg2->ptr(), arg2->length())))
+ {
+ my_error(ER_GIS_INVALID_DATA, MYF(0), "ST_Distance_Sphere");
+ goto handle_errors;
+ }
+// Method allowed for points and multipoints
+ if (!(g1->get_class_info()->m_type_id == Geometry::wkb_point ||
+ g1->get_class_info()->m_type_id == Geometry::wkb_multipoint) ||
+ !(g2->get_class_info()->m_type_id == Geometry::wkb_point ||
+ g2->get_class_info()->m_type_id == Geometry::wkb_multipoint))
+ {
+ // Generate error message in case different geometry is used?
+ my_error(ER_INTERNAL_ERROR, MYF(0), func_name());
+ return 0;
+ }
+ distance= spherical_distance_points(g1, g2, sphere_radius);
+ if (distance < 0)
+ {
+ my_error(ER_INTERNAL_ERROR, MYF(0), "Returned distance cannot be negative.");
+ return 1;
+ }
+ return distance;
+
+ handle_errors:
+ return 0;
+}
+
+
+double Item_func_sphere_distance::spherical_distance_points(Geometry *g1,
+ Geometry *g2,
+ const double r)
+{
+ double res= 0.0;
+ // Length for the single point (25 Bytes)
+ uint32 len= SRID_SIZE + POINT_DATA_SIZE + WKB_HEADER_SIZE;
+ int error= 0;
+
+ switch (g2->get_class_info()->m_type_id)
+ {
+ case Geometry::wkb_point:
+ // Optimization for point-point case
+ if (g1->get_class_info()->m_type_id == Geometry::wkb_point)
+ {
+ res= static_cast<Gis_point *>(g2)->calculate_haversine(g1, r, &error);
+ }
+ else
+ {
+ // Optimization for single point in Multipoint
+ if (g1->get_data_size() == len)
+ {
+ res= static_cast<Gis_point *>(g2)->calculate_haversine(g1, r, &error);
+ }
+ else
+ {
+ // There are multipoints in g1
+ // g1 is MultiPoint and calculate MP.sphericaldistance from g2 Point
+ if (g1->get_data_size() != GET_SIZE_ERROR)
+ static_cast<Gis_point *>(g2)->spherical_distance_multipoints(
+ (Gis_multi_point *)g1, r, &res, &error);
+ }
+ }
+ break;
+
+ case Geometry::wkb_multipoint:
+ // Optimization for point-point case
+ if (g1->get_class_info()->m_type_id == Geometry::wkb_point)
+ {
+ // Optimization for single point in Multipoint g2
+ if (g2->get_data_size() == len)
+ {
+ res= static_cast<Gis_point *>(g1)->calculate_haversine(g2, r, &error);
+ }
+ else
+ {
+ if (g2->get_data_size() != GET_SIZE_ERROR)
+ // g1 is a point (casted to multi_point) and g2 multipoint
+ static_cast<Gis_point *>(g1)->spherical_distance_multipoints(
+ (Gis_multi_point *)g2, r, &res, &error);
+ }
+ }
+ else
+ {
+ // Multipoints in g1 and g2 - no optimization
+ static_cast<Gis_multi_point *>(g1)->spherical_distance_multipoints(
+ (Gis_multi_point *)g2, r, &res, &error);
+ }
+ break;
+
+ default:
+ DBUG_ASSERT(0);
+ break;
+ }
+
+ if (res < 0)
+ goto handle_error;
+
+ handle_error:
+ if (error > 0)
+ my_error(ER_STD_OUT_OF_RANGE_ERROR, MYF(0),
+ "Longitude should be [-180,180]", "ST_Distance_Sphere");
+ else if(error < 0)
+ my_error(ER_STD_OUT_OF_RANGE_ERROR, MYF(0),
+ "Latitude should be [-90,90]", "ST_Distance_Sphere");
+ return res;
+}
+
+
String *Item_func_pointonsurface::val_str(String *str)
{
Gcalc_operation_transporter trn(&func, &collector);
- DBUG_ENTER("Item_func_pointonsurface::val_real");
+ DBUG_ENTER("Item_func_pointonsurface::val_str");
DBUG_ASSERT(fixed == 1);
String *res= args[0]->val_str(&tmp_value);
Geometry_buffer buffer;
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index a858a9a2d57..efff940ec4b 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -714,6 +714,20 @@ public:
};
+class Item_func_sphere_distance: public Item_real_func
+{
+ double spherical_distance_points(Geometry *g1, Geometry *g2,
+ const double sphere_r);
+public:
+ Item_func_sphere_distance(THD *thd, List<Item> &list):
+ Item_real_func(thd, list) {}
+ double val_real();
+ const char *func_name() const { return "st_distance_sphere"; }
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_sphere_distance>(thd, mem_root, this); }
+};
+
+
class Item_func_pointonsurface: public Item_geometry_func
{
String tmp_value;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 802bfca64b7..4b8f118ca43 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -368,7 +368,7 @@ bool Item_subselect::mark_as_eliminated_processor(void *arg)
bool Item_subselect::eliminate_subselect_processor(void *arg)
{
unit->item= NULL;
- unit->exclude_from_tree();
+ unit->exclude();
eliminated= TRUE;
return FALSE;
}
@@ -437,6 +437,26 @@ bool Item_subselect::mark_as_dependent(THD *thd, st_select_lex *select,
/*
+ @brief
+ Update the table bitmaps for the outer references used within a subquery
+*/
+
+bool Item_subselect::update_table_bitmaps_processor(void *arg)
+{
+ List_iterator<Ref_to_outside> it(upper_refs);
+ Ref_to_outside *upper;
+
+ while ((upper= it++))
+ {
+ if (upper->item &&
+ upper->item->walk(&Item::update_table_bitmaps_processor, FALSE, arg))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+/*
Adjust attributes after our parent select has been merged into grandparent
DESCRIPTION
@@ -831,7 +851,7 @@ bool Item_subselect::expr_cache_is_needed(THD *thd)
inline bool Item_in_subselect::left_expr_has_null()
{
- return (*(optimizer->get_cache()))->null_value;
+ return (*(optimizer->get_cache()))->null_value_inside;
}
@@ -1299,7 +1319,17 @@ bool Item_singlerow_subselect::null_inside()
void Item_singlerow_subselect::bring_value()
{
if (!exec() && assigned())
- null_value= 0;
+ {
+ null_value= true;
+ for (uint i= 0; i < max_columns ; i++)
+ {
+ if (!row[i]->null_value)
+ {
+ null_value= false;
+ return;
+ }
+ }
+ }
else
reset();
}
@@ -1325,7 +1355,11 @@ longlong Item_singlerow_subselect::val_int()
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_int();
+ {
+ longlong val= value->val_int();
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1334,6 +1368,7 @@ longlong Item_singlerow_subselect::val_int()
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1342,7 +1377,11 @@ String *Item_singlerow_subselect::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_str(str);
+ {
+ String *res= value->val_str(str);
+ null_value= value->null_value;
+ return res;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1351,6 +1390,7 @@ String *Item_singlerow_subselect::val_str(String *str)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1360,7 +1400,11 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_decimal(decimal_value);
+ {
+ my_decimal *val= value->val_decimal(decimal_value);
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1369,6 +1413,7 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1378,7 +1423,11 @@ bool Item_singlerow_subselect::val_bool()
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_bool();
+ {
+ bool val= value->val_bool();
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1387,6 +1436,7 @@ bool Item_singlerow_subselect::val_bool()
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1396,7 +1446,11 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->get_date(ltime, fuzzydate);
+ {
+ bool val= value->get_date(ltime, fuzzydate);
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1405,6 +1459,7 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 1;
}
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 2292c22480f..130f90839e3 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -48,7 +48,11 @@ class Cached_item;
class Item_subselect :public Item_result_field,
protected Used_tables_and_const_cache
{
- bool value_assigned; /* value already assigned to subselect */
+ /*
+ Set to TRUE if the value is assigned for the subselect
+ FALSE: subquery not executed or the subquery returns an empty result
+ */
+ bool value_assigned;
bool own_engine; /* the engine was not taken from other Item_subselect */
protected:
/* thread handler, will be assigned in fix_fields only */
@@ -249,6 +253,7 @@ public:
@retval FALSE otherwise
*/
bool is_expensive_processor(void *arg) { return is_expensive(); }
+ bool update_table_bitmaps_processor(void *arg);
/**
Get the SELECT_LEX structure associated with this Item.
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index e50822e71f2..dd65f04a652 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2015, MariaDB
+ Copyright (c) 2008, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -464,7 +464,8 @@ Item_sum::Item_sum(THD *thd, Item_sum *item):
if (!(orig_args= (Item**) thd->alloc(sizeof(Item*)*arg_count)))
return;
}
- memcpy(orig_args, item->orig_args, sizeof(Item*)*arg_count);
+ if (arg_count)
+ memcpy(orig_args, item->orig_args, sizeof(Item*)*arg_count);
init_aggregator();
with_distinct= item->with_distinct;
if (item->aggr)
@@ -1136,7 +1137,8 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
check_sum_func(thd, ref))
return TRUE;
- memcpy (orig_args, args, sizeof (Item *) * arg_count);
+ if (arg_count)
+ memcpy (orig_args, args, sizeof (Item *) * arg_count);
fixed= 1;
return FALSE;
}
@@ -3169,7 +3171,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
{
Item_func_group_concat *item= (Item_func_group_concat *) item_arg;
TABLE *table= item->table;
- uint max_length= (uint)table->in_use->variables.group_concat_max_len;
+ uint max_length= table->in_use->variables.group_concat_max_len;
String tmp((char *)table->record[1], table->s->reclength,
default_charset_info);
String tmp2;
@@ -3312,7 +3314,8 @@ Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
/* orig_args is only used for print() */
orig_args= (Item**) (order + arg_count_order);
- memcpy(orig_args, args, sizeof(Item*) * arg_count);
+ if (arg_count)
+ memcpy(orig_args, args, sizeof(Item*) * arg_count);
}
@@ -3496,7 +3499,7 @@ bool Item_func_group_concat::repack_tree(THD *thd)
DBUG_ASSERT(tree->size_of_element == st.tree.size_of_element);
st.table= table;
st.len= 0;
- st.maxlen= (size_t)thd->variables.group_concat_max_len;
+ st.maxlen= thd->variables.group_concat_max_len;
tree_walk(tree, &copy_to_tree, &st, left_root_right);
if (st.len <= st.maxlen) // Copying aborted. Must be OOM
{
@@ -3517,7 +3520,7 @@ bool Item_func_group_concat::repack_tree(THD *thd)
decreases up to N=10 (that is, factor=1024) and then starts to increase,
again, very slowly.
*/
-#define GCONCAT_REPACK_FACTOR (1 << 10)
+#define GCONCAT_REPACK_FACTOR 10
bool Item_func_group_concat::add()
{
@@ -3563,7 +3566,7 @@ bool Item_func_group_concat::add()
{
THD *thd= table->in_use;
table->field[0]->store(row_str_len, FALSE);
- if (tree_len > thd->variables.group_concat_max_len * GCONCAT_REPACK_FACTOR
+ if ((tree_len >> GCONCAT_REPACK_FACTOR) > thd->variables.group_concat_max_len
&& tree->elements_in_tree > 1)
if (repack_tree(thd))
return 1;
@@ -3621,9 +3624,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
result.set_charset(collation.collation);
result_field= 0;
null_value= 1;
- max_length= (uint32)(thd->variables.group_concat_max_len
- / collation.collation->mbminlen
- * collation.collation->mbmaxlen);
+ max_length= (uint32)MY_MIN(thd->variables.group_concat_max_len
+ / collation.collation->mbminlen
+ * collation.collation->mbmaxlen, UINT_MAX32);
uint32 offset;
if (separator->needs_conversion(separator->length(), separator->charset(),
diff --git a/sql/key.cc b/sql/key.cc
index 18806efc18f..689b1e9c886 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -244,14 +244,13 @@ void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
else if (key_part->key_part_flag & HA_VAR_LENGTH_PART)
{
Field *field= key_part->field;
- my_bitmap_map *old_map;
my_ptrdiff_t ptrdiff= to_record - field->table->record[0];
field->move_field_offset(ptrdiff);
key_length-= HA_KEY_BLOB_LENGTH;
length= MY_MIN(key_length, key_part->length);
- old_map= dbug_tmp_use_all_columns(field->table, field->table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(field->table, &field->table->write_set);
field->set_key_image(from_key, length);
- dbug_tmp_restore_column_map(field->table->write_set, old_map);
+ dbug_tmp_restore_column_map(&field->table->write_set, old_map);
from_key+= HA_KEY_BLOB_LENGTH;
field->move_field_offset(-ptrdiff);
}
@@ -419,7 +418,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
void key_unpack(String *to, TABLE *table, KEY *key)
{
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->read_set);
DBUG_ENTER("key_unpack");
to->length(0);
@@ -441,7 +440,7 @@ void key_unpack(String *to, TABLE *table, KEY *key)
field_unpack(to, key_part->field, table->record[0], key_part->length,
MY_TEST(key_part->key_part_flag & HA_PART_KEY_SEG));
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_VOID_RETURN;
}
diff --git a/sql/log.cc b/sql/log.cc
index 54a8bd9552f..dc8df9c6fdb 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -4397,7 +4397,9 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
0, 0, &log_space_reclaimed);
mysql_mutex_lock(&rli->log_space_lock);
- rli->log_space_total-= log_space_reclaimed;
+ my_atomic_add64_explicit((volatile int64*)(&rli->log_space_total),
+ (-(int64)log_space_reclaimed),
+ MY_MEMORY_ORDER_RELAXED);
mysql_cond_broadcast(&rli->log_space_cond);
mysql_mutex_unlock(&rli->log_space_lock);
diff --git a/sql/log.h b/sql/log.h
index 0e6b2c895af..0770861fe01 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -716,7 +716,9 @@ public:
char buf1[22],buf2[22];
#endif
DBUG_ENTER("harvest_bytes_written");
- (*counter)+=bytes_written;
+
+ my_atomic_add64_explicit((volatile int64*)(counter), bytes_written,
+ MY_MEMORY_ORDER_RELAXED);
DBUG_PRINT("info",("counter: %s bytes_written: %s", llstr(*counter,buf1),
llstr(bytes_written,buf2)));
bytes_written=0;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 097cbe8da9d..c32f31db1f6 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -7150,10 +7150,10 @@ error:
if (thd->transaction_rollback_request)
{
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
else if (! thd->in_multi_stmt_transaction_mode())
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
else
thd->mdl_context.release_statement_locks();
@@ -8554,7 +8554,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
"COMMIT /* implicit, from Xid_log_event */");
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
res= trans_commit(thd); /* Automatically rolls back on error. */
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
#ifdef WITH_WSREP
if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
@@ -10718,7 +10718,7 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
There was the same problem with MERGE MYISAM tables and so here we try to
go the same way.
*/
-static void restore_empty_query_table_list(LEX *lex)
+inline void restore_empty_query_table_list(LEX *lex)
{
if (lex->first_not_own_table())
(*lex->first_not_own_table()->prev_global)= NULL;
@@ -10733,6 +10733,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
TABLE* table;
DBUG_ENTER("Rows_log_event::do_apply_event(Relay_log_info*)");
int error= 0;
+ LEX *lex= thd->lex;
+ uint8 new_trg_event_map= get_trg_event_map();
/*
If m_table_id == ~0ULL, then we have a dummy event that does not
contain any data. In that case, we just remove all tables in the
@@ -10823,27 +10825,29 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(action)));
};);
- if (slave_run_triggers_for_rbr)
- {
- LEX *lex= thd->lex;
- uint8 new_trg_event_map= get_trg_event_map();
-
- /*
- Trigger's procedures work with global table list. So we have to add
- rgi->tables_to_lock content there to get trigger's in the list.
+ /*
+ Trigger's procedures work with global table list. So we have to add
+ rgi->tables_to_lock content there to get trigger's in the list.
- Then restore_empty_query_table_list() restore the list as it was
- */
- DBUG_ASSERT(lex->query_tables == NULL);
- if ((lex->query_tables= rgi->tables_to_lock))
- rgi->tables_to_lock->prev_global= &lex->query_tables;
+ Then restore_empty_query_table_list() restore the list as it was
+ */
+ DBUG_ASSERT(lex->query_tables == NULL);
+ if ((lex->query_tables= rgi->tables_to_lock))
+ rgi->tables_to_lock->prev_global= &lex->query_tables;
- for (TABLE_LIST *tables= rgi->tables_to_lock; tables;
- tables= tables->next_global)
+ for (TABLE_LIST *tables= rgi->tables_to_lock; tables;
+ tables= tables->next_global)
+ {
+ if (slave_run_triggers_for_rbr)
{
tables->trg_event_map= new_trg_event_map;
lex->query_tables_last= &tables->next_global;
}
+ else if (!WSREP_ON)
+ {
+ tables->slave_fk_event_map= new_trg_event_map;
+ lex->query_tables_last= &tables->next_global;
+ }
}
if (open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0))
{
@@ -11193,8 +11197,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
}
/* remove trigger's tables */
- if (slave_run_triggers_for_rbr)
- restore_empty_query_table_list(thd->lex);
+ restore_empty_query_table_list(thd->lex);
#if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE)
if (WSREP(thd) && thd->wsrep_exec_mode == REPL_RECV)
@@ -11212,8 +11215,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
DBUG_RETURN(error);
err:
- if (slave_run_triggers_for_rbr)
- restore_empty_query_table_list(thd->lex);
+ restore_empty_query_table_list(thd->lex);
rgi->slave_close_thread_tables(thd);
DBUG_RETURN(error);
}
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 9eeb82eeffd..8cb21771991 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -1082,7 +1082,7 @@ MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout,
DBUG_ASSERT(!debug_sync_set_action((owner->get_thd()),
STRING_WITH_LEN(act)));
};);
- if (wsrep_thd_is_BF(owner->get_thd(), false))
+ if (WSREP_ON && wsrep_thd_is_BF(owner->get_thd(), false))
{
wait_result= mysql_cond_wait(&m_COND_wait_status, &m_LOCK_wait_status);
}
@@ -1155,7 +1155,7 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket)
*/
DBUG_ASSERT(ticket->get_lock());
#ifdef WITH_WSREP
- if ((this == &(ticket->get_lock()->m_waiting)) &&
+ if (WSREP_ON && (this == &(ticket->get_lock()->m_waiting)) &&
wsrep_thd_is_BF(ticket->get_ctx()->get_thd(), false))
{
Ticket_iterator itw(ticket->get_lock()->m_waiting);
@@ -1581,7 +1581,7 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
ticket->is_incompatible_when_granted(type_arg))
{
#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(requestor_ctx->get_thd(),false) &&
+ if (WSREP_ON && wsrep_thd_is_BF(requestor_ctx->get_thd(),false) &&
key.mdl_namespace() == MDL_key::GLOBAL)
{
WSREP_DEBUG("global lock granted for BF: %lu %s",
@@ -1615,7 +1615,7 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
}
else
{
- if (wsrep_thd_is_BF(requestor_ctx->get_thd(), false) &&
+ if (WSREP_ON && wsrep_thd_is_BF(requestor_ctx->get_thd(), false) &&
key.mdl_namespace() == MDL_key::GLOBAL)
{
WSREP_DEBUG("global lock granted for BF (waiting queue): %lu %s",
@@ -2842,6 +2842,9 @@ void MDL_context::rollback_to_savepoint(const MDL_savepoint &mdl_savepoint)
void MDL_context::release_transactional_locks()
{
DBUG_ENTER("MDL_context::release_transactional_locks");
+ /* Fail if there are active transactions */
+ DBUG_ASSERT(!(current_thd->server_status &
+ (SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY)));
release_locks_stored_before(MDL_STATEMENT, NULL);
release_locks_stored_before(MDL_TRANSACTION, NULL);
DBUG_VOID_RETURN;
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index 29d7074aeb1..434ae08fde0 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2015, MariaDB
+ Copyright (c) 2015, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -85,7 +85,6 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
do
{
- size_t copied;
uint elength, wlength, length;
uchar iv[MY_AES_BLOCK_SIZE]= {0};
@@ -116,11 +115,13 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_ASSERT(length <= info->buffer_length);
- copied= MY_MIN(Count, (size_t)(length - pos_offset));
-
- memcpy(Buffer, info->buffer + pos_offset, copied);
- Count-= copied;
- Buffer+= copied;
+ size_t copied= MY_MIN(Count, (size_t)(length - pos_offset));
+ if (copied)
+ {
+ memcpy(Buffer, info->buffer + pos_offset, copied);
+ Count-= copied;
+ Buffer+= copied;
+ }
info->read_pos= info->buffer + pos_offset + copied;
info->read_end= info->buffer + length;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d3e124e3405..48121ce2ea2 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -385,7 +385,6 @@ static bool binlog_format_used= false;
LEX_STRING opt_init_connect, opt_init_slave;
mysql_cond_t COND_thread_cache;
static mysql_cond_t COND_flush_thread_cache;
-mysql_cond_t COND_slave_background;
static DYNAMIC_ARRAY all_options;
/* Global variables */
@@ -758,7 +757,7 @@ mysql_mutex_t
LOCK_crypt,
LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list,
- LOCK_connection_count, LOCK_error_messages, LOCK_slave_background;
+ LOCK_connection_count, LOCK_error_messages;
mysql_mutex_t LOCK_stats, LOCK_global_user_client_stats,
LOCK_global_table_stats, LOCK_global_index_stats;
@@ -947,8 +946,7 @@ PSI_mutex_key key_LOCK_stats,
PSI_mutex_key key_LOCK_gtid_waiting;
PSI_mutex_key key_LOCK_after_binlog_sync;
-PSI_mutex_key key_LOCK_prepare_ordered, key_LOCK_commit_ordered,
- key_LOCK_slave_background;
+PSI_mutex_key key_LOCK_prepare_ordered, key_LOCK_commit_ordered;
PSI_mutex_key key_TABLE_SHARE_LOCK_share;
static PSI_mutex_info all_server_mutexes[]=
@@ -1017,7 +1015,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_prepare_ordered, "LOCK_prepare_ordered", PSI_FLAG_GLOBAL},
{ &key_LOCK_after_binlog_sync, "LOCK_after_binlog_sync", PSI_FLAG_GLOBAL},
{ &key_LOCK_commit_ordered, "LOCK_commit_ordered", PSI_FLAG_GLOBAL},
- { &key_LOCK_slave_background, "LOCK_slave_background", PSI_FLAG_GLOBAL},
{ &key_LOG_INFO_lock, "LOG_INFO::lock", 0},
{ &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL},
@@ -1074,7 +1071,7 @@ PSI_cond_key key_TC_LOG_MMAP_COND_queue_busy;
PSI_cond_key key_COND_rpl_thread_queue, key_COND_rpl_thread,
key_COND_rpl_thread_stop, key_COND_rpl_thread_pool,
key_COND_parallel_entry, key_COND_group_commit_orderer,
- key_COND_prepare_ordered, key_COND_slave_background;
+ key_COND_prepare_ordered;
PSI_cond_key key_COND_wait_gtid, key_COND_gtid_ignore_duplicates;
static PSI_cond_info all_server_conds[]=
@@ -1124,7 +1121,6 @@ static PSI_cond_info all_server_conds[]=
{ &key_COND_parallel_entry, "COND_parallel_entry", 0},
{ &key_COND_group_commit_orderer, "COND_group_commit_orderer", 0},
{ &key_COND_prepare_ordered, "COND_prepare_ordered", 0},
- { &key_COND_slave_background, "COND_slave_background", 0},
{ &key_COND_start_thread, "COND_start_thread", PSI_FLAG_GLOBAL},
{ &key_COND_wait_gtid, "COND_wait_gtid", 0},
{ &key_COND_gtid_ignore_duplicates, "COND_gtid_ignore_duplicates", 0}
@@ -2015,8 +2011,11 @@ static void __cdecl kill_server(int sig_ptr)
close_connections();
+#ifdef WITH_WSREP
if (wsrep_inited == 1)
wsrep_deinit(true);
+ wsrep_sst_auth_free();
+#endif /* WITH_WSREP */
if (sig != MYSQL_KILL_SIGNAL &&
sig != 0)
@@ -2136,6 +2135,7 @@ extern "C" void unireg_abort(int exit_code)
/* In bootstrap mode we deinitialize wsrep here. */
if (opt_bootstrap && wsrep_inited)
wsrep_deinit(true);
+ wsrep_sst_auth_free();
}
#endif // WITH_WSREP
@@ -2379,8 +2379,6 @@ static void clean_up_mutexes()
mysql_cond_destroy(&COND_prepare_ordered);
mysql_mutex_destroy(&LOCK_after_binlog_sync);
mysql_mutex_destroy(&LOCK_commit_ordered);
- mysql_mutex_destroy(&LOCK_slave_background);
- mysql_cond_destroy(&COND_slave_background);
DBUG_VOID_RETURN;
}
@@ -4838,9 +4836,6 @@ static int init_thread_environment()
MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_commit_ordered, &LOCK_commit_ordered,
MY_MUTEX_INIT_SLOW);
- mysql_mutex_init(key_LOCK_slave_background, &LOCK_slave_background,
- MY_MUTEX_INIT_SLOW);
- mysql_cond_init(key_COND_slave_background, &COND_slave_background, NULL);
#ifdef HAVE_OPENSSL
mysql_mutex_init(key_LOCK_des_key_file,
@@ -5422,6 +5417,10 @@ static int init_server_components()
that there are unprocessed options.
*/
my_getopt_skip_unknown= 0;
+#ifdef WITH_WSREP
+ if (wsrep_recovery)
+ my_getopt_skip_unknown= TRUE;
+#endif
if ((ho_error= handle_options(&remaining_argc, &remaining_argv, no_opts,
mysqld_get_one_option)))
@@ -5431,20 +5430,27 @@ static int init_server_components()
remaining_argv--;
my_getopt_skip_unknown= TRUE;
- if (remaining_argc > 1)
+#ifdef WITH_WSREP
+ if (!wsrep_recovery)
{
- fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n",
- my_progname, remaining_argv[1]);
- unireg_abort(1);
+#endif
+ if (remaining_argc > 1)
+ {
+ fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n",
+ my_progname, remaining_argv[1]);
+ unireg_abort(1);
+ }
+#ifdef WITH_WSREP
}
+#endif
}
- if (init_io_cache_encryption())
- unireg_abort(1);
-
if (opt_abort)
unireg_abort(0);
+ if (init_io_cache_encryption())
+ unireg_abort(1);
+
/* if the errmsg.sys is not loaded, terminate to maintain behaviour */
if (!DEFAULT_ERRMSGS[0][0])
unireg_abort(1);
@@ -8435,8 +8441,11 @@ static int show_memory_used(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_LONGLONG;
var->value= buff;
if (scope == OPT_GLOBAL)
+ {
+ calc_sum_of_all_status_if_needed(status_var);
*(longlong*) buff= (status_var->global_memory_used +
status_var->local_memory_used);
+ }
else
*(longlong*) buff= status_var->local_memory_used;
return 0;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 2947734901c..64e5aef5946 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -568,8 +568,7 @@ extern mysql_mutex_t
LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_user_conn,
- LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count,
- LOCK_slave_background;
+ LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count;
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count,
LOCK_global_system_variables;
extern mysql_mutex_t LOCK_start_thread;
@@ -583,7 +582,6 @@ extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern mysql_prlock_t LOCK_system_variables_hash;
extern mysql_cond_t COND_thread_count, COND_start_thread;
extern mysql_cond_t COND_manager;
-extern mysql_cond_t COND_slave_background;
extern int32 thread_running;
extern int32 thread_count, service_thread_count;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 798b1f284bc..f3f184367c9 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -3248,8 +3248,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
void store_key_image_to_rec(Field *field, uchar *ptr, uint len)
{
- /* Do the same as print_key() does */
- my_bitmap_map *old_map;
+ /* Do the same as print_key() does */
if (field->real_maybe_null())
{
@@ -3261,10 +3260,10 @@ void store_key_image_to_rec(Field *field, uchar *ptr, uint len)
field->set_notnull();
ptr++;
}
- old_map= dbug_tmp_use_all_columns(field->table,
- field->table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(field->table,
+ &field->table->write_set);
field->set_key_image(ptr, len);
- dbug_tmp_restore_column_map(field->table->write_set, old_map);
+ dbug_tmp_restore_column_map(&field->table->write_set, old_map);
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -3479,7 +3478,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
PART_PRUNE_PARAM prune_param;
MEM_ROOT alloc;
RANGE_OPT_PARAM *range_par= &prune_param.range_param;
- my_bitmap_map *old_sets[2];
+ MY_BITMAP *old_sets[2];
prune_param.part_info= part_info;
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0,
@@ -3495,7 +3494,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
}
dbug_tmp_use_all_columns(table, old_sets,
- table->read_set, table->write_set);
+ &table->read_set, &table->write_set);
range_par->thd= thd;
range_par->table= table;
/* range_par->cond doesn't need initialization */
@@ -3592,7 +3591,7 @@ all_used:
retval= FALSE; // some partitions are used
mark_all_partitions_as_used(prune_param.part_info);
end:
- dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
+ dbug_tmp_restore_column_maps(&table->read_set, &table->write_set, old_sets);
thd->no_errors=0;
thd->mem_root= range_par->old_root;
free_root(&alloc,MYF(0)); // Return memory & allocator
@@ -7158,6 +7157,30 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param,
if (array->count > NOT_IN_IGNORE_THRESHOLD || !value_item)
DBUG_RETURN(0);
+ /*
+ If this is "unique_key NOT IN (...)", do not consider it sargable (for
+ any index, not just the unique one). The logic is as follows:
+ - if there are only a few constants, this condition is not selective
+ (unless the table is also very small in which case we won't gain
+ anything)
+ - If there are a lot of constants, the overhead of building and
+ processing enormous range list is not worth it.
+ */
+ if (param->using_real_indexes)
+ {
+ key_map::Iterator it(field->key_start);
+ uint key_no;
+ while ((key_no= it++) != key_map::Iterator::BITMAP_END)
+ {
+ KEY *key_info= &field->table->key_info[key_no];
+ if (key_info->user_defined_key_parts == 1 &&
+ (key_info->flags & HA_NOSAME))
+ {
+ DBUG_RETURN(0);
+ }
+ }
+ }
+
/* Get a SEL_TREE for "(-inf|NULL) < X < c_0" interval. */
uint i=0;
do
@@ -10362,6 +10385,7 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
uint keynr= param->real_keynr[idx];
DBUG_ENTER("check_quick_select");
+ param->is_ror_scan= FALSE;
/* Handle cases when we don't have a valid non-empty list of range */
if (!tree)
DBUG_RETURN(HA_POS_ERROR);
@@ -14786,6 +14810,113 @@ static void print_ror_scans_arr(TABLE *table, const char *msg,
DBUG_VOID_RETURN;
}
+static String dbug_print_sel_arg_buf;
+
+static void
+print_sel_arg_key(Field *field, const uchar *key, String *out)
+{
+ TABLE *table= field->table;
+ MY_BITMAP *old_sets[2];
+ dbug_tmp_use_all_columns(table, old_sets, &table->read_set, &table->write_set);
+
+ if (field->real_maybe_null())
+ {
+ if (*key)
+ {
+ out->append("NULL");
+ goto end;
+ }
+ key++; // Skip null byte
+ }
+
+ field->set_key_image(key, field->pack_length());
+
+ if (field->type() == MYSQL_TYPE_BIT)
+ (void) field->val_int_as_str(out, 1);
+ else
+ field->val_str(out);
+
+end:
+ dbug_tmp_restore_column_maps(&table->read_set, &table->write_set, old_sets);
+}
+
+
+/*
+ @brief
+ Produce a string representation of an individual SEL_ARG and return pointer
+ to it
+
+ @detail
+ Intended usage:
+
+ (gdb) p dbug_print_sel_arg(ptr)
+*/
+
+const char *dbug_print_sel_arg(SEL_ARG *sel_arg)
+{
+ StringBuffer<64> buf;
+ String &out= dbug_print_sel_arg_buf;
+ out.length(0);
+
+ if (!sel_arg)
+ {
+ out.append("NULL");
+ goto end;
+ }
+
+ out.append("SEL_ARG(");
+
+ const char *stype;
+ switch(sel_arg->type) {
+ case SEL_ARG::IMPOSSIBLE:
+ stype="IMPOSSIBLE";
+ break;
+ case SEL_ARG::MAYBE:
+ stype="MAYBE";
+ break;
+ case SEL_ARG::MAYBE_KEY:
+ stype="MAYBE_KEY";
+ break;
+ case SEL_ARG::KEY_RANGE:
+ default:
+ stype= NULL;
+ }
+
+ if (stype)
+ {
+ out.append("type=");
+ out.append(stype);
+ goto end;
+ }
+
+ if (sel_arg->min_flag & NO_MIN_RANGE)
+ out.append("-inf");
+ else
+ {
+ print_sel_arg_key(sel_arg->field, sel_arg->min_value, &buf);
+ out.append(buf);
+ }
+
+ out.append((sel_arg->min_flag & NEAR_MIN)? "<" : "<=");
+
+ out.append(sel_arg->field->field_name);
+
+ out.append((sel_arg->max_flag & NEAR_MAX)? "<" : "<=");
+
+ if (sel_arg->max_flag & NO_MAX_RANGE)
+ out.append("+inf");
+ else
+ {
+ print_sel_arg_key(sel_arg->field, sel_arg->max_value, &buf);
+ out.append(buf);
+ }
+
+ out.append(")");
+
+end:
+ return dbug_print_sel_arg_buf.c_ptr_safe();
+}
+
/*****************************************************************************
** Print a quick range for debugging
@@ -14801,9 +14932,9 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length)
const uchar *key_end= key+used_length;
uint store_length;
TABLE *table= key_part->field->table;
- my_bitmap_map *old_sets[2];
+ MY_BITMAP *old_sets[2];
- dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set);
+ dbug_tmp_use_all_columns(table, old_sets, &table->read_set, &table->write_set);
for (; key < key_end; key+=store_length, key_part++)
{
@@ -14830,7 +14961,7 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length)
if (key+store_length < key_end)
fputc('/',DBUG_FILE);
}
- dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
+ dbug_tmp_restore_column_maps(&table->read_set, &table->write_set, old_sets);
}
@@ -14838,16 +14969,16 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg)
{
char buf[MAX_KEY/8+1];
TABLE *table;
- my_bitmap_map *old_sets[2];
+ MY_BITMAP *old_sets[2];
DBUG_ENTER("print_quick");
if (!quick)
DBUG_VOID_RETURN;
DBUG_LOCK_FILE;
table= quick->head;
- dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set);
+ dbug_tmp_use_all_columns(table, old_sets, &table->read_set, &table->write_set);
quick->dbug_dump(0, TRUE);
- dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets);
+ dbug_tmp_restore_column_maps(&table->read_set, &table->write_set, old_sets);
fprintf(DBUG_FILE,"other_keys: 0x%s:\n", needed_reg->print(buf));
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 02b95dae44a..868d8b26f4b 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -830,7 +830,10 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
if (is_field_part)
{
if (between || eq_type)
+ {
*range_fl&= ~(NO_MAX_RANGE | NO_MIN_RANGE);
+ *range_fl&= ~(max_fl ? NEAR_MAX : NEAR_MIN);
+ }
else
{
*range_fl&= ~(max_fl ? NO_MAX_RANGE : NO_MIN_RANGE);
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index ef817fffe1e..503b523a66c 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1642,13 +1642,13 @@ void partition_info::print_no_partition_found(TABLE *table_arg, myf errflag)
buf_ptr= (char*)"from column_list";
else
{
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table_arg, table_arg->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table_arg, &table_arg->read_set);
if (part_expr->null_value)
buf_ptr= (char*)"NULL";
else
longlong10_to_str(err_value, buf,
part_expr->unsigned_flag ? 10 : -10);
- dbug_tmp_restore_column_map(table_arg->read_set, old_map);
+ dbug_tmp_restore_column_map(&table_arg->read_set, old_map);
}
my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, errflag, buf_ptr);
}
diff --git a/sql/protocol.cc b/sql/protocol.cc
index de6d1b96f76..1bffcfb3bdb 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1250,15 +1250,15 @@ bool Protocol_text::store(Field *field)
CHARSET_INFO *tocs= this->thd->variables.character_set_results;
#ifndef DBUG_OFF
TABLE *table= field->table;
- my_bitmap_map *old_map= 0;
+ MY_BITMAP *old_map= 0;
if (table->file)
- old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ old_map= dbug_tmp_use_all_columns(table, &table->read_set);
#endif
field->val_str(&str);
#ifndef DBUG_OFF
if (old_map)
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
#endif
return store_string_aux(str.ptr(), str.length(), str.charset(), tocs);
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 43fdeec9e6a..a8f7641fce4 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -432,7 +432,7 @@ rpl_slave_state::truncate_state_table(THD *thd)
close_thread_tables(thd);
ha_commit_trans(thd, TRUE);
}
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
reenable_binlog(thd);
@@ -726,7 +726,7 @@ end:
}
else
{
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
#ifdef HAVE_REPLICATION
rpl_group_info::pending_gtid_deletes_free(elist);
#endif
diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc
index 53999d57bf6..3bcc0204036 100644
--- a/sql/rpl_injector.cc
+++ b/sql/rpl_injector.cc
@@ -68,34 +68,34 @@ injector::transaction::~transaction()
*/
int injector::transaction::commit()
{
- DBUG_ENTER("injector::transaction::commit()");
- int error= m_thd->binlog_flush_pending_rows_event(true);
- /*
- Cluster replication does not preserve statement or
- transaction boundaries of the master. Instead, a new
- transaction on replication slave is started when a new GCI
- (global checkpoint identifier) is issued, and is committed
- when the last event of the check point has been received and
- processed. This ensures consistency of each cluster in
- cluster replication, and there is no requirement for stronger
- consistency: MySQL replication is asynchronous with other
- engines as well.
-
- A practical consequence of that is that row level replication
- stream passed through the injector thread never contains
- COMMIT events.
- Here we should preserve the server invariant that there is no
- outstanding statement transaction when the normal transaction
- is committed by committing the statement transaction
- explicitly.
- */
- trans_commit_stmt(m_thd);
- if (!trans_commit(m_thd))
- {
- close_thread_tables(m_thd);
- m_thd->mdl_context.release_transactional_locks();
- }
- DBUG_RETURN(error);
+ DBUG_ENTER("injector::transaction::commit()");
+ int error= m_thd->binlog_flush_pending_rows_event(true);
+ /*
+ Cluster replication does not preserve statement or
+ transaction boundaries of the master. Instead, a new
+ transaction on replication slave is started when a new GCI
+ (global checkpoint identifier) is issued, and is committed
+ when the last event of the check point has been received and
+ processed. This ensures consistency of each cluster in
+ cluster replication, and there is no requirement for stronger
+ consistency: MySQL replication is asynchronous with other
+ engines as well.
+
+ A practical consequence of that is that row level replication
+ stream passed through the injector thread never contains
+ COMMIT events.
+ Here we should preserve the server invariant that there is no
+ outstanding statement transaction when the normal transaction
+ is committed by committing the statement transaction
+ explicitly.
+ */
+ trans_commit_stmt(m_thd);
+ if (!trans_commit(m_thd))
+ {
+ close_thread_tables(m_thd);
+ m_thd->release_transactional_locks();
+ }
+ DBUG_RETURN(error);
}
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 4cf87ba73b7..869640fd46f 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -4,6 +4,7 @@
#include "rpl_mi.h"
#include "sql_parse.h"
#include "debug_sync.h"
+#include "sql_repl.h"
/*
Code for optional parallel execution of replicated events on the slave.
@@ -82,7 +83,7 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev)
return;
mysql_mutex_lock(&rli->data_lock);
- cmp= strcmp(rli->group_relay_log_name, qev->event_relay_log_name);
+ cmp= compare_log_name(rli->group_relay_log_name, qev->event_relay_log_name);
if (cmp < 0)
{
rli->group_relay_log_pos= qev->future_event_relay_log_pos;
@@ -91,7 +92,7 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev)
rli->group_relay_log_pos < qev->future_event_relay_log_pos)
rli->group_relay_log_pos= qev->future_event_relay_log_pos;
- cmp= strcmp(rli->group_master_log_name, qev->future_event_master_log_name);
+ cmp= compare_log_name(rli->group_master_log_name, qev->future_event_master_log_name);
if (cmp < 0)
{
strcpy(rli->group_master_log_name, qev->future_event_master_log_name);
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 99f8da2c928..5273b33c728 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -454,7 +454,8 @@ static inline int add_relay_log(Relay_log_info* rli,LOG_INFO* linfo)
linfo->log_file_name);
DBUG_RETURN(1);
}
- rli->log_space_total += s.st_size;
+ my_atomic_add64_explicit((volatile int64*)(&rli->log_space_total),
+ s.st_size, MY_MEMORY_ORDER_RELAXED);
DBUG_PRINT("info",("log_space_total: %llu", rli->log_space_total));
DBUG_RETURN(0);
}
@@ -464,7 +465,8 @@ static int count_relay_log_space(Relay_log_info* rli)
{
LOG_INFO linfo;
DBUG_ENTER("count_relay_log_space");
- rli->log_space_total= 0;
+ my_atomic_store64_explicit((volatile int64*)(&rli->log_space_total), 0,
+ MY_MEMORY_ORDER_RELAXED);
if (rli->relay_log.find_log_pos(&linfo, NullS, 1))
{
sql_print_error("Could not find first log while counting relay log space");
@@ -987,7 +989,7 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
if (rgi->is_parallel_exec)
{
/* In case of parallel replication, do not update the position backwards. */
- int cmp= strcmp(group_relay_log_name, rgi->event_relay_log_name);
+ int cmp= compare_log_name(group_relay_log_name, rgi->event_relay_log_name);
if (cmp < 0)
{
group_relay_log_pos= rgi->future_event_relay_log_pos;
@@ -999,7 +1001,7 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
In the parallel case we need to update the master_log_name here, rather
than in Rotate_log_event::do_update_pos().
*/
- cmp= strcmp(group_master_log_name, rgi->future_event_master_log_name);
+ cmp= compare_log_name(group_master_log_name, rgi->future_event_master_log_name);
if (cmp <= 0)
{
if (cmp < 0)
@@ -1223,8 +1225,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
strmake_buf(rli->group_relay_log_name, rli->relay_log.get_log_fname());
strmake_buf(rli->event_relay_log_name, rli->relay_log.get_log_fname());
rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
- rli->log_space_total= 0;
-
+ my_atomic_store64_explicit((volatile int64*)(&rli->log_space_total), 0,
+ MY_MEMORY_ORDER_RELAXED);
if (count_relay_log_space(rli))
{
*errmsg= "Error counting relay log space";
@@ -1734,7 +1736,7 @@ end:
if (table_opened)
{
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
if (array_inited)
delete_dynamic(&array);
@@ -1902,7 +1904,7 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
if (error)
{
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
if (thd == rli->sql_driver_thd)
{
@@ -2016,10 +2018,10 @@ void rpl_group_info::slave_close_thread_tables(THD *thd)
if (thd->transaction_rollback_request)
{
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
else if (! thd->in_multi_stmt_transaction_mode())
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
else
thd->mdl_context.release_statement_locks();
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index c913a0477d7..61c53e6b6e3 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -30,6 +30,11 @@
#define SIGNAL_FMT "signal %d"
#endif
+
+#ifdef __APPLE__
+#include <sys/sysctl.h>
+#endif
+
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
@@ -51,7 +56,7 @@ extern const char *optimizer_switch_names[];
static inline void output_core_info()
{
/* proc is optional on some BSDs so it can't hurt to look */
-#ifdef HAVE_READLINK
+#if defined(HAVE_READLINK) && !defined(__APPLE__)
char buff[PATH_MAX];
ssize_t len;
int fd;
@@ -77,6 +82,13 @@ static inline void output_core_info()
my_close(fd, MYF(0));
}
#endif
+#elif defined(__APPLE__)
+ char buff[PATH_MAX];
+ size_t len = sizeof(buff);
+ if (sysctlbyname("kern.corefile", buff, &len, NULL, 0) == 0)
+ {
+ my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff);
+ }
#else
char buff[80];
my_getwd(buff, sizeof(buff), 0);
diff --git a/sql/slave.cc b/sql/slave.cc
index 87eacfcfd0a..3124b2d10ab 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -60,6 +60,7 @@
#include "rpl_tblmap.h"
#include "debug_sync.h"
#include "rpl_parallel.h"
+#include "sql_manager.h"
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
@@ -279,8 +280,6 @@ static void init_slave_psi_keys(void)
#endif /* HAVE_PSI_INTERFACE */
-static bool slave_background_thread_running;
-static bool slave_background_thread_stop;
static bool slave_background_thread_gtid_loaded;
struct slave_background_kill_t {
@@ -289,24 +288,15 @@ struct slave_background_kill_t {
} *slave_background_kill_list;
-pthread_handler_t
-handle_slave_background(void *arg __attribute__((unused)))
+static void bg_rpl_load_gtid_slave_state(void *)
{
- THD *thd;
- PSI_stage_info old_stage;
- bool stop;
-
- my_thread_init();
- thd= new THD(next_thread_id());
+ THD *thd= new THD(next_thread_id());
thd->thread_stack= (char*) &thd; /* Set approximate stack start */
thd->system_thread = SYSTEM_THREAD_SLAVE_BACKGROUND;
- thread_safe_increment32(&service_thread_count);
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
-#ifdef WITH_WSREP
thd->variables.wsrep_on= 0;
-#endif
thd_proc_info(thd, "Loading slave GTID position from table");
if (rpl_load_gtid_slave_state(thd))
@@ -316,136 +306,34 @@ handle_slave_background(void *arg __attribute__((unused)))
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
- mysql_mutex_lock(&LOCK_slave_background);
+ // hijacking global_rpl_thread_pool cond here - it's only once on startup
+ mysql_mutex_lock(&global_rpl_thread_pool.LOCK_rpl_thread_pool);
slave_background_thread_gtid_loaded= true;
- mysql_cond_broadcast(&COND_slave_background);
-
- THD_STAGE_INFO(thd, stage_slave_background_process_request);
- do
- {
- slave_background_kill_t *kill_list;
-
- thd->ENTER_COND(&COND_slave_background, &LOCK_slave_background,
- &stage_slave_background_wait_request,
- &old_stage);
- for (;;)
- {
- stop= abort_loop || thd->killed || slave_background_thread_stop;
- kill_list= slave_background_kill_list;
- if (stop || kill_list)
- break;
- mysql_cond_wait(&COND_slave_background, &LOCK_slave_background);
- }
-
- slave_background_kill_list= NULL;
- thd->EXIT_COND(&old_stage);
-
- while (kill_list)
- {
- slave_background_kill_t *p = kill_list;
- THD *to_kill= p->to_kill;
- kill_list= p->next;
-
- mysql_mutex_lock(&to_kill->LOCK_thd_data);
- to_kill->awake(KILL_CONNECTION);
- mysql_mutex_unlock(&to_kill->LOCK_thd_data);
- mysql_mutex_lock(&to_kill->LOCK_wakeup_ready);
- to_kill->rgi_slave->killed_for_retry=
- rpl_group_info::RETRY_KILL_KILLED;
- mysql_cond_broadcast(&to_kill->COND_wakeup_ready);
- mysql_mutex_unlock(&to_kill->LOCK_wakeup_ready);
- my_free(p);
- }
- mysql_mutex_lock(&LOCK_slave_background);
- } while (!stop);
-
- slave_background_thread_running= false;
- mysql_cond_broadcast(&COND_slave_background);
- mysql_mutex_unlock(&LOCK_slave_background);
-
+ mysql_cond_signal(&global_rpl_thread_pool.COND_rpl_thread_pool);
+ mysql_mutex_unlock(&global_rpl_thread_pool.LOCK_rpl_thread_pool);
delete thd;
- thread_safe_decrement32(&service_thread_count);
- signal_thd_deleted();
-
- my_thread_end();
- return 0;
}
-
-
-void
-slave_background_kill_request(THD *to_kill)
+static void bg_slave_kill(void *victim)
{
- if (to_kill->rgi_slave->killed_for_retry)
- return; // Already deadlock killed.
- slave_background_kill_t *p=
- (slave_background_kill_t *)my_malloc(sizeof(*p), MYF(MY_WME));
- if (p)
- {
- p->to_kill= to_kill;
- to_kill->rgi_slave->killed_for_retry=
- rpl_group_info::RETRY_KILL_PENDING;
- mysql_mutex_lock(&LOCK_slave_background);
- p->next= slave_background_kill_list;
- slave_background_kill_list= p;
- mysql_cond_signal(&COND_slave_background);
- mysql_mutex_unlock(&LOCK_slave_background);
- }
+ THD *to_kill= (THD *)victim;
+ mysql_mutex_lock(&to_kill->LOCK_thd_data);
+ to_kill->awake(KILL_CONNECTION);
+ mysql_mutex_unlock(&to_kill->LOCK_thd_data);
+ mysql_mutex_lock(&to_kill->LOCK_wakeup_ready);
+ to_kill->rgi_slave->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED;
+ mysql_cond_broadcast(&to_kill->COND_wakeup_ready);
+ mysql_mutex_unlock(&to_kill->LOCK_wakeup_ready);
}
-
-/*
- Start the slave background thread.
-
- This thread is currently used for two purposes:
-
- 1. To load the GTID state from mysql.gtid_slave_pos at server start; reading
- from table requires valid THD, which is otherwise not available during
- server init.
-
- 2. To kill worker thread transactions during parallel replication, when a
- storage engine attempts to take an errorneous conflicting lock that would
- cause a deadlock. Killing is done asynchroneously, as the kill may not
- be safe within the context of a callback from inside storage engine
- locking code.
-*/
-static int
-start_slave_background_thread()
+void slave_background_kill_request(THD *to_kill)
{
- pthread_t th;
-
- slave_background_thread_running= true;
- slave_background_thread_stop= false;
- slave_background_thread_gtid_loaded= false;
- if (mysql_thread_create(key_thread_slave_background,
- &th, &connection_attrib, handle_slave_background,
- NULL))
- {
- sql_print_error("Failed to create thread while initialising slave");
- return 1;
- }
-
- mysql_mutex_lock(&LOCK_slave_background);
- while (!slave_background_thread_gtid_loaded)
- mysql_cond_wait(&COND_slave_background, &LOCK_slave_background);
- mysql_mutex_unlock(&LOCK_slave_background);
-
- return 0;
-}
-
-
-static void
-stop_slave_background_thread()
-{
- mysql_mutex_lock(&LOCK_slave_background);
- slave_background_thread_stop= true;
- mysql_cond_broadcast(&COND_slave_background);
- while (slave_background_thread_running)
- mysql_cond_wait(&COND_slave_background, &LOCK_slave_background);
- mysql_mutex_unlock(&LOCK_slave_background);
+ if (to_kill->rgi_slave->killed_for_retry)
+ return; // Already deadlock killed.
+ to_kill->rgi_slave->killed_for_retry= rpl_group_info::RETRY_KILL_PENDING;
+ mysql_manager_submit(bg_slave_kill, to_kill);
}
-
/* Initialize slave structures */
int init_slave()
@@ -457,12 +345,19 @@ int init_slave()
init_slave_psi_keys();
#endif
- if (start_slave_background_thread())
- return 1;
-
if (global_rpl_thread_pool.init(opt_slave_parallel_threads))
return 1;
+ slave_background_thread_gtid_loaded= false;
+ mysql_manager_submit(bg_rpl_load_gtid_slave_state, NULL);
+
+ // hijacking global_rpl_thread_pool cond here - it's only once on startup
+ mysql_mutex_lock(&global_rpl_thread_pool.LOCK_rpl_thread_pool);
+ while (!slave_background_thread_gtid_loaded)
+ mysql_cond_wait(&global_rpl_thread_pool.COND_rpl_thread_pool,
+ &global_rpl_thread_pool.LOCK_rpl_thread_pool);
+ mysql_mutex_unlock(&global_rpl_thread_pool.LOCK_rpl_thread_pool);
+
/*
This is called when mysqld starts. Before client connections are
accepted. However bootstrap may conflict with us if it does START SLAVE.
@@ -1080,7 +975,6 @@ void slave_prepare_for_shutdown()
mysql_mutex_lock(&LOCK_active_mi);
master_info_index->free_connections();
mysql_mutex_unlock(&LOCK_active_mi);
- stop_slave_background_thread();
}
/*
@@ -1111,8 +1005,6 @@ void end_slave()
active_mi= 0;
mysql_mutex_unlock(&LOCK_active_mi);
- stop_slave_background_thread();
-
global_rpl_thread_pool.destroy();
free_all_rpl_filters();
DBUG_VOID_RETURN;
@@ -2373,7 +2265,10 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
&rli->log_space_lock,
&stage_waiting_for_relay_log_space,
&old_stage);
- while (rli->log_space_limit < rli->log_space_total &&
+ while (rli->log_space_limit <
+ (ulonglong)my_atomic_load64_explicit((volatile int64*)
+ (&rli->log_space_total),
+ MY_MEMORY_ORDER_RELAXED) &&
!(slave_killed=io_slave_killed(mi)) &&
!rli->ignore_log_space_limit)
mysql_cond_wait(&rli->log_space_cond, &rli->log_space_lock);
@@ -2923,7 +2818,10 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
protocol->store(mi->rli.last_error().message, &my_charset_bin);
protocol->store((uint32) mi->rli.slave_skip_counter);
protocol->store((ulonglong) mi->rli.group_master_log_pos);
- protocol->store((ulonglong) mi->rli.log_space_total);
+ protocol->store((ulonglong)
+ my_atomic_load64_explicit((volatile int64*)
+ (&mi->rli.log_space_total),
+ MY_MEMORY_ORDER_RELAXED));
protocol->store(
mi->rli.until_condition==Relay_log_info::UNTIL_NONE ? "None":
@@ -4329,9 +4227,7 @@ pthread_handler_t handle_slave_io(void *arg)
goto err;
}
-#ifdef WITH_WSREP
thd->variables.wsrep_on= 0;
-#endif
if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
@@ -4623,7 +4519,9 @@ Stopping slave I/O thread due to out-of-memory error from master");
#endif
if (rli->log_space_limit && rli->log_space_limit <
- rli->log_space_total &&
+ (ulonglong) my_atomic_load64_explicit((volatile int64*)
+ (&rli->log_space_total),
+ MY_MEMORY_ORDER_RELAXED) &&
!rli->ignore_log_space_limit)
if (wait_for_relay_log_space(rli))
{
@@ -4638,8 +4536,11 @@ log space");
err:
// print the current replication position
if (mi->using_gtid == Master_info::USE_GTID_NO)
+ {
sql_print_information("Slave I/O thread exiting, read up to log '%s', "
"position %llu", IO_RPL_LOG_NAME, mi->master_log_pos);
+ sql_print_information("master was %s:%d", mi->host, mi->port);
+ }
else
{
StringBuffer<100> tmp;
@@ -4648,6 +4549,7 @@ err:
"position %llu; GTID position %s",
IO_RPL_LOG_NAME, mi->master_log_pos,
tmp.c_ptr_safe());
+ sql_print_information("master was %s:%d", mi->host, mi->port);
}
RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
thd->reset_query();
@@ -5236,6 +5138,7 @@ pthread_handler_t handle_slave_sql(void *arg)
sql_print_information("Slave SQL thread exiting, replication stopped in "
"log '%s' at position %llu%s", RPL_LOG_NAME,
rli->group_master_log_pos, tmp.c_ptr_safe());
+ sql_print_information("master was %s:%d", mi->host, mi->port);
}
err_before_start:
@@ -7222,7 +7125,10 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
is are able to rotate and purge sometime soon.
*/
if (rli->log_space_limit &&
- rli->log_space_limit < rli->log_space_total)
+ rli->log_space_limit <
+ (ulonglong) my_atomic_load64_explicit((volatile int64*)
+ (&rli->log_space_total),
+ MY_MEMORY_ORDER_RELAXED))
{
/* force rotation if not in an unfinished group */
rli->sql_force_rotate_relay= !rli->is_in_group();
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 6a650183fb8..b205d253733 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -2163,10 +2163,10 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (thd->transaction_rollback_request)
{
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
else if (! thd->in_multi_stmt_transaction_mode())
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
else
thd->mdl_context.release_statement_locks();
}
@@ -3119,10 +3119,10 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
if (thd->transaction_rollback_request)
{
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
else if (! thd->in_multi_stmt_transaction_mode())
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
else
thd->mdl_context.release_statement_locks();
}
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 83905fc9f3d..711efa91394 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -605,6 +605,7 @@ Geometry *Geometry::create_from_json(Geometry_buffer *buffer,
if (feature_type_found)
goto handle_geometry_key;
}
+ goto err_return;
}
else
{
@@ -1031,6 +1032,119 @@ const Geometry::Class_info *Gis_point::get_class_info() const
}
+/**
+ Function to calculate haversine.
+ Taking as arguments Point and Multipoint geometries.
+ Multipoint geometry has to be single point only.
+ It is up to caller to ensure valid input.
+
+ @param g pointer to the Geometry
+ @param r sphere radius
+ @param error pointer describing the error in case of the boundary conditions
+
+ @return distance in case without error, it is caclulcated distance (non-negative),
+ in case error exist, negative value.
+*/
+double Gis_point::calculate_haversine(const Geometry *g,
+ const double sphere_radius,
+ int *error)
+{
+ DBUG_ASSERT(sphere_radius > 0);
+ double x1r, x2r, y1r, y2r, dlong, dlat, res;
+
+ // This check is done only for optimization purposes where we know it will
+ // be one and only one point in Multipoint
+ if (g->get_class_info()->m_type_id == Geometry::wkb_multipoint)
+ {
+ const char point_size= 4 + WKB_HEADER_SIZE + POINT_DATA_SIZE+1; //1 for the type
+ char point_temp[point_size];
+ memset(point_temp+4, Geometry::wkb_point, 1);
+ memcpy(point_temp+5, static_cast<const Gis_multi_point *>(g)->get_data_ptr()+5, 4);
+ memcpy(point_temp+4+WKB_HEADER_SIZE, g->get_data_ptr()+4+WKB_HEADER_SIZE,
+ POINT_DATA_SIZE);
+ point_temp[point_size-1]= '\0';
+ Geometry_buffer gbuff;
+ Geometry *gg= Geometry::construct(&gbuff, point_temp, point_size-1);
+ DBUG_ASSERT(gg);
+ if (static_cast<Gis_point *>(gg)->get_xy_radian(&x2r, &y2r))
+ DBUG_ASSERT(0);
+ }
+ else
+ {
+ if (static_cast<const Gis_point *>(g)->get_xy_radian(&x2r, &y2r))
+ DBUG_ASSERT(0);
+ }
+ if (this->get_xy_radian(&x1r, &y1r))
+ DBUG_ASSERT(0);
+ // Check boundary conditions: longitude[-180,180]
+ if (!((x2r >= -M_PI && x2r <= M_PI) && (x1r >= -M_PI && x1r <= M_PI)))
+ {
+ *error=1;
+ return -1;
+ }
+ // Check boundary conditions: lattitude[-90,90]
+ if (!((y2r >= -M_PI/2 && y2r <= M_PI/2) && (y1r >= -M_PI/2 && y1r <= M_PI/2)))
+ {
+ *error=-1;
+ return -1;
+ }
+ dlat= sin((y2r - y1r)/2)*sin((y2r - y1r)/2);
+ dlong= sin((x2r - x1r)/2)*sin((x2r - x1r)/2);
+ res= 2*sphere_radius*asin((sqrt(dlat + cos(y1r)*cos(y2r)*dlong)));
+ return res;
+}
+
+
+/**
+ Function that calculate spherical distance of Point from Multipoint geometries.
+ In case there is single point in Multipoint geometries calculate_haversine()
+ can handle such case. Otherwise, new geometry (Point) has to be constructed.
+
+ @param g pointer to the Geometry
+ @param r sphere radius
+ @param result pointer to the result
+ @param err pointer to the error obtained from calculate_haversin()
+
+ @return state
+ @retval TRUE failed
+ @retval FALSE success
+*/
+int Gis_point::spherical_distance_multipoints(Geometry *g, const double r,
+ double *result, int *err)
+{
+ uint32 num_of_points2;
+ // To find the minimum radius it cannot be greater than Earth radius
+ double res= 6370986.0;
+ double temp_res= 0.0;
+ const uint32 len= 4 + WKB_HEADER_SIZE + POINT_DATA_SIZE + 1;
+ char s[len];
+ g->num_geometries(&num_of_points2);
+ DBUG_ASSERT(num_of_points2 >= 1);
+ if (num_of_points2 == 1)
+ {
+ *result= this->calculate_haversine(g, r, err);
+ return 0;
+ }
+ for (uint32 i=1; i <= num_of_points2; i++)
+ {
+ Geometry_buffer buff_temp;
+ Geometry *temp;
+
+ // First 4 bytes are handled already, make sure to create a Point
+ memset(s + 4, Geometry::wkb_point, 1);
+ memcpy(s + 5, g->get_data_ptr() + 5, 4);
+ memcpy(s + 4 + WKB_HEADER_SIZE, g->get_data_ptr() + 4 + WKB_HEADER_SIZE*i +\
+ POINT_DATA_SIZE*(i-1), POINT_DATA_SIZE);
+ s[len-1]= '\0';
+ temp= Geometry::construct(&buff_temp, s, len);
+ DBUG_ASSERT(temp);
+ temp_res= this->calculate_haversine(temp, r, err);
+ if (res > temp_res)
+ res= temp_res;
+ }
+ *result= res;
+ return 0;
+}
/***************************** LineString *******************************/
uint32 Gis_line_string::get_data_size() const
@@ -2161,6 +2275,81 @@ const Geometry::Class_info *Gis_multi_point::get_class_info() const
}
+/**
+ Function that calculate spherical distance of Multipoints geometries.
+ In case there is single point in Multipoint geometries calculate_haversine()
+ can handle such case. Otherwise, new geometry (Point) has to be constructed.
+
+ @param g pointer to the Geometry
+ @param r sphere radius
+ @param result pointer to the result
+ @param err pointer to the error obtained from calculate_haversin()
+
+ @return state
+ @retval TRUE failed
+ @retval FALSE success
+*/
+int Gis_multi_point::spherical_distance_multipoints(Geometry *g, const double r,
+ double *result, int *err)
+{
+ const uint32 len= 4 + WKB_HEADER_SIZE + POINT_DATA_SIZE + 1;
+ // Check how many points are stored in Multipoints
+ uint32 num_of_points1, num_of_points2;
+ // To find the minimum radius it cannot be greater than Earth radius
+ double res= 6370986.0;
+
+ /* From Item_func_sphere_distance::spherical_distance_points,
+ we are sure that there will be multiple points and we have to construct
+ Point geometry and return the smallest result.
+ */
+ num_geometries(&num_of_points1);
+ DBUG_ASSERT(num_of_points1 >= 1);
+ g->num_geometries(&num_of_points2);
+ DBUG_ASSERT(num_of_points2 >= 1);
+
+ for (uint32 i=1; i <= num_of_points1; i++)
+ {
+ Geometry_buffer buff_temp;
+ Geometry *temp;
+ double temp_res= 0.0;
+ char s[len];
+ // First 4 bytes are handled already, make sure to create a Point
+ memset(s + 4, Geometry::wkb_point, 1);
+ memcpy(s + 5, this->get_data_ptr() + 5, 4);
+ memcpy(s + 4 + WKB_HEADER_SIZE, this->get_data_ptr() + 4 + WKB_HEADER_SIZE*i +\
+ POINT_DATA_SIZE*(i-1), POINT_DATA_SIZE);
+ s[len-1]= '\0';
+ temp= Geometry::construct(&buff_temp, s, len);
+ DBUG_ASSERT(temp);
+ // Optimization for single Multipoint
+ if (num_of_points2 == 1)
+ {
+ *result= static_cast<Gis_point *>(temp)->calculate_haversine(g, r, err);
+ return 0;
+ }
+ for (uint32 j=1; j<= num_of_points2; j++)
+ {
+ Geometry_buffer buff_temp2;
+ Geometry *temp2;
+ char s2[len];
+ // First 4 bytes are handled already, make sure to create a Point
+ memset(s2 + 4, Geometry::wkb_point, 1);
+ memcpy(s2 + 5, g->get_data_ptr() + 5, 4);
+ memcpy(s2 + 4 + WKB_HEADER_SIZE, g->get_data_ptr() + 4 + WKB_HEADER_SIZE*j +\
+ POINT_DATA_SIZE*(j-1), POINT_DATA_SIZE);
+ s2[len-1]= '\0';
+ temp2= Geometry::construct(&buff_temp2, s2, len);
+ DBUG_ASSERT(temp2);
+ temp_res= static_cast<Gis_point *>(temp)->calculate_haversine(temp2, r, err);
+ if (res > temp_res)
+ res= temp_res;
+ }
+ }
+ *result= res;
+ return 0;
+}
+
+
/***************************** MultiLineString *******************************/
uint32 Gis_multi_line_string::get_data_size() const
diff --git a/sql/spatial.h b/sql/spatial.h
index e78da6e615d..1da788b07a0 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -332,6 +332,11 @@ public:
m_data+= WKB_HEADER_SIZE;
}
+ const char *get_data_ptr() const
+ {
+ return m_data;
+ }
+
bool envelope(String *result) const;
static Class_info *ci_collection[wkb_last+1];
@@ -410,6 +415,17 @@ public:
return 0;
}
+ int get_xy_radian(double *x, double *y) const
+ {
+ if (!get_xy(x, y))
+ {
+ *x= (*x)*M_PI/180;
+ *y= (*y)*M_PI/180;
+ return 0;
+ }
+ return 1;
+ }
+
int get_x(double *x) const
{
if (no_data(m_data, SIZEOF_STORED_DOUBLE))
@@ -436,6 +452,10 @@ public:
}
int store_shapes(Gcalc_shape_transporter *trn) const;
const Class_info *get_class_info() const;
+ double calculate_haversine(const Geometry *g, const double sphere_radius,
+ int *error);
+ int spherical_distance_multipoints(Geometry *g, const double r, double *result,
+ int *error);
};
@@ -535,6 +555,8 @@ public:
}
int store_shapes(Gcalc_shape_transporter *trn) const;
const Class_info *get_class_info() const;
+ int spherical_distance_multipoints(Geometry *g, const double r, double *res,
+ int *error);
};
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 641ab69c2a7..f1034986f22 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2770,6 +2770,12 @@ end:
int acl_check_setrole(THD *thd, char *rolename, ulonglong *access)
{
+ if (!initialized)
+ {
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
+ return 1;
+ }
+
return check_user_can_set_role(thd, thd->security_ctx->priv_user,
thd->security_ctx->host, thd->security_ctx->ip, rolename, access);
}
@@ -8945,7 +8951,8 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry,
if (!handle_as_role)
add_user_parameters(&global, (ACL_USER *)acl_entry, (want_access & GRANT_ACL));
-
+ else if (want_access & GRANT_ACL)
+ global.append(STRING_WITH_LEN(" WITH GRANT OPTION"));
protocol->prepare_for_resend();
protocol->store(global.ptr(),global.length(),global.charset());
if (protocol->write())
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index af4b9127f8f..17eede61337 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -42,7 +42,7 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list)
trans_rollback_stmt(thd);
trans_rollback(thd);
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
/*
table_list->table has been closed and freed. Do not reference
@@ -115,7 +115,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
acquire the exclusive lock to satisfy MDL asserts and avoid
deadlocks.
*/
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
/*
Attempt to do full-blown table open in mysql_admin_table() has failed.
Let us try to open at least a .FRM for this table.
@@ -266,7 +266,7 @@ end:
}
/* In case of a temporary table there will be no metadata lock. */
if (error && has_mdl_lock)
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
DBUG_RETURN(error);
}
@@ -543,7 +543,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
trans_rollback(thd);
close_thread_tables(thd);
table->table= NULL;
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name,
MDL_SHARED_NO_READ_WRITE, MDL_TRANSACTION);
}
@@ -597,7 +597,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
trans_rollback_stmt(thd);
trans_rollback(thd);
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
DBUG_PRINT("admin", ("simple error, admin next table"));
continue;
case -1: // error, message could be written to net
@@ -670,7 +670,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
trans_commit_stmt(thd);
trans_commit(thd);
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
lex->reset_query_tables_list(FALSE);
/*
Restore Query_tables_list::sql_command value to make statement
@@ -803,7 +803,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
thd->open_options|= extra_open_options;
close_thread_tables(thd);
table->table= NULL;
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
table->mdl_request.init(MDL_key::TABLE, table->db, table->table_name,
MDL_SHARED_NO_READ_WRITE, MDL_TRANSACTION);
table->mdl_request.set_type(MDL_SHARED_READ);
@@ -1035,7 +1035,7 @@ send_result_message:
trans_commit_stmt(thd);
trans_commit(thd);
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
/* Clear references to TABLE and MDL_ticket after releasing them. */
table->mdl_request.ticket= NULL;
@@ -1188,7 +1188,7 @@ send_result_message:
goto err;
}
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
/*
If it is CHECK TABLE v1, v2, v3, and v1, v2, v3 are views, we will run
@@ -1226,7 +1226,7 @@ err:
table->table= 0;
}
close_thread_tables(thd); // Shouldn't be needed
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
thd->resume_subsequent_commits(suspended_wfc);
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 635e17d1865..b8d18abb50c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4341,6 +4341,70 @@ bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
return false;
}
+/**
+ Extend the table_list to include foreign tables for prelocking.
+
+ @param[in] thd Thread context.
+ @param[in] prelocking_ctx Prelocking context of the statement.
+ @param[in] table_list Table list element for table.
+ @param[in] sp Routine body.
+ @param[out] need_prelocking Set to TRUE if method detects that prelocking
+ required, not changed otherwise.
+
+ @retval FALSE Success.
+ @retval TRUE Failure (OOM).
+*/
+inline bool
+prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx,
+ TABLE_LIST *table_list, bool *need_prelocking,
+ uint8 op)
+{
+ List <FOREIGN_KEY_INFO> fk_list;
+ List_iterator<FOREIGN_KEY_INFO> fk_list_it(fk_list);
+ FOREIGN_KEY_INFO *fk;
+ Query_arena *arena, backup;
+
+ arena= thd->activate_stmt_arena_if_needed(&backup);
+
+ table_list->table->file->get_parent_foreign_key_list(thd, &fk_list);
+ if (thd->is_error())
+ {
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+ return TRUE;
+ }
+
+ *need_prelocking= TRUE;
+
+ while ((fk= fk_list_it++))
+ {
+ // FK_OPTION_RESTRICT and FK_OPTION_NO_ACTION only need read access
+ static bool can_write[]= { true, false, true, true, false, true };
+ thr_lock_type lock_type;
+
+ if ((op & (1 << TRG_EVENT_DELETE) && can_write[fk->delete_method])
+ || (op & (1 << TRG_EVENT_UPDATE) && can_write[fk->update_method]))
+ lock_type= TL_WRITE_ALLOW_WRITE;
+ else
+ lock_type= TL_READ;
+
+ if (table_already_fk_prelocked(prelocking_ctx->query_tables,
+ fk->foreign_db, fk->foreign_table,
+ lock_type))
+ continue;
+
+ TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
+ tl->init_one_table_for_prelocking(fk->foreign_db->str, fk->foreign_db->length,
+ fk->foreign_table->str, fk->foreign_table->length,
+ NULL, lock_type, false, table_list->belong_to_view,
+ op, &prelocking_ctx->query_tables_last);
+ }
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+
+ return FALSE;
+}
+
/**
Defines how prelocking algorithm for DML statements should handle table list
@@ -4381,55 +4445,21 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
add_tables_and_routines_for_triggers(thd, prelocking_ctx, table_list))
return TRUE;
}
-
if (table_list->table->file->referenced_by_foreign_key())
{
- List <FOREIGN_KEY_INFO> fk_list;
- List_iterator<FOREIGN_KEY_INFO> fk_list_it(fk_list);
- FOREIGN_KEY_INFO *fk;
- Query_arena *arena, backup;
-
- arena= thd->activate_stmt_arena_if_needed(&backup);
-
- table_list->table->file->get_parent_foreign_key_list(thd, &fk_list);
- if (thd->is_error())
- {
- if (arena)
- thd->restore_active_arena(arena, &backup);
- return TRUE;
- }
-
- *need_prelocking= TRUE;
-
- while ((fk= fk_list_it++))
- {
- // FK_OPTION_RESTRICT and FK_OPTION_NO_ACTION only need read access
- static bool can_write[]= { true, false, true, true, false, true };
- uint8 op= table_list->trg_event_map;
- thr_lock_type lock_type;
-
- if ((op & (1 << TRG_EVENT_DELETE) && can_write[fk->delete_method])
- || (op & (1 << TRG_EVENT_UPDATE) && can_write[fk->update_method]))
- lock_type= TL_WRITE_ALLOW_WRITE;
- else
- lock_type= TL_READ;
-
- if (table_already_fk_prelocked(prelocking_ctx->query_tables,
- fk->foreign_db, fk->foreign_table,
- lock_type))
- continue;
-
- TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
- tl->init_one_table_for_prelocking(fk->foreign_db->str, fk->foreign_db->length,
- fk->foreign_table->str, fk->foreign_table->length,
- NULL, lock_type, false, table_list->belong_to_view,
- op, &prelocking_ctx->query_tables_last);
- }
- if (arena)
- thd->restore_active_arena(arena, &backup);
+ return (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
+ need_prelocking,
+ table_list->trg_event_map));
}
}
+ else if (table_list->slave_fk_event_map &&
+ table_list->table->file->referenced_by_foreign_key())
+ {
+ return (prepare_fk_prelocking_list(thd, prelocking_ctx,
+ table_list, need_prelocking,
+ table_list->slave_fk_event_map));
+ }
return FALSE;
}
@@ -5795,6 +5825,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Check if there are sufficient access rights to the found field. */
if (check_privileges &&
+ !table_list->is_derived() &&
check_column_grant_in_table_ref(thd, *actual_table, name, length))
fld= WRONG_GRANT;
else
@@ -7647,36 +7678,23 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
- Ensure that we have access rights to all fields to be inserted. Under
- some circumstances, this check may be skipped.
-
- - If any_privileges is true, skip the check.
+ Ensure that we have access rights to all fields to be inserted
+ the table 'tables'. Under some circumstances, this check may be skipped.
- - If the SELECT privilege has been found as fulfilled already for both
- the TABLE and TABLE_LIST objects (and both of these exist, of
- course), the check is skipped.
+ The check is skipped in the following cases:
- - If the SELECT privilege has been found fulfilled for the TABLE object
- and the TABLE_LIST represents a derived table other than a view (see
- below), the check is skipped.
+ - any_privileges is true
- - If the TABLE_LIST object represents a view, we may skip checking if
- the SELECT privilege has been found fulfilled for it, regardless of
- the TABLE object.
+ - the table is a derived table
- - If there is no TABLE object, the test is skipped if either
- * the TABLE_LIST does not represent a view, or
- * the SELECT privilege has been found fulfilled.
+ - the table is a view with SELECT privilege
- A TABLE_LIST that is not a view may be a subquery, an
- information_schema table, or a nested table reference. See the comment
- for TABLE_LIST.
+ - the table is a base table with SELECT privilege
*/
- if (!((table && tables->is_non_derived() &&
- (table->grant.privilege & SELECT_ACL)) ||
- ((!tables->is_non_derived() &&
- (tables->grant.privilege & SELECT_ACL)))) &&
- !any_privileges)
+ if (!any_privileges &&
+ !tables->is_derived() &&
+ !(tables->is_view() && (tables->grant.privilege & SELECT_ACL)) &&
+ !(table && (table->grant.privilege & SELECT_ACL)))
{
field_iterator.set(tables);
if (check_grant_all_columns(thd, SELECT_ACL, &field_iterator))
@@ -8652,7 +8670,7 @@ close_mysql_tables(THD *thd)
if (! thd->in_sub_stmt)
trans_commit_stmt(thd);
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
/*
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 8555ae6ee3e..0de153a5e7d 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1451,7 +1451,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
DBUG_PRINT("qcache", ("\
long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \
-sql mode: 0x%llx, sort len: %llu, conncat len: %llu, div_precision: %lu, \
+sql mode: 0x%llx, sort len: %llu, concat len: %u, div_precision: %lu, \
def_week_frmt: %lu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
@@ -1951,7 +1951,7 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
DBUG_PRINT("qcache", ("\
long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \
-sql mode: 0x%llx, sort len: %llu, conncat len: %llu, div_precision: %lu, \
+sql mode: 0x%llx, sort len: %llu, concat len: %u, div_precision: %lu, \
def_week_frmt: %lu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 6ad73bbb0a2..d428c7fdb80 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -554,11 +554,11 @@ struct Query_cache_query_flags
uint character_set_client_num;
uint character_set_results_num;
uint collation_connection_num;
+ uint group_concat_max_len;
ha_rows limit;
Time_zone *time_zone;
sql_mode_t sql_mode;
ulonglong max_sort_length;
- ulonglong group_concat_max_len;
ulong default_week_format;
ulong div_precision_increment;
MY_LOCALE *lc_time_names;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 0a8c136e556..047d6517a4b 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2020, MariaDB Corporation.
+ Copyright (c) 2008, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -444,6 +444,7 @@ void thd_set_ha_data(THD *thd, const struct handlerton *hton,
const void *ha_data)
{
plugin_ref *lock= &thd->ha_data[hton->slot].lock;
+ DBUG_ASSERT(thd == current_thd);
if (ha_data && !*lock)
*lock= ha_lock_engine(NULL, (handlerton*) hton);
else if (!ha_data && *lock)
@@ -451,7 +452,9 @@ void thd_set_ha_data(THD *thd, const struct handlerton *hton,
plugin_unlock(NULL, *lock);
*lock= NULL;
}
+ mysql_mutex_lock(&thd->LOCK_thd_data);
*thd_ha_data(thd, hton)= (void*) ha_data;
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
}
@@ -2859,12 +2862,12 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
}
/* Create the file world readable */
if ((file= mysql_file_create(key_select_to_file,
- path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
+ path, 0644, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
return file;
#ifdef HAVE_FCHMOD
- (void) fchmod(file, 0666); // Because of umask()
+ (void) fchmod(file, 0644); // Because of umask()
#else
- (void) chmod(path, 0666);
+ (void) chmod(path, 0644);
#endif
if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
{
@@ -4485,7 +4488,7 @@ void destroy_thd(MYSQL_THD thd)
void reset_thd(MYSQL_THD thd)
{
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
thd->free_items();
free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC));
}
@@ -4548,7 +4551,8 @@ extern "C" size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen)
if (!mysql_mutex_trylock(&thd->LOCK_thd_data))
{
len= MY_MIN(buflen - 1, thd->query_length());
- memcpy(buf, thd->query(), len);
+ if (len)
+ memcpy(buf, thd->query(), len);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
buf[len]= '\0';
@@ -4726,6 +4730,18 @@ thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd)
DBUG_EXECUTE_IF("disable_thd_need_ordering_with", return 1;);
if (!thd || !other_thd)
return 1;
+#ifdef WITH_WSREP
+ /* wsrep applier, replayer and TOI processing threads are ordered
+ by replication provider, relaxed GAP locking protocol can be used
+ between high priority wsrep threads. Note that this function
+ is called while holding lock_sys mutex, therefore we can't
+ use THD::LOCK_thd_data mutex below to follow mutex ordering rules.
+ */
+ if (WSREP_ON &&
+ wsrep_thd_is_BF(const_cast<THD *>(thd), false) &&
+ wsrep_thd_is_BF(const_cast<THD *>(other_thd), false))
+ return 0;
+#endif /* WITH_WSREP */
rgi= thd->rgi_slave;
other_rgi= other_thd->rgi_slave;
if (!rgi || !other_rgi)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 2727b4c84d5..c47ea9c9020 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -555,7 +555,6 @@ typedef struct system_variables
ulonglong bulk_insert_buff_size;
ulonglong join_buff_size;
ulonglong sortbuff_size;
- ulonglong group_concat_max_len;
ulonglong default_regex_flags;
ulonglong max_mem_used;
@@ -645,6 +644,8 @@ typedef struct system_variables
uint32 gtid_domain_id;
uint64 gtid_seq_no;
+ uint group_concat_max_len;
+
/**
Default transaction access mode. READ ONLY (true) or READ WRITE (false).
*/
@@ -864,11 +865,24 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
+uint calc_sum_of_all_status(STATUS_VAR *to);
+static inline void calc_sum_of_all_status_if_needed(STATUS_VAR *to)
+{
+ if (to->local_memory_used == 0)
+ {
+ mysql_mutex_lock(&LOCK_status);
+ *to= global_status_var;
+ mysql_mutex_unlock(&LOCK_status);
+ calc_sum_of_all_status(to);
+ DBUG_ASSERT(to->local_memory_used);
+ }
+}
+
/*
Update global_memory_used. We have to do this with atomic_add as the
global value can change outside of LOCK_status.
*/
-inline void update_global_memory_status(int64 size)
+static inline void update_global_memory_status(int64 size)
{
DBUG_PRINT("info", ("global memory_used: %lld size: %lld",
(longlong) global_status_var.global_memory_used,
@@ -886,7 +900,7 @@ inline void update_global_memory_status(int64 size)
@retval NULL on error
@retval Pointter to CHARSET_INFO with the given name on success
*/
-inline CHARSET_INFO *
+static inline CHARSET_INFO *
mysqld_collation_get_by_name(const char *name,
CHARSET_INFO *name_cs= system_charset_info)
{
@@ -905,7 +919,7 @@ mysqld_collation_get_by_name(const char *name,
return cs;
}
-inline bool is_supported_parser_charset(CHARSET_INFO *cs)
+static inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
return MY_TEST(cs->mbminlen == 1);
}
@@ -4177,6 +4191,13 @@ public:
locked_tables_mode= mode_arg;
}
void leave_locked_tables_mode();
+ /* Relesae transactional locks if there are no active transactions */
+ void release_transactional_locks()
+ {
+ if (!(server_status &
+ (SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY)))
+ mdl_context.release_transactional_locks();
+ }
int decide_logging_format(TABLE_LIST *tables);
/*
In Some cases when decide_logging_format is called it does not have all
@@ -5144,10 +5165,15 @@ class select_union_recursive :public select_union
public:
/* The temporary table with the new records generated by one iterative step */
TABLE *incr_table;
+ /* The TMP_TABLE_PARAM structure used to create incr_table */
+ TMP_TABLE_PARAM incr_table_param;
/* One of tables from the list rec_tables (determined dynamically) */
TABLE *first_rec_table_to_update;
- /* The temporary tables used for recursive table references */
- List<TABLE> rec_tables;
+ /*
+ The list of all recursive table references to the CTE for whose
+ specification this select_union_recursive was created
+ */
+ List<TABLE_LIST> rec_table_refs;
/*
The count of how many times cleanup() was called with cleaned==false
for the unit specifying the recursive CTE for which this object was created
@@ -5157,7 +5183,8 @@ class select_union_recursive :public select_union
select_union_recursive(THD *thd_arg):
select_union(thd_arg),
- incr_table(0), first_rec_table_to_update(0), cleanup_count(0) {};
+ incr_table(0), first_rec_table_to_update(0), cleanup_count(0)
+ { incr_table_param.init(); };
int send_data(List<Item> &items);
bool create_result_table(THD *thd, List<Item> *column_types,
@@ -5449,8 +5476,6 @@ struct SORT_FIELD_ATTR
{
uint length; /* Length of sort field */
uint suffix_length; /* Length suffix (0-4) */
- enum Type { FIXED_SIZE, VARIABLE_SIZE } type;
- bool is_variable_sized() { return type == VARIABLE_SIZE; }
};
@@ -5985,6 +6010,38 @@ class Sql_mode_save
sql_mode_t old_mode; // SQL mode saved at construction time.
};
+class Abort_on_warning_instant_set
+{
+ THD *m_thd;
+ bool m_save_abort_on_warning;
+public:
+ Abort_on_warning_instant_set(THD *thd, bool temporary_value)
+ :m_thd(thd), m_save_abort_on_warning(thd->abort_on_warning)
+ {
+ thd->abort_on_warning= temporary_value;
+ }
+ ~Abort_on_warning_instant_set()
+ {
+ m_thd->abort_on_warning= m_save_abort_on_warning;
+ }
+};
+
+class Check_level_instant_set
+{
+ THD *m_thd;
+ enum_check_fields m_check_level;
+public:
+ Check_level_instant_set(THD *thd, enum_check_fields temporary_value)
+ :m_thd(thd), m_check_level(thd->count_cuted_fields)
+ {
+ thd->count_cuted_fields= temporary_value;
+ }
+ ~Check_level_instant_set()
+ {
+ m_thd->count_cuted_fields= m_check_level;
+ }
+};
+
class Switch_to_definer_security_ctx
{
public:
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index b2900a20b28..ec1bc45433a 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -85,7 +85,6 @@ int get_or_create_user_conn(THD *thd, const char *user,
uc->host= uc->user + user_len + 1;
uc->len= temp_len;
uc->connections= uc->questions= uc->updates= uc->conn_per_hour= 0;
- uc->user_resources= *mqh;
uc->reset_utime= thd->thr_create_utime;
if (my_hash_insert(&hash_user_connections, (uchar*) uc))
{
@@ -95,6 +94,7 @@ int get_or_create_user_conn(THD *thd, const char *user,
goto end;
}
}
+ uc->user_resources= *mqh;
thd->user_connect=uc;
uc->connections++;
end:
@@ -1112,7 +1112,7 @@ void end_connection(THD *thd)
{
NET *net= &thd->net;
#ifdef WITH_WSREP
- if (WSREP(thd))
+ if (WSREP(thd) && wsrep)
{
wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id);
if (rcode) {
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index fe8e0de71b4..3a2301a5730 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -227,6 +227,7 @@ With_element *With_clause::find_table_def(TABLE_LIST *table,
!table->is_fqtn)
{
table->set_derived();
+ table->db= empty_c_string;
return with_elem;
}
}
@@ -863,8 +864,6 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd,
goto err;
spec_tables_tail= tbl;
}
- if (check_table_access(thd, SELECT_ACL, spec_tables, FALSE, UINT_MAX, FALSE))
- goto err;
if (spec_tables)
{
if (with_table->next_global)
@@ -880,6 +879,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd,
with_table->next_global= spec_tables;
}
res= &lex->unit;
+ res->with_element= this;
lex->unit.include_down(with_table->select_lex);
lex->unit.set_slave(with_select);
@@ -890,6 +890,22 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd,
with_select));
if (check_dependencies_in_with_clauses(lex->with_clauses_list))
res= NULL;
+ /*
+ Resolve references to CTE from the spec_tables list that has not
+ been resolved yet.
+ */
+ for (TABLE_LIST *tbl= spec_tables;
+ tbl;
+ tbl= tbl->next_global)
+ {
+ if (!tbl->with)
+ tbl->with= with_select->find_table_def_in_with_clauses(tbl);
+ if (tbl == spec_tables_tail)
+ break;
+ }
+ if (check_table_access(thd, SELECT_ACL, spec_tables, FALSE, UINT_MAX, FALSE))
+ goto err;
+
lex->sphead= NULL; // in order not to delete lex->sphead
lex_end(lex);
err:
@@ -1428,10 +1444,11 @@ void With_element::print(String *str, enum_query_type query_type)
bool With_element::instantiate_tmp_tables()
{
- List_iterator_fast<TABLE> li(rec_result->rec_tables);
- TABLE *rec_table;
- while ((rec_table= li++))
+ List_iterator_fast<TABLE_LIST> li(rec_result->rec_table_refs);
+ TABLE_LIST *rec_tbl;
+ while ((rec_tbl= li++))
{
+ TABLE *rec_table= rec_tbl->table;
if (!rec_table->is_created() &&
instantiate_tmp_table(rec_table,
rec_table->s->key_info,
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 39499e6895f..be5905da683 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -677,7 +677,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
if (derived->is_with_table_recursive_reference())
{
/* Here 'derived" is a secondary recursive table reference */
- unit->with_element->rec_result->rec_tables.push_back(derived->table);
+ unit->with_element->rec_result->rec_table_refs.push_back(derived);
}
}
DBUG_ASSERT(derived->table || res);
@@ -733,17 +733,17 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
derived->fill_me= FALSE;
- if (!(derived->derived_result= new (thd->mem_root) select_union(thd)))
+ if ((!derived->is_with_table_recursive_reference() ||
+ !derived->derived_result) &&
+ !(derived->derived_result= new (thd->mem_root) select_union(thd)))
DBUG_RETURN(TRUE); // out of memory
- lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_DERIVED;
// st_select_lex_unit::prepare correctly work for single select
if ((res= unit->prepare(thd, derived->derived_result, 0)))
goto exit;
if (derived->with &&
(res= derived->with->rename_columns_of_derived_unit(thd, unit)))
goto exit;
- lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_DERIVED;
if ((res= check_duplicate_names(thd, unit->types, 0)))
goto exit;
@@ -752,7 +752,8 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
Depending on the result field translation will or will not
be created.
*/
- if (derived->init_derived(thd, FALSE))
+ if (!derived->is_with_table_recursive_reference() &&
+ derived->init_derived(thd, FALSE))
goto exit;
/*
@@ -1199,7 +1200,8 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
DBUG_RETURN(false);
st_select_lex_unit *unit= derived->get_unit();
- st_select_lex *sl= unit->first_select();
+ st_select_lex *first_sl= unit->first_select();
+ st_select_lex *sl= first_sl;
if (derived->prohibit_cond_pushdown)
DBUG_RETURN(false);
@@ -1311,7 +1313,24 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
if (!extracted_cond_copy)
continue;
}
-
+
+ /*
+ Rename the columns of all non-first selects of a union to be compatible
+ by names with the columns of the first select. It will allow to use copies
+ of the same expression pushed into having clauses of different selects.
+ */
+ if (sl != first_sl)
+ {
+ DBUG_ASSERT(sl->item_list.elements == first_sl->item_list.elements);
+ List_iterator_fast<Item> it(sl->item_list);
+ List_iterator_fast<Item> nm_it(unit->types);
+ Item * item;
+ while((item= it++))
+ {
+ item->share_name_with(nm_it++);
+ }
+ }
+
/*
Transform the references to the 'derived' columns from the condition
pushed into the having clause of sl to make them usable in the new context
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index a811cee998f..7c2122b6a0a 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -600,7 +600,6 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
}
for (keypart_map= key_len=0 ; (item=it_ke++) ; key_part++)
{
- my_bitmap_map *old_map;
/* note that 'item' can be changed by fix_fields() call */
if ((!item->fixed &&
item->fix_fields(thd, it_ke.ref())) ||
@@ -613,9 +612,9 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
}
if (!in_prepare)
{
- old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
(void) item->save_in_field(key_part->field, 1);
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
}
key_len+= key_part->store_length;
keypart_map= (keypart_map << 1) | 1;
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index c05c9a7d229..5ae9d3beb8b 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -741,6 +741,9 @@ static bool mysqld_help_internal(THD *thd, const char *mask)
&name, &description, &example);
delete select;
+ if (thd->is_error())
+ goto error;
+
if (count_topics == 0)
{
int UNINIT_VAR(key_id);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 0c50a251d26..ec79ff6d688 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2948,7 +2948,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (thd->mdl_context.clone_ticket(&di->grl_protection) ||
thd->mdl_context.clone_ticket(&di->table_list.mdl_request))
{
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
di->handler_thread_initialized= TRUE;
goto err;
}
@@ -3144,7 +3144,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
mysql_mutex_unlock(&thd->LOCK_thd_data);
close_thread_tables(thd); // Free the table
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
mysql_cond_broadcast(&di->cond_client); // Safety
mysql_mutex_lock(&LOCK_delayed_create); // Because of delayed_get_table
@@ -4580,7 +4580,8 @@ bool select_create::send_eof()
WSREP_ERROR("Appending table key for CTAS failed: %s, %d",
(wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void", rcode);
- return true;
+ abort_result_set();
+ DBUG_RETURN(true);
}
/* If commit fails, we should be able to reset the OK status. */
thd->get_stmt_da()->set_overwrite_status(TRUE);
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 77017812074..4f9facc6d0c 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -1199,7 +1199,7 @@ bool JOIN_CACHE::check_emb_key_usage()
Item *item= ref->items[i]->real_item();
Field *fld= ((Item_field *) item)->field;
CACHE_FIELD *init_copy= field_descr+flag_fields+i;
- for (j= i, copy= init_copy; i < local_key_arg_fields; i++, copy++)
+ for (j= i, copy= init_copy; j < local_key_arg_fields; j++, copy++)
{
if (fld->eq(copy->field))
{
@@ -1395,7 +1395,8 @@ uint JOIN_CACHE::write_record_data(uchar * link, bool *is_full)
blob_field->get_image(cp, copy->length,
blob_field->charset());
DBUG_ASSERT(cp + copy->length + copy->blob_length <= buff + buff_size);
- memcpy(cp+copy->length, copy->str, copy->blob_length);
+ if (copy->blob_length)
+ memcpy(cp+copy->length, copy->str, copy->blob_length);
cp+= copy->length+copy->blob_length;
}
break;
@@ -1648,7 +1649,7 @@ void JOIN_CACHE::get_record_by_pos(uchar *rec_ptr)
}
-/*
+/*
Get the match flag from the referenced record: the default implementation
SYNOPSIS
@@ -1660,6 +1661,7 @@ void JOIN_CACHE::get_record_by_pos(uchar *rec_ptr)
get the match flag for the record pointed by the reference at the position
rec_ptr. If the match flag is placed in one of the previous buffers the
function first reaches the linked record fields in this buffer.
+ The function returns the value of the first encountered match flag.
RETURN VALUE
match flag for the record at the position rec_ptr
@@ -1684,6 +1686,39 @@ enum JOIN_CACHE::Match_flag JOIN_CACHE::get_match_flag_by_pos(uchar *rec_ptr)
/*
+ Get the match flag for the referenced record from specified join buffer
+
+ SYNOPSIS
+ get_match_flag_by_pos_from_join_buffer()
+ rec_ptr position of the first field of the record in the join buffer
+ tab join table with join buffer where to look for the match flag
+
+ DESCRIPTION
+ This default implementation of the get_match_flag_by_pos_from_join_buffer
+ method gets the match flag for the record pointed by the reference at the
+ position rec_ptr from the join buffer attached to the join table tab.
+
+ RETURN VALUE
+ match flag for the record at the position rec_ptr from the join
+ buffer attached to the table tab.
+*/
+
+enum JOIN_CACHE::Match_flag
+JOIN_CACHE::get_match_flag_by_pos_from_join_buffer(uchar *rec_ptr,
+ JOIN_TAB *tab)
+{
+ DBUG_ASSERT(tab->cache && tab->cache->with_match_flag);
+ for (JOIN_CACHE *cache= this; ; )
+ {
+ if (cache->join_tab == tab)
+ return (enum Match_flag) rec_ptr[0];
+ cache= cache->prev_cache;
+ rec_ptr= cache->get_rec_ref(rec_ptr);
+ }
+}
+
+
+/*
Calculate the increment of the auxiliary buffer for a record write
SYNOPSIS
@@ -1953,6 +1988,10 @@ bool JOIN_CACHE::read_referenced_field(CACHE_FIELD *copy,
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
+ NOTE
+ Currently this function is called only when generating null complemented
+ records for outer joins (=> only when join_tab->first_unmatched != NULL).
+
RETURN VALUE
TRUE the match flag is set to MATCH_FOUND and the record has been skipped
FALSE otherwise
@@ -1965,7 +2004,9 @@ bool JOIN_CACHE::skip_if_matched()
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
/* Check whether the match flag is MATCH_FOUND */
- if (get_match_flag_by_pos(pos+offset) == MATCH_FOUND)
+ if (get_match_flag_by_pos_from_join_buffer(pos+offset,
+ join_tab->first_unmatched) ==
+ MATCH_FOUND)
{
pos+= size_of_rec_len + get_rec_length(pos);
return TRUE;
@@ -1982,13 +2023,23 @@ bool JOIN_CACHE::skip_if_matched()
DESCRIPTION
This default implementation of the virtual function skip_if_not_needed_match
- skips the next record from the join buffer if its match flag is not
- MATCH_NOT_FOUND, and, either its value is MATCH_FOUND and join_tab is the
- first inner table of an inner join, or, its value is MATCH_IMPOSSIBLE
- and join_tab is the first inner table of an outer join.
+ skips the next record from the join when generating join extensions
+ for the records in the join buffer depending on the value of the match flag.
+ - In the case of a semi-nest the match flag may be in two states
+ {MATCH_NOT_FOUND, MATCH_FOUND}. The record is skipped if the flag is set
+ to MATCH_FOUND.
+ - In the case of a outer join nest when not_exists optimization is applied
+ the match may be in three states {MATCH_NOT_FOUND, MATCH_IMPOSSIBLE,
+ MATCH_FOUND. The record is skipped if the flag is set to MATCH_FOUND or
+ to MATCH_IMPOSSIBLE.
+
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
+ NOTE
+ Currently the function is called only when generating non-null complemented
+ extensions for records in the join buffer.
+
RETURN VALUE
TRUE the record has to be skipped
FALSE otherwise
@@ -1999,11 +2050,19 @@ bool JOIN_CACHE::skip_if_not_needed_match()
DBUG_ASSERT(with_length);
enum Match_flag match_fl;
uint offset= size_of_rec_len;
+ bool skip= FALSE;
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
- if ((match_fl= get_match_flag_by_pos(pos+offset)) != MATCH_NOT_FOUND &&
- (join_tab->check_only_first_match() == (match_fl == MATCH_FOUND)) )
+ if (!join_tab->check_only_first_match())
+ return FALSE;
+
+ match_fl= get_match_flag_by_pos(pos+offset);
+ skip= join_tab->first_sj_inner_tab ?
+ match_fl == MATCH_FOUND : // the case of semi-join
+ match_fl != MATCH_NOT_FOUND; // the case of outer-join
+
+ if (skip)
{
pos+= size_of_rec_len + get_rec_length(pos);
return TRUE;
@@ -2103,7 +2162,14 @@ enum_nested_loop_state JOIN_CACHE::join_records(bool skip_last)
goto finish;
}
join_tab->not_null_compl= FALSE;
- /* Prepare for generation of null complementing extensions */
+ /*
+ Prepare for generation of null complementing extensions.
+ For all inner tables of the outer join operation for which
+ regular matches have been just found the field 'first_unmatched'
+ is set to point the the first inner table. After all null
+ complement rows are generated for this outer join this field
+ is set back to NULL.
+ */
for (tab= join_tab->first_inner; tab <= join_tab->last_inner; tab++)
tab->first_unmatched= join_tab->first_inner;
}
@@ -2220,7 +2286,10 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
int error;
enum_nested_loop_state rc= NESTED_LOOP_OK;
join_tab->table->null_row= 0;
- bool check_only_first_match= join_tab->check_only_first_match();
+ bool check_only_first_match=
+ join_tab->check_only_first_match() &&
+ (!join_tab->first_inner || // semi-join case
+ join_tab->first_inner == join_tab->first_unmatched); // outer join case
bool outer_join_first_inner= join_tab->is_first_inner_for_outer_join();
DBUG_ENTER("JOIN_CACHE::join_matching_records");
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index 1cbc6acfd79..456991037d1 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -206,7 +206,9 @@ protected:
/*
This flag indicates that records written into the join buffer contain
- a match flag field. The flag must be set by the init method.
+ a match flag field. The flag must be set by the init method.
+ Currently any implementation of the virtial init method calls
+ the function JOIN_CACHE::calc_record_fields() to set this flag.
*/
bool with_match_flag;
/*
@@ -646,6 +648,13 @@ public:
/* Shall return the value of the match flag for the positioned record */
virtual enum Match_flag get_match_flag_by_pos(uchar *rec_ptr);
+ /*
+ Shall return the value of the match flag for the positioned record
+ from the join buffer attached to the specified table
+ */
+ virtual enum Match_flag
+ get_match_flag_by_pos_from_join_buffer(uchar *rec_ptr, JOIN_TAB *tab);
+
/* Shall return the position of the current record */
virtual uchar *get_curr_rec() { return curr_rec_pos; }
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index e1e307330e3..5059e4f656e 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -4450,9 +4450,11 @@ void st_select_lex::set_explain_type(bool on_the_fly)
/*
pos_in_table_list=NULL for e.g. post-join aggregation JOIN_TABs.
*/
- if (tab->table && tab->table->pos_in_table_list &&
- tab->table->pos_in_table_list->with &&
- tab->table->pos_in_table_list->with->is_recursive)
+ if (!(tab->table && tab->table->pos_in_table_list))
+ continue;
+ TABLE_LIST *tbl= tab->table->pos_in_table_list;
+ if (tbl->with && tbl->with->is_recursive &&
+ tbl->is_with_table_recursive_reference())
{
uses_cte= true;
break;
@@ -4583,6 +4585,9 @@ bool LEX::save_prep_leaf_tables()
bool st_select_lex::save_prep_leaf_tables(THD *thd)
{
+ if (prep_leaf_list_state == SAVED)
+ return FALSE;
+
List_iterator_fast<TABLE_LIST> li(leaf_tables);
TABLE_LIST *table;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 965c3f29834..f733f783d0e 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -280,7 +280,7 @@ struct LEX_MASTER_INFO
}
host= user= password= log_file_name= ssl_key= ssl_cert= ssl_ca=
- ssl_capath= ssl_cipher= relay_log_name= 0;
+ ssl_capath= ssl_cipher= ssl_crl= ssl_crlpath= relay_log_name= NULL;
pos= relay_log_pos= server_id= port= connect_retry= 0;
heartbeat_period= 0;
ssl= ssl_verify_server_cert= heartbeat_opt=
diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc
index 7fa9a78f06f..d57963cceb0 100644
--- a/sql/sql_manager.cc
+++ b/sql/sql_manager.cc
@@ -26,8 +26,8 @@
#include "sql_manager.h"
#include "sql_base.h" // flush_tables
-static bool volatile manager_thread_in_use;
-static bool abort_manager;
+static bool volatile manager_thread_in_use = 0;
+static bool abort_manager = false;
pthread_t manager_thread;
mysql_mutex_t LOCK_manager;
@@ -35,31 +35,31 @@ mysql_cond_t COND_manager;
struct handler_cb {
struct handler_cb *next;
- void (*action)(void);
+ void (*action)(void *);
+ void *data;
};
-static struct handler_cb * volatile cb_list;
+static struct handler_cb *cb_list; // protected by LOCK_manager
-bool mysql_manager_submit(void (*action)())
+bool mysql_manager_submit(void (*action)(void *), void *data)
{
bool result= FALSE;
DBUG_ASSERT(manager_thread_in_use);
- struct handler_cb * volatile *cb;
+ struct handler_cb **cb;
mysql_mutex_lock(&LOCK_manager);
cb= &cb_list;
- while (*cb && (*cb)->action != action)
+ while (*cb)
cb= &(*cb)->next;
+ *cb= (struct handler_cb *)my_malloc(sizeof(struct handler_cb), MYF(MY_WME));
if (!*cb)
+ result= TRUE;
+ else
{
- *cb= (struct handler_cb *)my_malloc(sizeof(struct handler_cb), MYF(MY_WME));
- if (!*cb)
- result= TRUE;
- else
- {
- (*cb)->next= NULL;
- (*cb)->action= action;
- }
+ (*cb)->next= NULL;
+ (*cb)->action= action;
+ (*cb)->data= data;
}
+ mysql_cond_signal(&COND_manager);
mysql_mutex_unlock(&LOCK_manager);
return result;
}
@@ -69,18 +69,14 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
int error = 0;
struct timespec abstime;
bool reset_flush_time = TRUE;
- struct handler_cb *cb= NULL;
my_thread_init();
DBUG_ENTER("handle_manager");
pthread_detach_this_thread();
manager_thread = pthread_self();
- mysql_cond_init(key_COND_manager, &COND_manager,NULL);
- mysql_mutex_init(key_LOCK_manager, &LOCK_manager, NULL);
- manager_thread_in_use = 1;
- for (;;)
+ mysql_mutex_lock(&LOCK_manager);
+ while (!abort_manager)
{
- mysql_mutex_lock(&LOCK_manager);
/* XXX: This will need to be made more general to handle different
* polling needs. */
if (flush_time)
@@ -90,40 +86,37 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
set_timespec(abstime, flush_time);
reset_flush_time = FALSE;
}
- while ((!error || error == EINTR) && !abort_manager)
+ while ((!error || error == EINTR) && !abort_manager && !cb_list)
error= mysql_cond_timedwait(&COND_manager, &LOCK_manager, &abstime);
+
+ if (error == ETIMEDOUT || error == ETIME)
+ {
+ tc_purge();
+ error = 0;
+ reset_flush_time = TRUE;
+ }
}
else
{
- while ((!error || error == EINTR) && !abort_manager)
+ while ((!error || error == EINTR) && !abort_manager && !cb_list)
error= mysql_cond_wait(&COND_manager, &LOCK_manager);
}
- if (cb == NULL)
- {
- cb= cb_list;
- cb_list= NULL;
- }
- mysql_mutex_unlock(&LOCK_manager);
- if (abort_manager)
- break;
-
- if (error == ETIMEDOUT || error == ETIME)
- {
- tc_purge();
- error = 0;
- reset_flush_time = TRUE;
- }
+ struct handler_cb *cb= cb_list;
+ cb_list= NULL;
+ mysql_mutex_unlock(&LOCK_manager);
while (cb)
{
struct handler_cb *next= cb->next;
- cb->action();
+ cb->action(cb->data);
my_free(cb);
cb= next;
}
+ mysql_mutex_lock(&LOCK_manager);
}
manager_thread_in_use = 0;
+ mysql_mutex_unlock(&LOCK_manager);
mysql_mutex_destroy(&LOCK_manager);
mysql_cond_destroy(&COND_manager);
DBUG_LEAVE; // Can't use DBUG_RETURN after my_thread_end
@@ -137,15 +130,15 @@ void start_handle_manager()
{
DBUG_ENTER("start_handle_manager");
abort_manager = false;
- if (flush_time && flush_time != ~(ulong) 0L)
{
pthread_t hThread;
- int error;
- if ((error= mysql_thread_create(key_thread_handle_manager,
- &hThread, &connection_attrib,
- handle_manager, 0)))
- sql_print_warning("Can't create handle_manager thread (errno= %d)",
- error);
+ int err;
+ manager_thread_in_use = 1;
+ mysql_cond_init(key_COND_manager, &COND_manager,NULL);
+ mysql_mutex_init(key_LOCK_manager, &LOCK_manager, NULL);
+ if ((err= mysql_thread_create(key_thread_handle_manager, &hThread,
+ &connection_attrib, handle_manager, 0)))
+ sql_print_warning("Can't create handle_manager thread (errno: %M)", err);
}
DBUG_VOID_RETURN;
}
@@ -155,10 +148,10 @@ void start_handle_manager()
void stop_handle_manager()
{
DBUG_ENTER("stop_handle_manager");
- abort_manager = true;
if (manager_thread_in_use)
{
mysql_mutex_lock(&LOCK_manager);
+ abort_manager = true;
DBUG_PRINT("quit", ("initiate shutdown of handle manager thread: %lu",
(ulong)manager_thread));
mysql_cond_signal(&COND_manager);
diff --git a/sql/sql_manager.h b/sql/sql_manager.h
index 9c6c84450ed..f97d4a2cfc5 100644
--- a/sql/sql_manager.h
+++ b/sql/sql_manager.h
@@ -18,6 +18,6 @@
void start_handle_manager();
void stop_handle_manager();
-bool mysql_manager_submit(void (*action)());
+bool mysql_manager_submit(void (*action)(void *), void *data);
#endif /* SQL_MANAGER_INCLUDED */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 83100e743ad..573df24cb33 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2034,7 +2034,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
locks.
*/
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
thd->cleanup_after_query();
@@ -2099,7 +2099,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
ulonglong options= (ulonglong) (uchar) packet[0];
if (trans_commit_implicit(thd))
break;
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
if (check_global_access(thd,RELOAD_ACL))
break;
general_log_print(thd, command, NullS);
@@ -2132,7 +2132,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (trans_commit_implicit(thd))
break;
close_thread_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
my_ok(thd);
break;
}
@@ -2179,6 +2179,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
general_log_print(thd, command, NullS);
status_var_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS]);
+ *current_global_status_var= global_status_var;
calc_sum_of_all_status(current_global_status_var);
if (!(uptime= (ulong) (thd->start_time - server_start_time)))
queries_per_second1000= 0;
@@ -2934,7 +2935,7 @@ err:
/* Close tables and release metadata locks. */
close_thread_tables(thd);
DBUG_ASSERT(!thd->locked_tables_mode);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
return TRUE;
}
@@ -2994,6 +2995,146 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
/**
+ Check whether the SQL statement being processed is prepended by
+ SET STATEMENT clause and handle variables assignment if it is.
+
+ @param thd thread handle
+ @param lex current lex
+
+ @return false in case of success, true in case of error.
+*/
+
+bool run_set_statement_if_requested(THD *thd, LEX *lex)
+{
+ if (!lex->stmt_var_list.is_empty() && !thd->slave_thread)
+ {
+ Query_arena backup;
+ DBUG_PRINT("info", ("SET STATEMENT %d vars", lex->stmt_var_list.elements));
+
+ lex->old_var_list.empty();
+ List_iterator_fast<set_var_base> it(lex->stmt_var_list);
+ set_var_base *var;
+
+ if (lex->set_arena_for_set_stmt(&backup))
+ return true;
+
+ MEM_ROOT *mem_root= thd->mem_root;
+ while ((var= it++))
+ {
+ DBUG_ASSERT(var->is_system());
+ set_var *o= NULL, *v= (set_var*)var;
+ if (!v->var->is_set_stmt_ok())
+ {
+ my_error(ER_SET_STATEMENT_NOT_SUPPORTED, MYF(0), v->var->name.str);
+ lex->reset_arena_for_set_stmt(&backup);
+ lex->old_var_list.empty();
+ lex->free_arena_for_set_stmt();
+ return true;
+ }
+ if (v->var->session_is_default(thd))
+ o= new set_var(thd,v->type, v->var, &v->base, NULL);
+ else
+ {
+ switch (v->var->option.var_type & GET_TYPE_MASK)
+ {
+ case GET_BOOL:
+ case GET_INT:
+ case GET_LONG:
+ case GET_LL:
+ {
+ bool null_value;
+ longlong val= v->var->val_int(&null_value, thd, v->type, &v->base);
+ o= new set_var(thd, v->type, v->var, &v->base,
+ (null_value ?
+ (Item *) new (mem_root) Item_null(thd) :
+ (Item *) new (mem_root) Item_int(thd, val)));
+ }
+ break;
+ case GET_UINT:
+ case GET_ULONG:
+ case GET_ULL:
+ {
+ bool null_value;
+ ulonglong val= v->var->val_int(&null_value, thd, v->type, &v->base);
+ o= new set_var(thd, v->type, v->var, &v->base,
+ (null_value ?
+ (Item *) new (mem_root) Item_null(thd) :
+ (Item *) new (mem_root) Item_uint(thd, val)));
+ }
+ break;
+ case GET_DOUBLE:
+ {
+ bool null_value;
+ double val= v->var->val_real(&null_value, thd, v->type, &v->base);
+ o= new set_var(thd, v->type, v->var, &v->base,
+ (null_value ?
+ (Item *) new (mem_root) Item_null(thd) :
+ (Item *) new (mem_root) Item_float(thd, val, 1)));
+ }
+ break;
+ default:
+ case GET_NO_ARG:
+ case GET_DISABLED:
+ DBUG_ASSERT(0);
+ /* fall through */
+ case 0:
+ case GET_FLAGSET:
+ case GET_ENUM:
+ case GET_SET:
+ case GET_STR:
+ case GET_STR_ALLOC:
+ {
+ char buff[STRING_BUFFER_USUAL_SIZE];
+ String tmp(buff, sizeof(buff), v->var->charset(thd)),*val;
+ val= v->var->val_str(&tmp, thd, v->type, &v->base);
+ if (val)
+ {
+ Item_string *str=
+ new (mem_root) Item_string(thd, v->var->charset(thd),
+ val->ptr(), val->length());
+ o= new set_var(thd, v->type, v->var, &v->base, str);
+ }
+ else
+ o= new set_var(thd, v->type, v->var, &v->base,
+ new (mem_root) Item_null(thd));
+ }
+ break;
+ }
+ }
+ DBUG_ASSERT(o);
+ lex->old_var_list.push_back(o, thd->mem_root);
+ }
+ lex->reset_arena_for_set_stmt(&backup);
+
+ if (lex->old_var_list.is_empty())
+ lex->free_arena_for_set_stmt();
+
+ if (thd->is_error() ||
+ sql_set_variables(thd, &lex->stmt_var_list, false))
+ {
+ if (!thd->is_error())
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "SET");
+ lex->restore_set_statement_var();
+ return true;
+ }
+ /*
+ The value of last_insert_id is remembered in THD to be written to binlog
+ when it's used *the first time* in the statement. But SET STATEMENT
+ must read the old value of last_insert_id to be able to restore it at
+ the end. This should not count at "reading of last_insert_id" and
+ should not remember last_insert_id for binlog. That is, it should clear
+ stmt_depends_on_first_successful_insert_id_in_prev_stmt flag.
+ */
+ if (!thd->in_sub_stmt)
+ {
+ thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
+ }
+ }
+ return false;
+}
+
+
+/**
Execute command saved in thd and lex->sql_command.
@param thd Thread handle
@@ -3195,6 +3336,11 @@ mysql_execute_command(THD *thd)
#ifdef HAVE_REPLICATION
} /* endif unlikely slave */
#endif
+ /* store old value of binlog format */
+ enum_binlog_format orig_binlog_format,orig_current_stmt_binlog_format;
+
+ thd->get_binlog_format(&orig_binlog_format,
+ &orig_current_stmt_binlog_format);
#ifdef WITH_WSREP
if (wsrep && WSREP(thd))
{
@@ -3246,132 +3392,13 @@ mysql_execute_command(THD *thd)
DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
- /* store old value of binlog format */
- enum_binlog_format orig_binlog_format,orig_current_stmt_binlog_format;
-
- thd->get_binlog_format(&orig_binlog_format,
- &orig_current_stmt_binlog_format);
-
- if (!lex->stmt_var_list.is_empty() && !thd->slave_thread)
- {
- Query_arena backup;
- DBUG_PRINT("info", ("SET STATEMENT %d vars", lex->stmt_var_list.elements));
-
- lex->old_var_list.empty();
- List_iterator_fast<set_var_base> it(lex->stmt_var_list);
- set_var_base *var;
-
- if (lex->set_arena_for_set_stmt(&backup))
- goto error;
-
- MEM_ROOT *mem_root= thd->mem_root;
- while ((var= it++))
- {
- DBUG_ASSERT(var->is_system());
- set_var *o= NULL, *v= (set_var*)var;
- if (!v->var->is_set_stmt_ok())
- {
- my_error(ER_SET_STATEMENT_NOT_SUPPORTED, MYF(0), v->var->name.str);
- lex->reset_arena_for_set_stmt(&backup);
- lex->old_var_list.empty();
- lex->free_arena_for_set_stmt();
- goto error;
- }
- if (v->var->session_is_default(thd))
- o= new set_var(thd,v->type, v->var, &v->base, NULL);
- else
- {
- switch (v->var->option.var_type & GET_TYPE_MASK)
- {
- case GET_BOOL:
- case GET_INT:
- case GET_LONG:
- case GET_LL:
- {
- bool null_value;
- longlong val= v->var->val_int(&null_value, thd, v->type, &v->base);
- o= new set_var(thd, v->type, v->var, &v->base,
- (null_value ?
- (Item *) new (mem_root) Item_null(thd) :
- (Item *) new (mem_root) Item_int(thd, val)));
- }
- break;
- case GET_UINT:
- case GET_ULONG:
- case GET_ULL:
- {
- bool null_value;
- ulonglong val= v->var->val_int(&null_value, thd, v->type, &v->base);
- o= new set_var(thd, v->type, v->var, &v->base,
- (null_value ?
- (Item *) new (mem_root) Item_null(thd) :
- (Item *) new (mem_root) Item_uint(thd, val)));
- }
- break;
- case GET_DOUBLE:
- {
- bool null_value;
- double val= v->var->val_real(&null_value, thd, v->type, &v->base);
- o= new set_var(thd, v->type, v->var, &v->base,
- (null_value ?
- (Item *) new (mem_root) Item_null(thd) :
- (Item *) new (mem_root) Item_float(thd, val, 1)));
- }
- break;
- default:
- case GET_NO_ARG:
- case GET_DISABLED:
- DBUG_ASSERT(0);
- case 0:
- case GET_FLAGSET:
- case GET_ENUM:
- case GET_SET:
- case GET_STR:
- case GET_STR_ALLOC:
- {
- char buff[STRING_BUFFER_USUAL_SIZE];
- String tmp(buff, sizeof(buff), v->var->charset(thd)),*val;
- val= v->var->val_str(&tmp, thd, v->type, &v->base);
- if (val)
- {
- Item_string *str= new (mem_root) Item_string(thd, v->var->charset(thd),
- val->ptr(), val->length());
- o= new set_var(thd, v->type, v->var, &v->base, str);
- }
- else
- o= new set_var(thd, v->type, v->var, &v->base,
- new (mem_root) Item_null(thd));
- }
- break;
- }
- }
- DBUG_ASSERT(o);
- lex->old_var_list.push_back(o, thd->mem_root);
- }
- lex->reset_arena_for_set_stmt(&backup);
- if (lex->old_var_list.is_empty())
- lex->free_arena_for_set_stmt();
- if (thd->is_error() ||
- (res= sql_set_variables(thd, &lex->stmt_var_list, false)))
- {
- if (!thd->is_error())
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "SET");
- lex->restore_set_statement_var();
- goto error;
- }
- /*
- The value of last_insert_id is remembered in THD to be written to binlog
- when it's used *the first time* in the statement. But SET STATEMENT
- must read the old value of last_insert_id to be able to restore it at
- the end. This should not count at "reading of last_insert_id" and
- should not remember last_insert_id for binlog. That is, it should clear
- stmt_depends_on_first_successful_insert_id_in_prev_stmt flag.
- */
- if (!thd->in_sub_stmt)
- {
- thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
- }
- }
+ /*
+ Assign system variables with values specified by the clause
+ SET STATEMENT var1=value1 [, var2=value2, ...] FOR <statement>
+ if they are any.
+ */
+ if (run_set_statement_if_requested(thd, lex))
+ goto error;
if (thd->lex->mi.connection_name.str == NULL)
thd->lex->mi.connection_name= thd->variables.default_master_connection;
@@ -3406,7 +3433,7 @@ mysql_execute_command(THD *thd)
/* Commit the normal transaction if one is active. */
bool commit_failed= trans_commit_implicit(thd);
/* Release metadata locks acquired in this transaction. */
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
if (commit_failed)
{
WSREP_DEBUG("implicit commit failed, MDL released: %lld",
@@ -4645,7 +4672,7 @@ mysql_execute_command(THD *thd)
{
res= trans_commit_implicit(thd);
thd->locked_tables_list.unlock_locked_tables(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
}
if (thd->global_read_lock.is_acquired())
@@ -4659,7 +4686,7 @@ mysql_execute_command(THD *thd)
res= trans_commit_implicit(thd);
thd->locked_tables_list.unlock_locked_tables(thd);
/* Release transactional metadata locks. */
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
if (res)
goto error;
@@ -5313,7 +5340,7 @@ mysql_execute_command(THD *thd)
DBUG_PRINT("info", ("Executing SQLCOM_BEGIN thd: %p", thd));
if (trans_begin(thd, lex->start_transaction_opt))
{
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
WSREP_DEBUG("BEGIN failed, MDL released: %lld",
(longlong) thd->thread_id);
goto error;
@@ -5331,7 +5358,7 @@ mysql_execute_command(THD *thd)
(thd->variables.completion_type == 2 &&
lex->tx_release != TVL_NO));
bool commit_failed= trans_commit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
if (commit_failed)
{
WSREP_DEBUG("COMMIT failed, MDL released: %lld",
@@ -5382,7 +5409,7 @@ mysql_execute_command(THD *thd)
(thd->variables.completion_type == 2 &&
lex->tx_release != TVL_NO));
bool rollback_failed= trans_rollback(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
if (rollback_failed)
{
@@ -5859,7 +5886,6 @@ mysql_execute_command(THD *thd)
case SQLCOM_XA_COMMIT:
{
bool commit_failed= trans_xa_commit(thd);
- thd->mdl_context.release_transactional_locks();
if (commit_failed)
{
WSREP_DEBUG("XA commit failed, MDL released: %lld",
@@ -5877,7 +5903,6 @@ mysql_execute_command(THD *thd)
case SQLCOM_XA_ROLLBACK:
{
bool rollback_failed= trans_xa_rollback(thd);
- thd->mdl_context.release_transactional_locks();
if (rollback_failed)
{
WSREP_DEBUG("XA rollback failed, MDL released: %lld",
@@ -6095,7 +6120,7 @@ finish:
all storage engines including binary log.
*/
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
else if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_END))
{
@@ -6108,7 +6133,7 @@ finish:
/* Commit the normal transaction if one is active. */
trans_commit_implicit(thd);
thd->get_stmt_da()->set_overwrite_status(false);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
}
else if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
@@ -6123,7 +6148,7 @@ finish:
- If in autocommit mode, or outside a transactional context,
automatically release metadata locks of the current statement.
*/
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
else if (! thd->in_sub_stmt)
{
@@ -6145,7 +6170,7 @@ finish:
{
WSREP_DEBUG("Forcing release of transactional locks for thd: %lld",
(longlong) thd->thread_id);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
#endif /* WITH_WSREP */
@@ -6641,6 +6666,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
bool check_single_table_access(THD *thd, ulong privilege, TABLE_LIST *tables,
bool no_errors)
{
+ if (tables->derived)
+ return 0;
+
Switch_to_definer_security_ctx backup_sctx(thd, tables);
const char *db_name;
@@ -7332,8 +7360,13 @@ void THD::reset_for_next_command(bool do_clear_error)
thd->save_prep_leaf_list= false;
- DBUG_PRINT("debug",
- ("is_current_stmt_binlog_format_row(): %d",
+#ifdef WITH_WSREP
+#if !defined(DBUG_OFF)
+ if (mysql_bin_log.is_open())
+#endif
+#endif
+ DBUG_PRINT("debug",
+ ("is_current_stmt_binlog_format_row(): %d",
thd->is_current_stmt_binlog_format_row()));
DBUG_VOID_RETURN;
@@ -8745,6 +8778,8 @@ push_new_name_resolution_context(THD *thd,
left_op->first_leaf_for_name_resolution();
on_context->last_name_resolution_table=
right_op->last_leaf_for_name_resolution();
+ on_context->select_lex = thd->lex->current_select;
+ on_context->outer_context = thd->lex->current_context()->outer_context;
return thd->lex->push_context(on_context, thd->mem_root);
}
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index ce5953696a2..968fa223e1e 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -101,6 +101,7 @@ void mysql_init_multi_delete(LEX *lex);
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
void create_table_set_open_action_and_adjust_tables(LEX *lex);
pthread_handler_t handle_bootstrap(void *arg);
+bool run_set_statement_if_requested(THD *thd, LEX *lex);
int mysql_execute_command(THD *thd);
bool do_command(THD *thd);
void do_handle_bootstrap(THD *thd);
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index 64194b5a1b5..13f7296e0cd 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -22,9 +22,10 @@
that is defined in plugin.h
*/
#define SHOW_always_last SHOW_KEY_CACHE_LONG, \
- SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \
SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
- SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_LEX_STRING
+ SHOW_LONG_NOFLUSH, SHOW_LEX_STRING, \
+ /* SHOW_*_STATUS must be at the end, SHOW_LONG_STATUS being first */ \
+ SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_LONGLONG_STATUS
#include <my_global.h>
#undef SHOW_always_last
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index 43fe540731e..358052132a0 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -177,7 +177,6 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_thd_ignore_table,
wsrep_thd_trx_seqno,
wsrep_thd_ws_handle,
- wsrep_thd_auto_increment_variables,
wsrep_set_load_multi_commit,
wsrep_is_load_multi_commit,
wsrep_trx_is_aborting,
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 4bf8142959d..fa335465f02 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB
+ Copyright (c) 2008, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -117,15 +117,15 @@ When one supplies long data for a placeholder:
#include <mysql.h>
#else
#include <mysql_com.h>
+/* Constants defining bits in parameter type flags. Flags are read from high byte of short value */
+static const uint PARAMETER_FLAG_UNSIGNED= 128U << 8;
#endif
#include "lock.h" // MYSQL_OPEN_FORCE_SHARED_MDL
+#include "log_event.h" // class Log_event
#include "sql_handler.h"
#include "transaction.h" // trans_rollback_implicit
#include "wsrep_mysqld.h"
-/* Constants defining bits in parameter type flags. Flags are read from high byte of short value */
-static const uint PARAMETER_FLAG_UNSIGNED = 128U << 8;
-
/**
A result class used to send cursor rows using the binary protocol.
*/
@@ -2522,6 +2522,16 @@ static bool check_prepared_statement(Prepared_statement *stmt)
DBUG_RETURN(FALSE);
}
break;
+ case SQLCOM_SHOW_BINLOG_EVENTS:
+ case SQLCOM_SHOW_RELAYLOG_EVENTS:
+ {
+ List<Item> field_list;
+ Log_event::init_show_field_list(thd, &field_list);
+
+ if ((res= send_stmt_metadata(thd, stmt, &field_list)) == 2)
+ DBUG_RETURN(FALSE);
+ }
+ break;
#endif /* EMBEDDED_LIBRARY */
case SQLCOM_SHOW_CREATE_PROC:
if ((res= mysql_test_show_create_routine(stmt, TYPE_ENUM_PROCEDURE)) == 2)
@@ -4239,6 +4249,16 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
*/
MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
+ /*
+ Set variables specified by
+ SET STATEMENT var1=value1 [, var2=value2, ...] FOR <statement>
+ clause for duration of prepare phase. Original values of variable
+ listed in the SET STATEMENT clause is restored right after return
+ from the function check_prepared_statement()
+ */
+ if (likely(error == 0))
+ error= run_set_statement_if_requested(thd, lex);
+
/*
The only case where we should have items in the thd->free_list is
after stmt->set_params_from_vars(), which may in some cases create
@@ -4257,6 +4277,12 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_PREPARE;
}
+ /*
+ Restore original values of variables modified on handling
+ SET STATEMENT clause.
+ */
+ thd->lex->restore_set_statement_var();
+
/* The order is important */
lex->unit.cleanup();
@@ -4278,7 +4304,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
if (thd->transaction_rollback_request)
{
trans_rollback_implicit(thd);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
}
/* Preserve CHANGE MASTER attributes */
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 4af8ebc2dd8..59a3f686e45 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -4541,5 +4541,22 @@ rpl_gtid_pos_update(THD *thd, char *str, size_t len)
return false;
}
+int compare_log_name(const char *log_1, const char *log_2) {
+ int res= 1;
+ const char *ext1_str= strrchr(log_1, '.');
+ const char *ext2_str= strrchr(log_2, '.');
+ char file_name_1[255], file_name_2[255];
+ strmake(file_name_1, log_1, (ext1_str - log_1));
+ strmake(file_name_2, log_2, (ext2_str - log_2));
+ char *endptr = NULL;
+ res= strcmp(file_name_1, file_name_2);
+ if (!res)
+ {
+ ulong ext1= strtoul(++ext1_str, &endptr, 10);
+ ulong ext2= strtoul(++ext2_str, &endptr, 10);
+ res= (ext1 > ext2 ? 1 : ((ext1 == ext2) ? 0 : -1));
+ }
+ return res;
+}
#endif /* HAVE_REPLICATION */
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 8ddfa9239f6..9129aaeed5e 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -56,6 +56,7 @@ bool show_binlogs(THD* thd);
extern int init_master_info(Master_info* mi);
void kill_zombie_dump_threads(uint32 slave_server_id);
int check_binlog_magic(IO_CACHE* log, const char** errmsg);
+int compare_log_name(const char *log_1, const char *log_2);
struct LOAD_FILE_IO_CACHE : public IO_CACHE
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3b090093060..7bfbf719017 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -729,22 +729,6 @@ JOIN::prepare(TABLE_LIST *tables_init,
tables_list, select_lex->leaf_tables,
FALSE, SELECT_ACL, SELECT_ACL, FALSE))
DBUG_RETURN(-1);
-
- /*
- Permanently remove redundant parts from the query if
- 1) This is a subquery
- 2) This is the first time this query is optimized (since the
- transformation is permanent
- 3) Not normalizing a view. Removal should take place when a
- query involving a view is optimized, not when the view
- is created
- */
- if (select_lex->master_unit()->item && // 1)
- select_lex->first_cond_optimization && // 2)
- !thd->lex->is_view_context_analysis()) // 3)
- {
- remove_redundant_subquery_clauses(select_lex);
- }
/*
TRUE if the SELECT list mixes elements with and without grouping,
@@ -824,6 +808,23 @@ JOIN::prepare(TABLE_LIST *tables_init,
&hidden_group_fields,
&select_lex->select_n_reserved))
DBUG_RETURN(-1);
+
+ /*
+ Permanently remove redundant parts from the query if
+ 1) This is a subquery
+ 2) This is the first time this query is optimized (since the
+ transformation is permanent
+ 3) Not normalizing a view. Removal should take place when a
+ query involving a view is optimized, not when the view
+ is created
+ */
+ if (select_lex->master_unit()->item && // 1)
+ select_lex->first_cond_optimization && // 2)
+ !thd->lex->is_view_context_analysis()) // 3)
+ {
+ remove_redundant_subquery_clauses(select_lex);
+ }
+
/* Resolve the ORDER BY that was skipped, then remove it. */
if (skip_order_by && select_lex !=
select_lex->master_unit()->global_parameters())
@@ -3800,6 +3801,9 @@ mysql_select(THD *thd,
}
else
{
+ if (thd->lex->describe)
+ select_options|= SELECT_DESCRIBE;
+
/*
When in EXPLAIN, delay deleting the joins so that they are still
available when we're producing EXPLAIN EXTENDED warning text.
@@ -11929,10 +11933,6 @@ void JOIN_TAB::cleanup()
{
DBUG_ENTER("JOIN_TAB::cleanup");
- if (tab_list && tab_list->is_with_table_recursive_reference() &&
- tab_list->with->is_cleaned())
- DBUG_VOID_RETURN;
-
DBUG_PRINT("enter", ("tab: %p table %s.%s",
this,
(table ? table->s->db.str : "?"),
@@ -12275,6 +12275,9 @@ void JOIN::join_free()
for (tmp_unit= select_lex->first_inner_unit();
tmp_unit;
tmp_unit= tmp_unit->next_unit())
+ {
+ if (tmp_unit->with_element && tmp_unit->with_element->is_recursive)
+ continue;
for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
{
Item_subselect *subselect= sl->master_unit()->item;
@@ -12292,7 +12295,7 @@ void JOIN::join_free()
/* Can't unlock if at least one JOIN is still needed */
can_unlock= can_unlock && full_local;
}
-
+ }
/*
We are not using tables anymore
Unlock all tables. We may be in an INSERT .... SELECT statement.
@@ -12668,6 +12671,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
{
table_map order_tables=order->item[0]->used_tables();
if (order->item[0]->with_sum_func ||
+ order->item[0]->with_window_func ||
/*
If the outer table of an outer join is const (either by itself or
after applying WHERE condition), grouping on a field from such a
@@ -22464,7 +22468,7 @@ cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref)
{
enum enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
bool result= 0;
for (store_key **copy=ref->key_copy ; *copy ; copy++)
@@ -22476,7 +22480,7 @@ cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref)
}
}
thd->count_cuted_fields= save_count_cuted_fields;
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return result;
}
@@ -26064,10 +26068,10 @@ JOIN::reoptimize(Item *added_where, table_map join_tables,
if (save_to)
{
DBUG_ASSERT(!keyuse.elements);
- memcpy(keyuse.buffer,
- save_to->keyuse.buffer,
- (size_t) save_to->keyuse.elements * keyuse.size_of_element);
keyuse.elements= save_to->keyuse.elements;
+ if (size_t e= keyuse.elements)
+ memcpy(keyuse.buffer,
+ save_to->keyuse.buffer, e * keyuse.size_of_element);
}
/* Add the new access methods to the keyuse array. */
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4584460ca3f..f41c0df5ad8 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1842,8 +1842,8 @@ class store_key_field: public store_key
enum store_key_result copy_inner()
{
TABLE *table= copy_field.to_field->table;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
- table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table,
+ &table->write_set);
/*
It looks like the next statement is needed only for a simplified
@@ -1854,7 +1854,7 @@ class store_key_field: public store_key
bzero(copy_field.to_ptr,copy_field.to_length);
copy_field.do_copy(&copy_field);
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
null_key= to_field->is_null();
return err != 0 ? STORE_KEY_FATAL : STORE_KEY_OK;
}
@@ -1889,8 +1889,8 @@ public:
enum store_key_result copy_inner()
{
TABLE *table= to_field->table;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
- table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table,
+ &table->write_set);
int res= FALSE;
/*
@@ -1911,7 +1911,7 @@ public:
*/
if (!res && table->in_use->is_error())
res= 1; /* STORE_KEY_FATAL */
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
null_key= to_field->is_null() || item->null_value;
return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL :
(store_key_result) res);
@@ -1947,8 +1947,8 @@ protected:
{
inited=1;
TABLE *table= to_field->table;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
- table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table,
+ &table->write_set);
if ((res= item->save_in_field(to_field, 1)))
{
if (!err)
@@ -1960,7 +1960,7 @@ protected:
*/
if (!err && to_field->table->in_use->is_error())
err= 1; /* STORE_KEY_FATAL */
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
}
null_key= to_field->is_null() || item->null_value;
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 5544c765775..7023e5fe9ea 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1925,7 +1925,6 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
bool check_options= !(sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
!create_info_arg;
handlerton *hton;
- my_bitmap_map *old_map;
int error= 0;
DBUG_ENTER("show_create_table");
DBUG_PRINT("enter",("table: %s", table->s->table_name.str));
@@ -1987,7 +1986,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
We have to restore the read_set if we are called from insert in case
of row based replication.
*/
- old_map= tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= tmp_use_all_columns(table, &table->read_set);
for (ptr=table->field ; (field= *ptr); ptr++)
{
@@ -2014,8 +2013,13 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
/*
For string types dump collation name only if
collation is not primary for the given charset
+
+ For generated fields don't print the COLLATE clause if
+ the collation matches the expression's collation.
*/
- if (!(field->charset()->state & MY_CS_PRIMARY) && !field->vcol_info)
+ if (!(field->charset()->state & MY_CS_PRIMARY) &&
+ (!field->vcol_info ||
+ field->charset() != field->vcol_info->expr->collation.collation))
{
packet->append(STRING_WITH_LEN(" COLLATE "));
packet->append(field->charset()->name);
@@ -2352,7 +2356,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
}
}
#endif
- tmp_restore_column_map(table->read_set, old_map);
+ tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(error);
}
@@ -3576,6 +3580,9 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_SYS)
mysql_mutex_lock(&LOCK_global_system_variables);
+ else if (show_type >= SHOW_LONG_STATUS && scope == OPT_GLOBAL)
+ calc_sum_of_all_status_if_needed(status_var);
+
pos= get_one_variable(thd, var, scope, show_type, status_var,
&charset, buff, &length);
@@ -3616,8 +3623,6 @@ uint calc_sum_of_all_status(STATUS_VAR *to)
I_List_iterator<THD> it(threads);
THD *tmp;
- /* Get global values as base */
- *to= global_status_var;
to->local_memory_used= 0;
/* Add to this status from existing threads */
@@ -5046,6 +5051,12 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
continue;
}
+ if (thd->killed == ABORT_QUERY)
+ {
+ error= 0;
+ goto err;
+ }
+
DEBUG_SYNC(thd, "before_open_in_get_all_tables");
if (fill_schema_table_by_open(thd, FALSE,
table, schema_table,
@@ -7582,13 +7593,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
if (partial_cond)
partial_cond->val_int();
- if (scope == OPT_GLOBAL)
- {
- /* We only hold LOCK_status for summary status vars */
- mysql_mutex_lock(&LOCK_status);
- calc_sum_of_all_status(&tmp);
- mysql_mutex_unlock(&LOCK_status);
- }
+ tmp.local_memory_used= 0; // meaning tmp was not populated yet
mysql_mutex_lock(&LOCK_show_status);
res= show_status_array(thd, wild,
@@ -9410,7 +9415,7 @@ ST_FIELD_INFO check_constraints_fields_info[]=
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
{"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
OPEN_FULL_TABLE},
- {"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ {"CHECK_CLAUSE", MAX_FIELD_VARCHARLENGTH , MYSQL_TYPE_STRING, 0, 0, 0,
OPEN_FULL_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index d22921ba1e2..59c6423e388 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -1042,16 +1042,15 @@ public:
void store_stat_fields()
{
- char buff[MAX_FIELD_WIDTH];
- String val(buff, sizeof(buff), &my_charset_bin);
- my_bitmap_map *old_map;
+ StringBuffer<MAX_FIELD_WIDTH> val;
- old_map= dbug_tmp_use_all_columns(stat_table, stat_table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(stat_table, &stat_table->read_set);
for (uint i= COLUMN_STAT_MIN_VALUE; i <= COLUMN_STAT_HISTOGRAM; i++)
{
Field *stat_field= stat_table->field[i];
- if (table_field->collected_stats->is_null(i))
+ Column_statistics *stats= table_field->collected_stats;
+ if (stats->is_null(i))
stat_field->set_null();
else
{
@@ -1059,10 +1058,10 @@ public:
switch (i) {
case COLUMN_STAT_MIN_VALUE:
if (table_field->type() == MYSQL_TYPE_BIT)
- stat_field->store(table_field->collected_stats->min_value->val_int(),true);
+ stat_field->store(stats->min_value->val_int(),true);
else
{
- table_field->collected_stats->min_value->val_str(&val);
+ stats->min_value->val_str(&val);
uint32 length= Well_formed_prefix(val.charset(), val.ptr(),
MY_MIN(val.length(), stat_field->field_length)).length();
stat_field->store(val.ptr(), length, &my_charset_bin);
@@ -1070,42 +1069,38 @@ public:
break;
case COLUMN_STAT_MAX_VALUE:
if (table_field->type() == MYSQL_TYPE_BIT)
- stat_field->store(table_field->collected_stats->max_value->val_int(),true);
+ stat_field->store(stats->max_value->val_int(),true);
else
{
- table_field->collected_stats->max_value->val_str(&val);
+ stats->max_value->val_str(&val);
uint32 length= Well_formed_prefix(val.charset(), val.ptr(),
MY_MIN(val.length(), stat_field->field_length)).length();
stat_field->store(val.ptr(), length, &my_charset_bin);
}
break;
case COLUMN_STAT_NULLS_RATIO:
- stat_field->store(table_field->collected_stats->get_nulls_ratio());
+ stat_field->store(stats->get_nulls_ratio());
break;
case COLUMN_STAT_AVG_LENGTH:
- stat_field->store(table_field->collected_stats->get_avg_length());
+ stat_field->store(stats->get_avg_length());
break;
case COLUMN_STAT_AVG_FREQUENCY:
- stat_field->store(table_field->collected_stats->get_avg_frequency());
+ stat_field->store(stats->get_avg_frequency());
break;
case COLUMN_STAT_HIST_SIZE:
- stat_field->store(table_field->collected_stats->histogram.get_size());
+ stat_field->store(stats->histogram.get_size());
break;
case COLUMN_STAT_HIST_TYPE:
- stat_field->store(table_field->collected_stats->histogram.get_type() +
- 1);
+ stat_field->store(stats->histogram.get_type() + 1);
break;
case COLUMN_STAT_HISTOGRAM:
- const char * col_histogram=
- (const char *) (table_field->collected_stats->histogram.get_values());
- stat_field->store(col_histogram,
- table_field->collected_stats->histogram.get_size(),
- &my_charset_bin);
+ stat_field->store((char *)stats->histogram.get_values(),
+ stats->histogram.get_size(), &my_charset_bin);
break;
}
}
}
- dbug_tmp_restore_column_map(stat_table->read_set, old_map);
+ dbug_tmp_restore_column_map(&stat_table->read_set, old_map);
}
@@ -1155,16 +1150,30 @@ public:
switch (i) {
case COLUMN_STAT_MIN_VALUE:
- table_field->read_stats->min_value->set_notnull();
- stat_field->val_str(&val);
- table_field->read_stats->min_value->store(val.ptr(), val.length(),
- &my_charset_bin);
+ table_field->read_stats->min_value->set_notnull();
+ if (table_field->type() == MYSQL_TYPE_BIT)
+ table_field->read_stats->min_value->store(stat_field->val_int(),
+ true);
+ else
+ {
+ stat_field->val_str(&val);
+ table_field->read_stats->min_value->store(val.ptr(),
+ val.length(),
+ &my_charset_bin);
+ }
break;
case COLUMN_STAT_MAX_VALUE:
- table_field->read_stats->max_value->set_notnull();
- stat_field->val_str(&val);
- table_field->read_stats->max_value->store(val.ptr(), val.length(),
- &my_charset_bin);
+ table_field->read_stats->max_value->set_notnull();
+ if (table_field->type() == MYSQL_TYPE_BIT)
+ table_field->read_stats->max_value->store(stat_field->val_int(),
+ true);
+ else
+ {
+ stat_field->val_str(&val);
+ table_field->read_stats->max_value->store(val.ptr(),
+ val.length(),
+ &my_charset_bin);
+ }
break;
case COLUMN_STAT_NULLS_RATIO:
table_field->read_stats->set_nulls_ratio(stat_field->val_real());
@@ -2087,20 +2096,24 @@ void create_min_max_statistical_fields_for_table_share(THD *thd,
int alloc_statistics_for_table(THD* thd, TABLE *table)
{
Field **field_ptr;
- uint fields;
DBUG_ENTER("alloc_statistics_for_table");
+ uint columns= 0;
+ for (field_ptr= table->field; *field_ptr; field_ptr++)
+ {
+ if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
+ columns++;
+ }
Table_statistics *table_stats=
(Table_statistics *) alloc_root(&table->mem_root,
sizeof(Table_statistics));
- fields= table->s->fields ;
Column_statistics_collected *column_stats=
(Column_statistics_collected *) alloc_root(&table->mem_root,
sizeof(Column_statistics_collected) *
- (fields+1));
+ columns);
uint keys= table->s->keys;
Index_statistics *index_stats=
@@ -2111,12 +2124,6 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
ulonglong *idx_avg_frequency= (ulonglong*) alloc_root(&table->mem_root,
sizeof(ulonglong) * key_parts);
- uint columns= 0;
- for (field_ptr= table->field; *field_ptr; field_ptr++)
- {
- if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
- columns++;
- }
uint hist_size= thd->variables.histogram_size;
Histogram_type hist_type= (Histogram_type) (thd->variables.histogram_type);
uchar *histogram= NULL;
@@ -2138,19 +2145,17 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
table_stats->idx_avg_frequency= idx_avg_frequency;
table_stats->histograms= histogram;
- memset(column_stats, 0, sizeof(Column_statistics) * (fields+1));
+ memset(column_stats, 0, sizeof(Column_statistics) * columns);
- for (field_ptr= table->field; *field_ptr; field_ptr++, column_stats++)
+ for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- (*field_ptr)->collected_stats= column_stats;
- (*field_ptr)->collected_stats->max_value= NULL;
- (*field_ptr)->collected_stats->min_value= NULL;
if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
{
column_stats->histogram.set_size(hist_size);
column_stats->histogram.set_type(hist_type);
column_stats->histogram.set_values(histogram);
histogram+= hist_size;
+ (*field_ptr)->collected_stats= column_stats++;
}
}
@@ -2599,7 +2604,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
table_field= *field_ptr;
- if (!bitmap_is_set(table->read_set, table_field->field_index))
+ if (!table_field->collected_stats)
continue;
table_field->collected_stats->init(thd, table_field);
}
@@ -2626,7 +2631,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
table_field= *field_ptr;
- if (!bitmap_is_set(table->read_set, table_field->field_index))
+ if (!table_field->collected_stats)
continue;
if ((rc= table_field->collected_stats->add(rows)))
break;
@@ -2654,7 +2659,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
table_field= *field_ptr;
- if (!bitmap_is_set(table->read_set, table_field->field_index))
+ if (!table_field->collected_stats)
continue;
bitmap_set_bit(table->write_set, table_field->field_index);
if (!rc)
@@ -2758,7 +2763,7 @@ int update_statistics_for_table(THD *thd, TABLE *table)
for (Field **field_ptr= table->field; *field_ptr; field_ptr++)
{
Field *table_field= *field_ptr;
- if (!bitmap_is_set(table->read_set, table_field->field_index))
+ if (!table_field->collected_stats)
continue;
restore_record(stat_table, s->default_values);
column_stat.set_key_fields(table_field);
@@ -3715,6 +3720,7 @@ double get_column_range_cardinality(Field *field,
if (!table->stats_is_read)
return tab_records;
+ THD *thd= table->in_use;
double col_nulls= tab_records * col_stats->get_nulls_ratio();
double col_non_nulls= tab_records - col_nulls;
@@ -3745,7 +3751,7 @@ double get_column_range_cardinality(Field *field,
col_stats->min_max_values_are_provided())
{
Histogram *hist= &col_stats->histogram;
- if (hist->is_available())
+ if (hist->is_usable(thd))
{
store_key_image_to_rec(field, (uchar *) min_endp->key,
field->key_length());
@@ -3789,10 +3795,10 @@ double get_column_range_cardinality(Field *field,
max_mp_pos= 1.0;
Histogram *hist= &col_stats->histogram;
- if (!hist->is_available())
- sel= (max_mp_pos - min_mp_pos);
- else
+ if (hist->is_usable(thd))
sel= hist->range_selectivity(min_mp_pos, max_mp_pos);
+ else
+ sel= (max_mp_pos - min_mp_pos);
res= col_non_nulls * sel;
set_if_bigger(res, col_stats->get_avg_frequency());
}
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index fa3e8d6b894..d8788d99574 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -212,6 +212,17 @@ public:
bool is_available() { return get_size() > 0 && get_values(); }
+ /*
+ This function checks that histograms should be usable only when
+ 1) the level of optimizer_use_condition_selectivity > 3
+ 2) histograms have been collected
+ */
+ bool is_usable(THD *thd)
+ {
+ return thd->variables.optimizer_use_condition_selectivity > 3 &&
+ is_available();
+ }
+
void set_value(uint i, double val)
{
switch (type) {
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index b79ca82698b..4e0c7aea84b 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2016, MariaDB
+ Copyright (c) 2016, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -175,8 +175,8 @@ bool String::copy(const String &str)
{
if (alloc(str.str_length))
return TRUE;
- str_length=str.str_length;
- bmove(Ptr,str.Ptr,str_length); // May be overlapping
+ if ((str_length=str.str_length))
+ bmove(Ptr,str.Ptr,str_length); // May be overlapping
Ptr[str_length]=0;
str_charset=str.str_charset;
return FALSE;
@@ -539,8 +539,11 @@ bool String::append_ulonglong(ulonglong val)
bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
{
+ if (!arg_length)
+ return false;
+
uint32 offset;
-
+
if (needs_conversion(arg_length, cs, str_charset, &offset))
{
uint32 add_length;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 57284272316..cb28c6adcec 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3983,8 +3983,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
/* not a critical problem */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_TOO_LONG_KEY,
- ER_THD(thd, ER_TOO_LONG_KEY),
+ ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY),
key_part_length);
/* Align key length to multibyte char boundary */
key_part_length-= key_part_length % sql_field->charset->mbmaxlen;
@@ -4030,7 +4029,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (key->type == Key::MULTIPLE)
{
/* not a critical problem */
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY),
key_part_length);
/* Align key length to multibyte char boundary */
@@ -4254,7 +4253,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
ER_ILLEGAL_HA_CREATE_OPTION,
ER_THD(thd, ER_ILLEGAL_HA_CREATE_OPTION),
file->engine_name()->str,
- "TRANSACTIONAL=1");
+ create_info->transactional == HA_CHOICE_YES
+ ? "TRANSACTIONAL=1" : "TRANSACTIONAL=0");
if (parse_option_list(thd, file->partition_ht(), &create_info->option_struct,
&create_info->option_list,
@@ -5132,6 +5132,9 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
if (!opt_explicit_defaults_for_timestamp)
promote_first_timestamp_column(&alter_info->create_list);
+ /* We can abort create table for any table type */
+ thd->abort_on_warning= thd->is_strict_mode();
+
if (mysql_create_table_no_lock(thd, db, table_name, create_info, alter_info,
&is_trans, create_table_mode) > 0)
{
@@ -5164,6 +5167,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
}
err:
+ thd->abort_on_warning= 0;
+
/* In RBR we don't need to log CREATE TEMPORARY TABLE */
if (!result && thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
DBUG_RETURN(result);
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 4e68ec2ec2e..4ad0b365612 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -564,6 +564,7 @@ void mysql_print_status()
STATUS_VAR tmp;
uint count;
+ tmp= global_status_var;
count= calc_sum_of_all_status(&tmp);
printf("\nStatus information:\n\n");
(void) my_getwd(current_dir, sizeof(current_dir),MYF(0));
@@ -615,8 +616,12 @@ Next alarm time: %lu\n",
(ulong)alarm_info.next_alarm_time);
#endif
display_table_locks();
-#ifdef HAVE_MALLINFO
+#if defined(HAVE_MALLINFO2)
+ struct mallinfo2 info = mallinfo2();
+#elif defined(HAVE_MALLINFO)
struct mallinfo info= mallinfo();
+#endif
+#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
char llbuff[10][22];
printf("\nMemory status:\n\
Non-mmapped space allocated from system: %s\n\
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index ea4d7399ea3..7d1f630b88c 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -439,6 +439,15 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
*/
error= handler_truncate(thd, table_ref, FALSE);
+ if (error == TRUNCATE_OK && thd->locked_tables_mode &&
+ (table_ref->table->file->ht->flags &
+ HTON_REQUIRES_CLOSE_AFTER_TRUNCATE))
+ {
+ thd->locked_tables_list.mark_table_for_reopen(thd, table_ref->table);
+ if (unlikely(thd->locked_tables_list.reopen_tables(thd, true)))
+ thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
+ }
+
/*
All effects of a TRUNCATE TABLE operation are committed even if
truncation fails in the case of non transactional tables. Thus, the
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 046b42e4a83..42090037ead 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -92,7 +92,6 @@ public:
virtual void sortlength(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const= 0;
- virtual bool is_packable() const { return false; }
};
@@ -170,7 +169,6 @@ public:
void sortlength(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const;
- bool is_packable()const { return true; }
};
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 8b1719c60cb..7baedfb259c 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -211,7 +211,10 @@ select_union_recursive::create_result_table(THD *thd_arg,
create_table, keep_row_order))
return true;
- if (! (incr_table= create_tmp_table(thd_arg, &tmp_table_param, *column_types,
+ incr_table_param.init();
+ incr_table_param.field_count= column_types->elements;
+ incr_table_param.bit_fields_as_long= bit_fields_as_long;
+ if (! (incr_table= create_tmp_table(thd_arg, &incr_table_param, *column_types,
(ORDER*) 0, false, 1,
options, HA_POS_ERROR, "",
true, keep_row_order)))
@@ -221,20 +224,6 @@ select_union_recursive::create_result_table(THD *thd_arg,
for (uint i=0; i < table->s->fields; i++)
incr_table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
- TABLE *rec_table= 0;
- if (! (rec_table= create_tmp_table(thd_arg, &tmp_table_param, *column_types,
- (ORDER*) 0, false, 1,
- options, HA_POS_ERROR, alias,
- true, keep_row_order)))
- return true;
-
- rec_table->keys_in_use_for_query.clear_all();
- for (uint i=0; i < table->s->fields; i++)
- rec_table->field[i]->flags &= ~(PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG);
-
- if (rec_tables.push_back(rec_table))
- return true;
-
return false;
}
@@ -272,23 +261,25 @@ void select_union_recursive::cleanup()
free_tmp_table(thd, incr_table);
}
- List_iterator<TABLE> it(rec_tables);
- TABLE *tab;
- while ((tab= it++))
+ List_iterator<TABLE_LIST> it(rec_table_refs);
+ TABLE_LIST *tbl;
+ while ((tbl= it++))
{
+ TABLE *tab= tbl->table;
if (tab->is_created())
{
tab->file->extra(HA_EXTRA_RESET_STATE);
tab->file->ha_delete_all_rows();
}
- /*
+ /*
The table will be closed later in close_thread_tables(),
because it might be used in the statements like
ANALYZE WITH r AS (...) SELECT * from r
- where r is defined through recursion.
+ where r is defined through recursion.
*/
tab->next= thd->rec_tables;
thd->rec_tables= tab;
+ tbl->derived_result= 0;
}
}
@@ -715,9 +706,29 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
goto err;
if (!derived->table)
{
- derived->table= with_element->rec_result->rec_tables.head();
- if (derived->derived_result)
- derived->derived_result->table= derived->table;
+ bool res= false;
+
+ if ((!derived->is_with_table_recursive_reference() ||
+ !derived->derived_result) &&
+ !(derived->derived_result= new (thd->mem_root) select_union(thd)))
+ goto err; // out of memory
+ thd->create_tmp_table_for_derived= TRUE;
+ res= derived->derived_result->create_result_table(thd,
+ &types,
+ FALSE,
+ create_options,
+ derived->alias,
+ FALSE, FALSE);
+ thd->create_tmp_table_for_derived= FALSE;
+ if (res)
+ goto err;
+ derived->derived_result->set_unit(this);
+ derived->table= derived->derived_result->table;
+ if (derived->is_with_table_recursive_reference())
+ {
+ /* Here 'derived" is the primary recursive table reference */
+ derived->with->rec_result->rec_table_refs.push_back(derived);
+ }
}
with_element->mark_as_with_prepared_anchor();
is_rec_result_table_created= true;
@@ -1272,11 +1283,11 @@ bool st_select_lex_unit::exec_recursive()
TABLE *incr_table= with_element->rec_result->incr_table;
st_select_lex *end= NULL;
bool is_unrestricted= with_element->is_unrestricted();
- List_iterator_fast<TABLE> li(with_element->rec_result->rec_tables);
+ List_iterator_fast<TABLE_LIST> li(with_element->rec_result->rec_table_refs);
TMP_TABLE_PARAM *tmp_table_param= &with_element->rec_result->tmp_table_param;
ha_rows examined_rows= 0;
bool was_executed= executed;
- TABLE *rec_table;
+ TABLE_LIST *rec_tbl;
DBUG_ENTER("st_select_lex_unit::exec_recursive");
@@ -1335,8 +1346,9 @@ bool st_select_lex_unit::exec_recursive()
else
with_element->level++;
- while ((rec_table= li++))
+ while ((rec_tbl= li++))
{
+ TABLE *rec_table= rec_tbl->table;
saved_error=
incr_table->insert_all_rows_into_tmp_table(thd, rec_table,
tmp_table_param,
@@ -1370,13 +1382,7 @@ bool st_select_lex_unit::cleanup()
{
DBUG_RETURN(FALSE);
}
- /*
- When processing a PS/SP or an EXPLAIN command cleanup of a unit can
- be performed immediately when the unit is reached in the cleanup
- traversal initiated by the cleanup of the main unit.
- */
- if (!thd->stmt_arena->is_stmt_prepare() && !thd->lex->describe &&
- with_element && with_element->is_recursive && union_result)
+ if (with_element && with_element->is_recursive && union_result)
{
select_union_recursive *result= with_element->rec_result;
if (++result->cleanup_count == with_element->rec_outer_references)
@@ -1554,27 +1560,32 @@ bool st_select_lex::cleanup()
if (join)
{
+ List_iterator<TABLE_LIST> ti(leaf_tables);
+ TABLE_LIST *tbl;
+ while ((tbl= ti++))
+ {
+ if (tbl->is_recursive_with_table() &&
+ !tbl->is_with_table_recursive_reference())
+ {
+ /*
+ If query is killed before open_and_process_table() for tbl
+ is called then 'with' is already set, but 'derived' is not.
+ */
+ st_select_lex_unit *unit= tbl->with->spec;
+ error|= (bool) error | (uint) unit->cleanup();
+ }
+ }
DBUG_ASSERT((st_select_lex*)join->select_lex == this);
error= join->destroy();
delete join;
join= 0;
}
- for (TABLE_LIST *tbl= get_table_list(); tbl; tbl= tbl->next_local)
- {
- if (tbl->is_recursive_with_table() &&
- !tbl->is_with_table_recursive_reference())
- {
- /*
- If query is killed before open_and_process_table() for tbl
- is called then 'with' is already set, but 'derived' is not.
- */
- st_select_lex_unit *unit= tbl->with->spec;
- error|= (bool) error | (uint) unit->cleanup();
- }
- }
+ leaf_tables.empty();
for (SELECT_LEX_UNIT *lex_unit= first_inner_unit(); lex_unit ;
lex_unit= lex_unit->next_unit())
{
+ if (lex_unit->with_element && lex_unit->with_element->is_recursive)
+ continue;
error= (bool) ((uint) error | (uint) lex_unit->cleanup());
}
inner_refs_list.empty();
@@ -1594,8 +1605,12 @@ void st_select_lex::cleanup_all_joins(bool full)
join->cleanup(full);
for (unit= first_inner_unit(); unit; unit= unit->next_unit())
+ {
+ if (unit->with_element && unit->with_element->is_recursive)
+ continue;
for (sl= unit->first_select(); sl; sl= sl->next_select())
sl->cleanup_all_joins(full);
+ }
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 5e40cd242a4..01743a6751e 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1398,6 +1398,9 @@ bool Multiupdate_prelocking_strategy::handle_end(THD *thd)
if (select_lex->handle_derived(thd->lex, DT_MERGE))
DBUG_RETURN(1);
+ if (thd->lex->save_prep_leaf_tables())
+ DBUG_RETURN(1);
+
List<Item> *fields= &lex->select_lex.item_list;
if (setup_fields_with_no_wrap(thd, Ref_ptr_array(),
*fields, MARK_COLUMNS_WRITE, 0, 0))
@@ -1534,7 +1537,11 @@ int mysql_multi_update_prepare(THD *thd)
During prepare phase acquire only S metadata locks instead of SW locks to
keep prepare of multi-UPDATE compatible with concurrent LOCK TABLES WRITE
and global read lock.
+
+ Don't evaluate any subqueries even if constant, because
+ tables aren't locked yet.
*/
+ lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_DERIVED;
if (thd->lex->sql_command == SQLCOM_UPDATE_MULTI)
{
if (open_tables(thd, &table_list, &table_count,
@@ -1557,6 +1564,9 @@ int mysql_multi_update_prepare(THD *thd)
{
DBUG_RETURN(TRUE);
}
+
+ lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_DERIVED;
+
(void) read_statistics_for_tables_if_needed(thd, table_list);
/* @todo: downgrade the metadata locks here. */
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 8bfe6896ea2..0701c5233ac 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -291,6 +291,8 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view,
{
for (tbl= sl->get_table_list(); tbl; tbl= tbl->next_local)
{
+ if (!tbl->with && tbl->select_lex)
+ tbl->with= tbl->select_lex->find_table_def_in_with_clauses(tbl);
/*
Ensure that we have some privileges on this table, more strict check
will be done on column level after preparation,
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 2eabc4f0a6d..6eb47f1e49f 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1030,10 +1030,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 105 shift/reduce conflicts.
+ Currently there are 98 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 105
+%expect 115
/*
Comments for TOKENS.
@@ -1774,7 +1774,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <field_type> int_type real_type
-%type <Lex_field_type> type_with_opt_collate field_type
+%type <Lex_field_type> field_type
%type <Lex_dyncol_type> opt_dyncol_type dyncol_type
numeric_dyncol_type temporal_dyncol_type string_dyncol_type
@@ -1836,7 +1836,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <item>
literal text_literal insert_ident order_ident temporal_literal
simple_ident expr opt_expr opt_else sum_expr in_sum_expr
- variable variable_aux bool_pri
+ variable variable_aux
predicate bit_expr parenthesized_expr
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
expr_or_default set_expr_or_default
@@ -3010,11 +3010,12 @@ sp_param_name_and_type:
thd->variables.collation_database);
$<spvar>$= spvar;
}
- type_with_opt_collate
+ field_type
{
LEX *lex= Lex;
sp_variable *spvar= $<spvar>2;
+ Lex->set_last_field_type($3);
if (lex->sphead->fill_field_definition(thd, lex, lex->last_field))
{
MYSQL_YYABORT;
@@ -3096,14 +3097,15 @@ sp_decl:
thd->lex->init_last_field(&spvar->field_def, spvar->name.str,
thd->variables.collation_database);
}
- type_with_opt_collate
+ field_type
sp_opt_default
{
LEX *lex= Lex;
sp_pcontext *pctx= lex->spcont;
uint num_vars= pctx->context_var_count();
Item *dflt_value_item= $5;
-
+ Lex->set_last_field_type($4);
+
if (!dflt_value_item)
{
dflt_value_item= new (thd->mem_root) Item_null(thd);
@@ -6665,20 +6667,6 @@ serial_attribute:
;
-type_with_opt_collate:
- field_type opt_collate
- {
- $$= $1;
-
- if ($2)
- {
- if (!(Lex->charset= merge_charset_and_collation(Lex->charset, $2)))
- MYSQL_YYABORT;
- }
- Lex->set_last_field_type($1);
- }
- ;
-
charset:
CHAR_SYM SET {}
| CHARSET {}
@@ -6751,12 +6739,25 @@ charset_or_alias:
}
;
+collate: COLLATE_SYM collation_name_or_default
+ {
+ Lex->charset= Lex->last_field->charset= $2;
+ }
+ ;
+
opt_binary:
/* empty */ { bincmp_collation(NULL, false); }
| BYTE_SYM { bincmp_collation(&my_charset_bin, false); }
| charset_or_alias opt_bin_mod { bincmp_collation($1, $2); }
| BINARY { bincmp_collation(NULL, true); }
| BINARY charset_or_alias { bincmp_collation($2, true); }
+ | charset_or_alias collate
+ {
+ if (!my_charset_same(Lex->charset, $1))
+ my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ Lex->charset->name, $1->csname));
+ }
+ | collate { }
;
opt_bin_mod:
@@ -8972,23 +8973,19 @@ expr:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri
- ;
-
-bool_pri:
- bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
+ | expr EQUAL_SYM predicate %prec EQUAL_SYM
{
$$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri comp_op predicate %prec '='
+ | expr comp_op predicate %prec '='
{
$$= (*$2)(0)->create(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri comp_op all_or_any '(' subselect ')' %prec '='
+ | expr comp_op all_or_any '(' subselect ')' %prec '='
{
$$= all_any_subquery_creator(thd, $1, $2, $3, $5);
if ($$ == NULL)
@@ -13528,7 +13525,7 @@ kill:
lex->sql_command= SQLCOM_KILL;
lex->kill_type= KILL_TYPE_ID;
}
- kill_type kill_option kill_expr
+ kill_type kill_option
{
Lex->kill_signal= (killed_state) ($3 | $4);
}
@@ -13541,16 +13538,21 @@ kill_type:
;
kill_option:
- /* empty */ { $$= (int) KILL_CONNECTION; }
- | CONNECTION_SYM { $$= (int) KILL_CONNECTION; }
- | QUERY_SYM { $$= (int) KILL_QUERY; }
- | QUERY_SYM ID_SYM
+ opt_connection kill_expr { $$= (int) KILL_CONNECTION; }
+ | QUERY_SYM kill_expr { $$= (int) KILL_QUERY; }
+ | QUERY_SYM ID_SYM expr
{
$$= (int) KILL_QUERY;
Lex->kill_type= KILL_TYPE_QUERY;
+ Lex->value_list.push_front($3, thd->mem_root);
}
;
+opt_connection:
+ /* empty */ { }
+ | CONNECTION_SYM { }
+ ;
+
kill_expr:
expr
{
@@ -13563,7 +13565,6 @@ kill_expr:
}
;
-
shutdown:
SHUTDOWN { Lex->sql_command= SQLCOM_SHUTDOWN; }
;
@@ -16858,8 +16859,9 @@ sf_tail:
lex->init_last_field(&lex->sphead->m_return_field_def, NULL,
thd->variables.collation_database);
}
- type_with_opt_collate /* $11 */
+ field_type /* $11 */
{ /* $12 */
+ Lex->set_last_field_type($11);
if (Lex->sphead->fill_field_definition(thd, Lex, Lex->last_field))
MYSQL_YYABORT;
}
diff --git a/sql/structs.h b/sql/structs.h
index 67fb0d5dd66..27b9725815b 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -90,7 +90,7 @@ class engine_option_value;
struct ha_index_option_struct;
typedef struct st_key {
- uint key_length; /* Tot length of key */
+ uint key_length; /* total length of user defined key parts */
ulong flags; /* dupp key and pack flags */
uint user_defined_key_parts; /* How many key_parts */
uint usable_key_parts; /* Should normally be = user_defined_key_parts */
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 2a582a098fb..e4de3d8d0aa 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2224,7 +2224,7 @@ static Sys_var_ulong Sys_max_sort_length(
"the first max_sort_length bytes of each value are used; the rest "
"are ignored)",
SESSION_VAR(max_sort_length), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(8, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
+ VALID_RANGE(64, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
static Sys_var_ulong Sys_max_sp_recursion_depth(
"max_sp_recursion_depth",
@@ -3730,7 +3730,7 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
if (trans_commit_stmt(thd) || trans_commit(thd))
{
thd->variables.option_bits&= ~OPTION_AUTOCOMMIT;
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
WSREP_DEBUG("autocommit, MDL TRX lock released: %lld",
(longlong) thd->thread_id);
return true;
@@ -4157,11 +4157,11 @@ static Sys_var_ulong Sys_default_week_format(
SESSION_VAR(default_week_format), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 7), DEFAULT(0), BLOCK_SIZE(1));
-static Sys_var_ulonglong Sys_group_concat_max_len(
+static Sys_var_uint Sys_group_concat_max_len(
"group_concat_max_len",
"The maximum length of the result of function GROUP_CONCAT()",
SESSION_VAR(group_concat_max_len), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(4, SIZE_T_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1));
+ VALID_RANGE(4, UINT_MAX32), DEFAULT(1024*1024), BLOCK_SIZE(1));
static char *glob_hostname_ptr;
static Sys_var_charptr Sys_hostname(
@@ -4958,7 +4958,7 @@ static Sys_var_tz Sys_time_zone(
static Sys_var_charptr Sys_wsrep_provider(
"wsrep_provider", "Path to replication provider library",
- PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
+ PREALLOCATED READ_ONLY GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(WSREP_NONE),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update));
@@ -5171,7 +5171,7 @@ static Sys_var_ulong Sys_wsrep_max_ws_rows (
static Sys_var_charptr Sys_wsrep_notify_cmd(
"wsrep_notify_cmd", "",
- GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG),
+ READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG),
IN_SYSTEM_CHARSET, DEFAULT(""));
static Sys_var_mybool Sys_wsrep_certify_nonPK(
diff --git a/sql/table.cc b/sql/table.cc
index e4492f21a30..1004f583448 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2273,6 +2273,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
key_part->null_bit= field->null_bit;
key_part->store_length+=HA_KEY_NULL_LENGTH;
keyinfo->flags|=HA_NULL_PART_KEY;
+
+ /*
+ This branch is executed only for user defined key parts of the
+ secondary indexes.
+ */
+ DBUG_ASSERT(i < keyinfo->user_defined_key_parts);
keyinfo->key_length+= HA_KEY_NULL_LENGTH;
}
if (field->type() == MYSQL_TYPE_BLOB ||
@@ -2285,7 +2291,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
else
key_part->key_part_flag|= HA_VAR_LENGTH_PART;
key_part->store_length+=HA_KEY_BLOB_LENGTH;
- keyinfo->key_length+= HA_KEY_BLOB_LENGTH;
+ if (i < keyinfo->user_defined_key_parts)
+ keyinfo->key_length+= HA_KEY_BLOB_LENGTH;
}
if (field->type() == MYSQL_TYPE_BIT)
key_part->key_part_flag|= HA_BIT_PART;
@@ -2378,7 +2385,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
set_if_bigger(share->max_key_length,keyinfo->key_length+
keyinfo->user_defined_key_parts);
- share->total_key_length+= keyinfo->key_length;
/*
MERGE tables do not have unique indexes. But every key could be
an unique index on the underlying MyISAM table. (Bug #10400)
diff --git a/sql/table.h b/sql/table.h
index 14ab0027a79..83c72f76831 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -773,7 +773,7 @@ struct TABLE_SHARE
uint rec_buff_length; /* Size of table->record[] buffer */
uint keys, key_parts;
uint ext_key_parts; /* Total number of key parts in extended keys */
- uint max_key_length, max_unique_length, total_key_length;
+ uint max_key_length, max_unique_length;
uint uniques; /* Number of UNIQUE index */
uint db_create_options; /* Create options from database */
uint db_options_in_use; /* Options in use */
@@ -2277,8 +2277,12 @@ struct TABLE_LIST
Indicates what triggers we need to pre-load for this TABLE_LIST
when opening an associated TABLE. This is filled after
the parsed tree is created.
+
+ slave_fk_event_map is filled on the slave side with bitmaps value
+ representing row-based event operation to help find and prelock
+ possible FK constrain-related child tables.
*/
- uint8 trg_event_map;
+ uint8 trg_event_map, slave_fk_event_map;
/* TRUE <=> this table is a const one and was optimized away. */
bool optimized_away;
@@ -2766,25 +2770,25 @@ typedef struct st_open_table_list{
} OPEN_TABLE_LIST;
-static inline my_bitmap_map *tmp_use_all_columns(TABLE *table,
- MY_BITMAP *bitmap)
+static inline MY_BITMAP *tmp_use_all_columns(TABLE *table,
+ MY_BITMAP **bitmap)
{
- my_bitmap_map *old= bitmap->bitmap;
- bitmap->bitmap= table->s->all_set.bitmap;
+ MY_BITMAP *old= *bitmap;
+ *bitmap= &table->s->all_set;
return old;
}
-static inline void tmp_restore_column_map(MY_BITMAP *bitmap,
- my_bitmap_map *old)
+static inline void tmp_restore_column_map(MY_BITMAP **bitmap,
+ MY_BITMAP *old)
{
- bitmap->bitmap= old;
+ *bitmap= old;
}
/* The following is only needed for debugging */
-static inline my_bitmap_map *dbug_tmp_use_all_columns(TABLE *table,
- MY_BITMAP *bitmap)
+static inline MY_BITMAP *dbug_tmp_use_all_columns(TABLE *table,
+ MY_BITMAP **bitmap)
{
#ifndef DBUG_OFF
return tmp_use_all_columns(table, bitmap);
@@ -2793,8 +2797,8 @@ static inline my_bitmap_map *dbug_tmp_use_all_columns(TABLE *table,
#endif
}
-static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap,
- my_bitmap_map *old)
+static inline void dbug_tmp_restore_column_map(MY_BITMAP **bitmap,
+ MY_BITMAP *old)
{
#ifndef DBUG_OFF
tmp_restore_column_map(bitmap, old);
@@ -2807,22 +2811,22 @@ static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap,
Provide for the possiblity of the read set being the same as the write set
*/
static inline void dbug_tmp_use_all_columns(TABLE *table,
- my_bitmap_map **save,
- MY_BITMAP *read_set,
- MY_BITMAP *write_set)
+ MY_BITMAP **save,
+ MY_BITMAP **read_set,
+ MY_BITMAP **write_set)
{
#ifndef DBUG_OFF
- save[0]= read_set->bitmap;
- save[1]= write_set->bitmap;
+ save[0]= *read_set;
+ save[1]= *write_set;
(void) tmp_use_all_columns(table, read_set);
(void) tmp_use_all_columns(table, write_set);
#endif
}
-static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set,
- MY_BITMAP *write_set,
- my_bitmap_map **old)
+static inline void dbug_tmp_restore_column_maps(MY_BITMAP **read_set,
+ MY_BITMAP **write_set,
+ MY_BITMAP **old)
{
#ifndef DBUG_OFF
tmp_restore_column_map(read_set, old[0]);
@@ -2924,7 +2928,8 @@ inline void mark_as_null_row(TABLE *table)
{
table->null_row=1;
table->status|=STATUS_NULL_ROW;
- bfill(table->null_flags,table->s->null_bytes,255);
+ if (table->s->null_bytes)
+ bfill(table->null_flags,table->s->null_bytes,255);
}
bool is_simple_order(ORDER *order);
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 72b7f8e6fe4..543e0b7ad38 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -212,7 +212,7 @@ bool trans_begin(THD *thd, uint flags)
Release transactional metadata locks only after the
transaction has been committed.
*/
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
// The RO/RW options are mutually exclusive.
DBUG_ASSERT(!((flags & MYSQL_START_TRANS_OPT_READ_ONLY) &&
@@ -889,11 +889,13 @@ bool trans_xa_prepare(THD *thd)
/**
Commit and terminate the a XA transaction.
+ Transactional locks are released if transaction ended
@param thd Current thread
@retval FALSE Success
@retval TRUE Failure
+
*/
bool trans_xa_commit(THD *thd)
@@ -984,6 +986,7 @@ bool trans_xa_commit(THD *thd)
thd->transaction.xid_state.xa_state= XA_NOTR;
trans_track_end_trx(thd);
+ thd->mdl_context.release_transactional_locks();
DBUG_RETURN(res);
}
@@ -991,6 +994,7 @@ bool trans_xa_commit(THD *thd)
/**
Roll back and terminate a XA transaction.
+ Transactional locks are released if transaction ended
@param thd Current thread
@@ -1041,6 +1045,7 @@ bool trans_xa_rollback(THD *thd)
thd->transaction.xid_state.xa_state= XA_NOTR;
trans_track_end_trx(thd);
+ thd->mdl_context.release_transactional_locks();
DBUG_RETURN(res);
}
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 083960523c1..7974255af35 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -921,8 +921,11 @@ static bool pack_fields(uchar **buff_arg, List<Create_field> &create_fields,
it.rewind();
while ((field=it++))
{
- memcpy(buff, field->comment.str, field->comment.length);
- buff+= field->comment.length;
+ if (size_t l= field->comment.length)
+ {
+ memcpy(buff, field->comment.str, l);
+ buff+= l;
+ }
}
}
*buff_arg= buff;
@@ -941,7 +944,8 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
TABLE table;
TABLE_SHARE share;
Create_field *field;
- enum_check_fields old_count_cuted_fields= thd->count_cuted_fields;
+ Check_level_instant_set old_count_cuted_fields(thd, CHECK_FIELD_WARN);
+ Abort_on_warning_instant_set old_abort_on_warning(thd, 0);
DBUG_ENTER("make_empty_rec");
/* We need a table to generate columns for default values */
@@ -960,7 +964,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
null_pos= buff;
List_iterator<Create_field> it(create_fields);
- thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values
while ((field=it++))
{
/* regfield don't have to be deleted as it's allocated on THD::mem_root */
@@ -1036,6 +1039,5 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
*(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1);
err:
- thd->count_cuted_fields= old_count_cuted_fields;
DBUG_RETURN(error);
} /* make_empty_rec */
diff --git a/sql/unireg.h b/sql/unireg.h
index 6ce638928e8..efc3d6958f5 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -78,7 +78,8 @@
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
#define empty_record(A) { \
restore_record((A),s->default_values); \
- bfill((A)->null_flags,(A)->s->null_bytes,255);\
+ if ((A)->s->null_bytes) \
+ bfill((A)->null_flags,(A)->s->null_bytes,255); \
}
/* Defines for use with openfrm, openprt and openfrd */
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 66335c412e2..ea8ebb7522f 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -187,7 +187,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
trans_rollback(thd);
thd->locked_tables_list.unlock_locked_tables(thd);
/* Release transactional metadata locks. */
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
thd->wsrep_conflict_state= NO_CONFLICT;
DBUG_RETURN(WSREP_CB_FAILURE);
}
@@ -369,7 +369,7 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx,
/* Cleanup */
wsrep_set_apply_format(thd, NULL);
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
thd->reset_query(); /* Mutex protected */
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 53941c06892..f5e88aeac1f 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -125,14 +125,6 @@ longlong wsrep_thd_trx_seqno(THD *)
struct wsrep_ws_handle* wsrep_thd_ws_handle(THD *)
{ return 0; }
-void wsrep_thd_auto_increment_variables(THD *thd,
- unsigned long long *offset,
- unsigned long long *increment)
-{
- *offset= thd->variables.auto_increment_offset;
- *increment= thd->variables.auto_increment_increment;
-}
-
void wsrep_set_load_multi_commit(THD *thd, bool split)
{ }
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index d392d1c2a61..f22d8bf0f5a 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2762,9 +2762,7 @@ extern "C" void wsrep_thd_awake(THD *thd, my_bool signal)
{
if (signal)
{
- mysql_mutex_lock(&thd->LOCK_thd_data);
thd->awake(KILL_QUERY);
- mysql_mutex_unlock(&thd->LOCK_thd_data);
}
else
{
@@ -2790,16 +2788,18 @@ extern "C" bool wsrep_thd_ignore_table(THD *thd)
extern int
wsrep_trx_order_before(THD *thd1, THD *thd2)
{
- if (wsrep_thd_trx_seqno(thd1) < wsrep_thd_trx_seqno(thd2)) {
- WSREP_DEBUG("BF conflict, order: %lld %lld\n",
- (long long)wsrep_thd_trx_seqno(thd1),
- (long long)wsrep_thd_trx_seqno(thd2));
- return 1;
- }
- WSREP_DEBUG("waiting for BF, trx order: %lld %lld\n",
- (long long)wsrep_thd_trx_seqno(thd1),
- (long long)wsrep_thd_trx_seqno(thd2));
- return 0;
+ const longlong trx1_seqno= wsrep_thd_trx_seqno(thd1);
+ const longlong trx2_seqno= wsrep_thd_trx_seqno(thd2);
+ WSREP_DEBUG("BF conflict, order: %lld %lld\n",
+ trx1_seqno, trx2_seqno);
+
+ if (trx1_seqno == WSREP_SEQNO_UNDEFINED ||
+ trx2_seqno == WSREP_SEQNO_UNDEFINED)
+ return 1; /* trx is not yet replicated */
+ else if (trx1_seqno < trx2_seqno)
+ return 1;
+
+ return 0;
}
diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc
index fb04d7be7c1..3683d70a980 100644
--- a/sql/wsrep_notify.cc
+++ b/sql/wsrep_notify.cc
@@ -40,11 +40,13 @@ void wsrep_notify_status (wsrep_member_status_t status,
return;
}
- char cmd_buf[1 << 16]; // this can be long
- long cmd_len = sizeof(cmd_buf) - 1;
- char* cmd_ptr = cmd_buf;
+ const long cmd_len = (1 << 16) - 1;
+ char* cmd_ptr = (char*) my_malloc(cmd_len + 1, MYF(MY_WME));
long cmd_off = 0;
+ if (!cmd_ptr)
+ return; // the warning is in the log
+
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, "%s",
wsrep_notify_cmd);
@@ -93,6 +95,7 @@ void wsrep_notify_status (wsrep_member_status_t status,
{
WSREP_ERROR("Notification buffer too short (%ld). Aborting notification.",
cmd_len);
+ my_free(cmd_ptr);
return;
}
@@ -106,5 +109,6 @@ void wsrep_notify_status (wsrep_member_status_t status,
WSREP_ERROR("Notification command failed: %d (%s): \"%s\"",
err, strerror(err), cmd_ptr);
}
+ my_free(cmd_ptr);
}
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 65a3f971c62..f4092b9b8a7 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -149,6 +149,12 @@ static bool sst_auth_real_set (const char* value)
if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); }
wsrep_sst_auth= my_strdup(WSREP_SST_AUTH_MASK, MYF(0));
}
+ else
+ {
+ if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); }
+ wsrep_sst_auth= NULL;
+ }
+
return 0;
}
return 1;
@@ -701,8 +707,20 @@ static size_t estimate_cmd_len (bool* extra_args)
char c;
while ((c = *arg++) != 0)
{
- /* A whitespace or a single quote requires double quotation marks: */
- if (isspace(c) || c == '\'')
+ /*
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
+ */
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
+ */
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
@@ -725,10 +743,19 @@ static size_t estimate_cmd_len (bool* extra_args)
while ((c = *arg++) != 0)
{
/*
- A whitespace or a single quote requires double
- quotation marks:
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
*/
- if (isspace(c) || c == '\'')
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
+ */
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
@@ -809,8 +836,20 @@ static void copy_orig_argv (char* cmd_str)
char c;
while ((c = *arg_scan++) != 0)
{
- /* A whitespace or a single quote requires double quotation marks: */
- if (isspace(c) || c == '\'')
+ /*
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
+ */
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
+ */
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
@@ -884,10 +923,19 @@ static void copy_orig_argv (char* cmd_str)
while ((c = *arg_scan++) != 0)
{
/*
- A whitespace or a single quote requires double
- quotation marks:
+ Space, single quote, ampersand, and I/O redirection characters
+ require text to be enclosed in double quotes:
*/
- if (isspace(c) || c == '\'')
+ if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
+#ifdef __WIN__
+ c == '>' || c == '<')
+#else
+ /*
+ The semicolon is used to separate shell commands, so it must be
+ enclosed in double quotes as well:
+ */
+ c == '>' || c == '<' || c == ';')
+#endif
{
quotation= true;
}
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 4dddb399bd1..ef8c0e132f7 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -22,6 +22,7 @@
//#include "global_threads.h" // LOCK_thread_count, etc.
#include "sql_base.h" // close_thread_tables()
#include "mysqld.h" // start_wsrep_THD();
+#include "debug_sync.h"
#include "slave.h" // opt_log_slave_updates
#include "rpl_filter.h"
@@ -75,7 +76,7 @@ void wsrep_client_rollback(THD *thd)
}
/* Release transactional metadata locks. */
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
/* release explicit MDL locks */
thd->mdl_context.release_explicit_locks();
@@ -146,11 +147,12 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
// Disable general logging on applier threads
thd->variables.option_bits |= OPTION_LOG_OFF;
- // Enable binlogging if opt_log_slave_updates is set
- if (opt_log_slave_updates)
- thd->variables.option_bits|= OPTION_BIN_LOG;
- else
- thd->variables.option_bits&= ~(OPTION_BIN_LOG);
+
+ /* enable binlogging regardless of log_slave_updates setting
+ this is for ensuring that both local and applier transaction go through
+ same commit ordering algorithm in group commit control
+ */
+ thd->variables.option_bits|= OPTION_BIN_LOG;
if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init(thd, "wsrep_relay");
@@ -211,7 +213,7 @@ void wsrep_replay_sp_transaction(THD* thd)
thd->locked_tables_list.unlock_locked_tables(thd);
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
}
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
mysql_mutex_unlock(&thd->LOCK_thd_data);
THD *replay_thd= new THD(true);
@@ -350,7 +352,7 @@ void wsrep_replay_transaction(THD *thd)
thd->locked_tables_list.unlock_locked_tables(thd);
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
}
- thd->mdl_context.release_transactional_locks();
+ thd->release_transactional_locks();
/*
Replaying will call MYSQL_START_STATEMENT when handling
BEGIN Query_log_event so end statement must be called before
@@ -370,6 +372,19 @@ void wsrep_replay_transaction(THD *thd)
thd->variables.option_bits|= OPTION_BEGIN;
thd->server_status|= SERVER_STATUS_IN_TRANS;
+ /* Allow tests to block the replayer thread using the DBUG facilities */
+#ifdef ENABLED_DEBUG_SYNC
+ DBUG_EXECUTE_IF("sync.wsrep_replay_cb",
+ {
+ const char act[]=
+ "now "
+ "SIGNAL sync.wsrep_replay_cb_reached "
+ "WAIT_FOR signal.wsrep_replay_cb";
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act)));
+ };);
+#endif /* ENABLED_DEBUG_SYNC */
+
int rcode = wsrep->replay_trx(wsrep,
&thd->wsrep_ws_handle,
(void *)thd);
@@ -836,27 +851,6 @@ bool wsrep_thd_has_explicit_locks(THD *thd)
return thd->mdl_context.has_explicit_locks();
}
-/*
- Get auto increment variables for THD. Use global settings for
- applier threads.
- */
-void wsrep_thd_auto_increment_variables(THD* thd,
- unsigned long long* offset,
- unsigned long long* increment)
-{
- if (thd->wsrep_exec_mode == REPL_RECV &&
- thd->wsrep_conflict_state != REPLAYING)
- {
- *offset= global_system_variables.auto_increment_offset;
- *increment= global_system_variables.auto_increment_increment;
- }
- else
- {
- *offset= thd->variables.auto_increment_offset;
- *increment= thd->variables.auto_increment_increment;
- }
-}
-
my_bool wsrep_thd_is_applier(MYSQL_THD thd)
{
my_bool is_applier= false;
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index bd04295daa6..b951185e554 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1546,7 +1546,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
share->rows_recorded= 0;
stats.auto_increment_value= 1;
share->archive_write.auto_increment= 0;
- my_bitmap_map *org_bitmap= tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= tmp_use_all_columns(table, &table->read_set);
while (!(rc= get_row(&archive, table->record[0])))
{
@@ -1567,7 +1567,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
}
}
- tmp_restore_column_map(table->read_set, org_bitmap);
+ tmp_restore_column_map(&table->read_set, org_bitmap);
share->rows_recorded= (ha_rows)writer.rows;
}
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index cf30aa6b5dc..514948baf1c 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -1641,18 +1641,18 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key,
char *cass_key;
int cass_key_len;
- my_bitmap_map *old_map;
+ MY_BITMAP *old_map;
- old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ old_map= dbug_tmp_use_all_columns(table, &table->read_set);
if (rowkey_converter->mariadb_to_cassandra(&cass_key, &cass_key_len))
{
/* We get here when making lookups like uuid_column='not-an-uuid' */
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(HA_ERR_KEY_NOT_FOUND);
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
bool found;
if (se->get_slice(cass_key, cass_key_len, &found))
@@ -1726,8 +1726,8 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk)
cassandra_to_mariadb() calls will use field->store(...) methods, which
require that the column is in the table->write_set
*/
- my_bitmap_map *old_map;
- old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map;
+ old_map= dbug_tmp_use_all_columns(table, &table->write_set);
/* Start with all fields being NULL */
for (field= table->field + 1; *field; field++)
@@ -1848,7 +1848,7 @@ int ha_cassandra::read_cassandra_columns(bool unpack_pk)
}
err:
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return res;
}
@@ -1933,7 +1933,7 @@ void ha_cassandra::free_dynamic_row(DYNAMIC_COLUMN_VALUE **vals,
int ha_cassandra::write_row(uchar *buf)
{
- my_bitmap_map *old_map;
+ MY_BITMAP *old_map;
int ires;
DBUG_ENTER("ha_cassandra::write_row");
@@ -1943,7 +1943,7 @@ int ha_cassandra::write_row(uchar *buf)
if (!doing_insert_batch)
se->clear_insert_buffer();
- old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ old_map= dbug_tmp_use_all_columns(table, &table->read_set);
insert_lineno++;
@@ -1954,7 +1954,7 @@ int ha_cassandra::write_row(uchar *buf)
{
my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0),
rowkey_converter->field->field_name, insert_lineno);
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
se->start_row_insert(cass_key, cass_key_len);
@@ -1977,7 +1977,7 @@ int ha_cassandra::write_row(uchar *buf)
free_dynamic_row(&vals, &names);
if (rc)
{
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(rc);
}
}
@@ -1988,7 +1988,7 @@ int ha_cassandra::write_row(uchar *buf)
{
my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0),
field_converters[i]->field->field_name, insert_lineno);
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
se->add_insert_column(field_converters[i]->field->field_name, 0,
@@ -1996,7 +1996,7 @@ int ha_cassandra::write_row(uchar *buf)
}
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
bool res;
@@ -2263,8 +2263,8 @@ bool ha_cassandra::mrr_start_read()
{
uint key_len;
- my_bitmap_map *old_map;
- old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map;
+ old_map= dbug_tmp_use_all_columns(table, &table->read_set);
se->new_lookup_keys();
@@ -2288,7 +2288,7 @@ bool ha_cassandra::mrr_start_read()
break;
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
return se->multiget_slice();
}
@@ -2366,7 +2366,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data)
LEX_STRING *oldnames, *names;
uint oldcount, count;
String oldvalcol, valcol;
- my_bitmap_map *old_map;
+ MY_BITMAP *old_map;
int res;
DBUG_ENTER("ha_cassandra::update_row");
/* Currently, it is guaranteed that new_data == table->record[0] */
@@ -2374,7 +2374,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data)
/* For now, just rewrite the full record */
se->clear_insert_buffer();
- old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ old_map= dbug_tmp_use_all_columns(table, &table->read_set);
char *old_key;
int old_key_len;
@@ -2387,7 +2387,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data)
{
my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0),
rowkey_converter->field->field_name, insert_lineno);
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
@@ -2450,7 +2450,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data)
{
my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0),
field_converters[i]->field->field_name, insert_lineno);
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
se->add_insert_column(field_converters[i]->field->field_name, 0,
@@ -2477,7 +2477,7 @@ int ha_cassandra::update_row(const uchar *old_data, uchar *new_data)
}
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
res= se->do_insert();
diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp
index 92f36a4cdf2..a0a421657bd 100644
--- a/storage/connect/bson.cpp
+++ b/storage/connect/bson.cpp
@@ -82,7 +82,7 @@ BDOC::BDOC(PGLOBAL G) : BJSON(G, NULL)
/***********************************************************************/
PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng)
{
- int i;
+ size_t i;
bool b = false, ptyp = (bool *)pty;
PBVAL bvp = NULL;
@@ -185,7 +185,7 @@ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng)
/***********************************************************************/
/* Parse several items as being in an array. */
/***********************************************************************/
-OFFSET BDOC::ParseAsArray(int& i) {
+OFFSET BDOC::ParseAsArray(size_t& i) {
if (pty[0] && (!pretty || pretty > 2)) {
OFFSET jsp;
@@ -202,7 +202,7 @@ OFFSET BDOC::ParseAsArray(int& i) {
/***********************************************************************/
/* Parse a JSON Array. */
/***********************************************************************/
-OFFSET BDOC::ParseArray(int& i)
+OFFSET BDOC::ParseArray(size_t& i)
{
int level = 0;
bool b = (!i);
@@ -214,7 +214,7 @@ OFFSET BDOC::ParseArray(int& i)
switch (s[i]) {
case ',':
if (level < 2) {
- sprintf(G->Message, "Unexpected ',' near %.*s", ARGS);
+ sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS);
throw 1;
} else
level = 1;
@@ -222,7 +222,7 @@ OFFSET BDOC::ParseArray(int& i)
break;
case ']':
if (level == 1) {
- sprintf(G->Message, "Unexpected ',]' near %.*s", ARGS);
+ sprintf(G->Message, "Unexpected ',]' near %.*s", (int) ARGS);
throw 1;
} // endif level
@@ -236,7 +236,7 @@ OFFSET BDOC::ParseArray(int& i)
break;
default:
if (level == 2) {
- sprintf(G->Message, "Unexpected value near %.*s", ARGS);
+ sprintf(G->Message, "Unexpected value near %.*s", (int) ARGS);
throw 1;
} else if (lastvlp) {
vlp = ParseValue(i, NewVal());
@@ -260,7 +260,7 @@ OFFSET BDOC::ParseArray(int& i)
/***********************************************************************/
/* Parse a JSON Object. */
/***********************************************************************/
-OFFSET BDOC::ParseObject(int& i)
+OFFSET BDOC::ParseObject(size_t& i)
{
OFFSET key;
int level = 0;
@@ -283,7 +283,7 @@ OFFSET BDOC::ParseObject(int& i)
level = 2;
} else {
- sprintf(G->Message, "misplaced string near %.*s", ARGS);
+ sprintf(G->Message, "misplaced string near %.*s", (int) ARGS);
throw 2;
} // endif level
@@ -293,14 +293,14 @@ OFFSET BDOC::ParseObject(int& i)
ParseValue(++i, GetVlp(lastbpp));
level = 3;
} else {
- sprintf(G->Message, "Unexpected ':' near %.*s", ARGS);
+ sprintf(G->Message, "Unexpected ':' near %.*s", (int) ARGS);
throw 2;
} // endif level
break;
case ',':
if (level < 3) {
- sprintf(G->Message, "Unexpected ',' near %.*s", ARGS);
+ sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS);
throw 2;
} else
level = 1;
@@ -308,7 +308,7 @@ OFFSET BDOC::ParseObject(int& i)
break;
case '}':
if (!(level == 0 || level == 3)) {
- sprintf(G->Message, "Unexpected '}' near %.*s", ARGS);
+ sprintf(G->Message, "Unexpected '}' near %.*s", (int) ARGS);
throw 2;
} // endif level
@@ -321,7 +321,7 @@ OFFSET BDOC::ParseObject(int& i)
break;
default:
sprintf(G->Message, "Unexpected character '%c' near %.*s",
- s[i], ARGS);
+ s[i], (int) ARGS);
throw 2;
}; // endswitch s[i]
@@ -332,7 +332,7 @@ OFFSET BDOC::ParseObject(int& i)
/***********************************************************************/
/* Parse a JSON Value. */
/***********************************************************************/
-PBVAL BDOC::ParseValue(int& i, PBVAL bvp)
+PBVAL BDOC::ParseValue(size_t& i, PBVAL bvp)
{
for (; i < len; i++)
switch (s[i]) {
@@ -398,14 +398,14 @@ suite:
return bvp;
err:
- sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], ARGS);
+ sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], (int) ARGS);
throw 3;
} // end of ParseValue
/***********************************************************************/
/* Unescape and parse a JSON string. */
/***********************************************************************/
-OFFSET BDOC::ParseString(int& i)
+OFFSET BDOC::ParseString(size_t& i)
{
uchar* p;
int n = 0;
@@ -492,7 +492,7 @@ throw("Unexpected EOF in String");
/***********************************************************************/
/* Parse a JSON numeric value. */
/***********************************************************************/
-void BDOC::ParseNumeric(int& i, PBVAL vlp)
+void BDOC::ParseNumeric(size_t& i, PBVAL vlp)
{
char buf[50];
int n = 0;
@@ -1203,15 +1203,14 @@ void BJSON::SetArrayValue(PBVAL bap, PBVAL nvp, int n)
{
CheckType(bap, TYPE_JAR);
int i = 0;
- PBVAL bvp = NULL, pvp = NULL;
+ PBVAL bvp = NULL;
if (bap->To_Val)
for (bvp = GetArray(bap); bvp; i++, bvp = GetNext(bvp))
if (i == n) {
SetValueVal(bvp, nvp);
return;
- } else
- pvp = bvp;
+ }
if (!bvp)
AddArrayValue(bap, MOF(nvp));
diff --git a/storage/connect/bson.h b/storage/connect/bson.h
index 4da86aeac67..acc36e8e0ed 100644
--- a/storage/connect/bson.h
+++ b/storage/connect/bson.h
@@ -104,7 +104,7 @@ public:
PSZ GetArrayText(PGLOBAL g, PBVAL bap, PSTRG text);
void MergeArray(PBVAL bap1,PBVAL bap2);
bool DeleteValue(PBVAL bap, int n);
- void AddArrayValue(PBVAL bap, OFFSET nvp = NULL, int* x = NULL);
+ void AddArrayValue(PBVAL bap, OFFSET nvp = 0, int* x = NULL);
inline void AddArrayValue(PBVAL bap, PBVAL nvp = NULL, int* x = NULL)
{AddArrayValue(bap, MOF(nvp), x);}
void SetArrayValue(PBVAL bap, PBVAL nvp, int n);
@@ -184,12 +184,12 @@ public:
PSZ Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty);
protected:
- OFFSET ParseArray(int& i);
- OFFSET ParseObject(int& i);
- PBVAL ParseValue(int& i, PBVAL bvp);
- OFFSET ParseString(int& i);
- void ParseNumeric(int& i, PBVAL bvp);
- OFFSET ParseAsArray(int& i);
+ OFFSET ParseArray(size_t& i);
+ OFFSET ParseObject(size_t& i);
+ PBVAL ParseValue(size_t& i, PBVAL bvp);
+ OFFSET ParseString(size_t& i);
+ void ParseNumeric(size_t& i, PBVAL bvp);
+ OFFSET ParseAsArray(size_t& i);
bool SerializeArray(OFFSET arp, bool b);
bool SerializeObject(OFFSET obp);
bool SerializeValue(PBVAL vp, bool b = false);
@@ -197,7 +197,7 @@ protected:
// Members used when parsing and serializing
JOUT* jp; // Used with serialize
char* s; // The Json string to parse
- int len; // The Json string length
+ size_t len; // The Json string length
int pretty; // The pretty style of the file to parse
bool pty[3]; // Used to guess what pretty is
bool comma; // True if Pretty = 1
diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp
index dcf072242c8..a56db4d731b 100644
--- a/storage/connect/bsonudf.cpp
+++ b/storage/connect/bsonudf.cpp
@@ -31,6 +31,9 @@ int JsonDefPrec = -1;
int GetDefaultPrec(void);
int IsArgJson(UDF_ARGS* args, uint i);
void SetChanged(PBSON bsp);
+int GetJsonDefPrec(void);
+
+static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp);
/* --------------------------------- JSON UDF ---------------------------------- */
@@ -59,7 +62,7 @@ inline void JsonFreeMem(PGLOBAL g) {
/*********************************************************************************/
/* Allocate and initialize a BSON structure. */
/*********************************************************************************/
-PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp)
+static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp)
{
PBSON bsp = (PBSON)PlgDBSubAlloc(g, NULL, sizeof(BSON));
@@ -391,7 +394,7 @@ PSZ BJNX::MakeKey(UDF_ARGS *args, int i)
} // endif *s
if (n < 1)
- return NewStr("Key");
+ return NewStr((PSZ)"Key");
if (!b) {
p = (PSZ)BsonSubAlloc(n + 1);
@@ -405,7 +408,7 @@ PSZ BJNX::MakeKey(UDF_ARGS *args, int i)
return NewStr((PSZ)s);
} // endif count
- return NewStr("Key");
+ return NewStr((PSZ)"Key");
} // end of MakeKey
/*********************************************************************************/
@@ -1635,7 +1638,7 @@ PBVAL BJNX::ParseJsonFile(PGLOBAL g, char *fn, int& pty, size_t& len)
len = (size_t)mm.lenL;
if (mm.lenH)
- len += ((size_t)mm.lenH * 0x000000001LL);
+ len += mm.lenH;
memory = (char *)mm.memory;
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index 3c2c49de8b7..30ce19a5d37 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -1734,7 +1734,7 @@ bool BINFAM::OpenTableFile(PGLOBAL g) {
/*********************************************************************/
return AllocateBuffer(g);
} // end of OpenTableFile
-#endif 0
+#endif // 0
/***********************************************************************/
/* Allocate the line buffer. For mode Delete a bigger buffer has to */
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 2686bb4338e..b3c0b0c69b2 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -2194,7 +2194,6 @@ int ha_connect::MakeRecord(char *buf)
int rc= 0;
Field* *field;
Field *fp;
- my_bitmap_map *org_bitmap;
CHARSET_INFO *charset= tdbp->data_charset();
//MY_BITMAP readmap;
MY_BITMAP *map;
@@ -2209,7 +2208,7 @@ int ha_connect::MakeRecord(char *buf)
*table->def_read_set.bitmap, *table->def_write_set.bitmap);
// Avoid asserts in field::store() for columns that are not updated
- org_bitmap= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->write_set);
// This is for variable_length rows
memset(buf, 0, table->s->null_bytes);
@@ -2236,7 +2235,7 @@ int ha_connect::MakeRecord(char *buf)
continue;
htrc("Column %s not found\n", fp->field_name);
- dbug_tmp_restore_column_map(table->write_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->write_set, org_bitmap);
DBUG_RETURN(HA_ERR_WRONG_IN_RECORD);
} // endif colp
@@ -2319,7 +2318,7 @@ int ha_connect::MakeRecord(char *buf)
memcpy(buf, table->record[0], table->s->stored_rec_length);
// This is copied from ha_tina and is necessary to avoid asserts
- dbug_tmp_restore_column_map(table->write_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->write_set, org_bitmap);
DBUG_RETURN(rc);
} // end of MakeRecord
@@ -2339,7 +2338,7 @@ int ha_connect::ScanRecord(PGLOBAL g, const uchar *)
//PTDBASE tp= (PTDBASE)tdbp;
String attribute(attr_buffer, sizeof(attr_buffer),
table->s->table_charset);
- my_bitmap_map *bmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *bmap= dbug_tmp_use_all_columns(table, &table->read_set);
const CHARSET_INFO *charset= tdbp->data_charset();
String data_charset_value(data_buffer, sizeof(data_buffer), charset);
@@ -2461,7 +2460,7 @@ int ha_connect::ScanRecord(PGLOBAL g, const uchar *)
} // endfor field
err:
- dbug_tmp_restore_column_map(table->read_set, bmap);
+ dbug_tmp_restore_column_map(&table->read_set, bmap);
return rc;
} // end of ScanRecord
@@ -2509,7 +2508,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
OPVAL op;
Field *fp;
const key_range *ranges[2];
- my_bitmap_map *old_map;
+ MY_BITMAP *old_map;
KEY *kfp;
KEY_PART_INFO *kpart;
@@ -2526,7 +2525,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
both= ranges[0] && ranges[1];
kfp= &table->key_info[active_index];
- old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ old_map= dbug_tmp_use_all_columns(table, &table->write_set);
for (i= 0; i <= 1; i++) {
if (ranges[i] == NULL)
@@ -2621,11 +2620,11 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
if ((oom= qry->IsTruncated()))
strcpy(g->Message, "Out of memory");
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return oom;
err:
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return true;
} // end of MakeKeyWhere
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index bf6c9991800..7db01af2f2b 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -34,6 +34,8 @@ static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
static PJSON JsonNew(PGLOBAL g, JTYP type);
static PJVAL JvalNew(PGLOBAL g, JTYP type, void *vp = NULL);
static PJSNX JsnxNew(PGLOBAL g, PJSON jsp, int type, int len = 64);
+uint GetJsonGroupSize(void);
+static void SetChanged(PBSON bsp);
uint JsonGrpSize = 10;
@@ -1237,7 +1239,7 @@ PBSON JbinAlloc(PGLOBAL g, UDF_ARGS *args, ulong len, PJSON jsp)
/*********************************************************************************/
/* Set the BSON chain as changed. */
/*********************************************************************************/
-void SetChanged(PBSON bsp)
+static void SetChanged(PBSON bsp)
{
if (bsp->Bsp)
SetChanged(bsp->Bsp);
diff --git a/storage/connect/mysql-test/connect/r/xml.result b/storage/connect/mysql-test/connect/r/xml.result
index 6a0c9db27b3..575c903bbbc 100644
--- a/storage/connect/mysql-test/connect/r/xml.result
+++ b/storage/connect/mysql-test/connect/r/xml.result
@@ -374,8 +374,7 @@ INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
Warnings:
Level Warning
Code 1105
-Message Com error: Unable to save character to 'iso-8859-1' encoding.
-
+Message warning about characters outside of iso-8859-1
INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1;
node &<>"'
diff --git a/storage/connect/mysql-test/connect/t/xml.test b/storage/connect/mysql-test/connect/t/xml.test
index 0fdf8e90b6e..e837ec79604 100644
--- a/storage/connect/mysql-test/connect/t/xml.test
+++ b/storage/connect/mysql-test/connect/t/xml.test
@@ -300,6 +300,7 @@ CREATE TABLE t1 (node VARCHAR(50))
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
+--replace_regex /.*iso-8859-1.*/warning about characters outside of iso-8859-1/
INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1;
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index 69d258d9fd3..9e1f006d605 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -377,9 +377,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m)
if (atoi(buff) == mid)
break;
- if (sscanf(buff, " %*d %s \"%[^\"]", msgid, stmsg) < 2) {
+ if (sscanf(buff, " %*d %.31s \"%.255[^\"]", msgid, stmsg) < 2) {
// Old message file
- if (!sscanf(buff, " %*d \"%[^\"]", stmsg)) {
+ if (!sscanf(buff, " %*d \"%.255[^\"]", stmsg)) {
sprintf(stmsg, "Bad message file for %d %s", mid, SVP(m));
goto fin;
} else
@@ -628,7 +628,7 @@ size_t MakeOff(void* memp, void* ptr)
DoThrow(999);
} // endif ptr
#endif // _DEBUG || DEVELOPMENT
- return (size_t)((char*)ptr - (size_t)memp);
+ return (size_t)(((char*)ptr) - ((char*)memp));
} else
return 0;
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 4f192af64dd..59710ca74c2 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -528,7 +528,7 @@ int ha_tina::encode_quote(uchar *buf)
String attribute(attribute_buffer, sizeof(attribute_buffer),
&my_charset_bin);
bool ietf_quotes= table_share->option_struct->ietf_quotes;
- my_bitmap_map *org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
buffer.length(0);
for (Field **field=table->field ; *field ; field++)
@@ -606,7 +606,7 @@ int ha_tina::encode_quote(uchar *buf)
//buffer.replace(buffer.length(), 0, "\n", 1);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return (buffer.length());
}
@@ -659,7 +659,6 @@ int ha_tina::find_current_row(uchar *buf)
{
my_off_t end_offset, curr_offset= current_position;
int eoln_len;
- my_bitmap_map *org_bitmap;
int error;
bool read_all;
bool ietf_quotes= table_share->option_struct->ietf_quotes;
@@ -679,7 +678,7 @@ int ha_tina::find_current_row(uchar *buf)
/* We must read all columns in case a table is opened for update */
read_all= !bitmap_is_clear_all(table->write_set);
/* Avoid asserts in ::store() for columns that are not going to be updated */
- org_bitmap= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->write_set);
error= HA_ERR_CRASHED_ON_USAGE;
memset(buf, 0, table->s->null_bytes);
@@ -857,7 +856,7 @@ int ha_tina::find_current_row(uchar *buf)
error= 0;
err:
- dbug_tmp_restore_column_map(table->write_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->write_set, org_bitmap);
DBUG_RETURN(error);
}
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 2e8d5b12e81..adf8c67ad36 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -936,7 +936,7 @@ uint ha_federated::convert_row_to_internal_format(uchar *record,
{
ulong *lengths;
Field **field;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
DBUG_ENTER("ha_federated::convert_row_to_internal_format");
lengths= mysql_fetch_lengths(result);
@@ -965,7 +965,7 @@ uint ha_federated::convert_row_to_internal_format(uchar *record,
}
(*field)->move_field_offset(-old_ptr);
}
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(0);
}
@@ -1293,14 +1293,13 @@ bool ha_federated::create_where_from_key(String *to,
char tmpbuff[FEDERATED_QUERY_BUFFER_SIZE];
String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info);
const key_range *ranges[2]= { start_key, end_key };
- my_bitmap_map *old_map;
DBUG_ENTER("ha_federated::create_where_from_key");
tmp.length(0);
if (start_key == NULL && end_key == NULL)
DBUG_RETURN(1);
- old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
for (uint i= 0; i <= 1; i++)
{
bool needs_quotes;
@@ -1477,7 +1476,7 @@ prepare_for_next_key_part:
tmp.c_ptr_quick()));
}
}
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
if (both_not_null)
if (tmp.append(STRING_WITH_LEN(") ")))
@@ -1492,7 +1491,7 @@ prepare_for_next_key_part:
DBUG_RETURN(0);
err:
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(1);
}
@@ -1841,7 +1840,7 @@ int ha_federated::write_row(uchar *buf)
String insert_field_value_string(insert_field_value_buffer,
sizeof(insert_field_value_buffer),
&my_charset_bin);
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->read_set);
DBUG_ENTER("ha_federated::write_row");
values_string.length(0);
@@ -1895,7 +1894,7 @@ int ha_federated::write_row(uchar *buf)
values_string.append(STRING_WITH_LEN(", "));
}
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
/*
if there were no fields, we don't want to add a closing paren
@@ -2203,7 +2202,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data)
else
{
/* otherwise = */
- my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= tmp_use_all_columns(table, &table->read_set);
bool needs_quote= (*field)->str_needs_quotes();
(*field)->val_str(&field_value);
if (needs_quote)
@@ -2212,7 +2211,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data)
if (needs_quote)
update_string.append(value_quote_char);
field_value.length(0);
- tmp_restore_column_map(table->read_set, old_map);
+ tmp_restore_column_map(&table->read_set, old_map);
}
update_string.append(STRING_WITH_LEN(", "));
}
diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc
index 2068716eeba..4a2588a6af4 100644
--- a/storage/federatedx/federatedx_io_mysql.cc
+++ b/storage/federatedx/federatedx_io_mysql.cc
@@ -64,7 +64,6 @@ struct mysql_position
class federatedx_io_mysql :public federatedx_io
{
MYSQL mysql; /* MySQL connection */
- MYSQL_ROWS *current;
DYNAMIC_ARRAY savepoints;
bool requested_autocommit;
bool actual_autocommit;
@@ -108,7 +107,8 @@ public:
virtual void free_result(FEDERATEDX_IO_RESULT *io_result);
virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result);
virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result);
- virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result);
+ virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result,
+ FEDERATEDX_IO_ROWS **current= NULL);
virtual ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result);
virtual const char *get_column_data(FEDERATEDX_IO_ROW *row,
unsigned int column);
@@ -117,7 +117,7 @@ public:
virtual size_t get_ref_length() const;
virtual void mark_position(FEDERATEDX_IO_RESULT *io_result,
- void *ref);
+ void *ref, FEDERATEDX_IO_ROWS *current);
virtual int seek_position(FEDERATEDX_IO_RESULT **io_result,
const void *ref);
virtual void set_thd(void *thd);
@@ -515,10 +515,12 @@ my_ulonglong federatedx_io_mysql::get_num_rows(FEDERATEDX_IO_RESULT *io_result)
}
-FEDERATEDX_IO_ROW *federatedx_io_mysql::fetch_row(FEDERATEDX_IO_RESULT *io_result)
+FEDERATEDX_IO_ROW *federatedx_io_mysql::fetch_row(FEDERATEDX_IO_RESULT *io_result,
+ FEDERATEDX_IO_ROWS **current)
{
MYSQL_RES *result= (MYSQL_RES*)io_result;
- current= result->data_cursor;
+ if (current)
+ *current= (FEDERATEDX_IO_ROWS *) result->data_cursor;
return (FEDERATEDX_IO_ROW *) mysql_fetch_row(result);
}
@@ -626,11 +628,11 @@ size_t federatedx_io_mysql::get_ref_length() const
void federatedx_io_mysql::mark_position(FEDERATEDX_IO_RESULT *io_result,
- void *ref)
+ void *ref, FEDERATEDX_IO_ROWS *current)
{
mysql_position& pos= *reinterpret_cast<mysql_position*>(ref);
pos.result= (MYSQL_RES *) io_result;
- pos.offset= current;
+ pos.offset= (MYSQL_ROW_OFFSET) current;
}
int federatedx_io_mysql::seek_position(FEDERATEDX_IO_RESULT **io_result,
diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc
index aa35d4bdecc..d945db528c7 100644
--- a/storage/federatedx/federatedx_io_null.cc
+++ b/storage/federatedx/federatedx_io_null.cc
@@ -90,7 +90,8 @@ public:
virtual void free_result(FEDERATEDX_IO_RESULT *io_result);
virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result);
virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result);
- virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result);
+ virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result,
+ FEDERATEDX_IO_ROWS **current= NULL);
virtual ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result);
virtual const char *get_column_data(FEDERATEDX_IO_ROW *row,
unsigned int column);
@@ -98,7 +99,7 @@ public:
unsigned int column) const;
virtual size_t get_ref_length() const;
virtual void mark_position(FEDERATEDX_IO_RESULT *io_result,
- void *ref);
+ void *ref, FEDERATEDX_IO_ROWS *current);
virtual int seek_position(FEDERATEDX_IO_RESULT **io_result,
const void *ref);
};
@@ -242,7 +243,8 @@ my_ulonglong federatedx_io_null::get_num_rows(FEDERATEDX_IO_RESULT *)
}
-FEDERATEDX_IO_ROW *federatedx_io_null::fetch_row(FEDERATEDX_IO_RESULT *)
+FEDERATEDX_IO_ROW *federatedx_io_null::fetch_row(FEDERATEDX_IO_RESULT *,
+ FEDERATEDX_IO_ROWS **current)
{
return NULL;
}
@@ -288,7 +290,7 @@ size_t federatedx_io_null::get_ref_length() const
void federatedx_io_null::mark_position(FEDERATEDX_IO_RESULT *io_result,
- void *ref)
+ void *ref, FEDERATEDX_IO_ROWS *current)
{
}
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 840a5a68885..65947c730e0 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -859,7 +859,7 @@ uint ha_federatedx::convert_row_to_internal_format(uchar *record,
ulong *lengths;
Field **field;
int column= 0;
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
DBUG_ENTER("ha_federatedx::convert_row_to_internal_format");
lengths= io->fetch_lengths(result);
@@ -885,7 +885,7 @@ uint ha_federatedx::convert_row_to_internal_format(uchar *record,
}
(*field)->move_field_offset(-old_ptr);
}
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(0);
}
@@ -1213,14 +1213,13 @@ bool ha_federatedx::create_where_from_key(String *to,
char tmpbuff[FEDERATEDX_QUERY_BUFFER_SIZE];
String tmp(tmpbuff, sizeof(tmpbuff), system_charset_info);
const key_range *ranges[2]= { start_key, end_key };
- my_bitmap_map *old_map;
DBUG_ENTER("ha_federatedx::create_where_from_key");
tmp.length(0);
if (start_key == NULL && end_key == NULL)
DBUG_RETURN(1);
- old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
for (uint i= 0; i <= 1; i++)
{
bool needs_quotes;
@@ -1396,7 +1395,7 @@ prepare_for_next_key_part:
tmp.c_ptr_quick()));
}
}
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
if (both_not_null)
if (tmp.append(STRING_WITH_LEN(") ")))
@@ -1411,7 +1410,7 @@ prepare_for_next_key_part:
DBUG_RETURN(0);
err:
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(1);
}
@@ -1978,7 +1977,7 @@ int ha_federatedx::write_row(uchar *buf)
String insert_field_value_string(insert_field_value_buffer,
sizeof(insert_field_value_buffer),
&my_charset_bin);
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->read_set);
DBUG_ENTER("ha_federatedx::write_row");
values_string.length(0);
@@ -2032,7 +2031,7 @@ int ha_federatedx::write_row(uchar *buf)
values_string.append(STRING_WITH_LEN(", "));
}
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
/*
if there were no fields, we don't want to add a closing paren
@@ -2354,7 +2353,7 @@ int ha_federatedx::update_row(const uchar *old_data, uchar *new_data)
else
{
/* otherwise = */
- my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= tmp_use_all_columns(table, &table->read_set);
bool needs_quote= (*field)->str_needs_quotes();
(*field)->val_str(&field_value);
if (needs_quote)
@@ -2363,7 +2362,7 @@ int ha_federatedx::update_row(const uchar *old_data, uchar *new_data)
if (needs_quote)
update_string.append(value_quote_char);
field_value.length(0);
- tmp_restore_column_map(table->read_set, old_map);
+ tmp_restore_column_map(&table->read_set, old_map);
}
update_string.append(STRING_WITH_LEN(", "));
}
@@ -2908,7 +2907,7 @@ int ha_federatedx::read_next(uchar *buf, FEDERATEDX_IO_RESULT *result)
DBUG_RETURN(retval);
/* Fetch a row, insert it back in a row format. */
- if (!(row= io->fetch_row(result)))
+ if (!(row= io->fetch_row(result, &current)))
DBUG_RETURN(HA_ERR_END_OF_FILE);
if (!(retval= convert_row_to_internal_format(buf, row, result)))
@@ -2952,7 +2951,7 @@ void ha_federatedx::position(const uchar *record __attribute__ ((unused)))
if (txn->acquire(share, ha_thd(), TRUE, &io))
DBUG_VOID_RETURN;
- io->mark_position(stored_result, ref);
+ io->mark_position(stored_result, ref, current);
position_called= TRUE;
diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h
index 56c34d9ef37..3d208d89074 100644
--- a/storage/federatedx/ha_federatedx.h
+++ b/storage/federatedx/ha_federatedx.h
@@ -129,6 +129,7 @@ typedef struct st_federatedx_share {
typedef struct st_federatedx_result FEDERATEDX_IO_RESULT;
typedef struct st_federatedx_row FEDERATEDX_IO_ROW;
+typedef struct st_federatedx_rows FEDERATEDX_IO_ROWS;
typedef ptrdiff_t FEDERATEDX_IO_OFFSET;
class federatedx_io
@@ -203,7 +204,8 @@ public:
virtual void free_result(FEDERATEDX_IO_RESULT *io_result)=0;
virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result)=0;
virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result)=0;
- virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result)=0;
+ virtual FEDERATEDX_IO_ROW *fetch_row(FEDERATEDX_IO_RESULT *io_result,
+ FEDERATEDX_IO_ROWS **current= NULL)=0;
virtual ulong *fetch_lengths(FEDERATEDX_IO_RESULT *io_result)=0;
virtual const char *get_column_data(FEDERATEDX_IO_ROW *row,
unsigned int column)=0;
@@ -212,7 +214,7 @@ public:
virtual size_t get_ref_length() const=0;
virtual void mark_position(FEDERATEDX_IO_RESULT *io_result,
- void *ref)=0;
+ void *ref, FEDERATEDX_IO_ROWS *current)=0;
virtual int seek_position(FEDERATEDX_IO_RESULT **io_result,
const void *ref)=0;
virtual void set_thd(void *thd) { }
@@ -265,6 +267,7 @@ class ha_federatedx: public handler
federatedx_txn *txn;
federatedx_io *io;
FEDERATEDX_IO_RESULT *stored_result;
+ FEDERATEDX_IO_ROWS *current;
/**
Array of all stored results we get during a query execution.
*/
diff --git a/storage/innobase/.clang-format b/storage/innobase/.clang-format-old
index 54f7b47bc88..54f7b47bc88 100644
--- a/storage/innobase/.clang-format
+++ b/storage/innobase/.clang-format-old
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 511ac66d58c..f7fe4413086 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -4519,6 +4519,18 @@ btr_index_rec_validate(
rec_get_nth_field_offs(offsets, i, &len);
+ if (rec_offs_nth_extern(offsets, i)) {
+
+ const byte* data = rec_get_nth_field(
+ rec, offsets, i, &len);
+ len -= BTR_EXTERN_FIELD_REF_SIZE;
+ ulint extern_len = mach_read_from_4(
+ data + len + BTR_EXTERN_LEN + 4);
+ if (fixed_size == extern_len) {
+ continue;
+ }
+ }
+
/* Note that if fixed_size != 0, it equals the
length of a fixed-size column in the clustered index.
We should adjust it here.
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 7fd34c5d652..8f2acdb35bd 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3,7 +3,7 @@
Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -67,6 +67,9 @@ Created 10/16/1994 Heikki Tuuri
#include "srv0start.h"
#include "mysql_com.h"
#include "dict0stats.h"
+#ifdef WITH_WSREP
+#include "mysql/service_wsrep.h"
+#endif /* WITH_WSREP */
/** Buffered B-tree operation types, introduced as part of delete buffering. */
enum btr_op_t {
@@ -834,7 +837,6 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
TABLE_STATS_NAME)
|| !strcmp(index->table->name.m_name,
INDEX_STATS_NAME))) {
- ut_ad(!strcmp(field->name, "table_name"));
/* Interpret "table_name" as VARCHAR(199) even
if it was incorrectly defined as VARCHAR(64).
While the caller of ha_innobase enforces the
@@ -2941,7 +2943,8 @@ btr_cur_ins_lock_and_undo(
/* Check if there is predicate or GAP lock preventing the insertion */
if (!(flags & BTR_NO_LOCKING_FLAG)) {
- if (dict_index_is_spatial(index)) {
+ const unsigned type = index->type;
+ if (UNIV_UNLIKELY(type & DICT_SPATIAL)) {
lock_prdt_t prdt;
rtr_mbr_t mbr;
@@ -2958,9 +2961,30 @@ btr_cur_ins_lock_and_undo(
index, thr, mtr, &prdt);
*inherit = false;
} else {
+#ifdef WITH_WSREP
+ trx_t* trx= thr_get_trx(thr);
+ /* If transaction scanning an unique secondary
+ key is wsrep high priority thread (brute
+ force) this scanning may involve GAP-locking
+ in the index. As this locking happens also
+ when applying replication events in high
+ priority applier threads, there is a
+ probability for lock conflicts between two
+ wsrep high priority threads. To avoid this
+ GAP-locking we mark that this transaction
+ is using unique key scan here. */
+ if ((type & (DICT_CLUSTERED | DICT_UNIQUE)) == DICT_UNIQUE
+ && trx->is_wsrep()
+ && wsrep_thd_is_BF(trx->mysql_thd, false)) {
+ trx->wsrep_UK_scan= true;
+ }
+#endif /* WITH_WSREP */
err = lock_rec_insert_check_and_lock(
flags, rec, btr_cur_get_block(cursor),
index, thr, mtr, inherit);
+#ifdef WITH_WSREP
+ trx->wsrep_UK_scan= false;
+#endif /* WITH_WSREP */
}
}
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 79e6326ac1c..7b80d22c778 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2017, 2020, MariaDB Corporation.
+Copyright (c) 2017, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -624,6 +624,12 @@ btr_search_update_hash_ref(
return;
}
+ if (cursor->index != index) {
+ ut_ad(cursor->index->id == index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_ad(block->page.id.space() == index->space);
ut_a(index == cursor->index);
ut_ad(!dict_index_is_ibuf(index));
@@ -1139,18 +1145,28 @@ retry:
% btr_ahi_parts;
latch = btr_search_latches[ahi_slot];
+ dict_index_t* index = block->index;
ut_ad(!btr_search_own_any(RW_LOCK_S));
ut_ad(!btr_search_own_any(RW_LOCK_X));
- rw_lock_s_lock(latch);
+ bool is_freed = index && index->freed();
+ if (is_freed) {
+ rw_lock_x_lock(latch);
+ } else {
+ rw_lock_s_lock(latch);
+ }
+
assert_block_ahi_valid(block);
- if (!block->index || !btr_search_enabled) {
- rw_lock_s_unlock(latch);
+ if (!index || !btr_search_enabled) {
+ if (is_freed) {
+ rw_lock_x_unlock(latch);
+ } else {
+ rw_lock_s_unlock(latch);
+ }
return;
}
- dict_index_t* index = block->index;
#ifdef MYSQL_INDEX_DISABLE_AHI
ut_ad(!index->disable_ahi);
#endif
@@ -1167,7 +1183,9 @@ retry:
/* NOTE: The AHI fields of block must not be accessed after
releasing search latch, as the index page might only be s-latched! */
- rw_lock_s_unlock(latch);
+ if (!is_freed) {
+ rw_lock_s_unlock(latch);
+ }
ut_a(n_fields > 0 || n_bytes > 0);
@@ -1215,16 +1233,18 @@ next_rec:
mem_heap_free(heap);
}
- rw_lock_x_lock(latch);
+ if (!is_freed) {
+ rw_lock_x_lock(latch);
- if (UNIV_UNLIKELY(!block->index)) {
- /* Someone else has meanwhile dropped the hash index */
+ if (UNIV_UNLIKELY(!block->index)) {
+ /* Someone else has meanwhile dropped the
+ hash index */
+ goto cleanup;
+ }
- goto cleanup;
+ ut_a(block->index == index);
}
- ut_a(block->index == index);
-
if (block->curr_n_fields != n_fields
|| block->curr_n_bytes != n_bytes) {
@@ -1544,19 +1564,25 @@ btr_search_move_or_delete_hash_entries(
rw_lock_s_lock(latch);
ut_a(!new_block->index || new_block->index == index);
- ut_a(!block->index || block->index == index);
+ ut_a(!block->index || block->index->id == index->id);
ut_ad(!(new_block->index || block->index)
|| !dict_index_is_ibuf(index));
assert_block_ahi_valid(block);
assert_block_ahi_valid(new_block);
if (new_block->index) {
+drop_exit:
rw_lock_s_unlock(latch);
btr_search_drop_page_hash_index(block);
return;
}
if (block->index) {
+
+ if (block->index != index) {
+ goto drop_exit;
+ }
+
ulint n_fields = block->curr_n_fields;
ulint n_bytes = block->curr_n_bytes;
ibool left_side = block->curr_left_side;
@@ -1576,7 +1602,6 @@ btr_search_move_or_delete_hash_entries(
ut_ad(left_side == block->curr_left_side);
return;
}
-
rw_lock_s_unlock(latch);
}
@@ -1616,6 +1641,12 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
return;
}
+ if (index != cursor->index) {
+ ut_ad(index->id == cursor->index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_ad(block->page.id.space() == index->space);
ut_a(index == cursor->index);
ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0);
@@ -1688,6 +1719,12 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor)
return;
}
+ if (cursor->index != index) {
+ ut_ad(cursor->index->id == index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_a(cursor->index == index);
ut_ad(!dict_index_is_ibuf(index));
@@ -1774,6 +1811,12 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
#ifdef MYSQL_INDEX_DISABLE_AHI
ut_a(!index->disable_ahi);
#endif
+ if (index != cursor->index) {
+ ut_ad(index->id == cursor->index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_a(index == cursor->index);
ut_ad(!dict_index_is_ibuf(index));
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index e2b68011077..9f3d743ada1 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -4601,7 +4601,7 @@ evict_from_pool:
if (!access_time && !recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page(
- block, page_id, &page_size, TRUE);
+ block, page_id, page_size);
}
buf_pool_mutex_enter(buf_pool);
@@ -5511,6 +5511,7 @@ loop:
&& !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
ut_d(block->page.file_page_was_freed = FALSE);
buf_page_state page_state = buf_block_get_state(block);
+ bool have_x_latch = false;
#ifdef BTR_CUR_HASH_ADAPT
const dict_index_t *drop_hash_entry= NULL;
#endif
@@ -5563,26 +5564,26 @@ loop:
free_block = NULL;
break;
case BUF_BLOCK_FILE_PAGE:
- buf_block_fix(block);
- const int32_t num_fix_count =
- mtr->get_fix_count(block) + 1;
- buf_page_mutex_enter(block);
- while (buf_block_get_io_fix(block) != BUF_IO_NONE
- || (num_fix_count
- != block->page.buf_fix_count)) {
- buf_page_mutex_exit(block);
- buf_pool_mutex_exit(buf_pool);
- rw_lock_x_unlock(hash_lock);
-
- os_thread_yield();
-
- buf_pool_mutex_enter(buf_pool);
- rw_lock_x_lock(hash_lock);
+ have_x_latch = mtr->have_x_latch(*block);
+ if (!have_x_latch) {
+ buf_block_fix(block);
buf_page_mutex_enter(block);
+ while (buf_block_get_io_fix(block)
+ != BUF_IO_NONE
+ || block->page.buf_fix_count != 1) {
+ buf_page_mutex_exit(block);
+ buf_pool_mutex_exit(buf_pool);
+ rw_lock_x_unlock(hash_lock);
+
+ os_thread_sleep(1000);
+
+ buf_pool_mutex_enter(buf_pool);
+ rw_lock_x_lock(hash_lock);
+ buf_page_mutex_enter(block);
+ }
+ rw_lock_x_lock(&block->lock);
+ buf_page_mutex_exit(block);
}
-
- rw_lock_x_lock(&block->lock);
- buf_page_mutex_exit(block);
#ifdef BTR_CUR_HASH_ADAPT
drop_hash_entry = block->index;
#endif
@@ -5601,16 +5602,17 @@ loop:
}
#endif /* BTR_CUR_HASH_ADAPT */
+ if (!have_x_latch) {
#ifdef UNIV_DEBUG
- if (!fsp_is_system_temporary(page_id.space())) {
- rw_lock_s_lock_nowait(
- &block->debug_latch,
- __FILE__, __LINE__);
- }
+ if (!fsp_is_system_temporary(page_id.space())) {
+ rw_lock_s_lock_nowait(
+ &block->debug_latch,
+ __FILE__, __LINE__);
+ }
#endif /* UNIV_DEBUG */
- mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX);
-
+ mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX);
+ }
return block;
}
@@ -5678,7 +5680,7 @@ loop:
/* Delete possible entries for the page from the insert buffer:
such can exist if the page belonged to an index which was dropped */
if (!recv_recovery_is_on()) {
- ibuf_merge_or_delete_for_page(NULL, page_id, &page_size, TRUE);
+ ibuf_merge_or_delete_for_page(NULL, page_id, page_size);
}
frame = block->frame;
@@ -6133,7 +6135,7 @@ database_corrupted:
ibuf_merge_or_delete_for_page(
(buf_block_t*) bpage, bpage->id,
- &bpage->size, TRUE);
+ bpage->size);
}
fil_space_release_for_io(space);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index e3ce13b5b27..6f546dfbd94 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -2215,6 +2215,7 @@ dict_index_remove_from_cache_low(
if (index->online_log) {
ut_ad(index->online_status == ONLINE_INDEX_CREATION);
row_log_free(index->online_log);
+ index->online_log = NULL;
}
/* Remove the index from the list of indexes of the table */
@@ -6707,144 +6708,6 @@ dict_sys_get_size()
return size;
}
-/** Look for any dictionary objects that are found in the given tablespace.
-@param[in] space_id Tablespace ID to search for.
-@return true if tablespace is empty. */
-bool
-dict_space_is_empty(
- ulint space_id)
-{
- btr_pcur_t pcur;
- const rec_t* rec;
- mtr_t mtr;
- bool found = false;
-
- rw_lock_x_lock(&dict_operation_lock);
- mutex_enter(&dict_sys->mutex);
- mtr_start(&mtr);
-
- for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
- rec != NULL;
- rec = dict_getnext_system(&pcur, &mtr)) {
- const byte* field;
- ulint len;
- ulint space_id_for_table;
-
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__SPACE, &len);
- ut_ad(len == 4);
- space_id_for_table = mach_read_from_4(field);
-
- if (space_id_for_table == space_id) {
- found = true;
- }
- }
-
- mtr_commit(&mtr);
- mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(&dict_operation_lock);
-
- return(!found);
-}
-
-/** Find the space_id for the given name in sys_tablespaces.
-@param[in] name Tablespace name to search for.
-@return the tablespace ID. */
-ulint
-dict_space_get_id(
- const char* name)
-{
- btr_pcur_t pcur;
- const rec_t* rec;
- mtr_t mtr;
- ulint name_len = strlen(name);
- ulint id = ULINT_UNDEFINED;
-
- rw_lock_x_lock(&dict_operation_lock);
- mutex_enter(&dict_sys->mutex);
- mtr_start(&mtr);
-
- for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLESPACES);
- rec != NULL;
- rec = dict_getnext_system(&pcur, &mtr)) {
- const byte* field;
- ulint len;
-
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLESPACES__NAME, &len);
- ut_ad(len > 0);
- ut_ad(len < OS_FILE_MAX_PATH);
-
- if (len == name_len && ut_memcmp(name, field, len) == 0) {
-
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLESPACES__SPACE, &len);
- ut_ad(len == 4);
- id = mach_read_from_4(field);
-
- /* This is normally called by dict_getnext_system()
- at the end of the index. */
- btr_pcur_close(&pcur);
- break;
- }
- }
-
- mtr_commit(&mtr);
- mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(&dict_operation_lock);
-
- return(id);
-}
-
-/** Determine the extent size (in pages) for the given table
-@param[in] table the table whose extent size is being
- calculated.
-@return extent size in pages (256, 128 or 64) */
-ulint
-dict_table_extent_size(
- const dict_table_t* table)
-{
- const ulint mb_1 = 1024 * 1024;
- const ulint mb_2 = 2 * mb_1;
- const ulint mb_4 = 4 * mb_1;
-
- page_size_t page_size = dict_table_page_size(table);
- ulint pages_in_extent = FSP_EXTENT_SIZE;
-
- if (page_size.is_compressed()) {
-
- ulint disk_page_size = page_size.physical();
-
- switch (disk_page_size) {
- case 1024:
- pages_in_extent = mb_1/1024;
- break;
- case 2048:
- pages_in_extent = mb_1/2048;
- break;
- case 4096:
- pages_in_extent = mb_1/4096;
- break;
- case 8192:
- pages_in_extent = mb_1/8192;
- break;
- case 16384:
- pages_in_extent = mb_1/16384;
- break;
- case 32768:
- pages_in_extent = mb_2/32768;
- break;
- case 65536:
- pages_in_extent = mb_4/65536;
- break;
- default:
- ut_ad(0);
- }
- }
-
- return(pages_in_extent);
-}
-
size_t
dict_table_t::get_overflow_field_local_len() const
{
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index f8a4cebfb16..1611703c2e9 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -178,8 +178,8 @@ dict_stats_persistent_storage_check(
{"table_name", DATA_VARMYSQL,
DATA_NOT_NULL, 597},
- {"last_update", DATA_FIXBINARY,
- DATA_NOT_NULL, 4},
+ {"last_update", DATA_INT,
+ DATA_NOT_NULL | DATA_UNSIGNED, 4},
{"n_rows", DATA_INT,
DATA_NOT_NULL | DATA_UNSIGNED, 8},
@@ -209,8 +209,8 @@ dict_stats_persistent_storage_check(
{"index_name", DATA_VARMYSQL,
DATA_NOT_NULL, 192},
- {"last_update", DATA_FIXBINARY,
- DATA_NOT_NULL, 4},
+ {"last_update", DATA_INT,
+ DATA_NOT_NULL | DATA_UNSIGNED, 4},
{"stat_name", DATA_VARMYSQL,
DATA_NOT_NULL, 64*3},
@@ -1985,7 +1985,7 @@ static index_stats_t dict_stats_analyze_index(dict_index_t* index)
since it will be faster and will give better results. */
if (root_level == 0
- || N_SAMPLE_PAGES(index) * n_uniq > index->stat_n_leaf_pages) {
+ || N_SAMPLE_PAGES(index) * n_uniq > result.n_leaf_pages) {
if (root_level == 0) {
DEBUG_PRINTF(" %s(): just one page,"
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 328cd104e5d..659cfa26033 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -566,6 +566,10 @@ bool fil_node_t::read_page0(bool first)
this->size = ulint(size_bytes / psize);
space->committed_size = space->size += this->size;
+
+ if (block_size == 0) {
+ block_size = os_file_get_block_size(handle, name);
+ }
} else if (space->id != TRX_SYS_SPACE || space->size_in_header) {
/* If this is not the first-time open, do nothing.
For the system tablespace, we always get invoked as
@@ -605,12 +609,15 @@ static bool fil_node_open_file(fil_node_t* node)
const bool first_time_open = node->size == 0;
- bool o_direct_possible = !FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
- if (const ulint ssize = FSP_FLAGS_GET_ZIP_SSIZE(space->flags)) {
- compile_time_assert(((UNIV_ZIP_SIZE_MIN >> 1) << 3) == 4096);
- if (ssize < 3) {
- o_direct_possible = false;
- }
+ ulint type;
+ compile_time_assert(((UNIV_ZIP_SIZE_MIN >> 1) << 3) == 4096);
+ switch (FSP_FLAGS_GET_ZIP_SSIZE(space->flags)) {
+ case 1:
+ case 2:
+ type = OS_DATA_FILE_NO_O_DIRECT;
+ break;
+ default:
+ type = OS_DATA_FILE;
}
if (first_time_open
@@ -632,9 +639,7 @@ retry:
? OS_FILE_OPEN_RAW | OS_FILE_ON_ERROR_NO_EXIT
: OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_AIO,
- o_direct_possible
- ? OS_DATA_FILE
- : OS_DATA_FILE_NO_O_DIRECT,
+ type,
read_only_mode,
&success);
@@ -668,9 +673,7 @@ retry:
? OS_FILE_OPEN_RAW | OS_FILE_ON_ERROR_NO_EXIT
: OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_AIO,
- o_direct_possible
- ? OS_DATA_FILE
- : OS_DATA_FILE_NO_O_DIRECT,
+ type,
read_only_mode,
&success);
}
@@ -1038,15 +1041,14 @@ fil_space_extend_must_retry(
}
-/*******************************************************************//**
-Reserves the fil_system mutex and tries to make sure we can open at least one
+/** Reserves the fil_system mutex and tries to make sure we can open at least one
file while holding it. This should be called before calling
-fil_node_prepare_for_io(), because that function may need to open a file. */
+fil_node_prepare_for_io(), because that function may need to open a file.
+@param[in] space_id tablespace id
+@return whether the tablespace is usable for io */
static
-void
-fil_mutex_enter_and_prepare_for_io(
-/*===============================*/
- ulint space_id) /*!< in: space id */
+bool
+fil_mutex_enter_and_prepare_for_io(ulint space_id)
{
for (ulint count = 0;;) {
mutex_enter(&fil_system->mutex);
@@ -1059,7 +1061,7 @@ fil_mutex_enter_and_prepare_for_io(
fil_space_t* space = fil_space_get_by_id(space_id);
if (space == NULL) {
- break;
+ return false;
}
fil_node_t* node = UT_LIST_GET_LAST(space->chain);
@@ -1074,6 +1076,10 @@ fil_mutex_enter_and_prepare_for_io(
the insert buffer. The insert buffer is in
tablespace 0, and we cannot end up waiting in
this function. */
+ } else if (space->is_stopping() && !space->is_being_truncated) {
+ /* If the tablespace is being deleted then InnoDB
+ shouldn't prepare the tablespace for i/o */
+ return false;
} else if (!node || node->is_open()) {
/* If the file is already open, no need to do
anything; if the space does not exist, we handle the
@@ -1144,6 +1150,8 @@ fil_mutex_enter_and_prepare_for_io(
break;
}
+
+ return true;
}
/** Try to extend a tablespace if it is smaller than the specified size.
@@ -1160,7 +1168,10 @@ fil_space_extend(
bool success;
do {
- fil_mutex_enter_and_prepare_for_io(space->id);
+ if (!fil_mutex_enter_and_prepare_for_io(space->id)) {
+ success = false;
+ break;
+ }
} while (fil_space_extend_must_retry(
space, UT_LIST_GET_LAST(space->chain), size,
&success));
@@ -1537,7 +1548,9 @@ fil_space_t* fil_system_t::read_page0(ulint id)
/* It is possible that the tablespace is dropped while we are
not holding the mutex. */
- fil_mutex_enter_and_prepare_for_io(id);
+ if (!fil_mutex_enter_and_prepare_for_io(id)) {
+ return NULL;
+ }
fil_space_t* space = fil_space_get_by_id(id);
@@ -1610,14 +1623,16 @@ fil_space_get_first_path(
ut_ad(fil_system);
ut_a(id);
- fil_mutex_enter_and_prepare_for_io(id);
+ if (!fil_mutex_enter_and_prepare_for_io(id)) {
+fail_exit:
+ mutex_exit(&fil_system->mutex);
+ return(NULL);
+ }
space = fil_space_get_space(id);
if (space == NULL) {
- mutex_exit(&fil_system->mutex);
-
- return(NULL);
+ goto fail_exit;
}
ut_ad(mutex_own(&fil_system->mutex));
@@ -3492,7 +3507,6 @@ func_exit:
ut_ad(strchr(new_file_name, OS_PATH_SEPARATOR) != NULL);
if (!recv_recovery_is_on()) {
- fil_name_write_rename(id, old_file_name, new_file_name);
log_mutex_enter();
}
@@ -3590,11 +3604,22 @@ fil_ibd_create(
return(err);
}
+ ulint type;
+ compile_time_assert(((UNIV_ZIP_SIZE_MIN >> 1) << 3) == 4096);
+ switch (FSP_FLAGS_GET_ZIP_SSIZE(flags)) {
+ case 1:
+ case 2:
+ type = OS_DATA_FILE_NO_O_DIRECT;
+ break;
+ default:
+ type = OS_DATA_FILE;
+ }
+
file = os_file_create(
innodb_data_file_key, path,
OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_NORMAL,
- OS_DATA_FILE,
+ type,
srv_read_only_mode,
&success);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index fb06d300803..1bdfbddca04 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1709,7 +1709,7 @@ fts_drop_tables(
error = fts_drop_common_tables(trx, &fts_table);
- if (error == DB_SUCCESS) {
+ if (error == DB_SUCCESS && table->fts) {
error = fts_drop_all_index_tables(trx, table->fts);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 0617005a213..fc876e6f753 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4,7 +4,7 @@ Copyright (c) 2000, 2020, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -60,6 +60,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include <my_service_manager.h>
#include <key.h>
+#include <sql_manager.h>
/* Include necessary InnoDB headers */
#include "btr0btr.h"
@@ -167,11 +168,8 @@ wsrep_ws_handle(THD* thd, const trx_t* trx) {
extern TC_LOG* tc_log;
extern void wsrep_cleanup_transaction(THD *thd);
-static int
-wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
- my_bool signal);
-static void
-wsrep_fake_trx_id(handlerton* hton, THD *thd);
+static void wsrep_abort_transaction(handlerton*, THD *, THD *, my_bool);
+static void wsrep_fake_trx_id(handlerton* hton, THD *thd);
static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
#endif /* WITH_WSREP */
@@ -238,7 +236,6 @@ static char* innobase_server_stopword_table;
values */
static my_bool innobase_file_format_check;
-static my_bool innobase_use_atomic_writes;
static my_bool innobase_use_fallocate;
static my_bool innobase_use_doublewrite;
static my_bool innobase_use_checksums;
@@ -614,6 +611,7 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(ibuf_bitmap_mutex),
PSI_KEY(ibuf_mutex),
PSI_KEY(ibuf_pessimistic_insert_mutex),
+ PSI_KEY(index_online_log),
PSI_KEY(log_sys_mutex),
PSI_KEY(log_sys_write_mutex),
PSI_KEY(mutex_list_mutex),
@@ -671,7 +669,6 @@ static PSI_rwlock_info all_innodb_rwlocks[] = {
PSI_RWLOCK_KEY(trx_i_s_cache_lock),
PSI_RWLOCK_KEY(trx_purge_latch),
PSI_RWLOCK_KEY(index_tree_rw_lock),
- PSI_RWLOCK_KEY(index_online_log),
PSI_RWLOCK_KEY(hash_table_locks)
};
# endif /* UNIV_PFS_RWLOCK */
@@ -2558,6 +2555,72 @@ innobase_raw_format(
return(ut_str_sql_format(buf_tmp, buf_tmp_used, buf, buf_size));
}
+/*
+The helper function nlz(x) calculates the number of leading zeros
+in the binary representation of the number "x", either using a
+built-in compiler function or a substitute trick based on the use
+of the multiplication operation and a table indexed by the prefix
+of the multiplication result:
+*/
+#ifdef __GNUC__
+#define nlz(x) __builtin_clzll(x)
+#elif defined(_MSC_VER) && !defined(_M_CEE_PURE) && \
+ (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))
+#ifndef __INTRIN_H_
+#pragma warning(push, 4)
+#pragma warning(disable: 4255 4668)
+#include <intrin.h>
+#pragma warning(pop)
+#endif
+__forceinline unsigned int nlz (ulonglong x)
+{
+#if defined(_M_IX86) || defined(_M_X64)
+ unsigned long n;
+#ifdef _M_X64
+ _BitScanReverse64(&n, x);
+ return (unsigned int) n ^ 63;
+#else
+ unsigned long y = (unsigned long) (x >> 32);
+ unsigned int m = 31;
+ if (y == 0)
+ {
+ y = (unsigned long) x;
+ m = 63;
+ }
+ _BitScanReverse(&n, y);
+ return (unsigned int) n ^ m;
+#endif
+#elif defined(_M_ARM64)
+ return _CountLeadingZeros(x);
+#endif
+}
+#else
+inline unsigned int nlz (ulonglong x)
+{
+ static unsigned char table [48] = {
+ 32, 6, 5, 0, 4, 12, 0, 20,
+ 15, 3, 11, 0, 0, 18, 25, 31,
+ 8, 14, 2, 0, 10, 0, 0, 0,
+ 0, 0, 0, 21, 0, 0, 19, 26,
+ 7, 0, 13, 0, 16, 1, 22, 27,
+ 9, 0, 17, 23, 28, 24, 29, 30
+ };
+ unsigned int y= (unsigned int) (x >> 32);
+ unsigned int n= 0;
+ if (y == 0) {
+ y= (unsigned int) x;
+ n= 32;
+ }
+ y = y | (y >> 1); // Propagate leftmost 1-bit to the right.
+ y = y | (y >> 2);
+ y = y | (y >> 4);
+ y = y | (y >> 8);
+ y = y & ~(y >> 16);
+ y = y * 0x3EF5D037;
+ return n + table[y >> 26];
+}
+#endif
+
/*********************************************************************//**
Compute the next autoinc value.
@@ -2586,85 +2649,93 @@ innobase_next_autoinc(
ulonglong max_value) /*!< in: max value for type */
{
ulonglong next_value;
- ulonglong block = need * step;
+ ulonglong block;
/* Should never be 0. */
ut_a(need > 0);
- ut_a(block > 0);
+ ut_a(step > 0);
ut_a(max_value > 0);
- /*
- Allow auto_increment to go over max_value up to max ulonglong.
- This allows us to detect that all values are exhausted.
- If we don't do this, we will return max_value several times
- and get duplicate key errors instead of auto increment value
- out of range.
- */
- max_value= (~(ulonglong) 0);
+ /*
+ We need to calculate the "block" value equal to the product
+ "step * need". However, when calculating this product, an integer
+ overflow can occur, so we cannot simply use the usual multiplication
+ operation. The snippet below calculates the product of two numbers
+ and detects an unsigned integer overflow:
+ */
+ unsigned int m= nlz(need);
+ unsigned int n= nlz(step);
+ if (m + n <= 8 * sizeof(ulonglong) - 2) {
+ // The bit width of the original values is too large,
+ // therefore we are guaranteed to get an overflow.
+ goto overflow;
+ }
+ block = need * (step >> 1);
+ if ((longlong) block < 0) {
+ goto overflow;
+ }
+ block += block;
+ if (step & 1) {
+ block += need;
+ if (block < need) {
+ goto overflow;
+ }
+ }
+
+ /* Check for overflow. Current can be > max_value if the value
+ is in reality a negative value. Also, the visual studio compiler
+ converts large double values (which hypothetically can then be
+ passed here as the values of the "current" parameter) automatically
+ into unsigned long long datatype maximum value: */
+ if (current > max_value) {
+ goto overflow;
+ }
/* According to MySQL documentation, if the offset is greater than
the step then the offset is ignored. */
- if (offset > block) {
+ if (offset > step) {
offset = 0;
}
- /* Check for overflow. Current can be > max_value if the value is
- in reality a negative value.The visual studio compilers converts
- large double values automatically into unsigned long long datatype
- maximum value */
-
- if (block >= max_value
- || offset > max_value
- || current >= max_value
- || max_value - offset <= offset) {
-
- next_value = max_value;
+ /*
+ Let's round the current value to within a step-size block:
+ */
+ if (current > offset) {
+ next_value = current - offset;
} else {
- ut_a(max_value > current);
-
- ulonglong free = max_value - current;
-
- if (free < offset || free - offset <= block) {
- next_value = max_value;
- } else {
- next_value = 0;
- }
+ next_value = offset - current;
}
+ next_value -= next_value % step;
- if (next_value == 0) {
- ulonglong next;
-
- if (current > offset) {
- next = (current - offset) / step;
- } else {
- next = (offset - current) / step;
- }
-
- ut_a(max_value > next);
- next_value = next * step;
- /* Check for multiplication overflow. */
- ut_a(next_value >= next);
- ut_a(max_value > next_value);
-
- /* Check for overflow */
- if (max_value - next_value >= block) {
-
- next_value += block;
-
- if (max_value - next_value >= offset) {
- next_value += offset;
- } else {
- next_value = max_value;
- }
- } else {
- next_value = max_value;
- }
+ /*
+ Add an offset to the next value and check that the addition
+ does not cause an integer overflow:
+ */
+ next_value += offset;
+ if (next_value < offset) {
+ goto overflow;
}
- ut_a(next_value != 0);
- ut_a(next_value <= max_value);
+ /*
+ Add a block to the next value and check that the addition
+ does not cause an integer overflow:
+ */
+ next_value += block;
+ if (next_value < block) {
+ goto overflow;
+ }
return(next_value);
+
+overflow:
+ /*
+ Allow auto_increment to go over max_value up to max ulonglong.
+ This allows us to detect that all values are exhausted.
+ If we don't do this, we will return max_value several times
+ and get duplicate key errors instead of auto increment value
+ out of range:
+ */
+ return(~(ulonglong) 0);
}
/********************************************************************//**
@@ -3544,11 +3615,12 @@ ha_innobase::init_table_handle_for_HANDLER(void)
reset_template();
}
-/** Free tablespace resources allocated. */
-void innobase_space_shutdown()
+/*********************************************************************//**
+Free any resources that were allocated and return failure.
+@return always return 1 */
+static int innobase_init_abort()
{
- DBUG_ENTER("innobase_space_shutdown");
-
+ DBUG_ENTER("innobase_init_abort");
srv_sys_space.shutdown();
if (srv_tmp_space.get_sanity_check_status()) {
fil_space_close(srv_tmp_space.name());
@@ -3559,20 +3631,6 @@ void innobase_space_shutdown()
#ifdef WITH_INNODB_DISALLOW_WRITES
os_event_destroy(srv_allow_writes_event);
#endif /* WITH_INNODB_DISALLOW_WRITES */
-
- DBUG_VOID_RETURN;
-}
-
-/*********************************************************************//**
-Free any resources that were allocated and return failure.
-@return always return 1 */
-static
-int
-innobase_init_abort()
-/*=================*/
-{
- DBUG_ENTER("innobase_init_abort");
- innobase_space_shutdown();
DBUG_RETURN(1);
}
@@ -3624,7 +3682,12 @@ static const char* deprecated_mtflush_threads
" and the parameter will be removed in MariaDB 10.3."
" Use innodb-page-cleaners instead. ";
+/** Deprecation message about innodb_idle_flush_pct */
+static const char* deprecated_idle_flush_pct
+ = "innodb_idle_flush_pct is DEPRECATED and has no effect.";
+
static my_bool innodb_instrument_semaphores;
+static ulong innodb_idle_flush_pct;
/** If applicable, emit a message that log checksums cannot be disabled.
@param[in,out] thd client session, or NULL if at startup
@@ -3712,7 +3775,8 @@ innobase_init(
innobase_hton->flush_logs = innobase_flush_logs;
innobase_hton->show_status = innobase_show_status;
innobase_hton->flags =
- HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS;
+ HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS |
+ HTON_REQUIRES_CLOSE_AFTER_TRUNCATE;
#ifdef WITH_WSREP
innobase_hton->abort_transaction=wsrep_abort_transaction;
@@ -4245,29 +4309,24 @@ innobase_change_buffering_inited_ok:
" It will be removed in MariaDB 10.3.";
}
- srv_use_atomic_writes
- = innobase_use_atomic_writes && my_may_have_atomic_write;
- if (srv_use_atomic_writes && !srv_file_per_table)
- {
- fprintf(stderr, "InnoDB: Disabling atomic_writes as file_per_table is not used.\n");
- srv_use_atomic_writes= 0;
- }
+ if (innodb_idle_flush_pct != 100) {
+ ib::warn() << deprecated_idle_flush_pct;
+ }
- if (srv_use_atomic_writes) {
- fprintf(stderr, "InnoDB: using atomic writes.\n");
+#ifndef _WIN32
+ if (srv_use_atomic_writes && my_may_have_atomic_write) {
/*
Force O_DIRECT on Unixes (on Windows writes are always
unbuffered)
*/
-#ifndef _WIN32
if (!innobase_file_flush_method ||
!strstr(innobase_file_flush_method, "O_DIRECT")) {
innobase_file_flush_method =
srv_file_flush_method_str = (char*)"O_DIRECT";
fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n");
}
-#endif
}
+#endif
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
@@ -4417,7 +4476,6 @@ innobase_end(handlerton*, ha_panic_function)
}
innodb_shutdown();
- innobase_space_shutdown();
mysql_mutex_destroy(&commit_cond_m);
mysql_cond_destroy(&commit_cond);
@@ -5131,6 +5189,7 @@ innobase_close_connection(
if (trx) {
+ thd_set_ha_data(thd, hton, NULL);
if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
sql_print_error("Transaction not registered for MariaDB 2PC, "
@@ -5190,38 +5249,15 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels)
if (trx_t* trx= thd_to_trx(thd))
{
+ ut_ad(trx->mysql_thd == thd);
lock_mutex_enter();
- trx_sys_mutex_enter();
- trx_mutex_enter(trx);
- /* It is possible that innobase_close_connection() is concurrently
- being executed on our victim. In that case, trx->mysql_thd would
- be reset before invoking trx_t::free(). Even if the trx object is later
- reused for another client connection or a background transaction,
- its trx->mysql_thd will differ from our thd.
-
- If trx never performed any changes, nothing is really protecting
- the trx_t::free() call or the changes of trx_t::state when the
- transaction is being rolled back and trx_commit_low() is being
- executed.
-
- The function trx_allocate_for_mysql() acquires
- trx_sys_t::mutex, but trx_allocate_for_background() will not.
- Luckily, background transactions cannot be read-only, because
- for read-only transactions, trx_start_low() will avoid acquiring
- any of the trx_sys_t::mutex, lock_sys_t::mutex, trx_t::mutex before
- assigning trx_t::state.
-
- At this point, trx may have been reallocated for another client
- connection, or for a background operation. In that case, either
- trx_t::state or trx_t::mysql_thd should not match our expectations. */
- bool cancel= trx->mysql_thd == thd && trx->state == TRX_STATE_ACTIVE &&
- !trx->lock.was_chosen_as_deadlock_victim;
- trx_sys_mutex_exit();
- if (!cancel);
- else if (lock_t *lock= trx->lock.wait_lock)
+ if (lock_t *lock= trx->lock.wait_lock)
+ {
+ trx_mutex_enter(trx);
lock_cancel_waiting_and_release(lock);
+ trx_mutex_exit(trx);
+ }
lock_mutex_exit();
- trx_mutex_exit(trx);
}
DBUG_VOID_RETURN;
@@ -6684,8 +6720,8 @@ wsrep_innobase_mysql_sort(
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_VARCHAR:
{
- uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
- uint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN;
+ uchar *tmp_str;
+ uint tmp_length;
/* Use the charset number to pick the right charset struct for
the comparison. Since the MySQL function get_charset may be
@@ -6708,7 +6744,11 @@ wsrep_innobase_mysql_sort(
}
}
- ut_a(str_length <= tmp_length);
+ // Note that strnxfrm may change length of string
+ tmp_length= charset->coll->strnxfrmlen(charset, str_length);
+ tmp_length= ut_max(str_length, tmp_length) + 1;
+ tmp_str= static_cast<uchar *>(ut_malloc_nokey(tmp_length));
+ ut_ad(str_length <= tmp_length);
memcpy(tmp_str, str, str_length);
tmp_length = charset->coll->strnxfrm(charset, str, str_length,
@@ -6732,6 +6772,7 @@ wsrep_innobase_mysql_sort(
ret_length = tmp_length;
}
+ ut_free(tmp_str);
break;
}
case MYSQL_TYPE_DECIMAL :
@@ -7083,7 +7124,7 @@ wsrep_store_key_val_for_row(
THD* thd,
TABLE* table,
uint keynr, /*!< in: key number */
- char* buff, /*!< in/out: buffer for the key value (in MySQL
+ uchar* buff, /*!< in/out: buffer for the key value (in MySQL
format) */
uint buff_len,/*!< in: buffer length */
const uchar* record,
@@ -7092,7 +7133,7 @@ wsrep_store_key_val_for_row(
KEY* key_info = table->key_info + keynr;
KEY_PART_INFO* key_part = key_info->key_part;
KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
- char* buff_start = buff;
+ uchar* buff_start = buff;
enum_field_types mysql_type;
Field* field;
uint buff_space = buff_len;
@@ -7104,7 +7145,8 @@ wsrep_store_key_val_for_row(
for (; key_part != end; key_part++) {
- uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
+ uchar *sorted=NULL;
+ uint max_len=0;
ibool part_is_null = FALSE;
if (key_part->null_bit) {
@@ -7183,10 +7225,14 @@ wsrep_store_key_val_for_row(
true_len = key_len;
}
+ max_len= true_len;
+ sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
memcpy(sorted, data, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
- REC_VERSION_56_MAX_INDEX_COL_LEN);
+ max_len);
+ ut_ad(true_len <= max_len);
+
if (wsrep_protocol_version > 1) {
/* Note that we always reserve the maximum possible
length of the true VARCHAR in the key value, though
@@ -7271,11 +7317,13 @@ wsrep_store_key_val_for_row(
true_len = key_len;
}
+ max_len= true_len;
+ sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
memcpy(sorted, blob_data, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
- REC_VERSION_56_MAX_INDEX_COL_LEN);
-
+ max_len);
+ ut_ad(true_len <= max_len);
/* Note that we always reserve the maximum possible
length of the BLOB prefix in the key value. */
@@ -7351,10 +7399,14 @@ wsrep_store_key_val_for_row(
cs->mbmaxlen),
&error);
}
+
+ max_len= true_len;
+ sorted= static_cast<uchar *>(ut_malloc_nokey(max_len+1));
memcpy(sorted, src_start, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
- REC_VERSION_56_MAX_INDEX_COL_LEN);
+ max_len);
+ ut_ad(true_len <= max_len);
if (true_len > buff_space) {
fprintf (stderr,
@@ -7369,6 +7421,11 @@ wsrep_store_key_val_for_row(
buff += true_len;
buff_space -= true_len;
}
+
+ if (sorted) {
+ ut_free(sorted);
+ sorted= NULL;
+ }
}
ut_a(buff <= buff_start + buff_len);
@@ -8197,7 +8254,6 @@ ha_innobase::write_row(
/* Handling of errors related to auto-increment. */
if (auto_inc_used) {
ulonglong auto_inc;
- ulonglong col_max_value;
/* Note the number of rows processed for this statement, used
by get_auto_increment() to determine the number of AUTO-INC
@@ -8207,11 +8263,6 @@ ha_innobase::write_row(
--trx->n_autoinc_rows;
}
- /* We need the upper limit of the col type to check for
- whether we update the table autoinc counter or not. */
- col_max_value =
- table->next_number_field->get_max_int_value();
-
/* Get the value that MySQL attempted to store in the table.*/
auto_inc = table->next_number_field->val_uint();
@@ -8278,38 +8329,25 @@ ha_innobase::write_row(
if (auto_inc >= m_prebuilt->autoinc_last_value) {
set_max_autoinc:
+ /* We need the upper limit of the col type to check for
+ whether we update the table autoinc counter or not. */
+ ulonglong col_max_value =
+ table->next_number_field->get_max_int_value();
+
/* This should filter out the negative
values set explicitly by the user. */
if (auto_inc <= col_max_value) {
+ ut_ad(m_prebuilt->autoinc_increment > 0);
ulonglong offset;
ulonglong increment;
dberr_t err;
-#ifdef WITH_WSREP
- /* Applier threads which are processing
- ROW events and don't go through server
- level autoinc processing, therefore
- m_prebuilt autoinc values don't get
- properly assigned. Fetch values from
- server side. */
- if (trx->is_wsrep() &&
- wsrep_thd_exec_mode(m_user_thd) == REPL_RECV)
- {
- wsrep_thd_auto_increment_variables(
- m_user_thd, &offset, &increment);
- }
- else
- {
-#endif /* WITH_WSREP */
- ut_a(m_prebuilt->autoinc_increment > 0);
- offset = m_prebuilt->autoinc_offset;
- increment = m_prebuilt->autoinc_increment;
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
+
+ offset = m_prebuilt->autoinc_offset;
+ increment = m_prebuilt->autoinc_increment;
+
auto_inc = innobase_next_autoinc(
- auto_inc,
- 1, increment, offset,
+ auto_inc, 1, increment, offset,
col_max_value);
err = innobase_set_max_autoinc(
@@ -8836,6 +8874,8 @@ wsrep_calc_row_hash(
for (uint i = 0; i < table->s->fields; i++) {
byte null_byte=0;
byte true_byte=1;
+ ulint col_type;
+ ulint is_unsigned;
const Field* field = table->field[i];
if (!field->stored_in_db()) {
@@ -8844,8 +8884,9 @@ wsrep_calc_row_hash(
ptr = (const byte*) row + get_field_offset(table, field);
len = field->pack_length();
+ col_type = get_innobase_type_from_mysql_type(&is_unsigned, field);
- switch (prebuilt->table->cols[i].mtype) {
+ switch (col_type) {
case DATA_BLOB:
ptr = row_mysql_read_blob_ref(&len, ptr, len);
@@ -8977,46 +9018,37 @@ ha_innobase::update_row(
/* A value for an AUTO_INCREMENT column
was specified in the UPDATE statement. */
- ulonglong offset;
- ulonglong increment;
-#ifdef WITH_WSREP
- /* Applier threads which are processing
- ROW events and don't go through server
- level autoinc processing, therefore
- m_prebuilt autoinc values don't get
- properly assigned. Fetch values from
- server side. */
- if (trx->is_wsrep() &&
- wsrep_thd_exec_mode(m_user_thd) == REPL_RECV)
- {
- wsrep_thd_auto_increment_variables(
- m_user_thd, &offset, &increment);
- }
- else
- {
-#endif /* WITH_WSREP */
- offset = m_prebuilt->autoinc_offset;
- increment = m_prebuilt->autoinc_increment;
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
-
- autoinc = innobase_next_autoinc(
- autoinc, 1, increment, offset,
- table->found_next_number_field->get_max_int_value());
-
- error = innobase_set_max_autoinc(autoinc);
-
- if (m_prebuilt->table->persistent_autoinc) {
- /* Update the PAGE_ROOT_AUTO_INC. Yes, we do
- this even if dict_table_t::autoinc already was
- greater than autoinc, because we cannot know
- if any INSERT actually used (and wrote to
- PAGE_ROOT_AUTO_INC) a value bigger than our
- autoinc. */
- btr_write_autoinc(dict_table_get_first_index(
- m_prebuilt->table),
- autoinc);
+ /* We need the upper limit of the col type to check for
+ whether we update the table autoinc counter or not. */
+ ulonglong col_max_value =
+ table->found_next_number_field->get_max_int_value();
+
+ /* This should filter out the negative
+ values set explicitly by the user. */
+ if (autoinc <= col_max_value) {
+ ulonglong offset;
+ ulonglong increment;
+
+ offset = m_prebuilt->autoinc_offset;
+ increment = m_prebuilt->autoinc_increment;
+
+ autoinc = innobase_next_autoinc(
+ autoinc, 1, increment, offset,
+ col_max_value);
+
+ error = innobase_set_max_autoinc(autoinc);
+
+ if (m_prebuilt->table->persistent_autoinc) {
+ /* Update the PAGE_ROOT_AUTO_INC. Yes, we do
+ this even if dict_table_t::autoinc already was
+ greater than autoinc, because we cannot know
+ if any INSERT actually used (and wrote to
+ PAGE_ROOT_AUTO_INC) a value bigger than our
+ autoinc. */
+ btr_write_autoinc(dict_table_get_first_index(
+ m_prebuilt->table),
+ autoinc);
+ }
}
}
@@ -10474,7 +10506,7 @@ wsrep_append_key(
trx_t *trx,
TABLE_SHARE *table_share,
TABLE *table,
- const char* key,
+ const uchar* key,
uint16_t key_len,
wsrep_key_type key_type /*!< in: access type of this key
(shared, exclusive, semi...) */
@@ -10578,8 +10610,8 @@ ha_innobase::wsrep_append_keys(
if (wsrep_protocol_version == 0) {
uint len;
- char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char *key = &keyval[0];
+ uchar keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
+ uchar *key = &keyval[0];
ibool is_null;
len = wsrep_store_key_val_for_row(
@@ -10611,18 +10643,18 @@ ha_innobase::wsrep_append_keys(
for (i=0; i<table->s->keys; ++i) {
uint len;
- char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
- char* key0 = &keyval0[1];
- char* key1 = &keyval1[1];
+ uchar keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
+ uchar keyval1[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
+ uchar* key0 = &keyval0[1];
+ uchar* key1 = &keyval1[1];
KEY* key_info = table->key_info + i;
ibool is_null;
dict_index_t* idx = innobase_get_index(i);
dict_table_t* tab = (idx) ? idx->table : NULL;
- keyval0[0] = (char)i;
- keyval1[0] = (char)i;
+ keyval0[0] = (uchar)i;
+ keyval1[0] = (uchar)i;
if (!tab) {
WSREP_WARN("MariaDB-InnoDB key mismatch %s %s",
@@ -10680,7 +10712,7 @@ ha_innobase::wsrep_append_keys(
wsrep_calc_row_hash(digest, record0, table, m_prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
- (const char*) digest, 16,
+ (const uchar*) digest, 16,
key_type))) {
DBUG_RETURN(rcode);
}
@@ -10690,7 +10722,7 @@ ha_innobase::wsrep_append_keys(
digest, record1, table, m_prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share,
table,
- (const char*) digest,
+ (const uchar*) digest,
16, key_type))) {
DBUG_RETURN(rcode);
}
@@ -13546,17 +13578,10 @@ innobase_drop_database(
@param[in,out] trx InnoDB data dictionary transaction
@param[in] from old table name
@param[in] to new table name
-@param[in] commit whether to commit trx
-@param[in] use_fk whether to parse and enforce FOREIGN KEY constraints
+@param[in] commit whether to commit trx (and to enforce FOREIGN KEY)
@return DB_SUCCESS or error code */
-inline
-dberr_t
-innobase_rename_table(
- trx_t* trx,
- const char* from,
- const char* to,
- bool commit,
- bool use_fk)
+inline dberr_t innobase_rename_table(trx_t *trx, const char *from,
+ const char *to, bool commit)
{
dberr_t error;
char norm_to[FN_REFLEN];
@@ -13589,6 +13614,9 @@ innobase_rename_table(
Convert lock_wait_timeout unit from second to 250 milliseconds */
long int lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd) * 4;
if (table != NULL) {
+ if (commit) {
+ dict_stats_wait_bg_to_stop_using_table(table, trx);
+ }
for (dict_index_t* index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
@@ -13602,7 +13630,9 @@ innobase_rename_table(
}
}
}
- dict_table_close(table, TRUE, FALSE);
+ if (!commit) {
+ dict_table_close(table, TRUE, FALSE);
+ }
}
/* FTS sync is in progress. We shall timeout this operation */
@@ -13617,7 +13647,7 @@ innobase_rename_table(
ut_a(trx->will_lock > 0);
error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit,
- use_fk);
+ commit);
if (error != DB_SUCCESS) {
if (error == DB_TABLE_NOT_FOUND
@@ -13669,6 +13699,10 @@ innobase_rename_table(
func_exit:
if (commit) {
+ if (table) {
+ table->stats_bg_flag &= ~BG_STAT_SHOULD_QUIT;
+ dict_table_close(table, TRUE, FALSE);
+ }
row_mysql_unlock_data_dictionary(trx);
}
@@ -13754,9 +13788,11 @@ int ha_innobase::truncate()
++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
row_mysql_lock_data_dictionary(trx);
+ dict_stats_wait_bg_to_stop_using_table(ib_table, trx);
+
int err = convert_error_code_to_mysql(
innobase_rename_table(trx, ib_table->name.m_name, temp_name,
- false, false),
+ false),
ib_table->flags, m_user_thd);
if (err) {
trx_rollback_for_mysql(trx);
@@ -13839,7 +13875,7 @@ ha_innobase::rename_table(
++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- dberr_t error = innobase_rename_table(trx, from, to, true, true);
+ dberr_t error = innobase_rename_table(trx, from, to, true);
DEBUG_SYNC(thd, "after_innobase_rename_table");
@@ -14368,6 +14404,13 @@ ha_innobase::info_low(
if (dict_stats_is_persistent_enabled(ib_table)) {
if (is_analyze) {
+ row_mysql_lock_data_dictionary(
+ m_prebuilt->trx);
+ dict_stats_recalc_pool_del(ib_table);
+ dict_stats_wait_bg_to_stop_using_table(
+ ib_table, m_prebuilt->trx);
+ row_mysql_unlock_data_dictionary(
+ m_prebuilt->trx);
opt = DICT_STATS_RECALC_PERSISTENT;
} else {
/* This is e.g. 'SHOW INDEXES', fetch
@@ -14380,6 +14423,13 @@ ha_innobase::info_low(
ret = dict_stats_update(ib_table, opt);
+ if (opt == DICT_STATS_RECALC_PERSISTENT) {
+ mutex_enter(&dict_sys->mutex);
+ ib_table->stats_bg_flag
+ &= byte(~BG_STAT_SHOULD_QUIT);
+ mutex_exit(&dict_sys->mutex);
+ }
+
if (ret != DB_SUCCESS) {
m_prebuilt->trx->op_info = "";
DBUG_RETURN(HA_ERR_GENERIC);
@@ -17559,7 +17609,8 @@ innodb_io_capacity_update(
" higher than innodb_io_capacity_max %lu",
in_val, srv_max_io_capacity);
- srv_max_io_capacity = in_val * 2;
+ srv_max_io_capacity = (in_val & ~(~0UL >> 1))
+ ? in_val : in_val * 2;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
@@ -19530,69 +19581,68 @@ wsrep_abort_slave_trx(
(long long)bf_seqno, (long long)victim_seqno);
abort();
}
-/*******************************************************************//**
-This function is used to kill one transaction in BF. */
-UNIV_INTERN
-int
-wsrep_innobase_kill_one_trx(
-/*========================*/
- void * const bf_thd_ptr,
- const trx_t * const bf_trx,
- trx_t *victim_trx,
- ibool signal)
-{
- ut_ad(lock_mutex_own());
- ut_ad(trx_mutex_own(victim_trx));
- ut_ad(bf_thd_ptr);
- ut_ad(victim_trx);
- DBUG_ENTER("wsrep_innobase_kill_one_trx");
- THD *bf_thd = bf_thd_ptr ? (THD*) bf_thd_ptr : NULL;
- THD *thd = (THD *) victim_trx->mysql_thd;
- int64_t bf_seqno = (bf_thd) ? wsrep_thd_trx_seqno(bf_thd) : 0;
+struct bg_wsrep_kill_trx_arg {
+ my_thread_id thd_id;
+ trx_id_t trx_id;
+ int64_t bf_seqno;
+ ibool signal;
+};
- if (!thd) {
- DBUG_PRINT("wsrep", ("no thd for conflicting lock"));
- WSREP_WARN("no THD for trx: " TRX_ID_FMT, victim_trx->id);
- DBUG_RETURN(1);
- }
+static void bg_wsrep_kill_trx(
+ void *void_arg)
+{
+ bg_wsrep_kill_trx_arg *arg = (bg_wsrep_kill_trx_arg*)void_arg;
+ THD *thd = find_thread_by_id(arg->thd_id, false);
+ trx_t *victim_trx = NULL;
+ bool awake = false;
+ DBUG_ENTER("bg_wsrep_kill_trx");
- if (!bf_thd) {
- DBUG_PRINT("wsrep", ("no BF thd for conflicting lock"));
- WSREP_WARN("no BF THD for trx: " TRX_ID_FMT,
- bf_trx ? bf_trx->id : 0);
- DBUG_RETURN(1);
+ if (thd) {
+ victim_trx= thd_to_trx(thd);
+ /* Victim trx might not exist e.g. on MDL-conflict. */
+ if (victim_trx) {
+ lock_mutex_enter();
+ trx_mutex_enter(victim_trx);
+ if (victim_trx->id != arg->trx_id ||
+ victim_trx->state == TRX_STATE_COMMITTED_IN_MEMORY)
+ {
+ /* Victim was meanwhile rolled back or
+ committed */
+ trx_mutex_exit(victim_trx);
+ lock_mutex_exit();
+ wsrep_thd_UNLOCK(thd);
+ victim_trx= NULL;
+ }
+ } else {
+ /* find_thread_by_id locked
+ THD::LOCK_thd_data */
+ wsrep_thd_UNLOCK(thd);
+ }
}
- WSREP_LOG_CONFLICT(bf_thd, thd, TRUE);
+ if (!victim_trx) {
+ /* Victim trx might not exist (MDL-conflict) or victim
+ was meanwhile rolled back or committed because of
+ a KILL statement or a disconnect. */
+ goto ret;
+ }
WSREP_DEBUG("BF kill (" ULINTPF ", seqno: " INT64PF
"), victim: (%lu) trx: " TRX_ID_FMT,
- signal, bf_seqno,
+ arg->signal, arg->bf_seqno,
thd_get_thread_id(thd),
victim_trx->id);
WSREP_DEBUG("Aborting query: %s conf %d trx: %" PRId64,
- (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void",
+ (wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void",
wsrep_thd_conflict_state(thd, FALSE),
wsrep_thd_ws_handle(thd)->trx_id);
- wsrep_thd_LOCK(thd);
- DBUG_EXECUTE_IF("sync.wsrep_after_BF_victim_lock",
- {
- const char act[]=
- "now "
- "wait_for signal.wsrep_after_BF_victim_lock";
- DBUG_ASSERT(!debug_sync_set_action(bf_thd,
- STRING_WITH_LEN(act)));
- };);
-
-
if (wsrep_thd_query_state(thd) == QUERY_EXITING) {
WSREP_DEBUG("kill trx EXITING for " TRX_ID_FMT,
victim_trx->id);
- wsrep_thd_UNLOCK(thd);
- DBUG_RETURN(0);
+ goto ret_unlock;
}
if (wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
@@ -19608,18 +19658,13 @@ wsrep_innobase_kill_one_trx(
case MUST_ABORT:
WSREP_DEBUG("victim " TRX_ID_FMT " in MUST ABORT state",
victim_trx->id);
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- DBUG_RETURN(0);
- break;
+ goto ret_awake;
case ABORTED:
case ABORTING: // fall through
default:
WSREP_DEBUG("victim " TRX_ID_FMT " in state %d",
victim_trx->id, wsrep_thd_get_conflict_state(thd));
- wsrep_thd_UNLOCK(thd);
- DBUG_RETURN(0);
- break;
+ goto ret_unlock;
}
switch (wsrep_thd_query_state(thd)) {
@@ -19632,12 +19677,12 @@ wsrep_innobase_kill_one_trx(
victim_trx->id);
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
- wsrep_abort_slave_trx(bf_seqno,
+ wsrep_abort_slave_trx(arg->bf_seqno,
wsrep_thd_trx_seqno(thd));
} else {
wsrep_t *wsrep= get_wsrep();
rcode = wsrep->abort_pre_commit(
- wsrep, bf_seqno,
+ wsrep, arg->bf_seqno,
(wsrep_trx_id_t)wsrep_thd_ws_handle(thd)->trx_id
);
@@ -19646,10 +19691,7 @@ wsrep_innobase_kill_one_trx(
WSREP_DEBUG("cancel commit warning: "
TRX_ID_FMT,
victim_trx->id);
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- DBUG_RETURN(1);
- break;
+ goto ret_awake;
case WSREP_OK:
break;
default:
@@ -19662,12 +19704,9 @@ wsrep_innobase_kill_one_trx(
* kill the lock holder first.
*/
abort();
- break;
}
}
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
- break;
+ goto ret_awake;
case QUERY_EXEC:
/* it is possible that victim trx is itself waiting for some
* other lock. We need to cancel this waiting
@@ -19688,26 +19727,20 @@ wsrep_innobase_kill_one_trx(
lock_cancel_waiting_and_release(wait_lock);
}
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
} else {
/* abort currently executing query */
DBUG_PRINT("wsrep",("sending KILL_QUERY to: %lu",
thd_get_thread_id(thd)));
WSREP_DEBUG("kill query for: %ld",
thd_get_thread_id(thd));
- /* Note that innobase_kill_query will take lock_mutex
- and trx_mutex */
- wsrep_thd_UNLOCK(thd);
- wsrep_thd_awake(thd, signal);
/* for BF thd, we need to prevent him from committing */
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
- wsrep_abort_slave_trx(bf_seqno,
+ wsrep_abort_slave_trx(arg->bf_seqno,
wsrep_thd_trx_seqno(thd));
}
}
- break;
+ goto ret_awake;
case QUERY_IDLE:
{
WSREP_DEBUG("kill IDLE for " TRX_ID_FMT, victim_trx->id);
@@ -19715,10 +19748,9 @@ wsrep_innobase_kill_one_trx(
if (wsrep_thd_exec_mode(thd) == REPL_RECV) {
WSREP_DEBUG("kill BF IDLE, seqno: %lld",
(long long)wsrep_thd_trx_seqno(thd));
- wsrep_thd_UNLOCK(thd);
- wsrep_abort_slave_trx(bf_seqno,
+ wsrep_abort_slave_trx(arg->bf_seqno,
wsrep_thd_trx_seqno(thd));
- DBUG_RETURN(0);
+ goto ret_unlock;
}
/* This will lock thd from proceeding after net_read() */
wsrep_thd_set_conflict_state(thd, ABORTING);
@@ -19739,22 +19771,72 @@ wsrep_innobase_kill_one_trx(
DBUG_PRINT("wsrep",("signalling wsrep rollbacker"));
WSREP_DEBUG("signaling aborter");
wsrep_unlock_rollback();
- wsrep_thd_UNLOCK(thd);
-
- break;
+ goto ret_unlock;
}
default:
WSREP_WARN("bad wsrep query state: %d",
wsrep_thd_query_state(thd));
- wsrep_thd_UNLOCK(thd);
- break;
+ goto ret_unlock;
}
- DBUG_RETURN(0);
+ret_awake:
+ awake= true;
+
+ret_unlock:
+ trx_mutex_exit(victim_trx);
+ lock_mutex_exit();
+ if (awake)
+ wsrep_thd_awake(thd, arg->signal);
+ wsrep_thd_UNLOCK(thd);
+
+ret:
+ free(arg);
+ DBUG_VOID_RETURN;
+
+}
+
+/*******************************************************************//**
+This function is used to kill one transaction in BF. */
+UNIV_INTERN
+void
+wsrep_innobase_kill_one_trx(
+/*========================*/
+ MYSQL_THD const bf_thd,
+ const trx_t * const bf_trx,
+ trx_t *victim_trx,
+ ibool signal)
+{
+ ut_ad(bf_thd);
+ ut_ad(victim_trx);
+ ut_ad(lock_mutex_own());
+ ut_ad(trx_mutex_own(victim_trx));
+
+ bg_wsrep_kill_trx_arg *arg = (bg_wsrep_kill_trx_arg*)malloc(sizeof(*arg));
+ arg->thd_id = thd_get_thread_id(victim_trx->mysql_thd);
+ arg->trx_id = victim_trx->id;
+ arg->bf_seqno = wsrep_thd_trx_seqno((THD*)bf_thd);
+ arg->signal = signal;
+
+ DBUG_ENTER("wsrep_innobase_kill_one_trx");
+
+ WSREP_LOG_CONFLICT(bf_thd, victim_trx->mysql_thd, TRUE);
+
+ DBUG_EXECUTE_IF("sync.wsrep_after_BF_victim_lock",
+ {
+ const char act[]=
+ "now "
+ "wait_for signal.wsrep_after_BF_victim_lock";
+ DBUG_ASSERT(!debug_sync_set_action(bf_thd,
+ STRING_WITH_LEN(act)));
+ };);
+
+
+ mysql_manager_submit(bg_wsrep_kill_trx, arg);
+ DBUG_VOID_RETURN;
}
static
-int
+void
wsrep_abort_transaction(
/*====================*/
handlerton* hton,
@@ -19762,7 +19844,7 @@ wsrep_abort_transaction(
THD *victim_thd,
my_bool signal)
{
- DBUG_ENTER("wsrep_innobase_abort_thd");
+ DBUG_ENTER("wsrep_abort_transaction");
trx_t* victim_trx = thd_to_trx(victim_thd);
trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL;
@@ -19775,21 +19857,20 @@ wsrep_abort_transaction(
if (victim_trx) {
lock_mutex_enter();
trx_mutex_enter(victim_trx);
- int rcode = wsrep_innobase_kill_one_trx(bf_thd, bf_trx,
- victim_trx, signal);
+ wsrep_innobase_kill_one_trx(bf_thd, bf_trx, victim_trx, signal);
lock_mutex_exit();
trx_mutex_exit(victim_trx);
wsrep_srv_conc_cancel_wait(victim_trx);
- DBUG_RETURN(rcode);
+ DBUG_VOID_RETURN;
} else {
WSREP_DEBUG("victim does not have transaction");
wsrep_thd_LOCK(victim_thd);
wsrep_thd_set_conflict_state(victim_thd, MUST_ABORT);
- wsrep_thd_UNLOCK(victim_thd);
wsrep_thd_awake(victim_thd, signal);
+ wsrep_thd_UNLOCK(victim_thd);
}
- DBUG_RETURN(-1);
+ DBUG_VOID_RETURN;
}
static
@@ -19881,6 +19962,14 @@ innodb_instrument_semaphores_update(
HA_ERR_WRONG_COMMAND, deprecated_instrument_semaphores);
}
+static void innodb_idle_flush_pct_update(THD *thd, st_mysql_sys_var *var,
+ void*, const void *save)
+{
+ innodb_idle_flush_pct = *static_cast<const ulong*>(save);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_WRONG_COMMAND, deprecated_idle_flush_pct);
+}
+
/* plugin options */
static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
@@ -19931,12 +20020,10 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
" Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
-static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
+static MYSQL_SYSVAR_BOOL(use_atomic_writes, srv_use_atomic_writes,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Enable atomic writes, instead of using the doublewrite buffer, for files "
"on devices that supports atomic writes. "
- "To use this option one must use "
- "file_per_table=1, flush_method=O_DIRECT and use_fallocate=1. "
"This option only works on Linux with either FusionIO cards using "
"the directFS filesystem or with Shannon cards using any file system.",
NULL, NULL, TRUE);
@@ -19964,12 +20051,10 @@ static MYSQL_SYSVAR_ULONG(io_capacity_max, srv_max_io_capacity,
SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT, 100,
SRV_MAX_IO_CAPACITY_LIMIT, 0);
-static MYSQL_SYSVAR_ULONG(idle_flush_pct,
- srv_idle_flush_pct,
+static MYSQL_SYSVAR_ULONG(idle_flush_pct, innodb_idle_flush_pct,
PLUGIN_VAR_RQCMDARG,
- "Up to what percentage of dirty pages should be flushed when innodb "
- "finds it has spare resources to do so.",
- NULL, NULL, 100, 0, 100, 0);
+ "DEPRECATED. This setting has no effect.",
+ NULL, innodb_idle_flush_pct_update, 100, 0, 100, 0);
#ifdef UNIV_DEBUG
static MYSQL_SYSVAR_BOOL(background_drop_list_empty,
@@ -20961,11 +21046,6 @@ static MYSQL_SYSVAR_BOOL(master_thread_disabled_debug,
PLUGIN_VAR_OPCMDARG,
"Disable master thread",
NULL, srv_master_thread_disabled_debug_update, FALSE);
-
-static MYSQL_SYSVAR_UINT(simulate_comp_failures, srv_simulate_comp_failures,
- PLUGIN_VAR_NOCMDARG,
- "Simulate compression failures.",
- NULL, NULL, 0, 0, 99, 0);
#endif /* UNIV_DEBUG */
static MYSQL_SYSVAR_BOOL(force_primary_key,
@@ -21309,7 +21389,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(compression_pad_pct_max),
MYSQL_SYSVAR(default_row_format),
#ifdef UNIV_DEBUG
- MYSQL_SYSVAR(simulate_comp_failures),
MYSQL_SYSVAR(trx_rseg_n_slots_debug),
MYSQL_SYSVAR(limit_optimistic_insert_debug),
MYSQL_SYSVAR(trx_purge_view_update_only_debug),
@@ -21564,7 +21643,7 @@ static bool table_name_parse(
memcpy(tbl_buf, tbl_name.m_name + dbnamelen + 1, tblnamelen);
tbl_buf[tblnamelen] = 0;
- filename_to_tablename(db_buf, dbname, MAX_DATABASE_NAME_LEN + 1, true);
+ dbnamelen = filename_to_tablename(db_buf, dbname, MAX_DATABASE_NAME_LEN + 1, true);
if (tblnamelen > TEMP_FILE_PREFIX_LENGTH
&& !strncmp(tbl_buf, TEMP_FILE_PREFIX, TEMP_FILE_PREFIX_LENGTH)) {
@@ -21576,7 +21655,7 @@ static bool table_name_parse(
tblnamelen = is_part - tbl_buf;
}
- filename_to_tablename(tbl_buf, tblname, MAX_TABLE_NAME_LEN + 1, true);
+ tblnamelen = filename_to_tablename(tbl_buf, tblname, MAX_TABLE_NAME_LEN + 1, true);
return true;
}
@@ -22008,11 +22087,11 @@ innobase_get_computed_value(
field = dtuple_get_nth_v_field(row, col->v_pos);
- my_bitmap_map* old_write_set = dbug_tmp_use_all_columns(mysql_table, mysql_table->write_set);
- my_bitmap_map* old_read_set = dbug_tmp_use_all_columns(mysql_table, mysql_table->read_set);
+ MY_BITMAP *old_write_set = dbug_tmp_use_all_columns(mysql_table, &mysql_table->write_set);
+ MY_BITMAP *old_read_set = dbug_tmp_use_all_columns(mysql_table, &mysql_table->read_set);
ret = mysql_table->update_virtual_field(mysql_table->field[col->m_col.ind]);
- dbug_tmp_restore_column_map(mysql_table->read_set, old_read_set);
- dbug_tmp_restore_column_map(mysql_table->write_set, old_write_set);
+ dbug_tmp_restore_column_map(&mysql_table->read_set, old_read_set);
+ dbug_tmp_restore_column_map(&mysql_table->write_set, old_write_set);
if (ret != 0) {
DBUG_RETURN(NULL);
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index a02c897f7ae..274c6761d4f 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -46,7 +46,7 @@ struct ha_table_option_struct
uint atomic_writes; /*!< Use atomic writes for this
table if this options is ON or
in DEFAULT if
- srv_use_atomic_writes=1.
+ innodb_use_atomic_writes.
Atomic writes are not used if
value OFF.*/
uint encryption; /*!< DEFAULT, ON, OFF */
@@ -976,6 +976,3 @@ which is in the prepared state
@return 0 or error number */
int innobase_rollback_by_xid(handlerton* hton, XID* xid);
-
-/** Free tablespace resources allocated. */
-void innobase_space_shutdown();
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index b766cac5dd5..e03621795ba 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1944,9 +1944,9 @@ innobase_row_to_mysql(
}
}
if (table->vfield) {
- my_bitmap_map* old_vcol_set = tmp_use_all_columns(table, table->vcol_set);
+ MY_BITMAP *old_vcol_set = tmp_use_all_columns(table, &table->vcol_set);
table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_READ);
- tmp_restore_column_map(table->vcol_set, old_vcol_set);
+ tmp_restore_column_map(&table->vcol_set, old_vcol_set);
}
}
@@ -4657,12 +4657,28 @@ prepare_inplace_alter_table_dict(
}
if (dict_col_name_is_reserved(field->field_name)) {
+wrong_column_name:
dict_mem_table_free(ctx->new_table);
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
field->field_name);
goto new_clustered_failed;
}
+ /** Note the FTS_DOC_ID name is case sensitive due
+ to internal query parser.
+ FTS_DOC_ID column must be of BIGINT NOT NULL type
+ and it should be in all capitalized characters */
+ if (!innobase_strcasecmp(field->field_name,
+ FTS_DOC_ID_COL_NAME)) {
+ if (col_type != DATA_INT
+ || field->real_maybe_null()
+ || col_len != sizeof(doc_id_t)
+ || strcmp(field->field_name,
+ FTS_DOC_ID_COL_NAME)) {
+ goto wrong_column_name;
+ }
+ }
+
if (is_virtual) {
dict_mem_table_add_v_col(
ctx->new_table, ctx->heap,
@@ -6395,6 +6411,7 @@ innobase_online_rebuild_log_free(
== ONLINE_INDEX_CREATION);
clust_index->online_status = ONLINE_INDEX_COMPLETE;
row_log_free(clust_index->online_log);
+ clust_index->online_log = NULL;
DEBUG_SYNC_C("innodb_online_rebuild_log_free_aborted");
}
@@ -6717,6 +6734,7 @@ innobase_rename_column_try(
{
pars_info_t* info;
dberr_t error;
+ bool clust_has_prefixes = false;
DBUG_ENTER("innobase_rename_column_try");
@@ -6805,6 +6823,39 @@ err_exit:
if (error != DB_SUCCESS) {
goto err_exit;
}
+
+ if (!has_prefixes || !clust_has_prefixes
+ || field->prefix_len) {
+ continue;
+ }
+
+ /* For secondary indexes, the
+ has_prefixes check can be 'polluted'
+ by PRIMARY KEY column prefix. Try also
+ the simpler encoding of SYS_FIELDS.POS. */
+ info = pars_info_create();
+
+ pars_info_add_ull_literal(info, "indexid", index->id);
+ pars_info_add_int4_literal(info, "nth", i);
+ pars_info_add_str_literal(info, "new", to);
+
+ error = que_eval_sql(
+ info,
+ "PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n"
+ "BEGIN\n"
+ "UPDATE SYS_FIELDS SET COL_NAME=:new\n"
+ "WHERE INDEX_ID=:indexid\n"
+ "AND POS=:nth;\n"
+ "END;\n",
+ FALSE, trx);
+
+ if (error != DB_SUCCESS) {
+ goto err_exit;
+ }
+ }
+
+ if (index == dict_table_get_first_index(user_table)) {
+ clust_has_prefixes = has_prefixes;
}
}
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 7068dab77a4..46649187ca0 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2020, MariaDB Corporation.
+Copyright (c) 2016, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -4384,16 +4384,12 @@ exist entries for such a page if the page belonged to an index which
subsequently was dropped.
@param[in,out] block if page has been read from disk,
pointer to the page x-latched, else NULL
-@param[in] page_id page id of the index page
-@param[in] update_ibuf_bitmap normally this is set to TRUE, but
-if we have deleted or are deleting the tablespace, then we naturally do not
-want to update a non-existent bitmap page */
+@param[in] page_id page id of the index page */
void
ibuf_merge_or_delete_for_page(
buf_block_t* block,
const page_id_t page_id,
- const page_size_t* page_size,
- ibool update_ibuf_bitmap)
+ const page_size_t& page_size)
{
btr_pcur_t pcur;
#ifdef UNIV_IBUF_DEBUG
@@ -4417,81 +4413,50 @@ ibuf_merge_or_delete_for_page(
return;
}
- /* We cannot refer to page_size in the following, because it is passed
- as NULL (it is unknown) when buf_read_ibuf_merge_pages() is merging
- (discarding) changes for a dropped tablespace. When block != NULL or
- update_ibuf_bitmap is specified, then page_size must be known.
- That is why we will repeat the check below, with page_size in
- place of univ_page_size. Passing univ_page_size assumes that the
- uncompressed page size always is a power-of-2 multiple of the
- compressed page size. */
-
- if (ibuf_fixed_addr_page(page_id, univ_page_size)
- || fsp_descr_page(page_id, univ_page_size)) {
+ if (ibuf_fixed_addr_page(page_id, page_size)
+ || fsp_descr_page(page_id, page_size)) {
return;
}
- fil_space_t* space;
-
- if (update_ibuf_bitmap) {
-
- ut_ad(page_size != NULL);
+ fil_space_t* space = fil_space_acquire_silent(page_id.space());
- if (ibuf_fixed_addr_page(page_id, *page_size)
- || fsp_descr_page(page_id, *page_size)) {
- return;
- }
-
- space = fil_space_acquire_silent(page_id.space());
-
- if (UNIV_UNLIKELY(!space)) {
- /* Do not try to read the bitmap page from the
- non-existent tablespace, delete the ibuf records */
- block = NULL;
- update_ibuf_bitmap = FALSE;
- } else {
- page_t* bitmap_page = NULL;
- ulint bitmap_bits = 0;
+ if (UNIV_UNLIKELY(!space)) {
+ block = NULL;
+ } else {
+ page_t* bitmap_page = NULL;
+ ulint bitmap_bits = 0;
- ibuf_mtr_start(&mtr);
+ ibuf_mtr_start(&mtr);
- bitmap_page = ibuf_bitmap_get_map_page(
- page_id, *page_size, &mtr);
+ bitmap_page = ibuf_bitmap_get_map_page(
+ page_id, page_size, &mtr);
- if (bitmap_page &&
- fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) {
- bitmap_bits = ibuf_bitmap_page_get_bits(
- bitmap_page, page_id, *page_size,
- IBUF_BITMAP_BUFFERED, &mtr);
- }
+ if (bitmap_page &&
+ fil_page_get_type(bitmap_page) != FIL_PAGE_TYPE_ALLOCATED) {
+ bitmap_bits = ibuf_bitmap_page_get_bits(
+ bitmap_page, page_id, page_size,
+ IBUF_BITMAP_BUFFERED, &mtr);
+ }
- ibuf_mtr_commit(&mtr);
+ ibuf_mtr_commit(&mtr);
- if (!bitmap_bits) {
- /* No changes are buffered for this page. */
-
- fil_space_release(space);
- if (UNIV_UNLIKELY(srv_shutdown_state)
- && !srv_fast_shutdown
- && (!block
- || btr_page_get_index_id(block->frame)
- != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) {
- /* Prevent an infinite loop on slow
- shutdown, in case the bitmap bits are
- wrongly clear even though buffered
- changes exist. */
- ibuf_delete_recs(page_id);
- }
- return;
+ if (!bitmap_bits) {
+ /* No changes are buffered for this page. */
+
+ fil_space_release(space);
+ if (UNIV_UNLIKELY(srv_shutdown_state)
+ && !srv_fast_shutdown
+ && (!block
+ || btr_page_get_index_id(block->frame)
+ != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) {
+ /* Prevent an infinite loop on slow
+ shutdown, in case the bitmap bits are
+ wrongly clear even though buffered
+ changes exist. */
+ ibuf_delete_recs(page_id);
}
+ return;
}
- } else if (block != NULL
- && (ibuf_fixed_addr_page(page_id, *page_size)
- || fsp_descr_page(page_id, *page_size))) {
-
- return;
- } else {
- space = NULL;
}
mem_heap_t* heap = mem_heap_create(512);
@@ -4541,7 +4506,7 @@ loop:
if (block != NULL) {
ibool success;
- mtr.set_named_space(page_id.space());
+ mtr.set_named_space(space);
success = buf_page_get_known_nowait(
RW_X_LATCH, block,
@@ -4556,8 +4521,8 @@ loop:
the block is io-fixed. Other threads must not try to
latch an io-fixed block. */
buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE);
- } else if (update_ibuf_bitmap) {
- mtr.set_named_space(page_id.space());
+ } else if (space) {
+ mtr.set_named_space(space);
}
if (!btr_pcur_is_on_user_rec(&pcur)) {
@@ -4658,7 +4623,7 @@ loop:
ibuf_btr_pcur_commit_specify_mtr(&pcur, &mtr);
ibuf_mtr_start(&mtr);
- mtr.set_named_space(page_id.space());
+ mtr.set_named_space(space);
success = buf_page_get_known_nowait(
RW_X_LATCH, block,
@@ -4714,26 +4679,26 @@ loop:
}
reset_bit:
- if (update_ibuf_bitmap) {
+ if (space) {
page_t* bitmap_page;
- bitmap_page = ibuf_bitmap_get_map_page(page_id, *page_size,
+ bitmap_page = ibuf_bitmap_get_map_page(page_id, page_size,
&mtr);
ibuf_bitmap_page_set_bits(
- bitmap_page, page_id, *page_size,
+ bitmap_page, page_id, page_size,
IBUF_BITMAP_BUFFERED, FALSE, &mtr);
if (block != NULL) {
ulint old_bits = ibuf_bitmap_page_get_bits(
- bitmap_page, page_id, *page_size,
+ bitmap_page, page_id, page_size,
IBUF_BITMAP_FREE, &mtr);
ulint new_bits = ibuf_index_page_calc_free(block);
if (old_bits != new_bits) {
ibuf_bitmap_page_set_bits(
- bitmap_page, page_id, *page_size,
+ bitmap_page, page_id, page_size,
IBUF_BITMAP_FREE, new_bits, &mtr);
}
}
@@ -4957,6 +4922,13 @@ ibuf_check_bitmap_on_import(
bitmap_page = ibuf_bitmap_get_map_page(
page_id_t(space_id, page_no), page_size, &mtr);
+ if (!bitmap_page) {
+ mutex_exit(&ibuf_mutex);
+ ibuf_exit(&mtr);
+ mtr_commit(&mtr);
+ return DB_CORRUPTION;
+ }
+
if (buf_is_zeroes(span<const byte>(bitmap_page,
page_size.physical()))) {
/* This means we got all-zero page instead of
@@ -4980,11 +4952,6 @@ ibuf_check_bitmap_on_import(
continue;
}
- if (!bitmap_page) {
- mutex_exit(&ibuf_mutex);
- return DB_CORRUPTION;
- }
-
for (i = FSP_IBUF_BITMAP_OFFSET + 1;
i < page_size.physical();
i++) {
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 7351b5fb682..6cfb92a94d3 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -989,14 +989,6 @@ dict_tf_get_page_size(
ulint flags)
MY_ATTRIBUTE((const));
-/** Determine the extent size (in pages) for the given table
-@param[in] table the table whose extent size is being
- calculated.
-@return extent size in pages (256, 128 or 64) */
-ulint
-dict_table_extent_size(
- const dict_table_t* table);
-
/** Get the table page size.
@param[in] table table
@return compressed page size, or 0 if not compressed */
@@ -1905,20 +1897,6 @@ UNIV_INTERN
ulint
dict_sys_get_size();
-/** Look for any dictionary objects that are found in the given tablespace.
-@param[in] space_id Tablespace ID to search for.
-@return true if tablespace is empty. */
-bool
-dict_space_is_empty(
- ulint space_id);
-
-/** Find the space_id for the given name in sys_tablespaces.
-@param[in] name Tablespace name to search for.
-@return the tablespace ID. */
-ulint
-dict_space_get_id(
- const char* name);
-
/** Free the virtual column template
@param[in,out] vc_templ virtual column template */
UNIV_INLINE
diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h
index b3302409e5f..da8d4b7de26 100644
--- a/storage/innobase/include/dyn0buf.h
+++ b/storage/innobase/include/dyn0buf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -348,6 +348,24 @@ public:
}
/**
+ Iterate over each block and call the functor.
+ @return false if iteration was terminated. */
+ template <typename Functor>
+ bool for_each_block(const Functor& functor) const
+ {
+ for (typename list_t::iterator it = m_list.begin(),
+ end = m_list.end();
+ it != end; ++it) {
+
+ if (!functor(&*it)) {
+ return false;
+ }
+ }
+
+ return(true);
+ }
+
+ /**
Iterate over all the blocks in reverse and call the iterator
@return false if iteration was terminated. */
template <typename Functor>
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 05dc3f57df7..3eab2135969 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -234,8 +234,8 @@ innobase_casedn_str(
#ifdef WITH_WSREP
UNIV_INTERN
-int
-wsrep_innobase_kill_one_trx(void * const thd_ptr,
+void
+wsrep_innobase_kill_one_trx(MYSQL_THD const thd_ptr,
const trx_t * const bf_trx,
trx_t *victim_trx,
ibool signal);
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index a69b63ee16b..1a5214085de 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -342,16 +342,12 @@ exist entries for such a page if the page belonged to an index which
subsequently was dropped.
@param[in,out] block if page has been read from disk,
pointer to the page x-latched, else NULL
-@param[in] page_id page id of the index page
-@param[in] update_ibuf_bitmap normally this is set to TRUE, but
-if we have deleted or are deleting the tablespace, then we naturally do not
-want to update a non-existent bitmap page */
+@param[in] page_id page id of the index page */
void
ibuf_merge_or_delete_for_page(
buf_block_t* block,
const page_id_t page_id,
- const page_size_t* page_size,
- ibool update_ibuf_bitmap);
+ const page_size_t& page_size);
/*********************************************************************//**
Deletes all entries in the insert buffer for a given space id. This is used
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 5270cd671db..b57a38f8eab 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -434,10 +434,9 @@ struct mtr_t {
static inline bool is_block_dirtied(const buf_block_t* block)
MY_ATTRIBUTE((warn_unused_result));
- /** Get the buffer fix count for the block added by this mtr.
- @param[in] block block to be checked
- @return number of buffer count added by this mtr */
- int32_t get_fix_count(buf_block_t *block);
+ /** Check if we are holding a block latch in exclusive mode
+ @param block buffer pool block to search for */
+ bool have_x_latch(const buf_block_t& block) const;
private:
/** Look up the system tablespace. */
void lookup_sys_space();
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 82d1551de6c..23de5bd0ef1 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -160,7 +160,6 @@ static const ulint OS_FILE_NORMAL = 62;
/** Types for file create @{ */
static const ulint OS_DATA_FILE = 100;
static const ulint OS_LOG_FILE = 101;
-static const ulint OS_DATA_TEMP_FILE = 102;
static const ulint OS_DATA_FILE_NO_O_DIRECT = 103;
/* @} */
diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h
index 262be4d30a9..2798a4d40fb 100644
--- a/storage/innobase/include/que0que.h
+++ b/storage/innobase/include/que0que.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2020, MariaDB Corporation.
+Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -303,7 +303,6 @@ que_fork_scheduler_round_robin(
/** Query thread states */
enum que_thr_state_t {
QUE_THR_RUNNING,
- QUE_THR_PROCEDURE_WAIT,
/** in selects this means that the thread is at the end of its
result set (or start, in case of a scroll cursor); in other
statements, this means the thread has done its task */
diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h
index 383975c32d3..1e46d65e427 100644
--- a/storage/innobase/include/row0log.h
+++ b/storage/innobase/include/row0log.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -65,7 +65,7 @@ Free the row log for an index that was being created online. */
void
row_log_free(
/*=========*/
- row_log_t*& log) /*!< in,own: row log */
+ row_log_t* log) /*!< in,own: row log */
MY_ATTRIBUTE((nonnull));
/******************************************************//**
diff --git a/storage/innobase/include/row0log.ic b/storage/innobase/include/row0log.ic
index ba7eb7b025c..44d17bbcdf1 100644
--- a/storage/innobase/include/row0log.ic
+++ b/storage/innobase/include/row0log.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -38,6 +39,7 @@ row_log_abort_sec(
ut_ad(!dict_index_is_clust(index));
dict_index_set_online_status(index, ONLINE_INDEX_ABORTED);
row_log_free(index->online_log);
+ index->online_log = NULL;
}
/******************************************************//**
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index d5cdd4a3f17..8738f991368 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -784,12 +784,6 @@ struct row_prebuilt_t {
search key values from MySQL format
to InnoDB format.*/
uint srch_key_val_len; /*!< Size of search key */
- /** Disable prefetch. */
- bool m_no_prefetch;
-
- /** Return materialized key for secondary index scan */
- bool m_read_virtual_key;
-
/** The MySQL table object */
TABLE* m_mysql_table;
};
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 5214953f308..d196a4d6db6 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -435,8 +435,6 @@ extern double srv_defragment_fill_factor;
extern uint srv_defragment_frequency;
extern ulonglong srv_defragment_interval;
-extern ulong srv_idle_flush_pct;
-
extern uint srv_change_buffer_max_size;
/* Number of IO operations per second the server can do */
@@ -621,9 +619,6 @@ extern struct export_var_t export_vars;
/** Global counters */
extern srv_stats_t srv_stats;
-/** Simulate compression failures. */
-extern uint srv_simulate_comp_failures;
-
/** Fatal semaphore wait threshold = maximum number of seconds
that semaphore times out in InnoDB */
#define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index b2a436804fe..855d4439280 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -508,7 +508,7 @@ the pass value == 0. */
ibool
rw_lock_own(
/*========*/
- rw_lock_t* lock, /*!< in: rw-lock */
+ const rw_lock_t*lock, /*!< in: rw-lock */
ulint lock_type) /*!< in: lock type: RW_LOCK_S,
RW_LOCK_X */
MY_ATTRIBUTE((warn_unused_result));
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 4161d4d8563..5354c77db25 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -875,6 +875,9 @@ public:
/** whether wsrep_on(mysql_thd) held at the start of transaction */
bool wsrep;
bool is_wsrep() const { return UNIV_UNLIKELY(wsrep); }
+ /** true, if BF thread is performing unique secondary index scanning */
+ bool wsrep_UK_scan;
+ bool is_wsrep_UK_scan() const { return UNIV_UNLIKELY(wsrep_UK_scan); }
#else /* WITH_WSREP */
bool is_wsrep() const { return false; }
#endif /* WITH_WSREP */
@@ -1113,20 +1116,6 @@ private:
during bulk create index */
FlushObserver* flush_observer;
public:
- /* Lock wait statistics */
- ulint n_rec_lock_waits;
- /*!< Number of record lock waits,
- might not be exactly correct. */
- ulint n_table_lock_waits;
- /*!< Number of table lock waits,
- might not be exactly correct. */
- ulint total_rec_lock_wait_time;
- /*!< Total rec lock wait time up
- to this moment. */
- ulint total_table_lock_wait_time;
- /*!< Total table lock wait time
- up to this moment. */
-
#ifdef WITH_WSREP
os_event_t wsrep_event; /* event waited for in srv_conc_slot */
#endif /* WITH_WSREP */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 7819b0ae92b..fcdc8a5ae9f 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 7
-#define INNODB_VERSION_BUGFIX 32
+#define INNODB_VERSION_BUGFIX 33
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 913c80027bf..506106a2269 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2020, MariaDB Corporation.
+Copyright (c) 2014, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -644,56 +644,81 @@ lock_rec_get_insert_intention(
return(lock->type_mode & LOCK_INSERT_INTENTION);
}
+#ifdef UNIV_DEBUG
#ifdef WITH_WSREP
-/** Check if both conflicting lock and other record lock are brute force
-(BF). This case is a bug so report lock information and wsrep state.
-@param[in] lock_rec1 conflicting waiting record lock or NULL
-@param[in] lock_rec2 other waiting record lock
-@param[in] trx1 lock_rec1 can be NULL, trx
+/** Check if both conflicting lock transaction and other transaction
+requesting record lock are brute force (BF). If they are check is
+this BF-BF wait correct and if not report BF wait and assert.
+
+@param[in] lock_rec other waiting record lock
+@param[in] trx trx requesting conflicting record lock
*/
-static void wsrep_assert_no_bf_bf_wait(
- const lock_t* lock_rec1,
- const lock_t* lock_rec2,
- const trx_t* trx1)
+static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx)
{
- ut_ad(!lock_rec1 || lock_get_type_low(lock_rec1) == LOCK_REC);
- ut_ad(lock_get_type_low(lock_rec2) == LOCK_REC);
+ ut_ad(lock_get_type_low(lock) == LOCK_REC);
+ ut_ad(lock_mutex_own());
+ trx_t* lock_trx= lock->trx;
- if (!trx1->is_wsrep() || !lock_rec2->trx->is_wsrep())
- return;
- if (UNIV_LIKELY(!wsrep_thd_is_BF(trx1->mysql_thd, FALSE)))
+ /* Note that we are holding lock_sys->mutex, thus we should
+ not acquire THD::LOCK_thd_data mutex below to avoid mutexing
+ order violation. */
+
+ if (!trx->is_wsrep() || !lock_trx->is_wsrep())
return;
- if (UNIV_LIKELY(!wsrep_thd_is_BF(lock_rec2->trx->mysql_thd, FALSE)))
+ if (UNIV_LIKELY(!wsrep_thd_is_BF(trx->mysql_thd, FALSE))
+ || UNIV_LIKELY(!wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE)))
return;
- mtr_t mtr;
+ ut_ad(trx->state == TRX_STATE_ACTIVE);
+
+ trx_mutex_enter(lock_trx);
+ const trx_state_t trx2_state= lock_trx->state;
+ trx_mutex_exit(lock_trx);
- if (lock_rec1) {
- ib::error() << "Waiting lock on table: "
- << lock_rec1->index->table->name
- << " index: "
- << lock_rec1->index->name()
- << " that has conflicting lock ";
- lock_rec_print(stderr, lock_rec1, mtr);
+ /* If transaction is already committed in memory or
+ prepared we should wait. When transaction is committed in
+ memory we held trx mutex, but not lock_sys->mutex. Therefore,
+ we could end here before transaction has time to do
+ lock_release() that is protected with lock_sys->mutex. */
+ switch (trx2_state) {
+ case TRX_STATE_COMMITTED_IN_MEMORY:
+ case TRX_STATE_PREPARED:
+ return;
+ case TRX_STATE_ACTIVE:
+ break;
+ default:
+ ut_ad("invalid state" == 0);
}
+ /* If BF - BF order is honored, i.e. trx already holding
+ record lock should be ordered before this new lock request
+ we can keep trx waiting for the lock. If conflicting
+ transaction is already aborting or rolling back for replaying
+ we can also let new transaction waiting. */
+ if (wsrep_trx_order_before(lock_trx->mysql_thd, trx->mysql_thd)
+ || wsrep_trx_is_aborting(lock_trx->mysql_thd))
+ return;
+
+ mtr_t mtr;
+
ib::error() << "Conflicting lock on table: "
- << lock_rec2->index->table->name
+ << lock->index->table->name
<< " index: "
- << lock_rec2->index->name()
+ << lock->index->name()
<< " that has lock ";
- lock_rec_print(stderr, lock_rec2, mtr);
+ lock_rec_print(stderr, lock, mtr);
ib::error() << "WSREP state: ";
- wsrep_report_bf_lock_wait(trx1->mysql_thd,
- trx1->id);
- wsrep_report_bf_lock_wait(lock_rec2->trx->mysql_thd,
- lock_rec2->trx->id);
+ wsrep_report_bf_lock_wait(trx->mysql_thd,
+ trx->id);
+ wsrep_report_bf_lock_wait(lock_trx->mysql_thd,
+ lock_trx->id);
/* BF-BF wait is a bug */
ut_error;
}
#endif /* WITH_WSREP */
+#endif /* UNIV_DEBUG */
/*********************************************************************//**
Checks if a lock request for a new lock has to wait for request lock2.
@@ -721,6 +746,7 @@ lock_rec_has_to_wait(
{
ut_ad(trx && lock2);
ut_ad(lock_get_type_low(lock2) == LOCK_REC);
+ ut_ad(lock_mutex_own());
if (trx != lock2->trx
&& !lock_mode_compatible(static_cast<lock_mode>(
@@ -802,9 +828,25 @@ lock_rec_has_to_wait(
}
#ifdef WITH_WSREP
- /* There should not be two conflicting locks that are
- brute force. If there is it is a bug. */
- wsrep_assert_no_bf_bf_wait(NULL, lock2, trx);
+ /* New lock request from a transaction is using unique key
+ scan and this transaction is a wsrep high priority transaction
+ (brute force). If conflicting transaction is also wsrep high
+ priority transaction we should avoid lock conflict because
+ ordering of these transactions is already decided and
+ conflicting transaction will be later replayed. Note
+ that thread holding conflicting lock can't be
+ committed or rolled back while we hold
+ lock_sys->mutex. */
+ if (trx->is_wsrep_UK_scan()
+ && wsrep_thd_is_BF(lock2->trx->mysql_thd, false)) {
+ return (FALSE);
+ }
+
+ /* We very well can let bf to wait normally as other
+ BF will be replayed in case of conflict. For debug
+ builds we will do additional sanity checks to catch
+ unsupported bf wait if any. */
+ ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx));
#endif /* WITH_WSREP */
return(TRUE);
@@ -1081,66 +1123,35 @@ lock_rec_other_has_expl_req(
#endif /* UNIV_DEBUG */
#ifdef WITH_WSREP
-static
-void
-wsrep_kill_victim(
-/*==============*/
- const trx_t * const trx,
- const lock_t *lock)
+static void wsrep_kill_victim(const trx_t * const trx, const lock_t *lock)
{
ut_ad(lock_mutex_own());
- ut_ad(trx_mutex_own(lock->trx));
+ ut_ad(trx->is_wsrep());
+ trx_t* lock_trx = lock->trx;
+ ut_ad(trx_mutex_own(lock_trx));
+ ut_ad(lock_trx != trx);
- /* quit for native mysql */
- if (!trx->is_wsrep()) return;
+ if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE))
+ return;
- my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
- my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE);
- mtr_t mtr;
+ if (lock_trx->state == TRX_STATE_COMMITTED_IN_MEMORY
+ || lock_trx->lock.was_chosen_as_deadlock_victim)
+ return;
- if ((bf_this && !bf_other) ||
- (bf_this && bf_other && wsrep_trx_order_before(
- trx->mysql_thd, lock->trx->mysql_thd))) {
+ my_bool bf_other = wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE);
- if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
- if (UNIV_UNLIKELY(wsrep_debug)) {
- ib::info() << "WSREP: BF victim waiting\n";
- }
+ if (!bf_other
+ || wsrep_trx_order_before(trx->mysql_thd,
+ lock_trx->mysql_thd)) {
+
+ if (lock_trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
+ if (UNIV_UNLIKELY(wsrep_debug))
+ WSREP_INFO("BF victim waiting");
/* cannot release lock, until our lock
is in the queue*/
- } else if (lock->trx != trx) {
- if (wsrep_log_conflicts) {
- if (bf_this) {
- ib::info() << "*** Priority TRANSACTION:";
- } else {
- ib::info() << "*** Victim TRANSACTION:";
- }
-
- wsrep_trx_print_locking(stderr, trx, 3000);
-
- if (bf_other) {
- ib::info() << "*** Priority TRANSACTION:";
- } else {
- ib::info() << "*** Victim TRANSACTION:";
- }
- wsrep_trx_print_locking(stderr, lock->trx, 3000);
-
- ib::info() << "*** WAITING FOR THIS LOCK TO BE GRANTED:";
-
- if (lock_get_type(lock) == LOCK_REC) {
- lock_rec_print(stderr, lock, mtr);
- } else {
- lock_table_print(stderr, lock);
- }
-
- ib::info() << " SQL1: "
- << wsrep_thd_query(trx->mysql_thd);
- ib::info() << " SQL2: "
- << wsrep_thd_query(lock->trx->mysql_thd);
- }
-
- wsrep_innobase_kill_one_trx(trx->mysql_thd,
- trx, lock->trx, TRUE);
+ } else {
+ wsrep_innobase_kill_one_trx(trx->mysql_thd, trx,
+ lock_trx, true);
}
}
}
@@ -1522,11 +1533,6 @@ lock_rec_create_low(
trx_mutex_exit(c_lock->trx);
- if (UNIV_UNLIKELY(wsrep_debug)) {
- wsrep_report_bf_lock_wait(trx->mysql_thd, trx->id);
- wsrep_report_bf_lock_wait(c_lock->trx->mysql_thd, c_lock->trx->id);
- }
-
/* have to bail out here to avoid lock_set_lock... */
return(lock);
}
@@ -2385,10 +2391,6 @@ static void lock_rec_dequeue_from_page(lock_t* in_lock)
/* Grant the lock */
ut_ad(lock->trx != in_lock->trx);
lock_grant(lock);
-#ifdef WITH_WSREP
- } else {
- wsrep_assert_no_bf_bf_wait(c, lock, c->trx);
-#endif /* WITH_WSREP */
}
}
} else {
@@ -4317,10 +4319,6 @@ released:
/* Grant the lock */
ut_ad(trx != lock->trx);
lock_grant(lock);
-#ifdef WITH_WSREP
- } else {
- wsrep_assert_no_bf_bf_wait(c, lock, c->trx);
-#endif /* WITH_WSREP */
}
}
} else {
@@ -5919,6 +5917,19 @@ lock_sec_rec_modify_check_and_lock(
heap_no = page_rec_get_heap_no(rec);
+#ifdef WITH_WSREP
+ trx_t *trx= thr_get_trx(thr);
+ /* If transaction scanning an unique secondary key is wsrep
+ high priority thread (brute force) this scanning may involve
+ GAP-locking in the index. As this locking happens also when
+ applying replication events in high priority applier threads,
+ there is a probability for lock conflicts between two wsrep
+ high priority threads. To avoid this GAP-locking we mark that
+ this transaction is using unique key scan here. */
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, false))
+ trx->wsrep_UK_scan= true;
+#endif /* WITH_WSREP */
+
/* Another transaction cannot have an implicit lock on the record,
because when we come here, we already have modified the clustered
index record, and this would not have been possible if another active
@@ -5934,6 +5945,9 @@ lock_sec_rec_modify_check_and_lock(
MONITOR_INC(MONITOR_NUM_RECLOCK_REQ);
lock_mutex_exit();
+#ifdef WITH_WSREP
+ trx->wsrep_UK_scan= false;
+#endif /* WITH_WSREP */
#ifdef UNIV_DEBUG
{
@@ -6023,6 +6037,18 @@ lock_sec_rec_read_check_and_lock(
lock_rec_convert_impl_to_expl(block, rec, index, offsets);
}
+#ifdef WITH_WSREP
+ trx_t *trx= thr_get_trx(thr);
+ /* If transaction scanning an unique secondary key is wsrep
+ high priority thread (brute force) this scanning may involve
+ GAP-locking in the index. As this locking happens also when
+ applying replication events in high priority applier threads,
+ there is a probability for lock conflicts between two wsrep
+ high priority threads. To avoid this GAP-locking we mark that
+ this transaction is using unique key scan here. */
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, false))
+ trx->wsrep_UK_scan= true;
+#endif /* WITH_WSREP */
lock_mutex_enter();
ut_ad(mode != LOCK_X
@@ -6036,6 +6062,9 @@ lock_sec_rec_read_check_and_lock(
MONITOR_INC(MONITOR_NUM_RECLOCK_REQ);
lock_mutex_exit();
+#ifdef WITH_WSREP
+ trx->wsrep_UK_scan= false;
+#endif /* WITH_WSREP */
ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets));
@@ -6444,6 +6473,7 @@ lock_cancel_waiting_and_release(
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx));
+ ut_ad(lock->trx->state == TRX_STATE_ACTIVE);
lock->trx->lock.cancel = true;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 446e0afe576..42b8e4dee88 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -320,8 +320,7 @@ public:
&mtr, NULL)) {
mutex_exit(&recv_sys->mutex);
ibuf_merge_or_delete_for_page(
- block, i->first,
- &block->page.size, true);
+ block, i->first, block->page.size);
mtr.commit();
mtr.start();
mutex_enter(&recv_sys->mutex);
@@ -2417,8 +2416,6 @@ void recv_apply_hashed_log_recs(bool last_batch)
recv_no_ibuf_operations
= !last_batch || is_mariabackup_restore_or_export();
- ut_d(recv_no_log_write = recv_no_ibuf_operations);
-
if (ulint n = recv_sys->n_addrs) {
const char* msg = last_batch
? "Starting final batch to recover "
@@ -2502,7 +2499,7 @@ apply:
/* Wait until all the pages have been processed */
- while (recv_sys->n_addrs != 0) {
+ while (recv_sys->n_addrs || buf_get_n_pending_read_ios()) {
const bool abort = recv_sys->found_corrupt_log
|| recv_sys->found_corrupt_fs;
@@ -4002,6 +3999,8 @@ skip_apply:
mutex_enter(&recv_sys->mutex);
recv_sys->apply_log_recs = TRUE;
+ recv_no_ibuf_operations = is_mariabackup_restore_or_export();
+ ut_d(recv_no_log_write = recv_no_ibuf_operations);
mutex_exit(&recv_sys->mutex);
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index bc30d6efd55..fefc0687ddb 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -308,24 +308,6 @@ struct DebugCheck {
};
#endif
-/** Find buffer fix count of the given block acquired by the
-mini-transaction */
-struct FindBlock
-{
- int32_t num_fix;
- const buf_block_t *const block;
-
- FindBlock(const buf_block_t *block_buf): num_fix(0), block(block_buf) {}
-
- bool operator()(const mtr_memo_slot_t* slot)
- {
- if (slot->object == block)
- ut_d(if (slot->type != MTR_MEMO_MODIFY))
- num_fix++;
- return true;
- }
-};
-
/** Release a resource acquired by the mini-transaction. */
struct ReleaseBlocks {
/** Release specific object */
@@ -822,12 +804,48 @@ mtr_t::release_free_extents(ulint n_reserved)
space->release_free_extents(n_reserved);
}
-int32_t mtr_t::get_fix_count(buf_block_t *block)
+/** Find out whether a block was not X-latched by the mini-transaction */
+struct FindBlockX
{
- Iterate<FindBlock> iteration((FindBlock(block)));
- if (m_memo.for_each_block(iteration))
- return iteration.functor.num_fix;
- return 0;
+ const buf_block_t &block;
+
+ FindBlockX(const buf_block_t &block): block(block) {}
+
+ /** @return whether the block was not found x-latched */
+ bool operator()(const mtr_memo_slot_t *slot) const
+ {
+ return slot->object != &block || slot->type != MTR_MEMO_PAGE_X_FIX;
+ }
+};
+
+#ifdef UNIV_DEBUG
+/** Assert that the block is not present in the mini-transaction */
+struct FindNoBlock
+{
+ const buf_block_t &block;
+
+ FindNoBlock(const buf_block_t &block): block(block) {}
+
+ /** @return whether the block was not found */
+ bool operator()(const mtr_memo_slot_t *slot) const
+ {
+ return slot->object != &block;
+ }
+};
+#endif /* UNIV_DEBUG */
+
+bool mtr_t::have_x_latch(const buf_block_t &block) const
+{
+ if (m_memo.for_each_block(CIterate<FindBlockX>(FindBlockX(block))))
+ {
+ ut_ad(m_memo.for_each_block(CIterate<FindNoBlock>(FindNoBlock(block))));
+ ut_ad(!memo_contains_flagged(&block,
+ MTR_MEMO_PAGE_S_FIX | MTR_MEMO_PAGE_SX_FIX |
+ MTR_MEMO_BUF_FIX | MTR_MEMO_MODIFY));
+ return false;
+ }
+ ut_ad(rw_lock_own(&block.lock, RW_LOCK_X));
+ return true;
}
#ifdef UNIV_DEBUG
@@ -844,15 +862,17 @@ mtr_t::memo_contains(
return(false);
}
+ const rw_lock_t *lock = static_cast<const rw_lock_t*>(object);
+
switch (type) {
case MTR_MEMO_X_LOCK:
- ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_X));
+ ut_ad(rw_lock_own(lock, RW_LOCK_X));
break;
case MTR_MEMO_SX_LOCK:
- ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_SX));
+ ut_ad(rw_lock_own(lock, RW_LOCK_SX));
break;
case MTR_MEMO_S_LOCK:
- ut_ad(rw_lock_own((rw_lock_t*) object, RW_LOCK_S));
+ ut_ad(rw_lock_own(lock, RW_LOCK_S));
break;
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 5c6da7ad51c..d2d5769d85e 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -3007,7 +3007,6 @@ os_file_create_func(
ut_a(type == OS_LOG_FILE
|| type == OS_DATA_FILE
- || type == OS_DATA_TEMP_FILE
|| type == OS_DATA_FILE_NO_O_DIRECT);
ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
@@ -3055,7 +3054,7 @@ os_file_create_func(
/* We disable OS caching (O_DIRECT) only on data files */
if (!read_only
&& *success
- && (type != OS_LOG_FILE && type != OS_DATA_TEMP_FILE
+ && (type != OS_LOG_FILE
&& type != OS_DATA_FILE_NO_O_DIRECT)
&& (srv_file_flush_method == SRV_O_DIRECT
|| srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC)) {
@@ -4306,7 +4305,9 @@ os_file_create_func(
case SRV_ALL_O_DIRECT_FSYNC:
/*Traditional Windows behavior, no buffering for any files.*/
- attributes |= FILE_FLAG_NO_BUFFERING;
+ if (type != OS_DATA_FILE_NO_O_DIRECT) {
+ attributes |= FILE_FLAG_NO_BUFFERING;
+ }
break;
case SRV_FSYNC:
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 9664bda6fea..1acbfd2e230 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -1372,33 +1372,6 @@ page_zip_compress(
MONITOR_INC(MONITOR_PAGE_COMPRESS);
- /* Simulate a compression failure with a probability determined by
- innodb_simulate_comp_failures, only if the page has 2 or more
- records. */
-
- if (srv_simulate_comp_failures
- && !dict_index_is_ibuf(index)
- && page_get_n_recs(page) >= 2
- && ((ulint)(rand() % 100) < srv_simulate_comp_failures)
- && strcasecmp(index->table_name, "IBUF_DUMMY") != 0) {
-
-#ifdef UNIV_DEBUG
- ib::error()
- << "Simulating a compression failure"
- << " for table " << index->table->name
- << " index "
- << index->name()
- << " page "
- << page_get_page_no(page)
- << "("
- << (page_is_leaf(page) ? "leaf" : "non-leaf")
- << ")";
-
-#endif
-
- goto err_exit;
- }
-
heap = mem_heap_create(page_zip_get_size(page_zip)
+ n_fields * (2 + sizeof(ulint))
+ REC_OFFS_HEADER_SIZE
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index 3ad948af4d2..0b630bb1c8c 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, 2020 MariaDB Corporation.
+Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -349,7 +349,6 @@ que_fork_start_command(
case QUE_THR_RUNNING:
case QUE_THR_LOCK_WAIT:
- case QUE_THR_PROCEDURE_WAIT:
ut_error;
}
}
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index 962de60f555..fa6a6c738e6 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -2283,9 +2283,24 @@ wsrep_rec_get_foreign_key(
break;
case DATA_BLOB:
case DATA_BINARY:
+ case DATA_FIXBINARY:
+ case DATA_GEOMETRY:
memcpy(buf, data, len);
break;
- default:
+
+ case DATA_FLOAT:
+ {
+ float f = mach_float_read(data);
+ memcpy(buf, &f, sizeof(float));
+ }
+ break;
+ case DATA_DOUBLE:
+ {
+ double d = mach_double_read(data);
+ memcpy(buf, &d, sizeof(double));
+ }
+ break;
+ default:
break;
}
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 981c5046de1..fa7db1e27b8 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -3375,6 +3375,57 @@ struct fil_iterator_t {
byte* crypt_io_buffer; /*!< IO buffer when encrypted */
};
+
+/** InnoDB writes page by page when there is page compressed
+tablespace involved. It does help to save the disk space when
+punch hole is enabled
+@param iter Tablespace iterator
+@param write_request Request to write into the file
+@param offset offset of the file to be written
+@param writeptr buffer to be written
+@param n_bytes number of bytes to be written
+@param try_punch_only Try the range punch only because the
+ current range is full of empty pages
+@return DB_SUCCESS */
+static
+dberr_t fil_import_compress_fwrite(const fil_iterator_t &iter,
+ const IORequest &write_request,
+ os_offset_t offset,
+ const byte *writeptr,
+ ulint n_bytes,
+ bool try_punch_only=false)
+{
+ dberr_t err= os_file_punch_hole(iter.file, offset, n_bytes);
+ if (err != DB_SUCCESS || try_punch_only)
+ return err;
+
+ for (ulint j= 0; j < n_bytes; j+= srv_page_size)
+ {
+ /* Read the original data length from block and
+ safer to read FIL_PAGE_COMPRESSED_SIZE because it
+ is not encrypted*/
+ ulint n_write_bytes= srv_page_size;
+ if (j || offset)
+ {
+ n_write_bytes= mach_read_from_2(writeptr + j + FIL_PAGE_DATA);
+ const unsigned ptype= mach_read_from_2(writeptr + j + FIL_PAGE_TYPE);
+ /* Ignore the empty page */
+ if (ptype == 0 && n_write_bytes == 0)
+ continue;
+ n_write_bytes+= FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
+ if (ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)
+ n_write_bytes+= FIL_PAGE_COMPRESSION_METHOD_SIZE;
+ }
+
+ err= os_file_write(write_request, iter.filepath, iter.file,
+ writeptr + j, offset + j, n_write_bytes);
+ if (err != DB_SUCCESS)
+ break;
+ }
+
+ return err;
+}
+
/********************************************************************//**
TODO: This can be made parallel trivially by chunking up the file and creating
a callback per thread. . Main benefit will be to use multiple CPUs for
@@ -3416,7 +3467,10 @@ fil_iterate(
/* TODO: For ROW_FORMAT=COMPRESSED tables we do a lot of useless
copying for non-index pages. Unfortunately, it is
required by buf_zip_decompress() */
- dberr_t err = DB_SUCCESS;
+ dberr_t err = DB_SUCCESS;
+ bool page_compressed = false;
+ bool punch_hole = true;
+ IORequest write_request(IORequest::WRITE);
for (offset = iter.start; offset < iter.end; offset += n_bytes) {
if (callback.is_interrupted()) {
@@ -3494,9 +3548,8 @@ page_corrupted:
goto func_exit;
}
- const bool page_compressed
- = fil_page_is_compressed_encrypted(src)
- || fil_page_is_compressed(src);
+ page_compressed= fil_page_is_compressed_encrypted(src)
+ || fil_page_is_compressed(src);
if (page_compressed && block->page.zip.data) {
goto page_corrupted;
@@ -3651,13 +3704,23 @@ not_encrypted:
}
}
- /* A page was updated in the set, write back to disk. */
- if (updated) {
- IORequest write_request(IORequest::WRITE);
+ if (page_compressed && punch_hole && srv_use_trim) {
+ err = fil_import_compress_fwrite(
+ iter, write_request, offset, writeptr, n_bytes,
+ !updated);
- err = os_file_write(write_request,
- iter.filepath, iter.file,
- writeptr, offset, n_bytes);
+ if (err != DB_SUCCESS) {
+ punch_hole = false;
+ if (updated) {
+ goto normal_write;
+ }
+ }
+ } else if (updated) {
+ /* A page was updated in the set, write back to disk. */
+normal_write:
+ err = os_file_write(
+ write_request, iter.filepath, iter.file,
+ writeptr, offset, n_bytes);
if (err != DB_SUCCESS) {
goto func_exit;
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index ca04be71953..635e7f659eb 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -931,7 +931,7 @@ row_ins_foreign_fill_virtual(
update->old_vrow = row_build(
ROW_COPY_DATA, index, rec,
offsets, index->table, NULL, NULL,
- &ext, cascade->heap);
+ &ext, update->heap);
n_diff = update->n_fields;
if (index->table->vc_templ == NULL) {
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 986cac54540..1a7652350a9 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -3001,7 +3001,6 @@ row_log_allocate(
log->path = path;
dict_index_set_online_status(index, ONLINE_INDEX_CREATION);
- index->online_log = log;
if (log_tmp_is_encrypted()) {
ulint size = srv_sort_buf_size;
@@ -3014,6 +3013,7 @@ row_log_allocate(
}
}
+ index->online_log = log;
/* While we might be holding an exclusive data dictionary lock
here, in row_log_abort_sec() we will not always be holding it. Use
atomic operations in both cases. */
@@ -3027,7 +3027,7 @@ Free the row log for an index that was being created online. */
void
row_log_free(
/*=========*/
- row_log_t*& log) /*!< in,own: row log */
+ row_log_t* log) /*!< in,own: row log */
{
MONITOR_ATOMIC_DEC(MONITOR_ONLINE_CREATE_INDEX);
@@ -3046,7 +3046,6 @@ row_log_free(
mutex_free(&log->mutex);
ut_free(log);
- log = NULL;
}
/******************************************************//**
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 6571a7fbfec..835d74043fd 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -3768,6 +3768,8 @@ row_merge_drop_indexes(
ut_ad(prev);
ut_a(table->fts);
fts_drop_index(table, index, trx);
+ row_merge_drop_index_dict(
+ trx, index->id);
/* We can remove a DICT_FTS
index from the cache, because
we do not allow ADD FULLTEXT INDEX
@@ -4833,10 +4835,6 @@ wait_again:
buf, i + 1, n_indexes);
}
- DBUG_EXECUTE_IF(
- "ib_merge_wait_after_sort",
- os_thread_sleep(20000000);); /* 20 sec */
-
if (error == DB_SUCCESS) {
BtrBulk btr_bulk(sort_idx, trx,
trx->get_flush_observer());
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 312c35c58a3..c2f9186d408 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -958,9 +958,6 @@ row_create_prebuilt(
prebuilt->fts_doc_id_in_read_set = 0;
prebuilt->blob_heap = NULL;
- prebuilt->m_no_prefetch = false;
- prebuilt->m_read_virtual_key = false;
-
DBUG_RETURN(prebuilt);
}
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 0451a240ffc..864f7bd54ab 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3168,8 +3168,7 @@ static bool row_sel_store_mysql_rec(
search or virtual key read is not requested. */
if (!rec_clust
|| !prebuilt->index->has_virtual()
- || (!prebuilt->read_just_key
- && !prebuilt->m_read_virtual_key)) {
+ || !prebuilt->read_just_key) {
/* Initialize the NULL bit. */
mysql_rec[templ->mysql_null_byte_offset]
|= (byte) templ->mysql_null_bit_mask;
@@ -3185,23 +3184,8 @@ static bool row_sel_store_mysql_rec(
const dfield_t* dfield = dtuple_get_nth_v_field(
vrow, col->v_pos);
- /* If this is a partitioned table, it might request
- InnoDB to fill out virtual column data for serach
- index key values while other non key columns are also
- getting selected. The non-key virtual columns may
- not be materialized and we should skip them. */
if (dfield_get_type(dfield)->mtype == DATA_MISSING) {
-#ifdef UNIV_DEBUG
- ulint prefix;
-#endif /* UNIV_DEBUG */
- ut_ad(prebuilt->m_read_virtual_key);
-
- /* If it is part of index key the data should
- have been materialized. */
- ut_ad(dict_index_get_nth_col_or_prefix_pos(
- prebuilt->index, col->v_pos, false,
- true, &prefix) == ULINT_UNDEFINED);
-
+ ut_ad("no ha_innopart in MariaDB" == 0);
continue;
}
@@ -4377,8 +4361,7 @@ row_search_mvcc(
index key, if this is covered index scan or virtual key read is
requested. */
bool need_vrow = dict_index_has_virtual(prebuilt->index)
- && (prebuilt->read_just_key
- || prebuilt->m_read_virtual_key);
+ && prebuilt->read_just_key;
/* Reset the new record lock info if srv_locks_unsafe_for_binlog
is set or session is using a READ COMMITED isolation level. Then
@@ -5524,7 +5507,6 @@ use_covering_index:
if ((match_mode == ROW_SEL_EXACT
|| prebuilt->n_rows_fetched >= MYSQL_FETCH_CACHE_THRESHOLD)
&& prebuilt->select_lock_type == LOCK_NONE
- && !prebuilt->m_no_prefetch
&& !prebuilt->templ_contains_blob
&& !prebuilt->clust_index_was_generated
&& !prebuilt->used_in_HANDLER
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 10156c7d3ab..4b81d1478b0 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -126,25 +126,23 @@ NOTE that since we do not hold dict_operation_lock when leaving the
function, it may be that the referencing table has been dropped when
we leave this function: this function is only for heuristic use!
-@return TRUE if referenced */
+@return true if referenced */
static
-ibool
+bool
row_upd_index_is_referenced(
/*========================*/
dict_index_t* index, /*!< in: index */
trx_t* trx) /*!< in: transaction */
{
dict_table_t* table = index->table;
- ibool froze_data_dict = FALSE;
- ibool is_referenced = FALSE;
if (table->referenced_set.empty()) {
- return(FALSE);
+ return false;
}
- if (trx->dict_operation_lock_mode == 0) {
+ const bool froze_data_dict = !trx->dict_operation_lock_mode;
+ if (froze_data_dict) {
row_mysql_freeze_data_dictionary(trx);
- froze_data_dict = TRUE;
}
dict_foreign_set::iterator it
@@ -152,13 +150,13 @@ row_upd_index_is_referenced(
table->referenced_set.end(),
dict_foreign_with_index(index));
- is_referenced = (it != table->referenced_set.end());
+ const bool is_referenced = (it != table->referenced_set.end());
if (froze_data_dict) {
row_mysql_unfreeze_data_dictionary(trx);
}
- return(is_referenced);
+ return is_referenced;
}
#ifdef WITH_WSREP
@@ -2278,7 +2276,6 @@ row_upd_sec_index_entry(
dtuple_t* entry;
dict_index_t* index;
btr_cur_t* btr_cur;
- ibool referenced;
dberr_t err = DB_SUCCESS;
trx_t* trx = thr_get_trx(thr);
ulint mode;
@@ -2289,7 +2286,7 @@ row_upd_sec_index_entry(
index = node->index;
- referenced = row_upd_index_is_referenced(index, trx);
+ const bool referenced = row_upd_index_is_referenced(index, trx);
#ifdef WITH_WSREP
bool foreign = wsrep_row_upd_index_is_foreign(index, trx);
#endif /* WITH_WSREP */
@@ -2320,7 +2317,9 @@ row_upd_sec_index_entry(
break;
}
- if (!index->is_committed()) {
+ bool uncommitted = !index->is_committed();
+
+ if (uncommitted) {
/* The index->online_status may change if the index is
or was being created online, but not committed yet. It
is protected by index->lock. */
@@ -2517,11 +2516,38 @@ row_upd_sec_index_entry(
mem_heap_empty(heap);
+ DEBUG_SYNC_C_IF_THD(trx->mysql_thd,
+ "before_row_upd_sec_new_index_entry");
+
+ uncommitted = !index->is_committed();
+ if (uncommitted) {
+ mtr.start();
+ /* The index->online_status may change if the index is
+ being rollbacked. It is protected by index->lock. */
+
+ mtr_s_lock(dict_index_get_lock(index), &mtr);
+
+ switch (dict_index_get_online_status(index)) {
+ case ONLINE_INDEX_COMPLETE:
+ case ONLINE_INDEX_CREATION:
+ break;
+ case ONLINE_INDEX_ABORTED:
+ case ONLINE_INDEX_ABORTED_DROPPED:
+ mtr_commit(&mtr);
+ goto func_exit;
+ }
+
+ }
+
/* Build a new index entry */
entry = row_build_index_entry(node->upd_row, node->upd_ext,
index, heap);
ut_a(entry);
+ if (uncommitted) {
+ mtr_commit(&mtr);
+ }
+
/* Insert new index entry */
err = row_ins_sec_index_entry(index, entry, thr);
@@ -2661,12 +2687,13 @@ row_upd_clust_rec_by_insert(
upd_node_t* node, /*!< in/out: row update node */
dict_index_t* index, /*!< in: clustered index of the record */
que_thr_t* thr, /*!< in: query thread */
- ibool referenced,/*!< in: TRUE if index may be referenced in
+ bool referenced,/*!< in: whether index may be referenced in
a foreign key constraint */
#ifdef WITH_WSREP
bool foreign,/*!< in: whether this is a foreign key */
#endif
- mtr_t* mtr) /*!< in/out: mtr; gets committed here */
+ mtr_t* mtr) /*!< in/out: mini-transaction,
+ may be committed and restarted */
{
mem_heap_t* heap;
btr_pcur_t* pcur;
@@ -2731,10 +2758,7 @@ row_upd_clust_rec_by_insert(
btr_cur_get_block(btr_cur), rec, index, offsets,
thr, node->row, mtr);
if (err != DB_SUCCESS) {
-err_exit:
- mtr_commit(mtr);
- mem_heap_free(heap);
- return(err);
+ goto err_exit;
}
/* If the the new row inherits externally stored
@@ -2793,14 +2817,14 @@ check_fk:
}
}
- mtr_commit(mtr);
+ mtr->commit();
+ mtr->start();
+ node->state = UPD_NODE_INSERT_CLUSTERED;
err = row_ins_clust_index_entry(
index, entry, thr, dtuple_get_n_ext(entry));
- node->state = UPD_NODE_INSERT_CLUSTERED;
-
+err_exit:
mem_heap_free(heap);
-
return(err);
}
@@ -2820,7 +2844,8 @@ row_upd_clust_rec(
mem_heap_t** offsets_heap,
/*!< in/out: memory heap, can be emptied */
que_thr_t* thr, /*!< in: query thread */
- mtr_t* mtr) /*!< in: mtr; gets committed here */
+ mtr_t* mtr) /*!< in,out: mini-transaction; may be
+ committed and restarted here */
{
mem_heap_t* heap = NULL;
big_rec_t* big_rec = NULL;
@@ -2866,16 +2891,15 @@ row_upd_clust_rec(
goto success;
}
- mtr_commit(mtr);
-
if (buf_LRU_buf_pool_running_out()) {
-
err = DB_LOCK_TABLE_FULL;
goto func_exit;
}
+
/* We may have to modify the tree structure: do a pessimistic descent
down the index tree */
+ mtr->commit();
mtr->start();
if (index->table->is_temporary()) {
@@ -2925,7 +2949,6 @@ success:
}
}
- mtr_commit(mtr);
func_exit:
if (heap) {
mem_heap_free(heap);
@@ -2950,17 +2973,17 @@ row_upd_del_mark_clust_rec(
rec_offs* offsets,/*!< in/out: rec_get_offsets() for the
record under the cursor */
que_thr_t* thr, /*!< in: query thread */
- ibool referenced,
- /*!< in: TRUE if index may be referenced in
+ bool referenced,
+ /*!< in: whether index may be referenced in
a foreign key constraint */
#ifdef WITH_WSREP
bool foreign,/*!< in: whether this is a foreign key */
#endif
- mtr_t* mtr) /*!< in: mtr; gets committed here */
+ mtr_t* mtr) /*!< in,out: mini-transaction;
+ will be committed and restarted */
{
btr_pcur_t* pcur;
btr_cur_t* btr_cur;
- dberr_t err;
rec_t* rec;
trx_t* trx = thr_get_trx(thr);
@@ -2976,8 +2999,7 @@ row_upd_del_mark_clust_rec(
if (!row_upd_store_row(node, trx->mysql_thd,
thr->prebuilt && thr->prebuilt->table == node->table
? thr->prebuilt->m_mysql_table : NULL)) {
- err = DB_COMPUTE_VALUE_FAILED;
- return err;
+ return DB_COMPUTE_VALUE_FAILED;
}
/* Mark the clustered index record deleted; we do not have to check
@@ -2985,7 +3007,7 @@ row_upd_del_mark_clust_rec(
rec = btr_cur_get_rec(btr_cur);
- err = btr_cur_del_mark_set_clust_rec(
+ dberr_t err = btr_cur_del_mark_set_clust_rec(
btr_cur_get_block(btr_cur), rec,
index, offsets, thr, node->row, mtr);
@@ -3022,8 +3044,6 @@ row_upd_del_mark_clust_rec(
#endif /* WITH_WSREP */
}
- mtr_commit(mtr);
-
return(err);
}
@@ -3040,22 +3060,19 @@ row_upd_clust_step(
{
dict_index_t* index;
btr_pcur_t* pcur;
- ibool success;
dberr_t err;
mtr_t mtr;
rec_t* rec;
mem_heap_t* heap = NULL;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets;
- ibool referenced;
trx_t* trx = thr_get_trx(thr);
rec_offs_init(offsets_);
index = dict_table_get_first_index(node->table);
- referenced = row_upd_index_is_referenced(index, trx);
-
+ const bool referenced = row_upd_index_is_referenced(index, trx);
#ifdef WITH_WSREP
const bool foreign = wsrep_row_upd_index_is_foreign(index, trx);
#endif
@@ -3096,14 +3113,9 @@ row_upd_clust_step(
mode = BTR_MODIFY_LEAF;
}
- success = btr_pcur_restore_position(mode, pcur, &mtr);
-
- if (!success) {
+ if (!btr_pcur_restore_position(mode, pcur, &mtr)) {
err = DB_RECORD_NOT_FOUND;
-
- mtr_commit(&mtr);
-
- return(err);
+ goto exit_func;
}
/* If this is a row in SYS_INDEXES table of the data dictionary,
@@ -3122,14 +3134,9 @@ row_upd_clust_step(
mtr.start();
mtr.set_named_space(index->space);
- success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur,
- &mtr);
- if (!success) {
+ if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, &mtr)) {
err = DB_ERROR;
-
- mtr.commit();
-
- return(err);
+ goto exit_func;
}
}
@@ -3142,7 +3149,6 @@ row_upd_clust_step(
0, btr_pcur_get_block(pcur),
rec, index, offsets, thr);
if (err != DB_SUCCESS) {
- mtr.commit();
goto exit_func;
}
}
@@ -3151,8 +3157,6 @@ row_upd_clust_step(
btr_pcur_get_block(pcur),
page_rec_get_heap_no(rec)));
- /* NOTE: the following function calls will also commit mtr */
-
if (node->is_delete) {
err = row_upd_del_mark_clust_rec(
node, index, offsets, thr, referenced,
@@ -3160,13 +3164,7 @@ row_upd_clust_step(
foreign,
#endif
&mtr);
-
- if (err == DB_SUCCESS) {
- node->state = UPD_NODE_UPDATE_ALL_SEC;
- node->index = dict_table_get_next_index(index);
- }
-
- goto exit_func;
+ goto all_done;
}
/* If the update is made for MySQL, we already have the update vector
@@ -3181,14 +3179,13 @@ row_upd_clust_step(
}
if (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE) {
-
err = row_upd_clust_rec(
flags, node, index, offsets, &heap, thr, &mtr);
goto exit_func;
}
- if(!row_upd_store_row(node, trx->mysql_thd,
- thr->prebuilt ? thr->prebuilt->m_mysql_table : NULL)) {
+ if (!row_upd_store_row(node, trx->mysql_thd, thr->prebuilt
+ ? thr->prebuilt->m_mysql_table : NULL)) {
err = DB_COMPUTE_VALUE_FAILED;
goto exit_func;
}
@@ -3213,31 +3210,29 @@ row_upd_clust_step(
foreign,
#endif
&mtr);
- if (err != DB_SUCCESS) {
-
- goto exit_func;
+all_done:
+ if (err == DB_SUCCESS) {
+ node->state = UPD_NODE_UPDATE_ALL_SEC;
+success:
+ node->index = dict_table_get_next_index(index);
}
-
- node->state = UPD_NODE_UPDATE_ALL_SEC;
} else {
err = row_upd_clust_rec(
flags, node, index, offsets, &heap, thr, &mtr);
- if (err != DB_SUCCESS) {
-
- goto exit_func;
+ if (err == DB_SUCCESS) {
+ ut_ad(!node->is_delete);
+ node->state = UPD_NODE_UPDATE_SOME_SEC;
+ goto success;
}
-
- node->state = UPD_NODE_UPDATE_SOME_SEC;
}
- node->index = dict_table_get_next_index(index);
-
exit_func:
- if (heap) {
+ mtr.commit();
+ if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- return(err);
+ return err;
}
/***********************************************************//**
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index f1216dcd51e..44e0946f067 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -272,9 +272,6 @@ ulong srv_buf_pool_dump_pct;
/** Lock table size in bytes */
ulint srv_lock_table_size = ULINT_MAX;
-/** innodb_idle_flush_pct */
-ulong srv_idle_flush_pct;
-
/** copy of innodb_read_io_threads */
ulint srv_n_read_io_threads;
/** copy of innodb_write_io_threads */
@@ -512,9 +509,6 @@ current_time % 5 != 0. */
#endif /* MEM_PERIODIC_CHECK */
# define SRV_MASTER_DICT_LRU_INTERVAL (47)
-/** Simulate compression failures. */
-UNIV_INTERN uint srv_simulate_comp_failures;
-
/** Buffer pool dump status frequence in percentages */
UNIV_INTERN ulong srv_buf_dump_status_frequency;
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 0d8ebbe98cd..9548730b359 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2322,7 +2322,7 @@ files_checked:
to the data files and truncate or delete the log.
Unless --export is specified, no further change to
InnoDB files is needed. */
- ut_ad(!srv_force_recovery);
+ ut_ad(srv_force_recovery <= SRV_FORCE_IGNORE_CORRUPT);
ut_ad(srv_n_log_files_found <= 1);
ut_ad(recv_no_log_write);
buf_flush_sync_all_buf_pools();
@@ -2913,6 +2913,17 @@ innodb_shutdown()
fclose(dict_foreign_err_file);
}
+ srv_sys_space.shutdown();
+ if (srv_tmp_space.get_sanity_check_status()) {
+ fil_space_close(srv_tmp_space.name());
+ srv_tmp_space.delete_files();
+ }
+ srv_tmp_space.shutdown();
+
+#ifdef WITH_INNODB_DISALLOW_WRITES
+ os_event_destroy(srv_allow_writes_event);
+#endif /* WITH_INNODB_DISALLOW_WRITES */
+
if (srv_was_started && srv_print_verbose_log) {
ib::info() << "Shutdown completed; log sequence number "
<< srv_shutdown_lsn;
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index b46126bde58..ded4f44c2a9 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -990,7 +990,7 @@ the pass value == 0.
ibool
rw_lock_own(
/*========*/
- rw_lock_t* lock, /*!< in: rw-lock */
+ const rw_lock_t*lock, /*!< in: rw-lock */
ulint lock_type) /*!< in: lock type: RW_LOCK_S,
RW_LOCK_X */
{
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 4aecc8ae610..e3e1c33b305 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -128,20 +128,18 @@ trx_undo_parse_add_undo_rec(
return(ptr + len);
}
-/**********************************************************************//**
-Calculates the free space left for extending an undo log record.
+/** Calculate the free space left for extending an undo log record.
+@param page undo log page
+@param ptr current end of the undo page
@return bytes left */
-UNIV_INLINE
-ulint
-trx_undo_left(
-/*==========*/
- const page_t* page, /*!< in: undo log page */
- const byte* ptr) /*!< in: pointer to page */
+static ulint trx_undo_left(const page_t *page, const byte *ptr)
{
- /* The '- 10' is a safety margin, in case we have some small
- calculation error below */
-
- return(UNIV_PAGE_SIZE - (ptr - page) - 10 - FIL_PAGE_DATA_END);
+ ut_ad(ptr >= &page[TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE]);
+ /* The 10 is supposed to be an extra safety margin (and needed for
+ compatibility with older versions) */
+ lint left= srv_page_size - (ptr - page) - (10 + FIL_PAGE_DATA_END);
+ ut_ad(left >= 0);
+ return left < 0 ? 0 : static_cast<ulint>(left);
}
/**********************************************************************//**
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 13b4efb973b..42bd67cb24b 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2020, MariaDB Corporation.
+Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -154,6 +154,11 @@ trx_init(
trx->lock.rec_cached = 0;
trx->lock.table_cached = 0;
+#ifdef WITH_WSREP
+ ut_ad(!trx->wsrep);
+ ut_ad(!trx->wsrep_event);
+ ut_ad(!trx->wsrep_UK_scan);
+#endif /* WITH_WSREP */
ut_ad(trx->get_flush_observer() == NULL);
}
@@ -355,6 +360,7 @@ trx_t *trx_allocate_for_background()
#ifdef WITH_WSREP
trx->wsrep_event = NULL;
+ ut_ad(!trx->wsrep_UK_scan);
#endif /* WITH_WSREP */
return(trx);
@@ -393,7 +399,7 @@ inline void trx_t::free()
/* do not poison mutex */
MEM_NOACCESS(&id, sizeof id);
MEM_NOACCESS(&no, sizeof no);
- /* state is accessed by innobase_kill_connection() */
+ MEM_NOACCESS(&state, sizeof state);
MEM_NOACCESS(&is_recovered, sizeof is_recovered);
#ifdef WITH_WSREP
MEM_NOACCESS(&wsrep, sizeof wsrep);
@@ -419,7 +425,7 @@ inline void trx_t::free()
MEM_NOACCESS(&start_time_micro, sizeof start_time_micro);
MEM_NOACCESS(&commit_lsn, sizeof commit_lsn);
MEM_NOACCESS(&table_id, sizeof table_id);
- /* mysql_thd is accessed by innobase_kill_connection() */
+ MEM_NOACCESS(&mysql_thd, sizeof mysql_thd);
MEM_NOACCESS(&mysql_log_file_name, sizeof mysql_log_file_name);
MEM_NOACCESS(&mysql_log_offset, sizeof mysql_log_offset);
MEM_NOACCESS(&n_mysql_tables_in_use, sizeof n_mysql_tables_in_use);
@@ -464,12 +470,10 @@ inline void trx_t::free()
MEM_NOACCESS(&mod_tables, sizeof mod_tables);
MEM_NOACCESS(&detailed_error, sizeof detailed_error);
MEM_NOACCESS(&flush_observer, sizeof flush_observer);
- MEM_NOACCESS(&n_rec_lock_waits, sizeof n_rec_lock_waits);
- MEM_NOACCESS(&n_table_lock_waits, sizeof n_table_lock_waits);
- MEM_NOACCESS(&total_rec_lock_wait_time, sizeof total_rec_lock_wait_time);
- MEM_NOACCESS(&total_table_lock_wait_time, sizeof total_table_lock_wait_time);
#ifdef WITH_WSREP
MEM_NOACCESS(&wsrep_event, sizeof wsrep_event);
+ ut_ad(!wsrep_UK_scan);
+ MEM_NOACCESS(&wsrep_UK_scan, sizeof wsrep_UK_scan);
#endif /* WITH_WSREP */
MEM_NOACCESS(&magic_n, sizeof magic_n);
trx_pools->mem_free(this);
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index 3b617f625f0..9443ba90f6c 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -95,7 +95,6 @@ void eprint(FILE *trace_file __attribute__ ((unused)),
fputc('\n', trace_file);
if (trace_file != stderr)
{
- va_start(args, format);
my_printv_error(HA_ERR_INITIALIZATION, format, MYF(0), args);
}
va_end(args);
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 06ff71c1b5a..1025b70156f 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -5910,7 +5910,7 @@ int ha_mroonga::wrapper_write_row_index(uchar *buf)
DBUG_RETURN(0);
}
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
@@ -5985,7 +5985,7 @@ int ha_mroonga::storage_write_row(uchar *buf)
DBUG_RETURN(error);
}
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
for (i = 0; i < n_columns; i++) {
Field *field = table->field[i];
@@ -6266,7 +6266,7 @@ int ha_mroonga::storage_write_row_multiple_column_indexes(uchar *buf,
int error = 0;
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
@@ -6558,7 +6558,7 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data)
DBUG_RETURN(0);
}
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
@@ -6678,7 +6678,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
grn_obj new_value;
GRN_VOID_INIT(&new_value);
{
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
generic_store_bulk(field, &new_value);
}
grn_obj casted_value;
@@ -6707,7 +6707,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
storage_store_fields_for_prep_update(old_data, new_data, record_id);
{
mrn::Lock lock(&(share->record_mutex), have_unique_index());
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
if ((error = storage_prepare_delete_row_unique_indexes(old_data,
record_id))) {
DBUG_RETURN(error);
@@ -6732,7 +6732,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
#endif
if (bitmap_is_set(table->write_set, field->field_index)) {
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
DBUG_PRINT("info", ("mroonga: update column %d(%d)",i,field->field_index));
if (field->is_null()) continue;
@@ -6809,7 +6809,7 @@ int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data)
if (table->found_next_number_field &&
!table->s->next_number_keypart &&
new_data == table->record[0]) {
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
Field_num *field = (Field_num *) table->found_next_number_field;
if (field->unsigned_flag || field->val_int() > 0) {
MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share;
@@ -6865,7 +6865,7 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data, uchar *new_data)
my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(old_data, table->record[0]);
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
uint i;
uint n_keys = table->s->keys;
mrn_change_encoding(ctx, NULL);
@@ -7081,7 +7081,7 @@ int ha_mroonga::wrapper_delete_row_index(const uchar *buf)
DBUG_RETURN(0);
}
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
uint i;
uint n_keys = table->s->keys;
for (i = 0; i < n_keys; i++) {
@@ -7232,7 +7232,7 @@ int ha_mroonga::storage_delete_row_index(const uchar *buf)
GRN_TEXT_INIT(&key, 0);
GRN_TEXT_INIT(&encoded_key, 0);
- mrn::DebugColumnAccess debug_column_access(table, table->read_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->read_set);
uint i;
uint n_keys = table->s->keys;
mrn_change_encoding(ctx, NULL);
@@ -11420,7 +11420,7 @@ void ha_mroonga::storage_store_fields(uchar *buf, grn_id record_id)
}
}
- mrn::DebugColumnAccess debug_column_access(table, table->write_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->write_set);
DBUG_PRINT("info", ("mroonga: store column %d(%d)",i,field->field_index));
field->move_field_offset(ptr_diff);
if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) {
@@ -11485,7 +11485,7 @@ void ha_mroonga::storage_store_fields_for_prep_update(const uchar *old_data,
)
#endif
) {
- mrn::DebugColumnAccess debug_column_access(table, table->write_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->write_set);
DBUG_PRINT("info", ("mroonga: store column %d(%d)",i,field->field_index));
grn_obj value;
GRN_OBJ_INIT(&value, GRN_BULK, 0, grn_obj_get_range(ctx, grn_columns[i]));
@@ -11521,7 +11521,7 @@ void ha_mroonga::storage_store_fields_by_index(uchar *buf)
if (KEY_N_KEY_PARTS(key_info) == 1) {
my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(buf, table->record[0]);
Field *field = key_info->key_part->field;
- mrn::DebugColumnAccess debug_column_access(table, table->write_set);
+ mrn::DebugColumnAccess debug_column_access(table, &table->write_set);
field->move_field_offset(ptr_diff);
storage_store_field(field, (const char *)key, key_length);
field->move_field_offset(-ptr_diff);
diff --git a/storage/mroonga/lib/mrn_debug_column_access.cpp b/storage/mroonga/lib/mrn_debug_column_access.cpp
index 5b89baba485..4c88d7b3e64 100644
--- a/storage/mroonga/lib/mrn_debug_column_access.cpp
+++ b/storage/mroonga/lib/mrn_debug_column_access.cpp
@@ -20,7 +20,7 @@
#include "mrn_debug_column_access.hpp"
namespace mrn {
- DebugColumnAccess::DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap)
+ DebugColumnAccess::DebugColumnAccess(TABLE *table, MY_BITMAP **bitmap)
: table_(table),
bitmap_(bitmap) {
#ifndef DBUG_OFF
diff --git a/storage/mroonga/lib/mrn_debug_column_access.hpp b/storage/mroonga/lib/mrn_debug_column_access.hpp
index be8054efb9e..9f85b831def 100644
--- a/storage/mroonga/lib/mrn_debug_column_access.hpp
+++ b/storage/mroonga/lib/mrn_debug_column_access.hpp
@@ -25,12 +25,12 @@
namespace mrn {
class DebugColumnAccess {
TABLE *table_;
- MY_BITMAP *bitmap_;
+ MY_BITMAP **bitmap_;
#ifndef DBUG_OFF
- my_bitmap_map *map_;
+ MY_BITMAP *map_;
#endif
public:
- DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap);
+ DebugColumnAccess(TABLE *table, MY_BITMAP **bitmap);
~DebugColumnAccess();
};
}
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index 9247fae9e3c..1298232b5fa 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -144,8 +144,11 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
- key+= char_length;
+ if (char_length)
+ {
+ memcpy(key, pos, char_length);
+ key+= char_length;
+ }
continue;
}
else if (keyseg->flag & HA_SWAP_KEY)
diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt
index 613a44807c7..3be197f7106 100644
--- a/storage/oqgraph/CMakeLists.txt
+++ b/storage/oqgraph/CMakeLists.txt
@@ -39,6 +39,10 @@ int main() { return 0; }
ENDIF()
ENDFUNCTION()
+IF(PLUGIN_OQGRAPH STREQUAL "NO")
+ RETURN()
+ENDIF()
+
IF(NOT DEFINED OQGRAPH_OK)
CHECK_OQGRAPH()
IF (NOT OQGRAPH_OK)
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 350a4c3b5ff..c75beb36297 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -907,7 +907,7 @@ int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
bmove_align(buf, table->s->default_values, table->s->reclength);
key_restore(buf, (byte*) key, key_info, key_len);
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->read_set);
my_ptrdiff_t ptrdiff= buf - table->record[0];
if (ptrdiff)
@@ -936,7 +936,7 @@ int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
field[1]->move_field_offset(-ptrdiff);
field[2]->move_field_offset(-ptrdiff);
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
return error_code(oqgraph::NO_MORE_DATA);
}
}
@@ -961,7 +961,7 @@ int ha_oqgraph::index_read_idx(byte * buf, uint index, const byte * key,
field[1]->move_field_offset(-ptrdiff);
field[2]->move_field_offset(-ptrdiff);
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
// Keep the latch around so we can use it in the query result later -
// See fill_record().
@@ -994,7 +994,7 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
bmove_align(record, table->s->default_values, table->s->reclength);
- my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
my_ptrdiff_t ptrdiff= record - table->record[0];
if (ptrdiff)
@@ -1070,7 +1070,7 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
field[4]->move_field_offset(-ptrdiff);
field[5]->move_field_offset(-ptrdiff);
}
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return 0;
}
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 08c0fe8ecfe..7fa217d538b 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -188,17 +188,15 @@ ha_rows PFS_engine_table_share::get_row_count(void) const
int PFS_engine_table_share::write_row(TABLE *table, unsigned char *buf,
Field **fields) const
{
- my_bitmap_map *org_bitmap;
-
if (m_write_row == NULL)
{
return HA_ERR_WRONG_COMMAND;
}
/* We internally read from Fields to support the write interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
int result= m_write_row(table, buf, fields);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return result;
}
@@ -256,7 +254,6 @@ int PFS_engine_table::read_row(TABLE *table,
unsigned char *buf,
Field **fields)
{
- my_bitmap_map *org_bitmap;
Field *f;
Field **fields_reset;
@@ -264,7 +261,7 @@ int PFS_engine_table::read_row(TABLE *table,
bool read_all= !bitmap_is_clear_all(table->write_set);
/* We internally write to Fields to support the read interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->write_set);
/*
Some callers of the storage engine interface do not honor the
@@ -276,7 +273,7 @@ int PFS_engine_table::read_row(TABLE *table,
f->reset();
int result= read_row_values(table, buf, fields, read_all);
- dbug_tmp_restore_column_map(table->write_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->write_set, org_bitmap);
return result;
}
@@ -294,12 +291,10 @@ int PFS_engine_table::update_row(TABLE *table,
unsigned char *new_buf,
Field **fields)
{
- my_bitmap_map *org_bitmap;
-
/* We internally read from Fields to support the write interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
int result= update_row_values(table, old_buf, new_buf, fields);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return result;
}
@@ -308,12 +303,10 @@ int PFS_engine_table::delete_row(TABLE *table,
const unsigned char *buf,
Field **fields)
{
- my_bitmap_map *org_bitmap;
-
/* We internally read from Fields to support the delete interface */
- org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->read_set);
int result= delete_row_values(table, buf, fields);
- dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+ dbug_tmp_restore_column_map(&table->read_set, org_bitmap);
return result;
}
diff --git a/storage/perfschema/pfs_setup_object.cc b/storage/perfschema/pfs_setup_object.cc
index f33030e927f..8da9fccc65f 100644
--- a/storage/perfschema/pfs_setup_object.cc
+++ b/storage/perfschema/pfs_setup_object.cc
@@ -144,12 +144,18 @@ static void set_setup_object_key(PFS_setup_object_key *key,
char *ptr= &key->m_hash_key[0];
ptr[0]= (char) object_type;
ptr++;
- memcpy(ptr, schema, schema_length);
- ptr+= schema_length;
+ if (schema_length)
+ {
+ memcpy(ptr, schema, schema_length);
+ ptr+= schema_length;
+ }
ptr[0]= 0;
ptr++;
- memcpy(ptr, object, object_length);
- ptr+= object_length;
+ if (object_length)
+ {
+ memcpy(ptr, object, object_length);
+ ptr+= object_length;
+ }
ptr[0]= 0;
ptr++;
key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
diff --git a/storage/perfschema/table_accounts.cc b/storage/perfschema/table_accounts.cc
index 708f8269a69..550f6614abb 100644
--- a/storage/perfschema/table_accounts.cc
+++ b/storage/perfschema/table_accounts.cc
@@ -43,8 +43,8 @@ table_accounts::m_share=
sizeof(PFS_simple_index), /* ref length */
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE accounts("
- "USER CHAR(16) collate utf8_bin default null,"
- "HOST CHAR(60) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"CURRENT_CONNECTIONS bigint not null,"
"TOTAL_CONNECTIONS bigint not null)") }
};
diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.cc b/storage/perfschema/table_esgs_by_account_by_event_name.cc
index 22e4e0040f1..9a983eb076e 100644
--- a/storage/perfschema/table_esgs_by_account_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_account_by_event_name.cc
@@ -49,8 +49,8 @@ table_esgs_by_account_by_event_name::m_share=
sizeof(pos_esgs_by_account_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_stages_summary_by_account_by_event_name("
- "USER CHAR(16) collate utf8_bin default null,"
- "HOST CHAR(60) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.cc b/storage/perfschema/table_esgs_by_host_by_event_name.cc
index 86cc2eb1b86..5ff9faf0c1e 100644
--- a/storage/perfschema/table_esgs_by_host_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_host_by_event_name.cc
@@ -50,7 +50,7 @@ table_esgs_by_host_by_event_name::m_share=
sizeof(pos_esgs_by_host_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_stages_summary_by_host_by_event_name("
- "HOST CHAR(60) collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.cc b/storage/perfschema/table_esgs_by_user_by_event_name.cc
index af73c1fc5fd..23b7b0f6689 100644
--- a/storage/perfschema/table_esgs_by_user_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_user_by_event_name.cc
@@ -50,7 +50,7 @@ table_esgs_by_user_by_event_name::m_share=
sizeof(pos_esgs_by_user_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_stages_summary_by_user_by_event_name("
- "USER CHAR(16) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_esms_by_account_by_event_name.cc b/storage/perfschema/table_esms_by_account_by_event_name.cc
index 7afdabcbbfe..312050aa9c9 100644
--- a/storage/perfschema/table_esms_by_account_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_account_by_event_name.cc
@@ -49,8 +49,8 @@ table_esms_by_account_by_event_name::m_share=
sizeof(pos_esms_by_account_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_statements_summary_by_account_by_event_name("
- "USER CHAR(16) collate utf8_bin default null,"
- "HOST CHAR(60) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_esms_by_host_by_event_name.cc b/storage/perfschema/table_esms_by_host_by_event_name.cc
index 42629ab6c09..b390d1e17a4 100644
--- a/storage/perfschema/table_esms_by_host_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_host_by_event_name.cc
@@ -50,7 +50,7 @@ table_esms_by_host_by_event_name::m_share=
sizeof(pos_esms_by_host_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_statements_summary_by_host_by_event_name("
- "HOST CHAR(60) collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_esms_by_user_by_event_name.cc b/storage/perfschema/table_esms_by_user_by_event_name.cc
index f8708ac9a14..1fa1289aa8c 100644
--- a/storage/perfschema/table_esms_by_user_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_user_by_event_name.cc
@@ -50,7 +50,7 @@ table_esms_by_user_by_event_name::m_share=
sizeof(pos_esms_by_user_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_statements_summary_by_user_by_event_name("
- "USER CHAR(16) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_ews_by_account_by_event_name.cc b/storage/perfschema/table_ews_by_account_by_event_name.cc
index fa6258ec9ac..40e0152f889 100644
--- a/storage/perfschema/table_ews_by_account_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_account_by_event_name.cc
@@ -49,8 +49,8 @@ table_ews_by_account_by_event_name::m_share=
sizeof(pos_ews_by_account_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_waits_summary_by_account_by_event_name("
- "USER CHAR(16) collate utf8_bin default null,"
- "HOST CHAR(60) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_ews_by_host_by_event_name.cc b/storage/perfschema/table_ews_by_host_by_event_name.cc
index e3ef7ca3720..d22d6fc8d79 100644
--- a/storage/perfschema/table_ews_by_host_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_host_by_event_name.cc
@@ -50,7 +50,7 @@ table_ews_by_host_by_event_name::m_share=
sizeof(pos_ews_by_host_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_waits_summary_by_host_by_event_name("
- "HOST CHAR(60) collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_ews_by_user_by_event_name.cc b/storage/perfschema/table_ews_by_user_by_event_name.cc
index cb99f749a9c..b2f8e1da824 100644
--- a/storage/perfschema/table_ews_by_user_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_user_by_event_name.cc
@@ -50,7 +50,7 @@ table_ews_by_user_by_event_name::m_share=
sizeof(pos_ews_by_user_by_event_name),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE events_waits_summary_by_user_by_event_name("
- "USER CHAR(16) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
"EVENT_NAME VARCHAR(128) not null,"
"COUNT_STAR BIGINT unsigned not null,"
"SUM_TIMER_WAIT BIGINT unsigned not null,"
diff --git a/storage/perfschema/table_hosts.cc b/storage/perfschema/table_hosts.cc
index 8bc5310817c..221e0664590 100644
--- a/storage/perfschema/table_hosts.cc
+++ b/storage/perfschema/table_hosts.cc
@@ -44,7 +44,7 @@ table_hosts::m_share=
sizeof(PFS_simple_index), /* ref length */
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE hosts("
- "HOST CHAR(60) collate utf8_bin default null,"
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default null,"
"CURRENT_CONNECTIONS bigint not null,"
"TOTAL_CONNECTIONS bigint not null)") }
};
diff --git a/storage/perfschema/table_setup_actors.cc b/storage/perfschema/table_setup_actors.cc
index 305cfd32169..767a7e9e6f0 100644
--- a/storage/perfschema/table_setup_actors.cc
+++ b/storage/perfschema/table_setup_actors.cc
@@ -49,9 +49,9 @@ table_setup_actors::m_share=
sizeof(PFS_simple_index),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE setup_actors("
- "HOST CHAR(60) collate utf8_bin default '%' not null,"
- "USER CHAR(16) collate utf8_bin default '%' not null,"
- "ROLE CHAR(16) collate utf8_bin default '%' not null)") }
+ "HOST CHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) ") collate utf8_bin default '%' not null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default '%' not null,"
+ "ROLE CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default '%' not null)") }
};
PFS_engine_table* table_setup_actors::create()
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index eccf41db971..00196718113 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -46,8 +46,8 @@ table_threads::m_share=
"NAME VARCHAR(128) not null,"
"TYPE VARCHAR(10) not null,"
"PROCESSLIST_ID BIGINT unsigned,"
- "PROCESSLIST_USER VARCHAR(16),"
- "PROCESSLIST_HOST VARCHAR(60),"
+ "PROCESSLIST_USER VARCHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) "),"
+ "PROCESSLIST_HOST VARCHAR(" STRINGIFY_ARG(HOSTNAME_LENGTH) "),"
"PROCESSLIST_DB VARCHAR(64),"
"PROCESSLIST_COMMAND VARCHAR(16),"
"PROCESSLIST_TIME BIGINT,"
diff --git a/storage/perfschema/table_users.cc b/storage/perfschema/table_users.cc
index 883ebd36633..e9592c55f55 100644
--- a/storage/perfschema/table_users.cc
+++ b/storage/perfschema/table_users.cc
@@ -44,7 +44,7 @@ table_users::m_share=
sizeof(PFS_simple_index), /* ref length */
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE users("
- "USER CHAR(16) collate utf8_bin default null,"
+ "USER CHAR(" STRINGIFY_ARG(USERNAME_CHAR_LENGTH) ") collate utf8_bin default null,"
"CURRENT_CONNECTIONS bigint not null,"
"TOTAL_CONNECTIONS bigint not null)") }
};
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 5cbe4c162a8..8d2080187ef 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -6085,8 +6085,7 @@ ulonglong ha_rocksdb::load_auto_incr_value_from_index() {
Field *field =
table->key_info[table->s->next_number_index].key_part[0].field;
ulonglong max_val = rdb_get_int_col_max_value(field);
- my_bitmap_map *const old_map =
- dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *const old_map = dbug_tmp_use_all_columns(table, &table->read_set);
last_val = field->val_int();
if (last_val != max_val) {
last_val++;
@@ -6101,7 +6100,7 @@ ulonglong ha_rocksdb::load_auto_incr_value_from_index() {
}
}
#endif
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
}
m_keyread_only = save_keyread_only;
@@ -6138,15 +6137,15 @@ void ha_rocksdb::update_auto_incr_val_from_field() {
field = table->key_info[table->s->next_number_index].key_part[0].field;
max_val = rdb_get_int_col_max_value(field);
- my_bitmap_map *const old_map =
- dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *const old_map =
+ dbug_tmp_use_all_columns(table, &table->read_set);
new_val = field->val_int();
// don't increment if we would wrap around
if (new_val != max_val) {
new_val++;
}
- dbug_tmp_restore_column_map(table->read_set, old_map);
+ dbug_tmp_restore_column_map(&table->read_set, old_map);
// Only update if positive value was set for auto_incr column.
if (new_val <= max_val) {
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/issue896.result b/storage/rocksdb/mysql-test/rocksdb/r/issue896.result
index 917c95733f7..6b742ebaf0c 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/issue896.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/issue896.result
@@ -9,7 +9,7 @@ KEY `d` (`d`)
INSERT INTO t1 VALUES (100, 'aaabbb', UNIX_TIMESTAMP(), 200);
EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(d);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 11 NULL # Using index
+1 SIMPLE t1 index NULL d 9 NULL # Using index
# segfault here without the fix
SELECT COUNT(*) FROM t1 FORCE INDEX(d);
COUNT(*)
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
index 6cc4cc7a1dc..11cffac070f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
@@ -546,7 +546,7 @@ pk key1 col1
explain
select key1 from t30;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t30 index NULL key1 20 NULL # Using index
+1 SIMPLE t30 index NULL key1 18 NULL # Using index
select key1 from t30;
key1
row1-key
@@ -618,7 +618,7 @@ row3 row3-key row3-data
explain
select * from t30 order by key1 limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t30 index NULL key1 20 NULL #
+1 SIMPLE t30 index NULL key1 18 NULL #
select * from t30 order by key1 limit 3;
pk key1 col1
row1 row1-key row1-data
@@ -627,7 +627,7 @@ row3 row3-key row3-data
explain
select * from t30 order by key1 desc limit 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t30 index NULL key1 20 NULL #
+1 SIMPLE t30 index NULL key1 18 NULL #
select * from t30 order by key1 desc limit 3;
pk key1 col1
row5 row5-key row5-data
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_char_indexes.result b/storage/rocksdb/mysql-test/rocksdb/r/type_char_indexes.result
index 413c3f69f23..e8b913288c5 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_char_indexes.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_char_indexes.result
@@ -45,7 +45,7 @@ t1 1 v16 1 v16 A 500 NULL NULL YES LSMTREE
INSERT INTO t1 (c,c20,v16,v128,pk) VALUES ('a','char1','varchar1a','varchar1b','1'),('a','char2','varchar2a','varchar2b','2'),('b','char3','varchar1a','varchar1b','3'),('c','char4','varchar3a','varchar3b','4');
EXPLAIN SELECT SUBSTRING(v16,0,3) FROM t1 WHERE v16 LIKE 'varchar%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index v16 v16 21 NULL # Using where; Using index
+1 SIMPLE t1 index v16 v16 19 NULL # Using where; Using index
SELECT SUBSTRING(v16,7,3) FROM t1 WHERE v16 LIKE 'varchar%';
SUBSTRING(v16,7,3)
r1a
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/checkpoint.test b/storage/rocksdb/mysql-test/rocksdb/t/checkpoint.test
index e5de6246f60..68fe02bbd86 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/checkpoint.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/checkpoint.test
@@ -87,7 +87,7 @@ let $checkpoint = $MYSQL_TMP_DIR/already-existing-directory;
--mkdir $checkpoint
let $succeeds = 0;
--source set_checkpoint.inc
---exec rm -rf $checkpoint
+rmdir $checkpoint;
--disable_result_log
truncate table t1;
diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc
index fee5d24eb66..31bc40b1df9 100644
--- a/storage/rocksdb/rdb_datadic.cc
+++ b/storage/rocksdb/rdb_datadic.cc
@@ -1488,12 +1488,12 @@ void Rdb_key_def::pack_with_make_sort_key(
DBUG_ASSERT(*dst != nullptr);
const int max_len = fpi->m_max_image_len;
- my_bitmap_map *old_map;
+ MY_BITMAP*old_map;
old_map= dbug_tmp_use_all_columns(field->table,
- field->table->read_set);
+ &field->table->read_set);
field->sort_string(*dst, max_len);
- dbug_tmp_restore_column_map(field->table->read_set, old_map);
+ dbug_tmp_restore_column_map(&field->table->read_set, old_map);
*dst += max_len;
}
diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc
index 948f030b479..50f4ad0eeb4 100644
--- a/storage/sequence/sequence.cc
+++ b/storage/sequence/sequence.cc
@@ -115,13 +115,13 @@ THR_LOCK_DATA **ha_seq::store_lock(THD *thd, THR_LOCK_DATA **to,
void ha_seq::set(unsigned char *buf)
{
- my_bitmap_map *old_map = dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map = dbug_tmp_use_all_columns(table, &table->write_set);
my_ptrdiff_t offset = (my_ptrdiff_t) (buf - table->record[0]);
Field *field = table->field[0];
field->move_field_offset(offset);
field->store(cur, true);
field->move_field_offset(-offset);
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
}
int ha_seq::rnd_init(bool scan)
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 67bf0744c78..3347f306cf7 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -3047,7 +3047,7 @@ int ha_sphinx::get_rec ( byte * buf, const byte *, uint )
}
#if MYSQL_VERSION_ID>50100
- my_bitmap_map * org_bitmap = dbug_tmp_use_all_columns ( table, table->write_set );
+ MY_BITMAP * org_bitmap = dbug_tmp_use_all_columns ( table, &table->write_set );
#endif
Field ** field = table->field;
@@ -3193,7 +3193,7 @@ int ha_sphinx::get_rec ( byte * buf, const byte *, uint )
m_iCurrentPos++;
#if MYSQL_VERSION_ID > 50100
- dbug_tmp_restore_column_map ( table->write_set, org_bitmap );
+ dbug_tmp_restore_column_map ( &table->write_set, org_bitmap );
#endif
SPH_RET(0);
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 5e7b5a1e8ce..6dbc34706da 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -9737,12 +9737,12 @@ int ha_spider::write_row(
if (!table->auto_increment_field_not_null)
{
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
table->next_number_field->store((longlong) 0, TRUE);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
force_auto_increment = FALSE;
table->file->insert_id_for_cur_row = 0;
@@ -9750,13 +9750,13 @@ int ha_spider::write_row(
} else if (auto_increment_mode == 2)
{
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
table->next_number_field->store((longlong) 0, TRUE);
table->auto_increment_field_not_null = FALSE;
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
force_auto_increment = FALSE;
table->file->insert_id_for_cur_row = 0;
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index f77603d0d3a..8d4e9acda07 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -1624,7 +1624,7 @@ int spider_db_append_key_where_internal(
DBUG_PRINT("info", ("spider end_key_part_map=%lu", end_key_part_map));
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *tmp_map = dbug_tmp_use_all_columns(table, &table->read_set);
#endif
if (sql_kind == SPIDER_SQL_KIND_HANDLER)
@@ -2427,7 +2427,7 @@ end:
if (sql_kind == SPIDER_SQL_KIND_SQL)
dbton_hdl->set_order_pos(sql_type);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
DBUG_RETURN(0);
}
@@ -2928,15 +2928,15 @@ int spider_db_fetch_table(
bitmap_is_set(table->write_set, (*field)->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num =
spider_db_fetch_row(share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -3099,15 +3099,15 @@ int spider_db_fetch_key(
bitmap_is_set(table->write_set, field->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name));
if ((error_num =
spider_db_fetch_row(share, field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -3213,14 +3213,14 @@ int spider_db_fetch_minimum_columns(
bitmap_is_set(table->write_set, (*field)->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num = spider_db_fetch_row(share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -5128,15 +5128,15 @@ int spider_db_seek_tmp_table(
bitmap_is_set(table->write_set, (*field)->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num =
spider_db_fetch_row(spider->share, *field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -5215,15 +5215,15 @@ int spider_db_seek_tmp_key(
bitmap_is_set(table->write_set, field->field_index)
)) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name));
if ((error_num =
spider_db_fetch_row(spider->share, field, row, ptr_diff)))
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
row->next();
@@ -5305,8 +5305,8 @@ int spider_db_seek_tmp_minimum_columns(
bitmap_is_set(table->write_set, (*field)->field_index)));
*/
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
DBUG_PRINT("info", ("spider bitmap is set %s", (*field)->field_name));
if ((error_num =
@@ -5314,7 +5314,7 @@ int spider_db_seek_tmp_minimum_columns(
DBUG_RETURN(error_num);
row->next();
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
}
else if (bitmap_is_set(table->read_set, (*field)->field_index))
@@ -8680,8 +8680,8 @@ int spider_db_udf_fetch_table(
DBUG_RETURN(HA_ERR_END_OF_FILE);
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->write_set);
#endif
for (
roop_count = 0,
@@ -8694,7 +8694,7 @@ int spider_db_udf_fetch_table(
spider_db_udf_fetch_row(trx, *field, row)))
{
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
DBUG_RETURN(error_num);
}
@@ -8704,7 +8704,7 @@ int spider_db_udf_fetch_table(
for (; roop_count < set_off; roop_count++, field++)
(*field)->set_default();
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->write_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->write_set, tmp_map);
#endif
table->status = 0;
DBUG_RETURN(0);
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index 9ed29d015b3..1a24d80a95f 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -6528,8 +6528,7 @@ int spider_mysql_handler::append_update_set(
mysql_share->append_column_name(str, (*fields)->field_index);
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table,
- table->read_set);
+ MY_BITMAP *tmp_map = dbug_tmp_use_all_columns(table, &table->read_set);
#endif
if (
spider_db_mysql_utility.
@@ -6538,12 +6537,12 @@ int spider_mysql_handler::append_update_set(
str->reserve(SPIDER_SQL_COMMA_LEN)
) {
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
}
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
@@ -9172,8 +9171,8 @@ int spider_mysql_handler::append_insert_values(
bitmap_is_set(table->read_set, (*field)->field_index)
) {
#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->read_set);
+ MY_BITMAP *tmp_map =
+ dbug_tmp_use_all_columns(table, &table->read_set);
#endif
add_value = TRUE;
DBUG_PRINT("info",("spider is_null()=%s",
@@ -9195,7 +9194,7 @@ int spider_mysql_handler::append_insert_values(
if (str->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN))
{
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
str->length(0);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -9209,7 +9208,7 @@ int spider_mysql_handler::append_insert_values(
str->reserve(SPIDER_SQL_COMMA_LEN)
) {
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
str->length(0);
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -9217,7 +9216,7 @@ int spider_mysql_handler::append_insert_values(
}
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
+ dbug_tmp_restore_column_map(&table->read_set, tmp_map);
#endif
}
}
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 39bc286a617..12d3a5a060a 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -2313,7 +2313,7 @@ int ha_tokudb::pack_row_in_buff(
int r = ENOSYS;
memset((void *) row, 0, sizeof(*row));
- my_bitmap_map *old_map = dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map = dbug_tmp_use_all_columns(table, &table->write_set);
// Copy null bytes
memcpy(row_buff, record, table_share->null_bytes);
@@ -2362,7 +2362,7 @@ int ha_tokudb::pack_row_in_buff(
row->size = (size_t) (var_field_data_ptr - row_buff);
r = 0;
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return r;
}
@@ -2758,7 +2758,7 @@ DBT* ha_tokudb::create_dbt_key_from_key(
{
uint32_t size = 0;
uchar* tmp_buff = buff;
- my_bitmap_map *old_map = dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP *old_map = dbug_tmp_use_all_columns(table, &table->write_set);
key->data = buff;
@@ -2797,7 +2797,7 @@ DBT* ha_tokudb::create_dbt_key_from_key(
key->size = size;
DBUG_DUMP("key", (uchar *) key->data, key->size);
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
return key;
}
@@ -2890,7 +2890,7 @@ DBT* ha_tokudb::pack_key(
KEY* key_info = &table->key_info[keynr];
KEY_PART_INFO* key_part = key_info->key_part;
KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
- my_bitmap_map* old_map = dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP* old_map = dbug_tmp_use_all_columns(table, &table->write_set);
memset((void *) key, 0, sizeof(*key));
key->data = buff;
@@ -2927,7 +2927,7 @@ DBT* ha_tokudb::pack_key(
key->size = (buff - (uchar *) key->data);
DBUG_DUMP("key", (uchar *) key->data, key->size);
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(key);
}
@@ -2955,7 +2955,7 @@ DBT* ha_tokudb::pack_ext_key(
KEY* key_info = &table->key_info[keynr];
KEY_PART_INFO* key_part = key_info->key_part;
KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
- my_bitmap_map* old_map = dbug_tmp_use_all_columns(table, table->write_set);
+ MY_BITMAP* old_map = dbug_tmp_use_all_columns(table, &table->write_set);
memset((void *) key, 0, sizeof(*key));
key->data = buff;
@@ -3034,7 +3034,7 @@ DBT* ha_tokudb::pack_ext_key(
key->size = (buff - (uchar *) key->data);
DBUG_DUMP("key", (uchar *) key->data, key->size);
- dbug_tmp_restore_column_map(table->write_set, old_map);
+ dbug_tmp_restore_column_map(&table->write_set, old_map);
DBUG_RETURN(key);
}
#endif // defined(TOKU_INCLUDE_EXTENDED_KEYS) && TOKU_INCLUDE_EXTENDED_KEYS
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
index 3b82bbcef4f..c01edef283e 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
@@ -177,9 +177,8 @@ Note 1265 Data truncated for column 'a' at row 2
insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2
+Warning 1264 Out of range value for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
-Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
@@ -210,7 +209,7 @@ a
99999999.99
0.00
99999999.99
-0.00
+99999999.99
0.00
0.00
123.40
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index e4bd6d2b5c2..c052e427322 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2002-2007 MySQL AB & tommy@valley.ne.jp
Copyright (c) 2002, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 2020, MariaDB Corporation.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -399,7 +399,7 @@ my_strnxfrm_8bit_bin(CHARSET_INFO *cs,
{
set_if_smaller(srclen, dstlen);
set_if_smaller(srclen, nweights);
- if (dst != src)
+ if (srclen && dst != src)
memcpy(dst, src, srclen);
return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen,
(uint)(nweights - srclen), flags, 0);
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index bfd8b0db1d5..66bd1604803 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -553,9 +553,11 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
alloced= a= (uchar*) my_malloc(a_length+b_length+2, MYF(MY_FAE));
b= a + a_length+1;
- memcpy((char*) a, (char*) a0, a_length);
+ if (a_length)
+ memcpy((char*) a, (char*) a0, a_length);
a[a_length]= 0; /* if length(a0)> len1, need to put 'end of string' */
- memcpy((char *)b, (char *)b0, b_length);
+ if (b_length)
+ memcpy((char *)b, (char *)b0, b_length);
b[b_length]= 0; /* put end of string */
a_length= thai2sortable(a, a_length);
b_length= thai2sortable(b, b_length);
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index c5182911c4a..29d56919633 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1160,9 +1160,12 @@ static size_t
my_snprintf_mb2(CHARSET_INFO *cs __attribute__((unused)),
char* to, size_t n, const char* fmt, ...)
{
+ size_t ret;
va_list args;
va_start(args,fmt);
- return my_vsnprintf_mb2(to, n, fmt, args);
+ ret= my_vsnprintf_mb2(to, n, fmt, args);
+ va_end(args);
+ return ret;
}
@@ -2424,9 +2427,12 @@ static size_t
my_snprintf_utf32(CHARSET_INFO *cs __attribute__((unused)),
char* to, size_t n, const char* fmt, ...)
{
+ size_t ret;
va_list args;
va_start(args,fmt);
- return my_vsnprintf_utf32(to, n, fmt, args);
+ ret= my_vsnprintf_utf32(to, n, fmt, args);
+ va_end(args);
+ return ret;
}
diff --git a/strings/decimal.c b/strings/decimal.c
index 2dd7c960a3e..9d18a9ce52a 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -921,20 +921,75 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E'))
{
int str_error;
- longlong exponent= my_strtoll10(endp+1, (char**) &end_of_string,
+ const char *end_of_exponent= end_of_string;
+ longlong exponent= my_strtoll10(endp+1, (char**) &end_of_exponent,
&str_error);
- if (end_of_string != endp +1) /* If at least one digit */
+ if (end_of_exponent != endp +1) /* If at least one digit */
{
- *end= (char*) end_of_string;
+ *end= (char*) end_of_exponent;
if (str_error > 0)
{
+ if (str_error == MY_ERRNO_ERANGE)
+ {
+ /*
+ Exponent is:
+ - a huge positive number that does not fit into ulonglong
+ - a huge negative number that does not fit into longlong
+ Skip all remaining digits.
+ */
+ for ( ; end_of_exponent < end_of_string &&
+ my_isdigit(&my_charset_latin1, *end_of_exponent)
+ ; end_of_exponent++)
+ { }
+ *end= (char*) end_of_exponent;
+ if (exponent == ~0)
+ {
+ if (!decimal_is_zero(to))
+ {
+ /*
+ Non-zero mantissa and a huge positive exponent that
+ does not fit into ulonglong, e.g.:
+ 1e111111111111111111111
+ */
+ error= E_DEC_OVERFLOW;
+ }
+ else
+ {
+ /*
+ Zero mantissa and a huge positive exponent that
+ does not fit into ulonglong, e.g.:
+ 0e111111111111111111111
+ Return zero without warnings.
+ */
+ }
+ }
+ else
+ {
+ /*
+ Huge negative exponent that does not fit into longlong, e.g.
+ 1e-111111111111111111111
+ 0e-111111111111111111111
+ Return zero without warnings.
+ */
+ }
+ goto fatal_error;
+ }
+
+ /*
+ Some other error, e.g. MY_ERRNO_EDOM
+ */
error= E_DEC_BAD_NUM;
goto fatal_error;
}
if (exponent > INT_MAX/2 || (str_error == 0 && exponent < 0))
{
- error= E_DEC_OVERFLOW;
+ /*
+ The exponent fits into ulonglong, but it's still huge, e.g.
+ 1e1111111111
+ */
+ if (!decimal_is_zero(to))
+ error= E_DEC_OVERFLOW;
goto fatal_error;
}
if (exponent < INT_MIN/2 && error != E_DEC_OVERFLOW)
diff --git a/support-files/mariadb.pc.in b/support-files/mariadb.pc.in
index 7d321f28491..500e148d0ed 100644
--- a/support-files/mariadb.pc.in
+++ b/support-files/mariadb.pc.in
@@ -3,11 +3,12 @@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@INSTALL_LIBDIR@
includedir=${prefix}/@INSTALL_INCLUDEDIR@
-# those are rarely present or not at all, but we export them regardless
+# its common to want to know where to install it.
+plugindir=${prefix}/@INSTALL_PLUGINDIR@
+# Below are rarely present or not at all, but we export them regardless
bindir=${prefix}/@INSTALL_BINDIR@
sbindir=${prefix}/@INSTALL_SBINDIR@
scriptdir=${prefix}/@INSTALL_SCRIPTDIR@
-plugindir=${prefix}/@INSTALL_PLUGINDIR@
docdir=${prefix}/@INSTALL_DOCDIR@
mandir=${prefix}/@INSTALL_MANDIR@
sharedir=${prefix}/@INSTALL_SHAREDIR@
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
index 71518423687..4d49f6f4e35 100644
--- a/support-files/rpm/server-postin.sh
+++ b/support-files/rpm/server-postin.sh
@@ -40,7 +40,7 @@ if [ $1 = 1 ] ; then
# Create a MySQL user and group. Do not report any problems if it already
# exists.
groupadd -r %{mysqld_group} 2> /dev/null || true
- useradd -M -r --home $datadir --shell /sbin/nologin --comment "MySQL server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true
+ useradd -M -r --home $datadir --shell /sbin/nologin --comment "MySQL server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
usermod --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true
@@ -78,7 +78,7 @@ if [ -x /usr/sbin/semodule ] ; then
/usr/sbin/semodule -i /usr/share/mysql/policy/selinux/mariadb.pp
fi
-if [ -x sbin/restorecon ] ; then
- sbin/restorecon -R var/lib/mysql
+if [ -x /sbin/restorecon ] ; then
+ /sbin/restorecon -R /var/lib/mysql
fi
diff --git a/support-files/rpm/server-posttrans.sh b/support-files/rpm/server-posttrans.sh
index 1406c78a5f5..1525b592735 100644
--- a/support-files/rpm/server-posttrans.sh
+++ b/support-files/rpm/server-posttrans.sh
@@ -1,10 +1,15 @@
if [ -r %{restart_flag} ] ; then
rm %{restart_flag}
+ # only restart the server if it was alredy running
if [ -x /usr/bin/systemctl ] ; then
/usr/bin/systemctl daemon-reload > /dev/null 2>&1
- /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
+ if [ /usr/bin/systemctl is-active mysql ]; then
+ /usr/bin/systemctl restart mysql > /dev/null 2>&1
+ else
+ /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
+ fi
+ # not a systemd-enabled environment, use SysV startup script
elif %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then
- # only restart the server if it was alredy running
- %{_sysconfdir}/init.d/mysql restart
+ %{_sysconfdir}/init.d/mysql restart > /dev/null 2>&1
fi
fi
diff --git a/tests/grant.pl b/tests/grant.pl
deleted file mode 100755
index b50481a93fc..00000000000
--- a/tests/grant.pl
+++ /dev/null
@@ -1,750 +0,0 @@
-#!/usr/bin/env perl
-
-# Copyright (c) 2000, 2005 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-#
-# Testing of grants.
-# Note that this will delete all table and column grants !
-#
-
-use DBI;
-use Getopt::Long;
-use strict;
-
-use vars qw($dbh $user_dbh $opt_help $opt_Information $opt_force $opt_debug
- $opt_verbose $opt_server $opt_root_user $opt_password $opt_user
- $opt_database $opt_host $version $user $tables_cols $columns_cols
- $tmp_table $opt_silent);
-
-$version="1.1";
-$opt_help=$opt_Information=$opt_force=$opt_debug=$opt_verbose=$opt_silent=0;
-$opt_host="localhost",
-$opt_server="mysql";
-$opt_root_user="root";
-$opt_password="";
-$opt_user="grant_user";
-$opt_database="grant_test";
-
-GetOptions("Information","help","server=s","root-user=s","password=s","user","database=s","force","host=s","debug","verbose","silent") || usage();
-usage() if ($opt_help || $opt_Information);
-
-$user="$opt_user\@$opt_host";
-
-if (!$opt_force)
-{
- print_info()
-}
-
-$|=1;
-
-$tables_cols="Host, Db, User, Table_name, Grantor, Table_priv, Column_priv";
-$columns_cols="Host, Db, User, Table_name, Column_name, Column_priv";
-$tmp_table="/tmp/mysql-grant.test"; # Can't use $$ as we are logging result
-unlink($tmp_table);
-
-#
-# clear grant tables
-#
-
-$dbh = DBI->connect("DBI:mysql:mysql:$opt_host",
- $opt_root_user,$opt_password,
- { PrintError => 0}) || die "Can't connect to mysql server with user '$opt_root_user': $DBI::errstr\n";
-
-safe_query("delete from user where user='$opt_user' or user='${opt_user}2'");
-safe_query("delete from db where user='$opt_user'");
-safe_query("delete from tables_priv");
-safe_query("delete from columns_priv");
-safe_query("lock tables mysql.user write"); # Test lock tables
-safe_query("flush privileges");
-safe_query("unlock tables"); # should already be unlocked
-safe_query("drop database $opt_database",3); # Don't print possible error
-safe_query("create database $opt_database");
-
-# check that the user can't login yet
-
-user_connect(1);
-#goto test;
-
-#
-# Enable column grant code
-#
-safe_query("grant select(user) on mysql.user to $user");
-safe_query("revoke select(user) on mysql.user from $user");
-
-#
-# Test grants on user level
-#
-
-safe_query("grant select on *.* to $user");
-safe_query("set password FOR ${opt_user}2\@$opt_host = password('test')",1);
-safe_query("set password FOR $opt_user\@$opt_host=password('test')");
-user_connect(1);
-safe_query("set password FOR $opt_user\@$opt_host=''");
-user_connect(0);
-user_query("select * from mysql.user where user = '$opt_user'");
-user_query("select * from mysql.db where user = '$opt_user'");
-safe_query("grant select on *.* to $user,$user");
-safe_query("show grants for $user");
-user_connect(0);
-
-# The following should fail
-user_query("insert into mysql.user (host,user) values ('error','$opt_user')",1);
-user_query("update mysql.user set host='error' WHERE user='$opt_user'",1);
-user_query("create table $opt_database.test (a int,b int)",1);
-user_query("grant select on *.* to ${opt_user}2\@$opt_host",1);
-safe_query("revoke select on $opt_database.test from $opt_user\@opt_host",1);
-safe_query("revoke select on $opt_database.* from $opt_user\@opt_host",1);
-safe_query("revoke select on *.* from $opt_user",1);
-safe_query("grant select on $opt_database.not_exists to $opt_user",1);
-safe_query("grant FILE on $opt_database.test to $opt_user",1);
-safe_query("grant select on *.* to wrong___________user_name",1);
-safe_query("grant select on $opt_database.* to wrong___________user_name",1);
-user_connect(0);
-user_query("grant select on $opt_database.test to $opt_user with grant option",1);
-safe_query("set password FOR ''\@''=''",1);
-user_query("set password FOR root\@$opt_host = password('test')",1);
-
-# Change privileges for user
-safe_query("revoke select on *.* from $user");
-safe_query("grant create,update on *.* to $user");
-user_connect(0);
-safe_query("flush privileges");
-user_query("create table $opt_database.test (a int,b int)");
-user_query("update $opt_database.test set b=b+1 where a > 0",1);
-safe_query("show grants for $user");
-safe_query("revoke update on *.* from $user");
-user_connect(0);
-safe_query("grant select(c) on $opt_database.test to $user",1);
-safe_query("revoke select(c) on $opt_database.test from $user",1);
-safe_query("grant select on $opt_database.test to wrong___________user_name",1);
-user_query("INSERT INTO $opt_database.test values (2,0)",1);
-
-safe_query("grant ALL PRIVILEGES on *.* to $user");
-safe_query("REVOKE INSERT on *.* from $user");
-user_connect(0);
-user_query("INSERT INTO $opt_database.test values (1,0)",1);
-safe_query("grant INSERT on *.* to $user");
-user_connect(0);
-user_query("INSERT INTO $opt_database.test values (2,0)");
-user_query("select count(*) from $opt_database.test");
-safe_query("revoke SELECT on *.* from $user");
-user_connect(0);
-user_query("select count(*) from $opt_database.test",1);
-user_query("INSERT INTO $opt_database.test values (3,0)");
-safe_query("grant SELECT on *.* to $user");
-user_connect(0);
-user_query("select count(*) from $opt_database.test");
-safe_query("revoke ALL PRIVILEGES on *.* from $user");
-user_connect(1);
-safe_query("delete from user where user='$opt_user'");
-safe_query("flush privileges");
-if (0) # Only if no anonymous user on localhost.
-{
- safe_query("grant select on *.* to $opt_user");
- user_connect(0);
- safe_query("revoke select on *.* from $opt_user");
- user_connect(1);
-}
-safe_query("delete from user where user='$opt_user'");
-safe_query("flush privileges");
-
-#
-# Test grants on database level
-#
-safe_query("grant select on $opt_database.* to $user");
-safe_query("select * from mysql.user where user = '$opt_user'");
-safe_query("select * from mysql.db where user = '$opt_user'");
-user_connect(0);
-user_query("select count(*) from $opt_database.test");
-# The following should fail
-user_query("select * from mysql.user where user = '$opt_user'",1);
-user_query("insert into $opt_database.test values (4,0)",1);
-user_query("update $opt_database.test set a=1",1);
-user_query("delete from $opt_database.test",1);
-user_query("create table $opt_database.test2 (a int)",1);
-user_query("ALTER TABLE $opt_database.test add c int",1);
-user_query("CREATE INDEX dummy ON $opt_database.test (a)",1);
-user_query("drop table $opt_database.test",1);
-user_query("grant ALL PRIVILEGES on $opt_database.* to ${opt_user}2\@$opt_host",1);
-
-# Change privileges for user
-safe_query("grant ALL PRIVILEGES on $opt_database.* to $user WITH GRANT OPTION");
-user_connect(0);
-user_query("insert into $opt_database.test values (5,0)");
-safe_query("REVOKE ALL PRIVILEGES on * from $user",1);
-safe_query("REVOKE ALL PRIVILEGES on *.* from $user");
-safe_query("REVOKE ALL PRIVILEGES on $opt_database.* from $user");
-safe_query("REVOKE ALL PRIVILEGES on $opt_database.* from $user");
-user_connect(0);
-user_query("insert into $opt_database.test values (6,0)",1);
-safe_query("REVOKE GRANT OPTION on $opt_database.* from $user");
-user_connect(1);
-safe_query("grant ALL PRIVILEGES on $opt_database.* to $user");
-
-user_connect(0);
-user_query("select * from mysql.user where user = '$opt_user'",1);
-user_query("insert into $opt_database.test values (7,0)");
-user_query("update $opt_database.test set a=3 where a=2");
-user_query("delete from $opt_database.test where a=3");
-user_query("create table $opt_database.test2 (a int not null)");
-user_query("alter table $opt_database.test2 add b int");
-user_query("create index dummy on $opt_database.test2 (a)");
-user_query("update test,test2 SET test.a=test2.a where test.a=test2.a");
-user_query("drop table $opt_database.test2");
-user_query("show tables from grant_test");
-# These should fail
-user_query("insert into mysql.user (host,user) values ('error','$opt_user',0)",1);
-
-# Revoke database privileges
-safe_query("revoke ALL PRIVILEGES on $opt_database.* from $user");
-safe_query("select * from mysql.user where user = '$opt_user'");
-safe_query("select * from mysql.db where user = '$opt_user'");
-
-# Test multi-updates
-safe_query("grant CREATE,UPDATE,DROP on $opt_database.* to $user");
-user_connect(0);
-user_query("create table $opt_database.test2 (a int not null)");
-user_query("update test,test2 SET test.a=1 where 1",1);
-user_query("update test,test2 SET test.a=test2.a where 1",1);
-safe_query("grant SELECT on $opt_database.* to $user");
-user_connect(0);
-user_query("update test,test2 SET test.a=test2.a where test2.a=test.a");
-user_query("drop table $opt_database.test2");
-
-# Revoke database privileges
-safe_query("revoke ALL PRIVILEGES on $opt_database.* from $user");
-user_connect(1);
-
-#
-# Test of grants on table level
-#
-
-safe_query("grant create on $opt_database.test2 to $user");
-user_connect(0);
-user_query("create table $opt_database.test2 (a int not null)");
-user_query("show tables"); # Should only show test, not test2
-user_query("show columns from test",1);
-user_query("show keys from test",1);
-user_query("show columns from test2");
-user_query("show keys from test2");
-user_query("select * from test",1);
-safe_query("grant insert on $opt_database.test to $user");
-user_query("show tables");
-user_query("insert into $opt_database.test values (8,0)");
-user_query("update $opt_database.test set b=1",1);
-safe_query("grant update on $opt_database.test to $user");
-user_query("update $opt_database.test set b=2");
-
-user_query("update $opt_database.test,test2 SET test.b=3",1);
-safe_query("grant select on $opt_database.test2 to $user");
-user_query("update $opt_database.test,test2 SET test.b=3");
-safe_query("revoke select on $opt_database.test2 from $user");
-
-user_query("delete from $opt_database.test",1);
-safe_query("grant delete on $opt_database.test to $user");
-user_query("delete from $opt_database.test where a=1",1);
-user_query("update $opt_database.test set b=3 where b=1",1);
-user_query("update $opt_database.test set b=b+1",1);
-user_query("update $opt_database.test,test2 SET test.a=test2.a",1);
-
-#
-# Test global SELECT privilege combined with table level privileges
-#
-
-safe_query("grant SELECT on *.* to $user");
-user_connect(0);
-user_query("update $opt_database.test set b=b+1");
-user_query("update $opt_database.test set b=b+1 where a > 0");
-user_query("update $opt_database.test,test2 SET test.a=test2.a");
-user_query("update $opt_database.test,test2 SET test2.a=test.a",1);
-safe_query("revoke SELECT on *.* from $user");
-safe_query("grant SELECT on $opt_database.* to $user");
-user_connect(0);
-user_query("update $opt_database.test set b=b+1");
-user_query("update $opt_database.test set b=b+1 where a > 0");
-safe_query("grant UPDATE on *.* to $user");
-user_connect(0);
-user_query("update $opt_database.test set b=b+1");
-user_query("update $opt_database.test set b=b+1 where a > 0");
-safe_query("revoke UPDATE on *.* from $user");
-safe_query("revoke SELECT on $opt_database.* from $user");
-user_connect(0);
-user_query("update $opt_database.test set b=b+1 where a > 0",1);
-user_query("update $opt_database.test set b=b+1",1);
-
-# Add one privilege at a time until the user has all privileges
-user_query("select * from test",1);
-safe_query("grant select on $opt_database.test to $user");
-user_query("delete from $opt_database.test where a=1");
-user_query("update $opt_database.test set b=2 where b=1");
-user_query("update $opt_database.test set b=b+1");
-user_query("select count(*) from test");
-user_query("update test,test2 SET test.b=4",1);
-user_query("update test,test2 SET test2.a=test.a",1);
-user_query("update test,test2 SET test.a=test2.a",1);
-
-user_query("create table $opt_database.test3 (a int)",1);
-user_query("alter table $opt_database.test2 add c int",1);
-safe_query("grant alter on $opt_database.test2 to $user");
-user_query("alter table $opt_database.test2 add c int");
-user_query("create index dummy ON $opt_database.test (a)",1);
-safe_query("grant index on $opt_database.test2 to $user");
-user_query("create index dummy ON $opt_database.test2 (a)");
-user_query("insert into test2 SELECT a,a from test",1);
-safe_query("grant insert on test2 to $user",1); # No table: mysql.test2
-safe_query("grant insert(a) on $opt_database.test2 to $user");
-user_query("insert into test2 SELECT a,a from test",1);
-safe_query("grant insert(c) on $opt_database.test2 to $user");
-user_query("insert into test2 SELECT a,a from test");
-user_query("select count(*) from test2,test",1);
-user_query("select count(*) from test,test2",1);
-user_query("replace into test2 SELECT a from test",1);
-safe_query("grant update on $opt_database.test2 to $user");
-user_query("update test,test2 SET test2.a=test.a");
-user_query("update test,test2 SET test.b=test2.a where 0",1);
-user_query("update test,test2 SET test.a=2 where test2.a>100",1);
-user_query("update test,test2 SET test.a=test2.a",1);
-user_query("replace into test2 SELECT a,a from test",1);
-safe_query("grant DELETE on $opt_database.test2 to $user");
-user_query("replace into test2 SELECT a,a from test");
-user_query("insert into test (a) SELECT a from test2",1);
-safe_query("grant SELECT on $opt_database.test2 to $user");
-user_query("update test,test2 SET test.b=test2.a where 0");
-user_query("update test,test2 SET test.a=test2.a where test2.a>100");
-
-safe_query("revoke UPDATE on $opt_database.test2 from $user");
-safe_query("grant UPDATE (c) on $opt_database.test2 to $user");
-user_query("update test,test2 SET test.b=test2.a where 0");
-user_query("update test,test2 SET test.a=test2.a where test2.a>100");
-user_query("update test,test2 SET test2.a=test2.a where test2.a>100",1);
-user_query("update test,test2 SET test2.c=test2.a where test2.a>100");
-
-safe_query("revoke SELECT,UPDATE on $opt_database.test2 from $user");
-safe_query("grant UPDATE on $opt_database.test2 to $user");
-
-user_query("drop table $opt_database.test2",1);
-user_query("grant select on $opt_database.test2 to $user with grant option",1);
-safe_query("grant drop on $opt_database.test2 to $user with grant option");
-user_query("grant drop on $opt_database.test2 to $user with grant option");
-user_query("grant select on $opt_database.test2 to $user with grant option",1);
-
-# check rename privileges
-user_query("rename table $opt_database.test2 to $opt_database.test3",1);
-safe_query("grant CREATE,DROP on $opt_database.test3 to $user");
-user_query("rename table $opt_database.test2 to $opt_database.test3",1);
-user_query("create table $opt_database.test3 (a int)");
-safe_query("grant INSERT on $opt_database.test3 to $user");
-user_query("drop table $opt_database.test3");
-user_query("rename table $opt_database.test2 to $opt_database.test3");
-user_query("rename table $opt_database.test3 to $opt_database.test2",1);
-safe_query("grant ALTER on $opt_database.test3 to $user");
-user_query("rename table $opt_database.test3 to $opt_database.test2");
-safe_query("revoke DROP on $opt_database.test2 from $user");
-user_query("rename table $opt_database.test2 to $opt_database.test3");
-user_query("drop table if exists $opt_database.test2,$opt_database.test3",1);
-safe_query("drop table if exists $opt_database.test2,$opt_database.test3");
-
-# Check that the user doesn't have some user privileges
-user_query("create database $opt_database",1);
-user_query("drop database $opt_database",1);
-user_query("flush tables",1);
-safe_query("flush privileges");
-
-safe_query("select $tables_cols from mysql.tables_priv");
-safe_query("revoke ALL PRIVILEGES on $opt_database.test from $user");
-safe_query("revoke ALL PRIVILEGES on $opt_database.test2 from $user");
-safe_query("revoke ALL PRIVILEGES on $opt_database.test3 from $user");
-safe_query("revoke GRANT OPTION on $opt_database.test2 from $user");
-safe_query("select $tables_cols from mysql.tables_priv");
-user_query("select count(a) from test",1);
-
-#
-# Test some grants on column level
-#
-
-safe_query("grant create,update on $opt_database.test2 to $user");
-user_query("create table $opt_database.test2 (a int not null)");
-user_query("delete from $opt_database.test where a=2",1);
-user_query("delete from $opt_database.test where A=2",1);
-user_query("update test set b=5 where b>0",1);
-user_query("update test,test2 SET test.b=5 where b>0",1);
-
-safe_query("grant update(b),delete on $opt_database.test to $user");
-safe_query("revoke update(a) on $opt_database.test from $user",1);
-user_query("delete from $opt_database.test where a=2",1);
-user_query("update test set b=5 where b>0",1);
-safe_query("grant select(a),select(b) on $opt_database.test to $user");
-user_query("delete from $opt_database.test where a=2");
-user_query("delete from $opt_database.test where A=2");
-user_query("update test set b=5 where b>0");
-user_query("update test set a=11 where b>5",1);
-user_query("update test,test2 SET test.b=5 where b>0",1);
-user_query("update test,test2 SET test.a=11 where b>0",1);
-user_query("update test,test2 SET test.b=test2.a where b>0",1);
-user_query("update test,test2 SET test.b=11 where test2.a>0",1);
-user_query("select a,A from test");
-
-safe_query("select $tables_cols from mysql.tables_priv");
-safe_query("revoke ALL PRIVILEGES on $opt_database.test from $user");
-safe_query("select $tables_cols from mysql.tables_priv");
-safe_query("revoke GRANT OPTION on $opt_database.test from $user",1);
-safe_query("drop table $opt_database.test2");
-safe_query("revoke create,update on $opt_database.test2 from $user");
-
-#
-# Test grants on database level
-#
-
-safe_query("grant select(a) on $opt_database.test to $user");
-user_query("show full columns from test");
-safe_query("grant insert (b), update (b) on $opt_database.test to $user");
-
-user_query("select count(a) from test");
-user_query("select count(skr.a) from test as skr");
-user_query("select count(a) from test where a > 5");
-user_query("insert into test (b) values (5)");
-user_query("insert into test (b) values (a)");
-user_query("update test set b=3 where a > 0");
-
-user_query("select * from test",1);
-user_query("select b from test",1);
-user_query("select a from test where b > 0",1);
-user_query("insert into test (a) values (10)",1);
-user_query("insert into test (b) values (b)",1);
-user_query("insert into test (a,b) values (1,5)",1);
-user_query("insert into test (b) values (1),(b)",1);
-user_query("update test set b=3 where b > 0",1);
-
-safe_query("select $tables_cols from mysql.tables_priv");
-safe_query("select $columns_cols from mysql.columns_priv");
-safe_query("revoke select(a), update (b) on $opt_database.test from $user");
-safe_query("select $tables_cols from mysql.tables_priv");
-safe_query("select $columns_cols from mysql.columns_priv");
-
-user_query("select count(a) from test",1);
-user_query("update test set b=4",1);
-
-safe_query("grant select(a,b), update (a,b) on $opt_database.test to $user");
-user_query("select count(a),count(b) from test where a+b > 0");
-user_query("insert into test (b) values (9)");
-user_query("update test set b=6 where b > 0");
-
-safe_query("flush privileges"); # Test restoring privileges from disk
-safe_query("select $tables_cols from mysql.tables_priv");
-safe_query("select $columns_cols from mysql.columns_priv");
-
-# Try mixing of table and database privileges
-
-user_query("insert into test (a,b) values (12,12)",1);
-safe_query("grant insert on $opt_database.* to $user");
-user_connect(0);
-user_query("insert into test (a,b) values (13,13)");
-
-# This grants and revokes SELECT on different levels.
-safe_query("revoke select(b) on $opt_database.test from $user");
-user_query("select count(a) from test where a+b > 0",1);
-user_query("update test set b=5 where a=2");
-safe_query("grant select on $opt_database.test to $user");
-user_connect(0);
-user_query("select count(a) from test where a+b > 0");
-safe_query("revoke select(b) on $opt_database.test from $user");
-user_query("select count(a) from test where a+b > 0");
-safe_query("revoke select on $opt_database.test from $user");
-user_connect(0);
-user_query("select count(a) from test where a+b > 0",1);
-safe_query("grant select(a) on $opt_database.test to $user");
-user_query("select count(a) from test where a+b > 0",1);
-safe_query("grant select on *.* to $user");
-user_connect(0);
-user_query("select count(a) from test where a+b > 0");
-safe_query("revoke select on *.* from $user");
-safe_query("grant select(b) on $opt_database.test to $user");
-user_connect(0);
-user_query("select count(a) from test where a+b > 0");
-
-
-safe_query("select * from mysql.db where user = '$opt_user'");
-safe_query("select $tables_cols from mysql.tables_priv where user = '$opt_user'");
-safe_query("select $columns_cols from mysql.columns_priv where user = '$opt_user'");
-
-safe_query("revoke ALL PRIVILEGES on $opt_database.test from $user");
-user_query("select count(a) from test",1);
-user_query("select * from mysql.user order by hostname",1);
-safe_query("select * from mysql.db where user = '$opt_user'");
-safe_query("select $tables_cols from mysql.tables_priv where user = '$opt_user'");
-safe_query("select $columns_cols from mysql.columns_priv where user = '$opt_user'");
-
-#
-# Clear up privileges to make future tests easier
-
-safe_query("delete from user where user='$opt_user'");
-safe_query("delete from db where user='$opt_user'");
-safe_query("flush privileges");
-safe_query("show grants for $user",1);
-
-#
-# Test IDENTIFIED BY
-#
-
-safe_query("grant ALL PRIVILEGES on $opt_database.test to $user identified by 'dummy', ${opt_user}\@127.0.0.1 identified by 'dummy2'");
-user_connect(0,"dummy");
-safe_query("grant SELECT on $opt_database.* to $user identified by ''");
-user_connect(0);
-safe_query("revoke ALL PRIVILEGES on $opt_database.test from $user identified by '', ${opt_user}\@127.0.0.1 identified by 'dummy2'");
-safe_query("revoke ALL PRIVILEGES on $opt_database.* from $user identified by ''");
-
-safe_query("show grants for $user");
-
-#
-# Test bug reported in SELECT INTO OUTFILE
-#
-
-safe_query("create table $opt_database.test3 (a int, b int)");
-safe_query("grant SELECT on $opt_database.test3 to $user");
-safe_query("grant FILE on *.* to $user");
-safe_query("insert into $opt_database.test3 values (1,1)");
-user_connect(0);
-user_query("select * into outfile '$tmp_table' from $opt_database.test3");
-safe_query("revoke SELECT on $opt_database.test3 from $user");
-safe_query("grant SELECT(a) on $opt_database.test3 to $user");
-user_query("select a from $opt_database.test3");
-user_query("select * from $opt_database.test3",1);
-user_query("select a,b from $opt_database.test3",1);
-user_query("select b from $opt_database.test3",1);
-
-safe_query("revoke SELECT(a) on $opt_database.test3 from $user");
-safe_query("revoke FILE on *.* from $user");
-safe_query("drop table $opt_database.test3");
-
-#
-# Test privileges needed for LOCK TABLES
-#
-
-safe_query("create table $opt_database.test3 (a int)");
-user_connect(1);
-safe_query("grant INSERT on $opt_database.test3 to $user");
-user_connect(0);
-user_query("select * into outfile '$tmp_table' from $opt_database.test3",1);
-safe_query("grant SELECT on $opt_database.test3 to $user");
-user_connect(0);
-user_query("LOCK TABLES $opt_database.test3 READ",1);
-safe_query("grant LOCK TABLES on *.* to $user");
-safe_query("show grants for $user");
-safe_query("select * from mysql.user where user='$opt_user'");
-user_connect(0);
-user_query("LOCK TABLES $opt_database.test3 READ");
-user_query("UNLOCK TABLES");
-safe_query("revoke SELECT,INSERT,UPDATE,DELETE on $opt_database.test3 from $user");
-user_connect(0);
-safe_query("revoke LOCK TABLES on *.* from $user");
-user_connect(1);
-safe_query("drop table $opt_database.test3");
-
-#
-# test new privileges in 4.0.2
-#
-
-safe_query("show grants for $user");
-safe_query("grant all on *.* to $user WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 2 MAX_CONNECTIONS_PER_HOUR 3");
-safe_query("show grants for $user");
-safe_query("revoke LOCK TABLES on *.* from $user");
-safe_query("flush privileges");
-safe_query("show grants for $user");
-safe_query("revoke ALL PRIVILEGES on *.* from $user");
-safe_query("show grants for $user");
-
-#
-# Clean up things
-#
-
-unlink($tmp_table);
-safe_query("drop database $opt_database");
-safe_query("delete from user where user='$opt_user'");
-safe_query("delete from db where user='$opt_user'");
-safe_query("delete from tables_priv");
-safe_query("delete from columns_priv");
-safe_query("flush privileges");
-
-print "end of test\n";
-exit 0;
-
-sub usage
-{
- print <<EOF;
-$0 Ver $version
-
-This program tests that the GRANT commands works by creating a temporary
-database ($opt_database) and user ($opt_user).
-
-Options:
-
---database (Default $opt_database)
- In which database the test tables are created.
-
---force
- Don''t ask any question before starting this test.
-
---host='host name' (Default $opt_host)
- Host name where the database server is located.
-
---Information
---help
- Print this help
-
---password
- Password for root-user.
-
---server='server name' (Default $opt_server)
- Run the test on the given SQL server.
-
---user (Default $opt_user)
- A non-existing user on which we will test the GRANT commands.
-
---verbose
- Write all queries when we are execute them.
-
---root-user='user name' (Default $opt_root_user)
- User with privileges to modify the 'mysql' database.
-EOF
- exit(0);
-}
-
-
-sub print_info
-{
- my $tmp;
- print <<EOF;
-This test will clear your table and column grant table and recreate the
-$opt_database database !
-All privileges for $user will be destroyed !
-
-Don\'t run this test if you have done any GRANT commands that you want to keep!
-EOF
- for (;;)
- {
- print "Start test (yes/no) ? ";
- $tmp=<STDIN>; chomp($tmp); $tmp=lc($tmp);
- last if ($tmp =~ /^yes$/i);
- exit 1 if ($tmp =~ /^n/i);
- print "\n";
- }
-}
-
-
-sub user_connect
-{
- my ($ignore_error,$password)=@_;
- $password="" if (!defined($password));
-
- print "Connecting $opt_user\n" if ($opt_verbose);
- $user_dbh->disconnect if (defined($user_dbh));
-
- $user_dbh=DBI->connect("DBI:mysql:$opt_database:$opt_host",$opt_user,
- $password, { PrintError => 0});
- if (!$user_dbh)
- {
- if ($opt_verbose || !$ignore_error)
- {
- print "Error on connect: $DBI::errstr\n";
- }
- if (!$ignore_error)
- {
- die "The above should not have failed!";
- }
- }
- elsif ($ignore_error)
- {
- die "Connect succeeded when it shouldn't have !\n";
- }
-}
-
-sub safe_query
-{
- my ($query,$ignore_error)=@_;
- if (do_query($dbh,$query, $ignore_error))
- {
- if (!defined($ignore_error))
- {
- die "The above should not have failed!";
- }
- }
- elsif (defined($ignore_error) && $ignore_error == 1)
- {
- die "Query '$query' succeeded when it shouldn't have !\n";
- }
-}
-
-
-sub user_query
-{
- my ($query,$ignore_error)=@_;
- if (do_query($user_dbh,$query, $ignore_error))
- {
- if (!defined($ignore_error))
- {
- die "Query '$query' should not have failed!";
- }
- }
- elsif (defined($ignore_error) && $ignore_error == 1)
- {
- die "Query '$query' succeeded when it shouldn't have !\n";
- }
-}
-
-
-sub do_query
-{
- my ($my_dbh, $query, $ignore_error)=@_;
- my ($sth, $row, $tab, $col, $found, $fatal_error);
-
- print "$query\n" if ($opt_debug || $opt_verbose);
- if (!($sth= $my_dbh->prepare($query)))
- {
- print "Error in prepare: $DBI::errstr\n";
- return 1;
- }
- if (!$sth->execute)
- {
- $fatal_error= ($DBI::errstr =~ /parse error/);
- if (!$ignore_error || ($opt_verbose && $ignore_error != 3) || $fatal_error)
- {
- print "Error in execute: $DBI::errstr\n";
- }
- die if ($fatal_error);
- $sth->finish;
- return 1;
- }
- $found=0;
- if (!$opt_silent)
- {
- while (($row=$sth->fetchrow_arrayref))
- {
- $found=1;
- $tab="";
- foreach $col (@$row)
- {
- print $tab;
- print defined($col) ? $col : "NULL";
- $tab="\t";
- }
- print "\n";
- }
- print "\n" if ($found);
- }
- $sth->finish;
- return 0;
-}
diff --git a/unittest/mysys/stacktrace-t.c b/unittest/mysys/stacktrace-t.c
index 8fa0db15b36..d8408f80d76 100644
--- a/unittest/mysys/stacktrace-t.c
+++ b/unittest/mysys/stacktrace-t.c
@@ -29,6 +29,7 @@ void test_my_safe_print_str()
memcpy(b_stack, "LEGAL", 6);
memcpy(b_bss, "LEGAL", 6);
+#ifdef HAVE_STACKTRACE
#ifndef __SANITIZE_ADDRESS__
fprintf(stderr, "\n===== stack =====\n");
my_safe_print_str(b_stack, 65535);
@@ -48,6 +49,7 @@ void test_my_safe_print_str()
fprintf(stderr, "\n===== (const char*) 1 =====\n");
my_safe_print_str((const char*)1, 5);
#endif /*__SANITIZE_ADDRESS__*/
+#endif /*HAVE_STACKTRACE*/
free(b_heap);
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
index 01cc8725ecc..de24e39539c 100644
--- a/unittest/sql/mf_iocache-t.cc
+++ b/unittest/sql/mf_iocache-t.cc
@@ -95,7 +95,7 @@ void sql_print_error(const char *format, ...)
/*** end of encryption tweaks and stubs ****************************/
-IO_CACHE info;
+static IO_CACHE info;
#define CACHE_SIZE 16384
#define INFO_TAIL ", pos_in_file = %llu, pos_in_mem = %lu", \
diff --git a/vio/viossl.c b/vio/viossl.c
index 30946d3261c..ebcc5246a1c 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -97,18 +97,35 @@ static void ssl_set_sys_error(int ssl_error)
@param vio VIO object representing a SSL connection.
@param ret Value returned by a SSL I/O function.
@param event[out] The type of I/O event to wait/retry.
+ @param should_wait[out] whether to wait for 'event'
@return Whether a SSL I/O operation should be deferred.
@retval TRUE Temporary failure, retry operation.
@retval FALSE Indeterminate failure.
*/
-static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event)
+static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event, my_bool *should_wait)
{
int ssl_error;
SSL *ssl= vio->ssl_arg;
my_bool should_retry= TRUE;
+#if defined(ERR_LIB_X509) && defined(X509_R_CERT_ALREADY_IN_HASH_TABLE)
+ /*
+ Ignore error X509_R_CERT_ALREADY_IN_HASH_TABLE.
+ This is a workaround for an OpenSSL bug in an older (< 1.1.1)
+ OpenSSL version.
+ */
+ unsigned long err = ERR_peek_error();
+ if (ERR_GET_LIB(err) == ERR_LIB_X509 &&
+ ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE)
+ {
+ ERR_clear_error();
+ *should_wait= FALSE;
+ return TRUE;
+ }
+#endif
+
/* Retrieve the result for the SSL I/O operation. */
ssl_error= SSL_get_error(ssl, ret);
@@ -117,12 +134,15 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event
{
case SSL_ERROR_WANT_READ:
*event= VIO_IO_EVENT_READ;
+ *should_wait= TRUE;
break;
case SSL_ERROR_WANT_WRITE:
*event= VIO_IO_EVENT_WRITE;
+ *should_wait= TRUE;
break;
default:
should_retry= FALSE;
+ *should_wait= FALSE;
ssl_set_sys_error(ssl_error);
#ifndef HAVE_YASSL
ERR_clear_error();
@@ -134,6 +154,32 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event
}
+/**
+ Handle SSL io error.
+
+ @param[in] vio Vio
+ @param[in] ret return from the failed IO operation
+
+ @return 0 - should retry last read/write operation
+ 1 - some error has occured
+*/
+static int handle_ssl_io_error(Vio *vio, int ret)
+{
+ enum enum_vio_io_event event;
+ my_bool should_wait;
+
+ /* Process the SSL I/O error. */
+ if (!ssl_should_retry(vio, ret, &event, &should_wait))
+ return 1;
+
+ if (!should_wait)
+ return 1;
+
+ /* Attempt to wait for an I/O event. */
+ return vio_socket_io_wait(vio, event);
+}
+
+
size_t vio_ssl_read(Vio *vio, uchar *buf, size_t size)
{
int ret;
@@ -149,13 +195,7 @@ size_t vio_ssl_read(Vio *vio, uchar *buf, size_t size)
{
while ((ret= SSL_read(ssl, buf, (int)size)) < 0)
{
- enum enum_vio_io_event event;
-
- /* Process the SSL I/O error. */
- if (!ssl_should_retry(vio, ret, &event))
- break;
- /* Attempt to wait for an I/O event. */
- if (vio_socket_io_wait(vio, event))
+ if (handle_ssl_io_error(vio,ret))
break;
}
}
@@ -182,14 +222,7 @@ size_t vio_ssl_write(Vio *vio, const uchar *buf, size_t size)
{
while ((ret= SSL_write(ssl, buf, (int)size)) < 0)
{
- enum enum_vio_io_event event;
-
- /* Process the SSL I/O error. */
- if (!ssl_should_retry(vio, ret, &event))
- break;
-
- /* Attempt to wait for an I/O event. */
- if (vio_socket_io_wait(vio, event))
+ if (handle_ssl_io_error(vio,ret))
break;
}
}
@@ -296,14 +329,7 @@ static int ssl_handshake_loop(Vio *vio, SSL *ssl, ssl_handshake_func_t func)
/* Initiate the SSL handshake. */
while ((ret= func(ssl)) < 1)
{
- enum enum_vio_io_event event;
-
- /* Process the SSL I/O error. */
- if (!ssl_should_retry(vio, ret, &event))
- break;
-
- /* Wait for I/O so that the handshake can proceed. */
- if (vio_socket_io_wait(vio, event))
+ if (handle_ssl_io_error(vio,ret))
break;
}
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index 6290ada9704..6de033eacb2 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,4 +1,4 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_11.0_32_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_11.2_32_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt
index 810ec8ae0cb..ee79bc0bd5f 100644
--- a/zlib/CMakeLists.txt
+++ b/zlib/CMakeLists.txt
@@ -13,12 +13,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-cmake_minimum_required(VERSION 2.4.4)
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
-
-project(zlib C)
-
-set(VERSION "1.2.11")
include(CheckTypeSize)
include(CheckFunctionExists)
@@ -110,40 +104,7 @@ set(ZLIB_SRCS
zutil.c
)
-if(NOT MINGW)
- set(ZLIB_DLL_SRCS
- win32/zlib1.rc # If present will override custom build rule below.
- )
-endif()
-
-# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
-string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
- "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
-
ADD_CONVENIENCE_LIBRARY(zlib STATIC
${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
RESTRICT_SYMBOL_EXPORTS(zlib)
-
-if(NOT CYGWIN)
- # This property causes shared libraries on Linux to have the full version
- # encoded into their final filename. We disable this on Cygwin because
- # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
- # seems to be the default.
- #
- # This has no effect with MSVC, on that platform the version info for
- # the DLL comes from the resource file win32/zlib1.rc
- set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
-endif()
-
-if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
- # On unix-like platforms the library is almost always called libz
- set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
-elseif(UNIX)
- # On unix-like platforms the library is almost always called libz
- set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
-endif()
-
-
-RESTRICT_SYMBOL_EXPORTS(zlib)