Merge lp:~tsarev/percona-server/18205_03_wl47.patch into lp:percona-server/5.5

Proposed by Oleg Tsarev
Status: Superseded
Proposed branch: lp:~tsarev/percona-server/18205_03_wl47.patch
Merge into: lp:percona-server/5.5
Prerequisite: lp:~tsarev/percona-server/18205_02_wl36.patch
Diff against target: 5235 lines (+3129/-1489) (has conflicts)
5 files modified
patches/mysql-test-rnt.diff (+12/-1300)
patches/mysqlbinlog_fix.patch (+62/-0)
patches/series.OTHER (+1/-1)
patches/wl36.patch (+170/-43)
patches/wl47.patch (+2884/-145)
Conflict adding file .bzrignore.  Moved existing file to .bzrignore.moved.
Path conflict: <deleted> / patches/COPYING.innodb-deadlock-count-patch
Conflict adding file HandlerSocket-Plugin-for-MySQL.  Moved existing file to HandlerSocket-Plugin-for-MySQL.moved.
Contents conflict in Makefile
Conflict adding file README.HandlerSocket.  Moved existing file to README.HandlerSocket.moved.
Conflict adding file UDF.  Moved existing file to UDF.moved.
Conflict adding file apply_patches.  Moved existing file to apply_patches.moved.
Conflict adding files to build.  Created directory.
Conflict because build is not versioned, but has versioned children.  Versioned directory.
Conflict adding file build.  Moved existing file to build.moved.
Conflict adding files to build/debian.  Created directory.
Conflict because build/debian is not versioned, but has versioned children.  Versioned directory.
Contents conflict in build/debian/changelog
Contents conflict in build/debian/control
Contents conflict in build/debian/libmysqlclient-dev.docs
Contents conflict in build/debian/libmysqlclient-dev.files
Contents conflict in build/debian/libmysqlclient16.docs
Conflict adding files to build/debian/patches.  Created directory.
Conflict because build/debian/patches is not versioned, but has versioned children.  Versioned directory.
Contents conflict in build/debian/patches/00list
Contents conflict in build/debian/percona-server-client-5.1.docs
Contents conflict in build/debian/percona-server-client-5.1.files
Contents conflict in build/debian/percona-server-server-5.1.docs
Contents conflict in build/debian/percona-server-server-5.1.files
Contents conflict in build/debian/percona-server-server-5.1.links
Contents conflict in build/debian/percona-server-server-5.1.mysql.init
Contents conflict in build/debian/percona-server-server-5.1.postinst
Contents conflict in build/debian/percona-server-server-5.1.templates
Contents conflict in build/debian/rules
Contents conflict in build/percona-server.spec
Conflict adding file doc.  Moved existing file to doc.moved.
Conflict adding file handlersocket.patch.  Moved existing file to handlersocket.patch.moved.
Contents conflict in normalize_patches
Conflict adding file patches.  Moved existing file to patches.moved.
Contents conflict in patches/bug580324.patch
Contents conflict in patches/bugfix48929.patch
Contents conflict in patches/control_online_alter_index.patch
Contents conflict in patches/error_pad.patch
Contents conflict in patches/i_s_innodb_buffer_pool_pages.patch
Contents conflict in patches/innodb_adjust_defaults.patch
Contents conflict in patches/innodb_admin_command_base.patch
Contents conflict in patches/innodb_buffer_pool_shm.patch
Contents conflict in patches/innodb_deadlock_count.patch
Contents conflict in patches/innodb_dict_size_limit.patch
Contents conflict in patches/innodb_expand_import.patch
Contents conflict in patches/innodb_expand_undo_slots.patch
Contents conflict in patches/innodb_extend_slow.patch
Contents conflict in patches/innodb_extra_rseg.patch
Contents conflict in patches/innodb_fast_checksum.patch
Contents conflict in patches/innodb_files_extend.patch
Contents conflict in patches/innodb_fix_misc.patch
Contents conflict in patches/innodb_io_patches.patch
Contents conflict in patches/innodb_lru_dump_restore.patch
Contents conflict in patches/innodb_opt_lru_count.patch
Contents conflict in patches/innodb_overwrite_relay_log_info.patch
Contents conflict in patches/innodb_pass_corrupt_table.patch
Contents conflict in patches/innodb_purge_thread.patch
Contents conflict in patches/innodb_recovery_patches.patch
Contents conflict in patches/innodb_separate_doublewrite.patch
Contents conflict in patches/innodb_show_enhancements.patch
Contents conflict in patches/innodb_show_lock_name.patch
Contents conflict in patches/innodb_show_status.patch
Contents conflict in patches/innodb_show_sys_tables.patch
Contents conflict in patches/innodb_split_buf_pool_mutex.patch
Contents conflict in patches/innodb_stats.patch
Contents conflict in patches/innodb_swap_builtin_plugin.patch
Contents conflict in patches/innodb_thread_concurrency_timer_based.patch
Contents conflict in patches/log_connection_error.patch
Contents conflict in patches/microsec_process.patch
Contents conflict in patches/mysql-syslog.patch
Contents conflict in patches/mysql-test.diff
Contents conflict in patches/mysql_dump_ignore_ct.patch
Contents conflict in patches/optimizer_fix.patch
Contents conflict in patches/percona-support.patch
Contents conflict in patches/profiling_slow.patch
Contents conflict in patches/query_cache_enhance.patch
Contents conflict in patches/remove_fcntl_excessive_calls.patch
Contents conflict in patches/response_time_distribution.patch
Contents conflict in patches/series
Contents conflict in patches/show_patches.patch
Contents conflict in patches/show_slave_status_nolock.patch
Contents conflict in patches/show_temp_51.patch
Contents conflict in patches/slow_extended.patch
Contents conflict in patches/sql_no_fcache.patch
Contents conflict in patches/suppress_log_warning_1592.patch
Contents conflict in patches/userstat.patch
Conflict adding file python-for-subunit2junitxml.  Moved existing file to python-for-subunit2junitxml.moved.
Conflict adding file quiltrc.  Moved existing file to quiltrc.moved.
Conflict adding file subunit2junitxml.  Moved existing file to subunit2junitxml.moved.
To merge this branch: bzr merge lp:~tsarev/percona-server/18205_03_wl47.patch
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
Review via email: mp+90657@code.launchpad.net

This proposal has been superseded by a proposal from 2012-02-06.

Description of the change

move tests related to wl47.patch from mysql-test-rnt.diff to wl47.patch
fixed code policy

(issue 18205 - prepare lp:percona-server/rnt-5.1 patches to merge to lp:percona-server/5.1)

after merge this fix to lp:percona-server/rnt-5.1 I will propose for merge it to lp:percona-server/5.1

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

You propose to merge this to PS 5.1, while the prerequisite branch is proposed to be merged to rnt-5.1.

review: Needs Fixing
209. By Oleg Tsarev

merge lp:~tsarev/percona-server/18205_01_mysqlbinlog_fix.patch

210. By Oleg Tsarev

lp:~tsarev/percona-server/18205_02_wl36.patch

211. By Oleg Tsarev

merge lp:~tsarev/percona-server/18205_01_mysqlbinlog_fix.patch

212. By Oleg Tsarev

Fixed code policy in wl47.patch.
Moved related tests and tests fixes from mysql-test-run.diff to wl47.patch.
Added (missed before) results for tests rpl.rpl_row_annotate_do, rpl.rpl_row_annotate_dont, binlog.binlog_row_annotate.

Unmerged revisions

212. By Oleg Tsarev

Fixed code policy in wl47.patch.
Moved related tests and tests fixes from mysql-test-run.diff to wl47.patch.
Added (missed before) results for tests rpl.rpl_row_annotate_do, rpl.rpl_row_annotate_dont, binlog.binlog_row_annotate.

211. By Oleg Tsarev

merge lp:~tsarev/percona-server/18205_01_mysqlbinlog_fix.patch

210. By Oleg Tsarev

lp:~tsarev/percona-server/18205_02_wl36.patch

209. By Oleg Tsarev

merge lp:~tsarev/percona-server/18205_01_mysqlbinlog_fix.patch

208. By Oleg Tsarev

Return back Percona's "innodb_stats_method=nulls_ignored" algorithm.

Related Launchpad bug #892405
Related MySQL bug http://bugs.mysql.com/bug.php?id=63320

I added new value "nulls_ignored_exact" for variable innodb_stats_method.

