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

Proposed by Oleg Tsarev on 2012-02-13
Status: Merged
Merge reported by: Oleg Tsarev
Merged at revision: not available
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: 4605 lines (+2875/-1366)
2 files modified
patches/mysql-test-rnt.diff (+12/-1240)
patches/wl47.patch (+2863/-126)
To merge this branch: bzr merge lp:~tsarev/percona-server/18205_03_wl47.patch
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2012-02-13 Approve on 2012-02-13
Oleg Tsarev Pending
Laurynas Biveinis 2012-02-13 Pending
Review via email: mp+92706@code.launchpad.net

This proposal supersedes 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.
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
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

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
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

> 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: Resubmit
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

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

Will insert link & quote later and forgot remove q

:)

Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

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

I inserted
>
> :)

Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

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
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

> 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:

I'm sure it's meant to be applicable only to assignments in variable declarations, as the following example confirms.

Anyway, the coding guidelines may be (and often are) outdated. If you take a look at the source code (even the most recent changes), you won't see any examples of that rule being followed, even for declarations. Which is probably a hint it's not relevant anymore.

Anyway, not rule can justify abominations like this:

> -+ m_annotate_event= event;
> ++ m_annotate_event= event;
> + sql_thd->variables.binlog_annotate_rows_events= 1;

review: Needs Fixing
Oleg Tsarev (tsarev) wrote : Posted in a previous version of this proposal

Alexey,

Fixed.

> I'm sure it's meant to be applicable only to assignments in variable declarations, as the following example confirms.

I don't sure in any things last several years.
From this point of view I am looking to formal documents to understand how I should do my work.

> Anyway, the coding guidelines may be (and often are) outdated.

This is mean, we should reflect code policy changes in formal document.

Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

I still see some unnecessary alignment changes:

> -int THD::binlog_write_table_map(TABLE *table, bool is_trans)
> -+int THD::binlog_write_table_map(TABLE *table, bool is_trans,
> ++int THD::binlog_write_table_map(TABLE *table, bool is_trans,
> + my_bool *with_annotate)

and

> -+ int binlog_write_table_map(TABLE *table, bool is_transactional,
> ++ int binlog_write_table_map(TABLE *table, bool is_transactional,
> + my_bool *with_annotate= 0);

and

> -+ errmsg = "Failed on my_net_write()";
> ++ errmsg= "Failed on my_net_write()";

and

> -+ errmsg = "failed in send_file()";
> -+ my_errno= ER_UNKNOWN_ERROR;
> -+ goto err;
> ++ errmsg= "failed in send_file()";
> ++ my_errno= ER_UNKNOWN_ERROR;
> ++ goto err;

And what's the reason for this?

> @@ -506,7 +3322,7 @@
> + // find end of the next line
> + for (pend= pbeg + 1;
> + ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
> -+ pend++) ;
> ++ pend++) {};
> +
> + // print next line
> + my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);

Alexey Kopytov (akopytov) : Posted in a previous version of this proposal
review: Needs Fixing
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal

Alexey -

> > -+ errmsg = "Failed on my_net_write()";
> > ++ errmsg= "Failed on my_net_write()";

Isn't this a correct change, a space before "=" removal?

Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

On 09.02.12 8:56, Laurynas Biveinis wrote:
> Alexey -
>
>>> -+ errmsg = "Failed on my_net_write()";
>>> ++ errmsg= "Failed on my_net_write()";
>
> Isn't this a correct change, a space before "=" removal?

