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

Proposed by Oleg Tsarev
Status: Superseded
Proposed branch: lp:~tsarev/percona-server/18205_03_wl47.patch
Merge into: lp:percona-server/rnt-5.1
Prerequisite: lp:~tsarev/percona-server/18205_01_mysqlbinlog_fix.patch
Diff against target: 4640 lines (+2883/-1372)
2 files modified
patches/mysql-test-rnt.diff (+12/-1240)
patches/wl47.patch (+2871/-132)
To merge this branch: bzr merge lp:~tsarev/percona-server/18205_03_wl47.patch
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Information
Oleg Tsarev (community) Needs Resubmitting
Review via email: mp+91608@code.launchpad.net

This proposal supersedes a proposal from 2012-01-30.

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

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 : Posted in a previous version of this proposal

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
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Lines 4293--4925: no need to change it.
Lines 4311--4315: likewise.
Lines 4351--4354: unmentioned functionality change?
Lines 4404--4407: no need to change it.
Lines 4374--4378: unmentioned functinality change?
Lines 4415--4440: likewise.
Lines 4448--4461: likewise.
Lines 4469--4470: no need to change it.
Lines 4478--4479: likewise.
Lines 4485--4486: I think the "before" code is actually correct. The
guidelines don't mention it, but there is an example there with it.
Lines 4587--4591: no need to change it.
Line 4617: one space after "=" (no need to align rvalues in this case)

review: Needs Fixing
Revision history for this message
Oleg Tsarev (tsarev) wrote :

> Lines 4293--4925: no need to change it.
> Lines 4311--4315: likewise.

From my point of view more readable, but ok

> Lines 4351--4354: unmentioned functionality change?

See 4346--4357

> Lines 4404--4407: no need to change it.

I aligned agument of calls for this three functions for better readability

> Lines 4374--4378: unmentioned functinality change?

This is:
#define MYSQL_CLIENT
...
#endif // removed
// removed
#define MYSQL_CLIENT // removed
....

> Lines 4415--4440: likewise.

See Lines 4351--4354 and 4448--4461

> Lines 4448--4461: likewise.

See 4427--4440

> Lines 4469--4470: no need to change it.
> Lines 4478--4479: likewise.

According to MySQL Coding Guidelines I aligned right part of assigments. Do you need exact link and quote?

Quote:
http://forge.mysql.com/wiki/MySQL_Internals_Coding_Guidelines#Indentation_and_Spacing
When assigning to a variable, put zero spaces after the target variable name, then the assignment operator ('=' '+=' etc.), then space(s). For single assignments, there should be only one space after the equal sign. For multiple assignments, add additional spaces so that the source values line up. For example:

> Lines 4485--4486: I think the "before" code is actually correct. The
guidelines don't mention it, but there is an example there with it.
> Line 4617: one space after "=" (no need to align rvalues in this case)

Sorry, incorrectly understood part of Coding Guidelines. Will fix it.

review: Needs Resubmitting
Revision history for this message
Oleg Tsarev (tsarev) wrote :

Sorry, I forgot remove question about quote and link :)

Will insert link & quote later and forgot remove q

:)

Revision history for this message
Oleg Tsarev (tsarev) wrote :

> Sorry, I forgot remove question about quote and link :)
>
> Will insert link & quote later and forgot remove q

I inserted
>
> :)

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Yes, you are right on aligning assignment rvalues.

I still don't follow the code changes. They are not code fixes to fix formating and they are not described in the commit.

