revision-id: e709eb9bf712006d070767629518f827cd2f6bed (mariadb-10.3.21-23-ge709eb9bf71) parent(s): d531b4ee3a9bcd89a2fa6b49a2207eaf966f53e3 b04429434ad1ee7f49d263762a560f4ff31dd111 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2020-01-17 00:46:40 +0300 message: Merge branch '10.2' into 10.3 # Conflicts: # mysql-test/suite/galera/r/MW-388.result # mysql-test/suite/galera/t/MW-388.test # mysql-test/suite/innodb/r/truncate_inject.result # mysql-test/suite/innodb/t/truncate_inject.test # mysql-test/suite/rpl/r/rpl_stop_slave.result # mysql-test/suite/rpl/t/rpl_stop_slave.test # sql/sp_head.cc # sql/sp_head.h # sql/sql_lex.cc # sql/sql_yacc.yy # storage/xtradb/buf/buf0dblwr.cc mysql-test/include/binlog_inject_error.inc | 4 +- mysql-test/main/cache_temporal_4265.result | 3 +- mysql-test/main/cache_temporal_4265.test | 6 +- mysql-test/main/create_or_replace2.result | 4 +- mysql-test/main/create_or_replace2.test | 4 +- mysql-test/main/drop_bad_db_type.result | 6 +- mysql-test/main/drop_bad_db_type.test | 6 +- mysql-test/main/engine_error_in_alter-8453.result | 5 +- mysql-test/main/engine_error_in_alter-8453.test | 5 +- mysql-test/main/error_simulation.result | 11 +- mysql-test/main/error_simulation.test | 11 +- mysql-test/main/func_regexp_pcre_debug.result | 3 +- mysql-test/main/func_regexp_pcre_debug.test | 3 +- mysql-test/main/log_slow_debug.result | 4 +- mysql-test/main/log_slow_debug.test | 4 +- mysql-test/main/mdev6830.result | 2 + mysql-test/main/mdev6830.test | 4 +- mysql-test/main/merge-big.result | 2 +- mysql-test/main/merge-big.test | 2 +- mysql-test/main/merge_debug.result | 2 +- mysql-test/main/merge_debug.test | 2 +- mysql-test/main/myisam_debug.result | 4 +- mysql-test/main/myisam_debug.test | 4 +- mysql-test/main/range_innodb.result | 3 +- mysql-test/main/range_innodb.test | 3 +- mysql-test/main/range_interrupted-13751.result | 4 +- mysql-test/main/range_interrupted-13751.test | 4 +- mysql-test/main/select_debug.result | 2 + mysql-test/main/select_debug.test | 2 + mysql-test/main/show_explain.result | 178 ++++++++++---------- mysql-test/main/show_explain.test | 182 ++++++++++----------- mysql-test/main/show_explain_non_select.result | 8 +- mysql-test/main/show_explain_non_select.test | 8 +- mysql-test/main/show_explain_ps.result | 5 +- mysql-test/main/show_explain_ps.test | 5 +- mysql-test/main/slowlog_enospace-10508.result | 5 +- mysql-test/main/slowlog_enospace-10508.test | 5 +- mysql-test/main/stat_tables-enospc.result | 5 +- mysql-test/main/stat_tables-enospc.test | 5 +- mysql-test/main/union_crash-714.result | 4 +- mysql-test/main/union_crash-714.test | 4 +- mysql-test/main/warnings_debug.result | 2 + mysql-test/main/warnings_debug.test | 2 + mysql-test/suite/binlog/include/binlog_ioerr.inc | 3 +- mysql-test/suite/binlog/r/binlog_ioerr.result | 3 +- .../suite/binlog/r/binlog_write_error.result | 51 ++++-- .../suite/binlog_encryption/binlog_ioerr.result | 3 +- .../binlog_encryption/binlog_write_error.result | 51 ++++-- .../suite/binlog_encryption/rpl_checksum.result | 11 +- .../suite/binlog_encryption/rpl_corruption.result | 5 +- .../suite/binlog_encryption/rpl_incident.result | 2 + .../binlog_encryption/rpl_init_slave_errors.result | 3 +- mysql-test/suite/galera/disabled.def | 17 +- mysql-test/suite/galera/r/MW-388.result | 4 +- mysql-test/suite/galera/r/galera_events2.result | 1 + .../galera/r/galera_ist_restart_joiner.result | 1 - mysql-test/suite/galera/t/MW-388.test | 8 +- mysql-test/suite/galera/t/galera_events2.test | 4 + .../suite/gcol/r/innodb_virtual_debug_purge.result | 4 +- .../suite/gcol/t/innodb_virtual_debug_purge.test | 4 +- mysql-test/suite/innodb/r/blob-update-debug.result | 4 +- .../suite/innodb/r/innodb-replace-debug.result | 4 +- .../r/innodb-stats-initialize-failure.result | 3 +- mysql-test/suite/innodb/r/innodb-wl5522-1.result | 2 +- mysql-test/suite/innodb/r/innodb-wl5522.result | 2 +- .../suite/innodb/r/innodb_bug11754376.result | 2 + mysql-test/suite/innodb/r/innodb_bug56947.result | 2 + .../suite/innodb/r/innodb_corrupt_bit.result | 2 +- .../innodb/r/innodb_sys_semaphore_waits.result | 3 +- .../innodb/r/redo_log_during_checkpoint.result | 6 +- mysql-test/suite/innodb/t/blob-update-debug.test | 4 +- .../suite/innodb/t/innodb-replace-debug.test | 4 +- .../innodb/t/innodb-stats-initialize-failure.test | 5 +- mysql-test/suite/innodb/t/innodb_bug11754376.test | 3 +- mysql-test/suite/innodb/t/innodb_bug56947.test | 2 + mysql-test/suite/innodb/t/innodb_corrupt_bit.test | 2 +- .../suite/innodb/t/innodb_sys_semaphore_waits.test | 3 +- .../suite/innodb/t/redo_log_during_checkpoint.test | 6 +- .../suite/innodb_fts/r/concurrent_insert.result | 3 +- .../suite/innodb_fts/t/concurrent_insert.test | 3 +- mysql-test/suite/innodb_gis/r/rtree_debug.result | 2 +- mysql-test/suite/innodb_gis/t/rtree_debug.test | 2 +- mysql-test/suite/innodb_zip/r/wl5522_zip.result | 2 +- .../suite/optimizer_unfixed_bugs/r/bug36981.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug40992.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug41996.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug42991.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug43249.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug43360.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug43448.result | 2 + .../suite/optimizer_unfixed_bugs/r/bug43617.result | 2 + .../suite/optimizer_unfixed_bugs/t/bug36981.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug40992.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug41996.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug42991.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug43249.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug43360.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug43448.test | 2 + .../suite/optimizer_unfixed_bugs/t/bug43617.test | 3 +- mysql-test/suite/parts/r/partition_debug.result | 4 +- mysql-test/suite/parts/t/partition_debug.test | 4 +- .../suite/parts/t/partition_debug_innodb.test | 4 +- .../r/hostcache_ipv4_addrinfo_again_allow.result | 3 +- .../r/hostcache_ipv4_addrinfo_again_deny.result | 3 +- .../r/hostcache_ipv4_addrinfo_bad_allow.result | 3 +- .../r/hostcache_ipv4_addrinfo_bad_deny.result | 3 +- .../r/hostcache_ipv4_addrinfo_good_allow.result | 3 +- .../r/hostcache_ipv4_addrinfo_good_deny.result | 3 +- .../r/hostcache_ipv4_addrinfo_noname_allow.result | 3 +- .../r/hostcache_ipv4_addrinfo_noname_deny.result | 3 +- .../perfschema/r/hostcache_ipv4_auth_plugin.result | 3 +- .../perfschema/r/hostcache_ipv4_blocked.result | 3 +- .../perfschema/r/hostcache_ipv4_format.result | 3 +- .../perfschema/r/hostcache_ipv4_max_con.result | 3 +- .../r/hostcache_ipv4_nameinfo_again_allow.result | 3 +- .../r/hostcache_ipv4_nameinfo_again_deny.result | 3 +- .../r/hostcache_ipv4_nameinfo_noname_allow.result | 3 +- .../r/hostcache_ipv4_nameinfo_noname_deny.result | 3 +- .../perfschema/r/hostcache_ipv4_passwd.result | 3 +- .../suite/perfschema/r/hostcache_ipv4_ssl.result | 3 +- .../r/hostcache_ipv6_addrinfo_again_allow.result | 3 +- .../r/hostcache_ipv6_addrinfo_again_deny.result | 3 +- .../r/hostcache_ipv6_addrinfo_bad_allow.result | 3 +- .../r/hostcache_ipv6_addrinfo_bad_deny.result | 3 +- .../r/hostcache_ipv6_addrinfo_good_allow.result | 3 +- .../r/hostcache_ipv6_addrinfo_good_deny.result | 3 +- .../r/hostcache_ipv6_addrinfo_noname_allow.result | 3 +- .../r/hostcache_ipv6_addrinfo_noname_deny.result | 3 +- .../perfschema/r/hostcache_ipv6_auth_plugin.result | 3 +- .../perfschema/r/hostcache_ipv6_blocked.result | 3 +- .../perfschema/r/hostcache_ipv6_max_con.result | 3 +- .../r/hostcache_ipv6_nameinfo_again_allow.result | 3 +- .../r/hostcache_ipv6_nameinfo_again_deny.result | 3 +- .../r/hostcache_ipv6_nameinfo_noname_allow.result | 3 +- .../r/hostcache_ipv6_nameinfo_noname_deny.result | 3 +- .../perfschema/r/hostcache_ipv6_passwd.result | 3 +- .../suite/perfschema/r/hostcache_ipv6_ssl.result | 3 +- .../suite/perfschema/r/hostcache_peer_addr.result | 3 +- .../t/hostcache_ipv4_addrinfo_again_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_again_deny.test | 3 +- .../t/hostcache_ipv4_addrinfo_bad_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_bad_deny.test | 3 +- .../t/hostcache_ipv4_addrinfo_good_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_good_deny.test | 3 +- .../t/hostcache_ipv4_addrinfo_noname_allow.test | 3 +- .../t/hostcache_ipv4_addrinfo_noname_deny.test | 3 +- .../perfschema/t/hostcache_ipv4_auth_plugin.test | 3 +- .../suite/perfschema/t/hostcache_ipv4_blocked.test | 3 +- .../suite/perfschema/t/hostcache_ipv4_format.test | 3 +- .../suite/perfschema/t/hostcache_ipv4_max_con.test | 3 +- .../t/hostcache_ipv4_nameinfo_again_allow.test | 3 +- .../t/hostcache_ipv4_nameinfo_again_deny.test | 3 +- .../t/hostcache_ipv4_nameinfo_noname_allow.test | 3 +- .../t/hostcache_ipv4_nameinfo_noname_deny.test | 3 +- .../suite/perfschema/t/hostcache_ipv4_passwd.test | 3 +- .../suite/perfschema/t/hostcache_ipv4_ssl.test | 3 +- .../t/hostcache_ipv6_addrinfo_again_allow.test | 3 +- .../t/hostcache_ipv6_addrinfo_again_deny.test | 3 +- .../t/hostcache_ipv6_addrinfo_bad_allow.test | 3 +- .../t/hostcache_ipv6_addrinfo_bad_deny.test | 3 +- .../t/hostcache_ipv6_addrinfo_good_allow.test | 3 +- .../t/hostcache_ipv6_addrinfo_good_deny.test | 3 +- .../t/hostcache_ipv6_addrinfo_noname_allow.test | 4 +- .../t/hostcache_ipv6_addrinfo_noname_deny.test | 4 +- .../perfschema/t/hostcache_ipv6_auth_plugin.test | 3 +- .../suite/perfschema/t/hostcache_ipv6_blocked.test | 3 +- .../suite/perfschema/t/hostcache_ipv6_max_con.test | 3 +- .../t/hostcache_ipv6_nameinfo_again_allow.test | 3 +- .../t/hostcache_ipv6_nameinfo_again_deny.test | 3 +- .../t/hostcache_ipv6_nameinfo_noname_allow.test | 3 +- .../t/hostcache_ipv6_nameinfo_noname_deny.test | 3 +- .../suite/perfschema/t/hostcache_ipv6_passwd.test | 3 +- .../suite/perfschema/t/hostcache_ipv6_ssl.test | 3 +- .../suite/perfschema/t/hostcache_peer_addr.test | 3 +- mysql-test/suite/rpl/include/rpl_checksum.inc | 12 +- mysql-test/suite/rpl/include/rpl_corruption.inc | 5 +- mysql-test/suite/rpl/include/rpl_incident.inc | 6 +- .../suite/rpl/include/rpl_init_slave_errors.inc | 3 +- mysql-test/suite/rpl/r/kill_race_condition.result | 3 +- .../suite/rpl/r/rpl_binlog_rollback_cleanup.result | 9 + mysql-test/suite/rpl/r/rpl_bug33931.result | 3 +- mysql-test/suite/rpl/r/rpl_bug41902.result | 3 + mysql-test/suite/rpl/r/rpl_checksum.result | 11 +- mysql-test/suite/rpl/r/rpl_corruption.result | 5 +- mysql-test/suite/rpl/r/rpl_heartbeat_debug.result | 4 +- mysql-test/suite/rpl/r/rpl_incident.result | 2 + .../suite/rpl/r/rpl_init_slave_errors.result | 3 +- mysql-test/suite/rpl/r/rpl_row_big_table_id.result | 2 + .../suite/rpl/r/rpl_row_find_row_debug.result | 3 +- .../suite/rpl/r/rpl_semi_sync_skip_repl.result | 3 +- .../suite/rpl/r/rpl_show_slave_running.result | 3 +- .../rpl/r/rpl_slave_load_remove_tmpfile.result | 3 +- mysql-test/suite/rpl/r/rpl_stop_slave.result | 6 +- mysql-test/suite/rpl/r/rpl_view_debug.result | 2 + mysql-test/suite/rpl/t/kill_race_condition.test | 3 +- .../suite/rpl/t/rpl_binlog_rollback_cleanup.test | 46 ++++++ mysql-test/suite/rpl/t/rpl_bug33931.test | 3 +- mysql-test/suite/rpl/t/rpl_bug41902.test | 5 +- .../rpl/t/rpl_get_master_version_and_clock.test | 6 +- mysql-test/suite/rpl/t/rpl_heartbeat_debug.test | 4 +- mysql-test/suite/rpl/t/rpl_row_big_table_id.test | 3 +- mysql-test/suite/rpl/t/rpl_row_find_row_debug.test | 4 +- mysql-test/suite/rpl/t/rpl_row_index_choice.test | 4 +- .../suite/rpl/t/rpl_semi_sync_skip_repl.test | 4 +- mysql-test/suite/rpl/t/rpl_show_slave_running.test | 4 +- .../suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 4 +- mysql-test/suite/rpl/t/rpl_stop_slave.test | 12 +- mysql-test/suite/rpl/t/rpl_view_debug.test | 3 +- mysql-test/suite/sys_vars/r/debug_dbug_func.result | 6 +- mysql-test/suite/sys_vars/t/debug_dbug_func.test | 6 +- mysql-test/suite/wsrep/disabled.def | 2 +- mysql-test/suite/wsrep/t/binlog_format.opt | 2 +- sql/item_func.cc | 3 +- sql/log.cc | 3 +- sql/sp_head.cc | 12 +- sql/sp_head.h | 2 - sql/sql_select.cc | 13 +- storage/innobase/buf/buf0dblwr.cc | 4 +- storage/innobase/row/row0import.cc | 70 +++++--- 219 files changed, 841 insertions(+), 524 deletions(-) diff --cc mysql-test/main/log_slow_debug.result index 71a76342aba,00000000000..16d67d7fdc7 mode 100644,000000..100644 --- a/mysql-test/main/log_slow_debug.result +++ b/mysql-test/main/log_slow_debug.result @@@ -1,226 -1,0 +1,226 @@@ +SET @org_slow_query_log= @@global.slow_query_log; +SET @org_log_output= @@global.log_output; +SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements; +SET @@GLOBAL.slow_query_log=OFF; +SET @@GLOBAL.log_output='TABLE'; +FLUSH SLOW LOGS; +SET @@GLOBAL.slow_query_log=ON; +SET @@GLOBAL.log_slow_admin_statements=ON; - SET @save_dbug = @@debug_dbug; ++SET @saved_dbug = @@debug_dbug; +SET SESSION debug_dbug="+d,simulate_slow_query"; +CREATE PROCEDURE show_slow_log() +BEGIN +SELECT CONCAT('[slow] ', sql_text) AS sql_text +FROM mysql.slow_log +WHERE sql_text NOT LIKE '%debug_dbug%'; +END +$$ +# +# Expect all admin statements in the slow log (ON,DEFAULT) +# +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); +sql_text +[slow] TRUNCATE TABLE mysql.slow_log +[slow] CREATE TABLE t1 (a INT) +[slow] CREATE INDEX t1a ON t1 (a) +[slow] DROP INDEX t1a ON t1 +[slow] DROP TABLE t1 +[slow] CREATE TABLE t2 (a INT) +[slow] ALTER TABLE t2 RENAME t2 +[slow] RENAME TABLE t2 TO t3 +[slow] DROP TABLE t3 +[slow] CREATE TABLE t4 (a INT) +[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1' +[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP TABLE t4 +[slow] CREATE SEQUENCE s4 +[slow] ALTER SEQUENCE s4 MAXVALUE 100 +[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101' +[slow] ALTER SEQUENCE s4 MAXVALUE=101 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP SEQUENCE s4 +# +# Expect all admin statements in the slow log (ON,admin) +# +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=admin; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); +sql_text +[slow] CREATE INDEX t1a ON t1 (a) +[slow] DROP INDEX t1a ON t1 +[slow] ALTER TABLE t2 RENAME t2 +[slow] RENAME TABLE t2 TO t3 +[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +[slow] ALTER SEQUENCE s4 MAXVALUE 100 +[slow] ALTER SEQUENCE s4 MAXVALUE=101 +# +# Expect none of admin DDL statements in the slow log (ON,filesort) +# +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=filesort; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); +sql_text +# +# Expect none of admin statements in the slow log (OFF,DEFAULT) +# +SET @@SESSION.log_slow_admin_statements=OFF; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); +sql_text +[slow] TRUNCATE TABLE mysql.slow_log +[slow] CREATE TABLE t1 (a INT) +[slow] DROP TABLE t1 +[slow] CREATE TABLE t2 (a INT) +[slow] DROP TABLE t3 +[slow] CREATE TABLE t4 (a INT) +[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1' +[slow] DEALLOCATE PREPARE stmt +[slow] DROP TABLE t4 +[slow] CREATE SEQUENCE s4 +[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101' +[slow] DEALLOCATE PREPARE stmt +[slow] DROP SEQUENCE s4 +# +# Expect all admin statements in the slow log (GLOBAL OFF,LOCAL ON,DEFAULT) +# In the original implementation, this combination disabled slow log for admin commands. +# However, instead of this exception in GLOBAL vs LOCAL variable behaviour, +# we should make max_system_variables.log_slow_admin_statements=0 +# prevent enabling globally suppressed logging by setting the session variable to ON. +# +SET @@GLOBAL.log_slow_admin_statements=OFF; +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); +sql_text +[slow] TRUNCATE TABLE mysql.slow_log +[slow] CREATE TABLE t1 (a INT) +[slow] CREATE INDEX t1a ON t1 (a) +[slow] DROP INDEX t1a ON t1 +[slow] DROP TABLE t1 +[slow] CREATE TABLE t2 (a INT) +[slow] ALTER TABLE t2 RENAME t2 +[slow] RENAME TABLE t2 TO t3 +[slow] DROP TABLE t3 +[slow] CREATE TABLE t4 (a INT) +[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1' +[slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP TABLE t4 +[slow] CREATE SEQUENCE s4 +[slow] ALTER SEQUENCE s4 MAXVALUE 100 +[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101' +[slow] ALTER SEQUENCE s4 MAXVALUE=101 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP SEQUENCE s4 +# +# Clean up +# - SET SESSION debug_dbug=@save_dbug; ++SET SESSION debug_dbug=@saved_dbug; +TRUNCATE mysql.slow_log; +SET @@global.slow_query_log= @org_slow_query_log; +SET @@global.log_output= @org_log_output; +SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; +DROP PROCEDURE show_slow_log; diff --cc mysql-test/main/log_slow_debug.test index 6b7cdd62f8a,00000000000..aba4cbc8dcb mode 100644,000000..100644 --- a/mysql-test/main/log_slow_debug.test +++ b/mysql-test/main/log_slow_debug.test @@@ -1,95 -1,0 +1,95 @@@ +-- source include/have_debug.inc + +SET @org_slow_query_log= @@global.slow_query_log; +SET @org_log_output= @@global.log_output; +SET @org_log_slow_admin_statements= @@global.log_slow_admin_statements; + +SET @@GLOBAL.slow_query_log=OFF; +SET @@GLOBAL.log_output='TABLE'; +FLUSH SLOW LOGS; +SET @@GLOBAL.slow_query_log=ON; +SET @@GLOBAL.log_slow_admin_statements=ON; - SET @save_dbug = @@debug_dbug; ++SET @saved_dbug = @@debug_dbug; +SET SESSION debug_dbug="+d,simulate_slow_query"; + +DELIMITER $$; +CREATE PROCEDURE show_slow_log() +BEGIN + SELECT CONCAT('[slow] ', sql_text) AS sql_text + FROM mysql.slow_log + WHERE sql_text NOT LIKE '%debug_dbug%'; +END +$$ +DELIMITER ;$$ + + +--echo # +--echo # Expect all admin statements in the slow log (ON,DEFAULT) +--echo # + +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +--source include/log_slow_debug_common.inc +CALL show_slow_log(); + + +--echo # +--echo # Expect all admin statements in the slow log (ON,admin) +--echo # + +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=admin; +TRUNCATE TABLE mysql.slow_log; +--source include/log_slow_debug_common.inc +CALL show_slow_log(); + + +--echo # +--echo # Expect none of admin DDL statements in the slow log (ON,filesort) +--echo # + +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=filesort; +TRUNCATE TABLE mysql.slow_log; +--source include/log_slow_debug_common.inc +CALL show_slow_log(); + + +--echo # +--echo # Expect none of admin statements in the slow log (OFF,DEFAULT) +--echo # + +SET @@SESSION.log_slow_admin_statements=OFF; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +--source include/log_slow_debug_common.inc +CALL show_slow_log(); + + +--echo # +--echo # Expect all admin statements in the slow log (GLOBAL OFF,LOCAL ON,DEFAULT) +--echo # In the original implementation, this combination disabled slow log for admin commands. +--echo # However, instead of this exception in GLOBAL vs LOCAL variable behaviour, +--echo # we should make max_system_variables.log_slow_admin_statements=0 +--echo # prevent enabling globally suppressed logging by setting the session variable to ON. +--echo # + +SET @@GLOBAL.log_slow_admin_statements=OFF; +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +--source include/log_slow_debug_common.inc +CALL show_slow_log(); + + +--echo # +--echo # Clean up +--echo # + - SET SESSION debug_dbug=@save_dbug; ++SET SESSION debug_dbug=@saved_dbug; +TRUNCATE mysql.slow_log; +SET @@global.slow_query_log= @org_slow_query_log; +SET @@global.log_output= @org_log_output; +SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; +DROP PROCEDURE show_slow_log; diff --cc mysql-test/main/show_explain_ps.result index 69ee2cab31d,00000000000..1c3be0d5953 mode 100644,000000..100644 --- a/mysql-test/main/show_explain_ps.result +++ b/mysql-test/main/show_explain_ps.result @@@ -1,41 -1,0 +1,42 @@@ +truncate table performance_schema.events_statements_history_long; +truncate table performance_schema.events_stages_history_long; +drop table if exists t0, t1; +select * from performance_schema.setup_instruments where name like '%show_explain%'; +NAME ENABLED TIMED +wait/synch/cond/sql/show_explain YES YES +stage/sql/Show explain YES YES +statement/sql/show_explain YES YES +# We've got no instances +select * from performance_schema.cond_instances where name like '%show_explain%'; +NAME OBJECT_INSTANCE_BEGIN +# Check out if our cond is hit. +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +connect con1, localhost, root,,; +connection con1; +connection default; +connection con1; +set @show_explain_probe_select_id=1; - set debug_dbug='d,show_explain_probe_join_exec_start'; ++SET @saved_dbug = @@SESSION.debug_dbug; ++SET debug_dbug='d,show_explain_probe_join_exec_start'; +select count(*) from t0 where a < 100000; +connection default; +show explain for $thr2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +Warnings: +Note 1003 select count(*) from t0 where a < 100000 +connection con1; +count(*) +10 - set debug_dbug=''; ++SET debug_dbug= @saved_dbug; +select event_name +from +performance_schema.events_stages_history_long join +performance_schema.threads using (thread_id) +where +event_name like '%show explain' and +processlist_id=$thr1; +event_name +stage/sql/Show explain +drop table t0; diff --cc mysql-test/suite/galera/r/MW-388.result index a2cf02712bb,2785c1d0326..59d499e117d --- a/mysql-test/suite/galera/r/MW-388.result +++ b/mysql-test/suite/galera/r/MW-388.result @@@ -18,12 -18,10 +18,10 @@@ connection node_1a SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; SET SESSION wsrep_sync_wait = 0; - SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue'; CALL insert_proc ();; connection node_1a; - SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; + SET SESSION wsrep_sync_wait = 0; -SET GLOBAL debug_dbug = ""; +SET GLOBAL DEBUG_DBUG = ""; - SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; connection node_2; connection node_1; diff --cc mysql-test/suite/galera/t/MW-388.test index 042b7e2fee5,40522f30abb..09fc8a8bfc9 --- a/mysql-test/suite/galera/t/MW-388.test +++ b/mysql-test/suite/galera/t/MW-388.test @@@ -29,8 -29,10 +29,10 @@@ DELIMITER ; # local monitor, and our INSERT remains stuck there. SET GLOBAL wsrep_slave_threads = 2; -SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; + --let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + --connection node_2 --send INSERT INTO t1 VALUES (1, 'node 2'); @@@ -43,12 -45,11 +45,12 @@@ SET SESSION wsrep_sync_wait = 0 --send CALL insert_proc (); --connection node_1a - SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached"; + SET SESSION wsrep_sync_wait = 0; + --let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' + --source include/wait_condition.inc -SET GLOBAL debug_dbug = ""; + +SET GLOBAL DEBUG_DBUG = ""; - SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; --connection node_2 diff --cc mysql-test/suite/rpl/r/rpl_row_find_row_debug.result index 269dc16733a,650f6eeee51..f1a0059a04f --- a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result +++ b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result @@@ -15,10 -16,9 +16,10 @@@ DELETE FROM t1 DROP TABLE t1; connection slave; # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log -Occurrences: update=1, delete=1 +FOUND 1 /The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount/ in mysqld.2.err +FOUND 1 /The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount/ in mysqld.2.err include/stop_slave.inc - SET GLOBAL debug_dbug = ''; + SET @@GLOBAL.debug_dbug = @saved_dbug; SET GLOBAL log_warnings = 2; include/start_slave.inc include/rpl_end.inc diff --cc mysql-test/suite/rpl/r/rpl_stop_slave.result index 4b9c544527b,597df34c302..a4dbf13290a --- a/mysql-test/suite/rpl/r/rpl_stop_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result @@@ -15,8 -15,8 +15,8 @@@ include/stop_slave.in # Suspend the INSERT statement in current transaction on SQL thread. # It guarantees that SQL thread is applying the transaction when # STOP SLAVE command launchs. - set @old_debug=@@global.debug; + SET @saved_dbug = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,after_mysql_insert,*'; +set global debug_dbug= '+d,after_mysql_insert'; include/start_slave.inc # CREATE TEMPORARY TABLE with InnoDB engine @@@ -99,8 -100,8 +100,8 @@@ connection slave include/stop_slave.inc connection master; include/stop_dump_threads.inc - set @old_debug=@@global.debug; + SET @saved_dbug = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*'; +set global debug_dbug= '+d,dump_thread_wait_before_send_xid'; connection slave; include/start_slave.inc BEGIN; diff --cc mysql-test/suite/rpl/r/rpl_view_debug.result index 497f4303698,e23f33c035f..1ec3dda9daa --- a/mysql-test/suite/rpl/r/rpl_view_debug.result +++ b/mysql-test/suite/rpl/r/rpl_view_debug.result @@@ -21,9 -21,10 +21,10 @@@ Tables_in_tes t1 v1 connection master; + SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug="d,simulate_register_view_failure"; CREATE VIEW v2 as SELECT * FROM t1; -ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space +ERROR HY000: Out of memory. show tables; Tables_in_test t1 diff --cc mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index 9c4cc1bc34d,a61c06a92e5..02665c70b9e --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@@ -26,25 -26,23 +26,23 @@@ call mtr.add_suppression("Fatal error: call mtr.add_suppression("Slave I/O thread .* register on master"); #Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection - let $debug_saved= `select @@global.debug`; + SET @saved_dbug = @@GLOBAL.debug_dbug; -# set up two parameters to pass into extra/rpl_tests/rpl_get_master_version_and_clock +# set up two parameters to pass into include/rpl_get_master_version_and_clock let $dbug_sync_point= 'debug_lock.before_get_UNIX_TIMESTAMP'; let $debug_sync_action= 'now SIGNAL signal.get_unix_timestamp'; -source extra/rpl_tests/rpl_get_master_version_and_clock.test; +source include/rpl_get_master_version_and_clock.test; #Test case 2: Try to get the value of the SERVER_ID from master under network disconnection connection slave; let $dbug_sync_point= 'debug_lock.before_get_SERVER_ID'; let $debug_sync_action= 'now SIGNAL signal.get_server_id'; -source extra/rpl_tests/rpl_get_master_version_and_clock.test; +source include/rpl_get_master_version_and_clock.test; - eval set global debug_dbug= '$debug_saved'; - # cleanup - + SET @@GLOBAL.debug_dbug = @saved_dbug; # is not really necessary but avoids mtr post-run env check warnings SET DEBUG_SYNC= 'RESET'; diff --cc mysql-test/suite/rpl/t/rpl_stop_slave.test index 291524126ec,afe36334f18..17efa7ade3b --- a/mysql-test/suite/rpl/t/rpl_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test @@@ -22,8 -22,8 +22,8 @@@ source include/stop_slave.inc --echo # Suspend the INSERT statement in current transaction on SQL thread. --echo # It guarantees that SQL thread is applying the transaction when --echo # STOP SLAVE command launchs. - set @old_debug=@@global.debug; + SET @saved_dbug = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,after_mysql_insert,*'; +set global debug_dbug= '+d,after_mysql_insert'; source include/start_slave.inc; --echo @@@ -79,8 -77,8 +77,8 @@@ connection master # make sure that there are no zombie threads --source include/stop_dump_threads.inc - set @old_debug=@@global.debug; + SET @saved_dbug = @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*'; +set global debug_dbug= '+d,dump_thread_wait_before_send_xid'; connection slave; --source include/start_slave.inc diff --cc sql/log.cc index 900cc1b8197,91dfac07993..0aac2ee61fb --- a/sql/log.cc +++ b/sql/log.cc @@@ -481,18 -445,19 +481,19 @@@ private It truncates the cache to a certain position. This includes deleting the pending event. */ - void truncate(my_off_t pos) + void truncate(my_off_t pos, bool reset_cache=0) { DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos)); + cache_log.error=0; if (pending()) { delete pending(); set_pending(0); } - reinit_io_cache(&cache_log, WRITE_CACHE, pos, 0, 0); + reinit_io_cache(&cache_log, WRITE_CACHE, pos, 0, reset_cache); cache_log.end_of_file= saved_max_binlog_cache_size; } - + binlog_cache_data& operator=(const binlog_cache_data& info); binlog_cache_data(const binlog_cache_data& info); }; diff --cc sql/sp_head.cc index af4316085b7,1f5c6e96906..3a113de9dd5 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@@ -468,19 -532,12 +468,19 @@@ check_routine_name(const LEX_CSTRING *i } -sp_head* sp_head::create() +/* + * + * sp_head + * + */ - ++ +sp_head *sp_head::create(sp_package *parent, const Sp_handler *handler) { MEM_ROOT own_root; - init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0)); + init_sql_alloc(&own_root, "sp_head", MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, + MYF(0)); sp_head *sp; - if (!(sp= new (&own_root) sp_head(&own_root))) + if (!(sp= new (&own_root) sp_head(&own_root, parent, handler))) free_root(&own_root, MYF(0)); return sp; @@@ -493,35 -550,23 +493,41 @@@ void sp_head::destroy(sp_head *sp { /* Make a copy of main_mem_root as free_root will free the sp */ MEM_ROOT own_root= sp->main_mem_root; - delete sp; - - DBUG_PRINT("info", ("mem_root %p moved to %p", - &sp->main_mem_root, &own_root)); + DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx", + (ulong) &sp->mem_root, (ulong) &own_root)); + delete sp; ++ ++ free_root(&own_root, MYF(0)); } } + /* + * + * sp_head + * + */ -sp_head::sp_head(MEM_ROOT *mem_root_arg) +sp_head::sp_head(MEM_ROOT *mem_root_arg, sp_package *parent, + const Sp_handler *sph) :Query_arena(NULL, STMT_INITIALIZED_FOR_SP), - main_mem_root(*mem_root_arg), // todo: std::move operator. + Database_qualified_name(&null_clex_str, &null_clex_str), + main_mem_root(*mem_root_arg), + m_parent(parent), + m_handler(sph), m_flags(0), + m_tmp_query(NULL), + m_explicit_name(false), + /* + FIXME: the only use case when name is NULL is events, and it should + be rewritten soon. Remove the else part and replace 'if' with + an assert when this is done. + */ + m_qname(null_clex_str), + m_params(null_clex_str), + m_body(null_clex_str), + m_body_utf8(null_clex_str), + m_defstr(null_clex_str), m_sp_cache_version(0), m_creation_ctx(0), unsafe_flags(0), diff --cc sql/sp_head.h index 7e00cf7a0d8,882ff32f5e6..493bb777bdf --- a/sql/sp_head.h +++ b/sql/sp_head.h @@@ -316,16 -298,17 +316,14 @@@ public being opened is probably enough). */ SQL_I_List<Item_trigger_field> m_trg_table_fields; -private: - // users must use sp= sp_head::create() - sp_head(MEM_ROOT *mem_root_arg); - // users must use sp_head::destroy(sp) +protected: + sp_head(MEM_ROOT *mem_root, sp_package *parent, const Sp_handler *handler); virtual ~sp_head(); -- public: - static sp_head* create(); static void destroy(sp_head *sp); + static sp_head *create(sp_package *parent, const Sp_handler *handler); - /// Initialize after we have reset mem_root void init(LEX *lex);