There were 2 spaces after '='.

Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Actually, 3, to align it with the next "my_errno=..." line.

Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/mysql-test-rnt.diff'
2--- patches/mysql-test-rnt.diff 2012-02-06 06:00:16 +0000
3+++ patches/mysql-test-rnt.diff 2012-02-13 03:48:59 +0000
4@@ -1,27 +1,3 @@
5---- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
6-+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
7-@@ -321,14 +321,19 @@
8- # we check that the error code of the "ROLLBACK" event is 0 and not
9- # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
10- # and does not make slave to stop)
11-+
12-+-- source include/binlog_start_pos.inc
13-+
14- if (`select @@binlog_format = 'ROW'`)
15- {
16-- --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
17-+ let $start_pos= `select @binlog_start_pos + 418`;
18-+ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
19- }
20-
21- if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
22- {
23-- --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
24-+ let $start_pos= `select @binlog_start_pos + 449`;
25-+ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
26- }
27-
28- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
29 --- /dev/null
30 +++ b/mysql-test/extra/rpl_tests/check_type.inc
31 @@ -0,0 +1,52 @@
32@@ -259,16 +235,6 @@
33 --let $slave_skip_counter= 2
34 --let $show_slave_sql_error= 1
35 --source include/wait_for_slave_sql_error_and_skip.inc
36---- a/mysql-test/extra/rpl_tests/rpl_log.test
37-+++ b/mysql-test/extra/rpl_tests/rpl_log.test
38-@@ -14,6 +14,7 @@
39- reset master;
40- reset slave;
41- source include/start_slave.inc;
42-+source include/binlog_start_pos.inc;
43-
44- let $VERSION=`select version()`;
45-
46 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
47 +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
48 @@ -532,6 +532,16 @@
49@@ -288,165 +254,6 @@
50 --disable_query_log
51 SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
52 inc $stmt_id;
53---- /dev/null
54-+++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
55-@@ -0,0 +1,156 @@
56-+########################################################################
57-+# WL47: Store in binlog text of statements that caused RBR events
58-+# new event : ANNOTATE_ROWS_EVENT
59-+# new master option : --binlog-annotate-rows-events
60-+# new slave option : --replicate-annotate-rows-events
61-+########################################################################
62-+--source include/master-slave.inc
63-+connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,);
64-+
65-+connection master;
66-+--disable_query_log
67-+
68-+--disable_warnings
69-+DROP DATABASE IF EXISTS test1;
70-+--enable_warnings
71-+
72-+CREATE DATABASE test1;
73-+USE test1;
74-+
75-+CREATE TABLE t1(a int primary key, b int);
76-+CREATE TABLE t2(a int, b int);
77-+CREATE TABLE t3(a int, b int);
78-+CREATE TABLE t4(a int, b int);
79-+CREATE TABLE xt1(a int, b int);
80-+CREATE TABLE xt2(a int, b int);
81-+
82-+CREATE TABLE t5 (
83-+ a INT PRIMARY KEY AUTO_INCREMENT,
84-+ b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
85-+);
86-+
87-+SET SESSION binlog_annotate_rows_events = OFF;
88-+
89-+INSERT INTO t1 VALUES (0,0), (1,1);
90-+
91-+SET SESSION binlog_annotate_rows_events = ON;
92-+
93-+UPDATE t1 SET b = b + 1;
94-+REPLACE t1 VALUES (1,1), (2,2), (3,3);
95-+
96-+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
97-+INSERT INTO t3 VALUES (1,1), (2,2), (3,3);
98-+DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a;
99-+
100-+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
101-+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
102-+DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a;
103-+
104-+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
105-+INSERT INTO xt2 VALUES (1,1), (2,2), (3,3);
106-+DELETE xt1, xt2 FROM xt1 INNER JOIN xt2 INNER JOIN t3 WHERE xt1.a=xt2.a AND xt2.a=t3.a;
107-+
108-+INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz');
109-+SET NAMES latin1;
110-+INSERT INTO t5(b) VALUES ('gås');
111-+SET NAMES utf8;
112-+INSERT INTO t5(b) VALUES ('gås');
113-+SET NAMES latin1;
114-+
115-+FLUSH LOGS;
116-+
117-+--echo ########################################################################
118-+--echo # TABLES ON MASTER
119-+--echo ########################################################################
120-+--enable_query_log
121-+
122-+SELECT * FROM t1 ORDER BY a;
123-+SELECT * FROM t2 ORDER BY a;
124-+SELECT * FROM t3 ORDER BY a;
125-+SELECT * FROM t5 ORDER BY a;
126-+
127-+sync_slave_with_master;
128-+--echo ########################################################################
129-+--echo # TABLES ON SLAVE: should be the same as on master
130-+--echo ########################################################################
131-+--disable_query_log
132-+USE test1;
133-+--enable_query_log
134-+
135-+SELECT * FROM t1 ORDER BY a;
136-+SELECT * FROM t2 ORDER BY a;
137-+SELECT * FROM t3 ORDER BY a;
138-+SELECT * FROM t5 ORDER BY a;
139-+
140-+--echo ########################################################################
141-+--echo # EVENTS ON SLAVE
142-+let $annotate= `select @@global.replicate_annotate_rows_events`;
143-+if ($annotate)
144-+{
145-+ --echo # The following Annotate_rows events should appear below:
146-+ --echo # - UPDATE t1 SET b = b + 1;
147-+ --echo # - REPLACE t1 VALUES (1,1), (2,2), (3,3);
148-+ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
149-+ --echo # - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
150-+ --echo # - DELETE t1, t2 FROM <...>
151-+ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
152-+ --echo # - DELETE xt1, t2 FROM <...>
153-+ --echo # - INSERT INTO t5(b) VALUES <...> (3 instances)
154-+}
155-+if (!$annotate)
156-+{
157-+ --echo # No Annotate_rows events should appear below
158-+}
159-+--echo ########################################################################
160-+FLUSH LOGS;
161-+
162-+--source include/binlog_start_pos.inc
163-+let $start_pos= `select @binlog_start_pos`;
164-+--replace_column 2 # 5 #
165-+--replace_result $start_pos <start_pos>
166-+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
167-+--eval show binlog events in 'slave-bin.000001' from $start_pos
168-+
169-+--echo #
170-+--echo ########################################################################
171-+--echo # INSERTs DELAYED ON MASTERs
172-+--echo ########################################################################
173-+connection master;
174-+SET SESSION binlog_annotate_rows_events = ON;
175-+INSERT DELAYED INTO test1.t4 VALUES (1,1);
176-+FLUSH TABLES;
177-+SELECT * FROM test1.t4 ORDER BY a;
178-+
179-+sync_slave_with_master;
180-+connection master;
181-+sync_slave_with_master;
182-+
183-+--echo ########################################################################
184-+--echo # ON SLAVE
185-+--echo # No Annotate_rows events should appear below
186-+--echo ########################################################################
187-+FLUSH LOGS;
188-+
189-+--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
190-+perl;
191-+ open F, '<', "$ENV{MYSQLTEST_VARDIR}/tmp/annotated_events.txt" or die;
192-+ binmode STDOUT;
193-+ while (defined ($_ = <F>)) {
194-+ if (/Annotate_rows/) {
195-+ s/[0-9]+\sAnnotate_rows\s[0-9]+\s[0-9]+/# Annotate_rows # #/;
196-+ print($_);
197-+ $_ = <F>;
198-+ s/[0-9]+\sTable_map\s[0-9]+\s[0-9]+\stable_id:\s[0-9]+/# Table_map # # table_id: #/;
199-+ print($_);
200-+ }
201-+ }
202-+EOF
203-+
204-+# Clean-up
205-+connection master;
206-+--disable_query_log
207-+DROP DATABASE test1;
208-+sync_slave_with_master;
209-+--enable_query_log
210-+
211-+--source include/rpl_end.inc
212 --- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
213 +++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
214 @@ -6,6 +6,10 @@
215@@ -1490,54 +1297,6 @@
216 +source include/rpl_reset.inc;
217 +enable_warnings;
218 +enable_query_log;
219---- /dev/null
220-+++ b/mysql-test/include/binlog_start_pos.inc
221-@@ -0,0 +1,26 @@
222-+##############################################################################
223-+#
224-+# binlog_start_pos is the postion of the the first event in the binary log
225-+# which follows the Format description event. Intended to reduce test suite
226-+# dependance on the Format description event length changes (e.g. in case
227-+# of adding new events). Evaluated as:
228-+#
229-+# binlog_start_pos = 4 /* binlog header */ +
230-+# (Format_description_log_event length)
231-+#
232-+# Format_description_log_event length =
233-+# 19 /* event common header */ +
234-+# 57 /* misc stuff in the Format description header */ +
235-+# number of events.
236-+#
237-+# With current number of events = 160,
238-+#
239-+# binlog_start_pos = 4 + 19 + 57 + 160 = 240.
240-+#
241-+##############################################################################
242-+
243-+let $binlog_start_pos=240;
244-+--disable_query_log
245-+SET @binlog_start_pos=240;
246-+--enable_query_log
247-+
248---- a/mysql-test/include/show_binlog_events2.inc
249-+++ b/mysql-test/include/show_binlog_events2.inc
250-@@ -1,4 +1,4 @@
251----let $binlog_start=106
252-+--let $binlog_start=240
253- --replace_result $binlog_start <binlog_start>
254- --replace_column 2 # 5 #
255- --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
256---- a/mysql-test/include/show_binlog_events.inc
257-+++ b/mysql-test/include/show_binlog_events.inc
258-@@ -3,7 +3,7 @@
259- #
260- # Useage:
261- # let $binlog_file= master-bin.000002;
262--# let $binlog_start= 106;
263-+# let $binlog_start= 240;
264- # let $binlog_limit= 1, 3;
265- # source include/show_binlog_events.inc;
266- #
267 --- a/mysql-test/include/test_fieldsize.inc
268 +++ b/mysql-test/include/test_fieldsize.inc
269 @@ -22,7 +22,7 @@
270@@ -1549,69 +1308,6 @@
271 --let $show_slave_sql_error= 1
272 --source include/wait_for_slave_sql_error.inc
273
274---- a/mysql-test/r/ctype_cp932_binlog_stm.result
275-+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
276-@@ -44,9 +44,6 @@
277- master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
278- master-bin.000001 # Query # # use `test`; DROP TABLE t4
279- End of 5.0 tests
280--call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
281--SHOW BINLOG EVENTS FROM 365;
282--ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
283- Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
284- CREATE TABLE t1 (a varchar(16)) character set cp932;
285- INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
286---- a/mysql-test/r/mysqlbinlog.result
287-+++ b/mysql-test/r/mysqlbinlog.result
288-@@ -1,15 +1,17 @@
289- reset master;
290-+SET @save_binlog_size= @@global.max_binlog_size;
291-+SET @@global.max_binlog_size= 4096;
292- set timestamp=1000000000;
293- drop table if exists t1,t2,t3,t4,t5,t03,t04;
294- create table t1 (word varchar(20));
295- create table t2 (id int auto_increment not null primary key);
296- insert into t1 values ("abirvalg");
297- insert into t2 values ();
298--load data infile '../../std_data/words.dat' into table t1;
299--load data infile '../../std_data/words.dat' into table t1;
300--load data infile '../../std_data/words.dat' into table t1;
301--load data infile '../../std_data/words.dat' into table t1;
302--load data infile '../../std_data/words.dat' into table t1;
303-+load data infile '../../std_data/words3.dat' into table t1;
304-+load data infile '../../std_data/words3.dat' into table t1;
305-+load data infile '../../std_data/words3.dat' into table t1;
306-+load data infile '../../std_data/words3.dat' into table t1;
307-+load data infile '../../std_data/words3.dat' into table t1;
308- insert into t1 values ("Alas");
309- flush logs;
310-
311-@@ -255,6 +257,7 @@
312- ROLLBACK /* added by mysqlbinlog */;
313- /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
314- drop table t1,t2;
315-+SET @@global.max_binlog_size= @save_binlog_size;
316- flush logs;
317- flush logs;
318- select * from t5 /* must be (1),(1) */;
319-@@ -377,14 +380,14 @@
320- /*!*/;
321- SET TIMESTAMP=1000000000/*!*/;
322- SET @@session.collation_database=7/*!*/;
323--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`)
324-+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`)
325- /*!*/;
326- SET TIMESTAMP=1000000000/*!*/;
327- SET @@session.collation_database=DEFAULT/*!*/;
328--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`)
329-+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`)
330- /*!*/;
331- SET TIMESTAMP=1000000000/*!*/;
332--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`)
333-+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`)
334- /*!*/;
335- SET TIMESTAMP=1000000000/*!*/;
336- drop table t1
337 --- /dev/null
338 +++ b/mysql-test/r/percona_fast_alter_column.result
339 @@ -0,0 +1,47 @@
340@@ -1778,75 +1474,6 @@
341 +DEFAULT(t2)
342 +0000-00-00 00:00:00
343 +DROP TABLE test;
344---- /dev/null
345-+++ b/mysql-test/std_data/words3.dat
346-@@ -0,0 +1,66 @@
347-+Aarhus
348-+Aaron
349-+Ababa
350-+aback
351-+abaft
352-+abandon
353-+abandoned
354-+abandoning
355-+abandonment
356-+abandons
357-+Aarhus
358-+Aaron
359-+Ababa
360-+aback
361-+abaft
362-+abandon
363-+abandoned
364-+abandoning
365-+abandonment
366-+abandons
367-+abase
368-+abased
369-+abasement
370-+abasements
371-+abases
372-+abash
373-+abashed
374-+abashes
375-+abashing
376-+abasing
377-+abate
378-+abated
379-+abatement
380-+abatements
381-+abater
382-+abates
383-+abating
384-+Abba
385-+abbe
386-+abbey
387-+abbeys
388-+abbot
389-+abbots
390-+Abbott
391-+abbreviate
392-+abbreviated
393-+abbreviates
394-+abbreviating
395-+abbreviation
396-+abbreviations
397-+Abby
398-+abdomen
399-+abdomens
400-+abdominal
401-+abduct
402-+abducted
403-+abduction
404-+abductions
405-+abductor
406-+abductors
407-+abducts
408-+Abe
409-+abed
410-+Abel
411-+Abelian
412-+Abelson
413 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
414 +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
415 @@ -93,6 +93,7 @@
416@@ -1857,26 +1484,6 @@
417 #
418 # Bug #54393: crash and/or valgrind errors in
419 # mysql_client_binlog_statement
420---- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
421-+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
422-@@ -331,7 +331,7 @@
423- master-bin.000001 # Query # # use `test`; insert into t1 values( 243 )
424- master-bin.000001 # Query # # use `test`; insert into t1 values( 242 )
425- master-bin.000001 # Query # # use `test`; insert into t1 values( 241 )
426--master-bin.000001 # Query # # use `test`; insert into t1 values( 240 )
427-+master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
428- master-bin.000001 # Query # # use `test`; insert into t1 values( 239 )
429- master-bin.000001 # Query # # use `test`; insert into t1 values( 238 )
430- master-bin.000001 # Query # # use `test`; insert into t1 values( 237 )
431-@@ -465,7 +465,7 @@
432- master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
433- master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
434- master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
435--master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
436-+master-bin.000001 # Query # # use `test`; insert into t1 values( 106 )
437- master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
438- master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
439- master-bin.000001 # Query # # use `test`; insert into t1 values( 103 )
440 --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
441 +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
442 @@ -153,6 +153,7 @@
443@@ -1887,258 +1494,6 @@
444
445 --echo #
446 --echo # Bug #54393: crash and/or valgrind errors in
447---- a/mysql-test/suite/binlog/t/binlog_incident.test
448-+++ b/mysql-test/suite/binlog/t/binlog_incident.test
449-@@ -4,6 +4,7 @@
450-
451- source include/have_log_bin.inc;
452- source include/have_debug.inc;
453-+source include/binlog_start_pos.inc;
454-
455- let $MYSQLD_DATADIR= `select @@datadir`;
456- RESET MASTER;
457-@@ -20,7 +21,7 @@
458- DROP TABLE t1;
459- FLUSH LOGS;
460-
461--exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
462-+exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
463- --disable_query_log
464- 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;
465- --enable_query_log
466---- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
467-+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
468-@@ -1,5 +1,6 @@
469- -- source include/have_debug.inc
470- -- source include/have_binlog_format_statement.inc
471-+-- source include/binlog_start_pos.inc
472- #
473- # bug#27571 asynchronous setting mysql_$query()'s local error and
474- # Query_log_event::error_code
475-@@ -24,7 +25,7 @@
476- # for some constants like the offset of the first real event
477- # that is different between severs versions.
478- let $MYSQLD_DATADIR= `select @@datadir`;
479----exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
480-+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
481- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
482- eval select
483- (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
484---- a/mysql-test/suite/binlog/t/binlog_killed.test
485-+++ b/mysql-test/suite/binlog/t/binlog_killed.test
486-@@ -1,5 +1,6 @@
487- -- source include/have_innodb.inc
488- -- source include/have_binlog_format_statement.inc
489-+-- source include/binlog_start_pos.inc
490-
491- # You cannot use `KILL' with the Embedded MySQL Server library,
492- # because the embedded server merely runs inside the threads of the host
493-@@ -51,7 +52,8 @@
494- let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
495-
496- let $MYSQLD_DATADIR= `select @@datadir`;
497----exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
498-+let $start_pos= `select @binlog_start_pos + 28`;
499-+--exec $MYSQL_BINLOG --force-if-open --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
500- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
501- eval select
502- (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
503---- /dev/null
504-+++ b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt
505-@@ -0,0 +1 @@
506-+--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3
507---- /dev/null
508-+++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test
509-@@ -0,0 +1,189 @@
510-+###############################################################################
511-+# WL47: Store in binlog text of statements that caused RBR events
512-+# new event: ANNOTATE_ROWS_EVENT
513-+# new master option: --binlog-annotate-rows-events
514-+# new mysqlbinlog option: --skip-annotate-rows-events
515-+#
516-+# Intended to test that:
517-+# *** If the --binlog-annotate-rows-events option is switched on on master
518-+# then Annotate_rows events:
519-+# - are generated;
520-+# - are genrated only once for "multi-table-maps" rbr queries;
521-+# - are not generated when the corresponding queries are filtered away;
522-+# - are generated when the corresponding queries are filtered away partialy
523-+# (e.g. in case of multi-delete).
524-+# *** Annotate_rows events are printed by mysqlbinlog started without
525-+# --skip-annotate-rows-events options both in remote and local cases.
526-+# *** Annotate_rows events are not printed by mysqlbinlog started with
527-+# --skip-annotate-rows-events options both in remote and local cases.
528-+###############################################################################
529-+
530-+--source include/have_log_bin.inc
531-+--source include/have_binlog_format_row.inc
532-+--source include/binlog_start_pos.inc
533-+
534-+--disable_query_log
535-+
536-+# Fix timestamp to avoid varying results
537-+SET timestamp=1000000000;
538-+
539-+# Delete all existing binary logs
540-+RESET MASTER;
541-+
542-+--disable_warnings
543-+DROP DATABASE IF EXISTS test1;
544-+DROP DATABASE IF EXISTS test2;
545-+DROP DATABASE IF EXISTS test3;
546-+DROP DATABASE IF EXISTS xtest1;
547-+DROP DATABASE IF EXISTS xtest2;
548-+--enable_warnings
549-+
550-+CREATE DATABASE test1;
551-+CREATE TABLE test1.t1(a int);
552-+
553-+CREATE DATABASE test2;
554-+CREATE TABLE test2.t2(a int);
555-+CREATE VIEW test2.v2 AS SELECT * FROM test2.t2;
556-+
557-+CREATE DATABASE test3;
558-+CREATE TABLE test3.t3(a int);
559-+
560-+CREATE DATABASE xtest1;
561-+CREATE TABLE xtest1.xt1(a int);
562-+
563-+CREATE DATABASE xtest2;
564-+CREATE TABLE xtest2.xt2(a int);
565-+
566-+# By default SESSION binlog_annotate_rows_events = OFF
567-+
568-+INSERT INTO test1.t1 VALUES (1), (2), (3);
569-+
570-+SET SESSION binlog_annotate_rows_events = ON;
571-+
572-+INSERT INTO test2.t2 VALUES (1), (2), (3);
573-+INSERT INTO test3.t3 VALUES (1), (2), (3);
574-+
575-+# This query generates two Table maps but the Annotate
576-+# event should appear only once before the first Table map
577-+DELETE test1.t1, test2.t2
578-+ FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
579-+ WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
580-+
581-+# This event should be filtered out together with Annotate event
582-+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
583-+
584-+# This event should pass the filter
585-+INSERT INTO test2.v2 VALUES (1), (2), (3);
586-+
587-+# This event should pass the filter only for test2.t2 part
588-+DELETE xtest1.xt1, test2.t2
589-+ FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
590-+ WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
591-+
592-+# These events should be filtered out together with Annotate events
593-+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
594-+INSERT INTO xtest2.xt2 VALUES (1), (2), (3);
595-+DELETE xtest1.xt1, xtest2.xt2
596-+ FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3
597-+ WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a;
598-+
599-+FLUSH LOGS;
600-+--enable_query_log
601-+
602-+--echo #####################################################################################
603-+--echo # The following Annotate_rows events should appear below:
604-+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
605-+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
606-+--echo # - DELETE test1.t1, test2.t2 FROM <...>
607-+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
608-+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...>
609-+--echo #####################################################################################
610-+
611-+let $start_pos= `select @binlog_start_pos`;
612-+--replace_column 2 # 5 #
613-+--replace_result $start_pos <start_pos>
614-+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
615-+--eval show binlog events in 'master-bin.000001' from $start_pos
616-+
617-+--echo #
618-+--echo #####################################################################################
619-+--echo # mysqlbinlog
620-+--echo # The following Annotates should appear in this output:
621-+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
622-+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
623-+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
624-+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
625-+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
626-+--echo #####################################################################################
627-+
628-+let $MYSQLD_DATADIR= `select @@datadir`;
629-+--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 #/
630-+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
631-+
632-+--echo #
633-+--echo #####################################################################################
634-+--echo # mysqlbinlog --database=test1
635-+--echo # The following Annotate should appear in this output:
636-+--echo # - DELETE test1.t1, test2.t2 FROM <...>
637-+--echo #####################################################################################
638-+
639-+let $MYSQLD_DATADIR= `select @@datadir`;
640-+--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 #/
641-+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001
642-+
643-+--echo #
644-+--echo #####################################################################################
645-+--echo # mysqlbinlog --skip-annotate-rows-events
646-+--echo # No Annotates should appear in this output
647-+--echo #####################################################################################
648-+
649-+let $MYSQLD_DATADIR= `select @@datadir`;
650-+--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 #/
651-+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v $MYSQLD_DATADIR/master-bin.000001
652-+
653-+--echo #
654-+--echo #####################################################################################
655-+--echo # mysqlbinlog --read-from-remote-server
656-+--echo # The following Annotates should appear in this output:
657-+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
658-+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
659-+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
660-+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
661-+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
662-+--echo #####################################################################################
663-+
664-+let $MYSQLD_DATADIR= `select @@datadir`;
665-+--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 #/
666-+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
667-+
668-+--echo #
669-+--echo #####################################################################################
670-+--echo # mysqlbinlog --read-from-remote-server --database=test1
671-+--echo # The following Annotate should appear in this output:
672-+--echo # - DELETE test1.t1, test2.t2 FROM <...>
673-+--echo #####################################################################################
674-+
675-+let $MYSQLD_DATADIR= `select @@datadir`;
676-+--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 #/
677-+--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
678-+
679-+--echo #
680-+--echo #####################################################################################
681-+--echo # mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
682-+--echo # No Annotates should appear in this output
683-+--echo #####################################################################################
684-+
685-+let $MYSQLD_DATADIR= `select @@datadir`;
686-+--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 #/
687-+--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
688-+
689-+# Clean-up
690-+
691-+--disable_query_log
692-+DROP DATABASE test1;
693-+DROP DATABASE test2;
694-+DROP DATABASE test3;
695-+DROP DATABASE xtest1;
696-+DROP DATABASE xtest2;
697-+--enable_query_log
698-+
699 --- /dev/null
700 +++ b/mysql-test/suite/rpl/r/percona_mixed_binlog_direct.result
701 @@ -0,0 +1,1462 @@
702@@ -6285,17 +5640,6 @@
703 SELECT COUNT(*) FROM t1;
704 COUNT(*)
705 0
706---- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
707-+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
708-@@ -21,7 +21,7 @@
709- [on slave]
710- ---- Wait until slave stops with an error ----
711- include/wait_for_slave_sql_error.inc [errno=1062]
712--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)
713-+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)
714- call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
715- SELECT * FROM t1;
716- a
717 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
718 +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
719 @@ -117,17 +117,17 @@
720@@ -7426,47 +6770,6 @@
721 +
722 # END 5.1 Test Case
723 --source include/rpl_end.inc
724---- /dev/null
725-+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt
726-@@ -0,0 +1 @@
727-+--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
728-\ No newline at end of file
729---- /dev/null
730-+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test
731-@@ -0,0 +1,9 @@
732-+###############################################################################
733-+# WL47: Store in binlog text of statements that caused RBR events
734-+# Wrapper for extra/rpl/rpl_row_annotate.test.
735-+# Intended to test that if the --replicate-annotate-rows-events option
736-+# is switched off on slave then Annotate_events are not reproduced.
737-+###############################################################################
738-+
739-+--source include/have_binlog_format_row.inc
740-+--source extra/rpl_tests/rpl_row_annotate.test
741---- /dev/null
742-+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt
743-@@ -0,0 +1 @@
744-+--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
745-\ No newline at end of file
746---- /dev/null
747-+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test
748-@@ -0,0 +1,16 @@
749-+###############################################################################
750-+# WL47: Store in binlog text of statements that caused RBR events
751-+# Wrapper for extra/rpl/rpl_row_annotate.test.
752-+# Intended to test that if the --replicate-annotate-rows-events option
753-+# is switched on on slave then Annotate_events:
754-+# - are reproduced on slave
755-+# - are reproduced only once for "multi-table-maps" rbr queries
756-+# - are not reproduced when the corresponding queries are filtered away
757-+# on replication
758-+# - are reproduced when the corresponding queries are filtered away partialy
759-+# (e.g. in case of multi-delete)
760-+# - are not generated on slave for queries that are not annotated on master.
761-+###############################################################################
762-+
763-+--source include/have_binlog_format_row.inc
764-+--source extra/rpl_tests/rpl_row_annotate.test
765 --- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
766 +++ b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test
767 @@ -2,6 +2,8 @@
768@@ -7491,89 +6794,6 @@
769 --disable_warnings
770 DROP TABLE IF EXISTS t1;
771 --enable_warnings
772---- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
773-+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
774-@@ -1,7 +1,8 @@
775- # depends on the binlog output
776- -- source include/have_binlog_format_row.inc
777-+--source include/binlog_start_pos.inc
778-
779--let $rename_event_pos= 897;
780-+let $rename_event_pos= `select @binlog_start_pos + 791`;
781-
782- # Bug#18326: Do not lock table for writing during prepare of statement
783- # The use of the ps protocol causes extra table maps in the binlog, so
784---- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
785-+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
786-@@ -162,15 +162,18 @@
787-
788- remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
789-
790-+--source include/binlog_start_pos.inc
791-
792- # this test for position option
793--# By setting this position to 416, we should only get the create of t3
794-+# By setting this position to start_binlog_pos + 310, we should only get the create of t3
795-+let $start_pos= `select @binlog_start_pos + 310`;
796-+let $stop_pos= `select @binlog_start_pos + 463`;
797- --disable_query_log
798- select "--- Test 2 position test --" as "";
799- --enable_query_log
800- let $MYSQLD_DATADIR= `select @@datadir;`;
801- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
802----exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
803-+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
804-
805- # These are tests for remote binlog.
806- # They should return the same as previous test.
807-@@ -181,7 +184,7 @@
808-
809- # This is broken now
810- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
811----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
812-+--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
813-
814- # This part is disabled due to bug #17654
815-
816-@@ -257,7 +260,7 @@
817- select "--- Test 5 LOAD DATA --" as "";
818- --enable_query_log
819- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
820----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
821-+--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
822-
823- # Bug#7853 (mysqlbinlog does not accept input from stdin)
824-
825-@@ -265,14 +268,17 @@
826- select "--- Test 6 reading stdin --" as "";
827- --enable_query_log
828- let $MYSQLD_DATADIR= `select @@datadir;`;
829-+let $stop_pos= `select @binlog_start_pos + 463`;
830- --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
831----exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
832-+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
833-
834- --disable_query_log
835- select "--- Test 7 reading stdin w/position --" as "";
836- --enable_query_log
837-+let $start_pos= `select @binlog_start_pos + 310`;
838-+let $stop_pos= `select @binlog_start_pos + 463`;
839- --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
840----exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
841-+--exec $MYSQL_BINLOG --short-form --position=$start_pos --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
842-
843- # Bug#16217 (mysql client did not know how not switch its internal charset)
844- --disable_query_log
845---- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
846-+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
847-@@ -1,5 +1,6 @@
848- # depends on the binlog output
849- --source include/have_binlog_format_mixed_or_statement.inc
850-+--source include/binlog_start_pos.inc
851-
852--let $rename_event_pos= 656;
853-+let $rename_event_pos= `select @binlog_start_pos + 550`;
854- -- source extra/rpl_tests/rpl_flsh_tbls.test
855 --- /dev/null
856 +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test
857 @@ -0,0 +1,75 @@
858@@ -7652,436 +6872,6 @@
859 +set global slave_type_conversions = @saved_slave_type_conversions;
860 +
861 +source include/rpl_end.inc;
862---- a/mysql-test/t/ctype_cp932_binlog_stm.test
863-+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
864-@@ -28,16 +28,6 @@
865-
866- --echo End of 5.0 tests
867-
868--#
869--# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
870--# Note: 364 is a magic position (found experimentally, depends on
871--# the log's contents) that caused the server crash.
872--
873--call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
874--
875----error 1220
876--SHOW BINLOG EVENTS FROM 365;
877--
878- --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
879- CREATE TABLE t1 (a varchar(16)) character set cp932;
880- INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
881---- a/mysql-test/t/mysqlbinlog2.test
882-+++ b/mysql-test/t/mysqlbinlog2.test
883-@@ -3,7 +3,7 @@
884-
885- # TODO: Need to look at making row based version once new binlog client is complete.
886- -- source include/have_binlog_format_mixed_or_statement.inc
887--
888-+-- source include/binlog_start_pos.inc
889-
890- --disable_warnings
891- drop table if exists t1;
892-@@ -50,15 +50,19 @@
893- --disable_query_log
894- select "--- start-position --" as "";
895- --enable_query_log
896----exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
897-+let $start_pos= `select @binlog_start_pos + 502`;
898-+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
899- --disable_query_log
900- select "--- stop-position --" as "";
901- --enable_query_log
902----exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
903-+let $stop_pos= `select @binlog_start_pos + 502`;
904-+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
905- --disable_query_log
906- select "--- start and stop positions ---" as "";
907- --enable_query_log
908----exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
909-+let $start_pos= `select @binlog_start_pos + 502`;
910-+let $stop_pos= `select @binlog_start_pos + 619`;
911-+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos $MYSQLD_DATADIR/master-bin.000001
912- --disable_query_log
913- select "--- start-datetime --" as "";
914- --enable_query_log
915-@@ -84,11 +88,13 @@
916- --disable_query_log
917- select "--- start-position --" as "";
918- --enable_query_log
919----exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
920-+let $start_pos= `select @binlog_start_pos + 502`;
921-+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
922- --disable_query_log
923- select "--- stop-position --" as "";
924- --enable_query_log
925----exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
926-+let $stop_pos= `select @binlog_start_pos + 28`;
927-+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
928- --disable_query_log
929- select "--- start-datetime --" as "";
930- --enable_query_log
931-@@ -111,15 +117,19 @@
932- --disable_query_log
933- select "--- start-position --" as "";
934- --enable_query_log
935----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
936-+let $start_pos= `select @binlog_start_pos + 502`;
937-+--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
938- --disable_query_log
939- select "--- stop-position --" as "";
940- --enable_query_log
941----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
942-+let $stop_pos= `select @binlog_start_pos + 502`;
943-+--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
944- --disable_query_log
945- select "--- start and stop positions ---" as "";
946- --enable_query_log
947----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
948-+let $start_pos= `select @binlog_start_pos + 502`;
949-+let $stop_pos= `select @binlog_start_pos + 619`;
950-+--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
951- --disable_query_log
952- select "--- start-datetime --" as "";
953- --enable_query_log
954-@@ -142,11 +152,13 @@
955- --disable_query_log
956- select "--- start-position --" as "";
957- --enable_query_log
958----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
959-+let $start_pos= `select @binlog_start_pos + 502`;
960-+--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
961- --disable_query_log
962- select "--- stop-position --" as "";
963- --enable_query_log
964----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
965-+let $stop_pos= `select @binlog_start_pos + 28`;
966-+--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
967- --disable_query_log
968- select "--- start-datetime --" as "";
969- --enable_query_log
970---- a/mysql-test/t/mysqlbinlog-master.opt
971-+++ b/mysql-test/t/mysqlbinlog-master.opt
972-@@ -1,2 +1 @@
973----max-binlog-size=4096
974- --force-restart
975---- a/mysql-test/t/mysqlbinlog.test
976-+++ b/mysql-test/t/mysqlbinlog.test
977-@@ -3,10 +3,18 @@
978- -- source include/have_binlog_format_statement.inc
979-
980- -- source include/have_log_bin.inc
981-+-- source include/binlog_start_pos.inc
982-
983- # Deletes all the binary logs
984- reset master;
985-
986-+# We need small binlog size to break the last LOAD DATA INFILE below so that
987-+# the corresponding Begin_load_query will be written to master-bin.000001
988-+# while the Execute_load_query will be written to master-bin.000002.
989-+
990-+SET @save_binlog_size= @@global.max_binlog_size;
991-+SET @@global.max_binlog_size= 4096;
992-+
993- # we need this for getting fixed timestamps inside of this test
994- set timestamp=1000000000;
995-
996-@@ -26,13 +34,15 @@
997-
998- # test for load data and load data distributed among the several
999- # files (we need to fill up first binlog)
1000--load data infile '../../std_data/words.dat' into table t1;
1001--load data infile '../../std_data/words.dat' into table t1;
1002--load data infile '../../std_data/words.dat' into table t1;
1003--load data infile '../../std_data/words.dat' into table t1;
1004--load data infile '../../std_data/words.dat' into table t1;
1005-+load data infile '../../std_data/words3.dat' into table t1;
1006-+load data infile '../../std_data/words3.dat' into table t1;
1007-+load data infile '../../std_data/words3.dat' into table t1;
1008-+load data infile '../../std_data/words3.dat' into table t1;
1009-+load data infile '../../std_data/words3.dat' into table t1;
1010- # simple query to show more in second binlog
1011- insert into t1 values ("Alas");
1012-+
1013-+### Starting master-bin.000003
1014- flush logs;
1015-
1016- # delimiters are for easier debugging in future
1017-@@ -46,7 +56,7 @@
1018- #
1019- let $MYSQLD_DATADIR= `select @@datadir`;
1020- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1021----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1022-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1023- --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
1024-
1025- # this should not fail but shouldn't produce any working statements
1026-@@ -54,7 +64,7 @@
1027- select "--- Broken LOAD DATA --" as "";
1028- --enable_query_log
1029- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1030----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1031-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1032- --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
1033-
1034- # this should show almost nothing
1035-@@ -62,17 +72,17 @@
1036- select "--- --database --" as "";
1037- --enable_query_log
1038- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1039----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1040-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1041- --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
1042-
1043- # this test for position option
1044- --disable_query_log
1045- select "--- --position --" as "";
1046- --enable_query_log
1047-+let $start_pos= `select @binlog_start_pos + 227`;
1048- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1049----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1050----exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002
1051--
1052-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1053-+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002
1054-
1055- # These are tests for remote binlog.
1056- # They should return the same as previous test.
1057-@@ -83,7 +93,7 @@
1058-
1059- # This is broken now
1060- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1061----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1062-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1063- --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
1064-
1065- # This is broken too
1066-@@ -91,7 +101,7 @@
1067- select "--- Broken LOAD DATA --" as "";
1068- --enable_query_log
1069- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1070----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1071-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1072- --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
1073-
1074- # And this too ! (altough it is documented)
1075-@@ -99,34 +109,39 @@
1076- select "--- --database --" as "";
1077- --enable_query_log
1078- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1079----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1080-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1081- --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
1082-
1083- # Strangely but this works
1084- --disable_query_log
1085- select "--- --position --" as "";
1086- --enable_query_log
1087-+let $start_pos= `select @binlog_start_pos + 227`;
1088- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1089----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1090----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
1091-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1092-+--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
1093-
1094- # Bug#7853 mysqlbinlog does not accept input from stdin
1095- --disable_query_log
1096- select "--- reading stdin --" as "";
1097- --enable_query_log
1098- --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
1099----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1100-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1101- --exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
1102-
1103- --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
1104----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1105-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1106- --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
1107- drop table t1,t2;
1108-
1109-+SET @@global.max_binlog_size= @save_binlog_size;
1110-+
1111- #
1112- # Bug#14157 utf8 encoding in binlog without set character_set_client
1113- #
1114-+### Starting master-bin.000004
1115- flush logs;
1116-+
1117- --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
1118- create table if not exists t5 (a int);
1119- set names latin1;
1120-@@ -140,6 +155,8 @@
1121- # resulted binlog, parly consisting of multi-byte utf8 chars,
1122- # must be digestable for both client and server. In 4.1 the client
1123- # should use default-character-set same as the server.
1124-+
1125-+### Starting master-bin.000005
1126- flush logs;
1127- --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
1128- select * from t5 /* must be (1),(1) */;
1129-@@ -150,6 +167,8 @@
1130- # Check that a dump created by mysqlbinlog reproduces
1131- # lc_time_names dependent values correctly
1132- #
1133-+
1134-+### Starting master-bin.000006
1135- flush logs;
1136- create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
1137- insert into t5 values (1, date_format('2001-01-01','%W'));
1138-@@ -158,7 +177,10 @@
1139- set lc_time_names=en_US;
1140- insert into t5 values (3, date_format('2001-01-01','%W'));
1141- select * from t5 order by c1;
1142-+
1143-+### Starting master-bin.000007
1144- flush logs;
1145-+
1146- drop table t5;
1147- --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
1148- select * from t5 order by c1;
1149-@@ -170,7 +192,10 @@
1150- --disable_warnings
1151- drop procedure if exists p1;
1152- --enable_warnings
1153-+
1154-+### Starting master-bin.000008
1155- flush logs;
1156-+
1157- delimiter //;
1158- create procedure p1()
1159- begin
1160-@@ -178,12 +203,15 @@
1161- end;
1162- //
1163- delimiter ;//
1164-+
1165-+### Starting master-bin.000009
1166- flush logs;
1167-+
1168- call p1();
1169- drop procedure p1;
1170- --error ER_SP_DOES_NOT_EXIST
1171- call p1();
1172----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1173-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1174- --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
1175- --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
1176- call p1();
1177-@@ -202,7 +230,9 @@
1178- # (LOAD DATA INFILE need it)
1179- #
1180-
1181-+### Starting master-bin.000010
1182- flush logs;
1183-+
1184- create table t1 (a varchar(64) character set utf8);
1185- load data infile '../../std_data/loaddata6.dat' into table t1;
1186- set character_set_database=koi8r;
1187-@@ -217,9 +247,12 @@
1188- load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
1189- select hex(a) from t1;
1190- drop table t1;
1191-+
1192-+### Starting master-bin.000011
1193- flush logs;
1194-+
1195- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1196----replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
1197-+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
1198- --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
1199-
1200- #
1201-@@ -229,9 +262,14 @@
1202-
1203- CREATE TABLE t1 (c1 CHAR(10));
1204- # we need this for getting fixed timestamps inside of this test
1205-+### Starting master-bin.000012
1206- FLUSH LOGS;
1207-+
1208- INSERT INTO t1 VALUES ('0123456789');
1209-+
1210-+### Starting master-bin.000013
1211- FLUSH LOGS;
1212-+
1213- DROP TABLE t1;
1214-
1215- # We create a table, patch, and load the output into it
1216-@@ -257,11 +295,16 @@
1217- #
1218- # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
1219- #
1220-+### Starting master-bin.000014
1221- FLUSH LOGS;
1222-+
1223- CREATE TABLE t1(a INT);
1224- INSERT INTO t1 VALUES(connection_id());
1225- let $a= `SELECT a FROM t1`;
1226-+
1227-+### Starting master-bin.000015
1228- FLUSH LOGS;
1229-+
1230- let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
1231- --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
1232- DROP TABLE t1;
1233-@@ -281,11 +324,12 @@
1234- exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
1235- --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
1236-
1237--
1238- #
1239- # Test --disable-force-if-open and --force-if-open
1240- #
1241-+### Starting master-bin.000016
1242- FLUSH LOGS;
1243-+
1244- --error 1
1245- --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
1246- --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
1247-@@ -300,9 +344,15 @@
1248- SHOW GRANTS FOR untrusted@localhost;
1249- USE mysqltest1;
1250- CREATE TABLE t1 (a INT, b CHAR(64));
1251-+
1252-+### Starting master-bin.000017
1253- flush logs;
1254-+
1255- INSERT INTO t1 VALUES (1,USER());
1256-+
1257-+### Starting master-bin.000018
1258- flush logs;
1259-+
1260- echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
1261- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
1262- connect (unsecure,localhost,untrusted,,mysqltest1);
1263-@@ -326,14 +376,20 @@
1264- connection default;
1265- USE test;
1266- SET BINLOG_FORMAT = STATEMENT;
1267-+
1268-+### Starting master-bin.000019
1269- FLUSH LOGS;
1270-+
1271- CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
1272- SET @a_real = rand(20) * 1000;
1273- SET @an_int = 1000;
1274- SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
1275- SET @a_string = 'Just a test';
1276- INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
1277-+
1278-+### Starting master-bin.000020
1279- FLUSH LOGS;
1280-+
1281- query_vertical SELECT * FROM t1;
1282- DROP TABLE t1;
1283-
1284-@@ -357,6 +413,7 @@
1285-
1286- RESET MASTER;
1287- FLUSH LOGS;
1288-+
1289- --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
1290- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1291- eval SELECT
1292 --- /dev/null
1293 +++ b/mysql-test/t/percona_fast_alter_column.test
1294 @@ -0,0 +1,65 @@
1295@@ -8248,15 +7038,7 @@
1296 +DROP TABLE test;
1297 --- a/mysql-test/r/percona_server_variables_debug.result
1298 +++ b/mysql-test/r/percona_server_variables_debug.result
1299-@@ -7,6 +7,7 @@
1300- BACK_LOG
1301- BASEDIR
1302- BIG_TABLES
1303-+BINLOG_ANNOTATE_ROWS_EVENTS
1304- BINLOG_CACHE_SIZE
1305- BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
1306- BINLOG_FORMAT
1307-@@ -101,6 +102,7 @@
1308+@@ -102,6 +102,7 @@
1309 INNODB_EXTRA_RSEGMENTS
1310 INNODB_EXTRA_UNDOSLOTS
1311 INNODB_FAKE_CHANGES
1312@@ -8264,7 +7046,7 @@
1313 INNODB_FAST_CHECKSUM
1314 INNODB_FAST_RECOVERY
1315 INNODB_FAST_SHUTDOWN
1316-@@ -201,6 +203,7 @@
1317+@@ -202,6 +203,7 @@
1318 LOW_PRIORITY_UPDATES
1319 MAX_ALLOWED_PACKET
1320 MAX_BINLOG_CACHE_SIZE
1321@@ -8272,16 +7054,15 @@
1322 MAX_BINLOG_SIZE
1323 MAX_CONNECTIONS
1324 MAX_CONNECT_ERRORS
1325-@@ -273,6 +276,8 @@
1326- RELAY_LOG_INFO_FILE
1327+@@ -275,6 +277,7 @@
1328 RELAY_LOG_PURGE
1329 RELAY_LOG_SPACE_LIMIT
1330-+REPLICATE_ANNOTATE_ROWS_EVENTS
1331+ REPLICATE_ANNOTATE_ROWS_EVENTS
1332 +REPLICATION_SLAVE_SKIP_COLUMNS
1333 REPORT_HOST
1334 REPORT_PASSWORD
1335 REPORT_PORT
1336-@@ -291,6 +296,8 @@
1337+@@ -293,6 +296,8 @@
1338 SLAVE_NET_TIMEOUT
1339 SLAVE_SKIP_ERRORS
1340 SLAVE_TRANSACTION_RETRIES
1341@@ -8290,7 +7071,7 @@
1342 SLOW_LAUNCH_TIME
1343 SLOW_QUERY_LOG
1344 SLOW_QUERY_LOG_FILE
1345-@@ -312,6 +319,7 @@
1346+@@ -314,6 +319,7 @@
1347 SQL_SAFE_UPDATES
1348 SQL_SELECT_LIMIT
1349 SQL_SLAVE_SKIP_COUNTER
1350@@ -8300,15 +7081,7 @@
1351 SSL_CAPATH
1352 --- a/mysql-test/r/percona_server_variables_release.result
1353 +++ b/mysql-test/r/percona_server_variables_release.result
1354-@@ -7,6 +7,7 @@
1355- BACK_LOG
1356- BASEDIR
1357- BIG_TABLES
1358-+BINLOG_ANNOTATE_ROWS_EVENTS
1359- BINLOG_CACHE_SIZE
1360- BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
1361- BINLOG_FORMAT
1362-@@ -99,6 +100,7 @@
1363+@@ -100,6 +100,7 @@
1364 INNODB_EXTRA_RSEGMENTS
1365 INNODB_EXTRA_UNDOSLOTS
1366 INNODB_FAKE_CHANGES
1367@@ -8316,7 +7089,7 @@
1368 INNODB_FAST_CHECKSUM
1369 INNODB_FAST_RECOVERY
1370 INNODB_FAST_SHUTDOWN
1371-@@ -199,6 +201,7 @@
1372+@@ -200,6 +201,7 @@
1373 LOW_PRIORITY_UPDATES
1374 MAX_ALLOWED_PACKET
1375 MAX_BINLOG_CACHE_SIZE
1376@@ -8324,16 +7097,15 @@
1377 MAX_BINLOG_SIZE
1378 MAX_CONNECTIONS
1379 MAX_CONNECT_ERRORS
1380-@@ -270,6 +273,8 @@
1381- RELAY_LOG_INFO_FILE
1382+@@ -272,6 +274,7 @@
1383 RELAY_LOG_PURGE
1384 RELAY_LOG_SPACE_LIMIT
1385-+REPLICATE_ANNOTATE_ROWS_EVENTS
1386+ REPLICATE_ANNOTATE_ROWS_EVENTS
1387 +REPLICATION_SLAVE_SKIP_COLUMNS
1388 REPORT_HOST
1389 REPORT_PASSWORD
1390 REPORT_PORT
1391-@@ -288,6 +293,8 @@
1392+@@ -290,6 +293,8 @@
1393 SLAVE_NET_TIMEOUT
1394 SLAVE_SKIP_ERRORS
1395 SLAVE_TRANSACTION_RETRIES
1396@@ -8342,7 +7114,7 @@
1397 SLOW_LAUNCH_TIME
1398 SLOW_QUERY_LOG
1399 SLOW_QUERY_LOG_FILE
1400-@@ -309,6 +316,7 @@
1401+@@ -311,6 +316,7 @@
1402 SQL_SAFE_UPDATES
1403 SQL_SELECT_LIMIT
1404 SQL_SLAVE_SKIP_COUNTER
1405
1406=== modified file 'patches/wl47.patch'
1407--- patches/wl47.patch 2012-01-31 08:05:03 +0000
1408+++ patches/wl47.patch 2012-02-13 03:48:59 +0000
1409@@ -96,7 +96,7 @@
1410 static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
1411 const char* logname);
1412 static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
1413-@@ -947,6 +1012,19 @@
1414+@@ -956,6 +1021,19 @@
1415 my_free(fname, MYF(MY_WME));
1416 break;
1417 }
1418@@ -116,7 +116,7 @@
1419 case TABLE_MAP_EVENT:
1420 {
1421 Table_map_log_event *map= ((Table_map_log_event *)ev);
1422-@@ -956,5 +1034,12 @@
1423+@@ -965,6 +1043,13 @@
1424 destroy_evt= FALSE;
1425 goto end;
1426 }
1427@@ -129,7 +129,8 @@
1428 +
1429 size_t len_to= 0;
1430 const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(),
1431-@@ -992,6 +1077,13 @@
1432+ &len_to);
1433+@@ -1002,6 +1087,13 @@
1434 if (print_event_info->m_table_map_ignored.count() > 0)
1435 print_event_info->m_table_map_ignored.clear_tables();
1436
1437@@ -143,7 +144,7 @@
1438 /*
1439 One needs to take into account an event that gets
1440 filtered but was last event in the statement. If this is
1441-@@ -1227,6 +1319,11 @@
1442+@@ -1239,6 +1331,11 @@
1443 "Updates to a database with a different name than the original. \
1444 Example: rewrite-db='from->to'.",
1445 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1446@@ -155,7 +156,7 @@
1447 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
1448 };
1449
1450-@@ -1695,6 +1792,8 @@
1451+@@ -1707,6 +1804,8 @@
1452 cast to uint32.
1453 */
1454 int4store(buf, (uint32)start_position);
1455@@ -164,7 +165,7 @@
1456 int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
1457
1458 size_t tlen = strlen(logname);
1459-@@ -1727,18 +1826,30 @@
1460+@@ -1739,18 +1838,30 @@
1461 break; // end of data
1462 DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n",
1463 len, net->read_pos[5]));
1464@@ -206,7 +207,7 @@
1465
1466 Log_event_type type= ev->get_type_code();
1467 if (glob_description_event->binlog_version >= 3 ||
1468-@@ -2247,6 +2358,7 @@
1469+@@ -2259,6 +2370,7 @@
1470 if (result_file != stdout)
1471 my_fclose(result_file, MYF(0));
1472 cleanup();
1473@@ -214,6 +215,2809 @@
1474 delete binlog_filter;
1475 free_root(&s_mem_root, MYF(0));
1476 free_defaults(defaults_argv);
1477+--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
1478++++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
1479+@@ -321,14 +321,19 @@
1480+ # we check that the error code of the "ROLLBACK" event is 0 and not
1481+ # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
1482+ # and does not make slave to stop)
1483++
1484++-- source include/binlog_start_pos.inc
1485++
1486+ if (`select @@binlog_format = 'ROW'`)
1487+ {
1488+- --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
1489++ let $start_pos= `select @binlog_start_pos + 418`;
1490++ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
1491+ }
1492+
1493+ if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
1494+ {
1495+- --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
1496++ let $start_pos= `select @binlog_start_pos + 449`;
1497++ --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
1498+ }
1499+
1500+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1501+--- a/mysql-test/extra/rpl_tests/rpl_log.test
1502++++ b/mysql-test/extra/rpl_tests/rpl_log.test
1503+@@ -14,6 +14,7 @@
1504+ reset master;
1505+ reset slave;
1506+ source include/start_slave.inc;
1507++source include/binlog_start_pos.inc;
1508+
1509+ let $VERSION=`select version()`;
1510+
1511+--- /dev/null
1512++++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
1513+@@ -0,0 +1,156 @@
1514++########################################################################
1515++# WL47: Store in binlog text of statements that caused RBR events
1516++# new event : ANNOTATE_ROWS_EVENT
1517++# new master option : --binlog-annotate-rows-events
1518++# new slave option : --replicate-annotate-rows-events
1519++########################################################################
1520++--source include/master-slave.inc
1521++connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,);
1522++
1523++connection master;
1524++--disable_query_log
1525++
1526++--disable_warnings
1527++DROP DATABASE IF EXISTS test1;
1528++--enable_warnings
1529++
1530++CREATE DATABASE test1;
1531++USE test1;
1532++
1533++CREATE TABLE t1(a int primary key, b int);
1534++CREATE TABLE t2(a int, b int);
1535++CREATE TABLE t3(a int, b int);
1536++CREATE TABLE t4(a int, b int);
1537++CREATE TABLE xt1(a int, b int);
1538++CREATE TABLE xt2(a int, b int);
1539++
1540++CREATE TABLE t5 (
1541++ a INT PRIMARY KEY AUTO_INCREMENT,
1542++ b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
1543++);
1544++
1545++SET SESSION binlog_annotate_rows_events = OFF;
1546++
1547++INSERT INTO t1 VALUES (0,0), (1,1);
1548++
1549++SET SESSION binlog_annotate_rows_events = ON;
1550++
1551++UPDATE t1 SET b = b + 1;
1552++REPLACE t1 VALUES (1,1), (2,2), (3,3);
1553++
1554++INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
1555++INSERT INTO t3 VALUES (1,1), (2,2), (3,3);
1556++DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a;
1557++
1558++INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
1559++INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
1560++DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a;
1561++
1562++INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
1563++INSERT INTO xt2 VALUES (1,1), (2,2), (3,3);
1564++DELETE xt1, xt2 FROM xt1 INNER JOIN xt2 INNER JOIN t3 WHERE xt1.a=xt2.a AND xt2.a=t3.a;
1565++
1566++INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz');
1567++SET NAMES latin1;
1568++INSERT INTO t5(b) VALUES ('gås');
1569++SET NAMES utf8;
1570++INSERT INTO t5(b) VALUES ('gås');
1571++SET NAMES latin1;
1572++
1573++FLUSH LOGS;
1574++
1575++--echo ########################################################################
1576++--echo # TABLES ON MASTER
1577++--echo ########################################################################
1578++--enable_query_log
1579++
1580++SELECT * FROM t1 ORDER BY a;
1581++SELECT * FROM t2 ORDER BY a;
1582++SELECT * FROM t3 ORDER BY a;
1583++SELECT * FROM t5 ORDER BY a;
1584++
1585++sync_slave_with_master;
1586++--echo ########################################################################
1587++--echo # TABLES ON SLAVE: should be the same as on master
1588++--echo ########################################################################
1589++--disable_query_log
1590++USE test1;
1591++--enable_query_log
1592++
1593++SELECT * FROM t1 ORDER BY a;
1594++SELECT * FROM t2 ORDER BY a;
1595++SELECT * FROM t3 ORDER BY a;
1596++SELECT * FROM t5 ORDER BY a;
1597++
1598++--echo ########################################################################
1599++--echo # EVENTS ON SLAVE
1600++let $annotate= `select @@global.replicate_annotate_rows_events`;
1601++if ($annotate)
1602++{
1603++ --echo # The following Annotate_rows events should appear below:
1604++ --echo # - UPDATE t1 SET b = b + 1;
1605++ --echo # - REPLACE t1 VALUES (1,1), (2,2), (3,3);
1606++ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
1607++ --echo # - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
1608++ --echo # - DELETE t1, t2 FROM <...>
1609++ --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
1610++ --echo # - DELETE xt1, t2 FROM <...>
1611++ --echo # - INSERT INTO t5(b) VALUES <...> (3 instances)
1612++}
1613++if (!$annotate)
1614++{
1615++ --echo # No Annotate_rows events should appear below
1616++}
1617++--echo ########################################################################
1618++FLUSH LOGS;
1619++
1620++--source include/binlog_start_pos.inc
1621++let $start_pos= `select @binlog_start_pos`;
1622++--replace_column 2 # 5 #
1623++--replace_result $start_pos <start_pos>
1624++--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
1625++--eval show binlog events in 'slave-bin.000001' from $start_pos
1626++
1627++--echo #
1628++--echo ########################################################################
1629++--echo # INSERTs DELAYED ON MASTERs
1630++--echo ########################################################################
1631++connection master;
1632++SET SESSION binlog_annotate_rows_events = ON;
1633++INSERT DELAYED INTO test1.t4 VALUES (1,1);
1634++FLUSH TABLES;
1635++SELECT * FROM test1.t4 ORDER BY a;
1636++
1637++sync_slave_with_master;
1638++connection master;
1639++sync_slave_with_master;
1640++
1641++--echo ########################################################################
1642++--echo # ON SLAVE
1643++--echo # No Annotate_rows events should appear below
1644++--echo ########################################################################
1645++FLUSH LOGS;
1646++
1647++--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
1648++perl;
1649++ open F, '<', "$ENV{MYSQLTEST_VARDIR}/tmp/annotated_events.txt" or die;
1650++ binmode STDOUT;
1651++ while (defined ($_ = <F>)) {
1652++ if (/Annotate_rows/) {
1653++ s/[0-9]+\sAnnotate_rows\s[0-9]+\s[0-9]+/# Annotate_rows # #/;
1654++ print($_);
1655++ $_ = <F>;
1656++ s/[0-9]+\sTable_map\s[0-9]+\s[0-9]+\stable_id:\s[0-9]+/# Table_map # # table_id: #/;
1657++ print($_);
1658++ }
1659++ }
1660++EOF
1661++
1662++# Clean-up
1663++connection master;
1664++--disable_query_log
1665++DROP DATABASE test1;
1666++sync_slave_with_master;
1667++--enable_query_log
1668++
1669++--source include/rpl_end.inc
1670+--- /dev/null
1671++++ b/mysql-test/include/binlog_start_pos.inc
1672+@@ -0,0 +1,26 @@
1673++##############################################################################
1674++#
1675++# binlog_start_pos is the postion of the the first event in the binary log
1676++# which follows the Format description event. Intended to reduce test suite
1677++# dependance on the Format description event length changes (e.g. in case
1678++# of adding new events). Evaluated as:
1679++#
1680++# binlog_start_pos = 4 /* binlog header */ +
1681++# (Format_description_log_event length)
1682++#
1683++# Format_description_log_event length =
1684++# 19 /* event common header */ +
1685++# 57 /* misc stuff in the Format description header */ +
1686++# number of events.
1687++#
1688++# With current number of events = 160,
1689++#
1690++# binlog_start_pos = 4 + 19 + 57 + 160 = 240.
1691++#
1692++##############################################################################
1693++
1694++let $binlog_start_pos=240;
1695++--disable_query_log
1696++SET @binlog_start_pos=240;
1697++--enable_query_log
1698++
1699+--- a/mysql-test/include/show_binlog_events.inc
1700++++ b/mysql-test/include/show_binlog_events.inc
1701+@@ -3,7 +3,7 @@
1702+ #
1703+ # Useage:
1704+ # let $binlog_file= master-bin.000002;
1705+-# let $binlog_start= 106;
1706++# let $binlog_start= 240;
1707+ # let $binlog_limit= 1, 3;
1708+ # source include/show_binlog_events.inc;
1709+ #
1710+--- a/mysql-test/include/show_binlog_events2.inc
1711++++ b/mysql-test/include/show_binlog_events2.inc
1712+@@ -1,4 +1,4 @@
1713+---let $binlog_start=106
1714++--let $binlog_start=240
1715+ --replace_result $binlog_start <binlog_start>
1716+ --replace_column 2 # 5 #
1717+ --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
1718+--- a/mysql-test/r/ctype_cp932_binlog_stm.result
1719++++ b/mysql-test/r/ctype_cp932_binlog_stm.result
1720+@@ -44,9 +44,6 @@
1721+ master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
1722+ master-bin.000001 # Query # # use `test`; DROP TABLE t4
1723+ End of 5.0 tests
1724+-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
1725+-SHOW BINLOG EVENTS FROM 365;
1726+-ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
1727+ Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
1728+ CREATE TABLE t1 (a varchar(16)) character set cp932;
1729+ INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
1730+--- a/mysql-test/r/mysqlbinlog.result
1731++++ b/mysql-test/r/mysqlbinlog.result
1732+@@ -1,15 +1,17 @@
1733+ reset master;
1734++SET @save_binlog_size= @@global.max_binlog_size;
1735++SET @@global.max_binlog_size= 4096;
1736+ set timestamp=1000000000;
1737+ drop table if exists t1,t2,t3,t4,t5,t03,t04;
1738+ create table t1 (word varchar(20));
1739+ create table t2 (id int auto_increment not null primary key);
1740+ insert into t1 values ("abirvalg");
1741+ insert into t2 values ();
1742+-load data infile '../../std_data/words.dat' into table t1;
1743+-load data infile '../../std_data/words.dat' into table t1;
1744+-load data infile '../../std_data/words.dat' into table t1;
1745+-load data infile '../../std_data/words.dat' into table t1;
1746+-load data infile '../../std_data/words.dat' into table t1;
1747++load data infile '../../std_data/words3.dat' into table t1;
1748++load data infile '../../std_data/words3.dat' into table t1;
1749++load data infile '../../std_data/words3.dat' into table t1;
1750++load data infile '../../std_data/words3.dat' into table t1;
1751++load data infile '../../std_data/words3.dat' into table t1;
1752+ insert into t1 values ("Alas");
1753+ flush logs;
1754+
1755+@@ -255,6 +257,7 @@
1756+ ROLLBACK /* added by mysqlbinlog */;
1757+ /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1758+ drop table t1,t2;
1759++SET @@global.max_binlog_size= @save_binlog_size;
1760+ flush logs;
1761+ flush logs;
1762+ select * from t5 /* must be (1),(1) */;
1763+@@ -377,14 +380,14 @@
1764+ /*!*/;
1765+ SET TIMESTAMP=1000000000/*!*/;
1766+ SET @@session.collation_database=7/*!*/;
1767+-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`)
1768++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`)
1769+ /*!*/;
1770+ SET TIMESTAMP=1000000000/*!*/;
1771+ SET @@session.collation_database=DEFAULT/*!*/;
1772+-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`)
1773++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`)
1774+ /*!*/;
1775+ SET TIMESTAMP=1000000000/*!*/;
1776+-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`)
1777++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`)
1778+ /*!*/;
1779+ SET TIMESTAMP=1000000000/*!*/;
1780+ drop table t1
1781+--- a/mysql-test/r/percona_server_variables_debug.result
1782++++ b/mysql-test/r/percona_server_variables_debug.result
1783+@@ -7,6 +7,7 @@
1784+ BACK_LOG
1785+ BASEDIR
1786+ BIG_TABLES
1787++BINLOG_ANNOTATE_ROWS_EVENTS
1788+ BINLOG_CACHE_SIZE
1789+ BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
1790+ BINLOG_FORMAT
1791+@@ -273,6 +274,7 @@
1792+ RELAY_LOG_INFO_FILE
1793+ RELAY_LOG_PURGE
1794+ RELAY_LOG_SPACE_LIMIT
1795++REPLICATE_ANNOTATE_ROWS_EVENTS
1796+ REPORT_HOST
1797+ REPORT_PASSWORD
1798+ REPORT_PORT
1799+--- a/mysql-test/r/percona_server_variables_release.result
1800++++ b/mysql-test/r/percona_server_variables_release.result
1801+@@ -7,6 +7,7 @@
1802+ BACK_LOG
1803+ BASEDIR
1804+ BIG_TABLES
1805++BINLOG_ANNOTATE_ROWS_EVENTS
1806+ BINLOG_CACHE_SIZE
1807+ BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
1808+ BINLOG_FORMAT
1809+@@ -270,6 +271,7 @@
1810+ RELAY_LOG_INFO_FILE
1811+ RELAY_LOG_PURGE
1812+ RELAY_LOG_SPACE_LIMIT
1813++REPLICATE_ANNOTATE_ROWS_EVENTS
1814+ REPORT_HOST
1815+ REPORT_PASSWORD
1816+ REPORT_PORT
1817+--- /dev/null
1818++++ b/mysql-test/std_data/words3.dat
1819+@@ -0,0 +1,66 @@
1820++Aarhus
1821++Aaron
1822++Ababa
1823++aback
1824++abaft
1825++abandon
1826++abandoned
1827++abandoning
1828++abandonment
1829++abandons
1830++Aarhus
1831++Aaron
1832++Ababa
1833++aback
1834++abaft
1835++abandon
1836++abandoned
1837++abandoning
1838++abandonment
1839++abandons
1840++abase
1841++abased
1842++abasement
1843++abasements
1844++abases
1845++abash
1846++abashed
1847++abashes
1848++abashing
1849++abasing
1850++abate
1851++abated
1852++abatement
1853++abatements
1854++abater
1855++abates
1856++abating
1857++Abba
1858++abbe
1859++abbey
1860++abbeys
1861++abbot
1862++abbots
1863++Abbott
1864++abbreviate
1865++abbreviated
1866++abbreviates
1867++abbreviating
1868++abbreviation
1869++abbreviations
1870++Abby
1871++abdomen
1872++abdomens
1873++abdominal
1874++abduct
1875++abducted
1876++abduction
1877++abductions
1878++abductor
1879++abductors
1880++abducts
1881++Abe
1882++abed
1883++Abel
1884++Abelian
1885++Abelson
1886+--- /dev/null
1887++++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result
1888+@@ -0,0 +1,1219 @@
1889++#####################################################################################
1890++# The following Annotate_rows events should appear below:
1891++# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1892++# - INSERT INTO test3.t3 VALUES (1), (2), (3)
1893++# - DELETE test1.t1, test2.t2 FROM <...>
1894++# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1895++# - DELETE xtest1.xt1, test2.t2 FROM <...>
1896++#####################################################################################
1897++show binlog events in 'master-bin.000001' from <start_pos>;
1898++Log_name Pos Event_type Server_id End_log_pos Info
1899++master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
1900++master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test2
1901++master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test3
1902++master-bin.000001 # Query 1 # CREATE DATABASE test1
1903++master-bin.000001 # Query 1 # CREATE DATABASE test2
1904++master-bin.000001 # Query 1 # CREATE DATABASE test3
1905++master-bin.000001 # Query 1 # BEGIN
1906++master-bin.000001 # Table_map 1 # table_id: # (test1.t1)
1907++master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
1908++master-bin.000001 # Query 1 # COMMIT
1909++master-bin.000001 # Query 1 # BEGIN
1910++master-bin.000001 # Annotate_rows 1 # INSERT INTO test2.t2 VALUES (1), (2), (3)
1911++master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
1912++master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
1913++master-bin.000001 # Query 1 # COMMIT
1914++master-bin.000001 # Query 1 # BEGIN
1915++master-bin.000001 # Annotate_rows 1 # INSERT INTO test3.t3 VALUES (1), (2), (3)
1916++master-bin.000001 # Table_map 1 # table_id: # (test3.t3)
1917++master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
1918++master-bin.000001 # Query 1 # COMMIT
1919++master-bin.000001 # Query 1 # BEGIN
1920++master-bin.000001 # Annotate_rows 1 # DELETE test1.t1, test2.t2
1921++FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1922++WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a
1923++master-bin.000001 # Table_map 1 # table_id: # (test1.t1)
1924++master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
1925++master-bin.000001 # Delete_rows 1 # table_id: #
1926++master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
1927++master-bin.000001 # Query 1 # COMMIT
1928++master-bin.000001 # Query 1 # BEGIN
1929++master-bin.000001 # Annotate_rows 1 # INSERT INTO test2.v2 VALUES (1), (2), (3)
1930++master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
1931++master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
1932++master-bin.000001 # Query 1 # COMMIT
1933++master-bin.000001 # Query 1 # BEGIN
1934++master-bin.000001 # Annotate_rows 1 # DELETE xtest1.xt1, test2.t2
1935++FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
1936++WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a
1937++master-bin.000001 # Table_map 1 # table_id: # (test2.t2)
1938++master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
1939++master-bin.000001 # Query 1 # COMMIT
1940++master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
1941++#
1942++#####################################################################################
1943++# mysqlbinlog
1944++# The following Annotates should appear in this output:
1945++# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1946++# - INSERT INTO test3.t3 VALUES (1), (2), (3)
1947++# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
1948++# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1949++# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
1950++#####################################################################################
1951++/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1952++/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1953++DELIMITER /*!*/;
1954++# at #
1955++#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
1956++ROLLBACK/*!*/;
1957++# at #
1958++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1959++SET TIMESTAMP=1000000000/*!*/;
1960++SET @@session.pseudo_thread_id=#/*!*/;
1961++SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1962++SET @@session.sql_mode=0/*!*/;
1963++SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1964++/*!\C latin1 *//*!*/;
1965++SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1966++SET @@session.lc_time_names=0/*!*/;
1967++SET @@session.collation_database=DEFAULT/*!*/;
1968++DROP DATABASE IF EXISTS test1
1969++/*!*/;
1970++# at #
1971++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1972++SET TIMESTAMP=1000000000/*!*/;
1973++DROP DATABASE IF EXISTS test2
1974++/*!*/;
1975++# at #
1976++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1977++SET TIMESTAMP=1000000000/*!*/;
1978++DROP DATABASE IF EXISTS test3
1979++/*!*/;
1980++# at #
1981++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1982++SET TIMESTAMP=1000000000/*!*/;
1983++CREATE DATABASE test1
1984++/*!*/;
1985++# at #
1986++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1987++SET TIMESTAMP=1000000000/*!*/;
1988++CREATE DATABASE test2
1989++/*!*/;
1990++# at #
1991++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1992++SET TIMESTAMP=1000000000/*!*/;
1993++CREATE DATABASE test3
1994++/*!*/;
1995++# at #
1996++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
1997++SET TIMESTAMP=1000000000/*!*/;
1998++BEGIN
1999++/*!*/;
2000++# at #
2001++# at #
2002++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2003++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2004++### INSERT INTO test1.t1
2005++### SET
2006++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2007++### INSERT INTO test1.t1
2008++### SET
2009++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2010++### INSERT INTO test1.t1
2011++### SET
2012++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2013++# at #
2014++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2015++SET TIMESTAMP=1000000000/*!*/;
2016++COMMIT
2017++/*!*/;
2018++# at #
2019++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2020++SET TIMESTAMP=1000000000/*!*/;
2021++BEGIN
2022++/*!*/;
2023++# at #
2024++# at #
2025++# at #
2026++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2027++#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
2028++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2029++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2030++### INSERT INTO test2.t2
2031++### SET
2032++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2033++### INSERT INTO test2.t2
2034++### SET
2035++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2036++### INSERT INTO test2.t2
2037++### SET
2038++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2039++# at #
2040++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2041++SET TIMESTAMP=1000000000/*!*/;
2042++COMMIT
2043++/*!*/;
2044++# at #
2045++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2046++SET TIMESTAMP=1000000000/*!*/;
2047++BEGIN
2048++/*!*/;
2049++# at #
2050++# at #
2051++# at #
2052++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2053++#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
2054++#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
2055++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2056++### INSERT INTO test3.t3
2057++### SET
2058++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2059++### INSERT INTO test3.t3
2060++### SET
2061++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2062++### INSERT INTO test3.t3
2063++### SET
2064++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2065++# at #
2066++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2067++SET TIMESTAMP=1000000000/*!*/;
2068++COMMIT
2069++/*!*/;
2070++# at #
2071++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2072++SET TIMESTAMP=1000000000/*!*/;
2073++BEGIN
2074++/*!*/;
2075++# at #
2076++# at #
2077++# at #
2078++# at #
2079++# at #
2080++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2081++#Q> DELETE test1.t1, test2.t2
2082++#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2083++#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
2084++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2085++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2086++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
2087++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
2088++### DELETE FROM test1.t1
2089++### WHERE
2090++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2091++### DELETE FROM test1.t1
2092++### WHERE
2093++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2094++### DELETE FROM test1.t1
2095++### WHERE
2096++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2097++### DELETE FROM test2.t2
2098++### WHERE
2099++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2100++### DELETE FROM test2.t2
2101++### WHERE
2102++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2103++### DELETE FROM test2.t2
2104++### WHERE
2105++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2106++# at #
2107++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2108++SET TIMESTAMP=1000000000/*!*/;
2109++COMMIT
2110++/*!*/;
2111++# at #
2112++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2113++SET TIMESTAMP=1000000000/*!*/;
2114++BEGIN
2115++/*!*/;
2116++# at #
2117++# at #
2118++# at #
2119++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2120++#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
2121++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2122++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2123++### INSERT INTO test2.t2
2124++### SET
2125++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2126++### INSERT INTO test2.t2
2127++### SET
2128++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2129++### INSERT INTO test2.t2
2130++### SET
2131++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2132++# at #
2133++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2134++SET TIMESTAMP=1000000000/*!*/;
2135++COMMIT
2136++/*!*/;
2137++# at #
2138++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2139++SET TIMESTAMP=1000000000/*!*/;
2140++BEGIN
2141++/*!*/;
2142++# at #
2143++# at #
2144++# at #
2145++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2146++#Q> DELETE xtest1.xt1, test2.t2
2147++#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
2148++#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
2149++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2150++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
2151++### DELETE FROM test2.t2
2152++### WHERE
2153++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2154++### DELETE FROM test2.t2
2155++### WHERE
2156++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2157++### DELETE FROM test2.t2
2158++### WHERE
2159++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2160++# at #
2161++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2162++SET TIMESTAMP=1000000000/*!*/;
2163++COMMIT
2164++/*!*/;
2165++# at #
2166++#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
2167++DELIMITER ;
2168++# End of log file
2169++ROLLBACK /* added by mysqlbinlog */;
2170++/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
2171++#
2172++#####################################################################################
2173++# mysqlbinlog --database=test1
2174++# The following Annotate should appear in this output:
2175++# - DELETE test1.t1, test2.t2 FROM <...>
2176++#####################################################################################
2177++/*!40019 SET @@session.max_insert_delayed_threads=0*/;
2178++/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
2179++DELIMITER /*!*/;
2180++# at #
2181++#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
2182++ROLLBACK/*!*/;
2183++# at #
2184++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2185++SET TIMESTAMP=1000000000/*!*/;
2186++SET @@session.pseudo_thread_id=#/*!*/;
2187++SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
2188++SET @@session.sql_mode=0/*!*/;
2189++SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
2190++/*!\C latin1 *//*!*/;
2191++SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
2192++SET @@session.lc_time_names=0/*!*/;
2193++SET @@session.collation_database=DEFAULT/*!*/;
2194++DROP DATABASE IF EXISTS test1
2195++/*!*/;
2196++# at #
2197++# at #
2198++# at #
2199++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2200++SET TIMESTAMP=1000000000/*!*/;
2201++CREATE DATABASE test1
2202++/*!*/;
2203++# at #
2204++# at #
2205++# at #
2206++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2207++SET TIMESTAMP=1000000000/*!*/;
2208++BEGIN
2209++/*!*/;
2210++# at #
2211++# at #
2212++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2213++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2214++### INSERT INTO test1.t1
2215++### SET
2216++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2217++### INSERT INTO test1.t1
2218++### SET
2219++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2220++### INSERT INTO test1.t1
2221++### SET
2222++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2223++# at #
2224++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2225++SET TIMESTAMP=1000000000/*!*/;
2226++COMMIT
2227++/*!*/;
2228++# at #
2229++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2230++SET TIMESTAMP=1000000000/*!*/;
2231++BEGIN
2232++/*!*/;
2233++# at #
2234++# at #
2235++# at #
2236++# at #
2237++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2238++SET TIMESTAMP=1000000000/*!*/;
2239++COMMIT
2240++/*!*/;
2241++# at #
2242++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2243++SET TIMESTAMP=1000000000/*!*/;
2244++BEGIN
2245++/*!*/;
2246++# at #
2247++# at #
2248++# at #
2249++# at #
2250++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2251++SET TIMESTAMP=1000000000/*!*/;
2252++COMMIT
2253++/*!*/;
2254++# at #
2255++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2256++SET TIMESTAMP=1000000000/*!*/;
2257++BEGIN
2258++/*!*/;
2259++# at #
2260++# at #
2261++# at #
2262++# at #
2263++# at #
2264++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2265++#Q> DELETE test1.t1, test2.t2
2266++#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2267++#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
2268++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2269++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
2270++### DELETE FROM test1.t1
2271++### WHERE
2272++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2273++### DELETE FROM test1.t1
2274++### WHERE
2275++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2276++### DELETE FROM test1.t1
2277++### WHERE
2278++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2279++# at #
2280++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2281++SET TIMESTAMP=1000000000/*!*/;
2282++COMMIT
2283++/*!*/;
2284++# at #
2285++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2286++SET TIMESTAMP=1000000000/*!*/;
2287++BEGIN
2288++/*!*/;
2289++# at #
2290++# at #
2291++# at #
2292++# at #
2293++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2294++SET TIMESTAMP=1000000000/*!*/;
2295++COMMIT
2296++/*!*/;
2297++# at #
2298++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2299++SET TIMESTAMP=1000000000/*!*/;
2300++BEGIN
2301++/*!*/;
2302++# at #
2303++# at #
2304++# at #
2305++# at #
2306++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2307++SET TIMESTAMP=1000000000/*!*/;
2308++COMMIT
2309++/*!*/;
2310++# at #
2311++#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
2312++DELIMITER ;
2313++# End of log file
2314++ROLLBACK /* added by mysqlbinlog */;
2315++/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
2316++#
2317++#####################################################################################
2318++# mysqlbinlog --skip-annotate-rows-events
2319++# No Annotates should appear in this output
2320++#####################################################################################
2321++/*!40019 SET @@session.max_insert_delayed_threads=0*/;
2322++/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
2323++DELIMITER /*!*/;
2324++# at #
2325++#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
2326++ROLLBACK/*!*/;
2327++# at #
2328++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2329++SET TIMESTAMP=1000000000/*!*/;
2330++SET @@session.pseudo_thread_id=#/*!*/;
2331++SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
2332++SET @@session.sql_mode=0/*!*/;
2333++SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
2334++/*!\C latin1 *//*!*/;
2335++SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
2336++SET @@session.lc_time_names=0/*!*/;
2337++SET @@session.collation_database=DEFAULT/*!*/;
2338++DROP DATABASE IF EXISTS test1
2339++/*!*/;
2340++# at #
2341++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2342++SET TIMESTAMP=1000000000/*!*/;
2343++DROP DATABASE IF EXISTS test2
2344++/*!*/;
2345++# at #
2346++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2347++SET TIMESTAMP=1000000000/*!*/;
2348++DROP DATABASE IF EXISTS test3
2349++/*!*/;
2350++# at #
2351++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2352++SET TIMESTAMP=1000000000/*!*/;
2353++CREATE DATABASE test1
2354++/*!*/;
2355++# at #
2356++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2357++SET TIMESTAMP=1000000000/*!*/;
2358++CREATE DATABASE test2
2359++/*!*/;
2360++# at #
2361++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2362++SET TIMESTAMP=1000000000/*!*/;
2363++CREATE DATABASE test3
2364++/*!*/;
2365++# at #
2366++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2367++SET TIMESTAMP=1000000000/*!*/;
2368++BEGIN
2369++/*!*/;
2370++# at #
2371++# at #
2372++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2373++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2374++### INSERT INTO test1.t1
2375++### SET
2376++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2377++### INSERT INTO test1.t1
2378++### SET
2379++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2380++### INSERT INTO test1.t1
2381++### SET
2382++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2383++# at #
2384++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2385++SET TIMESTAMP=1000000000/*!*/;
2386++COMMIT
2387++/*!*/;
2388++# at #
2389++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2390++SET TIMESTAMP=1000000000/*!*/;
2391++BEGIN
2392++/*!*/;
2393++# at #
2394++# at #
2395++# at #
2396++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2397++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2398++### INSERT INTO test2.t2
2399++### SET
2400++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2401++### INSERT INTO test2.t2
2402++### SET
2403++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2404++### INSERT INTO test2.t2
2405++### SET
2406++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2407++# at #
2408++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2409++SET TIMESTAMP=1000000000/*!*/;
2410++COMMIT
2411++/*!*/;
2412++# at #
2413++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2414++SET TIMESTAMP=1000000000/*!*/;
2415++BEGIN
2416++/*!*/;
2417++# at #
2418++# at #
2419++# at #
2420++#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
2421++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2422++### INSERT INTO test3.t3
2423++### SET
2424++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2425++### INSERT INTO test3.t3
2426++### SET
2427++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2428++### INSERT INTO test3.t3
2429++### SET
2430++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2431++# at #
2432++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2433++SET TIMESTAMP=1000000000/*!*/;
2434++COMMIT
2435++/*!*/;
2436++# at #
2437++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2438++SET TIMESTAMP=1000000000/*!*/;
2439++BEGIN
2440++/*!*/;
2441++# at #
2442++# at #
2443++# at #
2444++# at #
2445++# at #
2446++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2447++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2448++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
2449++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
2450++### DELETE FROM test1.t1
2451++### WHERE
2452++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2453++### DELETE FROM test1.t1
2454++### WHERE
2455++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2456++### DELETE FROM test1.t1
2457++### WHERE
2458++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2459++### DELETE FROM test2.t2
2460++### WHERE
2461++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2462++### DELETE FROM test2.t2
2463++### WHERE
2464++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2465++### DELETE FROM test2.t2
2466++### WHERE
2467++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2468++# at #
2469++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2470++SET TIMESTAMP=1000000000/*!*/;
2471++COMMIT
2472++/*!*/;
2473++# at #
2474++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2475++SET TIMESTAMP=1000000000/*!*/;
2476++BEGIN
2477++/*!*/;
2478++# at #
2479++# at #
2480++# at #
2481++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2482++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2483++### INSERT INTO test2.t2
2484++### SET
2485++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2486++### INSERT INTO test2.t2
2487++### SET
2488++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2489++### INSERT INTO test2.t2
2490++### SET
2491++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2492++# at #
2493++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2494++SET TIMESTAMP=1000000000/*!*/;
2495++COMMIT
2496++/*!*/;
2497++# at #
2498++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2499++SET TIMESTAMP=1000000000/*!*/;
2500++BEGIN
2501++/*!*/;
2502++# at #
2503++# at #
2504++# at #
2505++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2506++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
2507++### DELETE FROM test2.t2
2508++### WHERE
2509++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2510++### DELETE FROM test2.t2
2511++### WHERE
2512++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2513++### DELETE FROM test2.t2
2514++### WHERE
2515++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2516++# at #
2517++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2518++SET TIMESTAMP=1000000000/*!*/;
2519++COMMIT
2520++/*!*/;
2521++# at #
2522++#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
2523++DELIMITER ;
2524++# End of log file
2525++ROLLBACK /* added by mysqlbinlog */;
2526++/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
2527++#
2528++#####################################################################################
2529++# mysqlbinlog --read-from-remote-server
2530++# The following Annotates should appear in this output:
2531++# - INSERT INTO test2.t2 VALUES (1), (2), (3)
2532++# - INSERT INTO test3.t3 VALUES (1), (2), (3)
2533++# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2534++# - INSERT INTO test2.t2 VALUES (1), (2), (3)
2535++# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2536++#####################################################################################
2537++/*!40019 SET @@session.max_insert_delayed_threads=0*/;
2538++/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
2539++DELIMITER /*!*/;
2540++# at #
2541++#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
2542++ROLLBACK/*!*/;
2543++# at #
2544++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2545++SET TIMESTAMP=1000000000/*!*/;
2546++SET @@session.pseudo_thread_id=#/*!*/;
2547++SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
2548++SET @@session.sql_mode=0/*!*/;
2549++SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
2550++/*!\C latin1 *//*!*/;
2551++SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
2552++SET @@session.lc_time_names=0/*!*/;
2553++SET @@session.collation_database=DEFAULT/*!*/;
2554++DROP DATABASE IF EXISTS test1
2555++/*!*/;
2556++# at #
2557++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2558++SET TIMESTAMP=1000000000/*!*/;
2559++DROP DATABASE IF EXISTS test2
2560++/*!*/;
2561++# at #
2562++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2563++SET TIMESTAMP=1000000000/*!*/;
2564++DROP DATABASE IF EXISTS test3
2565++/*!*/;
2566++# at #
2567++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2568++SET TIMESTAMP=1000000000/*!*/;
2569++CREATE DATABASE test1
2570++/*!*/;
2571++# at #
2572++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2573++SET TIMESTAMP=1000000000/*!*/;
2574++CREATE DATABASE test2
2575++/*!*/;
2576++# at #
2577++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2578++SET TIMESTAMP=1000000000/*!*/;
2579++CREATE DATABASE test3
2580++/*!*/;
2581++# at #
2582++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2583++SET TIMESTAMP=1000000000/*!*/;
2584++BEGIN
2585++/*!*/;
2586++# at #
2587++# at #
2588++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2589++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2590++### INSERT INTO test1.t1
2591++### SET
2592++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2593++### INSERT INTO test1.t1
2594++### SET
2595++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2596++### INSERT INTO test1.t1
2597++### SET
2598++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2599++# at #
2600++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2601++SET TIMESTAMP=1000000000/*!*/;
2602++COMMIT
2603++/*!*/;
2604++# at #
2605++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2606++SET TIMESTAMP=1000000000/*!*/;
2607++BEGIN
2608++/*!*/;
2609++# at #
2610++# at #
2611++# at #
2612++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2613++#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
2614++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2615++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2616++### INSERT INTO test2.t2
2617++### SET
2618++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2619++### INSERT INTO test2.t2
2620++### SET
2621++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2622++### INSERT INTO test2.t2
2623++### SET
2624++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2625++# at #
2626++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2627++SET TIMESTAMP=1000000000/*!*/;
2628++COMMIT
2629++/*!*/;
2630++# at #
2631++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2632++SET TIMESTAMP=1000000000/*!*/;
2633++BEGIN
2634++/*!*/;
2635++# at #
2636++# at #
2637++# at #
2638++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2639++#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
2640++#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
2641++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2642++### INSERT INTO test3.t3
2643++### SET
2644++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2645++### INSERT INTO test3.t3
2646++### SET
2647++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2648++### INSERT INTO test3.t3
2649++### SET
2650++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2651++# at #
2652++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2653++SET TIMESTAMP=1000000000/*!*/;
2654++COMMIT
2655++/*!*/;
2656++# at #
2657++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2658++SET TIMESTAMP=1000000000/*!*/;
2659++BEGIN
2660++/*!*/;
2661++# at #
2662++# at #
2663++# at #
2664++# at #
2665++# at #
2666++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2667++#Q> DELETE test1.t1, test2.t2
2668++#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2669++#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
2670++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2671++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2672++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
2673++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
2674++### DELETE FROM test1.t1
2675++### WHERE
2676++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2677++### DELETE FROM test1.t1
2678++### WHERE
2679++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2680++### DELETE FROM test1.t1
2681++### WHERE
2682++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2683++### DELETE FROM test2.t2
2684++### WHERE
2685++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2686++### DELETE FROM test2.t2
2687++### WHERE
2688++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2689++### DELETE FROM test2.t2
2690++### WHERE
2691++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2692++# at #
2693++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2694++SET TIMESTAMP=1000000000/*!*/;
2695++COMMIT
2696++/*!*/;
2697++# at #
2698++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2699++SET TIMESTAMP=1000000000/*!*/;
2700++BEGIN
2701++/*!*/;
2702++# at #
2703++# at #
2704++# at #
2705++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2706++#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
2707++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2708++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2709++### INSERT INTO test2.t2
2710++### SET
2711++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2712++### INSERT INTO test2.t2
2713++### SET
2714++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2715++### INSERT INTO test2.t2
2716++### SET
2717++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2718++# at #
2719++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2720++SET TIMESTAMP=1000000000/*!*/;
2721++COMMIT
2722++/*!*/;
2723++# at #
2724++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2725++SET TIMESTAMP=1000000000/*!*/;
2726++BEGIN
2727++/*!*/;
2728++# at #
2729++# at #
2730++# at #
2731++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2732++#Q> DELETE xtest1.xt1, test2.t2
2733++#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
2734++#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
2735++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2736++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
2737++### DELETE FROM test2.t2
2738++### WHERE
2739++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2740++### DELETE FROM test2.t2
2741++### WHERE
2742++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2743++### DELETE FROM test2.t2
2744++### WHERE
2745++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2746++# at #
2747++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2748++SET TIMESTAMP=1000000000/*!*/;
2749++COMMIT
2750++/*!*/;
2751++# at #
2752++#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
2753++DELIMITER ;
2754++# End of log file
2755++ROLLBACK /* added by mysqlbinlog */;
2756++/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
2757++#
2758++#####################################################################################
2759++# mysqlbinlog --read-from-remote-server --database=test1
2760++# The following Annotate should appear in this output:
2761++# - DELETE test1.t1, test2.t2 FROM <...>
2762++#####################################################################################
2763++/*!40019 SET @@session.max_insert_delayed_threads=0*/;
2764++/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
2765++DELIMITER /*!*/;
2766++# at #
2767++#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
2768++ROLLBACK/*!*/;
2769++# at #
2770++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2771++SET TIMESTAMP=1000000000/*!*/;
2772++SET @@session.pseudo_thread_id=#/*!*/;
2773++SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
2774++SET @@session.sql_mode=0/*!*/;
2775++SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
2776++/*!\C latin1 *//*!*/;
2777++SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
2778++SET @@session.lc_time_names=0/*!*/;
2779++SET @@session.collation_database=DEFAULT/*!*/;
2780++DROP DATABASE IF EXISTS test1
2781++/*!*/;
2782++# at #
2783++# at #
2784++# at #
2785++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2786++SET TIMESTAMP=1000000000/*!*/;
2787++CREATE DATABASE test1
2788++/*!*/;
2789++# at #
2790++# at #
2791++# at #
2792++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2793++SET TIMESTAMP=1000000000/*!*/;
2794++BEGIN
2795++/*!*/;
2796++# at #
2797++# at #
2798++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2799++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2800++### INSERT INTO test1.t1
2801++### SET
2802++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2803++### INSERT INTO test1.t1
2804++### SET
2805++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2806++### INSERT INTO test1.t1
2807++### SET
2808++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2809++# at #
2810++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2811++SET TIMESTAMP=1000000000/*!*/;
2812++COMMIT
2813++/*!*/;
2814++# at #
2815++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2816++SET TIMESTAMP=1000000000/*!*/;
2817++BEGIN
2818++/*!*/;
2819++# at #
2820++# at #
2821++# at #
2822++# at #
2823++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2824++SET TIMESTAMP=1000000000/*!*/;
2825++COMMIT
2826++/*!*/;
2827++# at #
2828++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2829++SET TIMESTAMP=1000000000/*!*/;
2830++BEGIN
2831++/*!*/;
2832++# at #
2833++# at #
2834++# at #
2835++# at #
2836++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2837++SET TIMESTAMP=1000000000/*!*/;
2838++COMMIT
2839++/*!*/;
2840++# at #
2841++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2842++SET TIMESTAMP=1000000000/*!*/;
2843++BEGIN
2844++/*!*/;
2845++# at #
2846++# at #
2847++# at #
2848++# at #
2849++# at #
2850++#010909 4:46:40 server id # end_log_pos # Annotate_rows:
2851++#Q> DELETE test1.t1, test2.t2
2852++#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2853++#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
2854++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2855++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
2856++### DELETE FROM test1.t1
2857++### WHERE
2858++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2859++### DELETE FROM test1.t1
2860++### WHERE
2861++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2862++### DELETE FROM test1.t1
2863++### WHERE
2864++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2865++# at #
2866++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2867++SET TIMESTAMP=1000000000/*!*/;
2868++COMMIT
2869++/*!*/;
2870++# at #
2871++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2872++SET TIMESTAMP=1000000000/*!*/;
2873++BEGIN
2874++/*!*/;
2875++# at #
2876++# at #
2877++# at #
2878++# at #
2879++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2880++SET TIMESTAMP=1000000000/*!*/;
2881++COMMIT
2882++/*!*/;
2883++# at #
2884++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2885++SET TIMESTAMP=1000000000/*!*/;
2886++BEGIN
2887++/*!*/;
2888++# at #
2889++# at #
2890++# at #
2891++# at #
2892++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2893++SET TIMESTAMP=1000000000/*!*/;
2894++COMMIT
2895++/*!*/;
2896++# at #
2897++#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
2898++DELIMITER ;
2899++# End of log file
2900++ROLLBACK /* added by mysqlbinlog */;
2901++/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
2902++#
2903++#####################################################################################
2904++# mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
2905++# No Annotates should appear in this output
2906++#####################################################################################
2907++/*!40019 SET @@session.max_insert_delayed_threads=0*/;
2908++/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
2909++DELIMITER /*!*/;
2910++# at #
2911++#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
2912++ROLLBACK/*!*/;
2913++# at #
2914++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2915++SET TIMESTAMP=1000000000/*!*/;
2916++SET @@session.pseudo_thread_id=#/*!*/;
2917++SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
2918++SET @@session.sql_mode=0/*!*/;
2919++SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
2920++/*!\C latin1 *//*!*/;
2921++SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
2922++SET @@session.lc_time_names=0/*!*/;
2923++SET @@session.collation_database=DEFAULT/*!*/;
2924++DROP DATABASE IF EXISTS test1
2925++/*!*/;
2926++# at #
2927++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2928++SET TIMESTAMP=1000000000/*!*/;
2929++DROP DATABASE IF EXISTS test2
2930++/*!*/;
2931++# at #
2932++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2933++SET TIMESTAMP=1000000000/*!*/;
2934++DROP DATABASE IF EXISTS test3
2935++/*!*/;
2936++# at #
2937++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2938++SET TIMESTAMP=1000000000/*!*/;
2939++CREATE DATABASE test1
2940++/*!*/;
2941++# at #
2942++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2943++SET TIMESTAMP=1000000000/*!*/;
2944++CREATE DATABASE test2
2945++/*!*/;
2946++# at #
2947++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2948++SET TIMESTAMP=1000000000/*!*/;
2949++CREATE DATABASE test3
2950++/*!*/;
2951++# at #
2952++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2953++SET TIMESTAMP=1000000000/*!*/;
2954++BEGIN
2955++/*!*/;
2956++# at #
2957++# at #
2958++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
2959++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2960++### INSERT INTO test1.t1
2961++### SET
2962++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2963++### INSERT INTO test1.t1
2964++### SET
2965++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2966++### INSERT INTO test1.t1
2967++### SET
2968++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2969++# at #
2970++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2971++SET TIMESTAMP=1000000000/*!*/;
2972++COMMIT
2973++/*!*/;
2974++# at #
2975++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2976++SET TIMESTAMP=1000000000/*!*/;
2977++BEGIN
2978++/*!*/;
2979++# at #
2980++# at #
2981++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
2982++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
2983++### INSERT INTO test2.t2
2984++### SET
2985++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
2986++### INSERT INTO test2.t2
2987++### SET
2988++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
2989++### INSERT INTO test2.t2
2990++### SET
2991++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
2992++# at #
2993++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2994++SET TIMESTAMP=1000000000/*!*/;
2995++COMMIT
2996++/*!*/;
2997++# at #
2998++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
2999++SET TIMESTAMP=1000000000/*!*/;
3000++BEGIN
3001++/*!*/;
3002++# at #
3003++# at #
3004++#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
3005++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
3006++### INSERT INTO test3.t3
3007++### SET
3008++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
3009++### INSERT INTO test3.t3
3010++### SET
3011++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
3012++### INSERT INTO test3.t3
3013++### SET
3014++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
3015++# at #
3016++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3017++SET TIMESTAMP=1000000000/*!*/;
3018++COMMIT
3019++/*!*/;
3020++# at #
3021++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3022++SET TIMESTAMP=1000000000/*!*/;
3023++BEGIN
3024++/*!*/;
3025++# at #
3026++# at #
3027++# at #
3028++# at #
3029++#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
3030++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
3031++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
3032++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
3033++### DELETE FROM test1.t1
3034++### WHERE
3035++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
3036++### DELETE FROM test1.t1
3037++### WHERE
3038++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
3039++### DELETE FROM test1.t1
3040++### WHERE
3041++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
3042++### DELETE FROM test2.t2
3043++### WHERE
3044++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
3045++### DELETE FROM test2.t2
3046++### WHERE
3047++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
3048++### DELETE FROM test2.t2
3049++### WHERE
3050++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
3051++# at #
3052++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3053++SET TIMESTAMP=1000000000/*!*/;
3054++COMMIT
3055++/*!*/;
3056++# at #
3057++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3058++SET TIMESTAMP=1000000000/*!*/;
3059++BEGIN
3060++/*!*/;
3061++# at #
3062++# at #
3063++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
3064++#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
3065++### INSERT INTO test2.t2
3066++### SET
3067++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
3068++### INSERT INTO test2.t2
3069++### SET
3070++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
3071++### INSERT INTO test2.t2
3072++### SET
3073++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
3074++# at #
3075++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3076++SET TIMESTAMP=1000000000/*!*/;
3077++COMMIT
3078++/*!*/;
3079++# at #
3080++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3081++SET TIMESTAMP=1000000000/*!*/;
3082++BEGIN
3083++/*!*/;
3084++# at #
3085++# at #
3086++#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
3087++#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
3088++### DELETE FROM test2.t2
3089++### WHERE
3090++### @1=3 /* INT meta=0 nullable=1 is_null=0 */
3091++### DELETE FROM test2.t2
3092++### WHERE
3093++### @1=2 /* INT meta=0 nullable=1 is_null=0 */
3094++### DELETE FROM test2.t2
3095++### WHERE
3096++### @1=1 /* INT meta=0 nullable=1 is_null=0 */
3097++# at #
3098++#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
3099++SET TIMESTAMP=1000000000/*!*/;
3100++COMMIT
3101++/*!*/;
3102++# at #
3103++#010909 4:46:40 server id # end_log_pos # Rotate to master-bin.000002 pos: 4
3104++DELIMITER ;
3105++# End of log file
3106++ROLLBACK /* added by mysqlbinlog */;
3107++/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
3108+--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result
3109++++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result
3110+@@ -331,7 +331,7 @@
3111+ master-bin.000001 # Query # # use `test`; insert into t1 values( 243 )
3112+ master-bin.000001 # Query # # use `test`; insert into t1 values( 242 )
3113+ master-bin.000001 # Query # # use `test`; insert into t1 values( 241 )
3114+-master-bin.000001 # Query # # use `test`; insert into t1 values( 240 )
3115++master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
3116+ master-bin.000001 # Query # # use `test`; insert into t1 values( 239 )
3117+ master-bin.000001 # Query # # use `test`; insert into t1 values( 238 )
3118+ master-bin.000001 # Query # # use `test`; insert into t1 values( 237 )
3119+@@ -465,7 +465,7 @@
3120+ master-bin.000001 # Query # # use `test`; insert into t1 values( 109 )
3121+ master-bin.000001 # Query # # use `test`; insert into t1 values( 108 )
3122+ master-bin.000001 # Query # # use `test`; insert into t1 values( 107 )
3123+-master-bin.000001 # Query # # use `test`; insert into t1 values( <binlog_start> )
3124++master-bin.000001 # Query # # use `test`; insert into t1 values( 106 )
3125+ master-bin.000001 # Query # # use `test`; insert into t1 values( 105 )
3126+ master-bin.000001 # Query # # use `test`; insert into t1 values( 104 )
3127+ master-bin.000001 # Query # # use `test`; insert into t1 values( 103 )
3128+--- a/mysql-test/suite/binlog/t/binlog_incident.test
3129++++ b/mysql-test/suite/binlog/t/binlog_incident.test
3130+@@ -4,6 +4,7 @@
3131+
3132+ source include/have_log_bin.inc;
3133+ source include/have_debug.inc;
3134++source include/binlog_start_pos.inc;
3135+
3136+ let $MYSQLD_DATADIR= `select @@datadir`;
3137+ RESET MASTER;
3138+@@ -20,7 +21,7 @@
3139+ DROP TABLE t1;
3140+ FLUSH LOGS;
3141+
3142+-exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
3143++exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
3144+ --disable_query_log
3145+ 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;
3146+ --enable_query_log
3147+--- a/mysql-test/suite/binlog/t/binlog_killed.test
3148++++ b/mysql-test/suite/binlog/t/binlog_killed.test
3149+@@ -1,5 +1,6 @@
3150+ -- source include/have_innodb.inc
3151+ -- source include/have_binlog_format_statement.inc
3152++-- source include/binlog_start_pos.inc
3153+
3154+ # You cannot use `KILL' with the Embedded MySQL Server library,
3155+ # because the embedded server merely runs inside the threads of the host
3156+@@ -51,7 +52,8 @@
3157+ let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
3158+
3159+ let $MYSQLD_DATADIR= `select @@datadir`;
3160+---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
3161++let $start_pos= `select @binlog_start_pos + 28`;
3162++--exec $MYSQL_BINLOG --force-if-open --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
3163+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3164+ eval select
3165+ (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
3166+--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
3167++++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
3168+@@ -1,5 +1,6 @@
3169+ -- source include/have_debug.inc
3170+ -- source include/have_binlog_format_statement.inc
3171++-- source include/binlog_start_pos.inc
3172+ #
3173+ # bug#27571 asynchronous setting mysql_$query()'s local error and
3174+ # Query_log_event::error_code
3175+@@ -24,7 +25,7 @@
3176+ # for some constants like the offset of the first real event
3177+ # that is different between severs versions.
3178+ let $MYSQLD_DATADIR= `select @@datadir`;
3179+---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
3180++--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
3181+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3182+ eval select
3183+ (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
3184+--- /dev/null
3185++++ b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt
3186+@@ -0,0 +1 @@
3187++--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3
3188+--- /dev/null
3189++++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test
3190+@@ -0,0 +1,189 @@
3191++###############################################################################
3192++# WL47: Store in binlog text of statements that caused RBR events
3193++# new event: ANNOTATE_ROWS_EVENT
3194++# new master option: --binlog-annotate-rows-events
3195++# new mysqlbinlog option: --skip-annotate-rows-events
3196++#
3197++# Intended to test that:
3198++# *** If the --binlog-annotate-rows-events option is switched on on master
3199++# then Annotate_rows events:
3200++# - are generated;
3201++# - are generated only once for "multi-table-maps" rbr queries;
3202++# - are not generated when the corresponding queries are filtered away;
3203++# - are generated when the corresponding queries are filtered away partialy
3204++# (e.g. in case of multi-delete).
3205++# *** Annotate_rows events are printed by mysqlbinlog started without
3206++# --skip-annotate-rows-events options both in remote and local cases.
3207++# *** Annotate_rows events are not printed by mysqlbinlog started with
3208++# --skip-annotate-rows-events options both in remote and local cases.
3209++###############################################################################
3210++
3211++--source include/have_log_bin.inc
3212++--source include/have_binlog_format_row.inc
3213++--source include/binlog_start_pos.inc
3214++
3215++--disable_query_log
3216++
3217++# Fix timestamp to avoid varying results
3218++SET timestamp=1000000000;
3219++
3220++# Delete all existing binary logs
3221++RESET MASTER;
3222++
3223++--disable_warnings
3224++DROP DATABASE IF EXISTS test1;
3225++DROP DATABASE IF EXISTS test2;
3226++DROP DATABASE IF EXISTS test3;
3227++DROP DATABASE IF EXISTS xtest1;
3228++DROP DATABASE IF EXISTS xtest2;
3229++--enable_warnings
3230++
3231++CREATE DATABASE test1;
3232++CREATE TABLE test1.t1(a int);
3233++
3234++CREATE DATABASE test2;
3235++CREATE TABLE test2.t2(a int);
3236++CREATE VIEW test2.v2 AS SELECT * FROM test2.t2;
3237++
3238++CREATE DATABASE test3;
3239++CREATE TABLE test3.t3(a int);
3240++
3241++CREATE DATABASE xtest1;
3242++CREATE TABLE xtest1.xt1(a int);
3243++
3244++CREATE DATABASE xtest2;
3245++CREATE TABLE xtest2.xt2(a int);
3246++
3247++# By default SESSION binlog_annotate_rows_events = OFF
3248++
3249++INSERT INTO test1.t1 VALUES (1), (2), (3);
3250++
3251++SET SESSION binlog_annotate_rows_events = ON;
3252++
3253++INSERT INTO test2.t2 VALUES (1), (2), (3);
3254++INSERT INTO test3.t3 VALUES (1), (2), (3);
3255++
3256++# This query generates two Table maps but the Annotate
3257++# event should appear only once before the first Table map
3258++DELETE test1.t1, test2.t2
3259++ FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
3260++ WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
3261++
3262++# This event should be filtered out together with Annotate event
3263++INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
3264++
3265++# This event should pass the filter
3266++INSERT INTO test2.v2 VALUES (1), (2), (3);
3267++
3268++# This event should pass the filter only for test2.t2 part
3269++DELETE xtest1.xt1, test2.t2
3270++ FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
3271++ WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
3272++
3273++# These events should be filtered out together with Annotate events
3274++INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
3275++INSERT INTO xtest2.xt2 VALUES (1), (2), (3);
3276++DELETE xtest1.xt1, xtest2.xt2
3277++ FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3
3278++ WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a;
3279++
3280++FLUSH LOGS;
3281++--enable_query_log
3282++
3283++--echo #####################################################################################
3284++--echo # The following Annotate_rows events should appear below:
3285++--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
3286++--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
3287++--echo # - DELETE test1.t1, test2.t2 FROM <...>
3288++--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
3289++--echo # - DELETE xtest1.xt1, test2.t2 FROM <...>
3290++--echo #####################################################################################
3291++
3292++let $start_pos= `select @binlog_start_pos`;
3293++--replace_column 2 # 5 #
3294++--replace_result $start_pos <start_pos>
3295++--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
3296++--eval show binlog events in 'master-bin.000001' from $start_pos
3297++
3298++--echo #
3299++--echo #####################################################################################
3300++--echo # mysqlbinlog
3301++--echo # The following Annotates should appear in this output:
3302++--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
3303++--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
3304++--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
3305++--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
3306++--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
3307++--echo #####################################################################################
3308++
3309++let $MYSQLD_DATADIR= `select @@datadir`;
3310++--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 #/
3311++--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
3312++
3313++--echo #
3314++--echo #####################################################################################
3315++--echo # mysqlbinlog --database=test1
3316++--echo # The following Annotate should appear in this output:
3317++--echo # - DELETE test1.t1, test2.t2 FROM <...>
3318++--echo #####################################################################################
3319++
3320++let $MYSQLD_DATADIR= `select @@datadir`;
3321++--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 #/
3322++--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001
3323++
3324++--echo #
3325++--echo #####################################################################################
3326++--echo # mysqlbinlog --skip-annotate-rows-events
3327++--echo # No Annotates should appear in this output
3328++--echo #####################################################################################
3329++
3330++let $MYSQLD_DATADIR= `select @@datadir`;
3331++--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 #/
3332++--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v $MYSQLD_DATADIR/master-bin.000001
3333++
3334++--echo #
3335++--echo #####################################################################################
3336++--echo # mysqlbinlog --read-from-remote-server
3337++--echo # The following Annotates should appear in this output:
3338++--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
3339++--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
3340++--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
3341++--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
3342++--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
3343++--echo #####################################################################################
3344++
3345++let $MYSQLD_DATADIR= `select @@datadir`;
3346++--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 #/
3347++--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
3348++
3349++--echo #
3350++--echo #####################################################################################
3351++--echo # mysqlbinlog --read-from-remote-server --database=test1
3352++--echo # The following Annotate should appear in this output:
3353++--echo # - DELETE test1.t1, test2.t2 FROM <...>
3354++--echo #####################################################################################
3355++
3356++let $MYSQLD_DATADIR= `select @@datadir`;
3357++--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 #/
3358++--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
3359++
3360++--echo #
3361++--echo #####################################################################################
3362++--echo # mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
3363++--echo # No Annotates should appear in this output
3364++--echo #####################################################################################
3365++
3366++let $MYSQLD_DATADIR= `select @@datadir`;
3367++--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 #/
3368++--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
3369++
3370++# Clean-up
3371++
3372++--disable_query_log
3373++DROP DATABASE test1;
3374++DROP DATABASE test2;
3375++DROP DATABASE test3;
3376++DROP DATABASE xtest1;
3377++DROP DATABASE xtest2;
3378++--enable_query_log
3379++
3380+--- /dev/null
3381++++ b/mysql-test/suite/rpl/r/percona_replicate_annotate_rows_events.result
3382+@@ -0,0 +1,16 @@
3383++include/master-slave.inc
3384++[connection master]
3385++DROP TABLE IF EXISTS t;
3386++CREATE TABLE t (a INT);
3387++INSERT INTO t VALUES(1);
3388++DROP TABLE t;
3389++select 738;
3390++738
3391++738
3392++select 738 = 738;
3393++738 = 738
3394++1
3395++select 738 = 738;
3396++738 = 738
3397++1
3398++include/rpl_end.inc
3399+--- /dev/null
3400++++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
3401+@@ -0,0 +1,141 @@
3402++include/master-slave.inc
3403++[connection master]
3404++########################################################################
3405++# TABLES ON MASTER
3406++########################################################################
3407++SELECT * FROM t1 ORDER BY a;
3408++a b
3409++0 1
3410++SELECT * FROM t2 ORDER BY a;
3411++a b
3412++SELECT * FROM t3 ORDER BY a;
3413++a b
3414++1 1
3415++2 2
3416++3 3
3417++SELECT * FROM t5 ORDER BY a;
3418++a b
3419++1 foo
3420++2 bar
3421++3 baz
3422++4 gås
3423++5 gås
3424++########################################################################
3425++# TABLES ON SLAVE: should be the same as on master
3426++########################################################################
3427++SELECT * FROM t1 ORDER BY a;
3428++a b
3429++0 1
3430++SELECT * FROM t2 ORDER BY a;
3431++a b
3432++SELECT * FROM t3 ORDER BY a;
3433++a b
3434++1 1
3435++2 2
3436++3 3
3437++SELECT * FROM t5 ORDER BY a;
3438++a b
3439++1 foo
3440++2 bar
3441++3 baz
3442++4 gås
3443++5 gås
3444++########################################################################
3445++# EVENTS ON SLAVE
3446++# The following Annotate_rows events should appear below:
3447++# - UPDATE t1 SET b = b + 1;
3448++# - REPLACE t1 VALUES (1,1), (2,2), (3,3);
3449++# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
3450++# - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
3451++# - DELETE t1, t2 FROM <...>
3452++# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
3453++# - DELETE xt1, t2 FROM <...>
3454++# - INSERT INTO t5(b) VALUES <...> (3 instances)
3455++########################################################################
3456++FLUSH LOGS;
3457++show binlog events in 'slave-bin.000001' from <start_pos>;
3458++Log_name Pos Event_type Server_id End_log_pos Info
3459++slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
3460++slave-bin.000001 # Query 1 # CREATE DATABASE test1
3461++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
3462++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int)
3463++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int)
3464++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int)
3465++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 (
3466++a INT PRIMARY KEY AUTO_INCREMENT,
3467++b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
3468++)
3469++slave-bin.000001 # Query 1 # BEGIN
3470++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3471++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3472++slave-bin.000001 # Query 1 # COMMIT
3473++slave-bin.000001 # Query 1 # BEGIN
3474++slave-bin.000001 # Annotate_rows 1 # UPDATE t1 SET b = b + 1
3475++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3476++slave-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
3477++slave-bin.000001 # Query 1 # COMMIT
3478++slave-bin.000001 # Query 1 # BEGIN
3479++slave-bin.000001 # Annotate_rows 1 # REPLACE t1 VALUES (1,1), (2,2), (3,3)
3480++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3481++slave-bin.000001 # Update_rows 1 # table_id: #
3482++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3483++slave-bin.000001 # Query 1 # COMMIT
3484++slave-bin.000001 # Query 1 # BEGIN
3485++slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
3486++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3487++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3488++slave-bin.000001 # Query 1 # COMMIT
3489++slave-bin.000001 # Query 1 # BEGIN
3490++slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
3491++slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
3492++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3493++slave-bin.000001 # Query 1 # COMMIT
3494++slave-bin.000001 # Query 1 # BEGIN
3495++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
3496++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3497++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3498++slave-bin.000001 # Delete_rows 1 # table_id: #
3499++slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
3500++slave-bin.000001 # Query 1 # COMMIT
3501++slave-bin.000001 # Query 1 # BEGIN
3502++slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
3503++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3504++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3505++slave-bin.000001 # Query 1 # COMMIT
3506++slave-bin.000001 # Query 1 # BEGIN
3507++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
3508++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3509++slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
3510++slave-bin.000001 # Query 1 # COMMIT
3511++slave-bin.000001 # Query 1 # BEGIN
3512++slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz')
3513++slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
3514++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3515++slave-bin.000001 # Query 1 # COMMIT
3516++slave-bin.000001 # Query 1 # BEGIN
3517++slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås')
3518++slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
3519++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3520++slave-bin.000001 # Query 1 # COMMIT
3521++slave-bin.000001 # Query 1 # BEGIN
3522++slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås')
3523++slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
3524++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3525++slave-bin.000001 # Query 1 # COMMIT
3526++slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
3527++#
3528++########################################################################
3529++# INSERTs DELAYED ON MASTERs
3530++########################################################################
3531++SET SESSION binlog_annotate_rows_events = ON;
3532++INSERT DELAYED INTO test1.t4 VALUES (1,1);
3533++FLUSH TABLES;
3534++SELECT * FROM test1.t4 ORDER BY a;
3535++a b
3536++1 1
3537++########################################################################
3538++# ON SLAVE
3539++# No Annotate_rows events should appear below
3540++########################################################################
3541++FLUSH LOGS;
3542++include/rpl_end.inc
3543+--- /dev/null
3544++++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
3545+@@ -0,0 +1,123 @@
3546++include/master-slave.inc
3547++[connection master]
3548++########################################################################
3549++# TABLES ON MASTER
3550++########################################################################
3551++SELECT * FROM t1 ORDER BY a;
3552++a b
3553++0 1
3554++SELECT * FROM t2 ORDER BY a;
3555++a b
3556++SELECT * FROM t3 ORDER BY a;
3557++a b
3558++1 1
3559++2 2
3560++3 3
3561++SELECT * FROM t5 ORDER BY a;
3562++a b
3563++1 foo
3564++2 bar
3565++3 baz
3566++4 gås
3567++5 gås
3568++########################################################################
3569++# TABLES ON SLAVE: should be the same as on master
3570++########################################################################
3571++SELECT * FROM t1 ORDER BY a;
3572++a b
3573++0 1
3574++SELECT * FROM t2 ORDER BY a;
3575++a b
3576++SELECT * FROM t3 ORDER BY a;
3577++a b
3578++1 1
3579++2 2
3580++3 3
3581++SELECT * FROM t5 ORDER BY a;
3582++a b
3583++1 foo
3584++2 bar
3585++3 baz
3586++4 gås
3587++5 gås
3588++########################################################################
3589++# EVENTS ON SLAVE
3590++# No Annotate_rows events should appear below
3591++########################################################################
3592++FLUSH LOGS;
3593++show binlog events in 'slave-bin.000001' from <start_pos>;
3594++Log_name Pos Event_type Server_id End_log_pos Info
3595++slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
3596++slave-bin.000001 # Query 1 # CREATE DATABASE test1
3597++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
3598++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int)
3599++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int)
3600++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int)
3601++slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 (
3602++a INT PRIMARY KEY AUTO_INCREMENT,
3603++b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
3604++)
3605++slave-bin.000001 # Query 1 # BEGIN
3606++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3607++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3608++slave-bin.000001 # Query 1 # COMMIT
3609++slave-bin.000001 # Query 1 # BEGIN
3610++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3611++slave-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F
3612++slave-bin.000001 # Query 1 # COMMIT
3613++slave-bin.000001 # Query 1 # BEGIN
3614++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3615++slave-bin.000001 # Update_rows 1 # table_id: #
3616++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3617++slave-bin.000001 # Query 1 # COMMIT
3618++slave-bin.000001 # Query 1 # BEGIN
3619++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3620++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3621++slave-bin.000001 # Query 1 # COMMIT
3622++slave-bin.000001 # Query 1 # BEGIN
3623++slave-bin.000001 # Table_map 1 # table_id: # (test1.t3)
3624++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3625++slave-bin.000001 # Query 1 # COMMIT
3626++slave-bin.000001 # Query 1 # BEGIN
3627++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3628++slave-bin.000001 # Table_map 1 # table_id: # (test1.t1)
3629++slave-bin.000001 # Delete_rows 1 # table_id: #
3630++slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
3631++slave-bin.000001 # Query 1 # COMMIT
3632++slave-bin.000001 # Query 1 # BEGIN
3633++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3634++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3635++slave-bin.000001 # Query 1 # COMMIT
3636++slave-bin.000001 # Query 1 # BEGIN
3637++slave-bin.000001 # Table_map 1 # table_id: # (test1.t2)
3638++slave-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F
3639++slave-bin.000001 # Query 1 # COMMIT
3640++slave-bin.000001 # Query 1 # BEGIN
3641++slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
3642++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3643++slave-bin.000001 # Query 1 # COMMIT
3644++slave-bin.000001 # Query 1 # BEGIN
3645++slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
3646++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3647++slave-bin.000001 # Query 1 # COMMIT
3648++slave-bin.000001 # Query 1 # BEGIN
3649++slave-bin.000001 # Table_map 1 # table_id: # (test1.t5)
3650++slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
3651++slave-bin.000001 # Query 1 # COMMIT
3652++slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
3653++#
3654++########################################################################
3655++# INSERTs DELAYED ON MASTERs
3656++########################################################################
3657++SET SESSION binlog_annotate_rows_events = ON;
3658++INSERT DELAYED INTO test1.t4 VALUES (1,1);
3659++FLUSH TABLES;
3660++SELECT * FROM test1.t4 ORDER BY a;
3661++a b
3662++1 1
3663++########################################################################
3664++# ON SLAVE
3665++# No Annotate_rows events should appear below
3666++########################################################################
3667++FLUSH LOGS;
3668++include/rpl_end.inc
3669+--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result
3670++++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
3671+@@ -21,7 +21,7 @@
3672+ [on slave]
3673+ ---- Wait until slave stops with an error ----
3674+ include/wait_for_slave_sql_error.inc [errno=1062]
3675+-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)
3676++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)
3677+ call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062");
3678+ SELECT * FROM t1;
3679+ a
3680+--- /dev/null
3681++++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-master.opt
3682+@@ -0,0 +1 @@
3683++--binlog_annotate_rows_events --replicate_annotate_rows_events
3684+--- /dev/null
3685++++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-slave.opt
3686+@@ -0,0 +1 @@
3687++--slave_net_timeout=1 --log_slave_updates=0 --binlog_annotate_rows_events --replicate_annotate_rows_events
3688+--- /dev/null
3689++++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events.test
3690+@@ -0,0 +1,35 @@
3691++########################################################################
3692++# Bug #872754: Annotate rows events on slave doesnt' work without slave's binlog
3693++########################################################################
3694++
3695++--source include/master-slave.inc
3696++--source include/have_binlog_format_row.inc
3697++--source include/have_debug.inc
3698++
3699++connection master;
3700++--disable_warnings
3701++DROP TABLE IF EXISTS t;
3702++--enable_warnings
3703++
3704++CREATE TABLE t (a INT);
3705++INSERT INTO t VALUES(1);
3706++
3707++--sleep 2
3708++
3709++DROP TABLE t;
3710++
3711++# The following would hang with the bug not fixed
3712++--sync_slave_with_master
3713++
3714++connection master;
3715++--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
3716++--eval select $master_log_pos
3717++
3718++connection slave;
3719++--let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
3720++--eval select $master_log_pos = $read_master_log_pos
3721++
3722++--let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
3723++--eval select $master_log_pos = $exec_master_log_pos
3724++
3725++--source include/rpl_end.inc
3726+--- /dev/null
3727++++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt
3728+@@ -0,0 +1 @@
3729++--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
3730+\ No newline at end of file
3731+--- /dev/null
3732++++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test
3733+@@ -0,0 +1,16 @@
3734++###############################################################################
3735++# WL47: Store in binlog text of statements that caused RBR events
3736++# Wrapper for extra/rpl/rpl_row_annotate.test.
3737++# Intended to test that if the --replicate-annotate-rows-events option
3738++# is switched on on slave then Annotate_events:
3739++# - are reproduced on slave
3740++# - are reproduced only once for "multi-table-maps" rbr queries
3741++# - are not reproduced when the corresponding queries are filtered away
3742++# on replication
3743++# - are reproduced when the corresponding queries are filtered away partialy
3744++# (e.g. in case of multi-delete)
3745++# - are not generated on slave for queries that are not annotated on master.
3746++###############################################################################
3747++
3748++--source include/have_binlog_format_row.inc
3749++--source extra/rpl_tests/rpl_row_annotate.test
3750+--- /dev/null
3751++++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt
3752+@@ -0,0 +1 @@
3753++--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
3754+\ No newline at end of file
3755+--- /dev/null
3756++++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test
3757+@@ -0,0 +1,9 @@
3758++###############################################################################
3759++# WL47: Store in binlog text of statements that caused RBR events
3760++# Wrapper for extra/rpl/rpl_row_annotate.test.
3761++# Intended to test that if the --replicate-annotate-rows-events option
3762++# is switched off on slave then Annotate_events are not reproduced.
3763++###############################################################################
3764++
3765++--source include/have_binlog_format_row.inc
3766++--source extra/rpl_tests/rpl_row_annotate.test
3767+--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
3768++++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
3769+@@ -1,7 +1,8 @@
3770+ # depends on the binlog output
3771+ -- source include/have_binlog_format_row.inc
3772++--source include/binlog_start_pos.inc
3773+
3774+-let $rename_event_pos= 897;
3775++let $rename_event_pos= `select @binlog_start_pos + 791`;
3776+
3777+ # Bug#18326: Do not lock table for writing during prepare of statement
3778+ # The use of the ps protocol causes extra table maps in the binlog, so
3779+--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
3780++++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
3781+@@ -162,15 +162,18 @@
3782+
3783+ remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
3784+
3785++--source include/binlog_start_pos.inc
3786+
3787+ # this test for position option
3788+-# By setting this position to 416, we should only get the create of t3
3789++# By setting this position to start_binlog_pos + 310, we should only get the create of t3
3790++let $start_pos= `select @binlog_start_pos + 310`;
3791++let $stop_pos= `select @binlog_start_pos + 463`;
3792+ --disable_query_log
3793+ select "--- Test 2 position test --" as "";
3794+ --enable_query_log
3795+ let $MYSQLD_DATADIR= `select @@datadir;`;
3796+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3797+---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
3798++--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
3799+
3800+ # These are tests for remote binlog.
3801+ # They should return the same as previous test.
3802+@@ -181,7 +184,7 @@
3803+
3804+ # This is broken now
3805+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3806+---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
3807++--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
3808+
3809+ # This part is disabled due to bug #17654
3810+
3811+@@ -257,7 +260,7 @@
3812+ select "--- Test 5 LOAD DATA --" as "";
3813+ --enable_query_log
3814+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3815+---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
3816++--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
3817+
3818+ # Bug#7853 (mysqlbinlog does not accept input from stdin)
3819+
3820+@@ -265,14 +268,17 @@
3821+ select "--- Test 6 reading stdin --" as "";
3822+ --enable_query_log
3823+ let $MYSQLD_DATADIR= `select @@datadir;`;
3824++let $stop_pos= `select @binlog_start_pos + 463`;
3825+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
3826+---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
3827++--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
3828+
3829+ --disable_query_log
3830+ select "--- Test 7 reading stdin w/position --" as "";
3831+ --enable_query_log
3832++let $start_pos= `select @binlog_start_pos + 310`;
3833++let $stop_pos= `select @binlog_start_pos + 463`;
3834+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
3835+---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
3836++--exec $MYSQL_BINLOG --short-form --position=$start_pos --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
3837+
3838+ # Bug#16217 (mysql client did not know how not switch its internal charset)
3839+ --disable_query_log
3840+--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
3841++++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
3842+@@ -1,5 +1,6 @@
3843+ # depends on the binlog output
3844+ --source include/have_binlog_format_mixed_or_statement.inc
3845++--source include/binlog_start_pos.inc
3846+
3847+-let $rename_event_pos= 656;
3848++let $rename_event_pos= `select @binlog_start_pos + 550`;
3849+ -- source extra/rpl_tests/rpl_flsh_tbls.test
3850+--- a/mysql-test/t/ctype_cp932_binlog_stm.test
3851++++ b/mysql-test/t/ctype_cp932_binlog_stm.test
3852+@@ -28,16 +28,6 @@
3853+
3854+ --echo End of 5.0 tests
3855+
3856+-#
3857+-# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
3858+-# Note: 364 is a magic position (found experimentally, depends on
3859+-# the log's contents) that caused the server crash.
3860+-
3861+-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
3862+-
3863+---error 1220
3864+-SHOW BINLOG EVENTS FROM 365;
3865+-
3866+ --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
3867+ CREATE TABLE t1 (a varchar(16)) character set cp932;
3868+ INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
3869+--- a/mysql-test/t/mysqlbinlog-master.opt
3870++++ b/mysql-test/t/mysqlbinlog-master.opt
3871+@@ -1,2 +1 @@
3872+---max-binlog-size=4096
3873+ --force-restart
3874+--- a/mysql-test/t/mysqlbinlog.test
3875++++ b/mysql-test/t/mysqlbinlog.test
3876+@@ -3,10 +3,18 @@
3877+ -- source include/have_binlog_format_statement.inc
3878+
3879+ -- source include/have_log_bin.inc
3880++-- source include/binlog_start_pos.inc
3881+
3882+ # Deletes all the binary logs
3883+ reset master;
3884+
3885++# We need small binlog size to break the last LOAD DATA INFILE below so that
3886++# the corresponding Begin_load_query will be written to master-bin.000001
3887++# while the Execute_load_query will be written to master-bin.000002.
3888++
3889++SET @save_binlog_size= @@global.max_binlog_size;
3890++SET @@global.max_binlog_size= 4096;
3891++
3892+ # we need this for getting fixed timestamps inside of this test
3893+ set timestamp=1000000000;
3894+
3895+@@ -26,13 +34,15 @@
3896+
3897+ # test for load data and load data distributed among the several
3898+ # files (we need to fill up first binlog)
3899+-load data infile '../../std_data/words.dat' into table t1;
3900+-load data infile '../../std_data/words.dat' into table t1;
3901+-load data infile '../../std_data/words.dat' into table t1;
3902+-load data infile '../../std_data/words.dat' into table t1;
3903+-load data infile '../../std_data/words.dat' into table t1;
3904++load data infile '../../std_data/words3.dat' into table t1;
3905++load data infile '../../std_data/words3.dat' into table t1;
3906++load data infile '../../std_data/words3.dat' into table t1;
3907++load data infile '../../std_data/words3.dat' into table t1;
3908++load data infile '../../std_data/words3.dat' into table t1;
3909+ # simple query to show more in second binlog
3910+ insert into t1 values ("Alas");
3911++
3912++### Starting master-bin.000003
3913+ flush logs;
3914+
3915+ # delimiters are for easier debugging in future
3916+@@ -46,7 +56,7 @@
3917+ #
3918+ let $MYSQLD_DATADIR= `select @@datadir`;
3919+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3920+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3921++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3922+ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
3923+
3924+ # this should not fail but shouldn't produce any working statements
3925+@@ -54,7 +64,7 @@
3926+ select "--- Broken LOAD DATA --" as "";
3927+ --enable_query_log
3928+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3929+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3930++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3931+ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
3932+
3933+ # this should show almost nothing
3934+@@ -62,17 +72,17 @@
3935+ select "--- --database --" as "";
3936+ --enable_query_log
3937+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3938+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3939++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3940+ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
3941+
3942+ # this test for position option
3943+ --disable_query_log
3944+ select "--- --position --" as "";
3945+ --enable_query_log
3946++let $start_pos= `select @binlog_start_pos + 227`;
3947+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3948+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3949+---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002
3950+-
3951++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3952++--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002
3953+
3954+ # These are tests for remote binlog.
3955+ # They should return the same as previous test.
3956+@@ -83,7 +93,7 @@
3957+
3958+ # This is broken now
3959+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3960+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3961++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3962+ --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
3963+
3964+ # This is broken too
3965+@@ -91,7 +101,7 @@
3966+ select "--- Broken LOAD DATA --" as "";
3967+ --enable_query_log
3968+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3969+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3970++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3971+ --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
3972+
3973+ # And this too ! (altough it is documented)
3974+@@ -99,34 +109,39 @@
3975+ select "--- --database --" as "";
3976+ --enable_query_log
3977+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3978+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3979++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3980+ --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
3981+
3982+ # Strangely but this works
3983+ --disable_query_log
3984+ select "--- --position --" as "";
3985+ --enable_query_log
3986++let $start_pos= `select @binlog_start_pos + 227`;
3987+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3988+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3989+---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
3990++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
3991++--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
3992+
3993+ # Bug#7853 mysqlbinlog does not accept input from stdin
3994+ --disable_query_log
3995+ select "--- reading stdin --" as "";
3996+ --enable_query_log
3997+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
3998+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
3999++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
4000+ --exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
4001+
4002+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
4003+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
4004++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
4005+ --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
4006+ drop table t1,t2;
4007+
4008++SET @@global.max_binlog_size= @save_binlog_size;
4009++
4010+ #
4011+ # Bug#14157 utf8 encoding in binlog without set character_set_client
4012+ #
4013++### Starting master-bin.000004
4014+ flush logs;
4015++
4016+ --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
4017+ create table if not exists t5 (a int);
4018+ set names latin1;
4019+@@ -140,6 +155,8 @@
4020+ # resulted binlog, parly consisting of multi-byte utf8 chars,
4021+ # must be digestable for both client and server. In 4.1 the client
4022+ # should use default-character-set same as the server.
4023++
4024++### Starting master-bin.000005
4025+ flush logs;
4026+ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
4027+ select * from t5 /* must be (1),(1) */;
4028+@@ -150,6 +167,8 @@
4029+ # Check that a dump created by mysqlbinlog reproduces
4030+ # lc_time_names dependent values correctly
4031+ #
4032++
4033++### Starting master-bin.000006
4034+ flush logs;
4035+ create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
4036+ insert into t5 values (1, date_format('2001-01-01','%W'));
4037+@@ -158,7 +177,10 @@
4038+ set lc_time_names=en_US;
4039+ insert into t5 values (3, date_format('2001-01-01','%W'));
4040+ select * from t5 order by c1;
4041++
4042++### Starting master-bin.000007
4043+ flush logs;
4044++
4045+ drop table t5;
4046+ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
4047+ select * from t5 order by c1;
4048+@@ -170,7 +192,10 @@
4049+ --disable_warnings
4050+ drop procedure if exists p1;
4051+ --enable_warnings
4052++
4053++### Starting master-bin.000008
4054+ flush logs;
4055++
4056+ delimiter //;
4057+ create procedure p1()
4058+ begin
4059+@@ -178,12 +203,15 @@
4060+ end;
4061+ //
4062+ delimiter ;//
4063++
4064++### Starting master-bin.000009
4065+ flush logs;
4066++
4067+ call p1();
4068+ drop procedure p1;
4069+ --error ER_SP_DOES_NOT_EXIST
4070+ call p1();
4071+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
4072++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
4073+ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
4074+ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
4075+ call p1();
4076+@@ -202,7 +230,9 @@
4077+ # (LOAD DATA INFILE need it)
4078+ #
4079+
4080++### Starting master-bin.000010
4081+ flush logs;
4082++
4083+ create table t1 (a varchar(64) character set utf8);
4084+ load data infile '../../std_data/loaddata6.dat' into table t1;
4085+ set character_set_database=koi8r;
4086+@@ -217,9 +247,12 @@
4087+ load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
4088+ select hex(a) from t1;
4089+ drop table t1;
4090++
4091++### Starting master-bin.000011
4092+ flush logs;
4093++
4094+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
4095+---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
4096++--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
4097+ --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
4098+
4099+ #
4100+@@ -229,9 +262,14 @@
4101+
4102+ CREATE TABLE t1 (c1 CHAR(10));
4103+ # we need this for getting fixed timestamps inside of this test
4104++### Starting master-bin.000012
4105+ FLUSH LOGS;
4106++
4107+ INSERT INTO t1 VALUES ('0123456789');
4108++
4109++### Starting master-bin.000013
4110+ FLUSH LOGS;
4111++
4112+ DROP TABLE t1;
4113+
4114+ # We create a table, patch, and load the output into it
4115+@@ -257,11 +295,16 @@
4116+ #
4117+ # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
4118+ #
4119++### Starting master-bin.000014
4120+ FLUSH LOGS;
4121++
4122+ CREATE TABLE t1(a INT);
4123+ INSERT INTO t1 VALUES(connection_id());
4124+ let $a= `SELECT a FROM t1`;
4125++
4126++### Starting master-bin.000015
4127+ FLUSH LOGS;
4128++
4129+ let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
4130+ --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
4131+ DROP TABLE t1;
4132+@@ -281,11 +324,12 @@
4133+ exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
4134+ --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
4135+
4136+-
4137+ #
4138+ # Test --disable-force-if-open and --force-if-open
4139+ #
4140++### Starting master-bin.000016
4141+ FLUSH LOGS;
4142++
4143+ --error 1
4144+ --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
4145+ --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
4146+@@ -300,9 +344,15 @@
4147+ SHOW GRANTS FOR untrusted@localhost;
4148+ USE mysqltest1;
4149+ CREATE TABLE t1 (a INT, b CHAR(64));
4150++
4151++### Starting master-bin.000017
4152+ flush logs;
4153++
4154+ INSERT INTO t1 VALUES (1,USER());
4155++
4156++### Starting master-bin.000018
4157+ flush logs;
4158++
4159+ echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
4160+ exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
4161+ connect (unsecure,localhost,untrusted,,mysqltest1);
4162+@@ -326,14 +376,20 @@
4163+ connection default;
4164+ USE test;
4165+ SET BINLOG_FORMAT = STATEMENT;
4166++
4167++### Starting master-bin.000019
4168+ FLUSH LOGS;
4169++
4170+ CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
4171+ SET @a_real = rand(20) * 1000;
4172+ SET @an_int = 1000;
4173+ SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
4174+ SET @a_string = 'Just a test';
4175+ INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
4176++
4177++### Starting master-bin.000020
4178+ FLUSH LOGS;
4179++
4180+ query_vertical SELECT * FROM t1;
4181+ DROP TABLE t1;
4182+
4183+@@ -357,6 +413,7 @@
4184+
4185+ RESET MASTER;
4186+ FLUSH LOGS;
4187++
4188+ --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
4189+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
4190+ eval SELECT
4191+--- a/mysql-test/t/mysqlbinlog2.test
4192++++ b/mysql-test/t/mysqlbinlog2.test
4193+@@ -3,7 +3,7 @@
4194+
4195+ # TODO: Need to look at making row based version once new binlog client is complete.
4196+ -- source include/have_binlog_format_mixed_or_statement.inc
4197+-
4198++-- source include/binlog_start_pos.inc
4199+
4200+ --disable_warnings
4201+ drop table if exists t1;
4202+@@ -50,15 +50,19 @@
4203+ --disable_query_log
4204+ select "--- start-position --" as "";
4205+ --enable_query_log
4206+---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
4207++let $start_pos= `select @binlog_start_pos + 502`;
4208++--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
4209+ --disable_query_log
4210+ select "--- stop-position --" as "";
4211+ --enable_query_log
4212+---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
4213++let $stop_pos= `select @binlog_start_pos + 502`;
4214++--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
4215+ --disable_query_log
4216+ select "--- start and stop positions ---" as "";
4217+ --enable_query_log
4218+---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
4219++let $start_pos= `select @binlog_start_pos + 502`;
4220++let $stop_pos= `select @binlog_start_pos + 619`;
4221++--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos $MYSQLD_DATADIR/master-bin.000001
4222+ --disable_query_log
4223+ select "--- start-datetime --" as "";
4224+ --enable_query_log
4225+@@ -84,11 +88,13 @@
4226+ --disable_query_log
4227+ select "--- start-position --" as "";
4228+ --enable_query_log
4229+---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
4230++let $start_pos= `select @binlog_start_pos + 502`;
4231++--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
4232+ --disable_query_log
4233+ select "--- stop-position --" as "";
4234+ --enable_query_log
4235+---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
4236++let $stop_pos= `select @binlog_start_pos + 28`;
4237++--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
4238+ --disable_query_log
4239+ select "--- start-datetime --" as "";
4240+ --enable_query_log
4241+@@ -111,15 +117,19 @@
4242+ --disable_query_log
4243+ select "--- start-position --" as "";
4244+ --enable_query_log
4245+---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
4246++let $start_pos= `select @binlog_start_pos + 502`;
4247++--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
4248+ --disable_query_log
4249+ select "--- stop-position --" as "";
4250+ --enable_query_log
4251+---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
4252++let $stop_pos= `select @binlog_start_pos + 502`;
4253++--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
4254+ --disable_query_log
4255+ select "--- start and stop positions ---" as "";
4256+ --enable_query_log
4257+---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
4258++let $start_pos= `select @binlog_start_pos + 502`;
4259++let $stop_pos= `select @binlog_start_pos + 619`;
4260++--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
4261+ --disable_query_log
4262+ select "--- start-datetime --" as "";
4263+ --enable_query_log
4264+@@ -142,11 +152,13 @@
4265+ --disable_query_log
4266+ select "--- start-position --" as "";
4267+ --enable_query_log
4268+---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
4269++let $start_pos= `select @binlog_start_pos + 502`;
4270++--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
4271+ --disable_query_log
4272+ select "--- stop-position --" as "";
4273+ --enable_query_log
4274+---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
4275++let $stop_pos= `select @binlog_start_pos + 28`;
4276++--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
4277+ --disable_query_log
4278+ select "--- start-datetime --" as "";
4279+ --enable_query_log
4280 --- a/sql/handler.cc
4281 +++ b/sql/handler.cc
4282 @@ -4625,7 +4625,8 @@
4283@@ -263,7 +3067,7 @@
4284 {
4285 int error;
4286 DBUG_ENTER("THD::binlog_write_table_map");
4287-@@ -4317,7 +4319,7 @@
4288+@@ -4317,7 +4320,7 @@
4289 if (is_trans && binlog_table_maps == 0)
4290 binlog_start_trans_and_stmt();
4291
4292@@ -272,7 +3076,7 @@
4293 DBUG_RETURN(error);
4294
4295 binlog_table_maps++;
4296-@@ -4447,10 +4449,12 @@
4297+@@ -4447,10 +4450,12 @@
4298 }
4299
4300 /**
4301@@ -287,7 +3091,7 @@
4302 {
4303 THD *thd= event_info->thd;
4304 bool error= 1;
4305-@@ -4631,6 +4635,16 @@
4306+@@ -4631,6 +4636,16 @@
4307 }
4308 }
4309
4310@@ -304,6 +3108,17 @@
4311 /*
4312 Write the SQL command
4313 */
4314+--- a/sql/log.h
4315++++ b/sql/log.h
4316+@@ -359,7 +359,7 @@
4317+ int new_file();
4318+
4319+ void reset_gathered_updates(THD *thd);
4320+- bool write(Log_event* event_info); // binary log write
4321++ bool write(Log_event *event_info, my_bool *with_annotate= 0); // binary log write
4322+ bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
4323+
4324+ bool write_incident(THD *thd, bool lock);
4325 --- a/sql/log_event.cc
4326 +++ b/sql/log_event.cc
4327 @@ -656,6 +656,7 @@
4328@@ -319,7 +3134,7 @@
4329 */
4330 if (description_event->binlog_version==3 &&
4331 - buf[EVENT_TYPE_OFFSET]<FORMAT_DESCRIPTION_EVENT && log_pos)
4332-+ (uchar)buf[EVENT_TYPE_OFFSET]<FORMAT_DESCRIPTION_EVENT && log_pos)
4333++ (uchar)buf[EVENT_TYPE_OFFSET] < FORMAT_DESCRIPTION_EVENT && log_pos)
4334 {
4335 /*
4336 If log_pos=0, don't change it. log_pos==0 is a marker to mean
4337@@ -487,9 +3302,9 @@
4338 + print_header(&pinfo->head_cache, pinfo, TRUE);
4339 + my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n");
4340 +
4341-+ char *pbeg; // beginning of the next line
4342-+ char *pend; // end of the next line
4343-+ uint cnt= 0; // characters counter
4344++ char *pbeg; // beginning of the next line
4345++ char *pend; // end of the next line
4346++ uint cnt= 0; // characters counter
4347 +
4348 + for (pbeg= m_query_txt; ; pbeg= pend)
4349 + {
4350@@ -506,7 +3321,7 @@
4351 + // find end of the next line
4352 + for (pend= pbeg + 1;
4353 + ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
4354-+ pend++) ;
4355++ pend++) {};
4356 +
4357 + // print next line
4358 + my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);
4359@@ -632,18 +3447,20 @@
4360 @class Table_map_log_event
4361
4362 In row-based mode, every row operation event is preceded by a
4363---- a/sql/log.h
4364-+++ b/sql/log.h
4365-@@ -359,7 +359,8 @@
4366- int new_file();
4367-
4368- void reset_gathered_updates(THD *thd);
4369-- bool write(Log_event* event_info); // binary log write
4370-+ bool write(Log_event* event_info,
4371-+ my_bool *with_annotate= 0); // binary log write
4372- bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
4373-
4374- bool write_incident(THD *thd, bool lock);
4375+--- a/sql/mysql_priv.h
4376++++ b/sql/mysql_priv.h
4377+@@ -615,7 +615,11 @@
4378+ /* BINLOG_DUMP options */
4379+
4380+ #define BINLOG_DUMP_NON_BLOCK 1
4381++#endif /* !MYSQL_CLIENT */
4382+
4383++#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2
4384++
4385++#ifndef MYSQL_CLIENT
4386+ /* sql_show.cc:show_log_files() */
4387+ #define SHOW_LOG_STATUS_FREE "FREE"
4388+ #define SHOW_LOG_STATUS_INUSE "IN USE"
4389 --- a/sql/mysqld.cc
4390 +++ b/sql/mysqld.cc
4391 @@ -504,6 +504,7 @@
4392@@ -682,20 +3499,6 @@
4393 {"binlog-do-db", OPT_BINLOG_DO_DB,
4394 "Tells the master it should log updates for the specified database, "
4395 "and exclude all others not explicitly mentioned.",
4396---- a/sql/mysql_priv.h
4397-+++ b/sql/mysql_priv.h
4398-@@ -615,7 +615,11 @@
4399- /* BINLOG_DUMP options */
4400-
4401- #define BINLOG_DUMP_NON_BLOCK 1
4402-+#endif /* !MYSQL_CLIENT */
4403-
4404-+#define BINLOG_SEND_ANNOTATE_ROWS_EVENT 2
4405-+
4406-+#ifndef MYSQL_CLIENT
4407- /* sql_show.cc:show_log_files() */
4408- #define SHOW_LOG_STATUS_FREE "FREE"
4409- #define SHOW_LOG_STATUS_INUSE "IN USE"
4410 --- a/sql/rpl_rli.cc
4411 +++ b/sql/rpl_rli.cc
4412 @@ -45,7 +45,8 @@
4413@@ -773,7 +3576,7 @@
4414 static sys_var_const_os_str sys_basedir(&vars, "basedir", mysql_home);
4415 +static sys_var_thd_bool
4416 +sys_binlog_annotate_rows_events(&vars, "binlog_annotate_rows_events",
4417-+ &SV::binlog_annotate_rows_events);
4418++ &SV::binlog_annotate_rows_events);
4419 static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
4420 &binlog_cache_size);
4421 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
4422@@ -789,7 +3592,7 @@
4423 // TODO if big log files: Change next to int8store()
4424 int4store(buf, (ulong) mi->master_log_pos);
4425 int2store(buf + 4, binlog_flags);
4426-@@ -2311,17 +2314,41 @@
4427+@@ -2311,15 +2314,39 @@
4428 }
4429 exec_res= apply_event_and_update_pos(ev, thd, rli);
4430
4431@@ -802,7 +3605,8 @@
4432 - {
4433 - DBUG_PRINT("info", ("Deleting the event after it has been executed"));
4434 - delete ev;
4435-+ switch (ev->get_type_code()) {
4436++ switch (ev->get_type_code())
4437++ {
4438 + case FORMAT_DESCRIPTION_EVENT:
4439 + /*
4440 + Format_description_log_event should not be deleted because it
4441@@ -836,11 +3640,8 @@
4442 + break;
4443 }
4444
4445-+
4446 /*
4447- update_log_pos failed: this should not happen, so we don't
4448- retry.
4449-@@ -2947,6 +2974,12 @@
4450+@@ -2947,6 +2973,12 @@
4451 thd->init_for_queries();
4452 thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
4453 set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
4454@@ -853,7 +3654,7 @@
4455 pthread_mutex_lock(&LOCK_thread_count);
4456 threads.append(thd);
4457 pthread_mutex_unlock(&LOCK_thread_count);
4458-@@ -3429,7 +3462,7 @@
4459+@@ -3429,7 +3461,7 @@
4460 If we get Load event, we need to pass a non-reusable buffer
4461 to read_log_event, so we do a trick
4462 */
4463@@ -862,7 +3663,7 @@
4464 {
4465 if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
4466 {
4467-@@ -3629,6 +3662,7 @@
4468+@@ -3629,6 +3661,7 @@
4469 {
4470 int error= 0;
4471 ulong inc_pos;
4472@@ -870,7 +3671,7 @@
4473 Relay_log_info *rli= &mi->rli;
4474 pthread_mutex_t *log_lock= rli->relay_log.get_log_lock();
4475 DBUG_ENTER("queue_event");
4476-@@ -3636,13 +3670,15 @@
4477+@@ -3636,13 +3669,16 @@
4478 LINT_INIT(inc_pos);
4479
4480 if (mi->rli.relay_log.description_event_for_queue->binlog_version<4 &&
4481@@ -884,7 +3685,8 @@
4482 - switch (buf[EVENT_TYPE_OFFSET]) {
4483 + new_pos= uint4korr(buf+LOG_POS_OFFSET);
4484 +
4485-+ switch ((uchar)buf[EVENT_TYPE_OFFSET]) {
4486++ switch ((uchar)buf[EVENT_TYPE_OFFSET])
4487++ {
4488 case STOP_EVENT:
4489 /*
4490 We needn't write this event to the relay log. Indeed, it just indicates a
4491@@ -944,7 +3746,7 @@
4492 if (!have_fd_event)
4493 {
4494 - int type = bufptr[EVENT_TYPE_OFFSET];
4495-+ int type = (uchar)bufptr[EVENT_TYPE_OFFSET];
4496++ int type= (uchar)bufptr[EVENT_TYPE_OFFSET];
4497 if (type == FORMAT_DESCRIPTION_EVENT || type == START_EVENT_V3)
4498 have_fd_event= TRUE;
4499 else
4500@@ -1018,7 +3820,7 @@
4501 - }
4502 + if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
4503 + {
4504-+ errmsg = "Failed on my_net_write()";
4505++ errmsg= "Failed on my_net_write()";
4506 + my_errno= ER_UNKNOWN_ERROR;
4507 + goto err;
4508 + }
4509@@ -1049,14 +3851,14 @@
4510 + });
4511 +
4512 + DBUG_PRINT("info", ("log event code %d",
4513-+ (*packet)[LOG_EVENT_OFFSET+1] ));
4514++ (*packet)[LOG_EVENT_OFFSET+1]));
4515 + if ((uchar)(*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
4516 + {
4517 + if (send_file(thd))
4518 + {
4519-+ errmsg = "failed in send_file()";
4520-+ my_errno= ER_UNKNOWN_ERROR;
4521-+ goto err;
4522++ errmsg= "failed in send_file()";
4523++ my_errno= ER_UNKNOWN_ERROR;
4524++ goto err;
4525 + }
4526 + }
4527 }
4528@@ -1109,74 +3911,9 @@
4529 (uchar*) &opt_log_slave_updates);
4530 +static sys_var_const
4531 +sys_replicate_annotate_rows_events(&vars,
4532-+ "replicate_annotate_rows_events",
4533-+ OPT_GLOBAL, SHOW_MY_BOOL,
4534-+ (uchar*) &opt_replicate_annotate_rows_events);
4535++ "replicate_annotate_rows_events",
4536++ OPT_GLOBAL, SHOW_MY_BOOL,
4537++ (uchar*) &opt_replicate_annotate_rows_events);
4538 static sys_var_const sys_relay_log(&vars, "relay_log",
4539 OPT_GLOBAL, SHOW_CHAR_PTR,
4540 (uchar*) &opt_relay_logname);
4541---- /dev/null
4542-+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-master.opt
4543-@@ -0,0 +1 @@
4544-+--binlog_annotate_rows_events --replicate_annotate_rows_events
4545---- /dev/null
4546-+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events-slave.opt
4547-@@ -0,0 +1 @@
4548-+--slave_net_timeout=1 --log_slave_updates=0 --binlog_annotate_rows_events --replicate_annotate_rows_events
4549---- /dev/null
4550-+++ b/mysql-test/suite/rpl/t/percona_replicate_annotate_rows_events.test
4551-@@ -0,0 +1,35 @@
4552-+########################################################################
4553-+# Bug #872754: Annotate rows events on slave doesnt' work without slave's binlog
4554-+########################################################################
4555-+
4556-+--source include/master-slave.inc
4557-+--source include/have_binlog_format_row.inc
4558-+--source include/have_debug.inc
4559-+
4560-+connection master;
4561-+--disable_warnings
4562-+DROP TABLE IF EXISTS t;
4563-+--enable_warnings
4564-+
4565-+CREATE TABLE t (a INT);
4566-+INSERT INTO t VALUES(1);
4567-+
4568-+--sleep 2
4569-+
4570-+DROP TABLE t;
4571-+
4572-+# The following would hang with the bug not fixed
4573-+--sync_slave_with_master
4574-+
4575-+connection master;
4576-+--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
4577-+--eval select $master_log_pos
4578-+
4579-+connection slave;
4580-+--let $read_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1)
4581-+--eval select $master_log_pos = $read_master_log_pos
4582-+
4583-+--let $exec_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
4584-+--eval select $master_log_pos = $exec_master_log_pos
4585-+
4586-+--source include/rpl_end.inc
4587---- /dev/null
4588-+++ b/mysql-test/suite/rpl/r/percona_replicate_annotate_rows_events.result
4589-@@ -0,0 +1,16 @@
4590-+include/master-slave.inc
4591-+[connection master]
4592-+DROP TABLE IF EXISTS t;
4593-+CREATE TABLE t (a INT);
4594-+INSERT INTO t VALUES(1);
4595-+DROP TABLE t;
4596-+select 738;
4597-+738
4598-+738
4599-+select 738 = 738;
4600-+738 = 738
4601-+1
4602-+select 738 = 738;
4603-+738 = 738
4604-+1
4605-+include/rpl_end.inc

Subscribers

People subscribed via source and target branches