review: Needs Information
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

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 06:00:16 +0000
+++ patches/mysql-test-rnt.diff 2012-02-08 08:50:23 +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,69 +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@@ -255,6 +257,7 @@
1590 ROLLBACK /* added by mysqlbinlog */;
1591 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1592 drop table t1,t2;
1593+SET @@global.max_binlog_size= @save_binlog_size;
1594 flush logs;
1595 flush logs;
1596 select * from t5 /* must be (1),(1) */;
1597@@ -377,14 +380,14 @@
1598 /*!*/;
1599 SET TIMESTAMP=1000000000/*!*/;
1600 SET @@session.collation_database=7/*!*/;
1601-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`)
1602+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`)
1603 /*!*/;
1604 SET TIMESTAMP=1000000000/*!*/;
1605 SET @@session.collation_database=DEFAULT/*!*/;
1606-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`)
1607+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`)
1608 /*!*/;
1609 SET TIMESTAMP=1000000000/*!*/;
1610-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`)
1611+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`)
1612 /*!*/;
1613 SET TIMESTAMP=1000000000/*!*/;
1614 drop table t1
1615--- /dev/null1311--- /dev/null
1616+++ b/mysql-test/r/percona_fast_alter_column.result1312+++ b/mysql-test/r/percona_fast_alter_column.result
1617@@ -0,0 +1,47 @@1313@@ -0,0 +1,47 @@
@@ -1778,75 +1474,6 @@
1778+DEFAULT(t2)1474+DEFAULT(t2)
1779+0000-00-00 00:00:001475+0000-00-00 00:00:00
1780+DROP TABLE test;1476+DROP TABLE test;
1781--- /dev/null
1782+++ b/mysql-test/std_data/words3.dat
1783@@ -0,0 +1,66 @@
1784+Aarhus
1785+Aaron
1786+Ababa
1787+aback
1788+abaft
1789+abandon
1790+abandoned
1791+abandoning
1792+abandonment
1793+abandons
1794+Aarhus
1795+Aaron
1796+Ababa
1797+aback
1798+abaft
1799+abandon
1800+abandoned
1801+abandoning
1802+abandonment
1803+abandons
1804+abase
1805+abased
1806+abasement
1807+abasements
1808+abases
1809+abash
1810+abashed
1811+abashes
1812+abashing
1813+abasing
1814+abate
1815+abated
1816+abatement
1817+abatements
1818+abater
1819+abates
1820+abating
1821+Abba
1822+abbe
1823+abbey
1824+abbeys
1825+abbot
1826+abbots
1827+Abbott
1828+abbreviate
1829+abbreviated
1830+abbreviates
1831+abbreviating
1832+abbreviation
1833+abbreviations
1834+Abby
1835+abdomen
1836+abdomens
1837+abdominal
1838+abduct
1839+abducted
1840+abduction
1841+abductions
1842+abductor
1843+abductors
1844+abducts
1845+Abe
1846+abed
1847+Abel
1848+Abelian
1849+Abelson
1850--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result1477--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
1851+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result1478+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
1852@@ -93,6 +93,7 @@1479@@ -93,6 +93,7 @@
@@ -1857,26 +1484,6 @@
1857 #1484 #
1858 # Bug #54393: crash and/or valgrind errors in 1485 # Bug #54393: crash and/or valgrind errors in
1859 # mysql_client_binlog_statement1486 # mysql_client_binlog_statement
1860--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
1861+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
1862@@ -331,7 +331,7 @@
1863 master-bin.000001 # Query # # use `test`; insert into t1 values( 243 )
1864 master-bin.000001 # Query # # use `test`; insert into t1 values( 242 )
1865 master-bin.000001 # Query # # use `test`; insert into t1 values( 241 )
1866-master-bin.000001 # Query # # use `test`; insert into t1 values( 240 )
1867+master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
1868 master-bin.000001 # Query # # use `test`; insert into t1 values( 239 )
1869 master-bin.000001 # Query # # use `test`; insert into t1 values( 238 )
1870 master-bin.000001 # Query # # use `test`; insert into t1 values( 237 )
1871@@ -465,7 +465,7 @@
1872 master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
1873 master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
1874 master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
1875-master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
1876+master-bin.000001 # Query # # use `test`; insert into t1 values( 106 )
1877 master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
1878 master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
1879 master-bin.000001 # Query # # use `test`; insert into t1 values( 103 )
1880--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test1487--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
1881+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test1488+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
1882@@ -153,6 +153,7 @@1489@@ -153,6 +153,7 @@
@@ -1887,258 +1494,6 @@
1887 1494
1888 --echo #1495 --echo #
1889 --echo # Bug #54393: crash and/or valgrind errors in 1496 --echo # Bug #54393: crash and/or valgrind errors in
1890--- a/mysql-test/suite/binlog/t/binlog_incident.test
1891+++ b/mysql-test/suite/binlog/t/binlog_incident.test
1892@@ -4,6 +4,7 @@
1893
1894 source include/have_log_bin.inc;
1895 source include/have_debug.inc;
1896+source include/binlog_start_pos.inc;
1897
1898 let $MYSQLD_DATADIR= `select @@datadir`;
1899 RESET MASTER;
1900@@ -20,7 +21,7 @@
1901 DROP TABLE t1;
1902 FLUSH LOGS;
1903
1904-exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1905+exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1906 --disable_query_log
1907 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;
1908 --enable_query_log
1909--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
1910+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
1911@@ -1,5 +1,6 @@
1912 -- source include/have_debug.inc
1913 -- source include/have_binlog_format_statement.inc
1914+-- source include/binlog_start_pos.inc
1915 #
1916 # bug#27571 asynchronous setting mysql_$query()'s local error and
1917 # Query_log_event::error_code
1918@@ -24,7 +25,7 @@
1919 # for some constants like the offset of the first real event
1920 # that is different between severs versions.
1921 let $MYSQLD_DATADIR= `select @@datadir`;
1922---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1923+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1924 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1925 eval select
1926 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
1927--- a/mysql-test/suite/binlog/t/binlog_killed.test
1928+++ b/mysql-test/suite/binlog/t/binlog_killed.test
1929@@ -1,5 +1,6 @@
1930 -- source include/have_innodb.inc
1931 -- source include/have_binlog_format_statement.inc
1932+-- source include/binlog_start_pos.inc
1933
1934 # You cannot use `KILL' with the Embedded MySQL Server library,
1935 # because the embedded server merely runs inside the threads of the host
1936@@ -51,7 +52,8 @@
1937 let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
1938
1939 let $MYSQLD_DATADIR= `select @@datadir`;
1940---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
1941+let $start_pos= `select @binlog_start_pos + 28`;
1942+--exec $MYSQL_BINLOG --force-if-open --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
1943 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1944 eval select
1945 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
1946--- /dev/null
1947+++ b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt
1948@@ -0,0 +1 @@
1949+--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3
1950--- /dev/null
1951+++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test
1952@@ -0,0 +1,189 @@
1953+###############################################################################
1954+# WL47: Store in binlog text of statements that caused RBR events
1955+# new event: ANNOTATE_ROWS_EVENT
1956+# new master option: --binlog-annotate-rows-events
1957+# new mysqlbinlog option: --skip-annotate-rows-events
1958+#
1959+# Intended to test that:
1960+# *** If the --binlog-annotate-rows-events option is switched on on master
1961+# then Annotate_rows events:
1962+# - are generated;
1963+# - are genrated only once for "multi-table-maps" rbr queries;
1964+# - are not generated when the corresponding queries are filtered away;
1965+# - are generated when the corresponding queries are filtered away partialy
1966+# (e.g. in case of multi-delete).
1967+# *** Annotate_rows events are printed by mysqlbinlog started without
1968+# --skip-annotate-rows-events options both in remote and local cases.
1969+# *** Annotate_rows events are not printed by mysqlbinlog started with
1970+# --skip-annotate-rows-events options both in remote and local cases.
1971+###############################################################################
1972+
1973+--source include/have_log_bin.inc
1974+--source include/have_binlog_format_row.inc
1975+--source include/binlog_start_pos.inc
1976+
1977+--disable_query_log
1978+
1979+# Fix timestamp to avoid varying results
1980+SET timestamp=1000000000;
1981+
1982+# Delete all existing binary logs
1983+RESET MASTER;
1984+
1985+--disable_warnings
1986+DROP DATABASE IF EXISTS test1;
1987+DROP DATABASE IF EXISTS test2;
1988+DROP DATABASE IF EXISTS test3;
1989+DROP DATABASE IF EXISTS xtest1;
1990+DROP DATABASE IF EXISTS xtest2;
1991+--enable_warnings
1992+
1993+CREATE DATABASE test1;
1994+CREATE TABLE test1.t1(a int);
1995+
1996+CREATE DATABASE test2;
1997+CREATE TABLE test2.t2(a int);
1998+CREATE VIEW test2.v2 AS SELECT * FROM test2.t2;
1999+
2000+CREATE DATABASE test3;
2001+CREATE TABLE test3.t3(a int);
2002+
2003+CREATE DATABASE xtest1;
2004+CREATE TABLE xtest1.xt1(a int);
2005+
2006+CREATE DATABASE xtest2;
2007+CREATE TABLE xtest2.xt2(a int);
2008+
2009+# By default SESSION binlog_annotate_rows_events = OFF
2010+
2011+INSERT INTO test1.t1 VALUES (1), (2), (3);
2012+
2013+SET SESSION binlog_annotate_rows_events = ON;
2014+
2015+INSERT INTO test2.t2 VALUES (1), (2), (3);
2016+INSERT INTO test3.t3 VALUES (1), (2), (3);
2017+
2018+# This query generates two Table maps but the Annotate
2019+# event should appear only once before the first Table map
2020+DELETE test1.t1, test2.t2
2021+ FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2022+ WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2023+
2024+# This event should be filtered out together with Annotate event
2025+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2026+
2027+# This event should pass the filter
2028+INSERT INTO test2.v2 VALUES (1), (2), (3);
2029+
2030+# This event should pass the filter only for test2.t2 part
2031+DELETE xtest1.xt1, test2.t2
2032+ FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
2033+ WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2034+
2035+# These events should be filtered out together with Annotate events
2036+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2037+INSERT INTO xtest2.xt2 VALUES (1), (2), (3);
2038+DELETE xtest1.xt1, xtest2.xt2
2039+ FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3
2040+ WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a;
2041+
2042+FLUSH LOGS;
2043+--enable_query_log
2044+
2045+--echo #####################################################################################
2046+--echo # The following Annotate_rows events should appear below:
2047+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2048+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2049+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2050+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2051+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...>
2052+--echo #####################################################################################
2053+
2054+let $start_pos= `select @binlog_start_pos`;
2055+--replace_column 2 # 5 #
2056+--replace_result $start_pos <start_pos>
2057+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
2058+--eval show binlog events in 'master-bin.000001' from $start_pos
2059+
2060+--echo #
2061+--echo #####################################################################################
2062+--echo # mysqlbinlog
2063+--echo # The following Annotates should appear in this output:
2064+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2065+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2066+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2067+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2068+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
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 -v -v $MYSQLD_DATADIR/master-bin.000001
2074+
2075+--echo #
2076+--echo #####################################################################################
2077+--echo # mysqlbinlog --database=test1
2078+--echo # The following Annotate should appear in this output:
2079+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2080+--echo #####################################################################################
2081+
2082+let $MYSQLD_DATADIR= `select @@datadir`;
2083+--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 #/
2084+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001
2085+
2086+--echo #
2087+--echo #####################################################################################
2088+--echo # mysqlbinlog --skip-annotate-rows-events
2089+--echo # No Annotates should appear in this output
2090+--echo #####################################################################################
2091+
2092+let $MYSQLD_DATADIR= `select @@datadir`;
2093+--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 #/
2094+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v $MYSQLD_DATADIR/master-bin.000001
2095+
2096+--echo #
2097+--echo #####################################################################################
2098+--echo # mysqlbinlog --read-from-remote-server
2099+--echo # The following Annotates should appear in this output:
2100+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2101+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2102+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2103+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2104+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
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 -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2110+
2111+--echo #
2112+--echo #####################################################################################
2113+--echo # mysqlbinlog --read-from-remote-server --database=test1
2114+--echo # The following Annotate should appear in this output:
2115+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2116+--echo #####################################################################################
2117+
2118+let $MYSQLD_DATADIR= `select @@datadir`;
2119+--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 #/
2120+--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
2121+
2122+--echo #
2123+--echo #####################################################################################
2124+--echo # mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
2125+--echo # No Annotates should appear in this output
2126+--echo #####################################################################################
2127+
2128+let $MYSQLD_DATADIR= `select @@datadir`;
2129+--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 #/
2130+--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
2131+
2132+# Clean-up
2133+
2134+--disable_query_log
2135+DROP DATABASE test1;
2136+DROP DATABASE test2;
2137+DROP DATABASE test3;
2138+DROP DATABASE xtest1;
2139+DROP DATABASE xtest2;
2140+--enable_query_log
2141+
2142--- /dev/null1497--- /dev/null
2143+++ b/mysql-test/suite/rpl/r/percona_mixed_binlog_direct.result1498+++ b/mysql-test/suite/rpl/r/percona_mixed_binlog_direct.result
2144@@ -0,0 +1,1462 @@1499@@ -0,0 +1,1462 @@
@@ -6285,17 +5640,6 @@
6285 SELECT COUNT(*) FROM t1;5640 SELECT COUNT(*) FROM t1;
6286 COUNT(*)5641 COUNT(*)
6287 05642 0
6288--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
6289+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
6290@@ -21,7 +21,7 @@
6291 [on slave]
6292 ---- Wait until slave stops with an error ----
6293 include/wait_for_slave_sql_error.inc [errno=1062]
6294-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)
6295+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)
6296 call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
6297 SELECT * FROM t1;
6298 a
6299--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result5643--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
6300+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result5644+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
6301@@ -117,17 +117,17 @@5645@@ -117,17 +117,17 @@
@@ -7426,47 +6770,6 @@
7426+6770+
7427 # END 5.1 Test Case6771 # END 5.1 Test Case
7428 --source include/rpl_end.inc6772 --source include/rpl_end.inc
7429--- /dev/null
7430+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt
7431@@ -0,0 +1 @@
7432+--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
7433\ No newline at end of file
7434--- /dev/null
7435+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test
7436@@ -0,0 +1,9 @@
7437+###############################################################################
7438+# WL47: Store in binlog text of statements that caused RBR events
7439+# Wrapper for extra/rpl/rpl_row_annotate.test.
7440+# Intended to test that if the --replicate-annotate-rows-events option
7441+# is switched off on slave then Annotate_events are not reproduced.
7442+###############################################################################
7443+
7444+--source include/have_binlog_format_row.inc
7445+--source extra/rpl_tests/rpl_row_annotate.test
7446--- /dev/null
7447+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt
7448@@ -0,0 +1 @@
7449+--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
7450\ No newline at end of file
7451--- /dev/null
7452+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test
7453@@ -0,0 +1,16 @@
7454+###############################################################################
7455+# WL47: Store in binlog text of statements that caused RBR events
7456+# Wrapper for extra/rpl/rpl_row_annotate.test.
7457+# Intended to test that if the --replicate-annotate-rows-events option
7458+# is switched on on slave then Annotate_events:
7459+# - are reproduced on slave
7460+# - are reproduced only once for "multi-table-maps" rbr queries
7461+# - are not reproduced when the corresponding queries are filtered away
7462+# on replication
7463+# - are reproduced when the corresponding queries are filtered away partialy
7464+# (e.g. in case of multi-delete)
7465+# - are not generated on slave for queries that are not annotated on master.
7466+###############################################################################
7467+
7468+--source include/have_binlog_format_row.inc
7469+--source extra/rpl_tests/rpl_row_annotate.test
7470--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test6773--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
7471+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test6774+++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
7472@@ -2,6 +2,8 @@6775@@ -2,6 +2,8 @@
@@ -7491,89 +6794,6 @@
7491 --disable_warnings6794 --disable_warnings
7492 DROP TABLE IF EXISTS t1;6795 DROP TABLE IF EXISTS t1;
7493 --enable_warnings6796 --enable_warnings
7494--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
7495+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
7496@@ -1,7 +1,8 @@
7497 # depends on the binlog output
7498 -- source include/have_binlog_format_row.inc
7499+--source include/binlog_start_pos.inc
7500
7501-let $rename_event_pos= 897;
7502+let $rename_event_pos= `select @binlog_start_pos + 791`;
7503
7504 # Bug#18326: Do not lock table for writing during prepare of statement
7505 # The use of the ps protocol causes extra table maps in the binlog, so
7506--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
7507+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
7508@@ -162,15 +162,18 @@
7509
7510 remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
7511
7512+--source include/binlog_start_pos.inc
7513
7514 # this test for position option
7515-# By setting this position to 416, we should only get the create of t3
7516+# By setting this position to start_binlog_pos + 310, we should only get the create of t3
7517+let $start_pos= `select @binlog_start_pos + 310`;
7518+let $stop_pos= `select @binlog_start_pos + 463`;
7519 --disable_query_log
7520 select "--- Test 2 position test --" as "";
7521 --enable_query_log
7522 let $MYSQLD_DATADIR= `select @@datadir;`;
7523 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7524---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
7525+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
7526
7527 # These are tests for remote binlog.
7528 # They should return the same as previous test.
7529@@ -181,7 +184,7 @@
7530
7531 # This is broken now
7532 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7533---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
7534+--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
7535
7536 # This part is disabled due to bug #17654
7537
7538@@ -257,7 +260,7 @@
7539 select "--- Test 5 LOAD DATA --" as "";
7540 --enable_query_log
7541 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7542---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
7543+--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
7544
7545 # Bug#7853 (mysqlbinlog does not accept input from stdin)
7546
7547@@ -265,14 +268,17 @@
7548 select "--- Test 6 reading stdin --" as "";
7549 --enable_query_log
7550 let $MYSQLD_DATADIR= `select @@datadir;`;
7551+let $stop_pos= `select @binlog_start_pos + 463`;
7552 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7553---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
7554+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
7555
7556 --disable_query_log
7557 select "--- Test 7 reading stdin w/position --" as "";
7558 --enable_query_log
7559+let $start_pos= `select @binlog_start_pos + 310`;
7560+let $stop_pos= `select @binlog_start_pos + 463`;
7561 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7562---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
7563+--exec $MYSQL_BINLOG --short-form --position=$start_pos --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
7564
7565 # Bug#16217 (mysql client did not know how not switch its internal charset)
7566 --disable_query_log
7567--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
7568+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
7569@@ -1,5 +1,6 @@
7570 # depends on the binlog output
7571 --source include/have_binlog_format_mixed_or_statement.inc
7572+--source include/binlog_start_pos.inc
7573
7574-let $rename_event_pos= 656;
7575+let $rename_event_pos= `select @binlog_start_pos + 550`;
7576 -- source extra/rpl_tests/rpl_flsh_tbls.test
7577--- /dev/null6797--- /dev/null
7578+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test6798+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test
7579@@ -0,0 +1,75 @@6799@@ -0,0 +1,75 @@
@@ -7652,436 +6872,6 @@
7652+set global slave_type_conversions = @saved_slave_type_conversions;6872+set global slave_type_conversions = @saved_slave_type_conversions;
7653+6873+
7654+source include/rpl_end.inc;6874+source include/rpl_end.inc;
7655--- a/mysql-test/t/ctype_cp932_binlog_stm.test
7656+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
7657@@ -28,16 +28,6 @@
7658
7659 --echo End of 5.0 tests
7660
7661-#
7662-# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
7663-# Note: 364 is a magic position (found experimentally, depends on
7664-# the log's contents) that caused the server crash.
7665-
7666-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
7667-
7668---error 1220
7669-SHOW BINLOG EVENTS FROM 365;
7670-
7671 --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
7672 CREATE TABLE t1 (a varchar(16)) character set cp932;
7673 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
7674--- a/mysql-test/t/mysqlbinlog2.test
7675+++ b/mysql-test/t/mysqlbinlog2.test
7676@@ -3,7 +3,7 @@
7677
7678 # TODO: Need to look at making row based version once new binlog client is complete.
7679 -- source include/have_binlog_format_mixed_or_statement.inc
7680-
7681+-- source include/binlog_start_pos.inc
7682
7683 --disable_warnings
7684 drop table if exists t1;
7685@@ -50,15 +50,19 @@
7686 --disable_query_log
7687 select "--- start-position --" as "";
7688 --enable_query_log
7689---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
7690+let $start_pos= `select @binlog_start_pos + 502`;
7691+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
7692 --disable_query_log
7693 select "--- stop-position --" as "";
7694 --enable_query_log
7695---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
7696+let $stop_pos= `select @binlog_start_pos + 502`;
7697+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
7698 --disable_query_log
7699 select "--- start and stop positions ---" as "";
7700 --enable_query_log
7701---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
7702+let $start_pos= `select @binlog_start_pos + 502`;
7703+let $stop_pos= `select @binlog_start_pos + 619`;
7704+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos $MYSQLD_DATADIR/master-bin.000001
7705 --disable_query_log
7706 select "--- start-datetime --" as "";
7707 --enable_query_log
7708@@ -84,11 +88,13 @@
7709 --disable_query_log
7710 select "--- start-position --" as "";
7711 --enable_query_log
7712---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7713+let $start_pos= `select @binlog_start_pos + 502`;
7714+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7715 --disable_query_log
7716 select "--- stop-position --" as "";
7717 --enable_query_log
7718---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7719+let $stop_pos= `select @binlog_start_pos + 28`;
7720+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
7721 --disable_query_log
7722 select "--- start-datetime --" as "";
7723 --enable_query_log
7724@@ -111,15 +117,19 @@
7725 --disable_query_log
7726 select "--- start-position --" as "";
7727 --enable_query_log
7728---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
7729+let $start_pos= `select @binlog_start_pos + 502`;
7730+--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
7731 --disable_query_log
7732 select "--- stop-position --" as "";
7733 --enable_query_log
7734---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
7735+let $stop_pos= `select @binlog_start_pos + 502`;
7736+--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
7737 --disable_query_log
7738 select "--- start and stop positions ---" as "";
7739 --enable_query_log
7740---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
7741+let $start_pos= `select @binlog_start_pos + 502`;
7742+let $stop_pos= `select @binlog_start_pos + 619`;
7743+--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
7744 --disable_query_log
7745 select "--- start-datetime --" as "";
7746 --enable_query_log
7747@@ -142,11 +152,13 @@
7748 --disable_query_log
7749 select "--- start-position --" as "";
7750 --enable_query_log
7751---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
7752+let $start_pos= `select @binlog_start_pos + 502`;
7753+--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
7754 --disable_query_log
7755 select "--- stop-position --" as "";
7756 --enable_query_log
7757---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
7758+let $stop_pos= `select @binlog_start_pos + 28`;
7759+--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
7760 --disable_query_log
7761 select "--- start-datetime --" as "";
7762 --enable_query_log
7763--- a/mysql-test/t/mysqlbinlog-master.opt
7764+++ b/mysql-test/t/mysqlbinlog-master.opt
7765@@ -1,2 +1 @@
7766---max-binlog-size=4096
7767 --force-restart
7768--- a/mysql-test/t/mysqlbinlog.test
7769+++ b/mysql-test/t/mysqlbinlog.test
7770@@ -3,10 +3,18 @@
7771 -- source include/have_binlog_format_statement.inc
7772
7773 -- source include/have_log_bin.inc
7774+-- source include/binlog_start_pos.inc
7775
7776 # Deletes all the binary logs
7777 reset master;
7778
7779+# We need small binlog size to break the last LOAD DATA INFILE below so that
7780+# the corresponding Begin_load_query will be written to master-bin.000001
7781+# while the Execute_load_query will be written to master-bin.000002.
7782+
7783+SET @save_binlog_size= @@global.max_binlog_size;
7784+SET @@global.max_binlog_size= 4096;
7785+
7786 # we need this for getting fixed timestamps inside of this test
7787 set timestamp=1000000000;
7788
7789@@ -26,13 +34,15 @@
7790
7791 # test for load data and load data distributed among the several
7792 # files (we need to fill up first binlog)
7793-load data infile '../../std_data/words.dat' into table t1;
7794-load data infile '../../std_data/words.dat' into table t1;
7795-load data infile '../../std_data/words.dat' into table t1;
7796-load data infile '../../std_data/words.dat' into table t1;
7797-load data infile '../../std_data/words.dat' into table t1;
7798+load data infile '../../std_data/words3.dat' into table t1;
7799+load data infile '../../std_data/words3.dat' into table t1;
7800+load data infile '../../std_data/words3.dat' into table t1;
7801+load data infile '../../std_data/words3.dat' into table t1;
7802+load data infile '../../std_data/words3.dat' into table t1;
7803 # simple query to show more in second binlog
7804 insert into t1 values ("Alas");
7805+
7806+### Starting master-bin.000003
7807 flush logs;
7808
7809 # delimiters are for easier debugging in future
7810@@ -46,7 +56,7 @@
7811 #
7812 let $MYSQLD_DATADIR= `select @@datadir`;
7813 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7814---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7815+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7816 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
7817
7818 # this should not fail but shouldn't produce any working statements
7819@@ -54,7 +64,7 @@
7820 select "--- Broken LOAD DATA --" as "";
7821 --enable_query_log
7822 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7823---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7824+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7825 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
7826
7827 # this should show almost nothing
7828@@ -62,17 +72,17 @@
7829 select "--- --database --" as "";
7830 --enable_query_log
7831 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7832---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7833+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7834 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
7835
7836 # this test for position option
7837 --disable_query_log
7838 select "--- --position --" as "";
7839 --enable_query_log
7840+let $start_pos= `select @binlog_start_pos + 227`;
7841 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7842---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7843---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002
7844-
7845+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7846+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002
7847
7848 # These are tests for remote binlog.
7849 # They should return the same as previous test.
7850@@ -83,7 +93,7 @@
7851
7852 # This is broken now
7853 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7854---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7855+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7856 --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
7857
7858 # This is broken too
7859@@ -91,7 +101,7 @@
7860 select "--- Broken LOAD DATA --" as "";
7861 --enable_query_log
7862 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7863---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7864+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7865 --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
7866
7867 # And this too ! (altough it is documented)
7868@@ -99,34 +109,39 @@
7869 select "--- --database --" as "";
7870 --enable_query_log
7871 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7872---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7873+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7874 --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
7875
7876 # Strangely but this works
7877 --disable_query_log
7878 select "--- --position --" as "";
7879 --enable_query_log
7880+let $start_pos= `select @binlog_start_pos + 227`;
7881 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7882---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7883---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
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/ --read-from-remote-server --position=$start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
7886
7887 # Bug#7853 mysqlbinlog does not accept input from stdin
7888 --disable_query_log
7889 select "--- reading stdin --" as "";
7890 --enable_query_log
7891 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
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 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
7895
7896 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
7897---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7898+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7899 --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
7900 drop table t1,t2;
7901
7902+SET @@global.max_binlog_size= @save_binlog_size;
7903+
7904 #
7905 # Bug#14157 utf8 encoding in binlog without set character_set_client
7906 #
7907+### Starting master-bin.000004
7908 flush logs;
7909+
7910 --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
7911 create table if not exists t5 (a int);
7912 set names latin1;
7913@@ -140,6 +155,8 @@
7914 # resulted binlog, parly consisting of multi-byte utf8 chars,
7915 # must be digestable for both client and server. In 4.1 the client
7916 # should use default-character-set same as the server.
7917+
7918+### Starting master-bin.000005
7919 flush logs;
7920 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
7921 select * from t5 /* must be (1),(1) */;
7922@@ -150,6 +167,8 @@
7923 # Check that a dump created by mysqlbinlog reproduces
7924 # lc_time_names dependent values correctly
7925 #
7926+
7927+### Starting master-bin.000006
7928 flush logs;
7929 create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
7930 insert into t5 values (1, date_format('2001-01-01','%W'));
7931@@ -158,7 +177,10 @@
7932 set lc_time_names=en_US;
7933 insert into t5 values (3, date_format('2001-01-01','%W'));
7934 select * from t5 order by c1;
7935+
7936+### Starting master-bin.000007
7937 flush logs;
7938+
7939 drop table t5;
7940 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
7941 select * from t5 order by c1;
7942@@ -170,7 +192,10 @@
7943 --disable_warnings
7944 drop procedure if exists p1;
7945 --enable_warnings
7946+
7947+### Starting master-bin.000008
7948 flush logs;
7949+
7950 delimiter //;
7951 create procedure p1()
7952 begin
7953@@ -178,12 +203,15 @@
7954 end;
7955 //
7956 delimiter ;//
7957+
7958+### Starting master-bin.000009
7959 flush logs;
7960+
7961 call p1();
7962 drop procedure p1;
7963 --error ER_SP_DOES_NOT_EXIST
7964 call p1();
7965---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7966+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7967 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
7968 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
7969 call p1();
7970@@ -202,7 +230,9 @@
7971 # (LOAD DATA INFILE need it)
7972 #
7973
7974+### Starting master-bin.000010
7975 flush logs;
7976+
7977 create table t1 (a varchar(64) character set utf8);
7978 load data infile '../../std_data/loaddata6.dat' into table t1;
7979 set character_set_database=koi8r;
7980@@ -217,9 +247,12 @@
7981 load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
7982 select hex(a) from t1;
7983 drop table t1;
7984+
7985+### Starting master-bin.000011
7986 flush logs;
7987+
7988 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
7989---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
7990+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
7991 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
7992
7993 #
7994@@ -229,9 +262,14 @@
7995
7996 CREATE TABLE t1 (c1 CHAR(10));
7997 # we need this for getting fixed timestamps inside of this test
7998+### Starting master-bin.000012
7999 FLUSH LOGS;
8000+
8001 INSERT INTO t1 VALUES ('0123456789');
8002+
8003+### Starting master-bin.000013
8004 FLUSH LOGS;
8005+
8006 DROP TABLE t1;
8007
8008 # We create a table, patch, and load the output into it
8009@@ -257,11 +295,16 @@
8010 #
8011 # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
8012 #
8013+### Starting master-bin.000014
8014 FLUSH LOGS;
8015+
8016 CREATE TABLE t1(a INT);
8017 INSERT INTO t1 VALUES(connection_id());
8018 let $a= `SELECT a FROM t1`;
8019+
8020+### Starting master-bin.000015
8021 FLUSH LOGS;
8022+
8023 let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
8024 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
8025 DROP TABLE t1;
8026@@ -281,11 +324,12 @@
8027 exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
8028 --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
8029
8030-
8031 #
8032 # Test --disable-force-if-open and --force-if-open
8033 #
8034+### Starting master-bin.000016
8035 FLUSH LOGS;
8036+
8037 --error 1
8038 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
8039 --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
8040@@ -300,9 +344,15 @@
8041 SHOW GRANTS FOR untrusted@localhost;
8042 USE mysqltest1;
8043 CREATE TABLE t1 (a INT, b CHAR(64));
8044+
8045+### Starting master-bin.000017
8046 flush logs;
8047+
8048 INSERT INTO t1 VALUES (1,USER());
8049+
8050+### Starting master-bin.000018
8051 flush logs;
8052+
8053 echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
8054 exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
8055 connect (unsecure,localhost,untrusted,,mysqltest1);
8056@@ -326,14 +376,20 @@
8057 connection default;
8058 USE test;
8059 SET BINLOG_FORMAT = STATEMENT;
8060+
8061+### Starting master-bin.000019
8062 FLUSH LOGS;
8063+
8064 CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
8065 SET @a_real = rand(20) * 1000;
8066 SET @an_int = 1000;
8067 SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
8068 SET @a_string = 'Just a test';
8069 INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
8070+
8071+### Starting master-bin.000020
8072 FLUSH LOGS;
8073+
8074 query_vertical SELECT * FROM t1;
8075 DROP TABLE t1;
8076
8077@@ -357,6 +413,7 @@
8078
8079 RESET MASTER;
8080 FLUSH LOGS;
8081+
8082 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
8083 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
8084 eval SELECT
8085--- /dev/null6875--- /dev/null
8086+++ b/mysql-test/t/percona_fast_alter_column.test6876+++ b/mysql-test/t/percona_fast_alter_column.test
8087@@ -0,0 +1,65 @@6877@@ -0,0 +1,65 @@
@@ -8248,15 +7038,7 @@
8248+DROP TABLE test;7038+DROP TABLE test;
8249--- a/mysql-test/r/percona_server_variables_debug.result7039--- a/mysql-test/r/percona_server_variables_debug.result
8250+++ b/mysql-test/r/percona_server_variables_debug.result7040+++ b/mysql-test/r/percona_server_variables_debug.result
8251@@ -7,6 +7,7 @@7041@@ -102,6 +102,7 @@
8252 BACK_LOG
8253 BASEDIR
8254 BIG_TABLES
8255+BINLOG_ANNOTATE_ROWS_EVENTS
8256 BINLOG_CACHE_SIZE
8257 BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
8258 BINLOG_FORMAT
8259@@ -101,6 +102,7 @@
8260 INNODB_EXTRA_RSEGMENTS7042 INNODB_EXTRA_RSEGMENTS
8261 INNODB_EXTRA_UNDOSLOTS7043 INNODB_EXTRA_UNDOSLOTS
8262 INNODB_FAKE_CHANGES7044 INNODB_FAKE_CHANGES
@@ -8264,7 +7046,7 @@
8264 INNODB_FAST_CHECKSUM7046 INNODB_FAST_CHECKSUM
8265 INNODB_FAST_RECOVERY7047 INNODB_FAST_RECOVERY
8266 INNODB_FAST_SHUTDOWN7048 INNODB_FAST_SHUTDOWN
8267@@ -201,6 +203,7 @@7049@@ -202,6 +203,7 @@
8268 LOW_PRIORITY_UPDATES7050 LOW_PRIORITY_UPDATES
8269 MAX_ALLOWED_PACKET7051 MAX_ALLOWED_PACKET
8270 MAX_BINLOG_CACHE_SIZE7052 MAX_BINLOG_CACHE_SIZE
@@ -8272,16 +7054,15 @@
8272 MAX_BINLOG_SIZE7054 MAX_BINLOG_SIZE
8273 MAX_CONNECTIONS7055 MAX_CONNECTIONS
8274 MAX_CONNECT_ERRORS7056 MAX_CONNECT_ERRORS
8275@@ -273,6 +276,8 @@7057@@ -275,6 +277,7 @@
8276 RELAY_LOG_INFO_FILE
8277 RELAY_LOG_PURGE7058 RELAY_LOG_PURGE
8278 RELAY_LOG_SPACE_LIMIT7059 RELAY_LOG_SPACE_LIMIT
8279+REPLICATE_ANNOTATE_ROWS_EVENTS7060 REPLICATE_ANNOTATE_ROWS_EVENTS
8280+REPLICATION_SLAVE_SKIP_COLUMNS7061+REPLICATION_SLAVE_SKIP_COLUMNS
8281 REPORT_HOST7062 REPORT_HOST
8282 REPORT_PASSWORD7063 REPORT_PASSWORD
8283 REPORT_PORT7064 REPORT_PORT
8284@@ -291,6 +296,8 @@7065@@ -293,6 +296,8 @@
8285 SLAVE_NET_TIMEOUT7066 SLAVE_NET_TIMEOUT
8286 SLAVE_SKIP_ERRORS7067 SLAVE_SKIP_ERRORS
8287 SLAVE_TRANSACTION_RETRIES7068 SLAVE_TRANSACTION_RETRIES
@@ -8290,7 +7071,7 @@
8290 SLOW_LAUNCH_TIME7071 SLOW_LAUNCH_TIME
8291 SLOW_QUERY_LOG7072 SLOW_QUERY_LOG
8292 SLOW_QUERY_LOG_FILE7073 SLOW_QUERY_LOG_FILE
8293@@ -312,6 +319,7 @@7074@@ -314,6 +319,7 @@
8294 SQL_SAFE_UPDATES7075 SQL_SAFE_UPDATES
8295 SQL_SELECT_LIMIT7076 SQL_SELECT_LIMIT
8296 SQL_SLAVE_SKIP_COUNTER7077 SQL_SLAVE_SKIP_COUNTER
@@ -8300,15 +7081,7 @@
8300 SSL_CAPATH7081 SSL_CAPATH
8301--- a/mysql-test/r/percona_server_variables_release.result7082--- a/mysql-test/r/percona_server_variables_release.result
8302+++ b/mysql-test/r/percona_server_variables_release.result7083+++ b/mysql-test/r/percona_server_variables_release.result
8303@@ -7,6 +7,7 @@7084@@ -100,6 +100,7 @@
8304 BACK_LOG
8305 BASEDIR
8306 BIG_TABLES
8307+BINLOG_ANNOTATE_ROWS_EVENTS
8308 BINLOG_CACHE_SIZE
8309 BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
8310 BINLOG_FORMAT
8311@@ -99,6 +100,7 @@
8312 INNODB_EXTRA_RSEGMENTS7085 INNODB_EXTRA_RSEGMENTS
8313 INNODB_EXTRA_UNDOSLOTS7086 INNODB_EXTRA_UNDOSLOTS
8314 INNODB_FAKE_CHANGES7087 INNODB_FAKE_CHANGES
@@ -8316,7 +7089,7 @@
8316 INNODB_FAST_CHECKSUM7089 INNODB_FAST_CHECKSUM
8317 INNODB_FAST_RECOVERY7090 INNODB_FAST_RECOVERY
8318 INNODB_FAST_SHUTDOWN7091 INNODB_FAST_SHUTDOWN
8319@@ -199,6 +201,7 @@7092@@ -200,6 +201,7 @@
8320 LOW_PRIORITY_UPDATES7093 LOW_PRIORITY_UPDATES
8321 MAX_ALLOWED_PACKET7094 MAX_ALLOWED_PACKET
8322 MAX_BINLOG_CACHE_SIZE7095 MAX_BINLOG_CACHE_SIZE
@@ -8324,16 +7097,15 @@
8324 MAX_BINLOG_SIZE7097 MAX_BINLOG_SIZE
8325 MAX_CONNECTIONS7098 MAX_CONNECTIONS
8326 MAX_CONNECT_ERRORS7099 MAX_CONNECT_ERRORS
8327@@ -270,6 +273,8 @@7100@@ -272,6 +274,7 @@
8328 RELAY_LOG_INFO_FILE
8329 RELAY_LOG_PURGE7101 RELAY_LOG_PURGE
8330 RELAY_LOG_SPACE_LIMIT7102 RELAY_LOG_SPACE_LIMIT
8331+REPLICATE_ANNOTATE_ROWS_EVENTS7103 REPLICATE_ANNOTATE_ROWS_EVENTS
8332+REPLICATION_SLAVE_SKIP_COLUMNS7104+REPLICATION_SLAVE_SKIP_COLUMNS
8333 REPORT_HOST7105 REPORT_HOST
8334 REPORT_PASSWORD7106 REPORT_PASSWORD
8335 REPORT_PORT7107 REPORT_PORT
8336@@ -288,6 +293,8 @@7108@@ -290,6 +293,8 @@
8337 SLAVE_NET_TIMEOUT7109 SLAVE_NET_TIMEOUT
8338 SLAVE_SKIP_ERRORS7110 SLAVE_SKIP_ERRORS
8339 SLAVE_TRANSACTION_RETRIES7111 SLAVE_TRANSACTION_RETRIES
@@ -8342,7 +7114,7 @@
8342 SLOW_LAUNCH_TIME7114 SLOW_LAUNCH_TIME
8343 SLOW_QUERY_LOG7115 SLOW_QUERY_LOG
8344 SLOW_QUERY_LOG_FILE7116 SLOW_QUERY_LOG_FILE
8345@@ -309,6 +316,7 @@7117@@ -311,6 +316,7 @@
8346 SQL_SAFE_UPDATES7118 SQL_SAFE_UPDATES
8347 SQL_SELECT_LIMIT7119 SQL_SELECT_LIMIT
8348 SQL_SLAVE_SKIP_COUNTER7120 SQL_SLAVE_SKIP_COUNTER
83497121
=== modified file 'patches/wl47.patch'
--- patches/wl47.patch 2012-01-31 08:05:03 +0000
+++ patches/wl47.patch 2012-02-08 08:50:23 +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,5 +1034,12 @@119@@ -965,6 +1043,13 @@
120 destroy_evt= FALSE;120 destroy_evt= FALSE;
121 goto end;121 goto end;
122 }122 }
@@ -129,7 +129,8 @@
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(),131 const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(),
132@@ -992,6 +1077,13 @@132 &len_to);
133@@ -1002,6 +1087,13 @@
133 if (print_event_info->m_table_map_ignored.count() > 0)134 if (print_event_info->m_table_map_ignored.count() > 0)
134 print_event_info->m_table_map_ignored.clear_tables();135 print_event_info->m_table_map_ignored.clear_tables();
135 136
@@ -143,7 +144,7 @@
143 /* 144 /*
144 One needs to take into account an event that gets145 One needs to take into account an event that gets
145 filtered but was last event in the statement. If this is146 filtered but was last event in the statement. If this is
146@@ -1227,6 +1319,11 @@147@@ -1239,6 +1331,11 @@
147 "Updates to a database with a different name than the original. \148 "Updates to a database with a different name than the original. \
148 Example: rewrite-db='from->to'.",149 Example: rewrite-db='from->to'.",
149 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},
@@ -155,7 +156,7 @@
155 {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}
156 };157 };
157 158
158@@ -1695,6 +1792,8 @@159@@ -1707,6 +1804,8 @@
159 cast to uint32.160 cast to uint32.
160 */161 */
161 int4store(buf, (uint32)start_position);162 int4store(buf, (uint32)start_position);
@@ -164,7 +165,7 @@
164 int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);165 int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
165 166
166 size_t tlen = strlen(logname);167 size_t tlen = strlen(logname);
167@@ -1727,18 +1826,30 @@168@@ -1739,18 +1838,30 @@
168 break; // end of data169 break; // end of data
169 DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",170 DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
170 len, net->read_pos[5]));171 len, net->read_pos[5]));
@@ -206,7 +207,7 @@
206 207
207 Log_event_type type= ev->get_type_code();208 Log_event_type type= ev->get_type_code();
208 if (glob_description_event->binlog_version >= 3 ||209 if (glob_description_event->binlog_version >= 3 ||
209@@ -2247,6 +2358,7 @@210@@ -2259,6 +2370,7 @@
210 if (result_file != stdout)211 if (result_file != stdout)
211 my_fclose(result_file, MYF(0));212 my_fclose(result_file, MYF(0));
212 cleanup();213 cleanup();
@@ -214,6 +215,2809 @@
214 delete binlog_filter;215 delete binlog_filter;
215 free_root(&s_mem_root, MYF(0));216 free_root(&s_mem_root, MYF(0));
216 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
217--- a/sql/handler.cc3021--- a/sql/handler.cc
218+++ b/sql/handler.cc3022+++ b/sql/handler.cc
219@@ -4625,7 +4625,8 @@3023@@ -4625,7 +4625,8 @@
@@ -258,12 +3062,12 @@
258 */3062 */
259 3063
260-int THD::binlog_write_table_map(TABLE *table, bool is_trans)3064-int THD::binlog_write_table_map(TABLE *table, bool is_trans)
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+ my_bool *with_annotate)3066+ my_bool* with_annotate)
263 {3067 {
264 int error;3068 int error;
265 DBUG_ENTER("THD::binlog_write_table_map");3069 DBUG_ENTER("THD::binlog_write_table_map");
266@@ -4317,7 +4319,7 @@3070@@ -4317,7 +4320,7 @@
267 if (is_trans && binlog_table_maps == 0)3071 if (is_trans && binlog_table_maps == 0)
268 binlog_start_trans_and_stmt();3072 binlog_start_trans_and_stmt();
269 3073
@@ -272,7 +3076,7 @@
272 DBUG_RETURN(error);3076 DBUG_RETURN(error);
273 3077
274 binlog_table_maps++;3078 binlog_table_maps++;
275@@ -4447,10 +4449,12 @@3079@@ -4447,10 +4450,12 @@
276 }3080 }
277 3081
278 /**3082 /**
@@ -287,7 +3091,7 @@
287 {3091 {
288 THD *thd= event_info->thd;3092 THD *thd= event_info->thd;
289 bool error= 1;3093 bool error= 1;
290@@ -4631,6 +4635,16 @@3094@@ -4631,6 +4636,16 @@
291 }3095 }
292 }3096 }
293 3097
@@ -304,6 +3108,18 @@
304 /*3108 /*
305 Write the SQL command3109 Write the SQL command
306 */3110 */
3111--- a/sql/log.h
3112+++ b/sql/log.h
3113@@ -359,7 +359,8 @@
3114 int new_file();
3115
3116 void reset_gathered_updates(THD *thd);
3117- bool write(Log_event* event_info); // binary log write
3118+ bool write(Log_event* event_info,
3119+ my_bool* with_annotate= 0); // binary log write
3120 bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
3121
3122 bool write_incident(THD *thd, bool lock);
307--- a/sql/log_event.cc3123--- a/sql/log_event.cc
308+++ b/sql/log_event.cc3124+++ b/sql/log_event.cc
309@@ -656,6 +656,7 @@3125@@ -656,6 +656,7 @@
@@ -487,9 +3303,9 @@
487+ print_header(&pinfo->head_cache, pinfo, TRUE);3303+ print_header(&pinfo->head_cache, pinfo, TRUE);
488+ my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n");3304+ my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n");
489+3305+
490+ char *pbeg; // beginning of the next line3306+ char *pbeg; // beginning of the next line
491+ char *pend; // end of the next line3307+ char *pend; // end of the next line
492+ uint cnt= 0; // characters counter3308+ uint cnt= 0; // characters counter
493+3309+
494+ for (pbeg= m_query_txt; ; pbeg= pend)3310+ for (pbeg= m_query_txt; ; pbeg= pend)
495+ {3311+ {
@@ -506,7 +3322,7 @@
506+ // find end of the next line3322+ // find end of the next line
507+ for (pend= pbeg + 1;3323+ for (pend= pbeg + 1;
508+ ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';3324+ ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
509+ pend++) ;3325+ pend++) {};
510+3326+
511+ // print next line3327+ // print next line
512+ my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);3328+ my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);
@@ -632,18 +3448,20 @@
632 @class Table_map_log_event3448 @class Table_map_log_event
633 3449
634 In row-based mode, every row operation event is preceded by a3450 In row-based mode, every row operation event is preceded by a
635--- a/sql/log.h3451--- a/sql/mysql_priv.h
636+++ b/sql/log.h3452+++ b/sql/mysql_priv.h
637@@ -359,7 +359,8 @@3453@@ -615,7 +615,11 @@
638 int new_file();3454 /* BINLOG_DUMP options */
639 3455
640 void reset_gathered_updates(THD *thd);3456 #define BINLOG_DUMP_NON_BLOCK 1
641- bool write(Log_event* event_info); // binary log write3457+#endif /* !MYSQL_CLIENT */
642+ bool write(Log_event* event_info,3458
643+ my_bool *with_annotate= 0); // binary log write3459+#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2
644 bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);3460+
645 3461+#ifndef MYSQL_CLIENT
646 bool write_incident(THD *thd, bool lock);3462 /* sql_show.cc:show_log_files() */
3463 #define SHOW_LOG_STATUS_FREE "FREE"
3464 #define SHOW_LOG_STATUS_INUSE "IN USE"
647--- a/sql/mysqld.cc3465--- a/sql/mysqld.cc
648+++ b/sql/mysqld.cc3466+++ b/sql/mysqld.cc
649@@ -504,6 +504,7 @@3467@@ -504,6 +504,7 @@
@@ -682,20 +3500,6 @@
682 {"binlog-do-db", OPT_BINLOG_DO_DB,3500 {"binlog-do-db", OPT_BINLOG_DO_DB,
683 "Tells the master it should log updates for the specified database, "3501 "Tells the master it should log updates for the specified database, "
684 "and exclude all others not explicitly mentioned.",3502 "and exclude all others not explicitly mentioned.",
685--- a/sql/mysql_priv.h
686+++ b/sql/mysql_priv.h
687@@ -615,7 +615,11 @@
688 /* BINLOG_DUMP options */
689
690 #define BINLOG_DUMP_NON_BLOCK 1
691+#endif /* !MYSQL_CLIENT */
692
693+#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2
694+
695+#ifndef MYSQL_CLIENT
696 /* sql_show.cc:show_log_files() */
697 #define SHOW_LOG_STATUS_FREE "FREE"
698 #define SHOW_LOG_STATUS_INUSE "IN USE"
699--- a/sql/rpl_rli.cc3503--- a/sql/rpl_rli.cc
700+++ b/sql/rpl_rli.cc3504+++ b/sql/rpl_rli.cc
701@@ -45,7 +45,8 @@3505@@ -45,7 +45,8 @@
@@ -730,7 +3534,7 @@
730+ inline void set_annotate_event(Annotate_rows_log_event *event)3534+ inline void set_annotate_event(Annotate_rows_log_event *event)
731+ {3535+ {
732+ free_annotate_event();3536+ free_annotate_event();
733+ m_annotate_event= event;3537+ m_annotate_event= event;
734+ sql_thd->variables.binlog_annotate_rows_events= 1;3538+ sql_thd->variables.binlog_annotate_rows_events= 1;
735+ }3539+ }
736+3540+
@@ -755,7 +3559,7 @@
755+ {3559+ {
756+ sql_thd->variables.binlog_annotate_rows_events= 0;3560+ sql_thd->variables.binlog_annotate_rows_events= 0;
757+ delete m_annotate_event;3561+ delete m_annotate_event;
758+ m_annotate_event= 0;3562+ m_annotate_event= 0;
759+ }3563+ }
760+ }3564+ }
761+3565+
@@ -773,7 +3577,7 @@
773 static sys_var_const_os_str sys_basedir(&vars, "basedir", mysql_home);3577 static sys_var_const_os_str sys_basedir(&vars, "basedir", mysql_home);
774+static sys_var_thd_bool3578+static sys_var_thd_bool
775+sys_binlog_annotate_rows_events(&vars, "binlog_annotate_rows_events",3579+sys_binlog_annotate_rows_events(&vars, "binlog_annotate_rows_events",
776+ &SV::binlog_annotate_rows_events);3580+ &SV::binlog_annotate_rows_events);
777 static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",3581 static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
778 &binlog_cache_size);3582 &binlog_cache_size);
779 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",3583 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
@@ -789,7 +3593,7 @@
789 // TODO if big log files: Change next to int8store()3593 // TODO if big log files: Change next to int8store()
790 int4store(buf, (ulong) mi->master_log_pos);3594 int4store(buf, (ulong) mi->master_log_pos);
791 int2store(buf + 4, binlog_flags);3595 int2store(buf + 4, binlog_flags);
792@@ -2311,17 +2314,41 @@3596@@ -2311,15 +2314,39 @@
793 }3597 }
794 exec_res= apply_event_and_update_pos(ev, thd, rli);3598 exec_res= apply_event_and_update_pos(ev, thd, rli);
795 3599
@@ -802,7 +3606,8 @@
802- {3606- {
803- DBUG_PRINT("info", ("Deleting the event after it has been executed"));3607- DBUG_PRINT("info", ("Deleting the event after it has been executed"));
804- delete ev;3608- delete ev;
805+ switch (ev->get_type_code()) {3609+ switch (ev->get_type_code())
3610+ {
806+ case FORMAT_DESCRIPTION_EVENT:3611+ case FORMAT_DESCRIPTION_EVENT:
807+ /*3612+ /*
808+ Format_description_log_event should not be deleted because it3613+ Format_description_log_event should not be deleted because it
@@ -836,11 +3641,8 @@
836+ break;3641+ break;
837 }3642 }
838 3643
839+
840 /*3644 /*
841 update_log_pos failed: this should not happen, so we don't3645@@ -2947,6 +2973,12 @@
842 retry.
843@@ -2947,6 +2974,12 @@
844 thd->init_for_queries();3646 thd->init_for_queries();
845 thd->temporary_tables = rli->save_temporary_tables; // restore temp tables3647 thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
846 set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables3648 set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
@@ -853,7 +3655,7 @@
853 pthread_mutex_lock(&LOCK_thread_count);3655 pthread_mutex_lock(&LOCK_thread_count);
854 threads.append(thd);3656 threads.append(thd);
855 pthread_mutex_unlock(&LOCK_thread_count);3657 pthread_mutex_unlock(&LOCK_thread_count);
856@@ -3429,7 +3462,7 @@3658@@ -3429,7 +3461,7 @@
857 If we get Load event, we need to pass a non-reusable buffer3659 If we get Load event, we need to pass a non-reusable buffer
858 to read_log_event, so we do a trick3660 to read_log_event, so we do a trick
859 */3661 */
@@ -862,7 +3664,7 @@
862 {3664 {
863 if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))3665 if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
864 {3666 {
865@@ -3629,6 +3662,7 @@3667@@ -3629,6 +3661,7 @@
866 {3668 {
867 int error= 0;3669 int error= 0;
868 ulong inc_pos;3670 ulong inc_pos;
@@ -870,7 +3672,7 @@
870 Relay_log_info *rli= &mi->rli;3672 Relay_log_info *rli= &mi->rli;
871 pthread_mutex_t *log_lock= rli->relay_log.get_log_lock();3673 pthread_mutex_t *log_lock= rli->relay_log.get_log_lock();
872 DBUG_ENTER("queue_event");3674 DBUG_ENTER("queue_event");
873@@ -3636,13 +3670,15 @@3675@@ -3636,13 +3669,16 @@
874 LINT_INIT(inc_pos);3676 LINT_INIT(inc_pos);
875 3677
876 if (mi->rli.relay_log.description_event_for_queue->binlog_version<4 &&3678 if (mi->rli.relay_log.description_event_for_queue->binlog_version<4 &&
@@ -884,7 +3686,8 @@
884- switch (buf[EVENT_TYPE_OFFSET]) {3686- switch (buf[EVENT_TYPE_OFFSET]) {
885+ new_pos= uint4korr(buf+LOG_POS_OFFSET);3687+ new_pos= uint4korr(buf+LOG_POS_OFFSET);
886+3688+
887+ switch ((uchar)buf[EVENT_TYPE_OFFSET]) {3689+ switch ((uchar)buf[EVENT_TYPE_OFFSET])
3690+ {
888 case STOP_EVENT:3691 case STOP_EVENT:
889 /*3692 /*
890 We needn't write this event to the relay log. Indeed, it just indicates a3693 We needn't write this event to the relay log. Indeed, it just indicates a
@@ -944,7 +3747,7 @@
944 if (!have_fd_event)3747 if (!have_fd_event)
945 {3748 {
946- int type = bufptr[EVENT_TYPE_OFFSET];3749- int type = bufptr[EVENT_TYPE_OFFSET];
947+ int type = (uchar)bufptr[EVENT_TYPE_OFFSET];3750+ int type= (uchar)bufptr[EVENT_TYPE_OFFSET];
948 if (type == FORMAT_DESCRIPTION_EVENT || type == START_EVENT_V3)3751 if (type == FORMAT_DESCRIPTION_EVENT || type == START_EVENT_V3)
949 have_fd_event= TRUE;3752 have_fd_event= TRUE;
950 else3753 else
@@ -958,13 +3761,14 @@
958 my_bool binlog_direct_non_trans_update;3761 my_bool binlog_direct_non_trans_update;
959 /*3762 /*
960 In slave thread we need to know in behalf of which3763 In slave thread we need to know in behalf of which
961@@ -1565,7 +1566,8 @@3764@@ -1565,7 +1566,9 @@
962 */3765 */
963 void binlog_start_trans_and_stmt();3766 void binlog_start_trans_and_stmt();
964 void binlog_set_stmt_begin();3767 void binlog_set_stmt_begin();
965- int binlog_write_table_map(TABLE *table, bool is_transactional);3768- int binlog_write_table_map(TABLE *table, bool is_transactional);
966+ int binlog_write_table_map(TABLE *table, bool is_transactional,3769+ int binlog_write_table_map(TABLE* table,
967+ my_bool *with_annotate= 0);3770+ bool is_transactional,
3771+ my_bool* with_annotate= 0);
968 int binlog_write_row(TABLE* table, bool is_transactional,3772 int binlog_write_row(TABLE* table, bool is_transactional,
969 MY_BITMAP const* cols, size_t colcnt,3773 MY_BITMAP const* cols, size_t colcnt,
970 const uchar *buf);3774 const uchar *buf);
@@ -1018,7 +3822,7 @@
1018- }3822- }
1019+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))3823+ if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
1020+ {3824+ {
1021+ errmsg = "Failed on my_net_write()";3825+ errmsg= "Failed on my_net_write()";
1022+ my_errno= ER_UNKNOWN_ERROR;3826+ my_errno= ER_UNKNOWN_ERROR;
1023+ goto err;3827+ goto err;
1024+ }3828+ }
@@ -1049,14 +3853,14 @@
1049+ });3853+ });
1050+3854+
1051+ DBUG_PRINT("info", ("log event code %d",3855+ DBUG_PRINT("info", ("log event code %d",
1052+ (*packet)[LOG_EVENT_OFFSET+1] ));3856+ (*packet)[LOG_EVENT_OFFSET+1]));
1053+ if ((uchar)(*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)3857+ if ((uchar)(*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
1054+ {3858+ {
1055+ if (send_file(thd))3859+ if (send_file(thd))
1056+ {3860+ {
1057+ errmsg = "failed in send_file()";3861+ errmsg= "failed in send_file()";
1058+ my_errno= ER_UNKNOWN_ERROR;3862+ my_errno= ER_UNKNOWN_ERROR;
1059+ goto err;3863+ goto err;
1060+ }3864+ }
1061+ }3865+ }
1062 }3866 }
@@ -1109,74 +3913,9 @@
1109 (uchar*) &opt_log_slave_updates);3913 (uchar*) &opt_log_slave_updates);
1110+static sys_var_const3914+static sys_var_const
1111+sys_replicate_annotate_rows_events(&vars,3915+sys_replicate_annotate_rows_events(&vars,
1112+ "replicate_annotate_rows_events",3916+ "replicate_annotate_rows_events",
1113+ OPT_GLOBAL, SHOW_MY_BOOL,3917+ OPT_GLOBAL, SHOW_MY_BOOL,
1114+ (uchar*) &opt_replicate_annotate_rows_events);3918+ (uchar*) &opt_replicate_annotate_rows_events);
1115 static sys_var_const sys_relay_log(&vars, "relay_log",3919 static sys_var_const sys_relay_log(&vars, "relay_log",
1116 OPT_GLOBAL, SHOW_CHAR_PTR,3920 OPT_GLOBAL, SHOW_CHAR_PTR,
1117 (uchar*) &opt_relay_logname);3921 (uchar*) &opt_relay_logname);
1118--- /dev/null
1119+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-master.opt
1120@@ -0,0 +1 @@
1121+--binlog_annotate_rows_events --replicate_annotate_rows_events
1122--- /dev/null
1123+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-slave.opt
1124@@ -0,0 +1 @@
1125+--slave_net_timeout=1 --log_slave_updates=0 --binlog_annotate_rows_events --replicate_annotate_rows_events
1126--- /dev/null
1127+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events.test
1128@@ -0,0 +1,35 @@
1129+########################################################################
1130+# Bug #872754: Annotate rows events on slave doesnt' work without slave's binlog
1131+########################################################################
1132+
1133+--source include/master-slave.inc
1134+--source include/have_binlog_format_row.inc
1135+--source include/have_debug.inc
1136+
1137+connection master;
1138+--disable_warnings
1139+DROP TABLE IF EXISTS t;
1140+--enable_warnings
1141+
1142+CREATE TABLE t (a INT);
1143+INSERT INTO t VALUES(1);
1144+
1145+--sleep 2
1146+
1147+DROP TABLE t;
1148+
1149+# The following would hang with the bug not fixed
1150+--sync_slave_with_master
1151+
1152+connection master;
1153+--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
1154+--eval select $master_log_pos
1155+
1156+connection slave;
1157+--let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
1158+--eval select $master_log_pos = $read_master_log_pos
1159+
1160+--let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
1161+--eval select $master_log_pos = $exec_master_log_pos
1162+
1163+--source include/rpl_end.inc
1164--- /dev/null
1165+++ b/mysql-test/suite/rpl/r/percona_replicate_annotate_rows_events.result
1166@@ -0,0 +1,16 @@
1167+include/master-slave.inc
1168+[connection master]
1169+DROP TABLE IF EXISTS t;
1170+CREATE TABLE t (a INT);
1171+INSERT INTO t VALUES(1);
1172+DROP TABLE t;
1173+select 738;
1174+738
1175+738
1176+select 738 = 738;
1177+738 = 738
1178+1
1179+select 738 = 738;
1180+738 = 738
1181+1
1182+include/rpl_end.inc

Subscribers

People subscribed via source and target branches