Current upsteam "nulls_ignored" algorithm calculate not_null values on every estimated (random) page, and after that try to approximates total value count.
Unfortunately, this algorithm works incorrectly on mostly null indexes (see MySQL Bug #63320).

Percona'a algorithm excludes from estimation pages with nulls, calculates the count of different values and approximates total value count.
This algorithm works correctly on mostly null indexes, but has limitation - it works correctly just on one-column-key indexes. On compound-keys algorithm can works incorrectly (I didn't test this).
Unfortunately, I can't imagine now how to discard this limitation.

207. By Oleg Tsarev

Fix incorrect month output from Subunit.pm
Perl localtime return month in range 0..11, subunit2junitxml expect range 1..12

206. By Oleg Tsarev

merge porting to 5.1.59

205. By Oleg Tsarev

Merge Alexey's commit:
    Bug #872754: Annotate rows events on slave doesnt' work without slave's binlog

    The problem was that Read_Master_Log_Pos was not calculated correctly
    when events were being skipped on the master (i.e. Annotate_Rows_Events
    when either replicate-annotate-rows-events or log-slave-updates were OFF).

    Fixed by changing the calculation so that master_log_pos is read from
    the event's header if it's available. Otherwise, proceed with the
    default logic.

204. By Oleg Tsarev

merge lp:percona-server/5.1

203. By Alexey Kopytov

Automerge from 5.1.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'patches/mysql-test-rnt.diff'
--- patches/mysql-test-rnt.diff 2012-02-06 05:52:20 +0000
+++ patches/mysql-test-rnt.diff 2012-02-06 05:52:21 +0000
@@ -1,27 +1,3 @@
1--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
2+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
3@@ -321,14 +321,19 @@
4 # we check that the error code of the "ROLLBACK" event is 0 and not
5 # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
6 # and does not make slave to stop)
7+
8+-- source include/binlog_start_pos.inc
9+
10 if (`select @@binlog_format = 'ROW'`)
11 {
12- --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
13+ let $start_pos= `select @binlog_start_pos + 418`;
14+ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
15 }
16
17 if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
18 {
19- --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
20+ let $start_pos= `select @binlog_start_pos + 449`;
21+ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
22 }
23
24 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
25--- /dev/null1--- /dev/null
26+++ b/mysql-test/extra/rpl_tests/check_type.inc2+++ b/mysql-test/extra/rpl_tests/check_type.inc
27@@ -0,0 +1,52 @@3@@ -0,0 +1,52 @@
@@ -259,16 +235,6 @@
259 --let $slave_skip_counter= 2235 --let $slave_skip_counter= 2
260 --let $show_slave_sql_error= 1236 --let $show_slave_sql_error= 1
261 --source include/wait_for_slave_sql_error_and_skip.inc237 --source include/wait_for_slave_sql_error_and_skip.inc
262--- a/mysql-test/extra/rpl_tests/rpl_log.test
263+++ b/mysql-test/extra/rpl_tests/rpl_log.test
264@@ -14,6 +14,7 @@
265 reset master;
266 reset slave;
267 source include/start_slave.inc;
268+source include/binlog_start_pos.inc;
269
270 let $VERSION=`select version()`;
271
272--- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc238--- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
273+++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc239+++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
274@@ -532,6 +532,16 @@240@@ -532,6 +532,16 @@
@@ -288,165 +254,6 @@
288 --disable_query_log254 --disable_query_log
289 SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));255 SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
290 inc $stmt_id;256 inc $stmt_id;
291--- /dev/null
292+++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
293@@ -0,0 +1,156 @@
294+########################################################################
295+# WL47: Store in binlog text of statements that caused RBR events
296+# new event : ANNOTATE_ROWS_EVENT
297+# new master option : --binlog-annotate-rows-events
298+# new slave option : --replicate-annotate-rows-events
299+########################################################################
300+--source include/master-slave.inc
301+connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,);
302+
303+connection master;
304+--disable_query_log
305+
306+--disable_warnings
307+DROP DATABASE IF EXISTS test1;
308+--enable_warnings
309+
310+CREATE DATABASE test1;
311+USE test1;
312+
313+CREATE TABLE t1(a int primary key, b int);
314+CREATE TABLE t2(a int, b int);
315+CREATE TABLE t3(a int, b int);
316+CREATE TABLE t4(a int, b int);
317+CREATE TABLE xt1(a int, b int);
318+CREATE TABLE xt2(a int, b int);
319+
320+CREATE TABLE t5 (
321+ a INT PRIMARY KEY AUTO_INCREMENT,
322+ b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
323+);
324+
325+SET SESSION binlog_annotate_rows_events = OFF;
326+
327+INSERT INTO t1 VALUES (0,0), (1,1);
328+
329+SET SESSION binlog_annotate_rows_events = ON;
330+
331+UPDATE t1 SET b = b + 1;
332+REPLACE t1 VALUES (1,1), (2,2), (3,3);
333+
334+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
335+INSERT INTO t3 VALUES (1,1), (2,2), (3,3);
336+DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a;
337+
338+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
339+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
340+DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a;
341+
342+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
343+INSERT INTO xt2 VALUES (1,1), (2,2), (3,3);
344+DELETE xt1, xt2 FROM xt1 INNER JOIN xt2 INNER JOIN t3 WHERE xt1.a=xt2.a AND xt2.a=t3.a;
345+
346+INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz');
347+SET NAMES latin1;
348+INSERT INTO t5(b) VALUES ('gås');
349+SET NAMES utf8;
350+INSERT INTO t5(b) VALUES ('gås');
351+SET NAMES latin1;
352+
353+FLUSH LOGS;
354+
355+--echo ########################################################################
356+--echo # TABLES ON MASTER
357+--echo ########################################################################
358+--enable_query_log
359+
360+SELECT * FROM t1 ORDER BY a;
361+SELECT * FROM t2 ORDER BY a;
362+SELECT * FROM t3 ORDER BY a;
363+SELECT * FROM t5 ORDER BY a;
364+
365+sync_slave_with_master;
366+--echo ########################################################################
367+--echo # TABLES ON SLAVE: should be the same as on master
368+--echo ########################################################################
369+--disable_query_log
370+USE test1;
371+--enable_query_log
372+
373+SELECT * FROM t1 ORDER BY a;
374+SELECT * FROM t2 ORDER BY a;
375+SELECT * FROM t3 ORDER BY a;
376+SELECT * FROM t5 ORDER BY a;
377+
378+--echo ########################################################################
379+--echo # EVENTS ON SLAVE
380+let $annotate= `select @@global.replicate_annotate_rows_events`;
381+if ($annotate)
382+{
383+ --echo # The following Annotate_rows events should appear below:
384+ --echo # - UPDATE t1 SET b = b + 1;
385+ --echo # - REPLACE t1 VALUES (1,1), (2,2), (3,3);
386+ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
387+ --echo # - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
388+ --echo # - DELETE t1, t2 FROM <...>
389+ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
390+ --echo # - DELETE xt1, t2 FROM <...>
391+ --echo # - INSERT INTO t5(b) VALUES <...> (3 instances)
392+}
393+if (!$annotate)
394+{
395+ --echo # No Annotate_rows events should appear below
396+}
397+--echo ########################################################################
398+FLUSH LOGS;
399+
400+--source include/binlog_start_pos.inc
401+let $start_pos= `select @binlog_start_pos`;
402+--replace_column 2 # 5 #
403+--replace_result $start_pos <start_pos>
404+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
405+--eval show binlog events in 'slave-bin.000001' from $start_pos
406+
407+--echo #
408+--echo ########################################################################
409+--echo # INSERTs DELAYED ON MASTERs
410+--echo ########################################################################
411+connection master;
412+SET SESSION binlog_annotate_rows_events = ON;
413+INSERT DELAYED INTO test1.t4 VALUES (1,1);
414+FLUSH TABLES;
415+SELECT * FROM test1.t4 ORDER BY a;
416+
417+sync_slave_with_master;
418+connection master;
419+sync_slave_with_master;
420+
421+--echo ########################################################################
422+--echo # ON SLAVE
423+--echo # No Annotate_rows events should appear below
424+--echo ########################################################################
425+FLUSH LOGS;
426+
427+--exec $MYSQL --host=127.0.0.1 --port=$SLAVE_MYPORT test -e "show binlog events in 'slave-bin.000002'" > $MYSQLTEST_VARDIR/tmp/annotated_events.txt
428+perl;
429+ open F, '<', "$ENV{MYSQLTEST_VARDIR}/tmp/annotated_events.txt" or die;
430+ binmode STDOUT;
431+ while (defined ($_ = <F>)) {
432+ if (/Annotate_rows/) {
433+ s/[0-9]+\sAnnotate_rows\s[0-9]+\s[0-9]+/# Annotate_rows # #/;
434+ print($_);
435+ $_ = <F>;
436+ s/[0-9]+\sTable_map\s[0-9]+\s[0-9]+\stable_id:\s[0-9]+/# Table_map # # table_id: #/;
437+ print($_);
438+ }
439+ }
440+EOF
441+
442+# Clean-up
443+connection master;
444+--disable_query_log
445+DROP DATABASE test1;
446+sync_slave_with_master;
447+--enable_query_log
448+
449+--source include/rpl_end.inc
450--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test257--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
451+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test258+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
452@@ -6,6 +6,10 @@259@@ -6,6 +6,10 @@
@@ -1490,54 +1297,6 @@
1490+source include/rpl_reset.inc;1297+source include/rpl_reset.inc;
1491+enable_warnings;1298+enable_warnings;
1492+enable_query_log;1299+enable_query_log;
1493--- /dev/null
1494+++ b/mysql-test/include/binlog_start_pos.inc
1495@@ -0,0 +1,26 @@
1496+##############################################################################
1497+#
1498+# binlog_start_pos is the postion of the the first event in the binary log
1499+# which follows the Format description event. Intended to reduce test suite
1500+# dependance on the Format description event length changes (e.g. in case
1501+# of adding new events). Evaluated as:
1502+#
1503+# binlog_start_pos = 4 /* binlog header */ +
1504+# (Format_description_log_event length)
1505+#
1506+# Format_description_log_event length =
1507+# 19 /* event common header */ +
1508+# 57 /* misc stuff in the Format description header */ +
1509+# number of events.
1510+#
1511+# With current number of events = 160,
1512+#
1513+# binlog_start_pos = 4 + 19 + 57 + 160 = 240.
1514+#
1515+##############################################################################
1516+
1517+let $binlog_start_pos=240;
1518+--disable_query_log
1519+SET @binlog_start_pos=240;
1520+--enable_query_log
1521+
1522--- a/mysql-test/include/show_binlog_events2.inc
1523+++ b/mysql-test/include/show_binlog_events2.inc
1524@@ -1,4 +1,4 @@
1525---let $binlog_start=106
1526+--let $binlog_start=240
1527 --replace_result $binlog_start <binlog_start>
1528 --replace_column 2 # 5 #
1529 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
1530--- a/mysql-test/include/show_binlog_events.inc
1531+++ b/mysql-test/include/show_binlog_events.inc
1532@@ -3,7 +3,7 @@
1533 #
1534 # Useage:
1535 # let $binlog_file= master-bin.000002;
1536-# let $binlog_start= 106;
1537+# let $binlog_start= 240;
1538 # let $binlog_limit= 1, 3;
1539 # source include/show_binlog_events.inc;
1540 #
1541--- a/mysql-test/include/test_fieldsize.inc1300--- a/mysql-test/include/test_fieldsize.inc
1542+++ b/mysql-test/include/test_fieldsize.inc1301+++ b/mysql-test/include/test_fieldsize.inc
1543@@ -22,7 +22,7 @@1302@@ -22,7 +22,7 @@
@@ -1549,129 +1308,6 @@
1549 --let $show_slave_sql_error= 11308 --let $show_slave_sql_error= 1
1550 --source include/wait_for_slave_sql_error.inc1309 --source include/wait_for_slave_sql_error.inc
1551 1310
1552--- a/mysql-test/r/ctype_cp932_binlog_stm.result
1553+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
1554@@ -44,9 +44,6 @@
1555 master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
1556 master-bin.000001 # Query # # use `test`; DROP TABLE t4
1557 End of 5.0 tests
1558-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
1559-SHOW BINLOG EVENTS FROM 365;
1560-ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
1561 Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
1562 CREATE TABLE t1 (a varchar(16)) character set cp932;
1563 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
1564--- a/mysql-test/r/mysqlbinlog.result
1565+++ b/mysql-test/r/mysqlbinlog.result
1566@@ -1,15 +1,17 @@
1567 reset master;
1568+SET @save_binlog_size= @@global.max_binlog_size;
1569+SET @@global.max_binlog_size= 4096;
1570 set timestamp=1000000000;
1571 drop table if exists t1,t2,t3,t4,t5,t03,t04;
1572 create table t1 (word varchar(20));
1573 create table t2 (id int auto_increment not null primary key);
1574 insert into t1 values ("abirvalg");
1575 insert into t2 values ();
1576-load data infile '../../std_data/words.dat' into table t1;
1577-load data infile '../../std_data/words.dat' into table t1;
1578-load data infile '../../std_data/words.dat' into table t1;
1579-load data infile '../../std_data/words.dat' into table t1;
1580-load data infile '../../std_data/words.dat' into table t1;
1581+load data infile '../../std_data/words3.dat' into table t1;
1582+load data infile '../../std_data/words3.dat' into table t1;
1583+load data infile '../../std_data/words3.dat' into table t1;
1584+load data infile '../../std_data/words3.dat' into table t1;
1585+load data infile '../../std_data/words3.dat' into table t1;
1586 insert into t1 values ("Alas");
1587 flush logs;
1588
1589@@ -220,7 +222,6 @@
1590 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1591 DELIMITER /*!*/;
1592 ROLLBACK/*!*/;
1593-use test/*!*/;
1594 SET TIMESTAMP=1108844556/*!*/;
1595 SET @@session.pseudo_thread_id=999999999/*!*/;
1596 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1597@@ -228,6 +229,7 @@
1598 SET @@session.collation_database=DEFAULT/*!*/;
1599 BEGIN
1600 /*!*/;
1601+use test/*!*/;
1602 SET TIMESTAMP=1108844555/*!*/;
1603 insert t1 values (1)
1604 /*!*/;
1605@@ -239,7 +241,6 @@
1606 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
1607 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1608 DELIMITER /*!*/;
1609-use test/*!*/;
1610 SET TIMESTAMP=1108844556/*!*/;
1611 SET @@session.pseudo_thread_id=999999999/*!*/;
1612 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1613@@ -247,6 +248,7 @@
1614 SET @@session.collation_database=DEFAULT/*!*/;
1615 BEGIN
1616 /*!*/;
1617+use test/*!*/;
1618 SET TIMESTAMP=1108844555/*!*/;
1619 insert t1 values (1)
1620 /*!*/;
1621@@ -255,6 +257,7 @@
1622 ROLLBACK /* added by mysqlbinlog */;
1623 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1624 drop table t1,t2;
1625+SET @@global.max_binlog_size= @save_binlog_size;
1626 flush logs;
1627 flush logs;
1628 select * from t5 /* must be (1),(1) */;
1629@@ -377,14 +380,14 @@
1630 /*!*/;
1631 SET TIMESTAMP=1000000000/*!*/;
1632 SET @@session.collation_database=7/*!*/;
1633-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
1634+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
1635 /*!*/;
1636 SET TIMESTAMP=1000000000/*!*/;
1637 SET @@session.collation_database=DEFAULT/*!*/;
1638-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
1639+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
1640 /*!*/;
1641 SET TIMESTAMP=1000000000/*!*/;
1642-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
1643+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
1644 /*!*/;
1645 SET TIMESTAMP=1000000000/*!*/;
1646 drop table t1
1647@@ -581,7 +584,6 @@
1648 SET @@session.collation_database=DEFAULT/*!*/;
1649 BEGIN
1650 /*!*/;
1651-use test/*!*/;
1652 SET TIMESTAMP=1266652094/*!*/;
1653 SavePoint mixed_cases
1654 /*!*/;
1655@@ -592,11 +594,9 @@
1656 SET TIMESTAMP=1266652094/*!*/;
1657 INSERT INTO db1.t1 VALUES(40)
1658 /*!*/;
1659-use test/*!*/;
1660 SET TIMESTAMP=1266652094/*!*/;
1661 ROLLBACK TO mixed_cases
1662 /*!*/;
1663-use db1/*!*/;
1664 SET TIMESTAMP=1266652094/*!*/;
1665 INSERT INTO db1.t2 VALUES("after rollback to")
1666 /*!*/;
1667@@ -624,7 +624,6 @@
1668 SET @@session.collation_database=DEFAULT/*!*/;
1669 BEGIN
1670 /*!*/;
1671-use test/*!*/;
1672 SET TIMESTAMP=1266652094/*!*/;
1673 SavePoint mixed_cases
1674 /*!*/;
1675--- /dev/null1311--- /dev/null
1676+++ b/mysql-test/r/percona_fast_alter_column.result1312+++ b/mysql-test/r/percona_fast_alter_column.result
1677@@ -0,0 +1,47 @@1313@@ -0,0 +1,47 @@
@@ -1838,75 +1474,6 @@
1838+DEFAULT(t2)1474+DEFAULT(t2)
1839+0000-00-00 00:00:001475+0000-00-00 00:00:00
1840+DROP TABLE test;1476+DROP TABLE test;
1841--- /dev/null
1842+++ b/mysql-test/std_data/words3.dat
1843@@ -0,0 +1,66 @@
1844+Aarhus
1845+Aaron
1846+Ababa
1847+aback
1848+abaft
1849+abandon
1850+abandoned
1851+abandoning
1852+abandonment
1853+abandons
1854+Aarhus
1855+Aaron
1856+Ababa
1857+aback
1858+abaft
1859+abandon
1860+abandoned
1861+abandoning
1862+abandonment
1863+abandons
1864+abase
1865+abased
1866+abasement
1867+abasements
1868+abases
1869+abash
1870+abashed
1871+abashes
1872+abashing
1873+abasing
1874+abate
1875+abated
1876+abatement
1877+abatements
1878+abater
1879+abates
1880+abating
1881+Abba
1882+abbe
1883+abbey
1884+abbeys
1885+abbot
1886+abbots
1887+Abbott
1888+abbreviate
1889+abbreviated
1890+abbreviates
1891+abbreviating
1892+abbreviation
1893+abbreviations
1894+Abby
1895+abdomen
1896+abdomens
1897+abdominal
1898+abduct
1899+abducted
1900+abduction
1901+abductions
1902+abductor
1903+abductors
1904+abducts
1905+Abe
1906+abed
1907+Abel
1908+Abelian
1909+Abelson
1910--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result1477--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
1911+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result1478+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
1912@@ -93,6 +93,7 @@1479@@ -93,6 +93,7 @@
@@ -1917,26 +1484,6 @@
1917 #1484 #
1918 # Bug #54393: crash and/or valgrind errors in 1485 # Bug #54393: crash and/or valgrind errors in
1919 # mysql_client_binlog_statement1486 # mysql_client_binlog_statement
1920--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
1921+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
1922@@ -331,7 +331,7 @@
1923 master-bin.000001 # Query # # use `test`; insert into t1 values( 243 )
1924 master-bin.000001 # Query # # use `test`; insert into t1 values( 242 )
1925 master-bin.000001 # Query # # use `test`; insert into t1 values( 241 )
1926-master-bin.000001 # Query # # use `test`; insert into t1 values( 240 )
1927+master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
1928 master-bin.000001 # Query # # use `test`; insert into t1 values( 239 )
1929 master-bin.000001 # Query # # use `test`; insert into t1 values( 238 )
1930 master-bin.000001 # Query # # use `test`; insert into t1 values( 237 )
1931@@ -465,7 +465,7 @@
1932 master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
1933 master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
1934 master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
1935-master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
1936+master-bin.000001 # Query # # use `test`; insert into t1 values( 106 )
1937 master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
1938 master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
1939 master-bin.000001 # Query # # use `test`; insert into t1 values( 103 )
1940--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test1487--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
1941+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test1488+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
1942@@ -153,6 +153,7 @@1489@@ -153,6 +153,7 @@
@@ -1947,258 +1494,6 @@
1947 1494
1948 --echo #1495 --echo #
1949 --echo # Bug #54393: crash and/or valgrind errors in 1496 --echo # Bug #54393: crash and/or valgrind errors in
1950--- a/mysql-test/suite/binlog/t/binlog_incident.test
1951+++ b/mysql-test/suite/binlog/t/binlog_incident.test
1952@@ -4,6 +4,7 @@
1953
1954 source include/have_log_bin.inc;
1955 source include/have_debug.inc;
1956+source include/binlog_start_pos.inc;
1957
1958 let $MYSQLD_DATADIR= `select @@datadir`;
1959 RESET MASTER;
1960@@ -20,7 +21,7 @@
1961 DROP TABLE t1;
1962 FLUSH LOGS;
1963
1964-exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1965+exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1966 --disable_query_log
1967 eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
1968 --enable_query_log
1969--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
1970+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
1971@@ -1,5 +1,6 @@
1972 -- source include/have_debug.inc
1973 -- source include/have_binlog_format_statement.inc
1974+-- source include/binlog_start_pos.inc
1975 #
1976 # bug#27571 asynchronous setting mysql_$query()'s local error and
1977 # Query_log_event::error_code
1978@@ -24,7 +25,7 @@
1979 # for some constants like the offset of the first real event
1980 # that is different between severs versions.
1981 let $MYSQLD_DATADIR= `select @@datadir`;
1982---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1983+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1984 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1985 eval select
1986 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
1987--- a/mysql-test/suite/binlog/t/binlog_killed.test
1988+++ b/mysql-test/suite/binlog/t/binlog_killed.test
1989@@ -1,5 +1,6 @@
1990 -- source include/have_innodb.inc
1991 -- source include/have_binlog_format_statement.inc
1992+-- source include/binlog_start_pos.inc
1993
1994 # You cannot use `KILL' with the Embedded MySQL Server library,
1995 # because the embedded server merely runs inside the threads of the host
1996@@ -51,7 +52,8 @@
1997 let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
1998
1999 let $MYSQLD_DATADIR= `select @@datadir`;
2000---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
2001+let $start_pos= `select @binlog_start_pos + 28`;
2002+--exec $MYSQL_BINLOG --force-if-open --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
2003 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2004 eval select
2005 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
2006--- /dev/null
2007+++ b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt
2008@@ -0,0 +1 @@
2009+--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3
2010--- /dev/null
2011+++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test
2012@@ -0,0 +1,189 @@
2013+###############################################################################
2014+# WL47: Store in binlog text of statements that caused RBR events
2015+# new event: ANNOTATE_ROWS_EVENT
2016+# new master option: --binlog-annotate-rows-events
2017+# new mysqlbinlog option: --skip-annotate-rows-events
2018+#
2019+# Intended to test that:
2020+# *** If the --binlog-annotate-rows-events option is switched on on master
2021+# then Annotate_rows events:
2022+# - are generated;
2023+# - are genrated only once for "multi-table-maps" rbr queries;
2024+# - are not generated when the corresponding queries are filtered away;
2025+# - are generated when the corresponding queries are filtered away partialy
2026+# (e.g. in case of multi-delete).
2027+# *** Annotate_rows events are printed by mysqlbinlog started without
2028+# --skip-annotate-rows-events options both in remote and local cases.
2029+# *** Annotate_rows events are not printed by mysqlbinlog started with
2030+# --skip-annotate-rows-events options both in remote and local cases.
2031+###############################################################################
2032+
2033+--source include/have_log_bin.inc
2034+--source include/have_binlog_format_row.inc
2035+--source include/binlog_start_pos.inc
2036+
2037+--disable_query_log
2038+
2039+# Fix timestamp to avoid varying results
2040+SET timestamp=1000000000;
2041+
2042+# Delete all existing binary logs
2043+RESET MASTER;
2044+
2045+--disable_warnings
2046+DROP DATABASE IF EXISTS test1;
2047+DROP DATABASE IF EXISTS test2;
2048+DROP DATABASE IF EXISTS test3;
2049+DROP DATABASE IF EXISTS xtest1;
2050+DROP DATABASE IF EXISTS xtest2;
2051+--enable_warnings
2052+
2053+CREATE DATABASE test1;
2054+CREATE TABLE test1.t1(a int);
2055+
2056+CREATE DATABASE test2;
2057+CREATE TABLE test2.t2(a int);
2058+CREATE VIEW test2.v2 AS SELECT * FROM test2.t2;
2059+
2060+CREATE DATABASE test3;
2061+CREATE TABLE test3.t3(a int);
2062+
2063+CREATE DATABASE xtest1;
2064+CREATE TABLE xtest1.xt1(a int);
2065+
2066+CREATE DATABASE xtest2;
2067+CREATE TABLE xtest2.xt2(a int);
2068+
2069+# By default SESSION binlog_annotate_rows_events = OFF
2070+
2071+INSERT INTO test1.t1 VALUES (1), (2), (3);
2072+
2073+SET SESSION binlog_annotate_rows_events = ON;
2074+
2075+INSERT INTO test2.t2 VALUES (1), (2), (3);
2076+INSERT INTO test3.t3 VALUES (1), (2), (3);
2077+
2078+# This query generates two Table maps but the Annotate
2079+# event should appear only once before the first Table map
2080+DELETE test1.t1, test2.t2
2081+ FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2082+ WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2083+
2084+# This event should be filtered out together with Annotate event
2085+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2086+
2087+# This event should pass the filter
2088+INSERT INTO test2.v2 VALUES (1), (2), (3);
2089+
2090+# This event should pass the filter only for test2.t2 part
2091+DELETE xtest1.xt1, test2.t2
2092+ FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
2093+ WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2094+
2095+# These events should be filtered out together with Annotate events
2096+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2097+INSERT INTO xtest2.xt2 VALUES (1), (2), (3);
2098+DELETE xtest1.xt1, xtest2.xt2
2099+ FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3
2100+ WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a;
2101+
2102+FLUSH LOGS;
2103+--enable_query_log
2104+
2105+--echo #####################################################################################
2106+--echo # The following Annotate_rows events should appear below:
2107+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2108+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2109+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2110+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2111+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...>
2112+--echo #####################################################################################
2113+
2114+let $start_pos= `select @binlog_start_pos`;
2115+--replace_column 2 # 5 #
2116+--replace_result $start_pos <start_pos>
2117+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
2118+--eval show binlog events in 'master-bin.000001' from $start_pos
2119+
2120+--echo #
2121+--echo #####################################################################################
2122+--echo # mysqlbinlog
2123+--echo # The following Annotates should appear in this output:
2124+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2125+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2126+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2127+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2128+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2129+--echo #####################################################################################
2130+
2131+let $MYSQLD_DATADIR= `select @@datadir`;
2132+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2133+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
2134+
2135+--echo #
2136+--echo #####################################################################################
2137+--echo # mysqlbinlog --database=test1
2138+--echo # The following Annotate should appear in this output:
2139+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2140+--echo #####################################################################################
2141+
2142+let $MYSQLD_DATADIR= `select @@datadir`;
2143+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2144+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001
2145+
2146+--echo #
2147+--echo #####################################################################################
2148+--echo # mysqlbinlog --skip-annotate-rows-events
2149+--echo # No Annotates should appear in this output
2150+--echo #####################################################################################
2151+
2152+let $MYSQLD_DATADIR= `select @@datadir`;
2153+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2154+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v $MYSQLD_DATADIR/master-bin.000001
2155+
2156+--echo #
2157+--echo #####################################################################################
2158+--echo # mysqlbinlog --read-from-remote-server
2159+--echo # The following Annotates should appear in this output:
2160+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2161+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2162+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2163+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2164+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2165+--echo #####################################################################################
2166+
2167+let $MYSQLD_DATADIR= `select @@datadir`;
2168+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2169+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2170+
2171+--echo #
2172+--echo #####################################################################################
2173+--echo # mysqlbinlog --read-from-remote-server --database=test1
2174+--echo # The following Annotate should appear in this output:
2175+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2176+--echo #####################################################################################
2177+
2178+let $MYSQLD_DATADIR= `select @@datadir`;
2179+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2180+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2181+
2182+--echo #
2183+--echo #####################################################################################
2184+--echo # mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
2185+--echo # No Annotates should appear in this output
2186+--echo #####################################################################################
2187+
2188+let $MYSQLD_DATADIR= `select @@datadir`;
2189+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2190+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2191+
2192+# Clean-up
2193+
2194+--disable_query_log
2195+DROP DATABASE test1;
2196+DROP DATABASE test2;
2197+DROP DATABASE test3;
2198+DROP DATABASE xtest1;
2199+DROP DATABASE xtest2;
2200+--enable_query_log
2201+
2202--- /dev/null1497--- /dev/null
2203+++ b/mysql-test/suite/rpl/r/percona_mixed_binlog_direct.result1498+++ b/mysql-test/suite/rpl/r/percona_mixed_binlog_direct.result
2204@@ -0,0 +1,1462 @@1499@@ -0,0 +1,1462 @@
@@ -6345,17 +5640,6 @@
6345 SELECT COUNT(*) FROM t1;5640 SELECT COUNT(*) FROM t1;
6346 COUNT(*)5641 COUNT(*)
6347 05642 0
6348--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
6349+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
6350@@ -21,7 +21,7 @@
6351 [on slave]
6352 ---- Wait until slave stops with an error ----
6353 include/wait_for_slave_sql_error.inc [errno=1062]
6354-Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error)
6355+Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 480 (expected "duplicate key" error)
6356 call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
6357 SELECT * FROM t1;
6358 a
6359--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result5643--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
6360+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result5644+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
6361@@ -117,17 +117,17 @@5645@@ -117,17 +117,17 @@
@@ -7486,47 +6770,6 @@
7486+6770+
7487 # END 5.1 Test Case6771 # END 5.1 Test Case
7488 --source include/rpl_end.inc6772 --source include/rpl_end.inc
7489--- /dev/null
7490+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt
7491@@ -0,0 +1 @@
7492+--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
7493\ No newline at end of file
7494--- /dev/null
7495+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test
7496@@ -0,0 +1,9 @@
7497+###############################################################################
7498+# WL47: Store in binlog text of statements that caused RBR events
7499+# Wrapper for extra/rpl/rpl_row_annotate.test.
7500+# Intended to test that if the --replicate-annotate-rows-events option
7501+# is switched off on slave then Annotate_events are not reproduced.
7502+###############################################################################
7503+
7504+--source include/have_binlog_format_row.inc
7505+--source extra/rpl_tests/rpl_row_annotate.test
7506--- /dev/null
7507+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt
7508@@ -0,0 +1 @@
7509+--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
7510\ No newline at end of file
7511--- /dev/null
7512+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test
7513@@ -0,0 +1,16 @@
7514+###############################################################################
7515+# WL47: Store in binlog text of statements that caused RBR events
7516+# Wrapper for extra/rpl/rpl_row_annotate.test.
7517+# Intended to test that if the --replicate-annotate-rows-events option
7518+# is switched on on slave then Annotate_events:
7519+# - are reproduced on slave
7520+# - are reproduced only once for "multi-table-maps" rbr queries
7521+# - are not reproduced when the corresponding queries are filtered away
7522+# on replication
7523+# - are reproduced when the corresponding queries are filtered away partialy
7524+# (e.g. in case of multi-delete)
7525+# - are not generated on slave for queries that are not annotated on master.
7526+###############################################################################
7527+
7528+--source include/have_binlog_format_row.inc
7529+--source extra/rpl_tests/rpl_row_annotate.test
7530--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test6773--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
7531+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test6774+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
7532@@ -2,6 +2,8 @@6775@@ -2,6 +2,8 @@
@@ -7551,89 +6794,6 @@
7551 --disable_warnings6794 --disable_warnings
7552 DROP TABLE IF EXISTS t1;6795 DROP TABLE IF EXISTS t1;
7553 --enable_warnings6796 --enable_warnings
7554--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
7555+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
7556@@ -1,7 +1,8 @@
7557 # depends on the binlog output
7558 -- source include/have_binlog_format_row.inc
7559+--source include/binlog_start_pos.inc
7560
7561-let $rename_event_pos= 897;
7562+let $rename_event_pos= `select @binlog_start_pos + 791`;
7563
7564 # Bug#18326: Do not lock table for writing during prepare of statement
7565 # The use of the ps protocol causes extra table maps in the binlog, so
7566--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
7567+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
7568@@ -162,15 +162,18 @@
7569
7570 remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
7571
7572+--source include/binlog_start_pos.inc
7573
7574 # this test for position option
7575-# By setting this position to 416, we should only get the create of t3
7576+# By setting this position to start_binlog_pos + 310, we should only get the create of t3
7577+let $start_pos= `select @binlog_start_pos + 310`;
7578+let $stop_pos= `select @binlog_start_pos + 463`;
7579 --disable_query_log
7580 select "--- Test 2 position test --" as "";
7581 --enable_query_log
7582 let $MYSQLD_DATADIR= `select @@datadir;`;
7583 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7584---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
7585+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
7586
7587 # These are tests for remote binlog.
7588 # They should return the same as previous test.
7589@@ -181,7 +184,7 @@
7590
7591 # This is broken now
7592 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7593---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7594+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7595
7596 # This part is disabled due to bug #17654
7597
7598@@ -257,7 +260,7 @@
7599 select "--- Test 5 LOAD DATA --" as "";
7600 --enable_query_log
7601 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7602---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
7603+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
7604
7605 # Bug#7853 (mysqlbinlog does not accept input from stdin)
7606
7607@@ -265,14 +268,17 @@
7608 select "--- Test 6 reading stdin --" as "";
7609 --enable_query_log
7610 let $MYSQLD_DATADIR= `select @@datadir;`;
7611+let $stop_pos= `select @binlog_start_pos + 463`;
7612 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7613---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
7614+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
7615
7616 --disable_query_log
7617 select "--- Test 7 reading stdin w/position --" as "";
7618 --enable_query_log
7619+let $start_pos= `select @binlog_start_pos + 310`;
7620+let $stop_pos= `select @binlog_start_pos + 463`;
7621 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7622---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
7623+--exec $MYSQL_BINLOG --short-form --position=$start_pos --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
7624
7625 # Bug#16217 (mysql client did not know how not switch its internal charset)
7626 --disable_query_log
7627--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
7628+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
7629@@ -1,5 +1,6 @@
7630 # depends on the binlog output
7631 --source include/have_binlog_format_mixed_or_statement.inc
7632+--source include/binlog_start_pos.inc
7633
7634-let $rename_event_pos= 656;
7635+let $rename_event_pos= `select @binlog_start_pos + 550`;
7636 -- source extra/rpl_tests/rpl_flsh_tbls.test
7637--- /dev/null6797--- /dev/null
7638+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test6798+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test
7639@@ -0,0 +1,75 @@6799@@ -0,0 +1,75 @@
@@ -7712,436 +6872,6 @@
7712+set global slave_type_conversions = @saved_slave_type_conversions;6872+set global slave_type_conversions = @saved_slave_type_conversions;
7713+6873+
7714+source include/rpl_end.inc;6874+source include/rpl_end.inc;
7715--- a/mysql-test/t/ctype_cp932_binlog_stm.test
7716+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
7717@@ -28,16 +28,6 @@
7718
7719 --echo End of 5.0 tests
7720
7721-#
7722-# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
7723-# Note: 364 is a magic position (found experimentally, depends on
7724-# the log's contents) that caused the server crash.
7725-
7726-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
7727-
7728---error 1220
7729-SHOW BINLOG EVENTS FROM 365;
7730-
7731 --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
7732 CREATE TABLE t1 (a varchar(16)) character set cp932;
7733 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
7734--- a/mysql-test/t/mysqlbinlog2.test
7735+++ b/mysql-test/t/mysqlbinlog2.test
7736@@ -3,7 +3,7 @@
7737
7738 # TODO: Need to look at making row based version once new binlog client is complete.
7739 -- source include/have_binlog_format_mixed_or_statement.inc
7740-
7741+-- source include/binlog_start_pos.inc
7742
7743 --disable_warnings
7744 drop table if exists t1;
7745@@ -50,15 +50,19 @@
7746 --disable_query_log
7747 select "--- start-position --" as "";
7748 --enable_query_log
7749---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
7750+let $start_pos= `select @binlog_start_pos + 502`;
7751+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
7752 --disable_query_log
7753 select "--- stop-position --" as "";
7754 --enable_query_log
7755---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
7756+let $stop_pos= `select @binlog_start_pos + 502`;
7757+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
7758 --disable_query_log
7759 select "--- start and stop positions ---" as "";
7760 --enable_query_log
7761---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
7762+let $start_pos= `select @binlog_start_pos + 502`;
7763+let $stop_pos= `select @binlog_start_pos + 619`;
7764+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos $MYSQLD_DATADIR/master-bin.000001
7765 --disable_query_log
7766 select "--- start-datetime --" as "";
7767 --enable_query_log
7768@@ -84,11 +88,13 @@
7769 --disable_query_log
7770 select "--- start-position --" as "";
7771 --enable_query_log
7772---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7773+let $start_pos= `select @binlog_start_pos + 502`;
7774+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7775 --disable_query_log
7776 select "--- stop-position --" as "";
7777 --enable_query_log
7778---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7779+let $stop_pos= `select @binlog_start_pos + 28`;
7780+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7781 --disable_query_log
7782 select "--- start-datetime --" as "";
7783 --enable_query_log
7784@@ -111,15 +117,19 @@
7785 --disable_query_log
7786 select "--- start-position --" as "";
7787 --enable_query_log
7788---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7789+let $start_pos= `select @binlog_start_pos + 502`;
7790+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7791 --disable_query_log
7792 select "--- stop-position --" as "";
7793 --enable_query_log
7794---exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7795+let $stop_pos= `select @binlog_start_pos + 502`;
7796+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7797 --disable_query_log
7798 select "--- start and stop positions ---" as "";
7799 --enable_query_log
7800---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7801+let $start_pos= `select @binlog_start_pos + 502`;
7802+let $stop_pos= `select @binlog_start_pos + 619`;
7803+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7804 --disable_query_log
7805 select "--- start-datetime --" as "";
7806 --enable_query_log
7807@@ -142,11 +152,13 @@
7808 --disable_query_log
7809 select "--- start-position --" as "";
7810 --enable_query_log
7811---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
7812+let $start_pos= `select @binlog_start_pos + 502`;
7813+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
7814 --disable_query_log
7815 select "--- stop-position --" as "";
7816 --enable_query_log
7817---exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
7818+let $stop_pos= `select @binlog_start_pos + 28`;
7819+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
7820 --disable_query_log
7821 select "--- start-datetime --" as "";
7822 --enable_query_log
7823--- a/mysql-test/t/mysqlbinlog-master.opt
7824+++ b/mysql-test/t/mysqlbinlog-master.opt
7825@@ -1,2 +1 @@
7826---max-binlog-size=4096
7827 --force-restart
7828--- a/mysql-test/t/mysqlbinlog.test
7829+++ b/mysql-test/t/mysqlbinlog.test
7830@@ -3,10 +3,18 @@
7831 -- source include/have_binlog_format_statement.inc
7832
7833 -- source include/have_log_bin.inc
7834+-- source include/binlog_start_pos.inc
7835
7836 # Deletes all the binary logs
7837 reset master;
7838
7839+# We need small binlog size to break the last LOAD DATA INFILE below so that
7840+# the corresponding Begin_load_query will be written to master-bin.000001
7841+# while the Execute_load_query will be written to master-bin.000002.
7842+
7843+SET @save_binlog_size= @@global.max_binlog_size;
7844+SET @@global.max_binlog_size= 4096;
7845+
7846 # we need this for getting fixed timestamps inside of this test
7847 set timestamp=1000000000;
7848
7849@@ -26,13 +34,15 @@
7850
7851 # test for load data and load data distributed among the several
7852 # files (we need to fill up first binlog)
7853-load data infile '../../std_data/words.dat' into table t1;
7854-load data infile '../../std_data/words.dat' into table t1;
7855-load data infile '../../std_data/words.dat' into table t1;
7856-load data infile '../../std_data/words.dat' into table t1;
7857-load data infile '../../std_data/words.dat' into table t1;
7858+load data infile '../../std_data/words3.dat' into table t1;
7859+load data infile '../../std_data/words3.dat' into table t1;
7860+load data infile '../../std_data/words3.dat' into table t1;
7861+load data infile '../../std_data/words3.dat' into table t1;
7862+load data infile '../../std_data/words3.dat' into table t1;
7863 # simple query to show more in second binlog
7864 insert into t1 values ("Alas");
7865+
7866+### Starting master-bin.000003
7867 flush logs;
7868
7869 # delimiters are for easier debugging in future
7870@@ -46,7 +56,7 @@
7871 #
7872 let $MYSQLD_DATADIR= `select @@datadir`;
7873 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7874---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7875+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7876 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
7877
7878 # this should not fail but shouldn't produce any working statements
7879@@ -54,7 +64,7 @@
7880 select "--- Broken LOAD DATA --" as "";
7881 --enable_query_log
7882 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7883---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7884+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7885 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
7886
7887 # this should show almost nothing
7888@@ -62,17 +72,17 @@
7889 select "--- --database --" as "";
7890 --enable_query_log
7891 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7892---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7893+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7894 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
7895
7896 # this test for position option
7897 --disable_query_log
7898 select "--- --position --" as "";
7899 --enable_query_log
7900+let $start_pos= `select @binlog_start_pos + 227`;
7901 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7902---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7903---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002
7904-
7905+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7906+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002
7907
7908 # These are tests for remote binlog.
7909 # They should return the same as previous test.
7910@@ -83,7 +93,7 @@
7911
7912 # This is broken now
7913 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7914---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7915+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7916 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
7917
7918 # This is broken too
7919@@ -91,7 +101,7 @@
7920 select "--- Broken LOAD DATA --" as "";
7921 --enable_query_log
7922 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7923---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7924+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7925 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null
7926
7927 # And this too ! (altough it is documented)
7928@@ -99,34 +109,39 @@
7929 select "--- --database --" as "";
7930 --enable_query_log
7931 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7932---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7933+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7934 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null
7935
7936 # Strangely but this works
7937 --disable_query_log
7938 select "--- --position --" as "";
7939 --enable_query_log
7940+let $start_pos= `select @binlog_start_pos + 227`;
7941 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7942---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7943---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=332 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
7944+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7945+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=$start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
7946
7947 # Bug#7853 mysqlbinlog does not accept input from stdin
7948 --disable_query_log
7949 select "--- reading stdin --" as "";
7950 --enable_query_log
7951 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7952---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7953+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7954 --exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
7955
7956 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7957---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7958+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7959 --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
7960 drop table t1,t2;
7961
7962+SET @@global.max_binlog_size= @save_binlog_size;
7963+
7964 #
7965 # Bug#14157 utf8 encoding in binlog without set character_set_client
7966 #
7967+### Starting master-bin.000004
7968 flush logs;
7969+
7970 --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
7971 create table if not exists t5 (a int);
7972 set names latin1;
7973@@ -140,6 +155,8 @@
7974 # resulted binlog, parly consisting of multi-byte utf8 chars,
7975 # must be digestable for both client and server. In 4.1 the client
7976 # should use default-character-set same as the server.
7977+
7978+### Starting master-bin.000005
7979 flush logs;
7980 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
7981 select * from t5 /* must be (1),(1) */;
7982@@ -150,6 +167,8 @@
7983 # Check that a dump created by mysqlbinlog reproduces
7984 # lc_time_names dependent values correctly
7985 #
7986+
7987+### Starting master-bin.000006
7988 flush logs;
7989 create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
7990 insert into t5 values (1, date_format('2001-01-01','%W'));
7991@@ -158,7 +177,10 @@
7992 set lc_time_names=en_US;
7993 insert into t5 values (3, date_format('2001-01-01','%W'));
7994 select * from t5 order by c1;
7995+
7996+### Starting master-bin.000007
7997 flush logs;
7998+
7999 drop table t5;
8000 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
8001 select * from t5 order by c1;
8002@@ -170,7 +192,10 @@
8003 --disable_warnings
8004 drop procedure if exists p1;
8005 --enable_warnings
8006+
8007+### Starting master-bin.000008
8008 flush logs;
8009+
8010 delimiter //;
8011 create procedure p1()
8012 begin
8013@@ -178,12 +203,15 @@
8014 end;
8015 //
8016 delimiter ;//
8017+
8018+### Starting master-bin.000009
8019 flush logs;
8020+
8021 call p1();
8022 drop procedure p1;
8023 --error ER_SP_DOES_NOT_EXIST
8024 call p1();
8025---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
8026+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
8027 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
8028 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
8029 call p1();
8030@@ -202,7 +230,9 @@
8031 # (LOAD DATA INFILE need it)
8032 #
8033
8034+### Starting master-bin.000010
8035 flush logs;
8036+
8037 create table t1 (a varchar(64) character set utf8);
8038 load data infile '../../std_data/loaddata6.dat' into table t1;
8039 set character_set_database=koi8r;
8040@@ -217,9 +247,12 @@
8041 load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
8042 select hex(a) from t1;
8043 drop table t1;
8044+
8045+### Starting master-bin.000011
8046 flush logs;
8047+
8048 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
8049---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
8050+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
8051 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
8052
8053 #
8054@@ -229,9 +262,14 @@
8055
8056 CREATE TABLE t1 (c1 CHAR(10));
8057 # we need this for getting fixed timestamps inside of this test
8058+### Starting master-bin.000012
8059 FLUSH LOGS;
8060+
8061 INSERT INTO t1 VALUES ('0123456789');
8062+
8063+### Starting master-bin.000013
8064 FLUSH LOGS;
8065+
8066 DROP TABLE t1;
8067
8068 # We create a table, patch, and load the output into it
8069@@ -257,11 +295,16 @@
8070 #
8071 # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
8072 #
8073+### Starting master-bin.000014
8074 FLUSH LOGS;
8075+
8076 CREATE TABLE t1(a INT);
8077 INSERT INTO t1 VALUES(connection_id());
8078 let $a= `SELECT a FROM t1`;
8079+
8080+### Starting master-bin.000015
8081 FLUSH LOGS;
8082+
8083 let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
8084 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
8085 DROP TABLE t1;
8086@@ -281,11 +324,12 @@
8087 exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
8088 --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
8089
8090-
8091 #
8092 # Test --disable-force-if-open and --force-if-open
8093 #
8094+### Starting master-bin.000016
8095 FLUSH LOGS;
8096+
8097 --error 1
8098 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
8099 --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
8100@@ -300,9 +344,15 @@
8101 SHOW GRANTS FOR untrusted@localhost;
8102 USE mysqltest1;
8103 CREATE TABLE t1 (a INT, b CHAR(64));
8104+
8105+### Starting master-bin.000017
8106 flush logs;
8107+
8108 INSERT INTO t1 VALUES (1,USER());
8109+
8110+### Starting master-bin.000018
8111 flush logs;
8112+
8113 echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
8114 exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
8115 connect (unsecure,localhost,untrusted,,mysqltest1);
8116@@ -326,14 +376,20 @@
8117 connection default;
8118 USE test;
8119 SET BINLOG_FORMAT = STATEMENT;
8120+
8121+### Starting master-bin.000019
8122 FLUSH LOGS;
8123+
8124 CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
8125 SET @a_real = rand(20) * 1000;
8126 SET @an_int = 1000;
8127 SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
8128 SET @a_string = 'Just a test';
8129 INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
8130+
8131+### Starting master-bin.000020
8132 FLUSH LOGS;
8133+
8134 query_vertical SELECT * FROM t1;
8135 DROP TABLE t1;
8136
8137@@ -357,6 +413,7 @@
8138
8139 RESET MASTER;
8140 FLUSH LOGS;
8141+
8142 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
8143 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
8144 eval SELECT
8145--- /dev/null6875--- /dev/null
8146+++ b/mysql-test/t/percona_fast_alter_column.test6876+++ b/mysql-test/t/percona_fast_alter_column.test
8147@@ -0,0 +1,65 @@6877@@ -0,0 +1,65 @@
@@ -8308,15 +7038,7 @@
8308+DROP TABLE test;7038+DROP TABLE test;
8309--- a/mysql-test/r/percona_server_variables_debug.result7039--- a/mysql-test/r/percona_server_variables_debug.result
8310+++ b/mysql-test/r/percona_server_variables_debug.result7040+++ b/mysql-test/r/percona_server_variables_debug.result
8311@@ -7,6 +7,7 @@7041@@ -102,6 +102,7 @@
8312 BACK_LOG
8313 BASEDIR
8314 BIG_TABLES
8315+BINLOG_ANNOTATE_ROWS_EVENTS
8316 BINLOG_CACHE_SIZE
8317 BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
8318 BINLOG_FORMAT
8319@@ -101,6 +102,7 @@
8320 INNODB_EXTRA_RSEGMENTS7042 INNODB_EXTRA_RSEGMENTS
8321 INNODB_EXTRA_UNDOSLOTS7043 INNODB_EXTRA_UNDOSLOTS
8322 INNODB_FAKE_CHANGES7044 INNODB_FAKE_CHANGES
@@ -8324,7 +7046,7 @@
8324 INNODB_FAST_CHECKSUM7046 INNODB_FAST_CHECKSUM
8325 INNODB_FAST_RECOVERY7047 INNODB_FAST_RECOVERY
8326 INNODB_FAST_SHUTDOWN7048 INNODB_FAST_SHUTDOWN
8327@@ -201,6 +203,7 @@7049@@ -202,6 +203,7 @@
8328 LOW_PRIORITY_UPDATES7050 LOW_PRIORITY_UPDATES
8329 MAX_ALLOWED_PACKET7051 MAX_ALLOWED_PACKET
8330 MAX_BINLOG_CACHE_SIZE7052 MAX_BINLOG_CACHE_SIZE
@@ -8332,16 +7054,15 @@
8332 MAX_BINLOG_SIZE7054 MAX_BINLOG_SIZE
8333 MAX_CONNECTIONS7055 MAX_CONNECTIONS
8334 MAX_CONNECT_ERRORS7056 MAX_CONNECT_ERRORS
8335@@ -273,6 +276,8 @@7057@@ -275,6 +277,7 @@
8336 RELAY_LOG_INFO_FILE
8337 RELAY_LOG_PURGE7058 RELAY_LOG_PURGE
8338 RELAY_LOG_SPACE_LIMIT7059 RELAY_LOG_SPACE_LIMIT
8339+REPLICATE_ANNOTATE_ROWS_EVENTS7060 REPLICATE_ANNOTATE_ROWS_EVENTS
8340+REPLICATION_SLAVE_SKIP_COLUMNS7061+REPLICATION_SLAVE_SKIP_COLUMNS
8341 REPORT_HOST7062 REPORT_HOST
8342 REPORT_PASSWORD7063 REPORT_PASSWORD
8343 REPORT_PORT7064 REPORT_PORT
8344@@ -291,6 +296,8 @@7065@@ -293,6 +296,8 @@
8345 SLAVE_NET_TIMEOUT7066 SLAVE_NET_TIMEOUT
8346 SLAVE_SKIP_ERRORS7067 SLAVE_SKIP_ERRORS
8347 SLAVE_TRANSACTION_RETRIES7068 SLAVE_TRANSACTION_RETRIES
@@ -8350,7 +7071,7 @@
8350 SLOW_LAUNCH_TIME7071 SLOW_LAUNCH_TIME
8351 SLOW_QUERY_LOG7072 SLOW_QUERY_LOG
8352 SLOW_QUERY_LOG_FILE7073 SLOW_QUERY_LOG_FILE
8353@@ -312,6 +319,7 @@7074@@ -314,6 +319,7 @@
8354 SQL_SAFE_UPDATES7075 SQL_SAFE_UPDATES
8355 SQL_SELECT_LIMIT7076 SQL_SELECT_LIMIT
8356 SQL_SLAVE_SKIP_COUNTER7077 SQL_SLAVE_SKIP_COUNTER
@@ -8360,15 +7081,7 @@
8360 SSL_CAPATH7081 SSL_CAPATH
8361--- a/mysql-test/r/percona_server_variables_release.result7082--- a/mysql-test/r/percona_server_variables_release.result
8362+++ b/mysql-test/r/percona_server_variables_release.result7083+++ b/mysql-test/r/percona_server_variables_release.result
8363@@ -7,6 +7,7 @@7084@@ -100,6 +100,7 @@
8364 BACK_LOG
8365 BASEDIR
8366 BIG_TABLES
8367+BINLOG_ANNOTATE_ROWS_EVENTS
8368 BINLOG_CACHE_SIZE
8369 BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
8370 BINLOG_FORMAT
8371@@ -99,6 +100,7 @@
8372 INNODB_EXTRA_RSEGMENTS7085 INNODB_EXTRA_RSEGMENTS
8373 INNODB_EXTRA_UNDOSLOTS7086 INNODB_EXTRA_UNDOSLOTS
8374 INNODB_FAKE_CHANGES7087 INNODB_FAKE_CHANGES
@@ -8376,7 +7089,7 @@
8376 INNODB_FAST_CHECKSUM7089 INNODB_FAST_CHECKSUM
8377 INNODB_FAST_RECOVERY7090 INNODB_FAST_RECOVERY
8378 INNODB_FAST_SHUTDOWN7091 INNODB_FAST_SHUTDOWN
8379@@ -199,6 +201,7 @@7092@@ -200,6 +201,7 @@
8380 LOW_PRIORITY_UPDATES7093 LOW_PRIORITY_UPDATES
8381 MAX_ALLOWED_PACKET7094 MAX_ALLOWED_PACKET
8382 MAX_BINLOG_CACHE_SIZE7095 MAX_BINLOG_CACHE_SIZE
@@ -8384,16 +7097,15 @@
8384 MAX_BINLOG_SIZE7097 MAX_BINLOG_SIZE
8385 MAX_CONNECTIONS7098 MAX_CONNECTIONS
8386 MAX_CONNECT_ERRORS7099 MAX_CONNECT_ERRORS
8387@@ -270,6 +273,8 @@7100@@ -272,6 +274,7 @@
8388 RELAY_LOG_INFO_FILE
8389 RELAY_LOG_PURGE7101 RELAY_LOG_PURGE
8390 RELAY_LOG_SPACE_LIMIT7102 RELAY_LOG_SPACE_LIMIT
8391+REPLICATE_ANNOTATE_ROWS_EVENTS7103 REPLICATE_ANNOTATE_ROWS_EVENTS
8392+REPLICATION_SLAVE_SKIP_COLUMNS7104+REPLICATION_SLAVE_SKIP_COLUMNS
8393 REPORT_HOST7105 REPORT_HOST
8394 REPORT_PASSWORD7106 REPORT_PASSWORD
8395 REPORT_PORT7107 REPORT_PORT
8396@@ -288,6 +293,8 @@7108@@ -290,6 +293,8 @@
8397 SLAVE_NET_TIMEOUT7109 SLAVE_NET_TIMEOUT
8398 SLAVE_SKIP_ERRORS7110 SLAVE_SKIP_ERRORS
8399 SLAVE_TRANSACTION_RETRIES7111 SLAVE_TRANSACTION_RETRIES
@@ -8402,7 +7114,7 @@
8402 SLOW_LAUNCH_TIME7114 SLOW_LAUNCH_TIME
8403 SLOW_QUERY_LOG7115 SLOW_QUERY_LOG
8404 SLOW_QUERY_LOG_FILE7116 SLOW_QUERY_LOG_FILE
8405@@ -309,6 +316,7 @@7117@@ -311,6 +316,7 @@
8406 SQL_SAFE_UPDATES7118 SQL_SAFE_UPDATES
8407 SQL_SELECT_LIMIT7119 SQL_SELECT_LIMIT
8408 SQL_SLAVE_SKIP_COUNTER7120 SQL_SLAVE_SKIP_COUNTER
84097121
=== modified file 'patches/mysqlbinlog_fix.patch'
--- patches/mysqlbinlog_fix.patch 2012-02-06 05:52:20 +0000
+++ patches/mysqlbinlog_fix.patch 2012-02-06 05:52:21 +0000
@@ -41,3 +41,65 @@
41 mysql= mysql_init(NULL);41 mysql= mysql_init(NULL);
42 42
43 if (!mysql)43 if (!mysql)
44--- a/mysql-test/r/mysqlbinlog.result
45+++ b/mysql-test/r/mysqlbinlog.result
46@@ -222,7 +222,6 @@ ROLLBACK /* added by mysqlbinlog */;
47 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
48 DELIMITER /*!*/;
49 ROLLBACK/*!*/;
50-use test/*!*/;
51 SET TIMESTAMP=1108844556/*!*/;
52 SET @@session.pseudo_thread_id=999999999/*!*/;
53 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
54@@ -230,6 +229,7 @@ SET @@session.lc_time_names=0/*!*/;
55 SET @@session.collation_database=DEFAULT/*!*/;
56 BEGIN
57 /*!*/;
58+use test/*!*/;
59 SET TIMESTAMP=1108844555/*!*/;
60 insert t1 values (1)
61 /*!*/;
62@@ -241,7 +241,6 @@ Warning: The option '--position' is depr
63 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
64 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
65 DELIMITER /*!*/;
66-use test/*!*/;
67 SET TIMESTAMP=1108844556/*!*/;
68 SET @@session.pseudo_thread_id=999999999/*!*/;
69 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
70@@ -249,6 +248,7 @@ SET @@session.lc_time_names=0/*!*/;
71 SET @@session.collation_database=DEFAULT/*!*/;
72 BEGIN
73 /*!*/;
74+use test/*!*/;
75 SET TIMESTAMP=1108844555/*!*/;
76 insert t1 values (1)
77 /*!*/;
78@@ -584,7 +584,6 @@ SET @@session.lc_time_names=0/*!*/;
79 SET @@session.collation_database=DEFAULT/*!*/;
80 BEGIN
81 /*!*/;
82-use test/*!*/;
83 SET TIMESTAMP=1266652094/*!*/;
84 SavePoint mixed_cases
85 /*!*/;
86@@ -595,11 +594,9 @@ INSERT INTO db1.t2 VALUES("in savepoint
87 SET TIMESTAMP=1266652094/*!*/;
88 INSERT INTO db1.t1 VALUES(40)
89 /*!*/;
90-use test/*!*/;
91 SET TIMESTAMP=1266652094/*!*/;
92 ROLLBACK TO mixed_cases
93 /*!*/;
94-use db1/*!*/;
95 SET TIMESTAMP=1266652094/*!*/;
96 INSERT INTO db1.t2 VALUES("after rollback to")
97 /*!*/;
98@@ -627,7 +624,6 @@ SET @@session.lc_time_names=0/*!*/;
99 SET @@session.collation_database=DEFAULT/*!*/;
100 BEGIN
101 /*!*/;
102-use test/*!*/;
103 SET TIMESTAMP=1266652094/*!*/;
104 SavePoint mixed_cases
105 /*!*/;
44106
=== modified file 'patches/series.OTHER'
--- patches/series.OTHER 2012-02-06 05:52:20 +0000
+++ patches/series.OTHER 2012-02-06 05:52:21 +0000
@@ -69,7 +69,7 @@
69bug860910.patch69bug860910.patch
70bug45702.patch70bug45702.patch
71mysqlbinlog_fix.patch71mysqlbinlog_fix.patch
72mwl36.patch72wl36.patch
73wl47.patch73wl47.patch
74wl5151.patch74wl5151.patch
75slave_type_conversions_error_on_truncate.patch75slave_type_conversions_error_on_truncate.patch
7676
=== renamed file 'patches/mwl36.patch' => 'patches/wl36.patch'
--- patches/mwl36.patch 2012-02-06 05:52:20 +0000
+++ patches/wl36.patch 2012-02-06 05:52:21 +0000
@@ -44,8 +44,8 @@
44+/* Needed for Rpl_filter */44+/* Needed for Rpl_filter */
45+CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;45+CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;
46+46+
47+#include "sql_string.h" // needed for Rpl_filter47+#include "sql_string.h" // needed for Rpl_filter
48+#include "sql_list.h" // needed for Rpl_filter48+#include "sql_list.h" // needed for Rpl_filter
49+#include "rpl_filter.h"49+#include "rpl_filter.h"
50+50+
51+Rpl_filter *binlog_filter;51+Rpl_filter *binlog_filter;
@@ -53,7 +53,7 @@
53 #define BIN_LOG_HEADER_SIZE 453 #define BIN_LOG_HEADER_SIZE 4
54 #define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)54 #define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
55 55
56@@ -623,6 +632,42 @@56@@ -623,6 +633,49 @@
57 57
58 58
59 /**59 /**
@@ -63,31 +63,38 @@
63+ We have to do it here (see process_event() below) and to suppress63+ We have to do it here (see process_event() below) and to suppress
64+ producing USE statements by corresponding log event print-functions.64+ producing USE statements by corresponding log event print-functions.
65+*/65+*/
66+
67+void print_use_stmt(PRINT_EVENT_INFO* pinfo, const char* db, size_t db_len)66+void print_use_stmt(PRINT_EVENT_INFO* pinfo, const char* db, size_t db_len)
68+{67+{
69+ // pinfo->db is the current db.68+ /*
70+ // If current db is the same as required db, do nothing.69+ pinfo->db is the current db.
70+ If current db is the same as required db, do nothing.
71+ */
71+ if (!db || !memcmp(pinfo->db, db, db_len + 1))72+ if (!db || !memcmp(pinfo->db, db, db_len + 1))
72+ return;73+ return;
73+74+
74+ // Current db and required db are different.75+ /*
75+ // Check for rewrite rule for required db. (Note that in a rewrite rule76+ Current db and required db are different.
76+ // neither db_from nor db_to part can be empty).77+ Check for rewrite rule for required db. (Note that in a rewrite rule
77+ size_t len_to= 0;78+ neither db_from nor db_to part can be empty)
78+ const char *db_to= binlog_filter->get_rewrite_db(db, &len_to);79+ */
80+ size_t len_to= 0;
81+ const char* db_to= binlog_filter->get_rewrite_db(db, &len_to);
79+82+
80+ // If there is no rewrite rule for db (in this case len_to is left = 0),83+ /*
81+ // printing of the corresponding USE statement is left for log event84+ If there is no rewrite rule for db (in this case len_to is left = 0),
82+ // print-function.85+ printing of the corresponding USE statement is left for log event
86+ print-function.
87+ */
83+ if (!len_to)88+ if (!len_to)
84+ return;89+ return;
85+90+
86+ // In case of rewrite rule print USE statement for db_to91+ // In case of rewrite rule print USE statement for db_to
87+ fprintf(result_file, "use %s%s\n", db_to, pinfo->delimiter);92+ fprintf(result_file, "use %s%s\n", db_to, pinfo->delimiter);
88+93+
89+ // Copy the *original* db to pinfo to suppress emiting94+ /*
90+ // of USE stmts by log_event print-functions.95+ Copy the *original* db to pinfo to suppress emiting
96+ of USE stmts by log_event print-functions.
97+ */
91+ memcpy(pinfo->db, db, db_len + 1);98+ memcpy(pinfo->db, db, db_len + 1);
92+}99+}
93+100+
@@ -96,28 +103,33 @@
96 Prints the given event in base64 format.103 Prints the given event in base64 format.
97 104
98 The header is printed to the head cache and the body is printed to105 The header is printed to the head cache and the body is printed to
99@@ -741,9 +786,11 @@106@@ -741,10 +798,12 @@
100 107
101 switch (ev_type) {108 switch (ev_type) {
102 case QUERY_EVENT:109 case QUERY_EVENT:
110- if (!((Query_log_event*)ev)->is_trans_keyword())
103+ {111+ {
104+ Query_log_event *qe= (Query_log_event*)ev;112+ Query_log_event *qe= (Query_log_event*)ev;
105 if (!((Query_log_event*)ev)->is_trans_keyword())113+ if (!qe->is_trans_keyword())
106 {114 {
107- if (shall_skip_database(((Query_log_event*)ev)->db))115- if (shall_skip_database(((Query_log_event*)ev)->db))
108+ if (shall_skip_database(qe->db))116+ if (shall_skip_database(qe->db))
109 goto end;117 goto end;
110 }118 }
111 else119 else
112@@ -752,6 +799,7 @@120 {
113 // from binary log 5.0, make it compatible with 5.1121@@ -754,16 +815,18 @@
122 */
114 ev->flags|= LOG_EVENT_SUPPRESS_USE_F;123 ev->flags|= LOG_EVENT_SUPPRESS_USE_F;
115 }124 }
116+ print_use_stmt(print_event_info, qe->db, qe->db_len);125+ print_use_stmt(print_event_info, qe->db, qe->db_len);
117 if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)126 if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
118 {127 {
119 if ((retval= write_event_header_and_base64(ev, result_file,128 if ((retval= write_event_header_and_base64(ev, result_file,
120@@ -762,6 +810,7 @@129 print_event_info)) !=
130 OK_CONTINUE)
131 goto end;
132 }
121 else133 else
122 ev->print(result_file, print_event_info);134 ev->print(result_file, print_event_info);
123 break;135 break;
@@ -125,7 +137,7 @@
125 137
126 case CREATE_FILE_EVENT:138 case CREATE_FILE_EVENT:
127 {139 {
128@@ -883,6 +932,7 @@140@@ -885,6 +952,7 @@
129 141
130 if (!shall_skip_database(exlq->db))142 if (!shall_skip_database(exlq->db))
131 {143 {
@@ -133,12 +145,13 @@
133 if (fname)145 if (fname)
134 {146 {
135 convert_path_to_forward_slashes(fname);147 convert_path_to_forward_slashes(fname);
136@@ -906,6 +956,13 @@148@@ -908,6 +976,14 @@
137 destroy_evt= FALSE;149 destroy_evt= FALSE;
138 goto end;150 goto end;
139 }151 }
140+ size_t len_to= 0;152+ size_t len_to= 0;
141+ const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(), &len_to);153+ const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(),
154+ &len_to);
142+ if (len_to && map->rewrite_db(db_to, len_to, glob_description_event))155+ if (len_to && map->rewrite_db(db_to, len_to, glob_description_event))
143+ {156+ {
144+ error("Could not rewrite database name");157+ error("Could not rewrite database name");
@@ -147,15 +160,16 @@
147 }160 }
148 case WRITE_ROWS_EVENT:161 case WRITE_ROWS_EVENT:
149 case DELETE_ROWS_EVENT:162 case DELETE_ROWS_EVENT:
150@@ -991,14 +1048,16 @@163@@ -993,16 +1069,20 @@
151 retval= ERROR_STOP;164 retval= ERROR_STOP;
152 end:165 end:
153 rec_count++;166 rec_count++;
154+ 167+
168+
155 /*169 /*
156- Destroy the log_event object. If reading from a remote host,170- Destroy the log_event object. If reading from a remote host,
157- set the temp_buf to NULL so that memory isn't freed twice.171- set the temp_buf to NULL so that memory isn't freed twice.
158+ Destroy the log_event object. 172+ Destroy the log_event object.
159+ MariaDB MWL#36: mainline does this:173+ MariaDB MWL#36: mainline does this:
160+ If reading from a remote host,174+ If reading from a remote host,
161+ set the temp_buf to NULL so that memory isn't freed twice.175+ set the temp_buf to NULL so that memory isn't freed twice.
@@ -165,10 +179,14 @@
165 {179 {
166- if (remote_opt)180- if (remote_opt)
167- ev->temp_buf= 0;181- ev->temp_buf= 0;
168 if (destroy_evt) /* destroy it later if not set (ignored table map) */182- if (destroy_evt) /* destroy it later if not set (ignored table map) */
183+ /* destroy it later if not set (ignored table map) */
184+ if (destroy_evt)
169 delete ev;185 delete ev;
170 }186 }
171@@ -1164,6 +1223,10 @@187 DBUG_RETURN(retval);
188 }
189@@ -1166,6 +1248,10 @@
172 "Used to reserve file descriptors for use by this program.",190 "Used to reserve file descriptors for use by this program.",
173 &open_files_limit, &open_files_limit, 0, GET_ULONG,191 &open_files_limit, &open_files_limit, 0, GET_ULONG,
174 REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},192 REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
@@ -179,7 +197,7 @@
179 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}197 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
180 };198 };
181 199
182@@ -1355,6 +1418,53 @@200@@ -1359,6 +1445,53 @@
183 (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);201 (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
184 }202 }
185 break;203 break;
@@ -187,8 +205,8 @@
187+ {205+ {
188+ /* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */206+ /* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */
189+ char* ptr;207+ char* ptr;
190+ char* key= argument; // db-from208+ char* key= argument; // db-from
191+ char* val; // db-to209+ char* val; // db-to
192+210+
193+ // Where key begins211+ // Where key begins
194+ while (*key && my_isspace(&my_charset_latin1, *key))212+ while (*key && my_isspace(&my_charset_latin1, *key))
@@ -233,7 +251,7 @@
233 case 'v':251 case 'v':
234 if (argument == disabled_my_option)252 if (argument == disabled_my_option)
235 verbose= 0;253 verbose= 0;
236@@ -1628,7 +1738,7 @@254@@ -1632,7 +1775,7 @@
237 If reading from a remote host, ensure the temp_buf for the255 If reading from a remote host, ensure the temp_buf for the
238 Log_event class is pointing to the incoming stream.256 Log_event class is pointing to the incoming stream.
239 */257 */
@@ -242,7 +260,7 @@
242 260
243 Log_event_type type= ev->get_type_code();261 Log_event_type type= ev->get_type_code();
244 if (glob_description_event->binlog_version >= 3 ||262 if (glob_description_event->binlog_version >= 3 ||
245@@ -2028,6 +2138,8 @@263@@ -2032,6 +2175,8 @@
246 return retval;264 return retval;
247 }265 }
248 266
@@ -251,7 +269,7 @@
251 269
252 int main(int argc, char** argv)270 int main(int argc, char** argv)
253 {271 {
254@@ -2040,6 +2152,13 @@272@@ -2044,6 +2189,13 @@
255 273
256 my_init_time(); // for time functions274 my_init_time(); // for time functions
257 275
@@ -265,7 +283,7 @@
265 if (load_defaults("my", load_default_groups, &argc, &argv))283 if (load_defaults("my", load_default_groups, &argc, &argv))
266 exit(1);284 exit(1);
267 defaults_argv= argv;285 defaults_argv= argv;
268@@ -2128,6 +2247,8 @@286@@ -2132,6 +2284,8 @@
269 if (result_file != stdout)287 if (result_file != stdout)
270 my_fclose(result_file, MYF(0));288 my_fclose(result_file, MYF(0));
271 cleanup();289 cleanup();
@@ -274,7 +292,7 @@
274 free_defaults(defaults_argv);292 free_defaults(defaults_argv);
275 my_free_open_file_info();293 my_free_open_file_info();
276 load_processor.destroy();294 load_processor.destroy();
277@@ -2139,6 +2260,12 @@295@@ -2143,6 +2297,12 @@
278 DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);296 DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);
279 }297 }
280 298
@@ -287,7 +305,7 @@
287 /*305 /*
288 We must include this here as it's compiled with different options for306 We must include this here as it's compiled with different options for
289 the server307 the server
290@@ -2149,4 +2276,7 @@308@@ -2153,4 +2313,7 @@
291 #include "my_decimal.cc"309 #include "my_decimal.cc"
292 #include "log_event.cc"310 #include "log_event.cc"
293 #include "log_event_old.cc"311 #include "log_event_old.cc"
@@ -475,9 +493,9 @@
475 *description_event);493 *description_event);
476 virtual ~Log_event() { free_temp_buf();}494 virtual ~Log_event() { free_temp_buf();}
477- void register_temp_buf(char* buf) { temp_buf = buf; }495- void register_temp_buf(char* buf) { temp_buf = buf; }
478+ void register_temp_buf(char* buf, bool must_free) 496+ void register_temp_buf(char* buf, bool must_free)
479+ { 497+ {
480+ temp_buf= buf; 498+ temp_buf= buf;
481+ event_owns_temp_buf= must_free;499+ event_owns_temp_buf= must_free;
482+ }500+ }
483 void free_temp_buf()501 void free_temp_buf()
@@ -490,7 +508,7 @@
490 temp_buf = 0;508 temp_buf = 0;
491 }509 }
492 }510 }
493@@ -3358,6 +3370,8 @@511@@ -3358,6 +3372,8 @@
494 ulong get_table_id() const { return m_table_id; }512 ulong get_table_id() const { return m_table_id; }
495 const char *get_table_name() const { return m_tblnam; }513 const char *get_table_name() const { return m_tblnam; }
496 const char *get_db_name() const { return m_dbnam; }514 const char *get_db_name() const { return m_dbnam; }
@@ -635,3 +653,112 @@
635 653
636 654
637 void *sql_calloc(size_t size)655 void *sql_calloc(size_t size)
656--- /dev/null
657+++ b/mysql-test/r/wl36.result
658@@ -0,0 +1,48 @@
659+CREATE DATABASE a;
660+USE a;
661+CREATE TABLE t1(a INT);
662+CREATE DATABASE b;
663+USE b;
664+CREATE TABLE t1(b INT);
665+CREATE DATABASE c;
666+USE c;
667+CREATE TABLE t1(c INT);
668+RESET MASTER;
669+USE a;
670+INSERT INTO t1 VALUES(0);
671+USE b;
672+INSERT INTO t1 VALUES(1);
673+FLUSH LOGS;
674+#
675+# Apply log with ''
676+#
677+a
678+0
679+b
680+1
681+c
682+#
683+# Apply log with '--rewrite-db="a->c"'
684+#
685+a
686+b
687+1
688+c
689+0
690+#
691+# Apply log with '--rewrite-db="a->b"'
692+#
693+a
694+b
695+0
696+1
697+c
698+USE a;
699+DROP TABLE t1;
700+DROP DATABASE a;
701+USE b;
702+DROP TABLE t1;
703+DROP DATABASE b;
704+USE c;
705+DROP TABLE t1;
706+DROP DATABASE c;
707--- /dev/null
708+++ b/mysql-test/t/wl36.test
709@@ -0,0 +1,55 @@
710+#
711+# WL #36: http://askmonty.org/worklog/Server-Sprint/?tid=36
712+# This is basic test for --rewrite-db option.
713+# mysqlbinlog --rewrite-db="from->to" should rewrite database
714+#
715+
716+--source include/have_log_bin.inc
717+
718+CREATE DATABASE a; USE a; CREATE TABLE t1(a INT);
719+
720+CREATE DATABASE b; USE b; CREATE TABLE t1(b INT);
721+
722+CREATE DATABASE c; USE c; CREATE TABLE t1(c INT);
723+
724+RESET MASTER;
725+--let MYSQLD_DATA_DIR=`select @@datadir`
726+--let BIN_LOG_FILE_NAME=query_get_value(show master status, File, 1)
727+--let BIN_LOG_START_POSITION=query_get_value(show master status, Position, 1)
728+USE a; INSERT INTO t1 VALUES(0);
729+USE b; INSERT INTO t1 VALUES(1);
730+--let BIN_LOG_STOP_POSITION=query_get_value(show master status, Position, 1)
731+FLUSH LOGS;
732+
733+--let BIN_LOG_FULL_PATH=`SELECT CONCAT("$MYSQLD_DATA_DIR", "$BIN_LOG_FILE_NAME")`
734+
735+--let i=3
736+# i=3: rewrite nothing
737+# i=2: rewrite a->c
738+# i=0: rewrite a->b
739+--disable_query_log
740+while ($i)
741+{
742+--let REWRITE=`SELECT CASE $i WHEN 3 THEN '' WHEN 2 THEN '--rewrite-db="a->c"' WHEN 1 THEN '--rewrite-db="a->b"' END`
743+
744+USE a; DELETE FROM t1;
745+USE b; DELETE FROM t1;
746+USE c; DELETE FROM t1;
747+
748+--echo #
749+--echo # Apply log with '$REWRITE'
750+--echo #
751+
752+--exec $MYSQL_BINLOG $REWRITE --start-position=$BIN_LOG_START_POSITION --stop-position=$BIN_LOG_STOP_POSITION $BIN_LOG_FULL_PATH | $MYSQL
753+
754+USE a; SELECT * FROM t1;
755+USE b; SELECT * FROM t1;
756+USE c; SELECT * FROM t1;
757+
758+dec $i;
759+}
760+--enable_query_log
761+
762+USE a; DROP TABLE t1; DROP DATABASE a;
763+USE b; DROP TABLE t1; DROP DATABASE b;
764+USE c; DROP TABLE t1; DROP DATABASE c;
638765
=== modified file 'patches/wl47.patch'
--- patches/wl47.patch 2012-02-06 05:52:20 +0000
+++ patches/wl47.patch 2012-02-06 05:52:21 +0000
@@ -96,7 +96,7 @@
96 static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,96 static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
97 const char* logname);97 const char* logname);
98 static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,98 static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
99@@ -947,6 +1012,19 @@99@@ -956,6 +1021,19 @@
100 my_free(fname, MYF(MY_WME));100 my_free(fname, MYF(MY_WME));
101 break;101 break;
102 }102 }
@@ -116,7 +116,7 @@
116 case TABLE_MAP_EVENT:116 case TABLE_MAP_EVENT:
117 {117 {
118 Table_map_log_event *map= ((Table_map_log_event *)ev);118 Table_map_log_event *map= ((Table_map_log_event *)ev);
119@@ -956,6 +1034,13 @@119@@ -965,6 +1043,13 @@
120 destroy_evt= FALSE;120 destroy_evt= FALSE;
121 goto end;121 goto end;
122 }122 }
@@ -127,10 +127,10 @@
127+ */127+ */
128+ print_annotate_event(print_event_info);128+ print_annotate_event(print_event_info);
129+129+
130 size_t len_to= 0;130 size_t len_to= 0;
131 const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(), &len_to);131 const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(),
132 if (len_to && map->rewrite_db(db_to, len_to, glob_description_event))132 &len_to);
133@@ -992,6 +1077,13 @@133@@ -1002,6 +1087,13 @@
134 if (print_event_info->m_table_map_ignored.count() > 0)134 if (print_event_info->m_table_map_ignored.count() > 0)
135 print_event_info->m_table_map_ignored.clear_tables();135 print_event_info->m_table_map_ignored.clear_tables();
136 136
@@ -144,7 +144,7 @@
144 /* 144 /*
145 One needs to take into account an event that gets145 One needs to take into account an event that gets
146 filtered but was last event in the statement. If this is146 filtered but was last event in the statement. If this is
147@@ -1227,6 +1319,11 @@147@@ -1239,6 +1331,11 @@
148 "Updates to a database with a different name than the original. \148 "Updates to a database with a different name than the original. \
149 Example: rewrite-db='from->to'.",149 Example: rewrite-db='from->to'.",
150 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},150 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -156,7 +156,7 @@
156 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}156 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
157 };157 };
158 158
159@@ -1695,6 +1792,8 @@159@@ -1707,6 +1804,8 @@
160 cast to uint32.160 cast to uint32.
161 */161 */
162 int4store(buf, (uint32)start_position);162 int4store(buf, (uint32)start_position);
@@ -165,7 +165,7 @@
165 int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);165 int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
166 166
167 size_t tlen = strlen(logname);167 size_t tlen = strlen(logname);
168@@ -1727,18 +1826,30 @@168@@ -1739,18 +1838,30 @@
169 break; // end of data169 break; // end of data
170 DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",170 DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
171 len, net->read_pos[5]));171 len, net->read_pos[5]));
@@ -207,7 +207,7 @@
207 207
208 Log_event_type type= ev->get_type_code();208 Log_event_type type= ev->get_type_code();
209 if (glob_description_event->binlog_version >= 3 ||209 if (glob_description_event->binlog_version >= 3 ||
210@@ -2247,6 +2358,7 @@210@@ -2259,6 +2370,7 @@
211 if (result_file != stdout)211 if (result_file != stdout)
212 my_fclose(result_file, MYF(0));212 my_fclose(result_file, MYF(0));
213 cleanup();213 cleanup();
@@ -215,6 +215,2809 @@
215 delete binlog_filter;215 delete binlog_filter;
216 free_root(&s_mem_root, MYF(0));216 free_root(&s_mem_root, MYF(0));
217 free_defaults(defaults_argv);217 free_defaults(defaults_argv);
218--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
219+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
220@@ -321,14 +321,19 @@
221 # we check that the error code of the "ROLLBACK" event is 0 and not
222 # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
223 # and does not make slave to stop)
224+
225+-- source include/binlog_start_pos.inc
226+
227 if (`select @@binlog_format = 'ROW'`)
228 {
229- --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
230+ let $start_pos= `select @binlog_start_pos + 418`;
231+ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
232 }
233
234 if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
235 {
236- --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
237+ let $start_pos= `select @binlog_start_pos + 449`;
238+ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
239 }
240
241 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
242--- a/mysql-test/extra/rpl_tests/rpl_log.test
243+++ b/mysql-test/extra/rpl_tests/rpl_log.test
244@@ -14,6 +14,7 @@
245 reset master;
246 reset slave;
247 source include/start_slave.inc;
248+source include/binlog_start_pos.inc;
249
250 let $VERSION=`select version()`;
251
252--- /dev/null
253+++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
254@@ -0,0 +1,156 @@
255+########################################################################
256+# WL47: Store in binlog text of statements that caused RBR events
257+# new event : ANNOTATE_ROWS_EVENT
258+# new master option : --binlog-annotate-rows-events
259+# new slave option : --replicate-annotate-rows-events
260+########################################################################
261+--source include/master-slave.inc
262+connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,);
263+
264+connection master;
265+--disable_query_log
266+
267+--disable_warnings
268+DROP DATABASE IF EXISTS test1;
269+--enable_warnings
270+
271+CREATE DATABASE test1;
272+USE test1;
273+
274+CREATE TABLE t1(a int primary key, b int);
275+CREATE TABLE t2(a int, b int);
276+CREATE TABLE t3(a int, b int);
277+CREATE TABLE t4(a int, b int);
278+CREATE TABLE xt1(a int, b int);
279+CREATE TABLE xt2(a int, b int);
280+
281+CREATE TABLE t5 (
282+ a INT PRIMARY KEY AUTO_INCREMENT,
283+ b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
284+);
285+
286+SET SESSION binlog_annotate_rows_events = OFF;
287+
288+INSERT INTO t1 VALUES (0,0), (1,1);
289+
290+SET SESSION binlog_annotate_rows_events = ON;
291+
292+UPDATE t1 SET b = b + 1;
293+REPLACE t1 VALUES (1,1), (2,2), (3,3);
294+
295+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
296+INSERT INTO t3 VALUES (1,1), (2,2), (3,3);
297+DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a;
298+
299+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
300+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
301+DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a;
302+
303+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
304+INSERT INTO xt2 VALUES (1,1), (2,2), (3,3);
305+DELETE xt1, xt2 FROM xt1 INNER JOIN xt2 INNER JOIN t3 WHERE xt1.a=xt2.a AND xt2.a=t3.a;
306+
307+INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz');
308+SET NAMES latin1;
309+INSERT INTO t5(b) VALUES ('gås');
310+SET NAMES utf8;
311+INSERT INTO t5(b) VALUES ('gås');
312+SET NAMES latin1;
313+
314+FLUSH LOGS;
315+
316+--echo ########################################################################
317+--echo # TABLES ON MASTER
318+--echo ########################################################################
319+--enable_query_log
320+
321+SELECT * FROM t1 ORDER BY a;
322+SELECT * FROM t2 ORDER BY a;
323+SELECT * FROM t3 ORDER BY a;
324+SELECT * FROM t5 ORDER BY a;
325+
326+sync_slave_with_master;
327+--echo ########################################################################
328+--echo # TABLES ON SLAVE: should be the same as on master
329+--echo ########################################################################
330+--disable_query_log
331+USE test1;
332+--enable_query_log
333+
334+SELECT * FROM t1 ORDER BY a;
335+SELECT * FROM t2 ORDER BY a;
336+SELECT * FROM t3 ORDER BY a;
337+SELECT * FROM t5 ORDER BY a;
338+
339+--echo ########################################################################
340+--echo # EVENTS ON SLAVE
341+let $annotate= `select @@global.replicate_annotate_rows_events`;
342+if ($annotate)
343+{
344+ --echo # The following Annotate_rows events should appear below:
345+ --echo # - UPDATE t1 SET b = b + 1;
346+ --echo # - REPLACE t1 VALUES (1,1), (2,2), (3,3);
347+ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
348+ --echo # - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
349+ --echo # - DELETE t1, t2 FROM <...>
350+ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
351+ --echo # - DELETE xt1, t2 FROM <...>
352+ --echo # - INSERT INTO t5(b) VALUES <...> (3 instances)
353+}
354+if (!$annotate)
355+{
356+ --echo # No Annotate_rows events should appear below
357+}
358+--echo ########################################################################
359+FLUSH LOGS;
360+
361+--source include/binlog_start_pos.inc
362+let $start_pos= `select @binlog_start_pos`;
363+--replace_column 2 # 5 #
364+--replace_result $start_pos <start_pos>
365+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
366+--eval show binlog events in 'slave-bin.000001' from $start_pos
367+
368+--echo #
369+--echo ########################################################################
370+--echo # INSERTs DELAYED ON MASTERs
371+--echo ########################################################################
372+connection master;
373+SET SESSION binlog_annotate_rows_events = ON;
374+INSERT DELAYED INTO test1.t4 VALUES (1,1);
375+FLUSH TABLES;
376+SELECT * FROM test1.t4 ORDER BY a;
377+
378+sync_slave_with_master;
379+connection master;
380+sync_slave_with_master;
381+
382+--echo ########################################################################
383+--echo # ON SLAVE
384+--echo # No Annotate_rows events should appear below
385+--echo ########################################################################
386+FLUSH LOGS;
387+
388+--exec $MYSQL --host=127.0.0.1 --port=$SLAVE_MYPORT test -e "show binlog events in 'slave-bin.000002'" > $MYSQLTEST_VARDIR/tmp/annotated_events.txt
389+perl;
390+ open F, '<', "$ENV{MYSQLTEST_VARDIR}/tmp/annotated_events.txt" or die;
391+ binmode STDOUT;
392+ while (defined ($_ = <F>)) {
393+ if (/Annotate_rows/) {
394+ s/[0-9]+\sAnnotate_rows\s[0-9]+\s[0-9]+/# Annotate_rows # #/;
395+ print($_);
396+ $_ = <F>;
397+ s/[0-9]+\sTable_map\s[0-9]+\s[0-9]+\stable_id:\s[0-9]+/# Table_map # # table_id: #/;
398+ print($_);
399+ }
400+ }
401+EOF
402+
403+# Clean-up
404+connection master;
405+--disable_query_log
406+DROP DATABASE test1;
407+sync_slave_with_master;
408+--enable_query_log
409+
410+--source include/rpl_end.inc
411--- /dev/null
412+++ b/mysql-test/include/binlog_start_pos.inc
413@@ -0,0 +1,26 @@
414+##############################################################################
415+#
416+# binlog_start_pos is the postion of the the first event in the binary log
417+# which follows the Format description event. Intended to reduce test suite
418+# dependance on the Format description event length changes (e.g. in case
419+# of adding new events). Evaluated as:
420+#
421+# binlog_start_pos = 4 /* binlog header */ +
422+# (Format_description_log_event length)
423+#
424+# Format_description_log_event length =
425+# 19 /* event common header */ +
426+# 57 /* misc stuff in the Format description header */ +
427+# number of events.
428+#
429+# With current number of events = 160,
430+#
431+# binlog_start_pos = 4 + 19 + 57 + 160 = 240.
432+#
433+##############################################################################
434+
435+let $binlog_start_pos=240;
436+--disable_query_log
437+SET @binlog_start_pos=240;
438+--enable_query_log
439+
440--- a/mysql-test/include/show_binlog_events.inc
441+++ b/mysql-test/include/show_binlog_events.inc
442@@ -3,7 +3,7 @@
443 #
444 # Useage:
445 # let $binlog_file= master-bin.000002;
446-# let $binlog_start= 106;
447+# let $binlog_start= 240;
448 # let $binlog_limit= 1, 3;
449 # source include/show_binlog_events.inc;
450 #
451--- a/mysql-test/include/show_binlog_events2.inc
452+++ b/mysql-test/include/show_binlog_events2.inc
453@@ -1,4 +1,4 @@
454---let $binlog_start=106
455+--let $binlog_start=240
456 --replace_result $binlog_start <binlog_start>
457 --replace_column 2 # 5 #
458 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
459--- a/mysql-test/r/ctype_cp932_binlog_stm.result
460+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
461@@ -44,9 +44,6 @@
462 master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
463 master-bin.000001 # Query # # use `test`; DROP TABLE t4
464 End of 5.0 tests
465-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
466-SHOW BINLOG EVENTS FROM 365;
467-ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
468 Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
469 CREATE TABLE t1 (a varchar(16)) character set cp932;
470 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
471--- a/mysql-test/r/mysqlbinlog.result
472+++ b/mysql-test/r/mysqlbinlog.result
473@@ -1,15 +1,17 @@
474 reset master;
475+SET @save_binlog_size= @@global.max_binlog_size;
476+SET @@global.max_binlog_size= 4096;
477 set timestamp=1000000000;
478 drop table if exists t1,t2,t3,t4,t5,t03,t04;
479 create table t1 (word varchar(20));
480 create table t2 (id int auto_increment not null primary key);
481 insert into t1 values ("abirvalg");
482 insert into t2 values ();
483-load data infile '../../std_data/words.dat' into table t1;
484-load data infile '../../std_data/words.dat' into table t1;
485-load data infile '../../std_data/words.dat' into table t1;
486-load data infile '../../std_data/words.dat' into table t1;
487-load data infile '../../std_data/words.dat' into table t1;
488+load data infile '../../std_data/words3.dat' into table t1;
489+load data infile '../../std_data/words3.dat' into table t1;
490+load data infile '../../std_data/words3.dat' into table t1;
491+load data infile '../../std_data/words3.dat' into table t1;
492+load data infile '../../std_data/words3.dat' into table t1;
493 insert into t1 values ("Alas");
494 flush logs;
495
496@@ -255,6 +257,7 @@
497 ROLLBACK /* added by mysqlbinlog */;
498 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
499 drop table t1,t2;
500+SET @@global.max_binlog_size= @save_binlog_size;
501 flush logs;
502 flush logs;
503 select * from t5 /* must be (1),(1) */;
504@@ -377,14 +380,14 @@
505 /*!*/;
506 SET TIMESTAMP=1000000000/*!*/;
507 SET @@session.collation_database=7/*!*/;
508-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
509+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
510 /*!*/;
511 SET TIMESTAMP=1000000000/*!*/;
512 SET @@session.collation_database=DEFAULT/*!*/;
513-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
514+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
515 /*!*/;
516 SET TIMESTAMP=1000000000/*!*/;
517-LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
518+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`)
519 /*!*/;
520 SET TIMESTAMP=1000000000/*!*/;
521 drop table t1
522--- a/mysql-test/r/percona_server_variables_debug.result
523+++ b/mysql-test/r/percona_server_variables_debug.result
524@@ -7,6 +7,7 @@
525 BACK_LOG
526 BASEDIR
527 BIG_TABLES
528+BINLOG_ANNOTATE_ROWS_EVENTS
529 BINLOG_CACHE_SIZE
530 BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
531 BINLOG_FORMAT
532@@ -273,6 +274,7 @@
533 RELAY_LOG_INFO_FILE
534 RELAY_LOG_PURGE
535 RELAY_LOG_SPACE_LIMIT
536+REPLICATE_ANNOTATE_ROWS_EVENTS
537 REPORT_HOST
538 REPORT_PASSWORD
539 REPORT_PORT
540--- a/mysql-test/r/percona_server_variables_release.result
541+++ b/mysql-test/r/percona_server_variables_release.result
542@@ -7,6 +7,7 @@
543 BACK_LOG
544 BASEDIR
545 BIG_TABLES
546+BINLOG_ANNOTATE_ROWS_EVENTS
547 BINLOG_CACHE_SIZE
548 BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
549 BINLOG_FORMAT
550@@ -270,6 +271,7 @@
551 RELAY_LOG_INFO_FILE
552 RELAY_LOG_PURGE
553 RELAY_LOG_SPACE_LIMIT
554+REPLICATE_ANNOTATE_ROWS_EVENTS
555 REPORT_HOST
556 REPORT_PASSWORD
557 REPORT_PORT
558--- /dev/null
559+++ b/mysql-test/std_data/words3.dat
560@@ -0,0 +1,66 @@
561+Aarhus
562+Aaron
563+Ababa
564+aback
565+abaft
566+abandon
567+abandoned
568+abandoning
569+abandonment
570+abandons
571+Aarhus
572+Aaron
573+Ababa
574+aback
575+abaft
576+abandon
577+abandoned
578+abandoning
579+abandonment
580+abandons
581+abase
582+abased
583+abasement
584+abasements
585+abases
586+abash
587+abashed
588+abashes
589+abashing
590+abasing
591+abate
592+abated
593+abatement
594+abatements
595+abater
596+abates
597+abating
598+Abba
599+abbe
600+abbey
601+abbeys
602+abbot
603+abbots
604+Abbott
605+abbreviate
606+abbreviated
607+abbreviates
608+abbreviating
609+abbreviation
610+abbreviations
611+Abby
612+abdomen
613+abdomens
614+abdominal
615+abduct
616+abducted
617+abduction
618+abductions
619+abductor
620+abductors
621+abducts
622+Abe
623+abed
624+Abel
625+Abelian
626+Abelson
627--- /dev/null
628+++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result
629@@ -0,0 +1,1219 @@
630+#####################################################################################
631+# The following Annotate_rows events should appear below:
632+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
633+# - INSERT INTO test3.t3 VALUES (1), (2), (3)
634+# - DELETE test1.t1, test2.t2 FROM <...>
635+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
636+# - DELETE xtest1.xt1, test2.t2 FROM <...>
637+#####################################################################################
638+show binlog events in 'master-bin.000001' from <start_pos>;
639+Log_name Pos Event_type Server_id End_log_pos Info
640+master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
641+master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test2
642+master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test3
643+master-bin.000001 # Query 1 # CREATE DATABASE test1
644+master-bin.000001 # Query 1 # CREATE DATABASE test2
645+master-bin.000001 # Query 1 # CREATE DATABASE test3
646+master-bin.000001 # Query 1 # BEGIN
647+master-bin.000001 # Table_map 1 # table_id: # (test1.t1)
648+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
649+master-bin.000001 # Query 1 # COMMIT
650+master-bin.000001 # Query 1 # BEGIN
651+master-bin.000001 # Annotate_rows 1 # INSERT INTO test2.t2 VALUES (1), (2), (3)
652+master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
653+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
654+master-bin.000001 # Query 1 # COMMIT
655+master-bin.000001 # Query 1 # BEGIN
656+master-bin.000001 # Annotate_rows 1 # INSERT INTO test3.t3 VALUES (1), (2), (3)
657+master-bin.000001 # Table_map 1 # table_id: # (test3.t3)
658+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
659+master-bin.000001 # Query 1 # COMMIT
660+master-bin.000001 # Query 1 # BEGIN
661+master-bin.000001 # Annotate_rows 1 # DELETE test1.t1, test2.t2
662+FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
663+WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a
664+master-bin.000001 # Table_map 1 # table_id: # (test1.t1)
665+master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
666+master-bin.000001 # Delete_rows 1 # table_id: #
667+master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
668+master-bin.000001 # Query 1 # COMMIT
669+master-bin.000001 # Query 1 # BEGIN
670+master-bin.000001 # Annotate_rows 1 # INSERT INTO test2.v2 VALUES (1), (2), (3)
671+master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
672+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
673+master-bin.000001 # Query 1 # COMMIT
674+master-bin.000001 # Query 1 # BEGIN
675+master-bin.000001 # Annotate_rows 1 # DELETE xtest1.xt1, test2.t2
676+FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
677+WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a
678+master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
679+master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
680+master-bin.000001 # Query 1 # COMMIT
681+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
682+#
683+#####################################################################################
684+# mysqlbinlog
685+# The following Annotates should appear in this output:
686+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
687+# - INSERT INTO test3.t3 VALUES (1), (2), (3)
688+# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
689+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
690+# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
691+#####################################################################################
692+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
693+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
694+DELIMITER /*!*/;
695+# at #
696+#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
697+ROLLBACK/*!*/;
698+# at #
699+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
700+SET TIMESTAMP=1000000000/*!*/;
701+SET @@session.pseudo_thread_id=#/*!*/;
702+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
703+SET @@session.sql_mode=0/*!*/;
704+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
705+/*!\C latin1 *//*!*/;
706+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
707+SET @@session.lc_time_names=0/*!*/;
708+SET @@session.collation_database=DEFAULT/*!*/;
709+DROP DATABASE IF EXISTS test1
710+/*!*/;
711+# at #
712+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
713+SET TIMESTAMP=1000000000/*!*/;
714+DROP DATABASE IF EXISTS test2
715+/*!*/;
716+# at #
717+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
718+SET TIMESTAMP=1000000000/*!*/;
719+DROP DATABASE IF EXISTS test3
720+/*!*/;
721+# at #
722+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
723+SET TIMESTAMP=1000000000/*!*/;
724+CREATE DATABASE test1
725+/*!*/;
726+# at #
727+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
728+SET TIMESTAMP=1000000000/*!*/;
729+CREATE DATABASE test2
730+/*!*/;
731+# at #
732+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
733+SET TIMESTAMP=1000000000/*!*/;
734+CREATE DATABASE test3
735+/*!*/;
736+# at #
737+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
738+SET TIMESTAMP=1000000000/*!*/;
739+BEGIN
740+/*!*/;
741+# at #
742+# at #
743+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
744+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
745+### INSERT INTO test1.t1
746+### SET
747+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
748+### INSERT INTO test1.t1
749+### SET
750+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
751+### INSERT INTO test1.t1
752+### SET
753+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
754+# at #
755+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
756+SET TIMESTAMP=1000000000/*!*/;
757+COMMIT
758+/*!*/;
759+# at #
760+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
761+SET TIMESTAMP=1000000000/*!*/;
762+BEGIN
763+/*!*/;
764+# at #
765+# at #
766+# at #
767+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
768+#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
769+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
770+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
771+### INSERT INTO test2.t2
772+### SET
773+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
774+### INSERT INTO test2.t2
775+### SET
776+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
777+### INSERT INTO test2.t2
778+### SET
779+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
780+# at #
781+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
782+SET TIMESTAMP=1000000000/*!*/;
783+COMMIT
784+/*!*/;
785+# at #
786+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
787+SET TIMESTAMP=1000000000/*!*/;
788+BEGIN
789+/*!*/;
790+# at #
791+# at #
792+# at #
793+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
794+#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
795+#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
796+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
797+### INSERT INTO test3.t3
798+### SET
799+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
800+### INSERT INTO test3.t3
801+### SET
802+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
803+### INSERT INTO test3.t3
804+### SET
805+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
806+# at #
807+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
808+SET TIMESTAMP=1000000000/*!*/;
809+COMMIT
810+/*!*/;
811+# at #
812+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
813+SET TIMESTAMP=1000000000/*!*/;
814+BEGIN
815+/*!*/;
816+# at #
817+# at #
818+# at #
819+# at #
820+# at #
821+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
822+#Q> DELETE test1.t1, test2.t2
823+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
824+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
825+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
826+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
827+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
828+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
829+### DELETE FROM test1.t1
830+### WHERE
831+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
832+### DELETE FROM test1.t1
833+### WHERE
834+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
835+### DELETE FROM test1.t1
836+### WHERE
837+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
838+### DELETE FROM test2.t2
839+### WHERE
840+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
841+### DELETE FROM test2.t2
842+### WHERE
843+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
844+### DELETE FROM test2.t2
845+### WHERE
846+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
847+# at #
848+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
849+SET TIMESTAMP=1000000000/*!*/;
850+COMMIT
851+/*!*/;
852+# at #
853+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
854+SET TIMESTAMP=1000000000/*!*/;
855+BEGIN
856+/*!*/;
857+# at #
858+# at #
859+# at #
860+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
861+#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
862+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
863+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
864+### INSERT INTO test2.t2
865+### SET
866+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
867+### INSERT INTO test2.t2
868+### SET
869+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
870+### INSERT INTO test2.t2
871+### SET
872+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
873+# at #
874+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
875+SET TIMESTAMP=1000000000/*!*/;
876+COMMIT
877+/*!*/;
878+# at #
879+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
880+SET TIMESTAMP=1000000000/*!*/;
881+BEGIN
882+/*!*/;
883+# at #
884+# at #
885+# at #
886+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
887+#Q> DELETE xtest1.xt1, test2.t2
888+#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
889+#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
890+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
891+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
892+### DELETE FROM test2.t2
893+### WHERE
894+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
895+### DELETE FROM test2.t2
896+### WHERE
897+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
898+### DELETE FROM test2.t2
899+### WHERE
900+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
901+# at #
902+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
903+SET TIMESTAMP=1000000000/*!*/;
904+COMMIT
905+/*!*/;
906+# at #
907+#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
908+DELIMITER ;
909+# End of log file
910+ROLLBACK /* added by mysqlbinlog */;
911+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
912+#
913+#####################################################################################
914+# mysqlbinlog --database=test1
915+# The following Annotate should appear in this output:
916+# - DELETE test1.t1, test2.t2 FROM <...>
917+#####################################################################################
918+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
919+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
920+DELIMITER /*!*/;
921+# at #
922+#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
923+ROLLBACK/*!*/;
924+# at #
925+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
926+SET TIMESTAMP=1000000000/*!*/;
927+SET @@session.pseudo_thread_id=#/*!*/;
928+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
929+SET @@session.sql_mode=0/*!*/;
930+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
931+/*!\C latin1 *//*!*/;
932+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
933+SET @@session.lc_time_names=0/*!*/;
934+SET @@session.collation_database=DEFAULT/*!*/;
935+DROP DATABASE IF EXISTS test1
936+/*!*/;
937+# at #
938+# at #
939+# at #
940+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
941+SET TIMESTAMP=1000000000/*!*/;
942+CREATE DATABASE test1
943+/*!*/;
944+# at #
945+# at #
946+# at #
947+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
948+SET TIMESTAMP=1000000000/*!*/;
949+BEGIN
950+/*!*/;
951+# at #
952+# at #
953+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
954+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
955+### INSERT INTO test1.t1
956+### SET
957+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
958+### INSERT INTO test1.t1
959+### SET
960+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
961+### INSERT INTO test1.t1
962+### SET
963+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
964+# at #
965+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
966+SET TIMESTAMP=1000000000/*!*/;
967+COMMIT
968+/*!*/;
969+# at #
970+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
971+SET TIMESTAMP=1000000000/*!*/;
972+BEGIN
973+/*!*/;
974+# at #
975+# at #
976+# at #
977+# at #
978+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
979+SET TIMESTAMP=1000000000/*!*/;
980+COMMIT
981+/*!*/;
982+# at #
983+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
984+SET TIMESTAMP=1000000000/*!*/;
985+BEGIN
986+/*!*/;
987+# at #
988+# at #
989+# at #
990+# at #
991+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
992+SET TIMESTAMP=1000000000/*!*/;
993+COMMIT
994+/*!*/;
995+# at #
996+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
997+SET TIMESTAMP=1000000000/*!*/;
998+BEGIN
999+/*!*/;
1000+# at #
1001+# at #
1002+# at #
1003+# at #
1004+# at #
1005+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1006+#Q> DELETE test1.t1, test2.t2
1007+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1008+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
1009+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1010+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
1011+### DELETE FROM test1.t1
1012+### WHERE
1013+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1014+### DELETE FROM test1.t1
1015+### WHERE
1016+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1017+### DELETE FROM test1.t1
1018+### WHERE
1019+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1020+# at #
1021+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1022+SET TIMESTAMP=1000000000/*!*/;
1023+COMMIT
1024+/*!*/;
1025+# at #
1026+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1027+SET TIMESTAMP=1000000000/*!*/;
1028+BEGIN
1029+/*!*/;
1030+# at #
1031+# at #
1032+# at #
1033+# at #
1034+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1035+SET TIMESTAMP=1000000000/*!*/;
1036+COMMIT
1037+/*!*/;
1038+# at #
1039+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1040+SET TIMESTAMP=1000000000/*!*/;
1041+BEGIN
1042+/*!*/;
1043+# at #
1044+# at #
1045+# at #
1046+# at #
1047+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1048+SET TIMESTAMP=1000000000/*!*/;
1049+COMMIT
1050+/*!*/;
1051+# at #
1052+#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
1053+DELIMITER ;
1054+# End of log file
1055+ROLLBACK /* added by mysqlbinlog */;
1056+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1057+#
1058+#####################################################################################
1059+# mysqlbinlog --skip-annotate-rows-events
1060+# No Annotates should appear in this output
1061+#####################################################################################
1062+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1063+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1064+DELIMITER /*!*/;
1065+# at #
1066+#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
1067+ROLLBACK/*!*/;
1068+# at #
1069+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1070+SET TIMESTAMP=1000000000/*!*/;
1071+SET @@session.pseudo_thread_id=#/*!*/;
1072+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1073+SET @@session.sql_mode=0/*!*/;
1074+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1075+/*!\C latin1 *//*!*/;
1076+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1077+SET @@session.lc_time_names=0/*!*/;
1078+SET @@session.collation_database=DEFAULT/*!*/;
1079+DROP DATABASE IF EXISTS test1
1080+/*!*/;
1081+# at #
1082+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1083+SET TIMESTAMP=1000000000/*!*/;
1084+DROP DATABASE IF EXISTS test2
1085+/*!*/;
1086+# at #
1087+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1088+SET TIMESTAMP=1000000000/*!*/;
1089+DROP DATABASE IF EXISTS test3
1090+/*!*/;
1091+# at #
1092+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1093+SET TIMESTAMP=1000000000/*!*/;
1094+CREATE DATABASE test1
1095+/*!*/;
1096+# at #
1097+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1098+SET TIMESTAMP=1000000000/*!*/;
1099+CREATE DATABASE test2
1100+/*!*/;
1101+# at #
1102+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1103+SET TIMESTAMP=1000000000/*!*/;
1104+CREATE DATABASE test3
1105+/*!*/;
1106+# at #
1107+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1108+SET TIMESTAMP=1000000000/*!*/;
1109+BEGIN
1110+/*!*/;
1111+# at #
1112+# at #
1113+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1114+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1115+### INSERT INTO test1.t1
1116+### SET
1117+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1118+### INSERT INTO test1.t1
1119+### SET
1120+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1121+### INSERT INTO test1.t1
1122+### SET
1123+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1124+# at #
1125+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1126+SET TIMESTAMP=1000000000/*!*/;
1127+COMMIT
1128+/*!*/;
1129+# at #
1130+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1131+SET TIMESTAMP=1000000000/*!*/;
1132+BEGIN
1133+/*!*/;
1134+# at #
1135+# at #
1136+# at #
1137+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1138+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1139+### INSERT INTO test2.t2
1140+### SET
1141+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1142+### INSERT INTO test2.t2
1143+### SET
1144+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1145+### INSERT INTO test2.t2
1146+### SET
1147+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1148+# at #
1149+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1150+SET TIMESTAMP=1000000000/*!*/;
1151+COMMIT
1152+/*!*/;
1153+# at #
1154+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1155+SET TIMESTAMP=1000000000/*!*/;
1156+BEGIN
1157+/*!*/;
1158+# at #
1159+# at #
1160+# at #
1161+#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
1162+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1163+### INSERT INTO test3.t3
1164+### SET
1165+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1166+### INSERT INTO test3.t3
1167+### SET
1168+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1169+### INSERT INTO test3.t3
1170+### SET
1171+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1172+# at #
1173+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1174+SET TIMESTAMP=1000000000/*!*/;
1175+COMMIT
1176+/*!*/;
1177+# at #
1178+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1179+SET TIMESTAMP=1000000000/*!*/;
1180+BEGIN
1181+/*!*/;
1182+# at #
1183+# at #
1184+# at #
1185+# at #
1186+# at #
1187+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1188+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1189+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
1190+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
1191+### DELETE FROM test1.t1
1192+### WHERE
1193+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1194+### DELETE FROM test1.t1
1195+### WHERE
1196+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1197+### DELETE FROM test1.t1
1198+### WHERE
1199+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1200+### DELETE FROM test2.t2
1201+### WHERE
1202+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1203+### DELETE FROM test2.t2
1204+### WHERE
1205+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1206+### DELETE FROM test2.t2
1207+### WHERE
1208+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1209+# at #
1210+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1211+SET TIMESTAMP=1000000000/*!*/;
1212+COMMIT
1213+/*!*/;
1214+# at #
1215+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1216+SET TIMESTAMP=1000000000/*!*/;
1217+BEGIN
1218+/*!*/;
1219+# at #
1220+# at #
1221+# at #
1222+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1223+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1224+### INSERT INTO test2.t2
1225+### SET
1226+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1227+### INSERT INTO test2.t2
1228+### SET
1229+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1230+### INSERT INTO test2.t2
1231+### SET
1232+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1233+# at #
1234+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1235+SET TIMESTAMP=1000000000/*!*/;
1236+COMMIT
1237+/*!*/;
1238+# at #
1239+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1240+SET TIMESTAMP=1000000000/*!*/;
1241+BEGIN
1242+/*!*/;
1243+# at #
1244+# at #
1245+# at #
1246+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1247+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
1248+### DELETE FROM test2.t2
1249+### WHERE
1250+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1251+### DELETE FROM test2.t2
1252+### WHERE
1253+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1254+### DELETE FROM test2.t2
1255+### WHERE
1256+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1257+# at #
1258+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1259+SET TIMESTAMP=1000000000/*!*/;
1260+COMMIT
1261+/*!*/;
1262+# at #
1263+#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
1264+DELIMITER ;
1265+# End of log file
1266+ROLLBACK /* added by mysqlbinlog */;
1267+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1268+#
1269+#####################################################################################
1270+# mysqlbinlog --read-from-remote-server
1271+# The following Annotates should appear in this output:
1272+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1273+# - INSERT INTO test3.t3 VALUES (1), (2), (3)
1274+# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
1275+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1276+# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
1277+#####################################################################################
1278+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1279+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1280+DELIMITER /*!*/;
1281+# at #
1282+#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
1283+ROLLBACK/*!*/;
1284+# at #
1285+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1286+SET TIMESTAMP=1000000000/*!*/;
1287+SET @@session.pseudo_thread_id=#/*!*/;
1288+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1289+SET @@session.sql_mode=0/*!*/;
1290+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1291+/*!\C latin1 *//*!*/;
1292+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1293+SET @@session.lc_time_names=0/*!*/;
1294+SET @@session.collation_database=DEFAULT/*!*/;
1295+DROP DATABASE IF EXISTS test1
1296+/*!*/;
1297+# at #
1298+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1299+SET TIMESTAMP=1000000000/*!*/;
1300+DROP DATABASE IF EXISTS test2
1301+/*!*/;
1302+# at #
1303+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1304+SET TIMESTAMP=1000000000/*!*/;
1305+DROP DATABASE IF EXISTS test3
1306+/*!*/;
1307+# at #
1308+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1309+SET TIMESTAMP=1000000000/*!*/;
1310+CREATE DATABASE test1
1311+/*!*/;
1312+# at #
1313+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1314+SET TIMESTAMP=1000000000/*!*/;
1315+CREATE DATABASE test2
1316+/*!*/;
1317+# at #
1318+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1319+SET TIMESTAMP=1000000000/*!*/;
1320+CREATE DATABASE test3
1321+/*!*/;
1322+# at #
1323+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1324+SET TIMESTAMP=1000000000/*!*/;
1325+BEGIN
1326+/*!*/;
1327+# at #
1328+# at #
1329+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1330+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1331+### INSERT INTO test1.t1
1332+### SET
1333+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1334+### INSERT INTO test1.t1
1335+### SET
1336+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1337+### INSERT INTO test1.t1
1338+### SET
1339+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1340+# at #
1341+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1342+SET TIMESTAMP=1000000000/*!*/;
1343+COMMIT
1344+/*!*/;
1345+# at #
1346+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1347+SET TIMESTAMP=1000000000/*!*/;
1348+BEGIN
1349+/*!*/;
1350+# at #
1351+# at #
1352+# at #
1353+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1354+#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
1355+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1356+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1357+### INSERT INTO test2.t2
1358+### SET
1359+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1360+### INSERT INTO test2.t2
1361+### SET
1362+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1363+### INSERT INTO test2.t2
1364+### SET
1365+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1366+# at #
1367+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1368+SET TIMESTAMP=1000000000/*!*/;
1369+COMMIT
1370+/*!*/;
1371+# at #
1372+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1373+SET TIMESTAMP=1000000000/*!*/;
1374+BEGIN
1375+/*!*/;
1376+# at #
1377+# at #
1378+# at #
1379+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1380+#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
1381+#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
1382+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1383+### INSERT INTO test3.t3
1384+### SET
1385+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1386+### INSERT INTO test3.t3
1387+### SET
1388+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1389+### INSERT INTO test3.t3
1390+### SET
1391+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1392+# at #
1393+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1394+SET TIMESTAMP=1000000000/*!*/;
1395+COMMIT
1396+/*!*/;
1397+# at #
1398+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1399+SET TIMESTAMP=1000000000/*!*/;
1400+BEGIN
1401+/*!*/;
1402+# at #
1403+# at #
1404+# at #
1405+# at #
1406+# at #
1407+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1408+#Q> DELETE test1.t1, test2.t2
1409+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1410+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
1411+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1412+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1413+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
1414+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
1415+### DELETE FROM test1.t1
1416+### WHERE
1417+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1418+### DELETE FROM test1.t1
1419+### WHERE
1420+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1421+### DELETE FROM test1.t1
1422+### WHERE
1423+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1424+### DELETE FROM test2.t2
1425+### WHERE
1426+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1427+### DELETE FROM test2.t2
1428+### WHERE
1429+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1430+### DELETE FROM test2.t2
1431+### WHERE
1432+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1433+# at #
1434+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1435+SET TIMESTAMP=1000000000/*!*/;
1436+COMMIT
1437+/*!*/;
1438+# at #
1439+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1440+SET TIMESTAMP=1000000000/*!*/;
1441+BEGIN
1442+/*!*/;
1443+# at #
1444+# at #
1445+# at #
1446+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1447+#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
1448+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1449+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1450+### INSERT INTO test2.t2
1451+### SET
1452+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1453+### INSERT INTO test2.t2
1454+### SET
1455+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1456+### INSERT INTO test2.t2
1457+### SET
1458+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1459+# at #
1460+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1461+SET TIMESTAMP=1000000000/*!*/;
1462+COMMIT
1463+/*!*/;
1464+# at #
1465+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1466+SET TIMESTAMP=1000000000/*!*/;
1467+BEGIN
1468+/*!*/;
1469+# at #
1470+# at #
1471+# at #
1472+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1473+#Q> DELETE xtest1.xt1, test2.t2
1474+#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
1475+#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
1476+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1477+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
1478+### DELETE FROM test2.t2
1479+### WHERE
1480+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1481+### DELETE FROM test2.t2
1482+### WHERE
1483+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1484+### DELETE FROM test2.t2
1485+### WHERE
1486+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1487+# at #
1488+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1489+SET TIMESTAMP=1000000000/*!*/;
1490+COMMIT
1491+/*!*/;
1492+# at #
1493+#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
1494+DELIMITER ;
1495+# End of log file
1496+ROLLBACK /* added by mysqlbinlog */;
1497+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1498+#
1499+#####################################################################################
1500+# mysqlbinlog --read-from-remote-server --database=test1
1501+# The following Annotate should appear in this output:
1502+# - DELETE test1.t1, test2.t2 FROM <...>
1503+#####################################################################################
1504+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1505+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1506+DELIMITER /*!*/;
1507+# at #
1508+#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
1509+ROLLBACK/*!*/;
1510+# at #
1511+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1512+SET TIMESTAMP=1000000000/*!*/;
1513+SET @@session.pseudo_thread_id=#/*!*/;
1514+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1515+SET @@session.sql_mode=0/*!*/;
1516+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1517+/*!\C latin1 *//*!*/;
1518+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1519+SET @@session.lc_time_names=0/*!*/;
1520+SET @@session.collation_database=DEFAULT/*!*/;
1521+DROP DATABASE IF EXISTS test1
1522+/*!*/;
1523+# at #
1524+# at #
1525+# at #
1526+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1527+SET TIMESTAMP=1000000000/*!*/;
1528+CREATE DATABASE test1
1529+/*!*/;
1530+# at #
1531+# at #
1532+# at #
1533+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1534+SET TIMESTAMP=1000000000/*!*/;
1535+BEGIN
1536+/*!*/;
1537+# at #
1538+# at #
1539+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1540+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1541+### INSERT INTO test1.t1
1542+### SET
1543+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1544+### INSERT INTO test1.t1
1545+### SET
1546+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1547+### INSERT INTO test1.t1
1548+### SET
1549+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1550+# at #
1551+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1552+SET TIMESTAMP=1000000000/*!*/;
1553+COMMIT
1554+/*!*/;
1555+# at #
1556+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1557+SET TIMESTAMP=1000000000/*!*/;
1558+BEGIN
1559+/*!*/;
1560+# at #
1561+# at #
1562+# at #
1563+# at #
1564+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1565+SET TIMESTAMP=1000000000/*!*/;
1566+COMMIT
1567+/*!*/;
1568+# at #
1569+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1570+SET TIMESTAMP=1000000000/*!*/;
1571+BEGIN
1572+/*!*/;
1573+# at #
1574+# at #
1575+# at #
1576+# at #
1577+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1578+SET TIMESTAMP=1000000000/*!*/;
1579+COMMIT
1580+/*!*/;
1581+# at #
1582+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1583+SET TIMESTAMP=1000000000/*!*/;
1584+BEGIN
1585+/*!*/;
1586+# at #
1587+# at #
1588+# at #
1589+# at #
1590+# at #
1591+#010909 4:46:40 server id # end_log_pos # Annotate_rows:
1592+#Q> DELETE test1.t1, test2.t2
1593+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1594+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
1595+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1596+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
1597+### DELETE FROM test1.t1
1598+### WHERE
1599+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1600+### DELETE FROM test1.t1
1601+### WHERE
1602+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1603+### DELETE FROM test1.t1
1604+### WHERE
1605+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1606+# at #
1607+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1608+SET TIMESTAMP=1000000000/*!*/;
1609+COMMIT
1610+/*!*/;
1611+# at #
1612+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1613+SET TIMESTAMP=1000000000/*!*/;
1614+BEGIN
1615+/*!*/;
1616+# at #
1617+# at #
1618+# at #
1619+# at #
1620+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1621+SET TIMESTAMP=1000000000/*!*/;
1622+COMMIT
1623+/*!*/;
1624+# at #
1625+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1626+SET TIMESTAMP=1000000000/*!*/;
1627+BEGIN
1628+/*!*/;
1629+# at #
1630+# at #
1631+# at #
1632+# at #
1633+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1634+SET TIMESTAMP=1000000000/*!*/;
1635+COMMIT
1636+/*!*/;
1637+# at #
1638+#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
1639+DELIMITER ;
1640+# End of log file
1641+ROLLBACK /* added by mysqlbinlog */;
1642+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1643+#
1644+#####################################################################################
1645+# mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
1646+# No Annotates should appear in this output
1647+#####################################################################################
1648+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1649+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1650+DELIMITER /*!*/;
1651+# at #
1652+#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
1653+ROLLBACK/*!*/;
1654+# at #
1655+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1656+SET TIMESTAMP=1000000000/*!*/;
1657+SET @@session.pseudo_thread_id=#/*!*/;
1658+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1659+SET @@session.sql_mode=0/*!*/;
1660+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1661+/*!\C latin1 *//*!*/;
1662+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1663+SET @@session.lc_time_names=0/*!*/;
1664+SET @@session.collation_database=DEFAULT/*!*/;
1665+DROP DATABASE IF EXISTS test1
1666+/*!*/;
1667+# at #
1668+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1669+SET TIMESTAMP=1000000000/*!*/;
1670+DROP DATABASE IF EXISTS test2
1671+/*!*/;
1672+# at #
1673+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1674+SET TIMESTAMP=1000000000/*!*/;
1675+DROP DATABASE IF EXISTS test3
1676+/*!*/;
1677+# at #
1678+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1679+SET TIMESTAMP=1000000000/*!*/;
1680+CREATE DATABASE test1
1681+/*!*/;
1682+# at #
1683+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1684+SET TIMESTAMP=1000000000/*!*/;
1685+CREATE DATABASE test2
1686+/*!*/;
1687+# at #
1688+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1689+SET TIMESTAMP=1000000000/*!*/;
1690+CREATE DATABASE test3
1691+/*!*/;
1692+# at #
1693+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1694+SET TIMESTAMP=1000000000/*!*/;
1695+BEGIN
1696+/*!*/;
1697+# at #
1698+# at #
1699+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1700+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1701+### INSERT INTO test1.t1
1702+### SET
1703+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1704+### INSERT INTO test1.t1
1705+### SET
1706+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1707+### INSERT INTO test1.t1
1708+### SET
1709+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1710+# at #
1711+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1712+SET TIMESTAMP=1000000000/*!*/;
1713+COMMIT
1714+/*!*/;
1715+# at #
1716+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1717+SET TIMESTAMP=1000000000/*!*/;
1718+BEGIN
1719+/*!*/;
1720+# at #
1721+# at #
1722+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1723+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1724+### INSERT INTO test2.t2
1725+### SET
1726+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1727+### INSERT INTO test2.t2
1728+### SET
1729+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1730+### INSERT INTO test2.t2
1731+### SET
1732+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1733+# at #
1734+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1735+SET TIMESTAMP=1000000000/*!*/;
1736+COMMIT
1737+/*!*/;
1738+# at #
1739+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1740+SET TIMESTAMP=1000000000/*!*/;
1741+BEGIN
1742+/*!*/;
1743+# at #
1744+# at #
1745+#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
1746+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1747+### INSERT INTO test3.t3
1748+### SET
1749+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1750+### INSERT INTO test3.t3
1751+### SET
1752+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1753+### INSERT INTO test3.t3
1754+### SET
1755+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1756+# at #
1757+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1758+SET TIMESTAMP=1000000000/*!*/;
1759+COMMIT
1760+/*!*/;
1761+# at #
1762+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1763+SET TIMESTAMP=1000000000/*!*/;
1764+BEGIN
1765+/*!*/;
1766+# at #
1767+# at #
1768+# at #
1769+# at #
1770+#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
1771+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1772+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
1773+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
1774+### DELETE FROM test1.t1
1775+### WHERE
1776+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1777+### DELETE FROM test1.t1
1778+### WHERE
1779+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1780+### DELETE FROM test1.t1
1781+### WHERE
1782+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1783+### DELETE FROM test2.t2
1784+### WHERE
1785+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1786+### DELETE FROM test2.t2
1787+### WHERE
1788+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1789+### DELETE FROM test2.t2
1790+### WHERE
1791+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1792+# at #
1793+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1794+SET TIMESTAMP=1000000000/*!*/;
1795+COMMIT
1796+/*!*/;
1797+# at #
1798+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1799+SET TIMESTAMP=1000000000/*!*/;
1800+BEGIN
1801+/*!*/;
1802+# at #
1803+# at #
1804+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1805+#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
1806+### INSERT INTO test2.t2
1807+### SET
1808+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1809+### INSERT INTO test2.t2
1810+### SET
1811+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1812+### INSERT INTO test2.t2
1813+### SET
1814+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1815+# at #
1816+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1817+SET TIMESTAMP=1000000000/*!*/;
1818+COMMIT
1819+/*!*/;
1820+# at #
1821+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1822+SET TIMESTAMP=1000000000/*!*/;
1823+BEGIN
1824+/*!*/;
1825+# at #
1826+# at #
1827+#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
1828+#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
1829+### DELETE FROM test2.t2
1830+### WHERE
1831+### @1=3 /* INT meta=0 nullable=1 is_null=0 */
1832+### DELETE FROM test2.t2
1833+### WHERE
1834+### @1=2 /* INT meta=0 nullable=1 is_null=0 */
1835+### DELETE FROM test2.t2
1836+### WHERE
1837+### @1=1 /* INT meta=0 nullable=1 is_null=0 */
1838+# at #
1839+#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1840+SET TIMESTAMP=1000000000/*!*/;
1841+COMMIT
1842+/*!*/;
1843+# at #
1844+#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
1845+DELIMITER ;
1846+# End of log file
1847+ROLLBACK /* added by mysqlbinlog */;
1848+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1849--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
1850+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
1851@@ -331,7 +331,7 @@
1852 master-bin.000001 # Query # # use `test`; insert into t1 values( 243 )
1853 master-bin.000001 # Query # # use `test`; insert into t1 values( 242 )
1854 master-bin.000001 # Query # # use `test`; insert into t1 values( 241 )
1855-master-bin.000001 # Query # # use `test`; insert into t1 values( 240 )
1856+master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
1857 master-bin.000001 # Query # # use `test`; insert into t1 values( 239 )
1858 master-bin.000001 # Query # # use `test`; insert into t1 values( 238 )
1859 master-bin.000001 # Query # # use `test`; insert into t1 values( 237 )
1860@@ -465,7 +465,7 @@
1861 master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
1862 master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
1863 master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
1864-master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
1865+master-bin.000001 # Query # # use `test`; insert into t1 values( 106 )
1866 master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
1867 master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
1868 master-bin.000001 # Query # # use `test`; insert into t1 values( 103 )
1869--- a/mysql-test/suite/binlog/t/binlog_incident.test
1870+++ b/mysql-test/suite/binlog/t/binlog_incident.test
1871@@ -4,6 +4,7 @@
1872
1873 source include/have_log_bin.inc;
1874 source include/have_debug.inc;
1875+source include/binlog_start_pos.inc;
1876
1877 let $MYSQLD_DATADIR= `select @@datadir`;
1878 RESET MASTER;
1879@@ -20,7 +21,7 @@
1880 DROP TABLE t1;
1881 FLUSH LOGS;
1882
1883-exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1884+exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1885 --disable_query_log
1886 eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
1887 --enable_query_log
1888--- a/mysql-test/suite/binlog/t/binlog_killed.test
1889+++ b/mysql-test/suite/binlog/t/binlog_killed.test
1890@@ -1,5 +1,6 @@
1891 -- source include/have_innodb.inc
1892 -- source include/have_binlog_format_statement.inc
1893+-- source include/binlog_start_pos.inc
1894
1895 # You cannot use `KILL' with the Embedded MySQL Server library,
1896 # because the embedded server merely runs inside the threads of the host
1897@@ -51,7 +52,8 @@
1898 let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
1899
1900 let $MYSQLD_DATADIR= `select @@datadir`;
1901---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
1902+let $start_pos= `select @binlog_start_pos + 28`;
1903+--exec $MYSQL_BINLOG --force-if-open --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
1904 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1905 eval select
1906 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
1907--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
1908+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
1909@@ -1,5 +1,6 @@
1910 -- source include/have_debug.inc
1911 -- source include/have_binlog_format_statement.inc
1912+-- source include/binlog_start_pos.inc
1913 #
1914 # bug#27571 asynchronous setting mysql_$query()'s local error and
1915 # Query_log_event::error_code
1916@@ -24,7 +25,7 @@
1917 # for some constants like the offset of the first real event
1918 # that is different between severs versions.
1919 let $MYSQLD_DATADIR= `select @@datadir`;
1920---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1921+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1922 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1923 eval select
1924 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
1925--- /dev/null
1926+++ b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt
1927@@ -0,0 +1 @@
1928+--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3
1929--- /dev/null
1930+++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test
1931@@ -0,0 +1,189 @@
1932+###############################################################################
1933+# WL47: Store in binlog text of statements that caused RBR events
1934+# new event: ANNOTATE_ROWS_EVENT
1935+# new master option: --binlog-annotate-rows-events
1936+# new mysqlbinlog option: --skip-annotate-rows-events
1937+#
1938+# Intended to test that:
1939+# *** If the --binlog-annotate-rows-events option is switched on on master
1940+# then Annotate_rows events:
1941+# - are generated;
1942+# - are generated only once for "multi-table-maps" rbr queries;
1943+# - are not generated when the corresponding queries are filtered away;
1944+# - are generated when the corresponding queries are filtered away partialy
1945+# (e.g. in case of multi-delete).
1946+# *** Annotate_rows events are printed by mysqlbinlog started without
1947+# --skip-annotate-rows-events options both in remote and local cases.
1948+# *** Annotate_rows events are not printed by mysqlbinlog started with
1949+# --skip-annotate-rows-events options both in remote and local cases.
1950+###############################################################################
1951+
1952+--source include/have_log_bin.inc
1953+--source include/have_binlog_format_row.inc
1954+--source include/binlog_start_pos.inc
1955+
1956+--disable_query_log
1957+
1958+# Fix timestamp to avoid varying results
1959+SET timestamp=1000000000;
1960+
1961+# Delete all existing binary logs
1962+RESET MASTER;
1963+
1964+--disable_warnings
1965+DROP DATABASE IF EXISTS test1;
1966+DROP DATABASE IF EXISTS test2;
1967+DROP DATABASE IF EXISTS test3;
1968+DROP DATABASE IF EXISTS xtest1;
1969+DROP DATABASE IF EXISTS xtest2;
1970+--enable_warnings
1971+
1972+CREATE DATABASE test1;
1973+CREATE TABLE test1.t1(a int);
1974+
1975+CREATE DATABASE test2;
1976+CREATE TABLE test2.t2(a int);
1977+CREATE VIEW test2.v2 AS SELECT * FROM test2.t2;
1978+
1979+CREATE DATABASE test3;
1980+CREATE TABLE test3.t3(a int);
1981+
1982+CREATE DATABASE xtest1;
1983+CREATE TABLE xtest1.xt1(a int);
1984+
1985+CREATE DATABASE xtest2;
1986+CREATE TABLE xtest2.xt2(a int);
1987+
1988+# By default SESSION binlog_annotate_rows_events = OFF
1989+
1990+INSERT INTO test1.t1 VALUES (1), (2), (3);
1991+
1992+SET SESSION binlog_annotate_rows_events = ON;
1993+
1994+INSERT INTO test2.t2 VALUES (1), (2), (3);
1995+INSERT INTO test3.t3 VALUES (1), (2), (3);
1996+
1997+# This query generates two Table maps but the Annotate
1998+# event should appear only once before the first Table map
1999+DELETE test1.t1, test2.t2
2000+ FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2001+ WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2002+
2003+# This event should be filtered out together with Annotate event
2004+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2005+
2006+# This event should pass the filter
2007+INSERT INTO test2.v2 VALUES (1), (2), (3);
2008+
2009+# This event should pass the filter only for test2.t2 part
2010+DELETE xtest1.xt1, test2.t2
2011+ FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
2012+ WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2013+
2014+# These events should be filtered out together with Annotate events
2015+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2016+INSERT INTO xtest2.xt2 VALUES (1), (2), (3);
2017+DELETE xtest1.xt1, xtest2.xt2
2018+ FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3
2019+ WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a;
2020+
2021+FLUSH LOGS;
2022+--enable_query_log
2023+
2024+--echo #####################################################################################
2025+--echo # The following Annotate_rows events should appear below:
2026+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2027+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2028+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2029+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2030+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...>
2031+--echo #####################################################################################
2032+
2033+let $start_pos= `select @binlog_start_pos`;
2034+--replace_column 2 # 5 #
2035+--replace_result $start_pos <start_pos>
2036+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
2037+--eval show binlog events in 'master-bin.000001' from $start_pos
2038+
2039+--echo #
2040+--echo #####################################################################################
2041+--echo # mysqlbinlog
2042+--echo # The following Annotates should appear in this output:
2043+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2044+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2045+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2046+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2047+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2048+--echo #####################################################################################
2049+
2050+let $MYSQLD_DATADIR= `select @@datadir`;
2051+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2052+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
2053+
2054+--echo #
2055+--echo #####################################################################################
2056+--echo # mysqlbinlog --database=test1
2057+--echo # The following Annotate should appear in this output:
2058+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2059+--echo #####################################################################################
2060+
2061+let $MYSQLD_DATADIR= `select @@datadir`;
2062+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2063+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001
2064+
2065+--echo #
2066+--echo #####################################################################################
2067+--echo # mysqlbinlog --skip-annotate-rows-events
2068+--echo # No Annotates should appear in this output
2069+--echo #####################################################################################
2070+
2071+let $MYSQLD_DATADIR= `select @@datadir`;
2072+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2073+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v $MYSQLD_DATADIR/master-bin.000001
2074+
2075+--echo #
2076+--echo #####################################################################################
2077+--echo # mysqlbinlog --read-from-remote-server
2078+--echo # The following Annotates should appear in this output:
2079+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2080+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2081+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2082+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2083+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2084+--echo #####################################################################################
2085+
2086+let $MYSQLD_DATADIR= `select @@datadir`;
2087+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2088+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2089+
2090+--echo #
2091+--echo #####################################################################################
2092+--echo # mysqlbinlog --read-from-remote-server --database=test1
2093+--echo # The following Annotate should appear in this output:
2094+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2095+--echo #####################################################################################
2096+
2097+let $MYSQLD_DATADIR= `select @@datadir`;
2098+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2099+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2100+
2101+--echo #
2102+--echo #####################################################################################
2103+--echo # mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
2104+--echo # No Annotates should appear in this output
2105+--echo #####################################################################################
2106+
2107+let $MYSQLD_DATADIR= `select @@datadir`;
2108+--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/
2109+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2110+
2111+# Clean-up
2112+
2113+--disable_query_log
2114+DROP DATABASE test1;
2115+DROP DATABASE test2;
2116+DROP DATABASE test3;
2117+DROP DATABASE xtest1;
2118+DROP DATABASE xtest2;
2119+--enable_query_log
2120+
2121--- /dev/null
2122+++ b/mysql-test/suite/rpl/r/percona_replicate_annotate_rows_events.result
2123@@ -0,0 +1,16 @@
2124+include/master-slave.inc
2125+[connection master]
2126+DROP TABLE IF EXISTS t;
2127+CREATE TABLE t (a INT);
2128+INSERT INTO t VALUES(1);
2129+DROP TABLE t;
2130+select 738;
2131+738
2132+738
2133+select 738 = 738;
2134+738 = 738
2135+1
2136+select 738 = 738;
2137+738 = 738
2138+1
2139+include/rpl_end.inc
2140--- /dev/null
2141+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
2142@@ -0,0 +1,141 @@
2143+include/master-slave.inc
2144+[connection master]
2145+########################################################################
2146+# TABLES ON MASTER
2147+########################################################################
2148+SELECT * FROM t1 ORDER BY a;
2149+a b
2150+0 1
2151+SELECT * FROM t2 ORDER BY a;
2152+a b
2153+SELECT * FROM t3 ORDER BY a;
2154+a b
2155+1 1
2156+2 2
2157+3 3
2158+SELECT * FROM t5 ORDER BY a;
2159+a b
2160+1 foo
2161+2 bar
2162+3 baz
2163+4 gås
2164+5 gås
2165+########################################################################
2166+# TABLES ON SLAVE: should be the same as on master
2167+########################################################################
2168+SELECT * FROM t1 ORDER BY a;
2169+a b
2170+0 1
2171+SELECT * FROM t2 ORDER BY a;
2172+a b
2173+SELECT * FROM t3 ORDER BY a;
2174+a b
2175+1 1
2176+2 2
2177+3 3
2178+SELECT * FROM t5 ORDER BY a;
2179+a b
2180+1 foo
2181+2 bar
2182+3 baz
2183+4 gås
2184+5 gås
2185+########################################################################
2186+# EVENTS ON SLAVE
2187+# The following Annotate_rows events should appear below:
2188+# - UPDATE t1 SET b = b + 1;
2189+# - REPLACE t1 VALUES (1,1), (2,2), (3,3);
2190+# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2191+# - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
2192+# - DELETE t1, t2 FROM <...>
2193+# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2194+# - DELETE xt1, t2 FROM <...>
2195+# - INSERT INTO t5(b) VALUES <...> (3 instances)
2196+########################################################################
2197+FLUSH LOGS;
2198+show binlog events in 'slave-bin.000001' from <start_pos>;
2199+Log_name Pos Event_type Server_id End_log_pos Info
2200+slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
2201+slave-bin.000001 # Query 1 # CREATE DATABASE test1
2202+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
2203+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int)
2204+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int)
2205+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int)
2206+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 (
2207+a INT PRIMARY KEY AUTO_INCREMENT,
2208+b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
2209+)
2210+slave-bin.000001 # Query 1 # BEGIN
2211+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2212+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2213+slave-bin.000001 # Query 1 # COMMIT
2214+slave-bin.000001 # Query 1 # BEGIN
2215+slave-bin.000001 # Annotate_rows 1 # UPDATE t1 SET b = b + 1
2216+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2217+slave-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
2218+slave-bin.000001 # Query 1 # COMMIT
2219+slave-bin.000001 # Query 1 # BEGIN
2220+slave-bin.000001 # Annotate_rows 1 # REPLACE t1 VALUES (1,1), (2,2), (3,3)
2221+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2222+slave-bin.000001 # Update_rows 1 # table_id: #
2223+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2224+slave-bin.000001 # Query 1 # COMMIT
2225+slave-bin.000001 # Query 1 # BEGIN
2226+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2227+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2228+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2229+slave-bin.000001 # Query 1 # COMMIT
2230+slave-bin.000001 # Query 1 # BEGIN
2231+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
2232+slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
2233+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2234+slave-bin.000001 # Query 1 # COMMIT
2235+slave-bin.000001 # Query 1 # BEGIN
2236+slave-bin.000001 # Annotate_rows 1 # DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a
2237+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2238+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2239+slave-bin.000001 # Delete_rows 1 # table_id: #
2240+slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
2241+slave-bin.000001 # Query 1 # COMMIT
2242+slave-bin.000001 # Query 1 # BEGIN
2243+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2244+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2245+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2246+slave-bin.000001 # Query 1 # COMMIT
2247+slave-bin.000001 # Query 1 # BEGIN
2248+slave-bin.000001 # Annotate_rows 1 # DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a
2249+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2250+slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
2251+slave-bin.000001 # Query 1 # COMMIT
2252+slave-bin.000001 # Query 1 # BEGIN
2253+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz')
2254+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
2255+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2256+slave-bin.000001 # Query 1 # COMMIT
2257+slave-bin.000001 # Query 1 # BEGIN
2258+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås')
2259+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
2260+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2261+slave-bin.000001 # Query 1 # COMMIT
2262+slave-bin.000001 # Query 1 # BEGIN
2263+slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås')
2264+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
2265+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2266+slave-bin.000001 # Query 1 # COMMIT
2267+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
2268+#
2269+########################################################################
2270+# INSERTs DELAYED ON MASTERs
2271+########################################################################
2272+SET SESSION binlog_annotate_rows_events = ON;
2273+INSERT DELAYED INTO test1.t4 VALUES (1,1);
2274+FLUSH TABLES;
2275+SELECT * FROM test1.t4 ORDER BY a;
2276+a b
2277+1 1
2278+########################################################################
2279+# ON SLAVE
2280+# No Annotate_rows events should appear below
2281+########################################################################
2282+FLUSH LOGS;
2283+include/rpl_end.inc
2284--- /dev/null
2285+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
2286@@ -0,0 +1,123 @@
2287+include/master-slave.inc
2288+[connection master]
2289+########################################################################
2290+# TABLES ON MASTER
2291+########################################################################
2292+SELECT * FROM t1 ORDER BY a;
2293+a b
2294+0 1
2295+SELECT * FROM t2 ORDER BY a;
2296+a b
2297+SELECT * FROM t3 ORDER BY a;
2298+a b
2299+1 1
2300+2 2
2301+3 3
2302+SELECT * FROM t5 ORDER BY a;
2303+a b
2304+1 foo
2305+2 bar
2306+3 baz
2307+4 gås
2308+5 gås
2309+########################################################################
2310+# TABLES ON SLAVE: should be the same as on master
2311+########################################################################
2312+SELECT * FROM t1 ORDER BY a;
2313+a b
2314+0 1
2315+SELECT * FROM t2 ORDER BY a;
2316+a b
2317+SELECT * FROM t3 ORDER BY a;
2318+a b
2319+1 1
2320+2 2
2321+3 3
2322+SELECT * FROM t5 ORDER BY a;
2323+a b
2324+1 foo
2325+2 bar
2326+3 baz
2327+4 gås
2328+5 gås
2329+########################################################################
2330+# EVENTS ON SLAVE
2331+# No Annotate_rows events should appear below
2332+########################################################################
2333+FLUSH LOGS;
2334+show binlog events in 'slave-bin.000001' from <start_pos>;
2335+Log_name Pos Event_type Server_id End_log_pos Info
2336+slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
2337+slave-bin.000001 # Query 1 # CREATE DATABASE test1
2338+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
2339+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int)
2340+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int)
2341+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int)
2342+slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 (
2343+a INT PRIMARY KEY AUTO_INCREMENT,
2344+b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
2345+)
2346+slave-bin.000001 # Query 1 # BEGIN
2347+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2348+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2349+slave-bin.000001 # Query 1 # COMMIT
2350+slave-bin.000001 # Query 1 # BEGIN
2351+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2352+slave-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
2353+slave-bin.000001 # Query 1 # COMMIT
2354+slave-bin.000001 # Query 1 # BEGIN
2355+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2356+slave-bin.000001 # Update_rows 1 # table_id: #
2357+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2358+slave-bin.000001 # Query 1 # COMMIT
2359+slave-bin.000001 # Query 1 # BEGIN
2360+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2361+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2362+slave-bin.000001 # Query 1 # COMMIT
2363+slave-bin.000001 # Query 1 # BEGIN
2364+slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
2365+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2366+slave-bin.000001 # Query 1 # COMMIT
2367+slave-bin.000001 # Query 1 # BEGIN
2368+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2369+slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
2370+slave-bin.000001 # Delete_rows 1 # table_id: #
2371+slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
2372+slave-bin.000001 # Query 1 # COMMIT
2373+slave-bin.000001 # Query 1 # BEGIN
2374+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2375+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2376+slave-bin.000001 # Query 1 # COMMIT
2377+slave-bin.000001 # Query 1 # BEGIN
2378+slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
2379+slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
2380+slave-bin.000001 # Query 1 # COMMIT
2381+slave-bin.000001 # Query 1 # BEGIN
2382+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
2383+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2384+slave-bin.000001 # Query 1 # COMMIT
2385+slave-bin.000001 # Query 1 # BEGIN
2386+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
2387+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2388+slave-bin.000001 # Query 1 # COMMIT
2389+slave-bin.000001 # Query 1 # BEGIN
2390+slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
2391+slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
2392+slave-bin.000001 # Query 1 # COMMIT
2393+slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
2394+#
2395+########################################################################
2396+# INSERTs DELAYED ON MASTERs
2397+########################################################################
2398+SET SESSION binlog_annotate_rows_events = ON;
2399+INSERT DELAYED INTO test1.t4 VALUES (1,1);
2400+FLUSH TABLES;
2401+SELECT * FROM test1.t4 ORDER BY a;
2402+a b
2403+1 1
2404+########################################################################
2405+# ON SLAVE
2406+# No Annotate_rows events should appear below
2407+########################################################################
2408+FLUSH LOGS;
2409+include/rpl_end.inc
2410--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
2411+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
2412@@ -21,7 +21,7 @@
2413 [on slave]
2414 ---- Wait until slave stops with an error ----
2415 include/wait_for_slave_sql_error.inc [errno=1062]
2416-Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error)
2417+Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 480 (expected "duplicate key" error)
2418 call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
2419 SELECT * FROM t1;
2420 a
2421--- /dev/null
2422+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-master.opt
2423@@ -0,0 +1 @@
2424+--binlog_annotate_rows_events --replicate_annotate_rows_events
2425--- /dev/null
2426+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-slave.opt
2427@@ -0,0 +1 @@
2428+--slave_net_timeout=1 --log_slave_updates=0 --binlog_annotate_rows_events --replicate_annotate_rows_events
2429--- /dev/null
2430+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events.test
2431@@ -0,0 +1,35 @@
2432+########################################################################
2433+# Bug #872754: Annotate rows events on slave doesnt' work without slave's binlog
2434+########################################################################
2435+
2436+--source include/master-slave.inc
2437+--source include/have_binlog_format_row.inc
2438+--source include/have_debug.inc
2439+
2440+connection master;
2441+--disable_warnings
2442+DROP TABLE IF EXISTS t;
2443+--enable_warnings
2444+
2445+CREATE TABLE t (a INT);
2446+INSERT INTO t VALUES(1);
2447+
2448+--sleep 2
2449+
2450+DROP TABLE t;
2451+
2452+# The following would hang with the bug not fixed
2453+--sync_slave_with_master
2454+
2455+connection master;
2456+--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
2457+--eval select $master_log_pos
2458+
2459+connection slave;
2460+--let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
2461+--eval select $master_log_pos = $read_master_log_pos
2462+
2463+--let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
2464+--eval select $master_log_pos = $exec_master_log_pos
2465+
2466+--source include/rpl_end.inc
2467--- /dev/null
2468+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt
2469@@ -0,0 +1 @@
2470+--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
2471\ No newline at end of file
2472--- /dev/null
2473+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test
2474@@ -0,0 +1,16 @@
2475+###############################################################################
2476+# WL47: Store in binlog text of statements that caused RBR events
2477+# Wrapper for extra/rpl/rpl_row_annotate.test.
2478+# Intended to test that if the --replicate-annotate-rows-events option
2479+# is switched on on slave then Annotate_events:
2480+# - are reproduced on slave
2481+# - are reproduced only once for "multi-table-maps" rbr queries
2482+# - are not reproduced when the corresponding queries are filtered away
2483+# on replication
2484+# - are reproduced when the corresponding queries are filtered away partialy
2485+# (e.g. in case of multi-delete)
2486+# - are not generated on slave for queries that are not annotated on master.
2487+###############################################################################
2488+
2489+--source include/have_binlog_format_row.inc
2490+--source extra/rpl_tests/rpl_row_annotate.test
2491--- /dev/null
2492+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt
2493@@ -0,0 +1 @@
2494+--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
2495\ No newline at end of file
2496--- /dev/null
2497+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test
2498@@ -0,0 +1,9 @@
2499+###############################################################################
2500+# WL47: Store in binlog text of statements that caused RBR events
2501+# Wrapper for extra/rpl/rpl_row_annotate.test.
2502+# Intended to test that if the --replicate-annotate-rows-events option
2503+# is switched off on slave then Annotate_events are not reproduced.
2504+###############################################################################
2505+
2506+--source include/have_binlog_format_row.inc
2507+--source extra/rpl_tests/rpl_row_annotate.test
2508--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
2509+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
2510@@ -1,7 +1,8 @@
2511 # depends on the binlog output
2512 -- source include/have_binlog_format_row.inc
2513+--source include/binlog_start_pos.inc
2514
2515-let $rename_event_pos= 897;
2516+let $rename_event_pos= `select @binlog_start_pos + 791`;
2517
2518 # Bug#18326: Do not lock table for writing during prepare of statement
2519 # The use of the ps protocol causes extra table maps in the binlog, so
2520--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
2521+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
2522@@ -162,15 +162,18 @@
2523
2524 remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
2525
2526+--source include/binlog_start_pos.inc
2527
2528 # this test for position option
2529-# By setting this position to 416, we should only get the create of t3
2530+# By setting this position to start_binlog_pos + 310, we should only get the create of t3
2531+let $start_pos= `select @binlog_start_pos + 310`;
2532+let $stop_pos= `select @binlog_start_pos + 463`;
2533 --disable_query_log
2534 select "--- Test 2 position test --" as "";
2535 --enable_query_log
2536 let $MYSQLD_DATADIR= `select @@datadir;`;
2537 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2538---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
2539+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
2540
2541 # These are tests for remote binlog.
2542 # They should return the same as previous test.
2543@@ -181,7 +184,7 @@
2544
2545 # This is broken now
2546 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2547---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2548+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2549
2550 # This part is disabled due to bug #17654
2551
2552@@ -257,7 +260,7 @@
2553 select "--- Test 5 LOAD DATA --" as "";
2554 --enable_query_log
2555 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2556---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=106 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
2557+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
2558
2559 # Bug#7853 (mysqlbinlog does not accept input from stdin)
2560
2561@@ -265,14 +268,17 @@
2562 select "--- Test 6 reading stdin --" as "";
2563 --enable_query_log
2564 let $MYSQLD_DATADIR= `select @@datadir;`;
2565+let $stop_pos= `select @binlog_start_pos + 463`;
2566 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2567---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
2568+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
2569
2570 --disable_query_log
2571 select "--- Test 7 reading stdin w/position --" as "";
2572 --enable_query_log
2573+let $start_pos= `select @binlog_start_pos + 310`;
2574+let $stop_pos= `select @binlog_start_pos + 463`;
2575 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2576---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
2577+--exec $MYSQL_BINLOG --short-form --position=$start_pos --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
2578
2579 # Bug#16217 (mysql client did not know how not switch its internal charset)
2580 --disable_query_log
2581--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
2582+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
2583@@ -1,5 +1,6 @@
2584 # depends on the binlog output
2585 --source include/have_binlog_format_mixed_or_statement.inc
2586+--source include/binlog_start_pos.inc
2587
2588-let $rename_event_pos= 656;
2589+let $rename_event_pos= `select @binlog_start_pos + 550`;
2590 -- source extra/rpl_tests/rpl_flsh_tbls.test
2591--- a/mysql-test/t/ctype_cp932_binlog_stm.test
2592+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
2593@@ -28,16 +28,6 @@
2594
2595 --echo End of 5.0 tests
2596
2597-#
2598-# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
2599-# Note: 364 is a magic position (found experimentally, depends on
2600-# the log's contents) that caused the server crash.
2601-
2602-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
2603-
2604---error 1220
2605-SHOW BINLOG EVENTS FROM 365;
2606-
2607 --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
2608 CREATE TABLE t1 (a varchar(16)) character set cp932;
2609 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
2610--- a/mysql-test/t/mysqlbinlog-master.opt
2611+++ b/mysql-test/t/mysqlbinlog-master.opt
2612@@ -1,2 +1 @@
2613---max-binlog-size=4096
2614 --force-restart
2615--- a/mysql-test/t/mysqlbinlog.test
2616+++ b/mysql-test/t/mysqlbinlog.test
2617@@ -3,10 +3,18 @@
2618 -- source include/have_binlog_format_statement.inc
2619
2620 -- source include/have_log_bin.inc
2621+-- source include/binlog_start_pos.inc
2622
2623 # Deletes all the binary logs
2624 reset master;
2625
2626+# We need small binlog size to break the last LOAD DATA INFILE below so that
2627+# the corresponding Begin_load_query will be written to master-bin.000001
2628+# while the Execute_load_query will be written to master-bin.000002.
2629+
2630+SET @save_binlog_size= @@global.max_binlog_size;
2631+SET @@global.max_binlog_size= 4096;
2632+
2633 # we need this for getting fixed timestamps inside of this test
2634 set timestamp=1000000000;
2635
2636@@ -26,13 +34,15 @@
2637
2638 # test for load data and load data distributed among the several
2639 # files (we need to fill up first binlog)
2640-load data infile '../../std_data/words.dat' into table t1;
2641-load data infile '../../std_data/words.dat' into table t1;
2642-load data infile '../../std_data/words.dat' into table t1;
2643-load data infile '../../std_data/words.dat' into table t1;
2644-load data infile '../../std_data/words.dat' into table t1;
2645+load data infile '../../std_data/words3.dat' into table t1;
2646+load data infile '../../std_data/words3.dat' into table t1;
2647+load data infile '../../std_data/words3.dat' into table t1;
2648+load data infile '../../std_data/words3.dat' into table t1;
2649+load data infile '../../std_data/words3.dat' into table t1;
2650 # simple query to show more in second binlog
2651 insert into t1 values ("Alas");
2652+
2653+### Starting master-bin.000003
2654 flush logs;
2655
2656 # delimiters are for easier debugging in future
2657@@ -46,7 +56,7 @@
2658 #
2659 let $MYSQLD_DATADIR= `select @@datadir`;
2660 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2661---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2662+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2663 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
2664
2665 # this should not fail but shouldn't produce any working statements
2666@@ -54,7 +64,7 @@
2667 select "--- Broken LOAD DATA --" as "";
2668 --enable_query_log
2669 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2670---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2671+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2672 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
2673
2674 # this should show almost nothing
2675@@ -62,17 +72,17 @@
2676 select "--- --database --" as "";
2677 --enable_query_log
2678 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2679---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2680+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2681 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
2682
2683 # this test for position option
2684 --disable_query_log
2685 select "--- --position --" as "";
2686 --enable_query_log
2687+let $start_pos= `select @binlog_start_pos + 227`;
2688 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2689---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2690---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002
2691-
2692+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2693+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002
2694
2695 # These are tests for remote binlog.
2696 # They should return the same as previous test.
2697@@ -83,7 +93,7 @@
2698
2699 # This is broken now
2700 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2701---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2702+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2703 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2704
2705 # This is broken too
2706@@ -91,7 +101,7 @@
2707 select "--- Broken LOAD DATA --" as "";
2708 --enable_query_log
2709 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2710---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2711+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2712 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null
2713
2714 # And this too ! (altough it is documented)
2715@@ -99,34 +109,39 @@
2716 select "--- --database --" as "";
2717 --enable_query_log
2718 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2719---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2720+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2721 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null
2722
2723 # Strangely but this works
2724 --disable_query_log
2725 select "--- --position --" as "";
2726 --enable_query_log
2727+let $start_pos= `select @binlog_start_pos + 227`;
2728 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2729---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2730---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=332 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
2731+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2732+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=$start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
2733
2734 # Bug#7853 mysqlbinlog does not accept input from stdin
2735 --disable_query_log
2736 select "--- reading stdin --" as "";
2737 --enable_query_log
2738 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2739---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2740+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2741 --exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
2742
2743 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2744---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2745+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2746 --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
2747 drop table t1,t2;
2748
2749+SET @@global.max_binlog_size= @save_binlog_size;
2750+
2751 #
2752 # Bug#14157 utf8 encoding in binlog without set character_set_client
2753 #
2754+### Starting master-bin.000004
2755 flush logs;
2756+
2757 --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
2758 create table if not exists t5 (a int);
2759 set names latin1;
2760@@ -140,6 +155,8 @@
2761 # resulted binlog, parly consisting of multi-byte utf8 chars,
2762 # must be digestable for both client and server. In 4.1 the client
2763 # should use default-character-set same as the server.
2764+
2765+### Starting master-bin.000005
2766 flush logs;
2767 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
2768 select * from t5 /* must be (1),(1) */;
2769@@ -150,6 +167,8 @@
2770 # Check that a dump created by mysqlbinlog reproduces
2771 # lc_time_names dependent values correctly
2772 #
2773+
2774+### Starting master-bin.000006
2775 flush logs;
2776 create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
2777 insert into t5 values (1, date_format('2001-01-01','%W'));
2778@@ -158,7 +177,10 @@
2779 set lc_time_names=en_US;
2780 insert into t5 values (3, date_format('2001-01-01','%W'));
2781 select * from t5 order by c1;
2782+
2783+### Starting master-bin.000007
2784 flush logs;
2785+
2786 drop table t5;
2787 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
2788 select * from t5 order by c1;
2789@@ -170,7 +192,10 @@
2790 --disable_warnings
2791 drop procedure if exists p1;
2792 --enable_warnings
2793+
2794+### Starting master-bin.000008
2795 flush logs;
2796+
2797 delimiter //;
2798 create procedure p1()
2799 begin
2800@@ -178,12 +203,15 @@
2801 end;
2802 //
2803 delimiter ;//
2804+
2805+### Starting master-bin.000009
2806 flush logs;
2807+
2808 call p1();
2809 drop procedure p1;
2810 --error ER_SP_DOES_NOT_EXIST
2811 call p1();
2812---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2813+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2814 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
2815 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
2816 call p1();
2817@@ -202,7 +230,9 @@
2818 # (LOAD DATA INFILE need it)
2819 #
2820
2821+### Starting master-bin.000010
2822 flush logs;
2823+
2824 create table t1 (a varchar(64) character set utf8);
2825 load data infile '../../std_data/loaddata6.dat' into table t1;
2826 set character_set_database=koi8r;
2827@@ -217,9 +247,12 @@
2828 load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
2829 select hex(a) from t1;
2830 drop table t1;
2831+
2832+### Starting master-bin.000011
2833 flush logs;
2834+
2835 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2836---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2837+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2838 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
2839
2840 #
2841@@ -229,9 +262,14 @@
2842
2843 CREATE TABLE t1 (c1 CHAR(10));
2844 # we need this for getting fixed timestamps inside of this test
2845+### Starting master-bin.000012
2846 FLUSH LOGS;
2847+
2848 INSERT INTO t1 VALUES ('0123456789');
2849+
2850+### Starting master-bin.000013
2851 FLUSH LOGS;
2852+
2853 DROP TABLE t1;
2854
2855 # We create a table, patch, and load the output into it
2856@@ -257,11 +295,16 @@
2857 #
2858 # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
2859 #
2860+### Starting master-bin.000014
2861 FLUSH LOGS;
2862+
2863 CREATE TABLE t1(a INT);
2864 INSERT INTO t1 VALUES(connection_id());
2865 let $a= `SELECT a FROM t1`;
2866+
2867+### Starting master-bin.000015
2868 FLUSH LOGS;
2869+
2870 let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
2871 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
2872 DROP TABLE t1;
2873@@ -281,11 +324,12 @@
2874 exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
2875 --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
2876
2877-
2878 #
2879 # Test --disable-force-if-open and --force-if-open
2880 #
2881+### Starting master-bin.000016
2882 FLUSH LOGS;
2883+
2884 --error 1
2885 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
2886 --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
2887@@ -300,9 +344,15 @@
2888 SHOW GRANTS FOR untrusted@localhost;
2889 USE mysqltest1;
2890 CREATE TABLE t1 (a INT, b CHAR(64));
2891+
2892+### Starting master-bin.000017
2893 flush logs;
2894+
2895 INSERT INTO t1 VALUES (1,USER());
2896+
2897+### Starting master-bin.000018
2898 flush logs;
2899+
2900 echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
2901 exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
2902 connect (unsecure,localhost,untrusted,,mysqltest1);
2903@@ -326,14 +376,20 @@
2904 connection default;
2905 USE test;
2906 SET BINLOG_FORMAT = STATEMENT;
2907+
2908+### Starting master-bin.000019
2909 FLUSH LOGS;
2910+
2911 CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
2912 SET @a_real = rand(20) * 1000;
2913 SET @an_int = 1000;
2914 SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
2915 SET @a_string = 'Just a test';
2916 INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
2917+
2918+### Starting master-bin.000020
2919 FLUSH LOGS;
2920+
2921 query_vertical SELECT * FROM t1;
2922 DROP TABLE t1;
2923
2924@@ -357,6 +413,7 @@
2925
2926 RESET MASTER;
2927 FLUSH LOGS;
2928+
2929 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
2930 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2931 eval SELECT
2932--- a/mysql-test/t/mysqlbinlog2.test
2933+++ b/mysql-test/t/mysqlbinlog2.test
2934@@ -3,7 +3,7 @@
2935
2936 # TODO: Need to look at making row based version once new binlog client is complete.
2937 -- source include/have_binlog_format_mixed_or_statement.inc
2938-
2939+-- source include/binlog_start_pos.inc
2940
2941 --disable_warnings
2942 drop table if exists t1;
2943@@ -50,15 +50,19 @@
2944 --disable_query_log
2945 select "--- start-position --" as "";
2946 --enable_query_log
2947---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
2948+let $start_pos= `select @binlog_start_pos + 502`;
2949+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
2950 --disable_query_log
2951 select "--- stop-position --" as "";
2952 --enable_query_log
2953---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
2954+let $stop_pos= `select @binlog_start_pos + 502`;
2955+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
2956 --disable_query_log
2957 select "--- start and stop positions ---" as "";
2958 --enable_query_log
2959---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
2960+let $start_pos= `select @binlog_start_pos + 502`;
2961+let $stop_pos= `select @binlog_start_pos + 619`;
2962+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos $MYSQLD_DATADIR/master-bin.000001
2963 --disable_query_log
2964 select "--- start-datetime --" as "";
2965 --enable_query_log
2966@@ -84,11 +88,13 @@
2967 --disable_query_log
2968 select "--- start-position --" as "";
2969 --enable_query_log
2970---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2971+let $start_pos= `select @binlog_start_pos + 502`;
2972+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2973 --disable_query_log
2974 select "--- stop-position --" as "";
2975 --enable_query_log
2976---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2977+let $stop_pos= `select @binlog_start_pos + 28`;
2978+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2979 --disable_query_log
2980 select "--- start-datetime --" as "";
2981 --enable_query_log
2982@@ -111,15 +117,19 @@
2983 --disable_query_log
2984 select "--- start-position --" as "";
2985 --enable_query_log
2986---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2987+let $start_pos= `select @binlog_start_pos + 502`;
2988+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2989 --disable_query_log
2990 select "--- stop-position --" as "";
2991 --enable_query_log
2992---exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2993+let $stop_pos= `select @binlog_start_pos + 502`;
2994+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2995 --disable_query_log
2996 select "--- start and stop positions ---" as "";
2997 --enable_query_log
2998---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
2999+let $start_pos= `select @binlog_start_pos + 502`;
3000+let $stop_pos= `select @binlog_start_pos + 619`;
3001+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
3002 --disable_query_log
3003 select "--- start-datetime --" as "";
3004 --enable_query_log
3005@@ -142,11 +152,13 @@
3006 --disable_query_log
3007 select "--- start-position --" as "";
3008 --enable_query_log
3009---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
3010+let $start_pos= `select @binlog_start_pos + 502`;
3011+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
3012 --disable_query_log
3013 select "--- stop-position --" as "";
3014 --enable_query_log
3015---exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
3016+let $stop_pos= `select @binlog_start_pos + 28`;
3017+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
3018 --disable_query_log
3019 select "--- start-datetime --" as "";
3020 --enable_query_log
218--- a/sql/handler.cc3021--- a/sql/handler.cc
219+++ b/sql/handler.cc3022+++ b/sql/handler.cc
220@@ -4625,7 +4625,8 @@3023@@ -4625,7 +4625,8 @@
@@ -237,19 +3040,20 @@
237 for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )3040 for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )
238 {3041 {
239 MYSQL_LOCK const *const lock= locks[i];3042 MYSQL_LOCK const *const lock= locks[i];
240@@ -4679,7 +4683,8 @@3043@@ -4679,7 +4683,9 @@
241 check_table_binlog_row_based(thd, table))3044 check_table_binlog_row_based(thd, table))
242 {3045 {
243 int const has_trans= table->file->has_transactions();3046 int const has_trans= table->file->has_transactions();
244- int const error= thd->binlog_write_table_map(table, has_trans);3047- int const error= thd->binlog_write_table_map(table, has_trans);
245+ int const error= thd->binlog_write_table_map(table, has_trans,3048+ int const error= thd->binlog_write_table_map(table,
3049+ has_trans,
246+ &with_annotate);3050+ &with_annotate);
247 /*3051 /*
248 If an error occurs, it is the responsibility of the caller to3052 If an error occurs, it is the responsibility of the caller to
249 roll back the transaction.3053 roll back the transaction.
250--- a/sql/log.cc3054--- a/sql/log.cc
251+++ b/sql/log.cc3055+++ b/sql/log.cc
252@@ -4296,10 +4296,12 @@3056@@ -4296,10 +4296,13 @@
253 3057
254 3058
255 /*3059 /*
@@ -259,12 +3063,13 @@
259 */3063 */
260 3064
261-int THD::binlog_write_table_map(TABLE *table, bool is_trans)3065-int THD::binlog_write_table_map(TABLE *table, bool is_trans)
262+int THD::binlog_write_table_map(TABLE *table, bool is_trans,3066+int THD::binlog_write_table_map(TABLE* table,
263+ my_bool *with_annotate)3067+ bool is_trans,
3068+ my_bool* with_annotate)
264 {3069 {
265 int error;3070 int error;
266 DBUG_ENTER("THD::binlog_write_table_map");3071 DBUG_ENTER("THD::binlog_write_table_map");
267@@ -4317,7 +4319,7 @@3072@@ -4317,7 +4320,7 @@
268 if (is_trans && binlog_table_maps == 0)3073 if (is_trans && binlog_table_maps == 0)
269 binlog_start_trans_and_stmt();3074 binlog_start_trans_and_stmt();
270 3075
@@ -273,7 +3078,7 @@
273 DBUG_RETURN(error);3078 DBUG_RETURN(error);
274 3079
275 binlog_table_maps++;3080 binlog_table_maps++;
276@@ -4447,10 +4449,12 @@3081@@ -4447,10 +4450,12 @@
277 }3082 }
278 3083
279 /**3084 /**
@@ -288,7 +3093,7 @@
288 {3093 {
289 THD *thd= event_info->thd;3094 THD *thd= event_info->thd;
290 bool error= 1;3095 bool error= 1;
291@@ -4631,6 +4635,16 @@3096@@ -4631,6 +4636,16 @@
292 }3097 }
293 }3098 }
294 3099
@@ -305,6 +3110,18 @@
305 /*3110 /*
306 Write the SQL command3111 Write the SQL command
307 */3112 */
3113--- a/sql/log.h
3114+++ b/sql/log.h
3115@@ -359,7 +359,8 @@
3116 int new_file();
3117
3118 void reset_gathered_updates(THD *thd);
3119- bool write(Log_event* event_info); // binary log write
3120+ bool write(Log_event* event_info,
3121+ my_bool* with_annotate= 0); // binary log write
3122 bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
3123
3124 bool write_incident(THD *thd, bool lock);
308--- a/sql/log_event.cc3125--- a/sql/log_event.cc
309+++ b/sql/log_event.cc3126+++ b/sql/log_event.cc
310@@ -656,6 +656,7 @@3127@@ -656,6 +656,7 @@
@@ -405,7 +3222,7 @@
405 load_header_len + header_len :3222 load_header_len + header_len :
406 (fake_base ? (header_len+load_header_len) :3223 (fake_base ? (header_len+load_header_len) :
407 (header_len+load_header_len) +3224 (header_len+load_header_len) +
408@@ -7960,6 +7971,141 @@3225@@ -7960,6 +7971,140 @@
409 #endif3226 #endif
410 3227
411 /**************************************************************************3228 /**************************************************************************
@@ -462,9 +3279,8 @@
462+{ 3279+{
463+ return 0;3280+ return 0;
464+}3281+}
465+#endif3282+
466+3283+
467+#ifndef MYSQL_CLIENT
468+bool Annotate_rows_log_event::write_data_body(IO_CACHE *file)3284+bool Annotate_rows_log_event::write_data_body(IO_CACHE *file)
469+{3285+{
470+ return my_b_safe_write(file, (uchar*) m_query_txt, m_query_len);3286+ return my_b_safe_write(file, (uchar*) m_query_txt, m_query_len);
@@ -488,9 +3304,9 @@
488+ print_header(&pinfo->head_cache, pinfo, TRUE);3304+ print_header(&pinfo->head_cache, pinfo, TRUE);
489+ my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n");3305+ my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n");
490+3306+
491+ char *pbeg; // beginning of the next line3307+ char *pbeg; // beginning of the next line
492+ char *pend; // end of the next line3308+ char *pend; // end of the next line
493+ uint cnt= 0; // characters counter3309+ uint cnt= 0; // characters counter
494+3310+
495+ for (pbeg= m_query_txt; ; pbeg= pend)3311+ for (pbeg= m_query_txt; ; pbeg= pend)
496+ {3312+ {
@@ -507,12 +3323,12 @@
507+ // find end of the next line3323+ // find end of the next line
508+ for (pend= pbeg + 1;3324+ for (pend= pbeg + 1;
509+ ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';3325+ ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
510+ pend++) ;3326+ pend++) {};
511+3327+
512+ // print next line3328+ // print next line
513+ my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);3329+ my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);
514+ my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg);3330+ my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg);
515+ my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1);3331+ my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1);
516+ }3332+ }
517+}3333+}
518+#endif3334+#endif
@@ -633,18 +3449,20 @@
633 @class Table_map_log_event3449 @class Table_map_log_event
634 3450
635 In row-based mode, every row operation event is preceded by a3451 In row-based mode, every row operation event is preceded by a
636--- a/sql/log.h3452--- a/sql/mysql_priv.h
637+++ b/sql/log.h3453+++ b/sql/mysql_priv.h
638@@ -359,7 +359,8 @@3454@@ -615,7 +615,11 @@
639 int new_file();3455 /* BINLOG_DUMP options */
640 3456
641 void reset_gathered_updates(THD *thd);3457 #define BINLOG_DUMP_NON_BLOCK 1
642- bool write(Log_event* event_info); // binary log write3458+#endif /* !MYSQL_CLIENT */
643+ bool write(Log_event* event_info,3459
644+ my_bool *with_annotate= 0); // binary log write3460+#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2
645 bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);3461+
646 3462+#ifndef MYSQL_CLIENT
647 bool write_incident(THD *thd, bool lock);3463 /* sql_show.cc:show_log_files() */
3464 #define SHOW_LOG_STATUS_FREE "FREE"
3465 #define SHOW_LOG_STATUS_INUSE "IN USE"
648--- a/sql/mysqld.cc3466--- a/sql/mysqld.cc
649+++ b/sql/mysqld.cc3467+++ b/sql/mysqld.cc
650@@ -504,6 +504,7 @@3468@@ -504,6 +504,7 @@
@@ -683,20 +3501,6 @@
683 {"binlog-do-db", OPT_BINLOG_DO_DB,3501 {"binlog-do-db", OPT_BINLOG_DO_DB,
684 "Tells the master it should log updates for the specified database, "3502 "Tells the master it should log updates for the specified database, "
685 "and exclude all others not explicitly mentioned.",3503 "and exclude all others not explicitly mentioned.",
686--- a/sql/mysql_priv.h
687+++ b/sql/mysql_priv.h
688@@ -615,7 +615,11 @@
689 /* BINLOG_DUMP options */
690
691 #define BINLOG_DUMP_NON_BLOCK 1
692+#endif /* !MYSQL_CLIENT */
693
694+#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2
695+
696+#ifndef MYSQL_CLIENT
697 /* sql_show.cc:show_log_files() */
698 #define SHOW_LOG_STATUS_FREE "FREE"
699 #define SHOW_LOG_STATUS_INUSE "IN USE"
700--- a/sql/rpl_rli.cc3504--- a/sql/rpl_rli.cc
701+++ b/sql/rpl_rli.cc3505+++ b/sql/rpl_rli.cc
702@@ -45,7 +45,8 @@3506@@ -45,7 +45,8 @@
@@ -731,7 +3535,7 @@
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches