List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:August 13 2010 8:43am
Subject:bzr commit into mysql-5.5-bugfixing branch (jon.hauglid:3105)
View as plain text  
#At file:///export/home/x/mysql-5.5-runtime-test/ based on revid:jon.hauglid@stripped

 3105 Jon Olav Hauglid	2010-08-13 [merge]
      Merge from mysql-5.5-bugfixing to mysql-5.5-runtime.

    removed:
      mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result
      mysql-test/suite/perfschema/r/ddl_processlist.result
      mysql-test/suite/perfschema/r/ddl_setup_objects.result
      mysql-test/suite/perfschema/r/dml_ews_by_event_name.result
      mysql-test/suite/perfschema/r/dml_processlist.result
      mysql-test/suite/perfschema/r/dml_setup_objects.result
      mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test
      mysql-test/suite/perfschema/t/ddl_processlist.test
      mysql-test/suite/perfschema/t/ddl_setup_objects.test
      mysql-test/suite/perfschema/t/dml_ews_by_event_name.test
      mysql-test/suite/perfschema/t/dml_processlist.test
      mysql-test/suite/perfschema/t/dml_setup_objects.test
      storage/perfschema/table_processlist.cc
      storage/perfschema/table_processlist.h
      storage/perfschema/table_setup_objects.cc
      storage/perfschema/table_setup_objects.h
    added:
      mysql-test/include/mysql_upgrade_preparation.inc
      mysql-test/r/mysql_upgrade_ssl.result
      mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
      mysql-test/suite/perfschema/t/dml_threads.test
      mysql-test/t/mysql_upgrade_ssl.test
      storage/perfschema/table_ews_global_by_event_name.cc
      storage/perfschema/table_ews_global_by_event_name.h
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
    modified:
      client/mysql_upgrade.c
      mysql-test/extra/rpl_tests/create_recursive_construct.inc
      mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
      mysql-test/suite/binlog/r/binlog_unsafe.result
      mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
      mysql-test/suite/binlog/t/binlog_unsafe.test
      mysql-test/suite/binlog/t/disabled.def
      mysql-test/suite/ndb/r/ndb_cursor.result
      mysql-test/suite/perfschema/include/setup_helper.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/aggregate.result
      mysql-test/suite/perfschema/r/func_file_io.result
      mysql-test/suite/perfschema/r/information_schema.result
      mysql-test/suite/perfschema/r/misc.result
      mysql-test/suite/perfschema/r/no_threads.result
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/schema.result
      mysql-test/suite/perfschema/r/selects.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/t/aggregate.test
      mysql-test/suite/perfschema/t/func_file_io.test
      mysql-test/suite/perfschema/t/misc.test
      mysql-test/suite/perfschema/t/no_threads.test
      mysql-test/suite/perfschema/t/schema.test
      mysql-test/suite/perfschema/t/selects.test
      mysql-test/suite/perfschema/t/start_server_no_thread_class.test
      mysql-test/suite/perfschema/t/start_server_no_thread_inst.test
      mysql-test/suite/perfschema/t/thread_cache.test
      mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
      mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
      mysql-test/suite/rpl_ndb/t/disabled.def
      mysql-test/t/mysql_upgrade.test
      scripts/CMakeLists.txt
      scripts/mysql_config.sh
      scripts/mysql_system_tables.sql
      sql/CMakeLists.txt
      sql/log.cc
      sql/log_event.cc
      sql/sp_head.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/Makefile.am
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_events_waits.cc
      storage/perfschema/pfs_events_waits.h
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_events_waits_summary.h
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2010-07-20 19:30:10 +0000
+++ b/client/mysql_upgrade.c	2010-08-11 17:56:56 +0000
@@ -209,6 +209,9 @@ static void add_one_option(DYNAMIC_STRIN
     case GET_STR:
       arg= argument;
       break;
+    case GET_BOOL:
+      arg= (*(my_bool *)opt->value) ? "1" : "0";
+      break;
     default:
       die("internal error at %s: %d",__FILE__, __LINE__);
     }

=== modified file 'mysql-test/extra/rpl_tests/create_recursive_construct.inc'
--- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc	2009-12-14 14:33:03 +0000
+++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc	2010-08-10 11:32:54 +0000
@@ -200,7 +200,7 @@ if (`SELECT $CRC_ARG_type = 1`) {
 if (`SELECT $CRC_ARG_type = 2`) {
   # It will be unsafe to call this procedure.
   --let $CRC_name= proc_$CRC_ARG_level
-  --let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END
+  --let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN $CRC_ARG_stmt_sidef; INSERT INTO ta$CRC_ARG_level VALUES (47); END
   --let $CRC_RET_stmt_sidef= CALL $CRC_name()
   --let $CRC_RET_value=
   --let $CRC_RET_sel_retval=
@@ -344,25 +344,8 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`
   if (`SELECT '$event_type' != 'Table_map'`) {
     --enable_query_log
     --echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
-
-    # Currently, there is a bug causing some statements to be logged
-    # partially in statement format. Hence, we don't fail here, we
-    # just print the events (masking out nondeterministic components
-    # of the output) and continue. When binloggging works perfectly,
-    # we should instead execute:
-    #--enable_query_log
-    #SHOW BINLOG EVENTS;
-    #--die Wrong events in binlog.
-
-    # Here, we should really source
-    # include/show_binlog_events.inc. But due to BUG#41913, that
-    # doesn't work, and we have to inline the entire file here. Sigh
-    # :-(
-    --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR 107 <binlog_start>
-    --replace_column 2 # 4 # 5 #
-    --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
-    --eval SHOW BINLOG EVENTS FROM 107
-    --disable_query_log
+    SHOW BINLOG EVENTS;
+    --die Wrong events in binlog.
   }
   SET binlog_format = STATEMENT;
 

=== added file 'mysql-test/include/mysql_upgrade_preparation.inc'
--- a/mysql-test/include/mysql_upgrade_preparation.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/mysql_upgrade_preparation.inc	2010-08-11 17:56:56 +0000
@@ -0,0 +1,30 @@
+# Include this in any test using mysql_upgrade
+
+# Can't run test of external client with embedded server
+-- source include/not_embedded.inc
+
+# Only run test if "mysql_upgrade" is found
+--require r/have_mysql_upgrade.result
+--disable_query_log
+select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
+--enable_query_log
+
+#
+# Hack:
+#
+# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
+# consumption (CPU) for upgrading a large log table will be intense.
+# Therefore, truncate the log table in advance and issue a statement
+# that should be logged.
+#
+if (`SELECT $VALGRIND_TEST`)
+{
+  --disable_query_log
+  --disable_result_log
+  --disable_abort_on_error
+  TRUNCATE TABLE mysql.general_log;
+  SELECT 1;
+  --enable_abort_on_error
+  --enable_result_log
+  --enable_query_log
+}

=== added file 'mysql-test/r/mysql_upgrade_ssl.result'
--- a/mysql-test/r/mysql_upgrade_ssl.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysql_upgrade_ssl.result	2010-08-11 17:56:56 +0000
@@ -0,0 +1,32 @@
+#
+# Bug#55672 mysql_upgrade dies with internal error 
+#
+mtr.global_suppressions                            OK
+mtr.test_suppressions                              OK
+mysql.columns_priv                                 OK
+mysql.db                                           OK
+mysql.event                                        OK
+mysql.func                                         OK
+mysql.general_log
+Error    : You can't use locks with log tables.
+status   : OK
+mysql.help_category                                OK
+mysql.help_keyword                                 OK
+mysql.help_relation                                OK
+mysql.help_topic                                   OK
+mysql.host                                         OK
+mysql.ndb_binlog_index                             OK
+mysql.plugin                                       OK
+mysql.proc                                         OK
+mysql.procs_priv                                   OK
+mysql.servers                                      OK
+mysql.slow_log
+Error    : You can't use locks with log tables.
+status   : 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

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result	2010-05-27 15:43:08 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result	2010-08-10 11:32:54 +0000
@@ -28,6 +28,25 @@ INSERT INTO t1 VALUES (1,2), (2,3);
 UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
 UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
 DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(1000));
+INSERT INTO t1 VALUES (CURRENT_USER());
+INSERT INTO t1 VALUES (FOUND_ROWS());
+INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
+INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
+INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
+INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
+INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
+INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
+INSERT INTO t1 VALUES (ROW_COUNT());
+INSERT INTO t1 VALUES (SESSION_USER());
+INSERT INTO t1 VALUES (SLEEP(1));
+INSERT INTO t1 VALUES (SYSDATE());
+INSERT INTO t1 VALUES (SYSTEM_USER());
+INSERT INTO t1 VALUES (USER());
+INSERT INTO t1 VALUES (UUID());
+INSERT INTO t1 VALUES (UUID_SHORT());
+INSERT INTO t1 VALUES (VERSION());
+INSERT INTO t1 VALUES (RAND());
 DROP DATABASE b42851;
 USE test;
 #
@@ -67,8 +86,11 @@ Note	1592	Unsafe statement written to th
 SELECT sf_bug50192();
 sf_bug50192()
 1
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 SHOW WARNINGS;
 Level	Code	Message
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 DROP FUNCTION sf_bug50192;
 DROP TRIGGER tr_bug50192;
 DROP TABLE t1, t2;

=== modified file 'mysql-test/suite/binlog/r/binlog_unsafe.result'
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result	2010-08-10 11:32:54 +0000
@@ -35,7 +35,7 @@ CREATE FUNCTION func_retval_1() RETURNS 
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 VALUES (func_retval_1());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -46,7 +46,7 @@ CREATE FUNCTION func_retval_2() RETURNS 
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 VALUES (func_retval_2());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -58,31 +58,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UUID() function.
@@ -90,7 +78,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -98,11 +86,11 @@ DROP TRIGGER trig_2;
 Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UUID() function.
 CREATE VIEW view_retval_2 AS SELECT func_retval_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_retval_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -114,7 +102,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 VALU
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -125,7 +113,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -134,33 +122,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UUID() function.
@@ -168,7 +142,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -176,11 +150,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UUID() function.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -190,18 +164,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 VALUES (UUID()); INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -210,33 +184,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UUID() function.
@@ -244,7 +204,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -254,7 +214,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -265,7 +225,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -274,33 +234,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UUID() function.
@@ -308,7 +254,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -318,7 +264,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -326,12 +272,10 @@ DROP TRIGGER trig_1;
 
 Invoking view view_retval_1 returning value from unsafe UUID() function.
 CREATE VIEW view_retval_1 AS SELECT UUID();
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT * FROM view_retval_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -342,29 +286,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe UUID() function.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe UUID() function.
@@ -372,19 +306,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
 
 Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe UUID() function.
 CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_retval_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -396,7 +328,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -407,7 +339,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 VALU
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -416,7 +348,7 @@ Invoking unsafe UUID() function.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t0 VALUES (UUID());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -429,7 +361,7 @@ CREATE FUNCTION func_retval_1() RETURNS 
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 VALUES (func_retval_1());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -440,7 +372,7 @@ CREATE FUNCTION func_retval_2() RETURNS 
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 VALUES (func_retval_2());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -452,31 +384,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
@@ -484,7 +404,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -492,11 +412,11 @@ DROP TRIGGER trig_2;
 Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe @@hostname variable.
 CREATE VIEW view_retval_2 AS SELECT func_retval_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_retval_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -508,7 +428,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 VALU
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -519,7 +439,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -528,33 +448,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
@@ -562,7 +468,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -570,11 +476,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -584,18 +490,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 VALUES (@@hostname); INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -604,33 +510,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
@@ -638,7 +530,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -648,7 +540,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -659,7 +551,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -668,33 +560,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
@@ -702,7 +580,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -712,7 +590,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -723,7 +601,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 VALU
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -732,7 +610,7 @@ Invoking unsafe @@hostname variable.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t0 VALUES (@@hostname);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -743,7 +621,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -752,33 +630,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
@@ -786,7 +650,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -794,11 +658,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -808,18 +672,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 SELECT * FROM data_table LIMIT 1; INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -828,33 +692,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
@@ -862,7 +712,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -872,7 +722,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -883,7 +733,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -892,33 +742,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
@@ -926,7 +762,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -936,7 +772,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -944,12 +780,10 @@ DROP TRIGGER trig_1;
 
 Invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
 CREATE VIEW view_retval_1 AS SELECT * FROM data_table LIMIT 1;
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT * FROM view_retval_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -960,29 +794,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
@@ -990,19 +814,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
 
 Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
 CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_retval_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -1014,7 +836,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1025,7 +847,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -1034,7 +856,7 @@ Invoking unsafe SELECT...LIMIT statement
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t0 SELECT * FROM data_table LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -1047,7 +869,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1056,33 +878,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
@@ -1090,7 +898,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1098,11 +906,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -1112,18 +920,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO t0 VALUES (1), (2); INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1132,33 +940,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
@@ -1166,7 +960,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1176,7 +970,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1187,7 +981,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1196,33 +990,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
@@ -1230,7 +1010,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1240,7 +1020,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1251,7 +1031,7 @@ PREPARE prep_1 FROM "INSERT DELAYED INTO
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -1260,7 +1040,7 @@ Invoking unsafe INSERT DELAYED statement
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT DELAYED INTO t0 VALUES (1), (2);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1271,7 +1051,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1280,35 +1060,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
@@ -1316,7 +1080,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1324,11 +1088,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -1338,66 +1102,39 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO double_autoinc_table VALUES (NULL); INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 
 Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
 CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
@@ -1405,7 +1142,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1415,21 +1152,9 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PREPARE prep_2;
 DROP PROCEDURE proc_1;
 
@@ -1438,7 +1163,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1447,35 +1172,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
@@ -1483,7 +1192,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1493,7 +1202,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1504,7 +1213,7 @@ PREPARE prep_1 FROM "INSERT INTO double_
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -1513,7 +1222,7 @@ Invoking unsafe update of two autoinc co
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO double_autoinc_table VALUES (NULL);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1524,7 +1233,7 @@ CREATE FUNCTION func_retval_1() RETURNS 
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 VALUES (func_retval_1());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -1535,7 +1244,7 @@ CREATE FUNCTION func_retval_2() RETURNS 
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 VALUES (func_retval_2());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -1547,31 +1256,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UDF.
@@ -1579,7 +1276,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1587,11 +1284,11 @@ DROP TRIGGER trig_2;
 Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UDF.
 CREATE VIEW view_retval_2 AS SELECT func_retval_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_retval_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -1603,7 +1300,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 VALU
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1614,7 +1311,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1623,33 +1320,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UDF.
@@ -1657,7 +1340,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1665,11 +1348,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UDF.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -1679,18 +1362,18 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 VALUES (myfunc_int(10)); INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1699,33 +1382,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UDF.
@@ -1733,7 +1402,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1743,7 +1412,7 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1754,7 +1423,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1763,33 +1432,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UDF.
@@ -1797,7 +1452,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1807,7 +1462,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1815,12 +1470,10 @@ DROP TRIGGER trig_1;
 
 Invoking view view_sidef_1 invoking unsafe UDF.
 CREATE VIEW view_sidef_1 AS SELECT myfunc_int(10);
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT * FROM view_sidef_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1829,29 +1482,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking view view_sidef_1 invoking unsafe UDF.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_sidef_1; INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking view view_sidef_1 invoking unsafe UDF.
@@ -1859,19 +1502,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
 
 Invoking view view_sidef_2 invoking view view_sidef_1 invoking unsafe UDF.
 CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1;
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -1881,7 +1522,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1892,7 +1533,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 VALU
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -1901,7 +1542,7 @@ Invoking unsafe UDF.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t0 VALUES (myfunc_int(10));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1912,7 +1553,7 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -1921,33 +1562,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
@@ -1955,7 +1582,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1963,11 +1590,11 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -1977,62 +1604,39 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 
 Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
 CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
@@ -2040,7 +1644,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2050,19 +1654,9 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PREPARE prep_2;
 DROP PROCEDURE proc_1;
 
@@ -2071,7 +1665,7 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2080,33 +1674,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
@@ -2114,7 +1694,7 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2124,7 +1704,7 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2132,12 +1712,10 @@ DROP TRIGGER trig_1;
 
 Invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
 CREATE VIEW view_retval_1 AS SELECT COUNT(*) FROM mysql.general_log;
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t1 SELECT * FROM view_retval_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -2148,29 +1726,19 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 1 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
@@ -2178,19 +1746,17 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
 
 Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe use of mysql.general_log.
 CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t2 SELECT * FROM view_retval_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -2202,7 +1768,7 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2213,7 +1779,7 @@ PREPARE prep_1 FROM "INSERT INTO t0 SELE
 * binlog_format = STATEMENT: expect 1 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -2222,7 +1788,7 @@ Invoking unsafe use of mysql.general_log
 * binlog_format = STATEMENT: expect 1 warnings.
 INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 * Invoke statement so that return value is dicarded: expect no warning.
@@ -2235,13 +1801,13 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2250,47 +1816,31 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
@@ -2298,13 +1848,13 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2312,23 +1862,23 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -2338,30 +1888,30 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END;
+CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2370,47 +1920,31 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
@@ -2418,13 +1952,13 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2434,13 +1968,13 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2451,13 +1985,13 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2466,47 +2000,31 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.double_autoinc_table)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.autoinc_table)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
@@ -2514,13 +2032,13 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2530,13 +2048,13 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2547,13 +2065,13 @@ PREPARE prep_1 FROM "INSERT DELAYED INTO
 * binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -2562,13 +2080,13 @@ Invoking statement that is unsafe in man
 * binlog_format = STATEMENT: expect 7 warnings.
 INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general_log, slow_log or performance_schema table(s). This is unsafe because system tables may differ on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a UDF. It cannot be determined if the UDF will return the same value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2579,8 +2097,8 @@ CREATE FUNCTION func_sidef_1() RETURNS V
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2589,37 +2107,21 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 2 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
@@ -2627,8 +2129,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2636,13 +2138,13 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
 CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -2652,70 +2154,43 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 2 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
 DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END;
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta0 VALUES (multi_unsafe_func()); INSERT INTO ta1 VALUES (47); END;
 * binlog_format = STATEMENT: expect 2 warnings.
 CALL proc_1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 
 Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe several times.
 CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
+CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 2 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe several times.
@@ -2723,8 +2198,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2734,22 +2209,10 @@ PREPARE prep_2 FROM "CALL proc_1()";
 * binlog_format = STATEMENT: expect 2 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PREPARE prep_2;
 DROP PROCEDURE proc_1;
 
@@ -2758,8 +2221,8 @@ CREATE TRIGGER trig_1 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2768,37 +2231,21 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 2 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.trigger_table_1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta0)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.ta1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe several times.
@@ -2806,8 +2253,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2817,8 +2264,8 @@ PREPARE prep_2 FROM "INSERT INTO trigger
 * binlog_format = STATEMENT: expect 2 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2827,13 +2274,13 @@ DROP TRIGGER trig_1;
 Invoking view view_sidef_1 invoking statement that is unsafe several times.
 CREATE VIEW view_sidef_1 AS SELECT multi_unsafe_func();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t1 SELECT * FROM view_sidef_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
@@ -2842,33 +2289,21 @@ CREATE FUNCTION func_sidef_2() RETURNS V
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
-CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
+CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT * FROM view_sidef_1; INSERT INTO ta2 VALUES (47); END;
 * binlog_format = STATEMENT: expect 2 warnings.
 CALL proc_2();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
-******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
-SHOW BINLOG EVENTS FROM <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta2 VALUES (47)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
@@ -2876,8 +2311,8 @@ CREATE TRIGGER trig_2 BEFORE INSERT ON t
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -2885,13 +2320,13 @@ DROP TRIGGER trig_2;
 Invoking view view_sidef_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
 CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
@@ -2901,8 +2336,8 @@ PREPARE prep_2 FROM "INSERT INTO t1 SELE
 * binlog_format = STATEMENT: expect 2 warnings.
 EXECUTE prep_2;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2913,8 +2348,8 @@ PREPARE prep_1 FROM "INSERT INTO ta0 VAL
 * binlog_format = STATEMENT: expect 2 warnings.
 EXECUTE prep_1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
@@ -2923,8 +2358,8 @@ Invoking statement that is unsafe severa
 * binlog_format = STATEMENT: expect 2 warnings.
 INSERT INTO ta0 VALUES (multi_unsafe_func());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER double_autoinc_trig;
@@ -2962,24 +2397,24 @@ INSERT INTO autoinc_table VALUES (NULL);
 The following variables *should* give a warning, despite they are replicated.
 INSERT INTO t1 VALUES (@@session.sql_mode);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 INSERT INTO t1 VALUES (@@session.insert_id);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 DROP TABLE t1, autoinc_table;
 CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
 INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 UPDATE t1 SET a=1 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 DELETE FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 CREATE PROCEDURE p1()
 BEGIN
 INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
@@ -2989,7 +2424,7 @@ DELETE FROM t1 LIMIT 1;
 END|
 CALL p1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 DROP PROCEDURE p1;
 DROP TABLE t1;
 DROP TABLE IF EXISTS t1;
@@ -2997,7 +2432,7 @@ CREATE TABLE t1 (a VARCHAR(100), b VARCH
 INSERT INTO t1 VALUES ('a','b');
 UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 DROP TABLE t1;
 DROP TABLE IF EXISTS t1, t2;
 CREATE TABLE t1(i INT PRIMARY KEY);
@@ -3006,7 +2441,7 @@ CREATE TABLE t3(i INT, ch CHAR(50));
 "Should issue message Statement may not be safe to log in statement format."
 INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 CREATE FUNCTION func6()
 RETURNS INT
 BEGIN
@@ -3018,7 +2453,7 @@ END|
 "Should issue message Statement may not be safe to log in statement format only once"
 INSERT INTO t3 VALUES(func6(), UUID());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 "Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
 CREATE FUNCTION fun_check_log_bin() RETURNS INT
 BEGIN
@@ -3028,10 +2463,7 @@ RETURN 100;
 END|
 "One unsafe warning should be issued in the following statement"
 SELECT fun_check_log_bin();
-fun_check_log_bin()
-100
-Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+ERROR HY000: Cannot change the sql_log_bin inside a stored function or trigger
 "SQL_LOG_BIN should be ON still"
 SHOW VARIABLES LIKE "SQL_LOG_BIN";
 Variable_name	Value
@@ -3087,16 +2519,16 @@ CREATE TABLE t1(i INT PRIMARY KEY);
 CREATE TABLE t2(i INT PRIMARY KEY);
 INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 INSERT INTO t1 VALUES(@@global.sync_binlog);
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system variable that may have a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 UPDATE t1 SET i = 999 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 DELETE FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
 DROP TABLE t1, t2;
 SET @@SESSION.SQL_MODE = @save_sql_mode;
 SET @old_binlog_format = @@session.binlog_format;
@@ -3146,18 +2578,18 @@ END|
 # so it should produce unsafe warning.
 INSERT INTO t2 SET a = func_modify_t1();
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 SET SESSION binlog_format = MIXED;
 # Check if the statement is logged in row format.
 INSERT INTO t2 SET a = func_modify_t1();
-SHOW BINLOG EVENTS FROM 1493;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	1493	Query	1	1561	BEGIN
-master-bin.000001	1561	Table_map	1	1603	table_id: 205 (test.t2)
-master-bin.000001	1603	Table_map	1	1645	table_id: 206 (test.t1)
-master-bin.000001	1645	Write_rows	1	1683	table_id: 206
-master-bin.000001	1683	Write_rows	1	1721	table_id: 205 flags: STMT_END_F
-master-bin.000001	1721	Query	1	1790	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
 DROP TABLE t1,t2;
 DROP FUNCTION func_modify_t1;
 SET SESSION binlog_format = STATEMENT;
@@ -3173,77 +2605,80 @@ end |
 # so it should produce unsafe warning
 INSERT INTO t1 SET a = 1;
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it invokes a trigger or a stored function that inserts into AUTO_INCREMENT column. The inserted values cannot be correctly logged.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 SET SESSION binlog_format = MIXED;
 # Check if the statement is logged in row format.
 INSERT INTO t1 SET a = 2;
-SHOW BINLOG EVENTS FROM 2773;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	2773	Query	1	2841	BEGIN
-master-bin.000001	2841	Table_map	1	2882	table_id: 208 (test.t1)
-master-bin.000001	2882	Table_map	1	2924	table_id: 209 (test.t3)
-master-bin.000001	2924	Table_map	1	2966	table_id: 210 (test.t2)
-master-bin.000001	2966	Write_rows	1	3004	table_id: 210
-master-bin.000001	3004	Write_rows	1	3042	table_id: 209
-master-bin.000001	3042	Write_rows	1	3076	table_id: 208 flags: STMT_END_F
-master-bin.000001	3076	Query	1	3145	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
 DROP TABLE t1,t2,t3;
 SET SESSION binlog_format = STATEMENT;
 CREATE TABLE t1 (a VARCHAR(1000));
 INSERT INTO t1 VALUES (CURRENT_USER());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (FOUND_ROWS());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (ROW_COUNT());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (SESSION_USER());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (SLEEP(1));
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (SYSDATE());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (SYSTEM_USER());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (USER());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (UUID());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (UUID_SHORT());
 Warnings:
-Note	1592	Unsafe statement written to the binary log in statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a system function that may return a different value on slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (VERSION());
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 INSERT INTO t1 VALUES (RAND());
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 DELETE FROM t1;
 SET TIMESTAMP=1000000;
 INSERT INTO t1 VALUES

=== modified file 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test'
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test	2010-08-10 11:32:54 +0000
@@ -72,6 +72,26 @@ UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
 UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
 DROP TABLE t1;
 
+CREATE TABLE t1 (a VARCHAR(1000));
+INSERT INTO t1 VALUES (CURRENT_USER());       #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (FOUND_ROWS());         #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));   #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));  #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));  #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe in BUG#39701
+INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
+INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));  #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (ROW_COUNT());          #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (SESSION_USER());       #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (SLEEP(1));             #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (SYSDATE());            #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (SYSTEM_USER());        #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (USER());               #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (UUID());               #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (UUID_SHORT());         #marked unsafe before BUG#47995
+INSERT INTO t1 VALUES (VERSION());            #marked unsafe in BUG#47995
+INSERT INTO t1 VALUES (RAND());               #marked unsafe in BUG#49222
+
 # clean up
 DROP DATABASE b42851;
 

=== modified file 'mysql-test/suite/binlog/t/binlog_unsafe.test'
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test	2010-08-10 11:32:54 +0000
@@ -468,6 +468,7 @@ BEGIN
 END|
 DELIMITER ;|
 --echo "One unsafe warning should be issued in the following statement"
+--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN
 SELECT fun_check_log_bin();
 --echo "SQL_LOG_BIN should be ON still"
 SHOW VARIABLES LIKE "SQL_LOG_BIN";

=== modified file 'mysql-test/suite/binlog/t/disabled.def'
--- a/mysql-test/suite/binlog/t/disabled.def	2010-06-06 11:19:29 +0000
+++ b/mysql-test/suite/binlog/t/disabled.def	2010-08-10 11:32:54 +0000
@@ -11,5 +11,4 @@
 ##############################################################################
 
 binlog_truncate_innodb	    : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
-binlog_unsafe               : BUG#50312 2010-01-13 lsoares Warnings for unsafe sub-statement not returned to client
 binlog_spurious_ddl_errors  : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled

=== modified file 'mysql-test/suite/ndb/r/ndb_cursor.result'
--- a/mysql-test/suite/ndb/r/ndb_cursor.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/ndb/r/ndb_cursor.result	2010-08-09 16:52:26 +0000
@@ -29,6 +29,8 @@ end;
 select * from t2 order by a;
 a	b
 call test_cursor();
+Warnings:
+Error	1329	No data - zero rows fetched, selected, or processed
 select * from t2 order by a;
 a	b
 1	10

=== modified file 'mysql-test/suite/perfschema/include/setup_helper.inc'
--- a/mysql-test/suite/perfschema/include/setup_helper.inc	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc	2010-08-12 14:08:52 +0000
@@ -25,17 +25,17 @@ update performance_schema.SETUP_CONSUMER
 
 connect (con1, localhost, root, , );
 
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID in (select connection_id())`;
 
 connect (con2, localhost, root, , );
 
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID in (select connection_id())`;
 
 connect (con3, localhost, root, , );
 
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID in (select connection_id())`;
 
 connection default;
@@ -49,6 +49,6 @@ prepare stmt_dump_events from
   where thread_id=? order by event_id;";
 
 prepare stmt_dump_thread from
-  "select name from performance_schema.PROCESSLIST where thread_id=? ;";
+  "select name from performance_schema.THREADS where thread_id=? ;";
 --enable_query_log
 

=== modified file 'mysql-test/suite/perfschema/include/start_server_common.inc'
--- a/mysql-test/suite/perfschema/include/start_server_common.inc	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc	2010-08-12 14:08:52 +0000
@@ -29,20 +29,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 --enable_result_log
 
 # This has a stable output, printing the result:

=== modified file 'mysql-test/suite/perfschema/r/aggregate.result'
--- a/mysql-test/suite/perfschema/r/aggregate.result	2010-01-27 15:26:05 +0000
+++ b/mysql-test/suite/perfschema/r/aggregate.result	2010-08-12 14:08:52 +0000
@@ -4,7 +4,7 @@ update performance_schema.SETUP_INSTRUME
 update performance_schema.SETUP_CONSUMERS set enabled = 'NO';
 truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
 update performance_schema.SETUP_CONSUMERS set enabled = 'YES';
@@ -49,14 +49,14 @@ OR @dump_all;
 EVENT_NAME	SUM_NUMBER_OF_BYTES_WRITE	SUM(i.SUM_NUMBER_OF_BYTES_WRITE)
 "Verifying waits aggregate consistency (instance)"
 SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
 GROUP BY EVENT_NAME
 HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
 OR @dump_all;
 EVENT_NAME	SUM_TIMER_WAIT	SUM(i.SUM_TIMER_WAIT)
 SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
 GROUP BY EVENT_NAME
 HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
@@ -64,7 +64,7 @@ AND (MIN(i.MIN_TIMER_WAIT) != 0)
 OR @dump_all;
 EVENT_NAME	MIN_TIMER_WAIT	MIN(i.MIN_TIMER_WAIT)
 SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
 GROUP BY EVENT_NAME
 HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
@@ -72,7 +72,7 @@ OR @dump_all;
 EVENT_NAME	MAX_TIMER_WAIT	MAX(i.MAX_TIMER_WAIT)
 "Verifying waits aggregate consistency (thread)"
 SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
 USING (EVENT_NAME)
 GROUP BY EVENT_NAME
@@ -80,7 +80,7 @@ HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIM
 OR @dump_all;
 EVENT_NAME	SUM_TIMER_WAIT	SUM(t.SUM_TIMER_WAIT)
 SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
 USING (EVENT_NAME)
 GROUP BY EVENT_NAME
@@ -89,7 +89,7 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
 OR @dump_all;
 EVENT_NAME	MIN_TIMER_WAIT	MIN(t.MIN_TIMER_WAIT)
 SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
 USING (EVENT_NAME)
 GROUP BY EVENT_NAME

=== removed file 'mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result'
--- a/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_ews_by_event_name.result	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== added file 'mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result'
--- a/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_ews_global_by_event_name.result	2010-08-12 14:08:52 +0000
@@ -0,0 +1,10 @@
+alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+ADD INDEX test_index(EVENT_NAME);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index
+ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== removed file 'mysql-test/suite/perfschema/r/ddl_processlist.result'
--- a/mysql-test/suite/perfschema/r/ddl_processlist.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_processlist.result	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-alter table performance_schema.PROCESSLIST add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.PROCESSLIST;
-ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== removed file 'mysql-test/suite/perfschema/r/ddl_setup_objects.result'
--- a/mysql-test/suite/perfschema/r/ddl_setup_objects.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_setup_objects.result	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-alter table performance_schema.SETUP_OBJECTS add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.SETUP_OBJECTS;
-ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== added file 'mysql-test/suite/perfschema/r/ddl_threads.result'
--- a/mysql-test/suite/perfschema/r/ddl_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result	2010-08-12 14:08:52 +0000
@@ -0,0 +1,8 @@
+alter table performance_schema.THREADS add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.THREADS;
+ERROR HY000: Invalid performance_schema usage.
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== removed file 'mysql-test/suite/perfschema/r/dml_ews_by_event_name.result'
--- a/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/dml_ews_by_event_name.result	1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-where event_name like 'Wait/Synch/%' limit 1;
-EVENT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
-#	#	#	#	#	#
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-where event_name='FOO';
-EVENT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
-avg_timer_wait=4, max_timer_wait=5;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-set count_star=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-set count_star=12 where event_name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-where count_star=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
-UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result'
--- a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result	2010-08-12 14:08:52 +0000
@@ -0,0 +1,28 @@
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+where event_name like 'Wait/Synch/%' limit 1;
+EVENT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+#	#	#	#	#	#
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+where event_name='FOO';
+EVENT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
+avg_timer_wait=4, max_timer_wait=5;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+set count_star=12;
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+set count_star=12 where event_name like "FOO";
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+where count_star=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+UNLOCK TABLES;
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+UNLOCK TABLES;

=== removed file 'mysql-test/suite/perfschema/r/dml_processlist.result'
--- a/mysql-test/suite/perfschema/r/dml_processlist.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/dml_processlist.result	1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-select * from performance_schema.PROCESSLIST
-where name like 'Thread/%' limit 1;
-THREAD_ID	ID	NAME
-#	#	#
-select * from performance_schema.PROCESSLIST
-where name='FOO';
-THREAD_ID	ID	NAME
-insert into performance_schema.PROCESSLIST
-set name='FOO', thread_id=1, id=2;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-update performance_schema.PROCESSLIST
-set thread_id=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-update performance_schema.PROCESSLIST
-set thread_id=12 where name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-delete from performance_schema.PROCESSLIST
-where id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-delete from performance_schema.PROCESSLIST;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-LOCK TABLES performance_schema.PROCESSLIST READ;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.PROCESSLIST WRITE;
-ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'PROCESSLIST'
-UNLOCK TABLES;

=== removed file 'mysql-test/suite/perfschema/r/dml_setup_objects.result'
--- a/mysql-test/suite/perfschema/r/dml_setup_objects.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/dml_setup_objects.result	1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
-select * from performance_schema.SETUP_OBJECTS;
-OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	ENABLED	TIMED	AGGREGATED
-select * from performance_schema.SETUP_OBJECTS
-where object_type = 'TABLE';
-OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	ENABLED	TIMED	AGGREGATED
-select * from performance_schema.SETUP_OBJECTS
-where enabled='YES';
-OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	ENABLED	TIMED	AGGREGATED
-insert into performance_schema.SETUP_OBJECTS
-set object_type='TABLE', object_schema='FOO', object_name='BAR',
-enabled='YES', timed='YES', aggregated='YES';
-ERROR HY000: Table storage engine for 'SETUP_OBJECTS' doesn't have this option
-update performance_schema.SETUP_OBJECTS
-set object_type='TABLE';
-update performance_schema.SETUP_OBJECTS
-set object_schema='ILLEGAL';
-update performance_schema.SETUP_OBJECTS
-set object_name='ILLEGAL';
-update performance_schema.SETUP_OBJECTS
-set enabled='NO';
-update performance_schema.SETUP_OBJECTS
-set timed='NO';
-update performance_schema.SETUP_OBJECTS
-set aggregated='NO';
-select * from performance_schema.SETUP_OBJECTS;
-OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	ENABLED	TIMED	AGGREGATED
-update performance_schema.SETUP_OBJECTS
-set enabled='YES', timed='YES', aggregated='YES';
-delete from performance_schema.SETUP_OBJECTS
-where object_type = 'TABLE';
-delete from performance_schema.SETUP_OBJECTS;
-LOCK TABLES performance_schema.SETUP_OBJECTS READ;
-UNLOCK TABLES;
-LOCK TABLES performance_schema.SETUP_OBJECTS WRITE;
-UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_threads.result'
--- a/mysql-test/suite/perfschema/r/dml_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_threads.result	2010-08-12 14:08:52 +0000
@@ -0,0 +1,27 @@
+select * from performance_schema.THREADS
+where name like 'Thread/%' limit 1;
+THREAD_ID	ID	NAME
+#	#	#
+select * from performance_schema.THREADS
+where name='FOO';
+THREAD_ID	ID	NAME
+insert into performance_schema.THREADS
+set name='FOO', thread_id=1, id=2;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
+update performance_schema.THREADS
+set thread_id=12;
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
+update performance_schema.THREADS
+set thread_id=12 where name like "FOO";
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
+delete from performance_schema.THREADS
+where id=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+delete from performance_schema.THREADS;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+LOCK TABLES performance_schema.THREADS READ;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS'
+UNLOCK TABLES;
+LOCK TABLES performance_schema.THREADS WRITE;
+ERROR 42000: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'THREADS'
+UNLOCK TABLES;

=== modified file 'mysql-test/suite/perfschema/r/func_file_io.result'
--- a/mysql-test/suite/perfschema/r/func_file_io.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/func_file_io.result	2010-08-12 14:08:52 +0000
@@ -90,27 +90,27 @@ SUM(SUM_NUMBER_OF_BYTES_WRITE) AS sum_nu
 FROM performance_schema.FILE_SUMMARY_BY_INSTANCE
 WHERE FILE_NAME LIKE CONCAT('%', @@tmpdir, '%') ORDER BY NULL;
 SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
 WHERE COUNT_STAR > 0
 ORDER BY SUM_TIMER_WAIT DESC
 LIMIT 10;
 SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
 # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
 LEFT JOIN information_schema.PROCESSLIST i USING (ID)
 GROUP BY i.user
 ORDER BY SUM_WAIT DESC
 LIMIT 20;
 SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
 WHERE p.ID = 1
 GROUP BY h.EVENT_NAME
 HAVING TOTAL_WAIT > 0;
 SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
 LEFT JOIN information_schema.PROCESSLIST i USING (ID)
 GROUP BY i.user, h.operation
 HAVING BYTES > 0

=== modified file 'mysql-test/suite/perfschema/r/information_schema.result'
--- a/mysql-test/suite/perfschema/r/information_schema.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/information_schema.result	2010-08-12 14:08:52 +0000
@@ -6,20 +6,19 @@ performance_schema	COND_INSTANCES	def
 performance_schema	EVENTS_WAITS_CURRENT	def
 performance_schema	EVENTS_WAITS_HISTORY	def
 performance_schema	EVENTS_WAITS_HISTORY_LONG	def
-performance_schema	EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	def
 performance_schema	EVENTS_WAITS_SUMMARY_BY_INSTANCE	def
 performance_schema	EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	def
+performance_schema	EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	def
 performance_schema	FILE_INSTANCES	def
 performance_schema	FILE_SUMMARY_BY_EVENT_NAME	def
 performance_schema	FILE_SUMMARY_BY_INSTANCE	def
 performance_schema	MUTEX_INSTANCES	def
 performance_schema	PERFORMANCE_TIMERS	def
-performance_schema	PROCESSLIST	def
 performance_schema	RWLOCK_INSTANCES	def
 performance_schema	SETUP_CONSUMERS	def
 performance_schema	SETUP_INSTRUMENTS	def
-performance_schema	SETUP_OBJECTS	def
 performance_schema	SETUP_TIMERS	def
+performance_schema	THREADS	def
 select upper(TABLE_NAME), TABLE_TYPE, ENGINE
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -28,20 +27,19 @@ COND_INSTANCES	BASE TABLE	PERFORMANCE_SC
 EVENTS_WAITS_CURRENT	BASE TABLE	PERFORMANCE_SCHEMA
 EVENTS_WAITS_HISTORY	BASE TABLE	PERFORMANCE_SCHEMA
 EVENTS_WAITS_HISTORY_LONG	BASE TABLE	PERFORMANCE_SCHEMA
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	BASE TABLE	PERFORMANCE_SCHEMA
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	BASE TABLE	PERFORMANCE_SCHEMA
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	BASE TABLE	PERFORMANCE_SCHEMA
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	BASE TABLE	PERFORMANCE_SCHEMA
 FILE_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
 FILE_SUMMARY_BY_EVENT_NAME	BASE TABLE	PERFORMANCE_SCHEMA
 FILE_SUMMARY_BY_INSTANCE	BASE TABLE	PERFORMANCE_SCHEMA
 MUTEX_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
 PERFORMANCE_TIMERS	BASE TABLE	PERFORMANCE_SCHEMA
-PROCESSLIST	BASE TABLE	PERFORMANCE_SCHEMA
 RWLOCK_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_CONSUMERS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_INSTRUMENTS	BASE TABLE	PERFORMANCE_SCHEMA
-SETUP_OBJECTS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_TIMERS	BASE TABLE	PERFORMANCE_SCHEMA
+THREADS	BASE TABLE	PERFORMANCE_SCHEMA
 select upper(TABLE_NAME), VERSION, ROW_FORMAT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -50,20 +48,19 @@ COND_INSTANCES	10	Dynamic
 EVENTS_WAITS_CURRENT	10	Dynamic
 EVENTS_WAITS_HISTORY	10	Dynamic
 EVENTS_WAITS_HISTORY_LONG	10	Dynamic
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	10	Dynamic
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	10	Dynamic
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	10	Dynamic
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	10	Dynamic
 FILE_INSTANCES	10	Dynamic
 FILE_SUMMARY_BY_EVENT_NAME	10	Dynamic
 FILE_SUMMARY_BY_INSTANCE	10	Dynamic
 MUTEX_INSTANCES	10	Dynamic
 PERFORMANCE_TIMERS	10	Fixed
-PROCESSLIST	10	Dynamic
 RWLOCK_INSTANCES	10	Dynamic
 SETUP_CONSUMERS	10	Dynamic
 SETUP_INSTRUMENTS	10	Dynamic
-SETUP_OBJECTS	10	Dynamic
 SETUP_TIMERS	10	Dynamic
+THREADS	10	Dynamic
 select upper(TABLE_NAME), TABLE_ROWS, AVG_ROW_LENGTH
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -72,20 +69,19 @@ COND_INSTANCES	1000	0
 EVENTS_WAITS_CURRENT	1000	0
 EVENTS_WAITS_HISTORY	1000	0
 EVENTS_WAITS_HISTORY_LONG	10000	0
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	1000	0
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	1000	0
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	1000	0
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	1000	0
 FILE_INSTANCES	1000	0
 FILE_SUMMARY_BY_EVENT_NAME	1000	0
 FILE_SUMMARY_BY_INSTANCE	1000	0
 MUTEX_INSTANCES	1000	0
 PERFORMANCE_TIMERS	5	0
-PROCESSLIST	1000	0
 RWLOCK_INSTANCES	1000	0
 SETUP_CONSUMERS	8	0
 SETUP_INSTRUMENTS	1000	0
-SETUP_OBJECTS	1000	0
 SETUP_TIMERS	1	0
+THREADS	1000	0
 select upper(TABLE_NAME), DATA_LENGTH, MAX_DATA_LENGTH
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -94,20 +90,19 @@ COND_INSTANCES	0	0
 EVENTS_WAITS_CURRENT	0	0
 EVENTS_WAITS_HISTORY	0	0
 EVENTS_WAITS_HISTORY_LONG	0	0
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	0	0
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	0	0
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	0	0
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	0	0
 FILE_INSTANCES	0	0
 FILE_SUMMARY_BY_EVENT_NAME	0	0
 FILE_SUMMARY_BY_INSTANCE	0	0
 MUTEX_INSTANCES	0	0
 PERFORMANCE_TIMERS	0	0
-PROCESSLIST	0	0
 RWLOCK_INSTANCES	0	0
 SETUP_CONSUMERS	0	0
 SETUP_INSTRUMENTS	0	0
-SETUP_OBJECTS	0	0
 SETUP_TIMERS	0	0
+THREADS	0	0
 select upper(TABLE_NAME), INDEX_LENGTH, DATA_FREE, AUTO_INCREMENT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -116,20 +111,19 @@ COND_INSTANCES	0	0	NULL
 EVENTS_WAITS_CURRENT	0	0	NULL
 EVENTS_WAITS_HISTORY	0	0	NULL
 EVENTS_WAITS_HISTORY_LONG	0	0	NULL
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	0	0	NULL
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	0	0	NULL
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	0	0	NULL
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	0	0	NULL
 FILE_INSTANCES	0	0	NULL
 FILE_SUMMARY_BY_EVENT_NAME	0	0	NULL
 FILE_SUMMARY_BY_INSTANCE	0	0	NULL
 MUTEX_INSTANCES	0	0	NULL
 PERFORMANCE_TIMERS	0	0	NULL
-PROCESSLIST	0	0	NULL
 RWLOCK_INSTANCES	0	0	NULL
 SETUP_CONSUMERS	0	0	NULL
 SETUP_INSTRUMENTS	0	0	NULL
-SETUP_OBJECTS	0	0	NULL
 SETUP_TIMERS	0	0	NULL
+THREADS	0	0	NULL
 select upper(TABLE_NAME), CREATE_TIME, UPDATE_TIME, CHECK_TIME
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -138,20 +132,19 @@ COND_INSTANCES	NULL	NULL	NULL
 EVENTS_WAITS_CURRENT	NULL	NULL	NULL
 EVENTS_WAITS_HISTORY	NULL	NULL	NULL
 EVENTS_WAITS_HISTORY_LONG	NULL	NULL	NULL
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	NULL	NULL	NULL
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	NULL	NULL	NULL
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	NULL	NULL	NULL
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	NULL	NULL	NULL
 FILE_INSTANCES	NULL	NULL	NULL
 FILE_SUMMARY_BY_EVENT_NAME	NULL	NULL	NULL
 FILE_SUMMARY_BY_INSTANCE	NULL	NULL	NULL
 MUTEX_INSTANCES	NULL	NULL	NULL
 PERFORMANCE_TIMERS	NULL	NULL	NULL
-PROCESSLIST	NULL	NULL	NULL
 RWLOCK_INSTANCES	NULL	NULL	NULL
 SETUP_CONSUMERS	NULL	NULL	NULL
 SETUP_INSTRUMENTS	NULL	NULL	NULL
-SETUP_OBJECTS	NULL	NULL	NULL
 SETUP_TIMERS	NULL	NULL	NULL
+THREADS	NULL	NULL	NULL
 select upper(TABLE_NAME), TABLE_COLLATION, CHECKSUM
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -160,20 +153,19 @@ COND_INSTANCES	utf8_general_ci	NULL
 EVENTS_WAITS_CURRENT	utf8_general_ci	NULL
 EVENTS_WAITS_HISTORY	utf8_general_ci	NULL
 EVENTS_WAITS_HISTORY_LONG	utf8_general_ci	NULL
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	utf8_general_ci	NULL
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	utf8_general_ci	NULL
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	utf8_general_ci	NULL
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	utf8_general_ci	NULL
 FILE_INSTANCES	utf8_general_ci	NULL
 FILE_SUMMARY_BY_EVENT_NAME	utf8_general_ci	NULL
 FILE_SUMMARY_BY_INSTANCE	utf8_general_ci	NULL
 MUTEX_INSTANCES	utf8_general_ci	NULL
 PERFORMANCE_TIMERS	utf8_general_ci	NULL
-PROCESSLIST	utf8_general_ci	NULL
 RWLOCK_INSTANCES	utf8_general_ci	NULL
 SETUP_CONSUMERS	utf8_general_ci	NULL
 SETUP_INSTRUMENTS	utf8_general_ci	NULL
-SETUP_OBJECTS	utf8_general_ci	NULL
 SETUP_TIMERS	utf8_general_ci	NULL
+THREADS	utf8_general_ci	NULL
 select upper(TABLE_NAME), TABLE_COMMENT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
@@ -182,17 +174,16 @@ COND_INSTANCES	
 EVENTS_WAITS_CURRENT	
 EVENTS_WAITS_HISTORY	
 EVENTS_WAITS_HISTORY_LONG	
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	
 EVENTS_WAITS_SUMMARY_BY_INSTANCE	
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	
 FILE_INSTANCES	
 FILE_SUMMARY_BY_EVENT_NAME	
 FILE_SUMMARY_BY_INSTANCE	
 MUTEX_INSTANCES	
 PERFORMANCE_TIMERS	
-PROCESSLIST	
 RWLOCK_INSTANCES	
 SETUP_CONSUMERS	
 SETUP_INSTRUMENTS	
-SETUP_OBJECTS	
 SETUP_TIMERS	
+THREADS	

=== modified file 'mysql-test/suite/perfschema/r/misc.result'
--- a/mysql-test/suite/perfschema/r/misc.result	2010-07-16 00:50:39 +0000
+++ b/mysql-test/suite/perfschema/r/misc.result	2010-08-12 14:08:52 +0000
@@ -1,6 +1,6 @@
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+(SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
 (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
 WHERE NAME LIKE "wait/synch/%")

=== modified file 'mysql-test/suite/perfschema/r/no_threads.result'
--- a/mysql-test/suite/perfschema/r/no_threads.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/no_threads.result	2010-08-12 14:08:52 +0000
@@ -17,11 +17,11 @@ show variables like "performance_schema_
 Variable_name	Value
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	10
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
 where name like "thread/sql/main";
 count(*)
 1
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
 where name like "thread/sql/OneConnection";
 count(*)
 0

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result	2010-07-15 21:57:47 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result	2010-08-12 14:08:52 +0000
@@ -12,21 +12,20 @@ ERROR 1050 (42S01) at line 183: Table 'C
 ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
 ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
 ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
 ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
 ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1118: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -43,21 +42,20 @@ ERROR 1050 (42S01) at line 183: Table 'C
 ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
 ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
 ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
 ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
 ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1118: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -72,21 +70,20 @@ ERROR 1050 (42S01) at line 183: Table 'C
 ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
 ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
 ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
 ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
 ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1118: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -101,21 +98,20 @@ ERROR 1050 (42S01) at line 183: Table 'C
 ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
 ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
 ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
 ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
 ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1118: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -130,21 +126,20 @@ ERROR 1050 (42S01) at line 183: Table 'C
 ERROR 1050 (42S01) at line 213: Table 'EVENTS_WAITS_CURRENT' already exists
 ERROR 1050 (42S01) at line 227: Table 'EVENTS_WAITS_HISTORY' already exists
 ERROR 1050 (42S01) at line 241: Table 'EVENTS_WAITS_HISTORY_LONG' already exists
-ERROR 1050 (42S01) at line 261: Table 'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME' already exists
-ERROR 1050 (42S01) at line 282: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
-ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 262: Table 'EVENTS_WAITS_SUMMARY_BY_INSTANCE' already exists
+ERROR 1050 (42S01) at line 283: Table 'EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME' already exists
+ERROR 1050 (42S01) at line 303: Table 'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 320: Table 'FILE_INSTANCES' already exists
 ERROR 1050 (42S01) at line 339: Table 'FILE_SUMMARY_BY_EVENT_NAME' already exists
 ERROR 1050 (42S01) at line 359: Table 'FILE_SUMMARY_BY_INSTANCE' already exists
 ERROR 1050 (42S01) at line 376: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 394: Table 'PERFORMANCE_TIMERS' already exists
-ERROR 1050 (42S01) at line 411: Table 'PROCESSLIST' already exists
-ERROR 1050 (42S01) at line 429: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
-ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 412: Table 'RWLOCK_INSTANCES' already exists
+ERROR 1050 (42S01) at line 428: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 445: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 461: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 478: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 1118: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result	2010-08-12 14:08:52 +0000
@@ -12,20 +12,19 @@ COND_INSTANCES
 EVENTS_WAITS_CURRENT
 EVENTS_WAITS_HISTORY
 EVENTS_WAITS_HISTORY_LONG
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
 EVENTS_WAITS_SUMMARY_BY_INSTANCE
 EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
 FILE_INSTANCES
 FILE_SUMMARY_BY_EVENT_NAME
 FILE_SUMMARY_BY_INSTANCE
 MUTEX_INSTANCES
 PERFORMANCE_TIMERS
-PROCESSLIST
 RWLOCK_INSTANCES
 SETUP_CONSUMERS
 SETUP_INSTRUMENTS
-SETUP_OBJECTS
 SETUP_TIMERS
+THREADS
 show create table COND_INSTANCES;
 Table	Create Table
 COND_INSTANCES	CREATE TABLE `COND_INSTANCES` (
@@ -92,31 +91,31 @@ EVENTS_WAITS_HISTORY_LONG	CREATE TABLE `
   `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
   `FLAGS` int(10) unsigned DEFAULT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 Table	Create Table
-EVENTS_WAITS_SUMMARY_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_EVENT_NAME` (
+EVENTS_WAITS_SUMMARY_BY_INSTANCE	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
   `EVENT_NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
   `COUNT_STAR` bigint(20) unsigned NOT NULL,
   `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
 Table	Create Table
-EVENTS_WAITS_SUMMARY_BY_INSTANCE	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
+  `THREAD_ID` int(11) NOT NULL,
   `EVENT_NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
   `COUNT_STAR` bigint(20) unsigned NOT NULL,
   `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 Table	Create Table
-EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
-  `THREAD_ID` int(11) NOT NULL,
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME` (
   `EVENT_NAME` varchar(128) NOT NULL,
   `COUNT_STAR` bigint(20) unsigned NOT NULL,
   `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
@@ -165,13 +164,6 @@ PERFORMANCE_TIMERS	CREATE TABLE `PERFORM
   `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
   `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table PROCESSLIST;
-Table	Create Table
-PROCESSLIST	CREATE TABLE `PROCESSLIST` (
-  `THREAD_ID` int(11) NOT NULL,
-  `ID` int(11) NOT NULL,
-  `NAME` varchar(64) NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
 show create table RWLOCK_INSTANCES;
 Table	Create Table
 RWLOCK_INSTANCES	CREATE TABLE `RWLOCK_INSTANCES` (
@@ -193,19 +185,16 @@ SETUP_INSTRUMENTS	CREATE TABLE `SETUP_IN
   `ENABLED` enum('YES','NO') NOT NULL,
   `TIMED` enum('YES','NO') NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table SETUP_OBJECTS;
-Table	Create Table
-SETUP_OBJECTS	CREATE TABLE `SETUP_OBJECTS` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL,
-  `TIMED` enum('YES','NO') NOT NULL,
-  `AGGREGATED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
 show create table SETUP_TIMERS;
 Table	Create Table
 SETUP_TIMERS	CREATE TABLE `SETUP_TIMERS` (
   `NAME` varchar(64) NOT NULL,
   `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table THREADS;
+Table	Create Table
+THREADS	CREATE TABLE `THREADS` (
+  `THREAD_ID` int(11) NOT NULL,
+  `ID` int(11) NOT NULL,
+  `NAME` varchar(64) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== modified file 'mysql-test/suite/perfschema/r/selects.result'
--- a/mysql-test/suite/perfschema/r/selects.result	2010-07-20 19:15:29 +0000
+++ b/mysql-test/suite/perfschema/r/selects.result	2010-08-12 14:08:52 +0000
@@ -13,7 +13,7 @@ OPERATION	TOTAL
 chsize	[NUM_BYTES]
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+(SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
 (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
 WHERE NAME LIKE "wait/synch/%")
@@ -86,7 +86,7 @@ DROP TRIGGER t_ps_trigger;
 DROP PROCEDURE IF EXISTS t_ps_proc;
 CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
 BEGIN
-SELECT id FROM performance_schema.PROCESSLIST
+SELECT id FROM performance_schema.THREADS
 WHERE THREAD_ID = tid INTO pid;
 END;
 |
@@ -94,7 +94,7 @@ CALL t_ps_proc(0, @p_id);
 DROP FUNCTION IF EXISTS t_ps_proc;
 CREATE FUNCTION t_ps_func(tid INT) RETURNS int
 BEGIN
-return (SELECT id FROM performance_schema.PROCESSLIST
+return (SELECT id FROM performance_schema.THREADS
 WHERE THREAD_ID = tid);
 END;
 |

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -66,7 +65,7 @@ select variable_value > 0 from informati
 where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
 variable_value > 0
 1
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 count(*)
 0
 show status like "performance_schema_thread_instances_lost";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -64,7 +63,7 @@ Performance_schema_thread_classes_lost	0
 show variables like "performance_schema_max_thread_instances";
 Variable_name	Value
 performance_schema_max_thread_instances	0
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 count(*)
 0
 select variable_value > 0 from information_schema.global_status

=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	OFF

=== modified file 'mysql-test/suite/perfschema/r/start_server_on.result'
--- a/mysql-test/suite/perfschema/r/start_server_on.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_on.result	2010-08-12 14:08:52 +0000
@@ -21,20 +21,19 @@ select * from performance_schema.COND_IN
 select * from performance_schema.EVENTS_WAITS_CURRENT;
 select * from performance_schema.EVENTS_WAITS_HISTORY;
 select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 select * from performance_schema.FILE_INSTANCES;
 select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
-select * from performance_schema.PROCESSLIST;
 select * from performance_schema.RWLOCK_INSTANCES;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
-select * from performance_schema.SETUP_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
 show variables like "performance_schema%";
 Variable_name	Value
 performance_schema	ON

=== modified file 'mysql-test/suite/perfschema/t/aggregate.test'
--- a/mysql-test/suite/perfschema/t/aggregate.test	2010-01-27 15:26:05 +0000
+++ b/mysql-test/suite/perfschema/t/aggregate.test	2010-08-12 14:08:52 +0000
@@ -31,7 +31,7 @@ update performance_schema.SETUP_CONSUMER
 # Cleanup statistics
 truncate table performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
 truncate table performance_schema.FILE_SUMMARY_BY_INSTANCE;
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
 
@@ -66,9 +66,9 @@ set @dump_all=FALSE;
 # because doing so removes a row in FILE_SUMMARY_BY_INSTANCE.
 
 # Likewise:
-# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >=
+# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
 #   COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
-# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <=
+# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
 #   MIN(EVENTS_WAITS_SUMMARY_BY_INSTANCE)
 # There will be equality only when an instrument instance
 # is not removed, which is next to impossible to predictably guarantee
@@ -80,9 +80,9 @@ set @dump_all=FALSE;
 # Both cause a row to be deleted from EVENTS_WAITS_SUMMARY_BY_INSTANCE.
 
 # Likewise:
-# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) >=
+# - COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) >=
 #   COUNT/SUM/MAX(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
-# - MIN(EVENTS_WAITS_SUMMARY_BY_EVENT_NAME) <=
+# - MIN(EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME) <=
 #   MIN(EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME)
 # There will be equality only when no thread is removed,
 # that is if no thread disconnects, or no sub thread (for example insert
@@ -131,14 +131,14 @@ OR @dump_all;
 --echo "Verifying waits aggregate consistency (instance)"
 
 SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(i.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
 GROUP BY EVENT_NAME
 HAVING (e.SUM_TIMER_WAIT < SUM(i.SUM_TIMER_WAIT))
 OR @dump_all;
 
 SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(i.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
 GROUP BY EVENT_NAME
 HAVING (e.MIN_TIMER_WAIT > MIN(i.MIN_TIMER_WAIT))
@@ -146,7 +146,7 @@ AND (MIN(i.MIN_TIMER_WAIT) != 0)
 OR @dump_all;
 
 SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(i.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE AS i USING (EVENT_NAME)
 GROUP BY EVENT_NAME
 HAVING (e.MAX_TIMER_WAIT < MAX(i.MAX_TIMER_WAIT))
@@ -155,7 +155,7 @@ OR @dump_all;
 --echo "Verifying waits aggregate consistency (thread)"
 
 SELECT EVENT_NAME, e.SUM_TIMER_WAIT, SUM(t.SUM_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
 USING (EVENT_NAME)
 GROUP BY EVENT_NAME
@@ -163,7 +163,7 @@ HAVING (e.SUM_TIMER_WAIT < SUM(t.SUM_TIM
 OR @dump_all;
 
 SELECT EVENT_NAME, e.MIN_TIMER_WAIT, MIN(t.MIN_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
 USING (EVENT_NAME)
 GROUP BY EVENT_NAME
@@ -172,7 +172,7 @@ AND (MIN(t.MIN_TIMER_WAIT) != 0)
 OR @dump_all;
 
 SELECT EVENT_NAME, e.MAX_TIMER_WAIT, MAX(t.MAX_TIMER_WAIT)
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME AS e
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME AS e
 JOIN performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME AS t
 USING (EVENT_NAME)
 GROUP BY EVENT_NAME

=== removed file 'mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test'
--- a/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_ews_by_event_name.test	1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-# Copyright (C) 2008-2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
--- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME add column foo integer;
-
-truncate table performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
-
--- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME ADD INDEX test_index(EVENT_NAME);
-
--- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(EVENT_NAME);
-

=== added file 'mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test'
--- a/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_ews_global_by_event_name.test	2010-08-12 14:08:52 +0000
@@ -0,0 +1,34 @@
+# Copyright (C) 2008-2009 Sun Microsystems, Inc
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  add column foo integer;
+
+truncate table performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  ADD INDEX test_index(EVENT_NAME);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index
+  ON performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(EVENT_NAME);
+

=== removed file 'mysql-test/suite/perfschema/t/ddl_processlist.test'
--- a/mysql-test/suite/perfschema/t/ddl_processlist.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_processlist.test	1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-# Copyright (C) 2008-2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
--- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.PROCESSLIST add column foo integer;
-
--- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.PROCESSLIST;
-
--- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.PROCESSLIST ADD INDEX test_index(ID);
-
--- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.PROCESSLIST(ID);
-

=== removed file 'mysql-test/suite/perfschema/t/ddl_setup_objects.test'
--- a/mysql-test/suite/perfschema/t/ddl_setup_objects.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_setup_objects.test	1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---replace_result '\'setup_objects' '\'SETUP_OBJECTS'
--- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.SETUP_OBJECTS add column foo integer;
-
-truncate table performance_schema.SETUP_OBJECTS;
-
--- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME);
-
--- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME);
-

=== added file 'mysql-test/suite/perfschema/t/ddl_threads.test'
--- a/mysql-test/suite/perfschema/t/ddl_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test	2010-08-12 14:08:52 +0000
@@ -0,0 +1,32 @@
+# Copyright (C) 2008-2009 Sun Microsystems, Inc
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.THREADS add column foo integer;
+
+-- error ER_WRONG_PERFSCHEMA_USAGE
+truncate table performance_schema.THREADS;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
+

=== removed file 'mysql-test/suite/perfschema/t/dml_ews_by_event_name.test'
--- a/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/dml_ews_by_event_name.test	1970-01-01 00:00:00 +0000
@@ -1,62 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---replace_column 1 # 2 # 3 # 4 # 5 # 6 #
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-  where event_name like 'Wait/Synch/%' limit 1;
-
-select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-  where event_name='FOO';
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
---error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-  set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
-  avg_timer_wait=4, max_timer_wait=5;
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-  set count_star=12;
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-  set count_star=12 where event_name like "FOO";
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
-  where count_star=1;
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME READ;
-UNLOCK TABLES;
-
---replace_result '\'events_waits_summary_by_event_name' '\'EVENTS_WAITS_SUMMARY_BY_EVENT_NAME'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME WRITE;
-UNLOCK TABLES;
-

=== added file 'mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test'
--- a/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test	2010-08-12 14:08:52 +0000
@@ -0,0 +1,62 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 #
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  where event_name like 'Wait/Synch/%' limit 1;
+
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  where event_name='FOO';
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3,
+  avg_timer_wait=4, max_timer_wait=5;
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  set count_star=12;
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  set count_star=12 where event_name like "FOO";
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+  where count_star=1;
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME READ;
+UNLOCK TABLES;
+
+--replace_result '\'events_waits_summary_global_by_event_name' '\'EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME'
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME WRITE;
+UNLOCK TABLES;
+

=== removed file 'mysql-test/suite/perfschema/t/dml_processlist.test'
--- a/mysql-test/suite/perfschema/t/dml_processlist.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/dml_processlist.test	1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---replace_column 1 # 2 # 3 #
-select * from performance_schema.PROCESSLIST
-  where name like 'Thread/%' limit 1;
-
-select * from performance_schema.PROCESSLIST
-  where name='FOO';
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.PROCESSLIST
-  set name='FOO', thread_id=1, id=2;
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PROCESSLIST
-  set thread_id=12;
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.PROCESSLIST
-  set thread_id=12 where name like "FOO";
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PROCESSLIST
-  where id=1;
-
---replace_result '\'processlist' '\'PROCESSLIST'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.PROCESSLIST;
-
---replace_result '\'processlist' '\'PROCESSLIST'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PROCESSLIST READ;
-UNLOCK TABLES;
-
---replace_result '\'processlist' '\'PROCESSLIST'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.PROCESSLIST WRITE;
-UNLOCK TABLES;
-

=== removed file 'mysql-test/suite/perfschema/t/dml_setup_objects.test'
--- a/mysql-test/suite/perfschema/t/dml_setup_objects.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/dml_setup_objects.test	1970-01-01 00:00:00 +0000
@@ -1,75 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
-select * from performance_schema.SETUP_OBJECTS;
-
-select * from performance_schema.SETUP_OBJECTS
-  where object_type = 'TABLE';
-
-select * from performance_schema.SETUP_OBJECTS
-  where enabled='YES';
-
-# Not implemented yet
---replace_result '\'setup_objects' '\'SETUP_OBJECTS'
---error ER_ILLEGAL_HA
-insert into performance_schema.SETUP_OBJECTS
-  set object_type='TABLE', object_schema='FOO', object_name='BAR',
-  enabled='YES', timed='YES', aggregated='YES';
-
-# Not implemented yet
-# --error ER_ILLEGAL_HA
-update performance_schema.SETUP_OBJECTS
-  set object_type='TABLE';
-
-# Not implemented yet
-# --error ER_ILLEGAL_HA
-update performance_schema.SETUP_OBJECTS
-  set object_schema='ILLEGAL';
-
-# Not implemented yet
-# --error ER_ILLEGAL_HA
-update performance_schema.SETUP_OBJECTS
-  set object_name='ILLEGAL';
-
-update performance_schema.SETUP_OBJECTS
-  set enabled='NO';
-
-update performance_schema.SETUP_OBJECTS
-  set timed='NO';
-
-update performance_schema.SETUP_OBJECTS
-  set aggregated='NO';
-
-select * from performance_schema.SETUP_OBJECTS;
-
-update performance_schema.SETUP_OBJECTS
-  set enabled='YES', timed='YES', aggregated='YES';
-
-delete from performance_schema.SETUP_OBJECTS
-  where object_type = 'TABLE';
-
-delete from performance_schema.SETUP_OBJECTS;
-
-LOCK TABLES performance_schema.SETUP_OBJECTS READ;
-UNLOCK TABLES;
-
-LOCK TABLES performance_schema.SETUP_OBJECTS WRITE;
-UNLOCK TABLES;
-

=== added file 'mysql-test/suite/perfschema/t/dml_threads.test'
--- a/mysql-test/suite/perfschema/t/dml_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_threads.test	2010-08-12 14:08:52 +0000
@@ -0,0 +1,61 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--replace_column 1 # 2 # 3 #
+select * from performance_schema.THREADS
+  where name like 'Thread/%' limit 1;
+
+select * from performance_schema.THREADS
+  where name='FOO';
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.THREADS
+  set name='FOO', thread_id=1, id=2;
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.THREADS
+  set thread_id=12;
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.THREADS
+  set thread_id=12 where name like "FOO";
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.THREADS
+  where id=1;
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.THREADS;
+
+--replace_result '\'threads' '\'THREADS'
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.THREADS READ;
+UNLOCK TABLES;
+
+--replace_result '\'threads' '\'THREADS'
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.THREADS WRITE;
+UNLOCK TABLES;
+

=== modified file 'mysql-test/suite/perfschema/t/func_file_io.test'
--- a/mysql-test/suite/perfschema/t/func_file_io.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/func_file_io.test	2010-08-12 14:08:52 +0000
@@ -144,7 +144,7 @@ WHERE FILE_NAME LIKE CONCAT('%', @@tmpdi
 #
 --disable_result_log
 SELECT EVENT_NAME, COUNT_STAR, AVG_TIMER_WAIT, SUM_TIMER_WAIT
-FROM performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
+FROM performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
 WHERE COUNT_STAR > 0
 ORDER BY SUM_TIMER_WAIT DESC
 LIMIT 10;
@@ -158,7 +158,7 @@ LIMIT 10;
 SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
 # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
 LEFT JOIN information_schema.PROCESSLIST i USING (ID)
 GROUP BY i.user
 ORDER BY SUM_WAIT DESC
@@ -171,7 +171,7 @@ LIMIT 20;
 --disable_result_log
 SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
 WHERE p.ID = 1
 GROUP BY h.EVENT_NAME
 HAVING TOTAL_WAIT > 0;
@@ -184,7 +184,7 @@ HAVING TOTAL_WAIT > 0;
 --disable_result_log
 SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
-INNER JOIN performance_schema.PROCESSLIST p USING (THREAD_ID)
+INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
 LEFT JOIN information_schema.PROCESSLIST i USING (ID)
 GROUP BY i.user, h.operation
 HAVING BYTES > 0

=== modified file 'mysql-test/suite/perfschema/t/misc.test'
--- a/mysql-test/suite/perfschema/t/misc.test	2010-07-16 00:50:39 +0000
+++ b/mysql-test/suite/perfschema/t/misc.test	2010-08-12 14:08:52 +0000
@@ -27,7 +27,7 @@
 --disable_result_log
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-  (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+  (SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
   (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
    WHERE NAME LIKE "wait/synch/%")

=== modified file 'mysql-test/suite/perfschema/t/no_threads.test'
--- a/mysql-test/suite/perfschema/t/no_threads.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/no_threads.test	2010-08-12 14:08:52 +0000
@@ -45,10 +45,10 @@ show variables like "performance_schema_
 
 # Verification : in this main thread
 
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
   where name like "thread/sql/main";
 
-select count(*) from performance_schema.PROCESSLIST
+select count(*) from performance_schema.THREADS
   where name like "thread/sql/OneConnection";
 
 select event_name, operation,

=== modified file 'mysql-test/suite/perfschema/t/schema.test'
--- a/mysql-test/suite/perfschema/t/schema.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/schema.test	2010-08-12 14:08:52 +0000
@@ -29,18 +29,17 @@ show create table COND_INSTANCES;
 show create table EVENTS_WAITS_CURRENT;
 show create table EVENTS_WAITS_HISTORY;
 show create table EVENTS_WAITS_HISTORY_LONG;
-show create table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
 show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
 show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
 show create table FILE_INSTANCES;
 show create table FILE_SUMMARY_BY_EVENT_NAME;
 show create table FILE_SUMMARY_BY_INSTANCE;
 show create table MUTEX_INSTANCES;
 show create table PERFORMANCE_TIMERS;
-show create table PROCESSLIST;
 show create table RWLOCK_INSTANCES;
 show create table SETUP_CONSUMERS;
 show create table SETUP_INSTRUMENTS;
-show create table SETUP_OBJECTS;
 show create table SETUP_TIMERS;
+show create table THREADS;
 

=== modified file 'mysql-test/suite/perfschema/t/selects.test'
--- a/mysql-test/suite/perfschema/t/selects.test	2010-07-20 19:15:29 +0000
+++ b/mysql-test/suite/perfschema/t/selects.test	2010-08-12 14:08:52 +0000
@@ -45,7 +45,7 @@ LIMIT 1;
 --replace_column 1 [EVENT_ID]
 SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
 WHERE THREAD_ID IN
-  (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
+  (SELECT THREAD_ID FROM performance_schema.THREADS)
 AND EVENT_NAME IN
   (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
    WHERE NAME LIKE "wait/synch/%")
@@ -138,7 +138,7 @@ delimiter |;
 
 CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
 BEGIN
-   SELECT id FROM performance_schema.PROCESSLIST
+   SELECT id FROM performance_schema.THREADS
    WHERE THREAD_ID = tid INTO pid;
 END;
 
@@ -157,7 +157,7 @@ delimiter |;
 
 CREATE FUNCTION t_ps_func(tid INT) RETURNS int
 BEGIN
-   return (SELECT id FROM performance_schema.PROCESSLIST
+   return (SELECT id FROM performance_schema.THREADS
            WHERE THREAD_ID = tid);
 END;
 

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_thread_class.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_class.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_class.test	2010-08-12 14:08:52 +0000
@@ -31,7 +31,7 @@ select variable_value > 0 from informati
   where variable_name like 'PERFORMANCE_SCHEMA_THREAD_CLASSES_LOST';
 
 # Expect no instances
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 
 # Expect no instances lost
 show status like "performance_schema_thread_instances_lost";

=== modified file 'mysql-test/suite/perfschema/t/start_server_no_thread_inst.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_thread_inst.test	2010-08-12 14:08:52 +0000
@@ -33,7 +33,7 @@ show status like "performance_schema_thr
 # Expect no instances
 show variables like "performance_schema_max_thread_instances";
 
-select count(*) from performance_schema.PROCESSLIST;
+select count(*) from performance_schema.THREADS;
 
 # Expect instances lost
 select variable_value > 0 from information_schema.global_status

=== modified file 'mysql-test/suite/perfschema/t/thread_cache.test'
--- a/mysql-test/suite/perfschema/t/thread_cache.test	2010-07-16 13:50:50 +0000
+++ b/mysql-test/suite/perfschema/t/thread_cache.test	2010-08-12 14:08:52 +0000
@@ -30,14 +30,14 @@ connect (con1, localhost, root, , );
 
 let $con1_ID=`select connection_id()`;
 
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID = connection_id()`;
 
 connect (con2, localhost, root, , );
 
 let $con2_ID=`select connection_id()`;
 
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID = connection_id()`;
 
 connection default;
@@ -58,7 +58,7 @@ connect (con3, localhost, root, , );
 
 let $con3_ID=`select connection_id()`;
 
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID = connection_id()`;
 
 disconnect con3;
@@ -82,14 +82,14 @@ connect (con1, localhost, root, , );
 
 let $con1_ID=`select connection_id()`;
 
-let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID = connection_id()`;
 
 connect (con2, localhost, root, , );
 
 let $con2_ID=`select connection_id()`;
 
-let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID = connection_id()`;
 
 connection default;
@@ -108,7 +108,7 @@ connect (con3, localhost, root, , );
 
 let $con3_ID=`select connection_id()`;
 
-let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
   where ID = connection_id()`;
 
 disconnect con3;

=== modified file 'mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result'
--- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	2010-06-30 15:25:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	2010-08-10 11:32:54 +0000
@@ -72,6 +72,8 @@ before call db1.p1()
 INSERT INTO db1.t2 VALUES ('before call db1.p2()');
 BEGIN;
 CALL db1.p2();
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 ROLLBACK;
 INSERT INTO db1.t2 VALUES ('after call db1.p2()');
 SELECT * FROM db1.t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result	2010-06-30 15:25:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result	2010-08-10 11:32:54 +0000
@@ -3661,6 +3661,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (135, 4);
 fc_i_nt_5_suc (135, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -3689,6 +3691,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (136, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -3781,6 +3785,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (139, 4);
 fc_i_nt_5_suc (139, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -3809,6 +3815,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (140, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -3907,6 +3915,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (143, 4);
 fc_i_nt_5_suc (143, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -3937,6 +3947,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (144, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4033,6 +4045,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (147, 4);
 fc_i_nt_5_suc (147, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4063,6 +4077,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (148, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4295,6 +4311,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (155, 4);
 fc_i_nt_5_suc (155, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4325,6 +4343,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (156, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4423,6 +4443,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (159, 4);
 fc_i_nt_5_suc (159, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4453,6 +4475,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (160, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4557,6 +4581,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (163, 4);
 fc_i_nt_5_suc (163, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4589,6 +4615,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (164, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4691,6 +4719,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 SELECT fc_i_nt_5_suc (167, 4);
 fc_i_nt_5_suc (167, 4)
 fc_i_nt_5_suc
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -4723,6 +4753,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (168, 4);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5291,6 +5323,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (185, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185),  NAME_CONST('in_stmt_id',1))
@@ -5329,6 +5363,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (186, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186),  NAME_CONST('in_stmt_id',1))
@@ -5367,6 +5403,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (187, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187),  NAME_CONST('in_stmt_id',1))
@@ -5407,6 +5445,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (188, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188),  NAME_CONST('in_stmt_id',1))
@@ -5885,6 +5925,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (201, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201),  NAME_CONST('in_stmt_id',1))
@@ -5925,6 +5967,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (202, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202),  NAME_CONST('in_stmt_id',1))
@@ -5967,6 +6011,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (203, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203),  NAME_CONST('in_stmt_id',1))
@@ -6007,6 +6053,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-proc << -b-b-b-b-b-b-b-b-b-b-b-
 CALL pc_i_nt_5_suc (204, 2);
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204),  NAME_CONST('in_stmt_id',1))

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result	2010-08-10 11:32:54 +0000
@@ -39,6 +39,8 @@ INSERT INTO t2 VALUES (NULL);
 RETURN i;
 END//
 CALL p1();
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
@@ -123,6 +125,8 @@ SELECT * FROM t2;
 id
 DROP TRIGGER tr1;
 CALL p2();
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result	2009-12-01 19:07:18 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result	2010-08-09 16:52:26 +0000
@@ -38,6 +38,8 @@ INSERT INTO t1 VALUES ('MySQL','1993-02-
 END|
 CALL p2();
 CALL p1();
+Warnings:
+Error	1329	No data - zero rows fetched, selected, or processed
 DROP TABLE t1;
 DROP TABLE t2;
 DROP PROCEDURE p1;

=== modified file 'mysql-test/suite/rpl_ndb/t/disabled.def'
--- a/mysql-test/suite/rpl_ndb/t/disabled.def	2010-07-02 06:23:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/disabled.def	2010-08-09 16:55:26 +0000
@@ -12,6 +12,7 @@
 
 rpl_ndb_stm_innodb  : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails
 rpl_ndb_2other      : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails
+rpl_ndb_row_implicit_commit_binlog : Bug#55849 2010-08-09 alik rpl_ndb.rpl_ndb_row_implicit_commit_binlog fails
 
 # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
 rpl_ndb_2ndb   : Bug#45974: rpl_ndb_2ndb fails sporadically

=== modified file 'mysql-test/t/mysql_upgrade.test'
--- a/mysql-test/t/mysql_upgrade.test	2010-07-05 10:22:13 +0000
+++ b/mysql-test/t/mysql_upgrade.test	2010-08-11 17:56:56 +0000
@@ -1,31 +1,4 @@
-# Can't run test of external client with embedded server
--- source include/not_embedded.inc
-
-# Only run test if "mysql_upgrade" is found
---require r/have_mysql_upgrade.result
---disable_query_log
-select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
---enable_query_log
-
-#
-# Hack:
-#
-# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
-# consumption (CPU) for upgrading a large log table will be intense.
-# Therefore, truncate the log table in advance and issue a statement
-# that should be logged.
-#
-if (`SELECT $VALGRIND_TEST`)
-{
-  --disable_query_log
-  --disable_result_log
-  --disable_abort_on_error
-  TRUNCATE TABLE mysql.general_log;
-  SELECT 1;
-  --enable_abort_on_error
-  --enable_result_log
-  --enable_query_log
-}
+-- source include/mysql_upgrade_preparation.inc
 
 #
 # Basic test that we can run mysql_upgrde and that it finds the

=== added file 'mysql-test/t/mysql_upgrade_ssl.test'
--- a/mysql-test/t/mysql_upgrade_ssl.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysql_upgrade_ssl.test	2010-08-11 17:56:56 +0000
@@ -0,0 +1,10 @@
+# mysql_upgrade tests requiring SSL support
+
+-- source include/have_ssl_communication.inc
+-- source include/mysql_upgrade_preparation.inc
+
+--echo #
+--echo # Bug#55672 mysql_upgrade dies with internal error 
+--echo #
+--exec $MYSQL_UPGRADE --skip-verbose --ssl --force 2>&1
+--exit

=== modified file 'scripts/CMakeLists.txt'
--- a/scripts/CMakeLists.txt	2010-08-05 16:38:24 +0000
+++ b/scripts/CMakeLists.txt	2010-08-10 14:06:04 +0000
@@ -1,4 +1,3 @@
-# Copyright (C) 2006 MySQL AB
 # 
 # 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
@@ -252,43 +251,40 @@ IF(POLICY CMP0007)
   CMAKE_POLICY(SET CMP0007 OLD)
 ENDIF()
 
-LIST(REMOVE_ITEM mysqlclient_LIB_DEPENDS "")
-LIST(REMOVE_DUPLICATES mysqlclient_LIB_DEPENDS)
-FOREACH(lib ${mysqlclient_LIB_DEPENDS})
-  # Filter out "general", it is not a library, just CMake hint
-  IF(NOT lib STREQUAL "general" AND NOT CLIENT_LIBS MATCHES "-l${lib} ")
-     IF (lib MATCHES "^\\-l")
-       SET(CLIENT_LIBS "${CLIENT_LIBS} ${lib} ") 
-     ELSEIF(lib MATCHES "^/")
-       # Full path, convert to just filename, strip "lib" prefix and extension
-       GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
-       STRING(REGEX REPLACE "^lib" "" lib "${lib}")
-       SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " ) 
-     ELSE()
-       SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " ) 
-     ENDIF()
+# Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable
+# returned string in ${var} is can be passed to linker's command line
+MACRO(EXTRACT_LINK_LIBRARIES target var)
+  IF(${target}_LIB_DEPENDS)
+    LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "")
+    LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS)
+    FOREACH(lib ${${target}_LIB_DEPENDS})
+      # Filter out "general", it is not a library, just CMake hint
+      # Also, remove duplicates
+      IF(NOT lib STREQUAL "general" AND NOT ${var}  MATCHES "-l${lib} ")
+        IF (lib MATCHES "^\\-l")
+          SET(${var} "${${var}} ${lib} ") 
+        ELSEIF(lib MATCHES "^/")
+          # Full path, convert to just filename, strip "lib" prefix and extension
+          GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
+          STRING(REGEX REPLACE "^lib" "" lib "${lib}")
+          SET(${var} "${${var}}-l${lib} " ) 
+        ELSE()
+          SET(${var} "${${var}}-l${lib} " ) 
+        ENDIF()
+      ENDIF()
+    ENDFOREACH()
   ENDIF()
-ENDFOREACH()
-
-
-IF(LIBDL AND NOT LIBDL MATCHES "-l")
-  SET(LIBDL "-l${LIBDL}")
-ENDIF()
-
-IF(LIBWRAP)
-  SET(WRAPLIBS "-lwrap")
-ENDIF()
-
-SET(LIBS "${CLIENT_LIBS}")
+  IF(MSVC)
+    STRING(REPLACE "-l" "" ${var} "${${var}}")
+  ENDIF()
+ENDMACRO()
 
-IF(LIBCRYPT)
-  SET(LIBS "${LIBS} -l${LIBCRYPT}")
-ENDIF()
+EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)
+EXTRACT_LINK_LIBRARIES(mysqlserver LIBS)
 
-IF(MSVC)
-  STRING(REPLACE "-l" "" CLIENT_LIBS "${CLIENT_LIBS}")
-  STRING(REPLACE "-l" "" LIBS "${LIBS}" )
-ENDIF()
+# mysql_config evaluates ${LIBDL}, we want to avoid it
+# as our CLIENT_LIBS and LIBS are already correct
+SET(LIBDL)
 
 SET(NON_THREADED_LIBS ${CLIENT_LIBS})
 SET(mysql_config_COMPONENT COMPONENT Development)

=== modified file 'scripts/mysql_config.sh'
--- a/scripts/mysql_config.sh	2010-07-19 14:00:29 +0000
+++ b/scripts/mysql_config.sh	2010-08-09 13:27:04 +0000
@@ -108,7 +108,7 @@ fi
 # We intentionally add a space to the beginning and end of lib strings, simplifies replace later
 libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
 libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
-libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
+libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @CLIENT_LIBS@ @openssl_libs@ "
 embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ "
 
 if [ -r "$pkglibdir/libmygcc.a" ]; then

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2010-04-14 16:40:04 +0000
+++ b/scripts/mysql_system_tables.sql	2010-08-12 14:08:52 +0000
@@ -242,26 +242,6 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
--- TABLE EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
---
-
-SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="COUNT_STAR BIGINT unsigned not null,";
-SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
 -- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
 --
 
@@ -304,6 +284,26 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
+-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_STAR BIGINT unsigned not null,";
+SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
 -- TABLE FILE_INSTANCES
 --
 
@@ -395,23 +395,6 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
--- TABLE PROCESSLIST
---
-
-SET @l1="CREATE TABLE performance_schema.PROCESSLIST(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="ID INTEGER not null,";
-SET @l4="NAME VARCHAR(64) not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
 -- TABLE RWLOCK_INSTANCES
 --
 
@@ -463,19 +446,15 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
--- TABLE SETUP_OBJECTS
+-- TABLE SETUP_TIMERS
 --
 
-SET @l1="CREATE TABLE performance_schema.SETUP_OBJECTS(";
-SET @l2="OBJECT_TYPE VARCHAR(64),";
-SET @l3="OBJECT_SCHEMA VARCHAR(64),";
-SET @l4="OBJECT_NAME VARCHAR(64),";
-SET @l5="ENABLED ENUM ('YES', 'NO') not null,";
-SET @l6="TIMED ENUM ('YES', 'NO') not null,";
-SET @l7="AGGREGATED ENUM ('YES', 'NO') not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
 
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+SET @cmd=concat(@l1,@l2,@l3,@l4);
 
 SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
 PREPARE stmt FROM @str;
@@ -483,15 +462,16 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
--- TABLE SETUP_TIMERS
+-- TABLE THREADS
 --
 
-SET @l1="CREATE TABLE performance_schema.SETUP_TIMERS(";
-SET @l2="NAME VARCHAR(64) not null,";
-SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+SET @l1="CREATE TABLE performance_schema.THREADS(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="ID INTEGER not null,";
+SET @l4="NAME VARCHAR(64) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
 
-SET @cmd=concat(@l1,@l2,@l3,@l4);
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
 
 SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
 PREPARE stmt FROM @str;

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2010-08-05 16:38:24 +0000
+++ b/sql/CMakeLists.txt	2010-08-09 19:47:26 +0000
@@ -82,6 +82,7 @@ MYSQL_ADD_PLUGIN(partition ha_partition.
 RECOMPILE_FOR_EMBEDDED)
 
 ADD_LIBRARY(sql STATIC ${SQL_SOURCE})
+ADD_DEPENDENCIES(sql GenServerSource)
 DTRACE_INSTRUMENT(sql)
 TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} 
   mysys dbug strings vio regex   
@@ -188,6 +189,7 @@ ADD_EXECUTABLE(gen_lex_hash gen_lex_hash
 ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
   COMMAND gen_lex_hash > lex_hash.h
+  DEPENDS gen_lex_hash
 )
 
 MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc)

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-07-29 12:32:11 +0000
+++ b/sql/log.cc	2010-08-10 11:32:54 +0000
@@ -4704,7 +4704,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
       file= cache_mngr->get_binlog_cache_log(is_trans_cache);
       cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
 
-      if (thd->stmt_accessed_non_trans_temp_table())
+      if (thd->lex->stmt_accessed_non_trans_temp_table())
         cache_data->set_changes_to_non_trans_temp_table();
 
       thd->binlog_start_trans_and_stmt();

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-07-29 10:18:13 +0000
+++ b/sql/log_event.cc	2010-08-10 11:32:54 +0000
@@ -679,7 +679,7 @@ Log_event::Log_event(THD* thd_arg, uint1
   server_id=	thd->server_id;
   when=		thd->start_time;
   cache_type= ((using_trans || stmt_has_updated_trans_table(thd) ||
-               (thd->stmt_accessed_temp_table() &&
+               (thd->lex->stmt_accessed_temp_table() &&
                trans_has_updated_trans_table(thd)))
                ? Log_event::EVENT_TRANSACTIONAL_CACHE :
                Log_event::EVENT_STMT_CACHE);
@@ -2573,7 +2573,7 @@ Query_log_event::Query_log_event(THD* th
   else
   {
     cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || trx_cache ||
-                 (thd->stmt_accessed_temp_table() &&
+                 (thd->lex->stmt_accessed_temp_table() &&
                  trans_has_updated_trans_table(thd)))
                  ? Log_event::EVENT_TRANSACTIONAL_CACHE :
                  Log_event::EVENT_STMT_CACHE);

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2010-07-30 15:28:36 +0000
+++ b/sql/sp_head.cc	2010-08-12 12:51:46 +0000
@@ -1743,7 +1743,7 @@ sp_head::execute_function(THD *thd, Item
                           Field *return_value_fld)
 {
   ulonglong binlog_save_options;
-  bool need_binlog_call;
+  bool need_binlog_call= FALSE;
   uint arg_no;
   sp_rcontext *octx = thd->spcont;
   sp_rcontext *nctx = NULL;
@@ -1950,6 +1950,14 @@ err_with_cleanup:
   free_root(&call_mem_root, MYF(0));
   thd->spcont= octx;
 
+  /*
+    If not insided a procedure and a function printing warning
+    messsages.
+  */
+  if (need_binlog_call && 
+      thd->spcont == NULL && !thd->binlog_evt_union.do_union)
+    thd->issue_unsafe_warnings();
+
   DBUG_RETURN(err_status);
 }
 
@@ -2195,6 +2203,17 @@ sp_head::execute_procedure(THD *thd, Lis
   thd->spcont= save_spcont;
   thd->utime_after_lock= utime_before_sp_exec;
 
+  /*
+    If not insided a procedure and a function printing warning
+    messsages.
+  */ 
+  bool need_binlog_call= mysql_bin_log.is_open() &&
+                         (thd->variables.option_bits & OPTION_BIN_LOG) &&
+                         !thd->is_current_stmt_binlog_format_row();
+  if (need_binlog_call && thd->spcont == NULL &&
+      !thd->binlog_evt_union.do_union)
+    thd->issue_unsafe_warnings();
+
   DBUG_RETURN(err_status);
 }
 

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-07-30 15:28:36 +0000
+++ b/sql/sql_class.cc	2010-08-10 11:32:54 +0000
@@ -492,7 +492,6 @@ THD::THD()
    rli_fake(0),
    user_time(0), in_sub_stmt(0),
    binlog_unsafe_warning_flags(0),
-   stmt_accessed_table_flag(0),
    binlog_table_maps(0),
    table_map_for_update(0),
    arg_of_last_insert_id_function(FALSE),
@@ -3675,8 +3674,17 @@ int THD::decide_logging_format(TABLE_LIS
        Innodb and Falcon; Innodb and MyIsam.
     */
     my_bool multi_access_engine= FALSE;
-
+    /*
+      Identifies if a table is changed.
+    */
+    my_bool is_write= FALSE;
+    /*
+      A pointer to a previous table that was changed.
+    */
     TABLE* prev_write_table= NULL;
+    /*
+      A pointer to a previous table that was accessed.
+    */
     TABLE* prev_access_table= NULL;
 
 #ifndef DBUG_OFF
@@ -3700,7 +3708,8 @@ int THD::decide_logging_format(TABLE_LIS
       if (table->placeholder())
         continue;
 
-      if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE)
+      if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE ||
+          table->table->s->table_category == TABLE_CATEGORY_LOG)
         lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE);
 
       handler::Table_flags const flags= table->table->file->ha_table_flags();
@@ -3716,16 +3725,18 @@ int THD::decide_logging_format(TABLE_LIS
         my_bool trans= table->table->file->has_transactions();
 
         if (table->table->s->tmp_table)
-          set_stmt_accessed_table(trans ? STMT_WRITES_TEMP_TRANS_TABLE :
-                                          STMT_WRITES_TEMP_NON_TRANS_TABLE);
+          lex->set_stmt_accessed_table(trans ? LEX::STMT_WRITES_TEMP_TRANS_TABLE :
+                                               LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE);
         else
-          set_stmt_accessed_table(trans ? STMT_WRITES_TRANS_TABLE :
-                                          STMT_WRITES_NON_TRANS_TABLE);
+          lex->set_stmt_accessed_table(trans ? LEX::STMT_WRITES_TRANS_TABLE :
+                                               LEX::STMT_WRITES_NON_TRANS_TABLE);
 
         flags_write_all_set &= flags;
         flags_write_some_set |= flags;
+        is_write= TRUE;
 
         prev_write_table= table->table;
+
       }
       flags_access_some_set |= flags;
 
@@ -3736,11 +3747,11 @@ int THD::decide_logging_format(TABLE_LIS
         my_bool trans= table->table->file->has_transactions();
 
         if (table->table->s->tmp_table)
-          set_stmt_accessed_table(trans ? STMT_READS_TEMP_TRANS_TABLE :
-                                          STMT_READS_TEMP_NON_TRANS_TABLE);
+          lex->set_stmt_accessed_table(trans ? LEX::STMT_READS_TEMP_TRANS_TABLE :
+                                               LEX::STMT_READS_TEMP_NON_TRANS_TABLE);
         else
-          set_stmt_accessed_table(trans ? STMT_READS_TRANS_TABLE :
-                                          STMT_READS_NON_TRANS_TABLE);
+          lex->set_stmt_accessed_table(trans ? LEX::STMT_READS_TRANS_TABLE :
+                                               LEX::STMT_READS_NON_TRANS_TABLE);
       }
 
       if (prev_access_table && prev_access_table->file->ht !=
@@ -3812,24 +3823,24 @@ int THD::decide_logging_format(TABLE_LIS
       my_bool non_trans_unsafe= FALSE;
 
       /* Case 1. */
-      if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) &&
-          stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+      if (lex->stmt_accessed_table(LEX::STMT_WRITES_TRANS_TABLE) &&
+          lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
         mixed_unsafe= TRUE;
       /* Case 2. */
-      else if (stmt_accessed_table(STMT_WRITES_TEMP_TRANS_TABLE) &&
-               stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_TRANS_TABLE) &&
+               lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
         mixed_unsafe= TRUE;
       /* Case 3. */
-      else if (stmt_accessed_table(STMT_WRITES_TRANS_TABLE) &&
-               stmt_accessed_table(STMT_READS_NON_TRANS_TABLE))
+      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TRANS_TABLE) &&
+               lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
         mixed_unsafe= TRUE;
       /* Case 4. */
-      else if (stmt_accessed_table(STMT_WRITES_TEMP_TRANS_TABLE) &&
-               stmt_accessed_table(STMT_READS_NON_TRANS_TABLE))
+      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_TRANS_TABLE) &&
+               lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
         mixed_unsafe= TRUE;
       /* Case 5. */
-      else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
-               stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
+               lex->stmt_accessed_table(LEX::STMT_READS_TRANS_TABLE) &&
                tx_isolation < ISO_REPEATABLE_READ)
         /*
            By default, InnoDB operates in REPEATABLE READ and with the option
@@ -3847,28 +3858,28 @@ int THD::decide_logging_format(TABLE_LIS
       if (trans_has_updated_trans_table(this))
       {
         /* Case 6. */
-        if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
-            stmt_accessed_table(STMT_READS_TRANS_TABLE))
+        if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
+            lex->stmt_accessed_table(LEX::STMT_READS_TRANS_TABLE))
           mixed_unsafe= TRUE;
         /* Case 7. */
-        else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
-                 stmt_accessed_table(STMT_READS_TEMP_TRANS_TABLE))
+        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
+                 lex->stmt_accessed_table(LEX::STMT_READS_TEMP_TRANS_TABLE))
           mixed_unsafe= TRUE;
         /* Case 8. */
-        else if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
-                 stmt_accessed_table(STMT_READS_TEMP_NON_TRANS_TABLE))
+        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
+                 lex->stmt_accessed_table(LEX::STMT_READS_TEMP_NON_TRANS_TABLE))
           mixed_unsafe= TRUE;
         /* Case 9. */
-        else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
-                 stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
+                 lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
           mixed_unsafe= TRUE;
         /* Case 10. */
-        else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
-                 stmt_accessed_table(STMT_READS_NON_TRANS_TABLE))
+        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
+                 lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
         mixed_unsafe= TRUE;
         /* Case 11. */
         else if (!variables.binlog_direct_non_trans_update &&
-                 stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE))
+                 lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
           non_trans_unsafe= TRUE;
       }
 
@@ -3959,13 +3970,14 @@ int THD::decide_logging_format(TABLE_LIS
           */
           my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), "");
         }
-        else if ((unsafe_flags= lex->get_stmt_unsafe_flags()) != 0)
+        else if (is_write && (unsafe_flags= lex->get_stmt_unsafe_flags()) != 0)
         {
           /*
             7. Warning: Unsafe statement logged as statement due to
                binlog_format = STATEMENT
           */
           binlog_unsafe_warning_flags|= unsafe_flags;
+
           DBUG_PRINT("info", ("Scheduling warning to be issued by "
                               "binlog_query: '%s'",
                               ER(ER_BINLOG_UNSAFE_STATEMENT)));
@@ -4441,23 +4453,10 @@ void THD::issue_unsafe_warnings()
     Ensure that binlog_unsafe_warning_flags is big enough to hold all
     bits.  This is actually a constant expression.
   */
-  DBUG_ASSERT(2 * LEX::BINLOG_STMT_UNSAFE_COUNT <=
+  DBUG_ASSERT(LEX::BINLOG_STMT_UNSAFE_COUNT <=
               sizeof(binlog_unsafe_warning_flags) * CHAR_BIT);
 
   uint32 unsafe_type_flags= binlog_unsafe_warning_flags;
-
-  /*
-    Clear: (1) bits above BINLOG_STMT_UNSAFE_COUNT; (2) bits for
-    warnings that have been printed already.
-  */
-  unsafe_type_flags &= (LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS ^
-                        (unsafe_type_flags >> LEX::BINLOG_STMT_UNSAFE_COUNT));
-  /* If all warnings have been printed already, return. */
-  if (unsafe_type_flags == 0)
-    DBUG_VOID_RETURN;
-
-  DBUG_PRINT("info", ("unsafe_type_flags: 0x%x", unsafe_type_flags));
-
   /*
     For each unsafe_type, check if the statement is unsafe in this way
     and issue a warning.
@@ -4481,12 +4480,6 @@ void THD::issue_unsafe_warnings()
       }
     }
   }
-  /*
-    Mark these unsafe types as already printed, to avoid printing
-    warnings for them again.
-  */
-  binlog_unsafe_warning_flags|=
-    unsafe_type_flags << LEX::BINLOG_STMT_UNSAFE_COUNT;
   DBUG_VOID_RETURN;
 }
 
@@ -4540,19 +4533,32 @@ int THD::binlog_query(THD::enum_binlog_q
 
   /*
     Warnings for unsafe statements logged in statement format are
-    printed here instead of in decide_logging_format().  This is
-    because the warnings should be printed only if the statement is
-    actually logged. When executing decide_logging_format(), we cannot
-    know for sure if the statement will be logged.
+    printed in three places instead of in decide_logging_format().
+    This is because the warnings should be printed only if the statement
+    is actually logged. When executing decide_logging_format(), we cannot
+    know for sure if the statement will be logged:
+
+    1 - sp_head::execute_procedure which prints out warnings for calls to
+    stored procedures.
+
+    2 - sp_head::execute_function which prints out warnings for calls
+    involving functions.
+
+    3 - THD::binlog_query (here) which prints warning for top level
+    statements not covered by the two cases above: i.e., if not insided a
+    procedure and a function.
 
     Besides, we should not try to print these warnings if it is not
     possible to write statements to the binary log as it happens when
     the execution is inside a function, or generaly speaking, when
     the variables.option_bits & OPTION_BIN_LOG is false.
+    
   */
-  if (variables.option_bits & OPTION_BIN_LOG)
+  if ((variables.option_bits & OPTION_BIN_LOG) &&
+      spcont == NULL && !binlog_evt_union.do_union)
     issue_unsafe_warnings();
 
+
   switch (qtype) {
     /*
       ROW_QUERY_TYPE means that the statement may be logged either in

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-08-12 13:50:23 +0000
+++ b/sql/sql_class.h	2010-08-13 08:43:26 +0000
@@ -1566,125 +1566,6 @@ public:
     return current_stmt_binlog_format == BINLOG_FORMAT_ROW;
   }
 
-  enum enum_stmt_accessed_table
-  {
-    /*
-       If a transactional table is about to be read. Note that
-       a write implies a read.
-    */
-    STMT_READS_TRANS_TABLE= 0,
-    /*
-       If a transactional table is about to be updated.
-    */
-    STMT_WRITES_TRANS_TABLE,
-    /*
-       If a non-transactional table is about to be read. Note that
-       a write implies a read.
-    */
-    STMT_READS_NON_TRANS_TABLE,
-    /*
-       If a non-transactional table is about to be updated.
-    */
-    STMT_WRITES_NON_TRANS_TABLE,
-    /*
-       If a temporary transactional table is about to be read. Note
-       that a write implies a read.
-    */
-    STMT_READS_TEMP_TRANS_TABLE,
-    /*
-       If a temporary transactional table is about to be updated.
-    */
-    STMT_WRITES_TEMP_TRANS_TABLE,
-    /*
-       If a temporary non-transactional table is about to be read. Note
-      that a write implies a read.
-    */
-    STMT_READS_TEMP_NON_TRANS_TABLE,
-    /*
-       If a temporary non-transactional table is about to be updated.
-    */
-    STMT_WRITES_TEMP_NON_TRANS_TABLE,
-    /*
-      The last element of the enumeration. Please, if necessary add
-      anything before this.
-    */
-    STMT_ACCESS_TABLE_COUNT
-  };
-
-  /**
-    Sets the type of table that is about to be accessed while executing a
-    statement.
-
-    @param accessed_table Enumeration type that defines the type of table,
-                           e.g. temporary, transactional, non-transactional.
-  */
-  inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
-  {
-    DBUG_ENTER("THD::set_stmt_accessed_table");
-
-    DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
-    stmt_accessed_table_flag |= (1U << accessed_table);
-
-    DBUG_VOID_RETURN;
-  }
-
-  /**
-    Checks if a type of table is about to be accessed while executing a
-    statement.
-
-    @param accessed_table Enumeration type that defines the type of table,
-                           e.g. temporary, transactional, non-transactional.
-
-    @return
-      @retval TRUE  if the type of the table is about to be accessed
-      @retval FALSE otherwise
-  */
-  inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
-  {
-    DBUG_ENTER("THD::stmt_accessed_table");
-
-    DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
-
-    DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0);
-  }
-
-  /**
-    Checks if a temporary table is about to be accessed while executing a
-    statement.
-
-    @return
-      @retval TRUE  if a temporary table is about to be accessed
-      @retval FALSE otherwise
-  */
-  inline bool stmt_accessed_temp_table()
-  {
-    DBUG_ENTER("THD::stmt_accessed_temp_table");
-
-    DBUG_RETURN((stmt_accessed_table_flag &
-                ((1U << STMT_READS_TEMP_TRANS_TABLE) |
-                 (1U << STMT_WRITES_TEMP_TRANS_TABLE) |
-                 (1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
-                 (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
-  }
-
-  /**
-    Checks if a temporary non-transactional table is about to be accessed
-    while executing a statement.
-
-    @return
-      @retval TRUE  if a temporary non-transactional table is about to be
-                    accessed
-      @retval FALSE otherwise
-  */
-  inline bool stmt_accessed_non_trans_temp_table()
-  {
-    DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
-
-    DBUG_RETURN((stmt_accessed_table_flag &
-                ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
-                 (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
-  }
-
 private:
   /**
     Indicates the format in which the current statement will be
@@ -1695,24 +1576,8 @@ private:
   /**
     Bit field for the state of binlog warnings.
 
-    There are two groups of bits:
-
-    - The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of
-      unsafeness that the current statement has.
-
-    - The following Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types
-      of unsafeness that the current statement has issued warnings
-      for.
-
-    Hence, this variable must be big enough to hold
-    2*Lex::BINLOG_STMT_UNSAFE_COUNT bits.  This is asserted in @c
-    issue_unsafe_warnings().
-
-    The first and second groups of bits are set by @c
-    decide_logging_format() when it detects that a warning should be
-    issued.  The third group of bits is set from @c binlog_query()
-    when a warning is issued.  All bits are cleared at the end of the
-    top-level statement.
+    The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of
+    unsafeness that the current statement has.
 
     This must be a member of THD and not of LEX, because warnings are
     detected and issued in different places (@c
@@ -1722,20 +1587,14 @@ private:
   */
   uint32 binlog_unsafe_warning_flags;
 
-  /**
-    Bit field that determines the type of tables that are about to be
-    be accessed while executing a statement.
-  */
-  uint32 stmt_accessed_table_flag;
-
-  void issue_unsafe_warnings();
-
   /*
     Number of outstanding table maps, i.e., table maps in the
     transaction cache.
   */
   uint binlog_table_maps;
 public:
+  void issue_unsafe_warnings();
+
   uint get_binlog_table_maps() const {
     return binlog_table_maps;
   }

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2010-07-29 12:32:11 +0000
+++ b/sql/sql_lex.cc	2010-08-10 11:32:54 +0000
@@ -2300,6 +2300,7 @@ void Query_tables_list::reset_query_tabl
   sroutines_list_own_last= sroutines_list.next;
   sroutines_list_own_elements= 0;
   binlog_stmt_flags= 0;
+  stmt_accessed_table_flag= 0; 
 }
 
 

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2010-07-29 12:32:11 +0000
+++ b/sql/sql_lex.h	2010-08-10 11:32:54 +0000
@@ -1276,6 +1276,125 @@ public:
     DBUG_VOID_RETURN;
   }
 
+  enum enum_stmt_accessed_table
+  {
+    /*
+       If a transactional table is about to be read. Note that
+       a write implies a read.
+    */
+    STMT_READS_TRANS_TABLE= 0,
+    /*
+       If a transactional table is about to be updated.
+    */
+    STMT_WRITES_TRANS_TABLE,
+    /*
+       If a non-transactional table is about to be read. Note that
+       a write implies a read.
+    */
+    STMT_READS_NON_TRANS_TABLE,
+    /*
+       If a non-transactional table is about to be updated.
+    */
+    STMT_WRITES_NON_TRANS_TABLE,
+    /*
+       If a temporary transactional table is about to be read. Note
+       that a write implies a read.
+    */
+    STMT_READS_TEMP_TRANS_TABLE,
+    /*
+       If a temporary transactional table is about to be updated.
+    */
+    STMT_WRITES_TEMP_TRANS_TABLE,
+    /*
+       If a temporary non-transactional table is about to be read. Note
+      that a write implies a read.
+    */
+    STMT_READS_TEMP_NON_TRANS_TABLE,
+    /*
+       If a temporary non-transactional table is about to be updated.
+    */
+    STMT_WRITES_TEMP_NON_TRANS_TABLE,
+    /*
+      The last element of the enumeration. Please, if necessary add
+      anything before this.
+    */
+    STMT_ACCESS_TABLE_COUNT
+  };
+               
+  /**
+    Sets the type of table that is about to be accessed while executing a
+    statement.
+
+    @param accessed_table Enumeration type that defines the type of table,
+                           e.g. temporary, transactional, non-transactional.
+  */
+  inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
+  {
+    DBUG_ENTER("THD::set_stmt_accessed_table");
+
+    DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
+    stmt_accessed_table_flag |= (1U << accessed_table);
+
+    DBUG_VOID_RETURN;
+  }
+
+  /**
+    Checks if a type of table is about to be accessed while executing a
+    statement.
+
+    @param accessed_table Enumeration type that defines the type of table,
+                           e.g. temporary, transactional, non-transactional.
+
+    @return
+      @retval TRUE  if the type of the table is about to be accessed
+      @retval FALSE otherwise
+  */
+  inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
+  {
+    DBUG_ENTER("THD::stmt_accessed_table");
+
+    DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
+
+    DBUG_RETURN((stmt_accessed_table_flag & (1U << accessed_table)) != 0);
+  }
+
+  /**
+    Checks if a temporary table is about to be accessed while executing a
+    statement.
+
+    @return
+      @retval TRUE  if a temporary table is about to be accessed
+      @retval FALSE otherwise
+  */
+  inline bool stmt_accessed_temp_table()
+  {
+    DBUG_ENTER("THD::stmt_accessed_temp_table");
+
+    DBUG_RETURN((stmt_accessed_table_flag &
+                ((1U << STMT_READS_TEMP_TRANS_TABLE) |
+                 (1U << STMT_WRITES_TEMP_TRANS_TABLE) |
+                 (1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
+                 (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
+  }
+
+  /**
+    Checks if a temporary non-transactional table is about to be accessed
+    while executing a statement.
+
+    @return
+      @retval TRUE  if a temporary non-transactional table is about to be
+                    accessed
+      @retval FALSE otherwise
+  */
+  inline bool stmt_accessed_non_trans_temp_table()
+  {
+    DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
+
+    DBUG_RETURN((stmt_accessed_table_flag &
+                ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
+                 (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
+  }
+
   /**
     true if the parsed tree contains references to stored procedures
     or functions, false otherwise
@@ -1317,6 +1436,12 @@ private:
     stored procedure has its own LEX object (but no own THD object).
   */
   uint32 binlog_stmt_flags;
+
+  /**
+    Bit field that determines the type of tables that are about to be
+    be accessed while executing a statement.
+  */
+  uint32 stmt_accessed_table_flag;
 };
 
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-08-12 15:29:41 +0000
+++ b/sql/sql_parse.cc	2010-08-13 08:43:26 +0000
@@ -5653,7 +5653,6 @@ void THD::reset_for_next_command()
 
   thd->reset_current_stmt_binlog_format_row();
   thd->binlog_unsafe_warning_flags= 0;
-  thd->stmt_accessed_table_flag= 0;
 
   DBUG_PRINT("debug",
              ("is_current_stmt_binlog_format_row(): %d",

=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt	2010-07-15 23:44:45 +0000
+++ b/storage/perfschema/CMakeLists.txt	2010-08-12 14:08:52 +0000
@@ -38,15 +38,15 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   table_all_instr.h
   table_events_waits.h
   table_events_waits_summary.h
+  table_ews_global_by_event_name.h
   table_file_instances.h
   table_file_summary.h
   table_performance_timers.h
-  table_processlist.h
   table_setup_consumers.h
   table_setup_instruments.h
-  table_setup_objects.h
   table_setup_timers.h
   table_sync_instances.h
+  table_threads.h
   ha_perfschema.cc
   pfs.cc
   pfs_column_values.cc
@@ -60,15 +60,15 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   table_all_instr.cc
   table_events_waits.cc
   table_events_waits_summary.cc
+  table_ews_global_by_event_name.cc
   table_file_instances.cc
   table_file_summary.cc
   table_performance_timers.cc
-  table_processlist.cc
   table_setup_consumers.cc
   table_setup_instruments.cc
-  table_setup_objects.cc
   table_setup_timers.cc
   table_sync_instances.cc
+  table_threads.cc
   pfs_atomic.cc
   pfs_check.cc
 )

=== modified file 'storage/perfschema/Makefile.am'
--- a/storage/perfschema/Makefile.am	2010-07-15 23:44:45 +0000
+++ b/storage/perfschema/Makefile.am	2010-08-12 14:08:52 +0000
@@ -39,12 +39,12 @@ noinst_HEADERS = ha_perfschema.h pfs_eng
                 table_setup_instruments.h table_performance_timers.h \
                 table_setup_timers.h \
                 table_setup_consumers.h table_events_waits.h \
-		pfs_events_waits.h pfs_timer.h table_processlist.h \
+		pfs_events_waits.h pfs_timer.h table_threads.h \
 		table_sync_instances.h \
 		table_events_waits_summary.h pfs_stat.h \
-		table_all_instr.h \
+		table_ews_global_by_event_name.h table_all_instr.h \
 		table_file_instances.h table_file_summary.h \
-		table_setup_objects.h pfs_lock.h pfs_atomic.h
+		pfs_lock.h pfs_atomic.h
 
 PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \
 		pfs_global.cc pfs_instr_class.cc pfs_instr.cc \
@@ -52,12 +52,12 @@ PSE_SOURCES = ha_perfschema.cc pfs_engin
                 table_setup_instruments.cc table_performance_timers.cc \
                 table_setup_timers.cc \
                 table_setup_consumers.cc table_events_waits.cc \
-		pfs_events_waits.cc pfs_timer.cc table_processlist.cc \
+		pfs_events_waits.cc pfs_timer.cc table_threads.cc \
 		table_sync_instances.cc \
 		table_events_waits_summary.cc \
-		table_all_instr.cc \
+		table_ews_global_by_event_name.cc table_all_instr.cc \
 		table_file_instances.cc table_file_summary.cc \
-		table_setup_objects.cc pfs_atomic.cc pfs_check.cc
+		pfs_atomic.cc pfs_check.cc
 
 EXTRA_LIBRARIES = libperfschema.a
 noinst_LIBRARIES = @plugin_perfschema_static_target@

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2010-07-15 23:44:45 +0000
+++ b/storage/perfschema/pfs.cc	2010-08-12 09:51:58 +0000
@@ -1117,7 +1117,6 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
   }
   PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
     [pfs_thread->m_wait_locker_count];
-  pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
   pfs_locker->m_target.m_mutex= pfs_mutex;
   pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1163,7 +1162,6 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
   }
   PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
     [pfs_thread->m_wait_locker_count];
-  pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
   pfs_locker->m_target.m_rwlock= pfs_rwlock;
   pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1222,7 +1220,6 @@ get_thread_cond_locker_v1(PSI_cond_locke
   }
   PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
     [pfs_thread->m_wait_locker_count];
-  pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
   pfs_locker->m_target.m_cond= pfs_cond;
   pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1267,7 +1264,6 @@ get_thread_table_locker_v1(PSI_table_loc
   }
   PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
     [pfs_thread->m_wait_locker_count];
-  pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
   pfs_locker->m_target.m_table= pfs_table;
   pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1320,7 +1316,6 @@ get_thread_file_name_locker_v1(PSI_file_
 
   PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
     [pfs_thread->m_wait_locker_count];
-  pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
   pfs_locker->m_target.m_file= pfs_file;
   pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1372,7 +1367,6 @@ get_thread_file_stream_locker_v1(PSI_fil
   }
   PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
     [pfs_thread->m_wait_locker_count];
-  pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
   pfs_locker->m_target.m_file= pfs_file;
   pfs_locker->m_waits_current.m_thread= pfs_thread;
@@ -1441,7 +1435,6 @@ get_thread_file_descriptor_locker_v1(PSI
       }
       PFS_wait_locker *pfs_locker= &pfs_thread->m_wait_locker_stack
         [pfs_thread->m_wait_locker_count];
-      pfs_locker->m_waits_current.m_wait_class= NO_WAIT_CLASS;
 
       pfs_locker->m_target.m_file= pfs_file;
       pfs_locker->m_waits_current.m_thread= pfs_thread;

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-07-16 01:18:44 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-08-12 14:08:52 +0000
@@ -23,11 +23,11 @@
 #include "table_events_waits.h"
 #include "table_setup_consumers.h"
 #include "table_setup_instruments.h"
-#include "table_setup_objects.h"
 #include "table_setup_timers.h"
 #include "table_performance_timers.h"
-#include "table_processlist.h"
+#include "table_threads.h"
 #include "table_events_waits_summary.h"
+#include "table_ews_global_by_event_name.h"
 #include "table_sync_instances.h"
 #include "table_file_instances.h"
 #include "table_file_summary.h"
@@ -52,13 +52,12 @@ static PFS_engine_table_share *all_share
   &table_events_waits_history_long::m_share,
   &table_setup_consumers::m_share,
   &table_setup_instruments::m_share,
-  &table_setup_objects::m_share,
   &table_setup_timers::m_share,
   &table_performance_timers::m_share,
-  &table_processlist::m_share,
+  &table_threads::m_share,
   &table_events_waits_summary_by_thread_by_event_name::m_share,
-  &table_events_waits_summary_by_event_name::m_share,
   &table_events_waits_summary_by_instance::m_share,
+  &table_ews_global_by_event_name::m_share,
   &table_file_summary_by_event_name::m_share,
   &table_file_summary_by_instance::m_share,
   &table_mutex_instances::m_share,

=== modified file 'storage/perfschema/pfs_events_waits.cc'
--- a/storage/perfschema/pfs_events_waits.cc	2010-07-23 20:17:55 +0000
+++ b/storage/perfschema/pfs_events_waits.cc	2010-08-12 09:51:58 +0000
@@ -80,25 +80,10 @@ void cleanup_events_waits_history_long(v
   events_waits_history_long_array= NULL;
 }
 
-static void copy_events_waits(PFS_events_waits *dest,
-                              const PFS_events_waits *source)
+static inline void copy_events_waits(PFS_events_waits *dest,
+                                     const PFS_events_waits *source)
 {
-  /* m_wait_class must be the first member of PFS_events_waits. */
-  compile_time_assert(offsetof(PFS_events_waits, m_wait_class) == 0);
-
-  char* dest_body= (reinterpret_cast<char*> (dest)) + sizeof(events_waits_class);
-  const char* source_body= (reinterpret_cast<const char*> (source))
-    + sizeof(events_waits_class);
-
-  /* See comments in table_events_waits_common::make_row(). */
-
-  /* Signal readers they are about to read garbage ... */
-  dest->m_wait_class= NO_WAIT_CLASS;
-  /* ... that this can generate. */
-  memcpy(dest_body, source_body,
-         sizeof(PFS_events_waits) - sizeof(events_waits_class));
-  /* Signal readers the record is now clean again. */
-  dest->m_wait_class= source->m_wait_class;
+  memcpy(dest, source, sizeof(PFS_events_waits));
 }
 
 /**
@@ -116,9 +101,7 @@ void insert_events_waits_history(PFS_thr
     causing a potential race condition.
     We are not testing for this and insert a possibly empty record,
     to make this thread (the writer) faster.
-    This is ok, the truncated data will have
-    wait->m_wait_class == NO_WAIT_CLASS,
-    which readers of m_waits_history will filter out.
+    This is ok, the readers of m_waits_history will filter this out.
   */
   copy_events_waits(&thread->m_waits_history[index], wait);
 

=== modified file 'storage/perfschema/pfs_events_waits.h'
--- a/storage/perfschema/pfs_events_waits.h	2010-07-15 23:44:45 +0000
+++ b/storage/perfschema/pfs_events_waits.h	2010-08-12 09:51:58 +0000
@@ -97,7 +97,7 @@ struct PFS_events_waits
     - TRUNCATE EVENTS_WAITS_HISTORY
     - TRUNCATE EVENTS_WAITS_HISTORY_LONG
   */
-  volatile events_waits_class m_wait_class;
+  events_waits_class m_wait_class;
   /** Executing thread. */
   PFS_thread *m_thread;
   /** Instrument metadata. */

=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc	2010-07-16 00:06:33 +0000
+++ b/storage/perfschema/table_events_waits.cc	2010-08-12 09:51:58 +0000
@@ -217,16 +217,8 @@ void table_events_waits_common::make_row
     or 8 atomics per recorded event.
     The problem is that we record a *lot* of events ...
 
-    Instead, a *dirty* marking is done using m_wait_class.
-    Using m_wait_class alone does not guarantee anything, it just filters
-    out most of the bad data.
-    This is acceptable because this code is garbage-proof,
-    and won't crash on bad data, only display it,
-    very rarely (which is accepted).
-
-    If a bad record is displayed, it's a very transient failure:
-    the next select * from EVENTS_WAITS_CURRENT/_HISTORY/_HISTORY_LONG will
-    show clean data again.
+    This code is prepared to accept *dirty* records,
+    and sanitizes all the data before returning a row.
   */
 
   m_row.m_thread_internal_id= safe_thread->m_thread_internal_id;

=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc	2010-07-16 00:06:33 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc	2010-08-12 14:08:52 +0000
@@ -338,144 +338,6 @@ int table_events_waits_summary_by_thread
   return 0;
 }
 
-THR_LOCK table_events_waits_summary_by_event_name::m_table_lock;
-
-static const TABLE_FIELD_TYPE ews_by_event_name_field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("EVENT_NAME") },
-    { C_STRING_WITH_LEN("varchar(128)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_STAR") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_events_waits_summary_by_event_name::m_field_def=
-{ 6, ews_by_event_name_field_types };
-
-PFS_engine_table_share
-table_events_waits_summary_by_event_name::m_share=
-{
-  { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_BY_EVENT_NAME") },
-  &pfs_truncatable_acl,
-  &table_events_waits_summary_by_event_name::create,
-  NULL, /* write_row */
-  &table_events_waits_summary_by_event_name::delete_all_rows,
-  1000, /* records */
-  sizeof(pos_all_instr_class),
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_events_waits_summary_by_event_name::create(void)
-{
-  return new table_events_waits_summary_by_event_name();
-}
-
-int table_events_waits_summary_by_event_name::delete_all_rows(void)
-{
-  reset_instrument_class_waits();
-  return 0;
-}
-
-table_events_waits_summary_by_event_name
-::table_events_waits_summary_by_event_name()
-  : table_all_instr_class(&m_share)
-{}
-
-void table_events_waits_summary_by_event_name
-::make_instr_row(PFS_instr_class *klass)
-{
-  m_row.m_name= klass->m_name;
-  m_row.m_name_length= klass->m_name_length;
-
-  m_row.m_count= klass->m_wait_stat.m_count;
-  m_row.m_sum= klass->m_wait_stat.m_sum;
-  m_row.m_min= klass->m_wait_stat.m_min;
-  m_row.m_max= klass->m_wait_stat.m_max;
-
-  if (m_row.m_count)
-    m_row.m_avg= m_row.m_sum / m_row.m_count;
-  else
-  {
-    m_row.m_min= 0;
-    m_row.m_avg= 0;
-  }
-}
-
-int table_events_waits_summary_by_event_name
-::read_row_values(TABLE *table, unsigned char *, Field **fields,
-                  bool read_all)
-{
-  Field *f;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  /*
-    The row always exist,
-    the instrument classes are static and never disappear.
-  */
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
-        break;
-      case 1: /* COUNT */
-        set_field_ulonglong(f, m_row.m_count);
-        break;
-      case 2: /* SUM */
-        set_field_ulonglong(f, m_row.m_sum);
-        break;
-      case 3: /* MIN */
-        set_field_ulonglong(f, m_row.m_min);
-        break;
-      case 4: /* AVG */
-        set_field_ulonglong(f, m_row.m_avg);
-        break;
-      case 5: /* MAX */
-        set_field_ulonglong(f, m_row.m_max);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-
-  return 0;
-}
-
 THR_LOCK table_events_waits_summary_by_instance::m_table_lock;
 
 static const TABLE_FIELD_TYPE ews_by_instance_field_types[]=

=== modified file 'storage/perfschema/table_events_waits_summary.h'
--- a/storage/perfschema/table_events_waits_summary.h	2010-07-16 00:06:33 +0000
+++ b/storage/perfschema/table_events_waits_summary.h	2010-08-12 14:08:52 +0000
@@ -144,58 +144,6 @@ private:
   pos_events_waits_summary_by_thread_by_event_name m_next_pos;
 };
 
-/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */
-struct row_events_waits_summary_by_event_name
-{
-  /** Column EVENT_NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-  /** Column COUNT_STAR. */
-  ulonglong m_count;
-  /** Column SUM_TIMER_WAIT. */
-  ulonglong m_sum;
-  /** Column MIN_TIMER_WAIT. */
-  ulonglong m_min;
-  /** Column AVG_TIMER_WAIT. */
-  ulonglong m_avg;
-  /** Column MAX_TIMER_WAIT. */
-  ulonglong m_max;
-};
-
-/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME. */
-class table_events_waits_summary_by_event_name : public table_all_instr_class
-{
-public:
-  /** Table share */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-  static int delete_all_rows();
-
-protected:
-  virtual void make_instr_row(PFS_instr_class *klass);
-
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-  table_events_waits_summary_by_event_name();
-
-public:
-  ~table_events_waits_summary_by_event_name()
-  {}
-
-private:
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_events_waits_summary_by_event_name m_row;
-};
-
 /** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_INSTANCE. */
 struct row_events_waits_summary_by_instance
 {

=== added file 'storage/perfschema/table_ews_global_by_event_name.cc'
--- a/storage/perfschema/table_ews_global_by_event_name.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_ews_global_by_event_name.cc	2010-08-12 14:08:52 +0000
@@ -0,0 +1,166 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+  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,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file storage/perfschema/table_ews_global_by_event_name.cc
+  Table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr_class.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_ews_global_by_event_name.h"
+#include "pfs_global.h"
+
+THR_LOCK table_ews_global_by_event_name::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("EVENT_NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_ews_global_by_event_name::m_field_def=
+{ 6, field_types };
+
+PFS_engine_table_share
+table_ews_global_by_event_name::m_share=
+{
+  { C_STRING_WITH_LEN("EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME") },
+  &pfs_truncatable_acl,
+  &table_ews_global_by_event_name::create,
+  NULL, /* write_row */
+  &table_ews_global_by_event_name::delete_all_rows,
+  1000, /* records */
+  sizeof(pos_all_instr_class),
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_ews_global_by_event_name::create(void)
+{
+  return new table_ews_global_by_event_name();
+}
+
+int table_ews_global_by_event_name::delete_all_rows(void)
+{
+  reset_instrument_class_waits();
+  return 0;
+}
+
+table_ews_global_by_event_name
+::table_ews_global_by_event_name()
+  : table_all_instr_class(&m_share)
+{}
+
+void table_ews_global_by_event_name
+::make_instr_row(PFS_instr_class *klass)
+{
+  m_row.m_name= klass->m_name;
+  m_row.m_name_length= klass->m_name_length;
+
+  m_row.m_count= klass->m_wait_stat.m_count;
+  m_row.m_sum= klass->m_wait_stat.m_sum;
+  m_row.m_min= klass->m_wait_stat.m_min;
+  m_row.m_max= klass->m_wait_stat.m_max;
+
+  if (m_row.m_count)
+    m_row.m_avg= m_row.m_sum / m_row.m_count;
+  else
+  {
+    m_row.m_min= 0;
+    m_row.m_avg= 0;
+  }
+}
+
+int table_ews_global_by_event_name
+::read_row_values(TABLE *table, unsigned char *, Field **fields,
+                  bool read_all)
+{
+  Field *f;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  /*
+    The row always exist,
+    the instrument classes are static and never disappear.
+  */
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* NAME */
+        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+        break;
+      case 1: /* COUNT */
+        set_field_ulonglong(f, m_row.m_count);
+        break;
+      case 2: /* SUM */
+        set_field_ulonglong(f, m_row.m_sum);
+        break;
+      case 3: /* MIN */
+        set_field_ulonglong(f, m_row.m_min);
+        break;
+      case 4: /* AVG */
+        set_field_ulonglong(f, m_row.m_avg);
+        break;
+      case 5: /* MAX */
+        set_field_ulonglong(f, m_row.m_max);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  return 0;
+}
+

=== added file 'storage/perfschema/table_ews_global_by_event_name.h'
--- a/storage/perfschema/table_ews_global_by_event_name.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_ews_global_by_event_name.h	2010-08-12 14:08:52 +0000
@@ -0,0 +1,88 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+  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,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME_H
+#define TABLE_EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME_H
+
+/**
+  @file storage/perfschema/table_ews_global_by_event_name.h
+  Table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+#include "table_all_instr.h"
+
+/**
+  @addtogroup Performance_schema_tables
+  @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */
+struct row_ews_global_by_event_name
+{
+  /** Column EVENT_NAME. */
+  const char *m_name;
+  /** Length in bytes of @c m_name. */
+  uint m_name_length;
+  /** Column COUNT_STAR. */
+  ulonglong m_count;
+  /** Column SUM_TIMER_WAIT. */
+  ulonglong m_sum;
+  /** Column MIN_TIMER_WAIT. */
+  ulonglong m_min;
+  /** Column AVG_TIMER_WAIT. */
+  ulonglong m_avg;
+  /** Column MAX_TIMER_WAIT. */
+  ulonglong m_max;
+};
+
+/** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */
+class table_ews_global_by_event_name : public table_all_instr_class
+{
+public:
+  /** Table share */
+  static PFS_engine_table_share m_share;
+  static PFS_engine_table* create();
+  static int delete_all_rows();
+
+protected:
+  virtual void make_instr_row(PFS_instr_class *klass);
+
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+  table_ews_global_by_event_name();
+
+public:
+  ~table_ews_global_by_event_name()
+  {}
+
+private:
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_ews_global_by_event_name m_row;
+};
+
+/** @} */
+#endif

=== removed file 'storage/perfschema/table_processlist.cc'
--- a/storage/perfschema/table_processlist.cc	2010-07-16 00:06:33 +0000
+++ b/storage/perfschema/table_processlist.cc	1970-01-01 00:00:00 +0000
@@ -1,177 +0,0 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-
-  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,
-  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-
-/**
-  @file storage/perfschema/table_processlist.cc
-  Table PROCESSLIST (implementation).
-*/
-
-#include "my_global.h"
-#include "my_pthread.h"
-#include "table_processlist.h"
-#include "pfs_instr_class.h"
-#include "pfs_instr.h"
-
-THR_LOCK table_processlist::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("THREAD_ID") },
-    { C_STRING_WITH_LEN("int(11)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("ID") },
-    { C_STRING_WITH_LEN("int(11)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("NAME") },
-    { C_STRING_WITH_LEN("varchar(64)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_processlist::m_field_def=
-{ 3, field_types };
-
-PFS_engine_table_share
-table_processlist::m_share=
-{
-  { C_STRING_WITH_LEN("PROCESSLIST") },
-  &pfs_readonly_acl,
-  &table_processlist::create,
-  NULL, /* write_row */
-  NULL, /* delete_all_rows */
-  1000, /* records */
-  sizeof(PFS_simple_index), /* ref length */
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_processlist::create(void)
-{
-  return new table_processlist();
-}
-
-table_processlist::table_processlist()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(0), m_next_pos(0)
-{}
-
-void table_processlist::reset_position(void)
-{
-  m_pos.m_index= 0;
-  m_next_pos.m_index= 0;
-}
-
-int table_processlist::rnd_next(void)
-{
-  PFS_thread *pfs;
-
-  for (m_pos.set_at(&m_next_pos);
-       m_pos.m_index < thread_max;
-       m_pos.next())
-  {
-    pfs= &thread_array[m_pos.m_index];
-    if (pfs->m_lock.is_populated())
-    {
-      make_row(pfs);
-      m_next_pos.set_after(&m_pos);
-      return 0;
-    }
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_processlist::rnd_pos(const void *pos)
-{
-  PFS_thread *pfs;
-
-  set_position(pos);
-  DBUG_ASSERT(m_pos.m_index < thread_max);
-  pfs= &thread_array[m_pos.m_index];
-  if (pfs->m_lock.is_populated())
-  {
-    make_row(pfs);
-    return 0;
-  }
-
-  return HA_ERR_RECORD_DELETED;
-}
-
-void table_processlist::make_row(PFS_thread *pfs)
-{
-  pfs_lock lock;
-  PFS_thread_class *safe_class;
-
-  m_row_exists= false;
-
-  /* Protect this reader against thread termination */
-  pfs->m_lock.begin_optimistic_lock(&lock);
-
-  safe_class= sanitize_thread_class(pfs->m_class);
-  if (unlikely(safe_class == NULL))
-    return;
-
-  m_row.m_thread_internal_id= pfs->m_thread_internal_id;
-  m_row.m_thread_id= pfs->m_thread_id;
-  m_row.m_name= safe_class->m_name;
-  m_row.m_name_length= safe_class->m_name_length;
-
-  if (pfs->m_lock.end_optimistic_lock(&lock))
-    m_row_exists= true;
-}
-
-int table_processlist::read_row_values(TABLE *table,
-                                       unsigned char *,
-                                       Field **fields,
-                                       bool read_all)
-{
-  Field *f;
-
-  if (unlikely(! m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* THREAD_ID */
-        set_field_ulong(f, m_row.m_thread_internal_id);
-        break;
-      case 1: /* ID */
-        set_field_ulong(f, m_row.m_thread_id);
-        break;
-      case 2: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-  return 0;
-}
-

=== removed file 'storage/perfschema/table_processlist.h'
--- a/storage/perfschema/table_processlist.h	2010-07-16 00:06:33 +0000
+++ b/storage/perfschema/table_processlist.h	1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-
-  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,
-  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-
-#ifndef TABLE_PROCESSIST_H
-#define TABLE_PROCESSIST_H
-
-/**
-  @file storage/perfschema/table_processlist.h
-  Table PROCESSLIST (declarations).
-*/
-
-#include "pfs_column_types.h"
-#include "pfs_engine_table.h"
-
-struct PFS_thread;
-
-/**
-  @addtogroup Performance_schema_tables
-  @{
-*/
-
-/** A row of PERFORMANCE_SCHEMA.PROCESSLIST. */
-struct row_processlist
-{
-  /** Column THREAD_ID. */
-  ulong m_thread_internal_id;
-  /** Column ID. */
-  ulong m_thread_id;
-  /** Column NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-};
-
-/** Table PERFORMANCE_SCHEMA.PROCESSLIST. */
-class table_processlist : public PFS_engine_table
-{
-public:
-  /** Table share. */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-
-  virtual int rnd_next();
-  virtual int rnd_pos(const void *pos);
-  virtual void reset_position(void);
-
-protected:
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-protected:
-  table_processlist();
-
-public:
-  ~table_processlist()
-  {}
-
-private:
-  void make_row(PFS_thread *pfs);
-
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_processlist m_row;
-  /** True is the current row exists. */
-  bool m_row_exists;
-  /** Current position. */
-  PFS_simple_index m_pos;
-  /** Next position. */
-  PFS_simple_index m_next_pos;
-};
-
-/** @} */
-#endif

=== removed file 'storage/perfschema/table_setup_objects.cc'
--- a/storage/perfschema/table_setup_objects.cc	2010-03-31 14:05:33 +0000
+++ b/storage/perfschema/table_setup_objects.cc	1970-01-01 00:00:00 +0000
@@ -1,281 +0,0 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
-
-  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-/**
-  @file storage/perfschema/table_setup_objects.cc
-  Table SETUP_OBJECTS (implementation).
-*/
-
-#include "sql_priv.h"
-#include "unireg.h"
-#include "pfs_instr_class.h"
-#include "pfs_column_types.h"
-#include "pfs_column_values.h"
-#include "table_setup_objects.h"
-#include "pfs_global.h"
-
-THR_LOCK table_setup_objects::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("OBJECT_TYPE") },
-    { C_STRING_WITH_LEN("varchar(64)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("OBJECT_SCHEMA") },
-    { C_STRING_WITH_LEN("varchar(64)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("OBJECT_NAME") },
-    { C_STRING_WITH_LEN("varchar(64)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("ENABLED") },
-    { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("TIMED") },
-    { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AGGREGATED") },
-    { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_setup_objects::m_field_def=
-{ 6, field_types };
-
-PFS_engine_table_share
-table_setup_objects::m_share=
-{
-  { C_STRING_WITH_LEN("SETUP_OBJECTS") },
-  &pfs_editable_acl,
-  &table_setup_objects::create,
-  table_setup_objects::write_row,
-  table_setup_objects::delete_all_rows,
-  1000, /* records */
-  sizeof(pos_setup_objects),
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_setup_objects::create(void)
-{
-  return new table_setup_objects();
-}
-
-int table_setup_objects::write_row(TABLE *table, unsigned char *buf,
-                                   Field **fields)
-{
-  /* Not implemented */
-  return HA_ERR_WRONG_COMMAND;
-}
-
-int table_setup_objects::delete_all_rows(void)
-{
-  /* Not implemented */
-  return HA_ERR_WRONG_COMMAND;
-}
-
-table_setup_objects::table_setup_objects()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(), m_next_pos()
-{}
-
-void table_setup_objects::reset_position(void)
-{
-  m_pos.reset();
-  m_next_pos.reset();
-}
-
-int table_setup_objects::rnd_next(void)
-{
-  PFS_table_share *table_share;
-
-  for (m_pos.set_at(&m_next_pos);
-       m_pos.has_more_view();
-       m_pos.next_view())
-  {
-    switch (m_pos.m_index_1) {
-    case pos_setup_objects::VIEW_TABLE:
-      for ( ; m_pos.m_index_2 < table_share_max; m_pos.m_index_2++)
-      {
-        table_share= &table_share_array[m_pos.m_index_2];
-        if (table_share->m_lock.is_populated())
-        {
-          make_row(table_share);
-          m_next_pos.set_after(&m_pos);
-          return 0;
-        }
-      }
-      break;
-    case pos_setup_objects::VIEW_EVENT:
-    case pos_setup_objects::VIEW_PROCEDURE:
-    case pos_setup_objects::VIEW_FUNCTION:
-    default:
-      break;
-    }
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_setup_objects::rnd_pos(const void *pos)
-{
-  PFS_table_share *share;
-
-  set_position(pos);
-
-  switch (m_pos.m_index_1) {
-  case pos_setup_objects::VIEW_TABLE:
-    DBUG_ASSERT(m_pos.m_index_2 < table_share_max);
-    share= &table_share_array[m_pos.m_index_2];
-    if (share->m_lock.is_populated())
-    {
-      make_row(share);
-      return 0;
-    }
-    break;
-  case pos_setup_objects::VIEW_EVENT:
-  case pos_setup_objects::VIEW_PROCEDURE:
-  case pos_setup_objects::VIEW_FUNCTION:
-  default:
-    break;
-  }
-
-  return HA_ERR_RECORD_DELETED;
-}
-
-void table_setup_objects::make_row(PFS_table_share *share)
-{
-  pfs_lock lock;
-
-  m_row_exists= false;
-  if (share == NULL)
-    return;
-
-  share->m_lock.begin_optimistic_lock(&lock);
-
-  m_row.m_schema_name= &share->m_schema_name[0];
-  m_row.m_schema_name_length= share->m_schema_name_length;
-  m_row.m_object_name= &share->m_table_name[0];
-  m_row.m_object_name_length= share->m_table_name_length;
-  m_row.m_enabled_ptr= &share->m_enabled;
-  m_row.m_timed_ptr= &share->m_timed;
-  m_row.m_aggregated_ptr= &share->m_aggregated;
-
-  if (share->m_lock.end_optimistic_lock(&lock))
-    m_row_exists= true;
-}
-
-int table_setup_objects::read_row_values(TABLE *table,
-                                         unsigned char *buf,
-                                         Field **fields,
-                                         bool read_all)
-{
-  Field *f;
-
-  if (unlikely(! m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 1);
-  buf[0]= 0;
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* OBJECT_TYPE */
-        set_field_varchar_utf8(f, "TABLE", 5);
-        break;
-      case 1: /* OBJECT_SCHEMA */
-        set_field_varchar_utf8(f, m_row.m_schema_name,
-                               m_row.m_schema_name_length);
-        break;
-      case 2: /* OBJECT_NAME */
-        set_field_varchar_utf8(f, m_row.m_object_name,
-                               m_row.m_object_name_length);
-        break;
-      case 3: /* ENABLED */
-        set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO);
-        break;
-      case 4: /* TIMED */
-        set_field_enum(f, (*m_row.m_timed_ptr) ? ENUM_YES : ENUM_NO);
-        break;
-      case 5: /* AGGREGATED */
-        set_field_enum(f, (*m_row.m_aggregated_ptr) ? ENUM_YES : ENUM_NO);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-
-  return 0;
-}
-
-int table_setup_objects::update_row_values(TABLE *table,
-                                           const unsigned char *,
-                                           unsigned char *,
-                                           Field **fields)
-{
-  Field *f;
-  enum_yes_no value;
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (bitmap_is_set(table->write_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* OBJECT_TYPE */
-      case 1: /* OBJECT_SCHEMA */
-      case 2: /* OBJECT_NAME */
-        my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
-        return HA_ERR_WRONG_COMMAND;
-      case 3: /* ENABLED */
-        value= (enum_yes_no) get_field_enum(f);
-        *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false;
-        break;
-      case 4: /* TIMED */
-        value= (enum_yes_no) get_field_enum(f);
-        *m_row.m_timed_ptr= (value == ENUM_YES) ? true : false;
-        break;
-      case 5: /* AGGREGATED */
-        value= (enum_yes_no) get_field_enum(f);
-        *m_row.m_aggregated_ptr= (value == ENUM_YES) ? true : false;
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-
-  return 0;
-}
-

=== removed file 'storage/perfschema/table_setup_objects.h'
--- a/storage/perfschema/table_setup_objects.h	2010-01-12 01:47:27 +0000
+++ b/storage/perfschema/table_setup_objects.h	1970-01-01 00:00:00 +0000
@@ -1,125 +0,0 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
-
-  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#ifndef TABLE_SETUP_OBJECTS_H
-#define TABLE_SETUP_OBJECTS_H
-
-/**
-  @file storage/perfschema/table_setup_objects.h
-  Table SETUP_OBJECTS (declarations).
-*/
-
-#include "pfs_instr_class.h"
-#include "pfs_engine_table.h"
-
-/**
-  @addtogroup Performance_schema_tables
-  @{
-*/
-
-/** A row of PERFORMANCE_SCHEMA.SETUP_OBJECTS. */
-struct row_setup_objects
-{
-  /** Column SCHEMA_NAME. */
-  const char *m_schema_name;
-  /** Length in bytes of @c m_schema_name. */
-  uint m_schema_name_length;
-  /** Column OBJECT_NAME. */
-  const char *m_object_name;
-  /** Length in bytes of @c m_object_name. */
-  uint m_object_name_length;
-  /** Column ENABLED. */
-  bool *m_enabled_ptr;
-  /** Column TIMED. */
-  bool *m_timed_ptr;
-  /** Column AGGREGATED. */
-  bool *m_aggregated_ptr;
-};
-
-/** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_OBJECTS. */
-struct pos_setup_objects : public PFS_double_index,
-                           public PFS_object_view_constants
-{
-  pos_setup_objects()
-    : PFS_double_index(VIEW_TABLE, 0)
-  {}
-
-  inline void reset(void)
-  {
-    m_index_1= VIEW_TABLE;
-    m_index_2= 0;
-  }
-
-  inline bool has_more_view(void)
-  { return (m_index_1 <= VIEW_FUNCTION); }
-
-  inline void next_view(void)
-  {
-    m_index_1++;
-    m_index_2= 0;
-  }
-};
-
-/** Table PERFORMANCE_SCHEMA.SETUP_OBJECTS. */
-class table_setup_objects : public PFS_engine_table
-{
-public:
-  /** Table share. */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-  static int write_row(TABLE *table, unsigned char *buf, Field **fields);
-  static int delete_all_rows();
-
-  virtual int rnd_next();
-  virtual int rnd_pos(const void *pos);
-  virtual void reset_position(void);
-
-protected:
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-  virtual int update_row_values(TABLE *table,
-                                const unsigned char *old_buf,
-                                unsigned char *new_buf,
-                                Field **fields);
-
-  table_setup_objects();
-
-public:
-  ~table_setup_objects()
-  {}
-
-private:
-  void make_row(PFS_table_share *share);
-
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_setup_objects m_row;
-  /** True is the current row exists. */
-  bool m_row_exists;
-  /** Current position. */
-  pos_setup_objects m_pos;
-  /** Next position. */
-  pos_setup_objects m_next_pos;
-};
-
-/** @} */
-#endif

=== added file 'storage/perfschema/table_threads.cc'
--- a/storage/perfschema/table_threads.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_threads.cc	2010-08-12 14:08:52 +0000
@@ -0,0 +1,177 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+  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,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file storage/perfschema/table_threads.cc
+  Table THREADS (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "table_threads.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+
+THR_LOCK table_threads::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("THREAD_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("NAME") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_threads::m_field_def=
+{ 3, field_types };
+
+PFS_engine_table_share
+table_threads::m_share=
+{
+  { C_STRING_WITH_LEN("THREADS") },
+  &pfs_readonly_acl,
+  &table_threads::create,
+  NULL, /* write_row */
+  NULL, /* delete_all_rows */
+  1000, /* records */
+  sizeof(PFS_simple_index), /* ref length */
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_threads::create(void)
+{
+  return new table_threads();
+}
+
+table_threads::table_threads()
+  : PFS_engine_table(&m_share, &m_pos),
+  m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+void table_threads::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_threads::rnd_next(void)
+{
+  PFS_thread *pfs;
+
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.m_index < thread_max;
+       m_pos.next())
+  {
+    pfs= &thread_array[m_pos.m_index];
+    if (pfs->m_lock.is_populated())
+    {
+      make_row(pfs);
+      m_next_pos.set_after(&m_pos);
+      return 0;
+    }
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_threads::rnd_pos(const void *pos)
+{
+  PFS_thread *pfs;
+
+  set_position(pos);
+  DBUG_ASSERT(m_pos.m_index < thread_max);
+  pfs= &thread_array[m_pos.m_index];
+  if (pfs->m_lock.is_populated())
+  {
+    make_row(pfs);
+    return 0;
+  }
+
+  return HA_ERR_RECORD_DELETED;
+}
+
+void table_threads::make_row(PFS_thread *pfs)
+{
+  pfs_lock lock;
+  PFS_thread_class *safe_class;
+
+  m_row_exists= false;
+
+  /* Protect this reader against thread termination */
+  pfs->m_lock.begin_optimistic_lock(&lock);
+
+  safe_class= sanitize_thread_class(pfs->m_class);
+  if (unlikely(safe_class == NULL))
+    return;
+
+  m_row.m_thread_internal_id= pfs->m_thread_internal_id;
+  m_row.m_thread_id= pfs->m_thread_id;
+  m_row.m_name= safe_class->m_name;
+  m_row.m_name_length= safe_class->m_name_length;
+
+  if (pfs->m_lock.end_optimistic_lock(&lock))
+    m_row_exists= true;
+}
+
+int table_threads::read_row_values(TABLE *table,
+                                   unsigned char *,
+                                   Field **fields,
+                                   bool read_all)
+{
+  Field *f;
+
+  if (unlikely(! m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* THREAD_ID */
+        set_field_ulong(f, m_row.m_thread_internal_id);
+        break;
+      case 1: /* ID */
+        set_field_ulong(f, m_row.m_thread_id);
+        break;
+      case 2: /* NAME */
+        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+  return 0;
+}
+

=== added file 'storage/perfschema/table_threads.h'
--- a/storage/perfschema/table_threads.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_threads.h	2010-08-12 14:08:52 +0000
@@ -0,0 +1,91 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+  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,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_THREADS_H
+#define TABLE_THREADS_H
+
+/**
+  @file storage/perfschema/table_threads.h
+  Table THREADS (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+
+struct PFS_thread;
+
+/**
+  @addtogroup Performance_schema_tables
+  @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.THREADS. */
+struct row_threads
+{
+  /** Column THREAD_ID. */
+  ulong m_thread_internal_id;
+  /** Column ID. */
+  ulong m_thread_id;
+  /** Column NAME. */
+  const char *m_name;
+  /** Length in bytes of @c m_name. */
+  uint m_name_length;
+};
+
+/** Table PERFORMANCE_SCHEMA.THREADS. */
+class table_threads : public PFS_engine_table
+{
+public:
+  /** Table share. */
+  static PFS_engine_table_share m_share;
+  static PFS_engine_table* create();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+protected:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+protected:
+  table_threads();
+
+public:
+  ~table_threads()
+  {}
+
+private:
+  void make_row(PFS_thread *pfs);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_threads m_row;
+  /** True is the current row exists. */
+  bool m_row_exists;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif


Attachment: [text/bzr-bundle] bzr/jon.hauglid@oracle.com-20100813084326-z92pvqc3bfmcyx73.bundle
Thread
bzr commit into mysql-5.5-bugfixing branch (jon.hauglid:3105) Jon Olav Hauglid13 Aug