~percona-dev/percona-server/release-5.1.52-12-rnt

132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1
# name       : wl47.patch
2
# introduced : 12
3
# maintainer : Oleg
4
#
5
#!!! notice !!!
6
# Any small change to this file in the main branch
7
# should be done or reviewed by the maintainer!
132.1.2 by Oleg Tsarev
adapt source code
8
diff -ruN a/client/client_priv.h b/client/client_priv.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
9
--- a/client/client_priv.h	2010-08-18 18:36:12.628622360 +0400
10
+++ b/client/client_priv.h	2010-08-18 18:35:54.549872942 +0400
132.1.2 by Oleg Tsarev
adapt source code
11
@@ -93,6 +93,7 @@
12
   OPT_SYSLOG,
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
13
   OPT_FIRST_SLAVE,
14
   OPT_REWRITE_DB,
15
+  OPT_SKIP_ANNOTATE_ROWS_EVENTS,
16
   OPT_ALL,
17
   OPT_MAX_CLIENT_OPTION
18
 };
132.1.2 by Oleg Tsarev
adapt source code
19
diff -ruN a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
20
--- a/client/mysqlbinlog.cc	2010-08-18 18:36:12.598623007 +0400
21
+++ b/client/mysqlbinlog.cc	2010-08-18 18:35:54.549872942 +0400
22
@@ -107,6 +107,7 @@
23
 static short binlog_flags = 0; 
24
 static MYSQL* mysql = NULL;
25
 static const char* dirname_for_local_load= 0;
26
+static bool opt_skip_annotate_rows_events= 0;
27
 
28
 /**
29
   Pointer to the Format_description_log_event of the currently active binlog.
30
@@ -128,6 +129,70 @@
31
   OK_STOP
32
 };
33
 
34
+/**
35
+  Pointer to the last read Annotate_rows_log_event. Having read an
36
+  Annotate_rows event, we should not print it immediatedly because all
37
+  subsequent rbr events can be filtered away, and have to keep it for a while.
38
+  Also because of that when reading a remote Annotate event we have to keep
39
+  its binary log representation in a separately allocated buffer.
40
+*/
41
+static Annotate_rows_log_event *annotate_event= NULL;
42
+
43
+void free_annotate_event()
44
+{
45
+  if (annotate_event)
46
+  {
47
+    delete annotate_event;
48
+    annotate_event= 0;
49
+  }
50
+}
51
+
52
+Log_event* read_remote_annotate_event(uchar* net_buf, ulong event_len,
53
+                                      const char **error_msg)
54
+{
55
+  uchar *event_buf;
56
+  Log_event* event;
57
+
58
+  if (!(event_buf= (uchar*) my_malloc(event_len + 1, MYF(MY_WME))))
59
+  {
60
+    error("Out of memory");
61
+    return 0;
62
+  }
63
+
64
+  memcpy(event_buf, net_buf, event_len);
65
+  event_buf[event_len]= 0;
66
+
67
+  if (!(event= Log_event::read_log_event((const char*) event_buf, event_len,
68
+                                         error_msg, glob_description_event)))
69
+  {
70
+    my_free(event_buf, MYF(0));
71
+    return 0;
72
+  }
73
+  /*
74
+    Ensure the event->temp_buf is pointing to the allocated buffer.
75
+    (TRUE = free temp_buf on the event deletion)
76
+  */
77
+  event->register_temp_buf((char*)event_buf, TRUE);
78
+
79
+  return event;
80
+}
81
+
82
+void keep_annotate_event(Annotate_rows_log_event* event)
83
+{
84
+  free_annotate_event();
85
+  annotate_event= event;
86
+}
87
+
88
+void print_annotate_event(PRINT_EVENT_INFO *print_event_info)
89
+{
90
+  if (annotate_event)
91
+  {
92
+    annotate_event->print(result_file, print_event_info);
93
+    delete annotate_event;  // the event should not be printed more than once
94
+    annotate_event= 0;
95
+  }
96
+}
97
+
98
 static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
99
                                           const char* logname);
100
 static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
101
@@ -936,6 +1001,19 @@
102
 	my_free(fname, MYF(MY_WME));
103
       break;
104
     }
105
+    case ANNOTATE_ROWS_EVENT:
106
+      if (!opt_skip_annotate_rows_events)
107
+      {
108
+        /*
109
+          We don't print Annotate event just now because all subsequent
110
+          rbr-events can be filtered away. Instead we'll keep the event
111
+          till it will be printed together with the first not filtered
112
+          away Table map or the last rbr will be processed.
113
+        */
114
+        keep_annotate_event((Annotate_rows_log_event*) ev);
115
+        destroy_evt= FALSE;
116
+      }
117
+      break;
118
     case TABLE_MAP_EVENT:
119
     {
120
       Table_map_log_event *map= ((Table_map_log_event *)ev);
121
@@ -945,6 +1023,13 @@
122
         destroy_evt= FALSE;
123
         goto end;
124
       }
125
+      /*
126
+        The Table map is to be printed, so it's just the time when we may
127
+        print the kept Annotate event (if there is any).
128
+        print_annotate_event() also deletes the kept Annotate event.
129
+      */
130
+      print_annotate_event(print_event_info);
131
+
132
       size_t len_to= 0;
133
       const char* db_to= binlog_filter->get_rewrite_db(map->get_db_name(), &len_to);
134
       if (len_to && map->rewrite_db(db_to, len_to, glob_description_event))
135
@@ -981,6 +1066,13 @@
136
           if (print_event_info->m_table_map_ignored.count() > 0)
137
             print_event_info->m_table_map_ignored.clear_tables();
138
 
139
+          /*
140
+            If there is a kept Annotate event and all corresponding
141
+            rbr-events were filtered away, the Annotate event was not
142
+            freed and it is just the time to do it.
143
+          */
144
+          free_annotate_event();
145
+
146
           /* 
147
              One needs to take into account an event that gets
148
              filtered but was last event in the statement. If this is
149
@@ -1215,6 +1307,11 @@
150
    "Updates to a database with a different name than the original. \
151
 Example: rewrite-db='from->to'.",
152
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
153
+  {"skip-annotate-rows-events", OPT_SKIP_ANNOTATE_ROWS_EVENTS,
154
+   "Don't print Annotate_rows events stored in the binary log.",
155
+   (uchar**) &opt_skip_annotate_rows_events,
156
+   (uchar**) &opt_skip_annotate_rows_events,
157
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
158
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
159
 };
160
 
161
@@ -1686,6 +1783,8 @@
162
     cast to uint32.
163
   */
164
   int4store(buf, (uint32)start_position);
165
+  if (!opt_skip_annotate_rows_events)
166
+    binlog_flags|= BINLOG_SEND_ANNOTATE_ROWS_EVENT;
167
   int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
168
 
169
   size_t tlen = strlen(logname);
170
@@ -1718,18 +1817,30 @@
171
       break; // end of data
172
     DBUG_PRINT("info",( "len: %lu  net->read_pos[5]: %d\n",
173
 			len, net->read_pos[5]));
174
-    if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
175
-                                        len - 1, &error_msg,
176
-                                        glob_description_event)))
177
+    if (net->read_pos[5] == ANNOTATE_ROWS_EVENT)
178
     {
179
-      error("Could not construct log event object: %s", error_msg);
180
-      DBUG_RETURN(ERROR_STOP);
181
-    }   
182
-    /*
183
-      If reading from a remote host, ensure the temp_buf for the
184
-      Log_event class is pointing to the incoming stream.
185
-    */
186
-    ev->register_temp_buf((char *) net->read_pos + 1, FALSE);
187
+      if (!(ev= read_remote_annotate_event(net->read_pos + 1, len - 1,
188
+                                           &error_msg)))
189
+      {
190
+        error("Could not construct annotate event object: %s", error_msg);
191
+        DBUG_RETURN(ERROR_STOP);
192
+      }   
193
+    }
194
+    else
195
+    {
196
+      if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
197
+                                          len - 1, &error_msg,
198
+                                          glob_description_event)))
199
+      {
200
+        error("Could not construct log event object: %s", error_msg);
201
+        DBUG_RETURN(ERROR_STOP);
202
+      }   
203
+      /*
204
+        If reading from a remote host, ensure the temp_buf for the
205
+        Log_event class is pointing to the incoming stream.
206
+      */
207
+      ev->register_temp_buf((char *) net->read_pos + 1, FALSE);
208
+    }
209
 
210
     Log_event_type type= ev->get_type_code();
211
     if (glob_description_event->binlog_version >= 3 ||
212
@@ -2238,6 +2349,7 @@
213
   if (result_file != stdout)
214
     my_fclose(result_file, MYF(0));
215
   cleanup();
216
+  free_annotate_event();
217
   delete binlog_filter;
218
   free_root(&s_mem_root, MYF(0));
219
   free_defaults(defaults_argv);
132.1.2 by Oleg Tsarev
adapt source code
220
diff -ruN a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
221
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test	2010-07-09 17:03:35.000000000 +0400
222
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test	2010-08-18 18:35:54.549872942 +0400
223
@@ -321,14 +321,19 @@
224
 # we check that the error code of the "ROLLBACK" event is 0 and not
225
 # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
226
 # and does not make slave to stop)
227
+
228
+-- source include/binlog_start_pos.inc
229
+
230
 if (`select @@binlog_format = 'ROW'`)
231
 {
232
-  --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
233
+  let $start_pos= `select @binlog_start_pos + 418`;
234
+  --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
235
 }
236
 
237
 if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
238
 {
239
-  --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
240
+  let $start_pos= `select @binlog_start_pos + 449`;
241
+  --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
242
 }
243
 
244
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
132.1.2 by Oleg Tsarev
adapt source code
245
diff -ruN a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
246
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test	2010-07-09 17:03:36.000000000 +0400
247
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test	2010-08-18 18:35:54.549872942 +0400
248
@@ -72,7 +72,7 @@
249
 --source include/stop_slave.inc
250
 DELETE FROM t2;
251
 # Set slave position to the BEGIN log event
252
---replace_result $master_pos_begin MASTER_POS_BEGIN
253
+--replace_result $master_pos_begin <master_pos_begin>
254
 eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin; 
255
 BEGIN;
256
 # Hold lock
257
@@ -103,7 +103,7 @@
258
 --source include/stop_slave.inc
259
 DELETE FROM t2;
260
 # Set slave position to the BEGIN log event
261
---replace_result $master_pos_begin MASTER_POS_BEGIN
262
+--replace_result $master_pos_begin <master_pos_begin>
263
 eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin; 
264
 BEGIN;
265
 # Hold lock
132.1.2 by Oleg Tsarev
adapt source code
266
diff -ruN a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
267
--- a/mysql-test/extra/rpl_tests/rpl_log.test	2010-07-09 17:03:37.000000000 +0400
268
+++ b/mysql-test/extra/rpl_tests/rpl_log.test	2010-08-18 18:35:54.549872942 +0400
269
@@ -14,6 +14,7 @@
270
 reset master;
271
 reset slave;
272
 source include/start_slave.inc;
273
+source include/binlog_start_pos.inc;
274
 
275
 let $VERSION=`select version()`;
276
 
132.1.2 by Oleg Tsarev
adapt source code
277
diff -ruN a/mysql-test/extra/rpl_tests/rpl_row_annotate.test b/mysql-test/extra/rpl_tests/rpl_row_annotate.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
278
--- a/mysql-test/extra/rpl_tests/rpl_row_annotate.test	1970-01-01 03:00:00.000000000 +0300
279
+++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test	2010-08-18 18:35:54.559911931 +0400
280
@@ -0,0 +1,155 @@
281
+########################################################################
282
+# WL47: Store in binlog text of statements that caused RBR events
283
+# new event          : ANNOTATE_ROWS_EVENT
284
+# new master option  : --binlog-annotate-rows-events
285
+# new slave option   : --replicate-annotate-rows-events
286
+########################################################################
287
+--source include/master-slave.inc
288
+connect (master2,127.0.0.1,root,,test,$MASTER_MYPORT,);
289
+
290
+connection master;
291
+--disable_query_log
292
+
293
+--disable_warnings
294
+DROP DATABASE IF EXISTS test1;
295
+--enable_warnings
296
+
297
+CREATE DATABASE test1;
298
+USE test1;
299
+
300
+CREATE TABLE t1(a int primary key, b int);
301
+CREATE TABLE t2(a int, b int);
302
+CREATE TABLE t3(a int, b int);
303
+CREATE TABLE t4(a int, b int);
304
+CREATE TABLE xt1(a int, b int);
305
+CREATE TABLE xt2(a int, b int);
306
+
307
+CREATE TABLE t5 (
308
+    a INT PRIMARY KEY AUTO_INCREMENT,
309
+    b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
310
+);
311
+
312
+SET SESSION binlog_annotate_rows_events = OFF;
313
+
314
+INSERT INTO t1 VALUES (0,0), (1,1);
315
+
316
+SET SESSION binlog_annotate_rows_events = ON;
317
+
318
+UPDATE t1 SET b = b + 1;
319
+REPLACE t1 VALUES (1,1), (2,2), (3,3);
320
+
321
+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
322
+INSERT INTO t3 VALUES (1,1), (2,2), (3,3);
323
+DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a;
324
+
325
+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
326
+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
327
+DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a;
328
+
329
+INSERT INTO xt1 VALUES (1,1), (2,2), (3,3);
330
+INSERT INTO xt2 VALUES (1,1), (2,2), (3,3);
331
+DELETE xt1, xt2 FROM xt1 INNER JOIN xt2 INNER JOIN t3 WHERE xt1.a=xt2.a AND xt2.a=t3.a;
332
+
333
+INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz');
334
+SET NAMES latin1;
335
+INSERT INTO t5(b) VALUES ('gås');
336
+SET NAMES utf8;
337
+INSERT INTO t5(b) VALUES ('gås');
338
+SET NAMES latin1;
339
+
340
+FLUSH LOGS;
341
+
342
+--echo ########################################################################
343
+--echo # TABLES ON MASTER
344
+--echo ########################################################################
345
+--enable_query_log
346
+
347
+SELECT * FROM t1 ORDER BY a;
348
+SELECT * FROM t2 ORDER BY a;
349
+SELECT * FROM t3 ORDER BY a;
350
+SELECT * FROM t5 ORDER BY a;
351
+
352
+sync_slave_with_master;
353
+--echo ########################################################################
354
+--echo # TABLES ON SLAVE: should be the same as on master
355
+--echo ########################################################################
356
+--disable_query_log
357
+USE test1;
358
+--enable_query_log
359
+
360
+SELECT * FROM t1 ORDER BY a;
361
+SELECT * FROM t2 ORDER BY a;
362
+SELECT * FROM t3 ORDER BY a;
363
+SELECT * FROM t5 ORDER BY a;
364
+
365
+--echo ########################################################################
366
+--echo # EVENTS ON SLAVE
367
+let $annotate= `select @@global.replicate_annotate_rows_events`;
368
+if ($annotate)
369
+{
370
+  --echo # The following Annotate_rows events should appear below:
371
+  --echo # - UPDATE t1 SET b = b + 1;
372
+  --echo # - REPLACE t1 VALUES (1,1), (2,2), (3,3);
373
+  --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
374
+  --echo # - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
375
+  --echo # - DELETE t1, t2 FROM <...>
376
+  --echo # - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
377
+  --echo # - DELETE xt1, t2 FROM <...>
378
+  --echo # - INSERT INTO t5(b) VALUES <...> (3 instances)
379
+}
380
+if (!$annotate)
381
+{
382
+  --echo # No Annotate_rows events should appear below
383
+}
384
+--echo ########################################################################
385
+FLUSH LOGS;
386
+
387
+--source include/binlog_start_pos.inc
388
+let $start_pos= `select @binlog_start_pos`;
389
+--replace_column 2 # 5 #
390
+--replace_result $start_pos <start_pos>
391
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
392
+--eval show binlog events in 'slave-bin.000001' from $start_pos
393
+
394
+--echo # 
395
+--echo ########################################################################
396
+--echo # INSERTs DELAYED ON MASTERs
397
+--echo ########################################################################
398
+connection master;
399
+SET SESSION binlog_annotate_rows_events = ON;
400
+INSERT DELAYED INTO test1.t4 VALUES (1,1);
401
+FLUSH TABLES;
402
+SELECT * FROM test1.t4 ORDER BY a;
403
+
404
+sync_slave_with_master;
405
+connection master;
406
+sync_slave_with_master;
407
+
408
+--echo ########################################################################
409
+--echo # ON SLAVE
410
+--echo # No Annotate_rows events should appear below
411
+--echo ########################################################################
412
+FLUSH LOGS;
413
+
414
+--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
415
+perl;
416
+    open F, '<', "$ENV{MYSQLTEST_VARDIR}/tmp/annotated_events.txt" or die;
417
+    binmode STDOUT;
418
+    while (defined ($_ = <F>)) {
419
+        if (/Annotate_rows/) {
420
+            s/[0-9]+\sAnnotate_rows\s[0-9]+\s[0-9]+/# Annotate_rows # #/;
421
+            print($_);
422
+            $_ = <F>;
423
+            s/[0-9]+\sTable_map\s[0-9]+\s[0-9]+\stable_id:\s[0-9]+/# Table_map # # table_id: #/;
424
+            print($_);
425
+        }
426
+    }
427
+EOF
428
+
429
+# Clean-up
430
+connection master;
431
+--disable_query_log
432
+DROP DATABASE test1;
433
+sync_slave_with_master;
434
+--enable_query_log
435
+
132.1.2 by Oleg Tsarev
adapt source code
436
diff -ruN a/mysql-test/include/binlog_start_pos.inc b/mysql-test/include/binlog_start_pos.inc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
437
--- a/mysql-test/include/binlog_start_pos.inc	1970-01-01 03:00:00.000000000 +0300
438
+++ b/mysql-test/include/binlog_start_pos.inc	2010-08-18 18:35:54.559911931 +0400
439
@@ -0,0 +1,26 @@
440
+##############################################################################
441
+#
442
+# binlog_start_pos is the postion of the the first event in the binary log
443
+# which follows the Format description event. Intended to reduce test suite
444
+# dependance on the Format description event length changes (e.g. in case
445
+# of adding new events). Evaluated as:
446
+#  
447
+#   binlog_start_pos = 4  /* binlog header */ +
448
+#                      (Format_description_log_event length)
449
+#
450
+#   Format_description_log_event length = 
451
+#                      19 /* event common header */ +
452
+#                      57 /* misc stuff in the Format description header */ +
453
+#                      number of events.
454
+# 
455
+# With current number of events = 160,
456
+#
457
+#   binlog_start_pos = 4 + 19 + 57 + 160 = 240.
458
+#
459
+##############################################################################
460
+
461
+let $binlog_start_pos=240;
462
+--disable_query_log
463
+SET @binlog_start_pos=240;
464
+--enable_query_log
465
+
132.1.2 by Oleg Tsarev
adapt source code
466
diff -ruN a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
467
--- a/mysql-test/include/show_binlog_events2.inc	2010-07-09 17:03:24.000000000 +0400
468
+++ b/mysql-test/include/show_binlog_events2.inc	2010-08-18 18:35:54.559911931 +0400
469
@@ -1,4 +1,4 @@
470
---let $binlog_start=106
471
+--let $binlog_start=240
472
 --replace_result $binlog_start <binlog_start>
473
 --replace_column 2 # 5 #
474
 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
132.1.2 by Oleg Tsarev
adapt source code
475
diff -ruN a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
476
--- a/mysql-test/include/show_binlog_events.inc	2010-07-09 17:03:24.000000000 +0400
477
+++ b/mysql-test/include/show_binlog_events.inc	2010-08-18 18:35:54.559911931 +0400
478
@@ -3,7 +3,7 @@
479
 #
480
 # Useage: 
481
 # let $binlog_file= master-bin.000002; 
482
-# let $binlog_start= 106; 
483
+# let $binlog_start= 240; 
484
 # let $binlog_limit= 1, 3; 
485
 # source include/show_binlog_events.inc;
486
 #
487
diff -ruN a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
488
--- a/mysql-test/r/ctype_cp932_binlog_stm.result	2010-07-09 19:02:50.000000000 +0600
489
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result	2010-11-01 15:54:03.000000000 +0500
490
@@ -44,8 +44,6 @@
491
 master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE bug18293
492
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t4
493
 End of 5.0 tests
494
-SHOW BINLOG EVENTS FROM 365;
495
-ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
496
 Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
497
 CREATE TABLE t1 (a varchar(16)) character set cp932;
498
 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
132.1.2 by Oleg Tsarev
adapt source code
499
diff -ruN a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
500
--- a/mysql-test/r/mysqlbinlog.result	2010-07-09 17:03:02.000000000 +0400
501
+++ b/mysql-test/r/mysqlbinlog.result	2010-08-18 18:35:54.619874038 +0400
502
@@ -1,15 +1,17 @@
503
 reset master;
504
+SET @save_binlog_size= @@global.max_binlog_size;
505
+SET @@global.max_binlog_size= 4096;
506
 set timestamp=1000000000;
507
 drop table if exists t1,t2,t3,t4,t5,t03,t04;
508
 create table t1 (word varchar(20));
509
 create table t2 (id int auto_increment not null primary key);
510
 insert into t1 values ("abirvalg");
511
 insert into t2 values ();
512
-load data infile '../../std_data/words.dat' into table t1;
513
-load data infile '../../std_data/words.dat' into table t1;
514
-load data infile '../../std_data/words.dat' into table t1;
515
-load data infile '../../std_data/words.dat' into table t1;
516
-load data infile '../../std_data/words.dat' into table t1;
517
+load data infile '../../std_data/words3.dat' into table t1;
518
+load data infile '../../std_data/words3.dat' into table t1;
519
+load data infile '../../std_data/words3.dat' into table t1;
520
+load data infile '../../std_data/words3.dat' into table t1;
521
+load data infile '../../std_data/words3.dat' into table t1;
522
 insert into t1 values ("Alas");
523
 flush logs;
524
 
525
@@ -220,7 +222,6 @@
526
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
527
 DELIMITER /*!*/;
528
 ROLLBACK/*!*/;
529
-use test/*!*/;
530
 SET TIMESTAMP=1108844556/*!*/;
531
 SET @@session.pseudo_thread_id=999999999/*!*/;
532
 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
533
@@ -228,6 +229,7 @@
534
 SET @@session.collation_database=DEFAULT/*!*/;
535
 BEGIN
536
 /*!*/;
537
+use test/*!*/;
538
 SET TIMESTAMP=1108844555/*!*/;
539
 insert t1 values (1)
540
 /*!*/;
541
@@ -239,7 +241,6 @@
542
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
543
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
544
 DELIMITER /*!*/;
545
-use test/*!*/;
546
 SET TIMESTAMP=1108844556/*!*/;
547
 SET @@session.pseudo_thread_id=999999999/*!*/;
548
 SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
549
@@ -247,6 +248,7 @@
550
 SET @@session.collation_database=DEFAULT/*!*/;
551
 BEGIN
552
 /*!*/;
553
+use test/*!*/;
554
 SET TIMESTAMP=1108844555/*!*/;
555
 insert t1 values (1)
556
 /*!*/;
557
@@ -255,6 +257,7 @@
558
 ROLLBACK /* added by mysqlbinlog */;
559
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
560
 drop table t1,t2;
561
+SET @@global.max_binlog_size= @save_binlog_size;
562
 flush logs;
563
 flush logs;
564
 select * from t5  /* must be (1),(1) */;
565
@@ -377,14 +380,14 @@
566
 /*!*/;
567
 SET TIMESTAMP=1000000000/*!*/;
568
 SET @@session.collation_database=7/*!*/;
569
-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`)
570
+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`)
571
 /*!*/;
572
 SET TIMESTAMP=1000000000/*!*/;
573
 SET @@session.collation_database=DEFAULT/*!*/;
574
-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`)
575
+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`)
576
 /*!*/;
577
 SET TIMESTAMP=1000000000/*!*/;
578
-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`)
579
+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`)
580
 /*!*/;
581
 SET TIMESTAMP=1000000000/*!*/;
582
 drop table t1
583
@@ -581,7 +584,6 @@
584
 SET @@session.collation_database=DEFAULT/*!*/;
585
 BEGIN
586
 /*!*/;
587
-use test/*!*/;
588
 SET TIMESTAMP=1266652094/*!*/;
589
 SavePoint mixed_cases
590
 /*!*/;
591
@@ -592,11 +594,9 @@
592
 SET TIMESTAMP=1266652094/*!*/;
593
 INSERT INTO db1.t1 VALUES(40)
594
 /*!*/;
595
-use test/*!*/;
596
 SET TIMESTAMP=1266652094/*!*/;
597
 ROLLBACK TO mixed_cases
598
 /*!*/;
599
-use db1/*!*/;
600
 SET TIMESTAMP=1266652094/*!*/;
601
 INSERT INTO db1.t2 VALUES("after rollback to")
602
 /*!*/;
603
@@ -624,7 +624,6 @@
604
 SET @@session.collation_database=DEFAULT/*!*/;
605
 BEGIN
606
 /*!*/;
607
-use test/*!*/;
608
 SET TIMESTAMP=1266652094/*!*/;
609
 SavePoint mixed_cases
610
 /*!*/;
132.1.2 by Oleg Tsarev
adapt source code
611
diff -ruN a/mysql-test/std_data/words3.dat b/mysql-test/std_data/words3.dat
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
612
--- a/mysql-test/std_data/words3.dat	1970-01-01 03:00:00.000000000 +0300
613
+++ b/mysql-test/std_data/words3.dat	2010-08-18 18:35:54.559911931 +0400
614
@@ -0,0 +1,66 @@
615
+Aarhus
616
+Aaron
617
+Ababa
618
+aback
619
+abaft
620
+abandon
621
+abandoned
622
+abandoning
623
+abandonment
624
+abandons
625
+Aarhus
626
+Aaron
627
+Ababa
628
+aback
629
+abaft
630
+abandon
631
+abandoned
632
+abandoning
633
+abandonment
634
+abandons
635
+abase
636
+abased
637
+abasement
638
+abasements
639
+abases
640
+abash
641
+abashed
642
+abashes
643
+abashing
644
+abasing
645
+abate
646
+abated
647
+abatement
648
+abatements
649
+abater
650
+abates
651
+abating
652
+Abba
653
+abbe
654
+abbey
655
+abbeys
656
+abbot
657
+abbots
658
+Abbott
659
+abbreviate
660
+abbreviated
661
+abbreviates
662
+abbreviating
663
+abbreviation
664
+abbreviations
665
+Abby
666
+abdomen
667
+abdomens
668
+abdominal
669
+abduct
670
+abducted
671
+abduction
672
+abductions
673
+abductor
674
+abductors
675
+abducts
676
+Abe
677
+abed
678
+Abel
679
+Abelian
680
+Abelson
132.1.2 by Oleg Tsarev
adapt source code
681
diff -ruN a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
682
--- a/mysql-test/suite/binlog/r/binlog_row_annotate.result	1970-01-01 03:00:00.000000000 +0300
683
+++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result	2010-08-18 18:35:54.559911931 +0400
684
@@ -0,0 +1,1219 @@
685
+#####################################################################################
686
+# The following Annotate_rows events should appear below:
687
+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
688
+# - INSERT INTO test3.t3 VALUES (1), (2), (3)
689
+# - DELETE test1.t1, test2.t2 FROM <...>
690
+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
691
+# - DELETE xtest1.xt1, test2.t2 FROM <...>
692
+#####################################################################################
693
+show binlog events in 'master-bin.000001' from <start_pos>;
694
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
695
+master-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test1
696
+master-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test2
697
+master-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test3
698
+master-bin.000001	#	Query	1	#	CREATE DATABASE test1
699
+master-bin.000001	#	Query	1	#	CREATE DATABASE test2
700
+master-bin.000001	#	Query	1	#	CREATE DATABASE test3
701
+master-bin.000001	#	Query	1	#	BEGIN
702
+master-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
703
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
704
+master-bin.000001	#	Query	1	#	COMMIT
705
+master-bin.000001	#	Query	1	#	BEGIN
706
+master-bin.000001	#	Annotate_rows	1	#	INSERT INTO test2.t2 VALUES (1), (2), (3)
707
+master-bin.000001	#	Table_map	1	#	table_id: # (test2.t2)
708
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
709
+master-bin.000001	#	Query	1	#	COMMIT
710
+master-bin.000001	#	Query	1	#	BEGIN
711
+master-bin.000001	#	Annotate_rows	1	#	INSERT INTO test3.t3 VALUES (1), (2), (3)
712
+master-bin.000001	#	Table_map	1	#	table_id: # (test3.t3)
713
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
714
+master-bin.000001	#	Query	1	#	COMMIT
715
+master-bin.000001	#	Query	1	#	BEGIN
716
+master-bin.000001	#	Annotate_rows	1	#	DELETE test1.t1, test2.t2
717
+FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
718
+WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a
719
+master-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
720
+master-bin.000001	#	Table_map	1	#	table_id: # (test2.t2)
721
+master-bin.000001	#	Delete_rows	1	#	table_id: #
722
+master-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
723
+master-bin.000001	#	Query	1	#	COMMIT
724
+master-bin.000001	#	Query	1	#	BEGIN
725
+master-bin.000001	#	Annotate_rows	1	#	INSERT INTO test2.v2 VALUES (1), (2), (3)
726
+master-bin.000001	#	Table_map	1	#	table_id: # (test2.t2)
727
+master-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
728
+master-bin.000001	#	Query	1	#	COMMIT
729
+master-bin.000001	#	Query	1	#	BEGIN
730
+master-bin.000001	#	Annotate_rows	1	#	DELETE xtest1.xt1, test2.t2
731
+FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
732
+WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a
733
+master-bin.000001	#	Table_map	1	#	table_id: # (test2.t2)
734
+master-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
735
+master-bin.000001	#	Query	1	#	COMMIT
736
+master-bin.000001	#	Rotate	1	#	master-bin.000002;pos=4
737
+#
738
+#####################################################################################
739
+# mysqlbinlog
740
+# The following Annotates should appear in this output:
741
+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
742
+# - INSERT INTO test3.t3 VALUES (1), (2), (3)
743
+# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
744
+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
745
+# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
746
+#####################################################################################
747
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
748
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
749
+DELIMITER /*!*/;
750
+# at #
751
+#010909  4:46:40 server id #  end_log_pos # 	Start: binlog v 4, server v #.##.## created 010909  4:46:40 at startup
752
+ROLLBACK/*!*/;
753
+# at #
754
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
755
+SET TIMESTAMP=1000000000/*!*/;
756
+SET @@session.pseudo_thread_id=#/*!*/;
757
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
758
+SET @@session.sql_mode=0/*!*/;
759
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
760
+/*!\C latin1 *//*!*/;
761
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
762
+SET @@session.lc_time_names=0/*!*/;
763
+SET @@session.collation_database=DEFAULT/*!*/;
764
+DROP DATABASE IF EXISTS test1
765
+/*!*/;
766
+# at #
767
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
768
+SET TIMESTAMP=1000000000/*!*/;
769
+DROP DATABASE IF EXISTS test2
770
+/*!*/;
771
+# at #
772
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
773
+SET TIMESTAMP=1000000000/*!*/;
774
+DROP DATABASE IF EXISTS test3
775
+/*!*/;
776
+# at #
777
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
778
+SET TIMESTAMP=1000000000/*!*/;
779
+CREATE DATABASE test1
780
+/*!*/;
781
+# at #
782
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
783
+SET TIMESTAMP=1000000000/*!*/;
784
+CREATE DATABASE test2
785
+/*!*/;
786
+# at #
787
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
788
+SET TIMESTAMP=1000000000/*!*/;
789
+CREATE DATABASE test3
790
+/*!*/;
791
+# at #
792
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
793
+SET TIMESTAMP=1000000000/*!*/;
794
+BEGIN
795
+/*!*/;
796
+# at #
797
+# at #
798
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
799
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
800
+### INSERT INTO test1.t1
801
+### SET
802
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
803
+### INSERT INTO test1.t1
804
+### SET
805
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
806
+### INSERT INTO test1.t1
807
+### SET
808
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
809
+# at #
810
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
811
+SET TIMESTAMP=1000000000/*!*/;
812
+COMMIT
813
+/*!*/;
814
+# at #
815
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
816
+SET TIMESTAMP=1000000000/*!*/;
817
+BEGIN
818
+/*!*/;
819
+# at #
820
+# at #
821
+# at #
822
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
823
+#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
824
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
825
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
826
+### INSERT INTO test2.t2
827
+### SET
828
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
829
+### INSERT INTO test2.t2
830
+### SET
831
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
832
+### INSERT INTO test2.t2
833
+### SET
834
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
835
+# at #
836
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
837
+SET TIMESTAMP=1000000000/*!*/;
838
+COMMIT
839
+/*!*/;
840
+# at #
841
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
842
+SET TIMESTAMP=1000000000/*!*/;
843
+BEGIN
844
+/*!*/;
845
+# at #
846
+# at #
847
+# at #
848
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
849
+#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
850
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test3`.`t3` mapped to number #
851
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
852
+### INSERT INTO test3.t3
853
+### SET
854
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
855
+### INSERT INTO test3.t3
856
+### SET
857
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
858
+### INSERT INTO test3.t3
859
+### SET
860
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
861
+# at #
862
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
863
+SET TIMESTAMP=1000000000/*!*/;
864
+COMMIT
865
+/*!*/;
866
+# at #
867
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
868
+SET TIMESTAMP=1000000000/*!*/;
869
+BEGIN
870
+/*!*/;
871
+# at #
872
+# at #
873
+# at #
874
+# at #
875
+# at #
876
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
877
+#Q> DELETE test1.t1, test2.t2
878
+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
879
+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
880
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
881
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
882
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id #
883
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
884
+### DELETE FROM test1.t1
885
+### WHERE
886
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
887
+### DELETE FROM test1.t1
888
+### WHERE
889
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
890
+### DELETE FROM test1.t1
891
+### WHERE
892
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
893
+### DELETE FROM test2.t2
894
+### WHERE
895
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
896
+### DELETE FROM test2.t2
897
+### WHERE
898
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
899
+### DELETE FROM test2.t2
900
+### WHERE
901
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
902
+# at #
903
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
904
+SET TIMESTAMP=1000000000/*!*/;
905
+COMMIT
906
+/*!*/;
907
+# at #
908
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
909
+SET TIMESTAMP=1000000000/*!*/;
910
+BEGIN
911
+/*!*/;
912
+# at #
913
+# at #
914
+# at #
915
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
916
+#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
917
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
918
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
919
+### INSERT INTO test2.t2
920
+### SET
921
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
922
+### INSERT INTO test2.t2
923
+### SET
924
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
925
+### INSERT INTO test2.t2
926
+### SET
927
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
928
+# at #
929
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
930
+SET TIMESTAMP=1000000000/*!*/;
931
+COMMIT
932
+/*!*/;
933
+# at #
934
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
935
+SET TIMESTAMP=1000000000/*!*/;
936
+BEGIN
937
+/*!*/;
938
+# at #
939
+# at #
940
+# at #
941
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
942
+#Q> DELETE xtest1.xt1, test2.t2
943
+#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
944
+#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
945
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
946
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
947
+### DELETE FROM test2.t2
948
+### WHERE
949
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
950
+### DELETE FROM test2.t2
951
+### WHERE
952
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
953
+### DELETE FROM test2.t2
954
+### WHERE
955
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
956
+# at #
957
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
958
+SET TIMESTAMP=1000000000/*!*/;
959
+COMMIT
960
+/*!*/;
961
+# at #
962
+#010909  4:46:40 server id #  end_log_pos # 	Rotate to master-bin.000002  pos: 4
963
+DELIMITER ;
964
+# End of log file
965
+ROLLBACK /* added by mysqlbinlog */;
966
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
967
+#
968
+#####################################################################################
969
+# mysqlbinlog --database=test1
970
+# The following Annotate should appear in this output:
971
+# - DELETE test1.t1, test2.t2 FROM <...>
972
+#####################################################################################
973
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
974
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
975
+DELIMITER /*!*/;
976
+# at #
977
+#010909  4:46:40 server id #  end_log_pos # 	Start: binlog v 4, server v #.##.## created 010909  4:46:40 at startup
978
+ROLLBACK/*!*/;
979
+# at #
980
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
981
+SET TIMESTAMP=1000000000/*!*/;
982
+SET @@session.pseudo_thread_id=#/*!*/;
983
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
984
+SET @@session.sql_mode=0/*!*/;
985
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
986
+/*!\C latin1 *//*!*/;
987
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
988
+SET @@session.lc_time_names=0/*!*/;
989
+SET @@session.collation_database=DEFAULT/*!*/;
990
+DROP DATABASE IF EXISTS test1
991
+/*!*/;
992
+# at #
993
+# at #
994
+# at #
995
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
996
+SET TIMESTAMP=1000000000/*!*/;
997
+CREATE DATABASE test1
998
+/*!*/;
999
+# at #
1000
+# at #
1001
+# at #
1002
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1003
+SET TIMESTAMP=1000000000/*!*/;
1004
+BEGIN
1005
+/*!*/;
1006
+# at #
1007
+# at #
1008
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1009
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1010
+### INSERT INTO test1.t1
1011
+### SET
1012
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1013
+### INSERT INTO test1.t1
1014
+### SET
1015
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1016
+### INSERT INTO test1.t1
1017
+### SET
1018
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1019
+# at #
1020
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1021
+SET TIMESTAMP=1000000000/*!*/;
1022
+COMMIT
1023
+/*!*/;
1024
+# at #
1025
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1026
+SET TIMESTAMP=1000000000/*!*/;
1027
+BEGIN
1028
+/*!*/;
1029
+# at #
1030
+# at #
1031
+# at #
1032
+# at #
1033
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1034
+SET TIMESTAMP=1000000000/*!*/;
1035
+COMMIT
1036
+/*!*/;
1037
+# at #
1038
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1039
+SET TIMESTAMP=1000000000/*!*/;
1040
+BEGIN
1041
+/*!*/;
1042
+# at #
1043
+# at #
1044
+# at #
1045
+# at #
1046
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1047
+SET TIMESTAMP=1000000000/*!*/;
1048
+COMMIT
1049
+/*!*/;
1050
+# at #
1051
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1052
+SET TIMESTAMP=1000000000/*!*/;
1053
+BEGIN
1054
+/*!*/;
1055
+# at #
1056
+# at #
1057
+# at #
1058
+# at #
1059
+# at #
1060
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1061
+#Q> DELETE test1.t1, test2.t2
1062
+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1063
+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
1064
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1065
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id #
1066
+### DELETE FROM test1.t1
1067
+### WHERE
1068
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1069
+### DELETE FROM test1.t1
1070
+### WHERE
1071
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1072
+### DELETE FROM test1.t1
1073
+### WHERE
1074
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1075
+# at #
1076
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1077
+SET TIMESTAMP=1000000000/*!*/;
1078
+COMMIT
1079
+/*!*/;
1080
+# at #
1081
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1082
+SET TIMESTAMP=1000000000/*!*/;
1083
+BEGIN
1084
+/*!*/;
1085
+# at #
1086
+# at #
1087
+# at #
1088
+# at #
1089
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1090
+SET TIMESTAMP=1000000000/*!*/;
1091
+COMMIT
1092
+/*!*/;
1093
+# at #
1094
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1095
+SET TIMESTAMP=1000000000/*!*/;
1096
+BEGIN
1097
+/*!*/;
1098
+# at #
1099
+# at #
1100
+# at #
1101
+# at #
1102
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1103
+SET TIMESTAMP=1000000000/*!*/;
1104
+COMMIT
1105
+/*!*/;
1106
+# at #
1107
+#010909  4:46:40 server id #  end_log_pos # 	Rotate to master-bin.000002  pos: 4
1108
+DELIMITER ;
1109
+# End of log file
1110
+ROLLBACK /* added by mysqlbinlog */;
1111
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1112
+#
1113
+#####################################################################################
1114
+# mysqlbinlog --skip-annotate-rows-events
1115
+# No Annotates should appear in this output
1116
+#####################################################################################
1117
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1118
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1119
+DELIMITER /*!*/;
1120
+# at #
1121
+#010909  4:46:40 server id #  end_log_pos # 	Start: binlog v 4, server v #.##.## created 010909  4:46:40 at startup
1122
+ROLLBACK/*!*/;
1123
+# at #
1124
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1125
+SET TIMESTAMP=1000000000/*!*/;
1126
+SET @@session.pseudo_thread_id=#/*!*/;
1127
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1128
+SET @@session.sql_mode=0/*!*/;
1129
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1130
+/*!\C latin1 *//*!*/;
1131
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1132
+SET @@session.lc_time_names=0/*!*/;
1133
+SET @@session.collation_database=DEFAULT/*!*/;
1134
+DROP DATABASE IF EXISTS test1
1135
+/*!*/;
1136
+# at #
1137
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1138
+SET TIMESTAMP=1000000000/*!*/;
1139
+DROP DATABASE IF EXISTS test2
1140
+/*!*/;
1141
+# at #
1142
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1143
+SET TIMESTAMP=1000000000/*!*/;
1144
+DROP DATABASE IF EXISTS test3
1145
+/*!*/;
1146
+# at #
1147
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1148
+SET TIMESTAMP=1000000000/*!*/;
1149
+CREATE DATABASE test1
1150
+/*!*/;
1151
+# at #
1152
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1153
+SET TIMESTAMP=1000000000/*!*/;
1154
+CREATE DATABASE test2
1155
+/*!*/;
1156
+# at #
1157
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1158
+SET TIMESTAMP=1000000000/*!*/;
1159
+CREATE DATABASE test3
1160
+/*!*/;
1161
+# at #
1162
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1163
+SET TIMESTAMP=1000000000/*!*/;
1164
+BEGIN
1165
+/*!*/;
1166
+# at #
1167
+# at #
1168
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1169
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1170
+### INSERT INTO test1.t1
1171
+### SET
1172
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1173
+### INSERT INTO test1.t1
1174
+### SET
1175
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1176
+### INSERT INTO test1.t1
1177
+### SET
1178
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1179
+# at #
1180
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1181
+SET TIMESTAMP=1000000000/*!*/;
1182
+COMMIT
1183
+/*!*/;
1184
+# at #
1185
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1186
+SET TIMESTAMP=1000000000/*!*/;
1187
+BEGIN
1188
+/*!*/;
1189
+# at #
1190
+# at #
1191
+# at #
1192
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1193
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1194
+### INSERT INTO test2.t2
1195
+### SET
1196
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1197
+### INSERT INTO test2.t2
1198
+### SET
1199
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1200
+### INSERT INTO test2.t2
1201
+### SET
1202
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1203
+# at #
1204
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1205
+SET TIMESTAMP=1000000000/*!*/;
1206
+COMMIT
1207
+/*!*/;
1208
+# at #
1209
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1210
+SET TIMESTAMP=1000000000/*!*/;
1211
+BEGIN
1212
+/*!*/;
1213
+# at #
1214
+# at #
1215
+# at #
1216
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test3`.`t3` mapped to number #
1217
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1218
+### INSERT INTO test3.t3
1219
+### SET
1220
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1221
+### INSERT INTO test3.t3
1222
+### SET
1223
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1224
+### INSERT INTO test3.t3
1225
+### SET
1226
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1227
+# at #
1228
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1229
+SET TIMESTAMP=1000000000/*!*/;
1230
+COMMIT
1231
+/*!*/;
1232
+# at #
1233
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1234
+SET TIMESTAMP=1000000000/*!*/;
1235
+BEGIN
1236
+/*!*/;
1237
+# at #
1238
+# at #
1239
+# at #
1240
+# at #
1241
+# at #
1242
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1243
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1244
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id #
1245
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
1246
+### DELETE FROM test1.t1
1247
+### WHERE
1248
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1249
+### DELETE FROM test1.t1
1250
+### WHERE
1251
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1252
+### DELETE FROM test1.t1
1253
+### WHERE
1254
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1255
+### DELETE FROM test2.t2
1256
+### WHERE
1257
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1258
+### DELETE FROM test2.t2
1259
+### WHERE
1260
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1261
+### DELETE FROM test2.t2
1262
+### WHERE
1263
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1264
+# at #
1265
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1266
+SET TIMESTAMP=1000000000/*!*/;
1267
+COMMIT
1268
+/*!*/;
1269
+# at #
1270
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1271
+SET TIMESTAMP=1000000000/*!*/;
1272
+BEGIN
1273
+/*!*/;
1274
+# at #
1275
+# at #
1276
+# at #
1277
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1278
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1279
+### INSERT INTO test2.t2
1280
+### SET
1281
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1282
+### INSERT INTO test2.t2
1283
+### SET
1284
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1285
+### INSERT INTO test2.t2
1286
+### SET
1287
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1288
+# at #
1289
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1290
+SET TIMESTAMP=1000000000/*!*/;
1291
+COMMIT
1292
+/*!*/;
1293
+# at #
1294
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1295
+SET TIMESTAMP=1000000000/*!*/;
1296
+BEGIN
1297
+/*!*/;
1298
+# at #
1299
+# at #
1300
+# at #
1301
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1302
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
1303
+### DELETE FROM test2.t2
1304
+### WHERE
1305
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1306
+### DELETE FROM test2.t2
1307
+### WHERE
1308
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1309
+### DELETE FROM test2.t2
1310
+### WHERE
1311
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1312
+# at #
1313
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1314
+SET TIMESTAMP=1000000000/*!*/;
1315
+COMMIT
1316
+/*!*/;
1317
+# at #
1318
+#010909  4:46:40 server id #  end_log_pos # 	Rotate to master-bin.000002  pos: 4
1319
+DELIMITER ;
1320
+# End of log file
1321
+ROLLBACK /* added by mysqlbinlog */;
1322
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1323
+#
1324
+#####################################################################################
1325
+# mysqlbinlog --read-from-remote-server
1326
+# The following Annotates should appear in this output:
1327
+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1328
+# - INSERT INTO test3.t3 VALUES (1), (2), (3)
1329
+# - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
1330
+# - INSERT INTO test2.t2 VALUES (1), (2), (3)
1331
+# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
1332
+#####################################################################################
1333
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1334
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1335
+DELIMITER /*!*/;
1336
+# at #
1337
+#010909  4:46:40 server id #  end_log_pos # 	Start: binlog v 4, server v #.##.## created 010909  4:46:40 at startup
1338
+ROLLBACK/*!*/;
1339
+# at #
1340
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1341
+SET TIMESTAMP=1000000000/*!*/;
1342
+SET @@session.pseudo_thread_id=#/*!*/;
1343
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1344
+SET @@session.sql_mode=0/*!*/;
1345
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1346
+/*!\C latin1 *//*!*/;
1347
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1348
+SET @@session.lc_time_names=0/*!*/;
1349
+SET @@session.collation_database=DEFAULT/*!*/;
1350
+DROP DATABASE IF EXISTS test1
1351
+/*!*/;
1352
+# at #
1353
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1354
+SET TIMESTAMP=1000000000/*!*/;
1355
+DROP DATABASE IF EXISTS test2
1356
+/*!*/;
1357
+# at #
1358
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1359
+SET TIMESTAMP=1000000000/*!*/;
1360
+DROP DATABASE IF EXISTS test3
1361
+/*!*/;
1362
+# at #
1363
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1364
+SET TIMESTAMP=1000000000/*!*/;
1365
+CREATE DATABASE test1
1366
+/*!*/;
1367
+# at #
1368
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1369
+SET TIMESTAMP=1000000000/*!*/;
1370
+CREATE DATABASE test2
1371
+/*!*/;
1372
+# at #
1373
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1374
+SET TIMESTAMP=1000000000/*!*/;
1375
+CREATE DATABASE test3
1376
+/*!*/;
1377
+# at #
1378
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1379
+SET TIMESTAMP=1000000000/*!*/;
1380
+BEGIN
1381
+/*!*/;
1382
+# at #
1383
+# at #
1384
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1385
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1386
+### INSERT INTO test1.t1
1387
+### SET
1388
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1389
+### INSERT INTO test1.t1
1390
+### SET
1391
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1392
+### INSERT INTO test1.t1
1393
+### SET
1394
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1395
+# at #
1396
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1397
+SET TIMESTAMP=1000000000/*!*/;
1398
+COMMIT
1399
+/*!*/;
1400
+# at #
1401
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1402
+SET TIMESTAMP=1000000000/*!*/;
1403
+BEGIN
1404
+/*!*/;
1405
+# at #
1406
+# at #
1407
+# at #
1408
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1409
+#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
1410
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1411
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1412
+### INSERT INTO test2.t2
1413
+### SET
1414
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1415
+### INSERT INTO test2.t2
1416
+### SET
1417
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1418
+### INSERT INTO test2.t2
1419
+### SET
1420
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1421
+# at #
1422
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1423
+SET TIMESTAMP=1000000000/*!*/;
1424
+COMMIT
1425
+/*!*/;
1426
+# at #
1427
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1428
+SET TIMESTAMP=1000000000/*!*/;
1429
+BEGIN
1430
+/*!*/;
1431
+# at #
1432
+# at #
1433
+# at #
1434
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1435
+#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
1436
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test3`.`t3` mapped to number #
1437
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1438
+### INSERT INTO test3.t3
1439
+### SET
1440
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1441
+### INSERT INTO test3.t3
1442
+### SET
1443
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1444
+### INSERT INTO test3.t3
1445
+### SET
1446
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1447
+# at #
1448
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1449
+SET TIMESTAMP=1000000000/*!*/;
1450
+COMMIT
1451
+/*!*/;
1452
+# at #
1453
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1454
+SET TIMESTAMP=1000000000/*!*/;
1455
+BEGIN
1456
+/*!*/;
1457
+# at #
1458
+# at #
1459
+# at #
1460
+# at #
1461
+# at #
1462
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1463
+#Q> DELETE test1.t1, test2.t2
1464
+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1465
+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
1466
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1467
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1468
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id #
1469
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
1470
+### DELETE FROM test1.t1
1471
+### WHERE
1472
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1473
+### DELETE FROM test1.t1
1474
+### WHERE
1475
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1476
+### DELETE FROM test1.t1
1477
+### WHERE
1478
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1479
+### DELETE FROM test2.t2
1480
+### WHERE
1481
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1482
+### DELETE FROM test2.t2
1483
+### WHERE
1484
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1485
+### DELETE FROM test2.t2
1486
+### WHERE
1487
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1488
+# at #
1489
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1490
+SET TIMESTAMP=1000000000/*!*/;
1491
+COMMIT
1492
+/*!*/;
1493
+# at #
1494
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1495
+SET TIMESTAMP=1000000000/*!*/;
1496
+BEGIN
1497
+/*!*/;
1498
+# at #
1499
+# at #
1500
+# at #
1501
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1502
+#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
1503
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1504
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1505
+### INSERT INTO test2.t2
1506
+### SET
1507
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1508
+### INSERT INTO test2.t2
1509
+### SET
1510
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1511
+### INSERT INTO test2.t2
1512
+### SET
1513
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1514
+# at #
1515
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1516
+SET TIMESTAMP=1000000000/*!*/;
1517
+COMMIT
1518
+/*!*/;
1519
+# at #
1520
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1521
+SET TIMESTAMP=1000000000/*!*/;
1522
+BEGIN
1523
+/*!*/;
1524
+# at #
1525
+# at #
1526
+# at #
1527
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1528
+#Q> DELETE xtest1.xt1, test2.t2
1529
+#Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
1530
+#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
1531
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1532
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
1533
+### DELETE FROM test2.t2
1534
+### WHERE
1535
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1536
+### DELETE FROM test2.t2
1537
+### WHERE
1538
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1539
+### DELETE FROM test2.t2
1540
+### WHERE
1541
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1542
+# at #
1543
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1544
+SET TIMESTAMP=1000000000/*!*/;
1545
+COMMIT
1546
+/*!*/;
1547
+# at #
1548
+#010909  4:46:40 server id #  end_log_pos # 	Rotate to master-bin.000002  pos: 4
1549
+DELIMITER ;
1550
+# End of log file
1551
+ROLLBACK /* added by mysqlbinlog */;
1552
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1553
+#
1554
+#####################################################################################
1555
+# mysqlbinlog --read-from-remote-server --database=test1
1556
+# The following Annotate should appear in this output:
1557
+# - DELETE test1.t1, test2.t2 FROM <...>
1558
+#####################################################################################
1559
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1560
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1561
+DELIMITER /*!*/;
1562
+# at #
1563
+#010909  4:46:40 server id #  end_log_pos # 	Start: binlog v 4, server v #.##.## created 010909  4:46:40 at startup
1564
+ROLLBACK/*!*/;
1565
+# at #
1566
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1567
+SET TIMESTAMP=1000000000/*!*/;
1568
+SET @@session.pseudo_thread_id=#/*!*/;
1569
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1570
+SET @@session.sql_mode=0/*!*/;
1571
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1572
+/*!\C latin1 *//*!*/;
1573
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1574
+SET @@session.lc_time_names=0/*!*/;
1575
+SET @@session.collation_database=DEFAULT/*!*/;
1576
+DROP DATABASE IF EXISTS test1
1577
+/*!*/;
1578
+# at #
1579
+# at #
1580
+# at #
1581
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1582
+SET TIMESTAMP=1000000000/*!*/;
1583
+CREATE DATABASE test1
1584
+/*!*/;
1585
+# at #
1586
+# at #
1587
+# at #
1588
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1589
+SET TIMESTAMP=1000000000/*!*/;
1590
+BEGIN
1591
+/*!*/;
1592
+# at #
1593
+# at #
1594
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1595
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1596
+### INSERT INTO test1.t1
1597
+### SET
1598
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1599
+### INSERT INTO test1.t1
1600
+### SET
1601
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1602
+### INSERT INTO test1.t1
1603
+### SET
1604
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1605
+# at #
1606
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1607
+SET TIMESTAMP=1000000000/*!*/;
1608
+COMMIT
1609
+/*!*/;
1610
+# at #
1611
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1612
+SET TIMESTAMP=1000000000/*!*/;
1613
+BEGIN
1614
+/*!*/;
1615
+# at #
1616
+# at #
1617
+# at #
1618
+# at #
1619
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1620
+SET TIMESTAMP=1000000000/*!*/;
1621
+COMMIT
1622
+/*!*/;
1623
+# at #
1624
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1625
+SET TIMESTAMP=1000000000/*!*/;
1626
+BEGIN
1627
+/*!*/;
1628
+# at #
1629
+# at #
1630
+# at #
1631
+# at #
1632
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1633
+SET TIMESTAMP=1000000000/*!*/;
1634
+COMMIT
1635
+/*!*/;
1636
+# at #
1637
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1638
+SET TIMESTAMP=1000000000/*!*/;
1639
+BEGIN
1640
+/*!*/;
1641
+# at #
1642
+# at #
1643
+# at #
1644
+# at #
1645
+# at #
1646
+#010909  4:46:40 server id #  end_log_pos # 	Annotate_rows:
1647
+#Q> DELETE test1.t1, test2.t2
1648
+#Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
1649
+#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
1650
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1651
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id #
1652
+### DELETE FROM test1.t1
1653
+### WHERE
1654
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1655
+### DELETE FROM test1.t1
1656
+### WHERE
1657
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1658
+### DELETE FROM test1.t1
1659
+### WHERE
1660
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1661
+# at #
1662
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1663
+SET TIMESTAMP=1000000000/*!*/;
1664
+COMMIT
1665
+/*!*/;
1666
+# at #
1667
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1668
+SET TIMESTAMP=1000000000/*!*/;
1669
+BEGIN
1670
+/*!*/;
1671
+# at #
1672
+# at #
1673
+# at #
1674
+# at #
1675
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1676
+SET TIMESTAMP=1000000000/*!*/;
1677
+COMMIT
1678
+/*!*/;
1679
+# at #
1680
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1681
+SET TIMESTAMP=1000000000/*!*/;
1682
+BEGIN
1683
+/*!*/;
1684
+# at #
1685
+# at #
1686
+# at #
1687
+# at #
1688
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1689
+SET TIMESTAMP=1000000000/*!*/;
1690
+COMMIT
1691
+/*!*/;
1692
+# at #
1693
+#010909  4:46:40 server id #  end_log_pos # 	Rotate to master-bin.000002  pos: 4
1694
+DELIMITER ;
1695
+# End of log file
1696
+ROLLBACK /* added by mysqlbinlog */;
1697
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
1698
+#
1699
+#####################################################################################
1700
+# mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
1701
+# No Annotates should appear in this output
1702
+#####################################################################################
1703
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
1704
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1705
+DELIMITER /*!*/;
1706
+# at #
1707
+#010909  4:46:40 server id #  end_log_pos # 	Start: binlog v 4, server v #.##.## created 010909  4:46:40 at startup
1708
+ROLLBACK/*!*/;
1709
+# at #
1710
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1711
+SET TIMESTAMP=1000000000/*!*/;
1712
+SET @@session.pseudo_thread_id=#/*!*/;
1713
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
1714
+SET @@session.sql_mode=0/*!*/;
1715
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
1716
+/*!\C latin1 *//*!*/;
1717
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
1718
+SET @@session.lc_time_names=0/*!*/;
1719
+SET @@session.collation_database=DEFAULT/*!*/;
1720
+DROP DATABASE IF EXISTS test1
1721
+/*!*/;
1722
+# at #
1723
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1724
+SET TIMESTAMP=1000000000/*!*/;
1725
+DROP DATABASE IF EXISTS test2
1726
+/*!*/;
1727
+# at #
1728
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1729
+SET TIMESTAMP=1000000000/*!*/;
1730
+DROP DATABASE IF EXISTS test3
1731
+/*!*/;
1732
+# at #
1733
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1734
+SET TIMESTAMP=1000000000/*!*/;
1735
+CREATE DATABASE test1
1736
+/*!*/;
1737
+# at #
1738
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1739
+SET TIMESTAMP=1000000000/*!*/;
1740
+CREATE DATABASE test2
1741
+/*!*/;
1742
+# at #
1743
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1744
+SET TIMESTAMP=1000000000/*!*/;
1745
+CREATE DATABASE test3
1746
+/*!*/;
1747
+# at #
1748
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1749
+SET TIMESTAMP=1000000000/*!*/;
1750
+BEGIN
1751
+/*!*/;
1752
+# at #
1753
+# at #
1754
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1755
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1756
+### INSERT INTO test1.t1
1757
+### SET
1758
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1759
+### INSERT INTO test1.t1
1760
+### SET
1761
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1762
+### INSERT INTO test1.t1
1763
+### SET
1764
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1765
+# at #
1766
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1767
+SET TIMESTAMP=1000000000/*!*/;
1768
+COMMIT
1769
+/*!*/;
1770
+# at #
1771
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1772
+SET TIMESTAMP=1000000000/*!*/;
1773
+BEGIN
1774
+/*!*/;
1775
+# at #
1776
+# at #
1777
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1778
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1779
+### INSERT INTO test2.t2
1780
+### SET
1781
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1782
+### INSERT INTO test2.t2
1783
+### SET
1784
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1785
+### INSERT INTO test2.t2
1786
+### SET
1787
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1788
+# at #
1789
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1790
+SET TIMESTAMP=1000000000/*!*/;
1791
+COMMIT
1792
+/*!*/;
1793
+# at #
1794
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1795
+SET TIMESTAMP=1000000000/*!*/;
1796
+BEGIN
1797
+/*!*/;
1798
+# at #
1799
+# at #
1800
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test3`.`t3` mapped to number #
1801
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1802
+### INSERT INTO test3.t3
1803
+### SET
1804
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1805
+### INSERT INTO test3.t3
1806
+### SET
1807
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1808
+### INSERT INTO test3.t3
1809
+### SET
1810
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1811
+# at #
1812
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1813
+SET TIMESTAMP=1000000000/*!*/;
1814
+COMMIT
1815
+/*!*/;
1816
+# at #
1817
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1818
+SET TIMESTAMP=1000000000/*!*/;
1819
+BEGIN
1820
+/*!*/;
1821
+# at #
1822
+# at #
1823
+# at #
1824
+# at #
1825
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test1`.`t1` mapped to number #
1826
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1827
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id #
1828
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
1829
+### DELETE FROM test1.t1
1830
+### WHERE
1831
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1832
+### DELETE FROM test1.t1
1833
+### WHERE
1834
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1835
+### DELETE FROM test1.t1
1836
+### WHERE
1837
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1838
+### DELETE FROM test2.t2
1839
+### WHERE
1840
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1841
+### DELETE FROM test2.t2
1842
+### WHERE
1843
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1844
+### DELETE FROM test2.t2
1845
+### WHERE
1846
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1847
+# at #
1848
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1849
+SET TIMESTAMP=1000000000/*!*/;
1850
+COMMIT
1851
+/*!*/;
1852
+# at #
1853
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1854
+SET TIMESTAMP=1000000000/*!*/;
1855
+BEGIN
1856
+/*!*/;
1857
+# at #
1858
+# at #
1859
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1860
+#010909  4:46:40 server id #  end_log_pos # 	Write_rows: table id # flags: STMT_END_F
1861
+### INSERT INTO test2.t2
1862
+### SET
1863
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1864
+### INSERT INTO test2.t2
1865
+### SET
1866
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1867
+### INSERT INTO test2.t2
1868
+### SET
1869
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1870
+# at #
1871
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1872
+SET TIMESTAMP=1000000000/*!*/;
1873
+COMMIT
1874
+/*!*/;
1875
+# at #
1876
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1877
+SET TIMESTAMP=1000000000/*!*/;
1878
+BEGIN
1879
+/*!*/;
1880
+# at #
1881
+# at #
1882
+#010909  4:46:40 server id #  end_log_pos # 	Table_map: `test2`.`t2` mapped to number #
1883
+#010909  4:46:40 server id #  end_log_pos # 	Delete_rows: table id # flags: STMT_END_F
1884
+### DELETE FROM test2.t2
1885
+### WHERE
1886
+###   @1=3 /* INT meta=0 nullable=1 is_null=0 */
1887
+### DELETE FROM test2.t2
1888
+### WHERE
1889
+###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
1890
+### DELETE FROM test2.t2
1891
+### WHERE
1892
+###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
1893
+# at #
1894
+#010909  4:46:40 server id #  end_log_pos # 	Query	thread_id=#	exec_time=#	error_code=0
1895
+SET TIMESTAMP=1000000000/*!*/;
1896
+COMMIT
1897
+/*!*/;
1898
+# at #
1899
+#010909  4:46:40 server id #  end_log_pos # 	Rotate to master-bin.000002  pos: 4
1900
+DELIMITER ;
1901
+# End of log file
1902
+ROLLBACK /* added by mysqlbinlog */;
1903
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
132.1.2 by Oleg Tsarev
adapt source code
1904
diff -ruN a/mysql-test/suite/binlog/t/binlog_incident.test b/mysql-test/suite/binlog/t/binlog_incident.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1905
--- a/mysql-test/suite/binlog/t/binlog_incident.test	2010-07-09 17:03:39.000000000 +0400
1906
+++ b/mysql-test/suite/binlog/t/binlog_incident.test	2010-08-18 18:35:54.559911931 +0400
1907
@@ -4,6 +4,7 @@
1908
 
1909
 source include/have_log_bin.inc;
1910
 source include/have_debug.inc;
1911
+source include/binlog_start_pos.inc;
1912
 
1913
 let $MYSQLD_DATADIR= `select @@datadir`;
1914
 RESET MASTER;
1915
@@ -20,7 +21,7 @@
1916
 DROP TABLE t1;
1917
 FLUSH LOGS;
1918
 
1919
-exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1920
+exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
1921
 --disable_query_log
1922
 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;
1923
 --enable_query_log
132.1.2 by Oleg Tsarev
adapt source code
1924
diff -ruN a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1925
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test	2010-07-09 17:03:39.000000000 +0400
1926
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test	2010-08-18 18:35:54.559911931 +0400
1927
@@ -1,5 +1,6 @@
1928
 -- source include/have_debug.inc
132.1.2 by Oleg Tsarev
adapt source code
1929
 -- source include/have_binlog_format_statement.inc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1930
+-- source include/binlog_start_pos.inc
1931
 #
1932
 # bug#27571 asynchronous setting mysql_$query()'s local error and 
1933
 #           Query_log_event::error_code
1934
@@ -24,7 +25,7 @@
1935
 #      for some constants like the offset of the first real event
1936
 #      that is different between severs versions.
1937
 let $MYSQLD_DATADIR= `select @@datadir`;
1938
---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1939
+--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
1940
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1941
 eval select
1942
 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
132.1.2 by Oleg Tsarev
adapt source code
1943
diff -ruN a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1944
--- a/mysql-test/suite/binlog/t/binlog_killed.test	2010-07-09 17:03:39.000000000 +0400
1945
+++ b/mysql-test/suite/binlog/t/binlog_killed.test	2010-08-18 18:35:54.559911931 +0400
1946
@@ -1,5 +1,6 @@
1947
 -- source include/have_innodb.inc
1948
 -- source include/have_binlog_format_statement.inc
1949
+-- source include/binlog_start_pos.inc
1950
 
1951
 # You cannot use `KILL' with the Embedded MySQL Server library,
1952
 # because the embedded server merely runs inside the threads of the host
1953
@@ -51,7 +52,8 @@
1954
 let $rows= `select count(*) from t2  /* must be 2 or 0 */`;
1955
 
1956
 let $MYSQLD_DATADIR= `select @@datadir`;
1957
---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
1958
+let $start_pos= `select @binlog_start_pos + 28`;
1959
+--exec $MYSQL_BINLOG --force-if-open --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
1960
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1961
 eval select
1962
 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
132.1.2 by Oleg Tsarev
adapt source code
1963
diff -ruN a/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1964
--- a/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt	1970-01-01 03:00:00.000000000 +0300
1965
+++ b/mysql-test/suite/binlog/t/binlog_row_annotate-master.opt	2010-08-18 18:35:54.559911931 +0400
1966
@@ -0,0 +1 @@
1967
+--timezone=GMT-3 --binlog-do-db=test1 --binlog-do-db=test2 --binlog-do-db=test3
132.1.2 by Oleg Tsarev
adapt source code
1968
diff -ruN a/mysql-test/suite/binlog/t/binlog_row_annotate.test b/mysql-test/suite/binlog/t/binlog_row_annotate.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
1969
--- a/mysql-test/suite/binlog/t/binlog_row_annotate.test	1970-01-01 03:00:00.000000000 +0300
1970
+++ b/mysql-test/suite/binlog/t/binlog_row_annotate.test	2010-08-18 18:35:54.559911931 +0400
1971
@@ -0,0 +1,189 @@
1972
+###############################################################################
1973
+# WL47: Store in binlog text of statements that caused RBR events
1974
+# new event:              ANNOTATE_ROWS_EVENT
1975
+# new master option:      --binlog-annotate-rows-events
1976
+# new mysqlbinlog option: --skip-annotate-rows-events
1977
+#
1978
+# Intended to test that:
1979
+# *** If the --binlog-annotate-rows-events option is switched on on master
1980
+#     then Annotate_rows events:
1981
+#     - are generated;
1982
+#     - are genrated only once for "multi-table-maps" rbr queries;
1983
+#     - are not generated when the corresponding queries are filtered away;
1984
+#     - are generated when the corresponding queries are filtered away partialy
1985
+#       (e.g. in case of multi-delete).
1986
+# *** Annotate_rows events are printed by mysqlbinlog started without
1987
+#     --skip-annotate-rows-events options both in remote and local cases.
1988
+# *** Annotate_rows events are not printed by mysqlbinlog started with
1989
+#     --skip-annotate-rows-events options both in remote and local cases.
1990
+###############################################################################
1991
+
1992
+--source include/have_log_bin.inc
1993
+--source include/have_binlog_format_row.inc
1994
+--source include/binlog_start_pos.inc
1995
+
1996
+--disable_query_log
1997
+
1998
+# Fix timestamp to avoid varying results
1999
+SET timestamp=1000000000;
2000
+
2001
+# Delete all existing binary logs
2002
+RESET MASTER;
2003
+
2004
+--disable_warnings
2005
+DROP DATABASE IF EXISTS test1;
2006
+DROP DATABASE IF EXISTS test2;
2007
+DROP DATABASE IF EXISTS test3;
2008
+DROP DATABASE IF EXISTS xtest1;
2009
+DROP DATABASE IF EXISTS xtest2;
2010
+--enable_warnings
2011
+
2012
+CREATE DATABASE test1;
2013
+CREATE TABLE test1.t1(a int);
2014
+
2015
+CREATE DATABASE test2;
2016
+CREATE TABLE test2.t2(a int);
2017
+CREATE VIEW  test2.v2 AS SELECT * FROM test2.t2;
2018
+
2019
+CREATE DATABASE test3;
2020
+CREATE TABLE test3.t3(a int);
2021
+
2022
+CREATE DATABASE xtest1;
2023
+CREATE TABLE xtest1.xt1(a int);
2024
+
2025
+CREATE DATABASE xtest2;
2026
+CREATE TABLE xtest2.xt2(a int);
2027
+
2028
+# By default SESSION binlog_annotate_rows_events = OFF
2029
+
2030
+INSERT INTO test1.t1 VALUES (1), (2), (3);
2031
+
2032
+SET SESSION binlog_annotate_rows_events = ON;
2033
+
2034
+INSERT INTO test2.t2 VALUES (1), (2), (3);
2035
+INSERT INTO test3.t3 VALUES (1), (2), (3);
2036
+
2037
+# This query generates two Table maps but the Annotate
2038
+# event should appear only once before the first Table map
2039
+DELETE test1.t1, test2.t2
2040
+  FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3
2041
+  WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2042
+
2043
+# This event should be filtered out together with Annotate event
2044
+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2045
+
2046
+# This event should pass the filter
2047
+INSERT INTO test2.v2 VALUES (1), (2), (3);
2048
+
2049
+# This event should pass the filter only for test2.t2 part
2050
+DELETE xtest1.xt1, test2.t2
2051
+  FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3
2052
+  WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a;
2053
+
2054
+# These events should be filtered out together with Annotate events
2055
+INSERT INTO xtest1.xt1 VALUES (1), (2), (3);
2056
+INSERT INTO xtest2.xt2 VALUES (1), (2), (3);
2057
+DELETE xtest1.xt1, xtest2.xt2
2058
+  FROM xtest1.xt1 INNER JOIN xtest2.xt2 INNER JOIN test3.t3
2059
+  WHERE xtest1.xt1.a=xtest2.xt2.a AND xtest2.xt2.a=test3.t3.a;
2060
+
2061
+FLUSH LOGS;
2062
+--enable_query_log
2063
+
2064
+--echo #####################################################################################
2065
+--echo # The following Annotate_rows events should appear below:
2066
+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2067
+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2068
+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2069
+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2070
+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...>
2071
+--echo #####################################################################################
2072
+
2073
+let $start_pos= `select @binlog_start_pos`;
2074
+--replace_column 2 # 5 #
2075
+--replace_result $start_pos <start_pos>
2076
+--replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\//
2077
+--eval show binlog events in 'master-bin.000001' from $start_pos
2078
+
2079
+--echo #
2080
+--echo #####################################################################################
2081
+--echo # mysqlbinlog
2082
+--echo # The following Annotates should appear in this output:
2083
+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2084
+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2085
+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2086
+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2087
+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2088
+--echo #####################################################################################
2089
+
2090
+let $MYSQLD_DATADIR= `select @@datadir`;
2091
+--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 #/
2092
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
2093
+
2094
+--echo #
2095
+--echo #####################################################################################
2096
+--echo # mysqlbinlog --database=test1
2097
+--echo # The following Annotate should appear in this output:
2098
+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2099
+--echo #####################################################################################
2100
+
2101
+let $MYSQLD_DATADIR= `select @@datadir`;
2102
+--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 #/
2103
+--exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $MYSQLD_DATADIR/master-bin.000001
2104
+
2105
+--echo #
2106
+--echo #####################################################################################
2107
+--echo # mysqlbinlog --skip-annotate-rows-events
2108
+--echo # No Annotates should appear in this output
2109
+--echo #####################################################################################
2110
+
2111
+let $MYSQLD_DATADIR= `select @@datadir`;
2112
+--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 #/
2113
+--exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-rows-events -v -v $MYSQLD_DATADIR/master-bin.000001
2114
+
2115
+--echo #
2116
+--echo #####################################################################################
2117
+--echo # mysqlbinlog --read-from-remote-server
2118
+--echo # The following Annotates should appear in this output:
2119
+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2120
+--echo # - INSERT INTO test3.t3 VALUES (1), (2), (3)
2121
+--echo # - DELETE test1.t1, test2.t2 FROM <...> (with two subsequent Table maps)
2122
+--echo # - INSERT INTO test2.t2 VALUES (1), (2), (3)
2123
+--echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
2124
+--echo #####################################################################################
2125
+
2126
+let $MYSQLD_DATADIR= `select @@datadir`;
2127
+--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 #/
2128
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001
2129
+
2130
+--echo #
2131
+--echo #####################################################################################
2132
+--echo # mysqlbinlog --read-from-remote-server --database=test1
2133
+--echo # The following Annotate should appear in this output:
2134
+--echo # - DELETE test1.t1, test2.t2 FROM <...>
2135
+--echo #####################################################################################
2136
+
2137
+let $MYSQLD_DATADIR= `select @@datadir`;
2138
+--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 #/
2139
+--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
2140
+
2141
+--echo #
2142
+--echo #####################################################################################
2143
+--echo # mysqlbinlog --read-from-remote-server --skip-annotate-rows-events
2144
+--echo # No Annotates should appear in this output
2145
+--echo #####################################################################################
2146
+
2147
+let $MYSQLD_DATADIR= `select @@datadir`;
2148
+--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 #/
2149
+--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
2150
+
2151
+# Clean-up
2152
+
2153
+--disable_query_log
2154
+DROP DATABASE test1;
2155
+DROP DATABASE test2;
2156
+DROP DATABASE test3;
2157
+DROP DATABASE xtest1;
2158
+DROP DATABASE xtest2;
2159
+--enable_query_log
2160
+
132.1.2 by Oleg Tsarev
adapt source code
2161
diff -ruN a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2162
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result	2010-07-09 17:04:26.000000000 +0400
2163
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result	2010-08-18 18:35:54.619874038 +0400
2164
@@ -55,7 +55,7 @@
2165
 *** Test lock wait timeout ***
2166
 include/stop_slave.inc
2167
 DELETE FROM t2;
2168
-CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
2169
+CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>;
2170
 BEGIN;
2171
 SELECT * FROM t1 FOR UPDATE;
2172
 a
2173
@@ -81,7 +81,7 @@
2174
 SET global max_relay_log_size=0;
2175
 include/stop_slave.inc
2176
 DELETE FROM t2;
2177
-CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
2178
+CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>;
2179
 BEGIN;
2180
 SELECT * FROM t1 FOR UPDATE;
2181
 a
132.1.2 by Oleg Tsarev
adapt source code
2182
diff -ruN a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2183
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result	2010-07-09 17:04:29.000000000 +0400
2184
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result	2010-08-18 18:35:54.619874038 +0400
2185
@@ -12,7 +12,7 @@
2186
 change master to master_log_pos=MASTER_LOG_POS;
2187
 Read_Master_Log_Pos	75
2188
 start slave;
2189
-Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'
2190
+Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event'
2191
 include/stop_slave.inc
2192
 show master status;
2193
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
132.1.2 by Oleg Tsarev
adapt source code
2194
diff -ruN a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2195
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result	1970-01-01 03:00:00.000000000 +0300
2196
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result	2010-08-18 18:35:54.559911931 +0400
2197
@@ -0,0 +1,126 @@
2198
+stop slave;
2199
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
2200
+reset master;
2201
+reset slave;
2202
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
2203
+start slave;
2204
+########################################################################
2205
+# TABLES ON MASTER
2206
+########################################################################
2207
+SELECT * FROM t1 ORDER BY a;
2208
+a	b
2209
+0	1
2210
+SELECT * FROM t2 ORDER BY a;
2211
+a	b
2212
+SELECT * FROM t3 ORDER BY a;
2213
+a	b
2214
+1	1
2215
+2	2
2216
+3	3
2217
+SELECT * FROM t5 ORDER BY a;
2218
+a	b
2219
+1	foo
2220
+2	bar
2221
+3	baz
2222
+4	gås
2223
+5	gås
2224
+########################################################################
2225
+# TABLES ON SLAVE: should be the same as on master
2226
+########################################################################
2227
+SELECT * FROM t1 ORDER BY a;
2228
+a	b
2229
+0	1
2230
+SELECT * FROM t2 ORDER BY a;
2231
+a	b
2232
+SELECT * FROM t3 ORDER BY a;
2233
+a	b
2234
+1	1
2235
+2	2
2236
+3	3
2237
+SELECT * FROM t5 ORDER BY a;
2238
+a	b
2239
+1	foo
2240
+2	bar
2241
+3	baz
2242
+4	gås
2243
+5	gås
2244
+########################################################################
2245
+# EVENTS ON SLAVE
2246
+# No Annotate_rows events should appear below
2247
+########################################################################
2248
+FLUSH LOGS;
2249
+show binlog events in 'slave-bin.000001' from <start_pos>;
2250
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
2251
+slave-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test1
2252
+slave-bin.000001	#	Query	1	#	CREATE DATABASE test1
2253
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t1(a int primary key, b int)
2254
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t2(a int, b int)
2255
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t3(a int, b int)
2256
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t4(a int, b int)
2257
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t5 (
2258
+a INT PRIMARY KEY AUTO_INCREMENT,
2259
+b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
2260
+)
2261
+slave-bin.000001	#	Query	1	#	BEGIN
2262
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2263
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2264
+slave-bin.000001	#	Query	1	#	COMMIT
2265
+slave-bin.000001	#	Query	1	#	BEGIN
2266
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2267
+slave-bin.000001	#	Update_rows	1	#	table_id: # flags: STMT_END_F
2268
+slave-bin.000001	#	Query	1	#	COMMIT
2269
+slave-bin.000001	#	Query	1	#	BEGIN
2270
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2271
+slave-bin.000001	#	Update_rows	1	#	table_id: #
2272
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2273
+slave-bin.000001	#	Query	1	#	COMMIT
2274
+slave-bin.000001	#	Query	1	#	BEGIN
2275
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2276
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2277
+slave-bin.000001	#	Query	1	#	COMMIT
2278
+slave-bin.000001	#	Query	1	#	BEGIN
2279
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t3)
2280
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2281
+slave-bin.000001	#	Query	1	#	COMMIT
2282
+slave-bin.000001	#	Query	1	#	BEGIN
2283
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2284
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2285
+slave-bin.000001	#	Delete_rows	1	#	table_id: #
2286
+slave-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
2287
+slave-bin.000001	#	Query	1	#	COMMIT
2288
+slave-bin.000001	#	Query	1	#	BEGIN
2289
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2290
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2291
+slave-bin.000001	#	Query	1	#	COMMIT
2292
+slave-bin.000001	#	Query	1	#	BEGIN
2293
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2294
+slave-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
2295
+slave-bin.000001	#	Query	1	#	COMMIT
2296
+slave-bin.000001	#	Query	1	#	BEGIN
2297
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t5)
2298
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2299
+slave-bin.000001	#	Query	1	#	COMMIT
2300
+slave-bin.000001	#	Query	1	#	BEGIN
2301
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t5)
2302
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2303
+slave-bin.000001	#	Query	1	#	COMMIT
2304
+slave-bin.000001	#	Query	1	#	BEGIN
2305
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t5)
2306
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2307
+slave-bin.000001	#	Query	1	#	COMMIT
2308
+slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
2309
+# 
2310
+########################################################################
2311
+# INSERTs DELAYED ON MASTERs
2312
+########################################################################
2313
+SET SESSION binlog_annotate_rows_events = ON;
2314
+INSERT DELAYED INTO test1.t4 VALUES (1,1);
2315
+FLUSH TABLES;
2316
+SELECT * FROM test1.t4 ORDER BY a;
2317
+a	b
2318
+1	1
2319
+########################################################################
2320
+# ON SLAVE
2321
+# No Annotate_rows events should appear below
2322
+########################################################################
2323
+FLUSH LOGS;
132.1.2 by Oleg Tsarev
adapt source code
2324
diff -ruN a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2325
--- a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result	1970-01-01 03:00:00.000000000 +0300
2326
+++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result	2010-08-18 18:35:54.559911931 +0400
2327
@@ -0,0 +1,144 @@
2328
+stop slave;
2329
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
2330
+reset master;
2331
+reset slave;
2332
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
2333
+start slave;
2334
+########################################################################
2335
+# TABLES ON MASTER
2336
+########################################################################
2337
+SELECT * FROM t1 ORDER BY a;
2338
+a	b
2339
+0	1
2340
+SELECT * FROM t2 ORDER BY a;
2341
+a	b
2342
+SELECT * FROM t3 ORDER BY a;
2343
+a	b
2344
+1	1
2345
+2	2
2346
+3	3
2347
+SELECT * FROM t5 ORDER BY a;
2348
+a	b
2349
+1	foo
2350
+2	bar
2351
+3	baz
2352
+4	gås
2353
+5	gås
2354
+########################################################################
2355
+# TABLES ON SLAVE: should be the same as on master
2356
+########################################################################
2357
+SELECT * FROM t1 ORDER BY a;
2358
+a	b
2359
+0	1
2360
+SELECT * FROM t2 ORDER BY a;
2361
+a	b
2362
+SELECT * FROM t3 ORDER BY a;
2363
+a	b
2364
+1	1
2365
+2	2
2366
+3	3
2367
+SELECT * FROM t5 ORDER BY a;
2368
+a	b
2369
+1	foo
2370
+2	bar
2371
+3	baz
2372
+4	gås
2373
+5	gås
2374
+########################################################################
2375
+# EVENTS ON SLAVE
2376
+# The following Annotate_rows events should appear below:
2377
+# - UPDATE t1 SET b = b + 1;
2378
+# - REPLACE t1 VALUES (1,1), (2,2), (3,3);
2379
+# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2380
+# - INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
2381
+# - DELETE t1, t2 FROM <...>
2382
+# - INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2383
+# - DELETE xt1, t2 FROM <...>
2384
+# - INSERT INTO t5(b) VALUES <...> (3 instances)
2385
+########################################################################
2386
+FLUSH LOGS;
2387
+show binlog events in 'slave-bin.000001' from <start_pos>;
2388
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
2389
+slave-bin.000001	#	Query	1	#	DROP DATABASE IF EXISTS test1
2390
+slave-bin.000001	#	Query	1	#	CREATE DATABASE test1
2391
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t1(a int primary key, b int)
2392
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t2(a int, b int)
2393
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t3(a int, b int)
2394
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t4(a int, b int)
2395
+slave-bin.000001	#	Query	1	#	use `test1`; CREATE TABLE t5 (
2396
+a INT PRIMARY KEY AUTO_INCREMENT,
2397
+b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
2398
+)
2399
+slave-bin.000001	#	Query	1	#	BEGIN
2400
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2401
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2402
+slave-bin.000001	#	Query	1	#	COMMIT
2403
+slave-bin.000001	#	Query	1	#	BEGIN
2404
+slave-bin.000001	#	Annotate_rows	1	#	UPDATE t1 SET b = b + 1
2405
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2406
+slave-bin.000001	#	Update_rows	1	#	table_id: # flags: STMT_END_F
2407
+slave-bin.000001	#	Query	1	#	COMMIT
2408
+slave-bin.000001	#	Query	1	#	BEGIN
2409
+slave-bin.000001	#	Annotate_rows	1	#	REPLACE t1 VALUES (1,1), (2,2), (3,3)
2410
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2411
+slave-bin.000001	#	Update_rows	1	#	table_id: #
2412
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2413
+slave-bin.000001	#	Query	1	#	COMMIT
2414
+slave-bin.000001	#	Query	1	#	BEGIN
2415
+slave-bin.000001	#	Annotate_rows	1	#	INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2416
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2417
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2418
+slave-bin.000001	#	Query	1	#	COMMIT
2419
+slave-bin.000001	#	Query	1	#	BEGIN
2420
+slave-bin.000001	#	Annotate_rows	1	#	INSERT INTO t3 VALUES (1,1), (2,2), (3,3)
2421
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t3)
2422
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2423
+slave-bin.000001	#	Query	1	#	COMMIT
2424
+slave-bin.000001	#	Query	1	#	BEGIN
2425
+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
2426
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2427
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t1)
2428
+slave-bin.000001	#	Delete_rows	1	#	table_id: #
2429
+slave-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
2430
+slave-bin.000001	#	Query	1	#	COMMIT
2431
+slave-bin.000001	#	Query	1	#	BEGIN
2432
+slave-bin.000001	#	Annotate_rows	1	#	INSERT INTO t2 VALUES (1,1), (2,2), (3,3)
2433
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2434
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2435
+slave-bin.000001	#	Query	1	#	COMMIT
2436
+slave-bin.000001	#	Query	1	#	BEGIN
2437
+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
2438
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t2)
2439
+slave-bin.000001	#	Delete_rows	1	#	table_id: # flags: STMT_END_F
2440
+slave-bin.000001	#	Query	1	#	COMMIT
2441
+slave-bin.000001	#	Query	1	#	BEGIN
2442
+slave-bin.000001	#	Annotate_rows	1	#	INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz')
2443
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t5)
2444
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2445
+slave-bin.000001	#	Query	1	#	COMMIT
2446
+slave-bin.000001	#	Query	1	#	BEGIN
2447
+slave-bin.000001	#	Annotate_rows	1	#	INSERT INTO t5(b) VALUES ('gås')
2448
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t5)
2449
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2450
+slave-bin.000001	#	Query	1	#	COMMIT
2451
+slave-bin.000001	#	Query	1	#	BEGIN
2452
+slave-bin.000001	#	Annotate_rows	1	#	INSERT INTO t5(b) VALUES ('gås')
2453
+slave-bin.000001	#	Table_map	1	#	table_id: # (test1.t5)
2454
+slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
2455
+slave-bin.000001	#	Query	1	#	COMMIT
2456
+slave-bin.000001	#	Rotate	2	#	slave-bin.000002;pos=4
2457
+# 
2458
+########################################################################
2459
+# INSERTs DELAYED ON MASTERs
2460
+########################################################################
2461
+SET SESSION binlog_annotate_rows_events = ON;
2462
+INSERT DELAYED INTO test1.t4 VALUES (1,1);
2463
+FLUSH TABLES;
2464
+SELECT * FROM test1.t4 ORDER BY a;
2465
+a	b
2466
+1	1
2467
+########################################################################
2468
+# ON SLAVE
2469
+# No Annotate_rows events should appear below
2470
+########################################################################
2471
+FLUSH LOGS;
132.1.2 by Oleg Tsarev
adapt source code
2472
diff -ruN a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2473
--- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2010-07-09 17:04:31.000000000 +0400
2474
+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2010-08-18 18:35:54.559911931 +0400
2475
@@ -24,7 +24,7 @@
2476
 1
2477
 [on slave]
2478
 ---- Wait until slave stops with an error ----
2479
-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)
2480
+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)
2481
 SELECT * FROM t1;
2482
 a
2483
 1
2484
@@ -50,7 +50,7 @@
2485
 a
2486
 [on slave]
2487
 ---- Wait until slave stops with an error ----
2488
-Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error)
2489
+Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 1116 (expected "can't find record" error)
2490
 SELECT * FROM t1;
2491
 a
2492
 ---- Resolve the conflict on the slave and restart SQL thread ----
132.1.2 by Oleg Tsarev
adapt source code
2493
diff -ruN a/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2494
--- a/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt	1970-01-01 03:00:00.000000000 +0300
2495
+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont-slave.opt	2010-08-18 18:35:54.559911931 +0400
2496
@@ -0,0 +1 @@
2497
+--log-slave-updates --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
2498
\ No newline at end of file
132.1.2 by Oleg Tsarev
adapt source code
2499
diff -ruN a/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2500
--- a/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test	1970-01-01 03:00:00.000000000 +0300
2501
+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_dont.test	2010-08-18 18:35:54.559911931 +0400
2502
@@ -0,0 +1,9 @@
2503
+###############################################################################
2504
+# WL47: Store in binlog text of statements that caused RBR events
2505
+# Wrapper for extra/rpl/rpl_row_annotate.test.
2506
+# Intended to test that if the --replicate-annotate-rows-events option
2507
+# is switched off on slave then Annotate_events are not reproduced.
2508
+###############################################################################
2509
+
2510
+--source include/have_binlog_format_row.inc
2511
+--source extra/rpl_tests/rpl_row_annotate.test
132.1.2 by Oleg Tsarev
adapt source code
2512
diff -ruN a/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2513
--- a/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt	1970-01-01 03:00:00.000000000 +0300
2514
+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do-slave.opt	2010-08-18 18:35:54.559911931 +0400
2515
@@ -0,0 +1 @@
2516
+--log-slave-updates --replicate-annotate-rows-events --replicate-ignore-table=test1.xt1 --replicate-ignore-table=test1.xt2
2517
\ No newline at end of file
132.1.2 by Oleg Tsarev
adapt source code
2518
diff -ruN a/mysql-test/suite/rpl/t/rpl_row_annotate_do.test b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2519
--- a/mysql-test/suite/rpl/t/rpl_row_annotate_do.test	1970-01-01 03:00:00.000000000 +0300
2520
+++ b/mysql-test/suite/rpl/t/rpl_row_annotate_do.test	2010-08-18 18:35:54.559911931 +0400
2521
@@ -0,0 +1,16 @@
2522
+###############################################################################
2523
+# WL47: Store in binlog text of statements that caused RBR events
2524
+# Wrapper for extra/rpl/rpl_row_annotate.test.
2525
+# Intended to test that if the --replicate-annotate-rows-events option
2526
+# is switched on on slave then Annotate_events:
2527
+# - are reproduced on slave
2528
+# - are reproduced only once for "multi-table-maps" rbr queries
2529
+# - are not reproduced when the corresponding queries are filtered away
2530
+#   on replication
2531
+# - are reproduced when the corresponding queries are filtered away partialy
2532
+#   (e.g. in case of multi-delete)
2533
+# - are not generated on slave for queries that are not annotated on master.
2534
+###############################################################################
2535
+
2536
+--source include/have_binlog_format_row.inc
2537
+--source extra/rpl_tests/rpl_row_annotate.test
132.1.2 by Oleg Tsarev
adapt source code
2538
diff -ruN a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2539
--- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2010-07-09 17:04:49.000000000 +0400
2540
+++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test	2010-08-18 18:35:54.559911931 +0400
2541
@@ -1,7 +1,8 @@
2542
 # depends on the binlog output
2543
 -- source include/have_binlog_format_row.inc
2544
+--source include/binlog_start_pos.inc
2545
 
2546
-let $rename_event_pos= 897;
2547
+let $rename_event_pos= `select @binlog_start_pos + 791`;
2548
 
2549
 # Bug#18326: Do not lock table for writing during prepare of statement
2550
 # The use of the ps protocol causes extra table maps in the binlog, so
132.1.2 by Oleg Tsarev
adapt source code
2551
diff -ruN a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2552
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2010-07-09 17:04:49.000000000 +0400
2553
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2010-08-18 18:35:54.569873814 +0400
2554
@@ -162,15 +162,18 @@
2555
 
2556
 remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
2557
 
2558
+--source include/binlog_start_pos.inc
2559
 
2560
 # this test for position option
2561
-# By setting this position to 416, we should only get the create of t3
2562
+# By setting this position to start_binlog_pos + 310, we should only get the create of t3
2563
+let $start_pos= `select @binlog_start_pos + 310`;
2564
+let $stop_pos=  `select @binlog_start_pos + 463`;
2565
 --disable_query_log
2566
 select "--- Test 2 position test --" as "";
2567
 --enable_query_log
2568
 let $MYSQLD_DATADIR= `select @@datadir;`;
2569
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2570
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
2571
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
2572
 
2573
 # These are tests for remote binlog.
2574
 # They should return the same as previous test.
2575
@@ -181,7 +184,7 @@
2576
 
2577
 # This is broken now
2578
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2579
---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
2580
+--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
2581
 
2582
 # This part is disabled due to bug #17654
2583
 
2584
@@ -257,7 +260,7 @@
2585
 select "--- Test 5 LOAD DATA --" as "";
2586
 --enable_query_log
2587
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2588
---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
2589
+--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
2590
 
2591
 # Bug#7853 (mysqlbinlog does not accept input from stdin)
2592
 
2593
@@ -265,14 +268,17 @@
2594
 select "--- Test 6 reading stdin --" as "";
2595
 --enable_query_log
2596
 let $MYSQLD_DATADIR= `select @@datadir;`;
2597
+let $stop_pos= `select @binlog_start_pos + 463`;
2598
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2599
---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
2600
+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
2601
 
2602
 --disable_query_log
2603
 select "--- Test 7 reading stdin w/position --" as "";
2604
 --enable_query_log
2605
+let $start_pos= `select @binlog_start_pos + 310`;
2606
+let $stop_pos= `select @binlog_start_pos + 463`;
2607
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2608
---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
2609
+--exec $MYSQL_BINLOG --short-form --position=$start_pos --stop-position=$stop_pos - < $MYSQLD_DATADIR/master-bin.000001
2610
 
2611
 # Bug#16217 (mysql client did not know how not switch its internal charset)
2612
 --disable_query_log
132.1.2 by Oleg Tsarev
adapt source code
2613
diff -ruN a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2614
--- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test	2010-07-09 17:04:53.000000000 +0400
2615
+++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test	2010-08-18 18:35:54.569873814 +0400
2616
@@ -1,7 +1,8 @@
2617
 # depends on the binlog output
2618
 --source include/have_binlog_format_mixed_or_statement.inc
2619
+--source include/binlog_start_pos.inc
2620
 
2621
-let $rename_event_pos= 656;
2622
+let $rename_event_pos= `select @binlog_start_pos + 550`;
2623
 -- source extra/rpl_tests/rpl_flsh_tbls.test
2624
 
2625
 # End of 4.1 tests
2626
diff -ruN a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
2627
--- a/mysql-test/t/ctype_cp932_binlog_stm.test	2010-07-09 19:02:22.000000000 +0600
2628
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test	2010-11-01 15:53:50.000000000 +0500
2629
@@ -28,14 +28,6 @@
2630
 
2631
 --echo End of 5.0 tests
2632
 
2633
-#
2634
-# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump 
2635
-# Note: 364 is a magic position (found experimentally, depends on 
2636
-# the log's contents) that caused the server crash.
2637
-
2638
---error 1220
2639
-SHOW BINLOG EVENTS FROM 365;
2640
-
2641
 --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
2642
 CREATE TABLE t1 (a varchar(16)) character set cp932;
2643
 INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
132.1.2 by Oleg Tsarev
adapt source code
2644
diff -ruN a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2645
--- a/mysql-test/t/mysqlbinlog2.test	2010-07-09 17:02:34.000000000 +0400
2646
+++ b/mysql-test/t/mysqlbinlog2.test	2010-08-18 18:35:54.569873814 +0400
2647
@@ -3,7 +3,7 @@
2648
 
2649
 # TODO: Need to look at making row based version once new binlog client is complete.
2650
 -- source include/have_binlog_format_mixed_or_statement.inc
2651
-
2652
+-- source include/binlog_start_pos.inc
2653
 
2654
 --disable_warnings
2655
 drop table if exists t1;
2656
@@ -50,15 +50,19 @@
2657
 --disable_query_log
2658
 select "--- start-position --" as "";
2659
 --enable_query_log
2660
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 
2661
+let $start_pos= `select @binlog_start_pos + 502`;
2662
+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 
2663
 --disable_query_log
2664
 select "--- stop-position --" as "";
2665
 --enable_query_log
2666
---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001 
2667
+let $stop_pos= `select @binlog_start_pos + 502`;
2668
+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 
2669
 --disable_query_log
2670
 select "--- start and stop positions ---" as "";
2671
 --enable_query_log
2672
---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001 
2673
+let $start_pos= `select @binlog_start_pos + 502`;
2674
+let $stop_pos= `select @binlog_start_pos + 619`;
2675
+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos $MYSQLD_DATADIR/master-bin.000001 
2676
 --disable_query_log
2677
 select "--- start-datetime --" as "";
2678
 --enable_query_log
2679
@@ -84,11 +88,13 @@
2680
 --disable_query_log
2681
 select "--- start-position --" as "";
2682
 --enable_query_log
2683
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2684
+let $start_pos= `select @binlog_start_pos + 502`;
2685
+--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2686
 --disable_query_log
2687
 select "--- stop-position --" as "";
2688
 --enable_query_log
2689
---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2690
+let $stop_pos= `select @binlog_start_pos + 28`;
2691
+--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
2692
 --disable_query_log
2693
 select "--- start-datetime --" as "";
2694
 --enable_query_log
2695
@@ -111,15 +117,19 @@
2696
 --disable_query_log
2697
 select "--- start-position --" as "";
2698
 --enable_query_log
2699
---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 
2700
+let $start_pos= `select @binlog_start_pos + 502`;
2701
+--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 
2702
 --disable_query_log
2703
 select "--- stop-position --" as "";
2704
 --enable_query_log
2705
---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 
2706
+let $stop_pos= `select @binlog_start_pos + 502`;
2707
+--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 
2708
 --disable_query_log
2709
 select "--- start and stop positions ---" as "";
2710
 --enable_query_log
2711
---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
2712
+let $start_pos= `select @binlog_start_pos + 502`;
2713
+let $stop_pos= `select @binlog_start_pos + 619`;
2714
+--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
2715
 --disable_query_log
2716
 select "--- start-datetime --" as "";
2717
 --enable_query_log
2718
@@ -142,11 +152,13 @@
2719
 --disable_query_log
2720
 select "--- start-position --" as "";
2721
 --enable_query_log
2722
---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
2723
+let $start_pos= `select @binlog_start_pos + 502`;
2724
+--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
2725
 --disable_query_log
2726
 select "--- stop-position --" as "";
2727
 --enable_query_log
2728
---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
2729
+let $stop_pos= `select @binlog_start_pos + 28`;
2730
+--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
2731
 --disable_query_log
2732
 select "--- start-datetime --" as "";
2733
 --enable_query_log
132.1.2 by Oleg Tsarev
adapt source code
2734
diff -ruN a/mysql-test/t/mysqlbinlog-master.opt b/mysql-test/t/mysqlbinlog-master.opt
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2735
--- a/mysql-test/t/mysqlbinlog-master.opt	2010-07-09 17:02:34.000000000 +0400
2736
+++ b/mysql-test/t/mysqlbinlog-master.opt	1970-01-01 03:00:00.000000000 +0300
2737
@@ -1 +0,0 @@
2738
---max-binlog-size=4096
132.1.2 by Oleg Tsarev
adapt source code
2739
diff -ruN a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2740
--- a/mysql-test/t/mysqlbinlog.test	2010-07-09 17:02:34.000000000 +0400
2741
+++ b/mysql-test/t/mysqlbinlog.test	2010-08-18 18:35:54.569873814 +0400
2742
@@ -3,10 +3,18 @@
132.1.2 by Oleg Tsarev
adapt source code
2743
 -- source include/have_binlog_format_statement.inc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
2744
 
2745
 -- source include/have_log_bin.inc
2746
+-- source include/binlog_start_pos.inc
2747
 
2748
 # Deletes all the binary logs
2749
 reset master;
2750
 
2751
+# We need small binlog size to break the last LOAD DATA INFILE below so that
2752
+# the corresponding Begin_load_query will be written to master-bin.000001
2753
+# while the Execute_load_query will be written to master-bin.000002.
2754
+
2755
+SET @save_binlog_size= @@global.max_binlog_size;
2756
+SET @@global.max_binlog_size= 4096;
2757
+
2758
 # we need this for getting fixed timestamps inside of this test
2759
 set timestamp=1000000000;
2760
 
2761
@@ -26,13 +34,15 @@
2762
 
2763
 # test for load data and load data distributed among the several
2764
 # files (we need to fill up first binlog)
2765
-load data infile '../../std_data/words.dat' into table t1;
2766
-load data infile '../../std_data/words.dat' into table t1;
2767
-load data infile '../../std_data/words.dat' into table t1;
2768
-load data infile '../../std_data/words.dat' into table t1;
2769
-load data infile '../../std_data/words.dat' into table t1;
2770
+load data infile '../../std_data/words3.dat' into table t1;
2771
+load data infile '../../std_data/words3.dat' into table t1;
2772
+load data infile '../../std_data/words3.dat' into table t1;
2773
+load data infile '../../std_data/words3.dat' into table t1;
2774
+load data infile '../../std_data/words3.dat' into table t1;
2775
 # simple query to show more in second binlog
2776
 insert into t1 values ("Alas");
2777
+
2778
+### Starting master-bin.000003
2779
 flush logs;
2780
 
2781
 # delimiters are for easier debugging in future
2782
@@ -46,7 +56,7 @@
2783
 #
2784
 let $MYSQLD_DATADIR= `select @@datadir`;
2785
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2786
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2787
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2788
 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
2789
 
2790
 # this should not fail but shouldn't produce any working statements
2791
@@ -54,7 +64,7 @@
2792
 select "--- Broken LOAD DATA --" as "";
2793
 --enable_query_log
2794
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2795
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2796
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2797
 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
2798
 
2799
 # this should show almost nothing
2800
@@ -62,17 +72,17 @@
2801
 select "--- --database --" as "";
2802
 --enable_query_log
2803
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2804
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2805
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2806
 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
2807
 
2808
 # this test for position option
2809
 --disable_query_log
2810
 select "--- --position --" as "";
2811
 --enable_query_log
2812
+let $start_pos= `select @binlog_start_pos + 227`;
2813
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2814
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2815
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002
2816
-
2817
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2818
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=$start_pos $MYSQLD_DATADIR/master-bin.000002
2819
 
2820
 # These are tests for remote binlog.
2821
 # They should return the same as previous test.
2822
@@ -83,7 +93,7 @@
2823
 
2824
 # This is broken now
2825
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2826
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2827
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2828
 --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
2829
 
2830
 # This is broken too
2831
@@ -91,7 +101,7 @@
2832
 select "--- Broken LOAD DATA --" as "";
2833
 --enable_query_log
2834
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2835
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2836
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2837
 --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
2838
 
2839
 # And this too ! (altough it is documented)
2840
@@ -99,34 +109,39 @@
2841
 select "--- --database --" as "";
2842
 --enable_query_log
2843
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2844
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2845
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2846
 --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
2847
 
2848
 # Strangely but this works
2849
 --disable_query_log
2850
 select "--- --position --" as "";
2851
 --enable_query_log
2852
+let $start_pos= `select @binlog_start_pos + 227`;
2853
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2854
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2855
---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
2856
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2857
+--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
2858
 
2859
 # Bug#7853 mysqlbinlog does not accept input from stdin
2860
 --disable_query_log
2861
 select "--- reading stdin --" as "";
2862
 --enable_query_log
2863
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2864
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2865
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2866
 --exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
2867
 
2868
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2869
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2870
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2871
 --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
2872
 drop table t1,t2;
2873
 
2874
+SET @@global.max_binlog_size= @save_binlog_size;
2875
+
2876
 #
2877
 # Bug#14157 utf8 encoding in binlog without set character_set_client
2878
 #
2879
+### Starting master-bin.000004
2880
 flush logs;
2881
+
2882
 --write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
2883
 create table if not exists t5 (a int);
2884
 set names latin1;
2885
@@ -140,6 +155,8 @@
2886
 # resulted binlog, parly consisting of multi-byte utf8 chars,
2887
 # must be digestable for both client and server. In 4.1 the client
2888
 # should use default-character-set same as the server.
2889
+
2890
+### Starting master-bin.000005
2891
 flush logs;
2892
 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
2893
 select * from t5  /* must be (1),(1) */;
2894
@@ -150,6 +167,8 @@
2895
 # Check that a dump created by mysqlbinlog reproduces
2896
 # lc_time_names dependent values correctly
2897
 #
2898
+
2899
+### Starting master-bin.000006
2900
 flush logs;
2901
 create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
2902
 insert into t5 values (1, date_format('2001-01-01','%W'));
2903
@@ -158,7 +177,10 @@
2904
 set lc_time_names=en_US;
2905
 insert into t5 values (3, date_format('2001-01-01','%W'));
2906
 select * from t5 order by c1;
2907
+
2908
+### Starting master-bin.000007
2909
 flush logs;
2910
+
2911
 drop table t5;
2912
 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
2913
 select * from t5 order by c1;
2914
@@ -170,7 +192,10 @@
2915
 --disable_warnings
2916
 drop procedure if exists p1;
2917
 --enable_warnings
2918
+
2919
+### Starting master-bin.000008
2920
 flush logs;
2921
+
2922
 delimiter //;
2923
 create procedure p1()
2924
 begin
2925
@@ -178,12 +203,15 @@
2926
 end;
2927
 //
2928
 delimiter ;//
2929
+
2930
+### Starting master-bin.000009
2931
 flush logs;
2932
+
2933
 call p1();
2934
 drop procedure p1;
2935
 --error ER_SP_DOES_NOT_EXIST
2936
 call p1();
2937
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2938
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2939
 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
2940
 --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
2941
 call p1();
2942
@@ -202,7 +230,9 @@
2943
 # (LOAD DATA INFILE need it)
2944
 #
2945
 
2946
+### Starting master-bin.000010
2947
 flush logs;
2948
+
2949
 create table t1 (a varchar(64) character set utf8);
2950
 load data infile '../../std_data/loaddata6.dat' into table t1;
2951
 set character_set_database=koi8r;
2952
@@ -217,9 +247,12 @@
2953
 load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
2954
 select hex(a) from t1;
2955
 drop table t1;
2956
+
2957
+### Starting master-bin.000011
2958
 flush logs;
2959
+
2960
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2961
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
2962
+--replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
2963
 --exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
2964
 
2965
 #
2966
@@ -229,9 +262,14 @@
2967
 
2968
 CREATE TABLE t1 (c1 CHAR(10));
2969
 # we need this for getting fixed timestamps inside of this test
2970
+### Starting master-bin.000012
2971
 FLUSH LOGS;
2972
+
2973
 INSERT INTO t1 VALUES ('0123456789');
2974
+
2975
+### Starting master-bin.000013
2976
 FLUSH LOGS;
2977
+
2978
 DROP TABLE t1;
2979
 
2980
 # We create a table, patch, and load the output into it
2981
@@ -257,11 +295,16 @@
2982
 #
2983
 # Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
2984
 #
2985
+### Starting master-bin.000014
2986
 FLUSH LOGS;
2987
+
2988
 CREATE TABLE t1(a INT);
2989
 INSERT INTO t1 VALUES(connection_id());
2990
 let $a= `SELECT a FROM t1`;
2991
+
2992
+### Starting master-bin.000015
2993
 FLUSH LOGS;
2994
+
2995
 let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
2996
 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $outfile
2997
 DROP TABLE t1;
2998
@@ -281,11 +324,12 @@
2999
 exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
3000
 --remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
3001
 
3002
-
3003
 #
3004
 # Test --disable-force-if-open and --force-if-open
3005
 #
3006
+### Starting master-bin.000016
3007
 FLUSH LOGS;
3008
+
3009
 --error 1
3010
 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
3011
 --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
3012
@@ -300,9 +344,15 @@
3013
 SHOW GRANTS FOR untrusted@localhost;
3014
 USE mysqltest1;
3015
 CREATE TABLE t1 (a INT, b CHAR(64));
3016
+
3017
+### Starting master-bin.000017
3018
 flush logs;
3019
+
3020
 INSERT INTO t1 VALUES (1,USER());
3021
+
3022
+### Starting master-bin.000018
3023
 flush logs;
3024
+
3025
 echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
3026
 exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
3027
 connect (unsecure,localhost,untrusted,,mysqltest1);
3028
@@ -326,14 +376,20 @@
3029
 connection default;
3030
 USE test;
3031
 SET BINLOG_FORMAT = STATEMENT;
3032
+
3033
+### Starting master-bin.000019
3034
 FLUSH LOGS;
3035
+
3036
 CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
3037
 SET @a_real = rand(20) * 1000;
3038
 SET @an_int = 1000;
3039
 SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
3040
 SET @a_string = 'Just a test';
3041
 INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
3042
+
3043
+### Starting master-bin.000020
3044
 FLUSH LOGS;
3045
+
3046
 query_vertical SELECT * FROM t1;
3047
 DROP TABLE t1;
3048
 
3049
@@ -357,6 +413,7 @@
3050
 
3051
 RESET MASTER;
3052
 FLUSH LOGS;
3053
+
3054
 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
3055
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
3056
 eval SELECT
132.1.2 by Oleg Tsarev
adapt source code
3057
diff -ruN a/sql/handler.cc b/sql/handler.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3058
--- a/sql/handler.cc	2010-08-18 18:36:10.898621829 +0400
3059
+++ b/sql/handler.cc	2010-08-18 18:35:54.569873814 +0400
3060
@@ -4599,7 +4599,8 @@
3061
 
3062
 /** @brief
3063
    Write table maps for all (manually or automatically) locked tables
3064
-   to the binary log.
3065
+   to the binary log. Also, if binlog_annotate_rows_events is ON,
3066
+   write Annotate_rows event before the first table map.
3067
 
3068
    SYNOPSIS
3069
      write_locked_table_maps()
3070
@@ -4636,6 +4637,9 @@
3071
     locks[0]= thd->extra_lock;
3072
     locks[1]= thd->lock;
3073
     locks[2]= thd->locked_tables;
3074
+    my_bool with_annotate= thd->variables.binlog_annotate_rows_events &&
3075
+                           thd->query() && thd->query_length();
3076
+
3077
     for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )
3078
     {
3079
       MYSQL_LOCK const *const lock= locks[i];
3080
@@ -4653,7 +4657,8 @@
3081
             check_table_binlog_row_based(thd, table))
3082
         {
3083
           int const has_trans= table->file->has_transactions();
3084
-          int const error= thd->binlog_write_table_map(table, has_trans);
3085
+          int const error= thd->binlog_write_table_map(table, has_trans,
3086
+                                                       &with_annotate);
3087
           /*
3088
             If an error occurs, it is the responsibility of the caller to
3089
             roll back the transaction.
132.1.2 by Oleg Tsarev
adapt source code
3090
diff -ruN a/sql/log.cc b/sql/log.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3091
--- a/sql/log.cc	2010-08-18 18:36:10.908622544 +0400
3092
+++ b/sql/log.cc	2010-08-18 18:35:54.579885425 +0400
137 by Oleg Tsarev
adapt source code
3093
@@ -4233,10 +4233,12 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3094
 
3095
 
3096
 /*
3097
-  Write a table map to the binary log.
3098
+  Write a table map to the binary log. If with_annotate != NULL and
3099
+  *with_annotate = TRUE write also Annotate_rows before the table map.
3100
  */
3101
 
3102
-int THD::binlog_write_table_map(TABLE *table, bool is_trans)
3103
+int THD::binlog_write_table_map(TABLE *table, bool is_trans,
3104
+                                my_bool *with_annotate)
3105
 {
3106
   int error;
3107
   DBUG_ENTER("THD::binlog_write_table_map");
137 by Oleg Tsarev
adapt source code
3108
@@ -4254,7 +4256,7 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3109
   if (is_trans && binlog_table_maps == 0)
3110
     binlog_start_trans_and_stmt();
3111
 
3112
-  if ((error= mysql_bin_log.write(&the_event)))
3113
+  if ((error= mysql_bin_log.write(&the_event, with_annotate)))
3114
     DBUG_RETURN(error);
3115
 
3116
   binlog_table_maps++;
137 by Oleg Tsarev
adapt source code
3117
@@ -4384,10 +4386,12 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3118
 }
3119
 
3120
 /**
3121
-  Write an event to the binary log.
3122
+  Write an event to the binary log. If with_annotate != NULL and
3123
+  *with_annotate = TRUE write also Annotate_rows before the event
3124
+  (this should happen only if the event is a Table_map).
3125
 */
3126
 
3127
-bool MYSQL_BIN_LOG::write(Log_event *event_info)
3128
+bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
3129
 {
3130
   THD *thd= event_info->thd;
3131
   bool error= 1;
137 by Oleg Tsarev
adapt source code
3132
@@ -4562,6 +4566,16 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3133
       }
3134
     }
3135
 
3136
+    if (with_annotate && *with_annotate)
3137
+    {
3138
+      DBUG_ASSERT(event_info->get_type_code() == TABLE_MAP_EVENT);
3139
+      Annotate_rows_log_event anno(thd);
3140
+      /* Annotate event should be written not more than once */
3141
+      *with_annotate= 0;
3142
+      if (anno.write(file))
3143
+        goto err;
3144
+    }
3145
+
3146
     /*
3147
        Write the SQL command
3148
      */
132.1.2 by Oleg Tsarev
adapt source code
3149
diff -ruN a/sql/log_event.cc b/sql/log_event.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3150
--- a/sql/log_event.cc	2010-08-18 18:36:12.598623007 +0400
3151
+++ b/sql/log_event.cc	2010-08-18 18:35:54.579885425 +0400
3152
@@ -644,6 +644,7 @@
3153
   case BEGIN_LOAD_QUERY_EVENT: return "Begin_load_query";
3154
   case EXECUTE_LOAD_QUERY_EVENT: return "Execute_load_query";
3155
   case INCIDENT_EVENT: return "Incident";
3156
+  case ANNOTATE_ROWS_EVENT: return "Annotate_rows";
3157
   default: return "Unknown";				/* impossible */
3158
   }
3159
 }
3160
@@ -723,7 +724,7 @@
3161
     logs are in 4.0 format, until it finds a Format_desc).
3162
   */
3163
   if (description_event->binlog_version==3 &&
3164
-      buf[EVENT_TYPE_OFFSET]<FORMAT_DESCRIPTION_EVENT && log_pos)
3165
+      (uchar)buf[EVENT_TYPE_OFFSET]<FORMAT_DESCRIPTION_EVENT && log_pos)
3166
   {
3167
       /*
3168
         If log_pos=0, don't change it. log_pos==0 is a marker to mean
3169
@@ -741,8 +742,8 @@
3170
   DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos));
3171
 
3172
   flags= uint2korr(buf + FLAGS_OFFSET);
3173
-  if ((buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT) ||
3174
-      (buf[EVENT_TYPE_OFFSET] == ROTATE_EVENT))
3175
+  if (((uchar)buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT) ||
3176
+      ((uchar)buf[EVENT_TYPE_OFFSET] == ROTATE_EVENT))
3177
   {
3178
     /*
3179
       These events always have a header which stops here (i.e. their
3180
@@ -1164,14 +1165,14 @@
3181
 
3182
   /* Check the integrity */
3183
   if (event_len < EVENT_LEN_OFFSET ||
3184
-      buf[EVENT_TYPE_OFFSET] >= ENUM_END_EVENT ||
3185
+      (uchar)buf[EVENT_TYPE_OFFSET] >= ENUM_END_EVENT ||
3186
       (uint) event_len != uint4korr(buf+EVENT_LEN_OFFSET))
3187
   {
3188
     *error="Sanity check failed";		// Needed to free buffer
3189
     DBUG_RETURN(NULL); // general sanity check - will fail on a partial read
3190
   }
3191
 
3192
-  uint event_type= buf[EVENT_TYPE_OFFSET];
3193
+  uint event_type= (uchar)buf[EVENT_TYPE_OFFSET];
3194
   if (event_type > description_event->number_of_event_types &&
3195
       event_type != FORMAT_DESCRIPTION_EVENT)
3196
   {
3197
@@ -1293,6 +1294,9 @@
3198
     case INCIDENT_EVENT:
3199
       ev = new Incident_log_event(buf, event_len, description_event);
3200
       break;
3201
+    case ANNOTATE_ROWS_EVENT:
3202
+      ev = new Annotate_rows_log_event(buf, event_len, description_event);
3203
+      break;
3204
     default:
3205
       DBUG_PRINT("error",("Unknown event code: %d",
3206
                           (int) buf[EVENT_TYPE_OFFSET]));
132.1.2 by Oleg Tsarev
adapt source code
3207
@@ -3781,6 +3785,13 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3208
                       post_header_len[DELETE_ROWS_EVENT-1]= 6;);
3209
       post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN;
3210
 
3211
+      // Set header length of the reserved events to 0
3212
+      memset(post_header_len + MYSQL_EVENTS_END - 1, 0,
3213
+             (MARIA_EVENTS_BEGIN - MYSQL_EVENTS_END)*sizeof(uint8));
3214
+
3215
+      // Set header lengths of Maria events
3216
+      post_header_len[ANNOTATE_ROWS_EVENT-1]= ANNOTATE_ROWS_HEADER_LEN;
3217
+
3218
       // Sanity-check that all post header lengths are initialized.
3219
       IF_DBUG({
3220
           int i;
132.1.2 by Oleg Tsarev
adapt source code
3221
@@ -4425,8 +4436,8 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3222
   */
3223
   if (event_len)
3224
     copy_log_event(buf, event_len,
3225
-                   ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
3226
-                    LOAD_HEADER_LEN + 
3227
+                   (((uchar)buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
3228
+                   LOAD_HEADER_LEN + 
3229
                     description_event->common_header_len :
3230
                     LOAD_HEADER_LEN + LOG_EVENT_HEADER_LEN),
3231
                    description_event);
132.1.2 by Oleg Tsarev
adapt source code
3232
@@ -4463,7 +4474,7 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3233
   */
3234
   if (!(field_lens= (uchar*)sql_ex.init((char*)buf + body_offset,
3235
                                         buf_end,
3236
-                                        buf[EVENT_TYPE_OFFSET] != LOAD_EVENT)))
3237
+                                        (uchar)buf[EVENT_TYPE_OFFSET] != LOAD_EVENT)))
3238
     DBUG_RETURN(1);
3239
   
3240
   data_len = event_len - body_offset;
132.1.2 by Oleg Tsarev
adapt source code
3241
@@ -6150,7 +6161,7 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3242
   uint8 create_file_header_len= description_event->post_header_len[CREATE_FILE_EVENT-1];
3243
   if (!(event_buf= (char*) my_memdup(buf, len, MYF(MY_WME))) ||
3244
       copy_log_event(event_buf,len,
3245
-                     ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
3246
+                     (((uchar)buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
3247
                       load_header_len + header_len :
3248
                       (fake_base ? (header_len+load_header_len) :
3249
                        (header_len+load_header_len) +
132.1.2 by Oleg Tsarev
adapt source code
3250
@@ -7905,6 +7916,141 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3251
 #endif
3252
 
3253
 /**************************************************************************
3254
+	Annotate_rows_log_event member functions
3255
+**************************************************************************/
3256
+
3257
+#ifndef MYSQL_CLIENT
3258
+Annotate_rows_log_event::Annotate_rows_log_event(THD *thd)
3259
+  : Log_event(thd, 0, true),
3260
+    m_save_thd_query_txt(0),
3261
+    m_save_thd_query_len(0)
3262
+{
3263
+  m_query_txt= thd->query();
3264
+  m_query_len= thd->query_length();
3265
+}
3266
+#endif
3267
+
3268
+Annotate_rows_log_event::Annotate_rows_log_event(const char *buf,
3269
+                                                 uint event_len,
3270
+                                      const Format_description_log_event *desc)
3271
+  : Log_event(buf, desc),
3272
+    m_save_thd_query_txt(0),
3273
+    m_save_thd_query_len(0)
3274
+{
3275
+  m_query_len= event_len - desc->common_header_len;
3276
+  m_query_txt= (char*) buf + desc->common_header_len;
3277
+}
3278
+
3279
+Annotate_rows_log_event::~Annotate_rows_log_event()
3280
+{
3281
+#ifndef MYSQL_CLIENT
3282
+  if (m_save_thd_query_txt)
3283
+    thd->set_query(m_save_thd_query_txt, m_save_thd_query_len);
3284
+#endif
3285
+}
3286
+
3287
+int Annotate_rows_log_event::get_data_size()
3288
+{
3289
+  return m_query_len;
3290
+}
3291
+
3292
+Log_event_type Annotate_rows_log_event::get_type_code()
3293
+{
3294
+  return ANNOTATE_ROWS_EVENT;
3295
+}
3296
+
3297
+bool Annotate_rows_log_event::is_valid() const
3298
+{
3299
+  return (m_query_txt != NULL && m_query_len != 0);
3300
+}
3301
+
3302
+#ifndef MYSQL_CLIENT
3303
+bool Annotate_rows_log_event::write_data_header(IO_CACHE *file)
3304
+{ 
3305
+  return 0;
3306
+}
3307
+#endif
3308
+
3309
+#ifndef MYSQL_CLIENT
3310
+bool Annotate_rows_log_event::write_data_body(IO_CACHE *file)
3311
+{
3312
+  return my_b_safe_write(file, (uchar*) m_query_txt, m_query_len);
3313
+}
3314
+#endif
3315
+
3316
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3317
+void Annotate_rows_log_event::pack_info(Protocol* protocol)
3318
+{
3319
+  if (m_query_txt && m_query_len)
3320
+    protocol->store(m_query_txt, m_query_len, &my_charset_bin);
3321
+}
3322
+#endif
3323
+
3324
+#ifdef MYSQL_CLIENT
3325
+void Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo)
3326
+{
3327
+  if (pinfo->short_form)
3328
+    return;
3329
+
3330
+  print_header(&pinfo->head_cache, pinfo, TRUE);
3331
+  my_b_printf(&pinfo->head_cache, "\tAnnotate_rows:\n");
3332
+
3333
+  char *pbeg;   // beginning of the next line
3334
+  char *pend;   // end of the next line
3335
+  uint cnt= 0;  // characters counter
3336
+
3337
+  for (pbeg= m_query_txt; ; pbeg= pend)
3338
+  {
3339
+    // skip all \r's and \n's at the beginning of the next line
3340
+    for (;; pbeg++)
3341
+    {
3342
+      if (++cnt > m_query_len)
3343
+        return;
3344
+
3345
+      if (*pbeg != '\r' && *pbeg != '\n')
3346
+        break;
3347
+    }
3348
+
3349
+    // find end of the next line
3350
+    for (pend= pbeg + 1;
3351
+         ++cnt <= m_query_len && *pend != '\r' && *pend != '\n';
3352
+         pend++);
3353
+
3354
+    // print next line
3355
+    my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4);
3356
+    my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg);
3357
+    my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1);
3358
+  }
3359
+}
3360
+#endif
3361
+
3362
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3363
+int Annotate_rows_log_event::do_apply_event(Relay_log_info const *rli)
3364
+{
3365
+  m_save_thd_query_txt= thd->query();
3366
+  m_save_thd_query_len= thd->query_length();
3367
+  thd->set_query(m_query_txt, m_query_len);
3368
+  return 0;
3369
+}
3370
+#endif
3371
+
3372
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3373
+int Annotate_rows_log_event::do_update_pos(Relay_log_info *rli)
3374
+{
3375
+  rli->inc_event_relay_log_pos();
3376
+  return 0;
3377
+}
3378
+#endif
3379
+
3380
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3381
+Log_event::enum_skip_reason
3382
+Annotate_rows_log_event::do_shall_skip(Relay_log_info *rli)
3383
+{
3384
+  return continue_group(rli);
3385
+}
3386
+#endif
3387
+
3388
+/**************************************************************************
3389
 	Table_map_log_event member functions and support functions
3390
 **************************************************************************/
3391
 
132.1.2 by Oleg Tsarev
adapt source code
3392
diff -ruN a/sql/log_event.h b/sql/log_event.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3393
--- a/sql/log_event.h	2010-08-18 18:36:12.608624840 +0400
3394
+++ b/sql/log_event.h	2010-08-18 18:35:54.589872172 +0400
3395
@@ -250,6 +250,7 @@
3396
 #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1)
3397
 #define EXECUTE_LOAD_QUERY_HEADER_LEN  (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN)
3398
 #define INCIDENT_HEADER_LEN    2
3399
+#define ANNOTATE_ROWS_HEADER_LEN  0
3400
 /* 
3401
   Max number of possible extra bytes in a replication event compared to a
3402
   packet (i.e. a query) sent from client to master;
132.1.2 by Oleg Tsarev
adapt source code
3403
@@ -582,8 +583,14 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3404
    */
3405
   INCIDENT_EVENT= 26,
3406
 
3407
+  /* New MySQL/Sun events are to be added right above this comment */
3408
+  MYSQL_EVENTS_END,
3409
+
3410
+  MARIA_EVENTS_BEGIN= 160,
3411
+  /* New Maria event numbers start from here */
3412
+  ANNOTATE_ROWS_EVENT= 160,
3413
+
3414
   /*
3415
-    Add new events here - right above this comment!
3416
     Existing events (except ENUM_END_EVENT) should never change their numbers
3417
   */
3418
 
132.1.2 by Oleg Tsarev
adapt source code
3419
@@ -2986,6 +2993,59 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3420
 char *str_to_hex(char *to, const char *from, uint len);
3421
 
3422
 /**
3423
+  @class Annotate_rows_log_event
3424
+
3425
+  In row-based mode, if binlog_annotate_rows_events = ON, each group of
3426
+  Table_map_log_events is preceded by an Annotate_rows_log_event which
3427
+  contains the query which caused the subsequent rows operations.
3428
+
3429
+  The Annotate_rows_log_event has no post-header and its body contains
3430
+  the corresponding query (without trailing zero). Note. The query length
3431
+  is to be calculated as a difference between the whole event length and
3432
+  the common header length.
3433
+*/
3434
+class Annotate_rows_log_event: public Log_event
3435
+{
3436
+public:
3437
+#ifndef MYSQL_CLIENT
3438
+  Annotate_rows_log_event(THD*);
3439
+#endif
3440
+  Annotate_rows_log_event(const char *buf, uint event_len,
3441
+                          const Format_description_log_event*);
3442
+  ~Annotate_rows_log_event();
3443
+
3444
+  virtual int get_data_size();
3445
+  virtual Log_event_type get_type_code();
3446
+  virtual bool is_valid() const;
3447
+
3448
+#ifndef MYSQL_CLIENT
3449
+  virtual bool write_data_header(IO_CACHE*);
3450
+  virtual bool write_data_body(IO_CACHE*);
3451
+#endif
3452
+
3453
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3454
+  virtual void pack_info(Protocol*);
3455
+#endif
3456
+
3457
+#ifdef MYSQL_CLIENT
3458
+  virtual void print(FILE*, PRINT_EVENT_INFO*);
3459
+#endif
3460
+
3461
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3462
+private:
3463
+  virtual int do_apply_event(Relay_log_info const*);
3464
+  virtual int do_update_pos(Relay_log_info*);
3465
+  virtual enum_skip_reason do_shall_skip(Relay_log_info*);
3466
+#endif
3467
+
3468
+private:
3469
+  char *m_query_txt;
3470
+  uint  m_query_len;
3471
+  char *m_save_thd_query_txt;
3472
+  uint  m_save_thd_query_len;
3473
+};
3474
+
3475
+/**
3476
   @class Table_map_log_event
3477
 
3478
   In row-based mode, every row operation event is preceded by a
132.1.2 by Oleg Tsarev
adapt source code
3479
diff -ruN a/sql/log.h b/sql/log.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3480
--- a/sql/log.h	2010-08-18 18:36:10.908622544 +0400
3481
+++ b/sql/log.h	2010-08-18 18:35:54.589872172 +0400
132.1.2 by Oleg Tsarev
adapt source code
3482
@@ -357,7 +357,8 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3483
   void new_file();
3484
 
132.1.2 by Oleg Tsarev
adapt source code
3485
   void reset_gathered_updates(THD *thd);
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3486
-  bool write(Log_event* event_info); // binary log write
3487
+  bool write(Log_event* event_info,
3488
+             my_bool *with_annotate= 0); // binary log write
3489
   bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
132.1.2 by Oleg Tsarev
adapt source code
3490
 
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3491
   bool write_incident(THD *thd, bool lock);
132.1.2 by Oleg Tsarev
adapt source code
3492
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3493
--- a/sql/mysqld.cc	2010-08-18 18:36:12.608624840 +0400
3494
+++ b/sql/mysqld.cc	2010-08-18 18:35:54.589872172 +0400
152 by Oleg Tsarev
sync fixes for --without-response_time_distribution
3495
@@ -496,6 +496,7 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3496
 my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
3497
 my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
3498
 my_bool opt_log_slave_updates= 0;
3499
+my_bool opt_replicate_annotate_rows_events= 0;
3500
 bool slave_warning_issued = false; 
3501
 
3502
 /*
152 by Oleg Tsarev
sync fixes for --without-response_time_distribution
3503
@@ -5863,6 +5864,8 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3504
   OPT_REPLICATE_IGNORE_DB,     OPT_LOG_SLAVE_UPDATES,
3505
   OPT_BINLOG_DO_DB,            OPT_BINLOG_IGNORE_DB,
3506
   OPT_BINLOG_FORMAT,
3507
+  OPT_BINLOG_ANNOTATE_ROWS_EVENTS,
3508
+  OPT_REPLICATE_ANNOTATE_ROWS_EVENTS,
3509
 #ifndef DBUG_OFF
3510
   OPT_BINLOG_SHOW_XID,
3511
 #endif
152 by Oleg Tsarev
sync fixes for --without-response_time_distribution
3512
@@ -6099,6 +6102,18 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3513
 #endif
3514
    , &opt_binlog_format, &opt_binlog_format,
3515
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3516
+  {"binlog-annotate-rows-events", OPT_BINLOG_ANNOTATE_ROWS_EVENTS,
3517
+   "Tells the master to annotate RBR events with the statement that "
3518
+   "caused these events.",
3519
+   (uchar**) &global_system_variables.binlog_annotate_rows_events,
3520
+   (uchar**) &max_system_variables.binlog_annotate_rows_events,
3521
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3522
+  {"replicate-annotate-rows-events", OPT_REPLICATE_ANNOTATE_ROWS_EVENTS,
3523
+   "Tells the slave to write annotate rows events recieved from the master "
3524
+   "to its own binary log. Sensible only in pair with log-slave-updates option.",
3525
+   (uchar**) &opt_replicate_annotate_rows_events,
3526
+   (uchar**) &opt_replicate_annotate_rows_events,
3527
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3528
   {"binlog-do-db", OPT_BINLOG_DO_DB,
3529
    "Tells the master it should log updates for the specified database, "
3530
    "and exclude all others not explicitly mentioned.",
132.1.2 by Oleg Tsarev
adapt source code
3531
diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3532
--- a/sql/mysql_priv.h	2010-08-18 18:36:12.628622360 +0400
3533
+++ b/sql/mysql_priv.h	2010-08-18 18:35:54.589872172 +0400
3534
@@ -588,7 +588,11 @@
3535
 /* BINLOG_DUMP options */
3536
 
3537
 #define BINLOG_DUMP_NON_BLOCK   1
3538
+#endif /* !MYSQL_CLIENT */
3539
 
3540
+#define BINLOG_SEND_ANNOTATE_ROWS_EVENT   2
3541
+
3542
+#ifndef MYSQL_CLIENT
3543
 /* sql_show.cc:show_log_files() */
3544
 #define SHOW_LOG_STATUS_FREE "FREE"
3545
 #define SHOW_LOG_STATUS_INUSE "IN USE"
132.1.2 by Oleg Tsarev
adapt source code
3546
diff -ruN a/sql/rpl_rli.cc b/sql/rpl_rli.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3547
--- a/sql/rpl_rli.cc	2010-07-09 16:34:57.000000000 +0400
3548
+++ b/sql/rpl_rli.cc	2010-08-18 18:35:54.589872172 +0400
3549
@@ -43,7 +43,8 @@
3550
    inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
3551
    until_log_pos(0), retried_trans(0),
3552
    tables_to_lock(0), tables_to_lock_count(0),
3553
-   last_event_start_time(0), m_flags(0)
3554
+   last_event_start_time(0), m_flags(0),
3555
+   m_annotate_event(0)
3556
 {
3557
   DBUG_ENTER("Relay_log_info::Relay_log_info");
3558
 
3559
@@ -77,6 +78,7 @@
3560
   pthread_cond_destroy(&stop_cond);
3561
   pthread_cond_destroy(&log_space_cond);
3562
   relay_log.cleanup();
3563
+  free_annotate_event();
3564
   DBUG_VOID_RETURN;
3565
 }
3566
 
132.1.2 by Oleg Tsarev
adapt source code
3567
diff -ruN a/sql/rpl_rli.h b/sql/rpl_rli.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3568
--- a/sql/rpl_rli.h	2010-07-09 16:35:15.000000000 +0400
3569
+++ b/sql/rpl_rli.h	2010-08-18 18:35:54.589872172 +0400
3570
@@ -413,8 +413,46 @@
3571
       (m_flags & (1UL << IN_STMT));
3572
   }
3573
 
3574
+  /**
3575
+    Save pointer to Annotate_rows event and switch on the
3576
+    binlog_annotate_rows_events for this sql thread.
3577
+    To be called when sql thread recieves an Annotate_rows event.
3578
+  */
3579
+  inline void set_annotate_event(Annotate_rows_log_event *event)
3580
+  {
3581
+    free_annotate_event();
3582
+    m_annotate_event= event;
3583
+    sql_thd->variables.binlog_annotate_rows_events= 1;
3584
+  }
3585
+
3586
+  /**
3587
+    Returns pointer to the saved Annotate_rows event or NULL if there is
3588
+    no saved event.
3589
+  */
3590
+  inline Annotate_rows_log_event* get_annotate_event()
3591
+  {
3592
+    return m_annotate_event;
3593
+  }
3594
+
3595
+  /**
3596
+    Delete saved Annotate_rows event (if any) and switch off the
3597
+    binlog_annotate_rows_events for this sql thread.
3598
+    To be called when sql thread has applied the last (i.e. with
3599
+    STMT_END_F flag) rbr event.
3600
+  */
3601
+  inline void free_annotate_event()
3602
+  {
3603
+    if (m_annotate_event)
3604
+    {
3605
+      sql_thd->variables.binlog_annotate_rows_events= 0;
3606
+      delete m_annotate_event;
3607
+      m_annotate_event= 0;
3608
+    }
3609
+  }
3610
+
3611
 private:
3612
   uint32 m_flags;
3613
+  Annotate_rows_log_event *m_annotate_event;
3614
 };
3615
 
3616
 
132.1.2 by Oleg Tsarev
adapt source code
3617
diff -ruN a/sql/set_var.cc b/sql/set_var.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3618
--- a/sql/set_var.cc	2010-08-18 18:36:12.548623621 +0400
3619
+++ b/sql/set_var.cc	2010-08-18 18:35:54.599871770 +0400
144 by Oleg Tsarev
update branch
3620
@@ -245,6 +245,9 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3621
                                              OPT_GLOBAL, SHOW_LONG,
3622
                                              (uchar*) &back_log);
3623
 static sys_var_const_os_str       sys_basedir(&vars, "basedir", mysql_home);
3624
+static sys_var_thd_bool
3625
+sys_binlog_annotate_rows_events(&vars, "binlog_annotate_rows_events",
3626
+                            &SV::binlog_annotate_rows_events);
3627
 static sys_var_long_ptr	sys_binlog_cache_size(&vars, "binlog_cache_size",
3628
 					      &binlog_cache_size);
3629
 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
132.1.2 by Oleg Tsarev
adapt source code
3630
diff -ruN a/sql/slave.cc b/sql/slave.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3631
--- a/sql/slave.cc	2010-08-18 18:36:10.809873377 +0400
3632
+++ b/sql/slave.cc	2010-08-18 18:35:54.599871770 +0400
3633
@@ -1899,6 +1899,9 @@
3634
   
3635
   *suppress_warnings= FALSE;
3636
 
3637
+  if (opt_log_slave_updates && opt_replicate_annotate_rows_events)
3638
+    binlog_flags|= BINLOG_SEND_ANNOTATE_ROWS_EVENT;
3639
+
3640
   // TODO if big log files: Change next to int8store()
3641
   int4store(buf, (ulong) mi->master_log_pos);
3642
   int2store(buf + 4, binlog_flags);
3643
@@ -2293,17 +2296,41 @@
3644
     }
3645
     exec_res= apply_event_and_update_pos(ev, thd, rli);
3646
 
3647
-    /*
3648
-      Format_description_log_event should not be deleted because it will be
3649
-      used to read info about the relay log's format; it will be deleted when
3650
-      the SQL thread does not need it, i.e. when this thread terminates.
3651
-    */
3652
-    if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
3653
-    {
3654
-      DBUG_PRINT("info", ("Deleting the event after it has been executed"));
3655
-      delete ev;
3656
+    switch (ev->get_type_code()) {
3657
+      case FORMAT_DESCRIPTION_EVENT:
3658
+        /*
3659
+          Format_description_log_event should not be deleted because it
3660
+          will be used to read info about the relay log's format;
3661
+          it will be deleted when the SQL thread does not need it,
3662
+          i.e. when this thread terminates.
3663
+        */
3664
+        break;
3665
+      case ANNOTATE_ROWS_EVENT:
3666
+        /*
3667
+          Annotate_rows event should not be deleted because after it has
3668
+          been applied, thd->query points to the string inside this event.
3669
+          The thd->query will be used to generate new Annotate_rows event
3670
+          during applying the subsequent Rows events.
3671
+        */
3672
+        rli->set_annotate_event((Annotate_rows_log_event*) ev);
3673
+        break;
3674
+      case DELETE_ROWS_EVENT:
3675
+      case UPDATE_ROWS_EVENT:
3676
+      case WRITE_ROWS_EVENT:
3677
+        /*
3678
+          After the last Rows event has been applied, the saved Annotate_rows
3679
+          event (if any) is not needed anymore and can be deleted.
3680
+        */
3681
+        if (((Rows_log_event*)ev)->get_flags(Rows_log_event::STMT_END_F))
3682
+          rli->free_annotate_event();
3683
+        /* fall through */
3684
+      default:
3685
+        DBUG_PRINT("info", ("Deleting the event after it has been executed"));
3686
+        delete ev;
3687
+        break;
3688
     }
3689
 
3690
+
3691
     /*
3692
       update_log_pos failed: this should not happen, so we don't
3693
       retry.
3694
@@ -2929,6 +2956,12 @@
3695
   thd->init_for_queries();
3696
   thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
3697
   set_thd_in_use_temporary_tables(rli);   // (re)set sql_thd in use for saved temp tables
3698
+  /*
3699
+    binlog_annotate_rows_events must be TRUE only after an Annotate_rows event
3700
+    has been recieved and only till the last corresponding rbr event has been
3701
+    applied. In all other cases it must be FALSE.
3702
+  */
3703
+  thd->variables.binlog_annotate_rows_events= 0;
3704
   pthread_mutex_lock(&LOCK_thread_count);
3705
   threads.append(thd);
3706
   pthread_mutex_unlock(&LOCK_thread_count);
132.1.2 by Oleg Tsarev
adapt source code
3707
@@ -3411,7 +3444,7 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3708
     If we get Load event, we need to pass a non-reusable buffer
3709
     to read_log_event, so we do a trick
3710
   */
3711
-  if (buf[EVENT_TYPE_OFFSET] == LOAD_EVENT)
3712
+  if ((uchar)buf[EVENT_TYPE_OFFSET] == LOAD_EVENT)
3713
   {
3714
     if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME)))))
3715
     {
132.1.2 by Oleg Tsarev
adapt source code
3716
@@ -3618,13 +3651,13 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3717
   LINT_INIT(inc_pos);
3718
 
3719
   if (mi->rli.relay_log.description_event_for_queue->binlog_version<4 &&
3720
-      buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
3721
+      (uchar)buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
3722
     DBUG_RETURN(queue_old_event(mi,buf,event_len));
3723
 
3724
   LINT_INIT(inc_pos);
3725
   pthread_mutex_lock(&mi->data_lock);
3726
 
3727
-  switch (buf[EVENT_TYPE_OFFSET]) {
3728
+  switch ((uchar)buf[EVENT_TYPE_OFFSET]) {
3729
   case STOP_EVENT:
3730
     /*
3731
       We needn't write this event to the relay log. Indeed, it just indicates a
132.1.2 by Oleg Tsarev
adapt source code
3732
@@ -3727,9 +3760,9 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3733
       the master's binlog (i.e. Format_desc, Rotate & Stop) should not increment
3734
       mi->master_log_pos.
3735
     */
3736
-    if (buf[EVENT_TYPE_OFFSET]!=FORMAT_DESCRIPTION_EVENT &&
3737
-        buf[EVENT_TYPE_OFFSET]!=ROTATE_EVENT &&
3738
-        buf[EVENT_TYPE_OFFSET]!=STOP_EVENT)
3739
+    if ((uchar)buf[EVENT_TYPE_OFFSET]!=FORMAT_DESCRIPTION_EVENT &&
3740
+        (uchar)buf[EVENT_TYPE_OFFSET]!=ROTATE_EVENT &&
3741
+        (uchar)buf[EVENT_TYPE_OFFSET]!=STOP_EVENT)
3742
     {
3743
       mi->master_log_pos+= inc_pos;
3744
       memcpy(rli->ign_master_log_name_end, mi->master_log_name, FN_REFLEN);
132.1.2 by Oleg Tsarev
adapt source code
3745
diff -ruN a/sql/slave.h b/sql/slave.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3746
--- a/sql/slave.h	2010-07-09 16:35:15.000000000 +0400
3747
+++ b/sql/slave.h	2010-08-18 18:35:54.609873882 +0400
3748
@@ -105,6 +105,7 @@
3749
 extern char *opt_relay_logname, *opt_relaylog_index_name;
3750
 extern my_bool opt_skip_slave_start, opt_reckless_slave;
3751
 extern my_bool opt_log_slave_updates;
3752
+extern my_bool opt_replicate_annotate_rows_events;
3753
 extern ulonglong relay_log_space_limit;
3754
 
3755
 /*
132.1.2 by Oleg Tsarev
adapt source code
3756
diff -ruN a/sql/sql_binlog.cc b/sql/sql_binlog.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3757
--- a/sql/sql_binlog.cc	2010-07-09 16:34:57.000000000 +0400
3758
+++ b/sql/sql_binlog.cc	2010-08-18 18:35:54.609873882 +0400
3759
@@ -167,7 +167,7 @@
3760
       */
3761
       if (!have_fd_event)
3762
       {
3763
-        int type = bufptr[EVENT_TYPE_OFFSET];
3764
+        int type = (uchar)bufptr[EVENT_TYPE_OFFSET];
3765
         if (type == FORMAT_DESCRIPTION_EVENT || type == START_EVENT_V3)
3766
           have_fd_event= TRUE;
3767
         else
132.1.2 by Oleg Tsarev
adapt source code
3768
diff -ruN a/sql/sql_class.h b/sql/sql_class.h
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3769
--- a/sql/sql_class.h	2010-08-18 18:36:12.379884806 +0400
3770
+++ b/sql/sql_class.h	2010-08-18 18:35:54.609873882 +0400
132.1.2 by Oleg Tsarev
adapt source code
3771
@@ -358,6 +358,7 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3772
   ulong ndb_index_stat_cache_entries;
3773
   ulong ndb_index_stat_update_freq;
3774
   ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
3775
+  my_bool binlog_annotate_rows_events;
3776
   my_bool binlog_direct_non_trans_update;
3777
   /*
3778
     In slave thread we need to know in behalf of which
132.1.2 by Oleg Tsarev
adapt source code
3779
@@ -1492,7 +1493,8 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3780
   */
3781
   void binlog_start_trans_and_stmt();
3782
   void binlog_set_stmt_begin();
3783
-  int binlog_write_table_map(TABLE *table, bool is_transactional);
3784
+  int binlog_write_table_map(TABLE *table, bool is_transactional,
3785
+                             my_bool *with_annotate= 0);
3786
   int binlog_write_row(TABLE* table, bool is_transactional,
3787
                        MY_BITMAP const* cols, size_t colcnt,
3788
                        const uchar *buf);
132.1.2 by Oleg Tsarev
adapt source code
3789
diff -ruN a/sql/sql_insert.cc b/sql/sql_insert.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3790
--- a/sql/sql_insert.cc	2010-08-18 18:36:10.958622210 +0400
3791
+++ b/sql/sql_insert.cc	2010-08-18 18:35:54.609873882 +0400
3792
@@ -1934,6 +1934,11 @@
3793
       pthread_mutex_lock(&LOCK_thread_count);
3794
       thread_count++;
3795
       pthread_mutex_unlock(&LOCK_thread_count);
3796
+      /*
3797
+        Annotating delayed inserts is not supported.
3798
+      */
3799
+      di->thd.variables.binlog_annotate_rows_events= 0;
3800
+
3801
       di->thd.set_db(table_list->db, (uint) strlen(table_list->db));
3802
       di->thd.set_query(my_strdup(table_list->table_name, MYF(MY_WME)), 0);
3803
       if (di->thd.db == NULL || di->thd.query() == NULL)
132.1.2 by Oleg Tsarev
adapt source code
3804
diff -ruN a/sql/sql_repl.cc b/sql/sql_repl.cc
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3805
--- a/sql/sql_repl.cc	2010-07-09 16:34:57.000000000 +0400
3806
+++ b/sql/sql_repl.cc	2010-08-18 18:35:54.619874038 +0400
3807
@@ -489,7 +489,7 @@
3808
        DBUG_PRINT("info",
3809
                   ("Looked for a Format_description_log_event, found event type %d",
3810
                    (*packet)[EVENT_TYPE_OFFSET+1]));
3811
-       if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT)
3812
+       if ((uchar)(*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT)
3813
        {
3814
          binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] &
3815
                                        LOG_EVENT_BINLOG_IN_USE_F);
3816
@@ -557,31 +557,36 @@
3817
 #endif
3818
 
3819
       if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT)
3820
+      if ((uchar)(*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT)
3821
       {
3822
         binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] &
3823
                                       LOG_EVENT_BINLOG_IN_USE_F);
3824
         (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F;
3825
       }
3826
-      else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT)
3827
+      else if ((uchar)(*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT)
3828
         binlog_can_be_corrupted= FALSE;
3829
 
3830
-      if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
3831
+      if ((uchar)(*packet)[EVENT_TYPE_OFFSET+1] != ANNOTATE_ROWS_EVENT ||
3832
+          (flags & BINLOG_SEND_ANNOTATE_ROWS_EVENT))
3833
       {
3834
-	errmsg = "Failed on my_net_write()";
3835
-	my_errno= ER_UNKNOWN_ERROR;
3836
-	goto err;
3837
-      }
3838
+        if (my_net_write(net, (uchar*) packet->ptr(), packet->length()))
3839
+        {
3840
+          errmsg = "Failed on my_net_write()";
3841
+          my_errno= ER_UNKNOWN_ERROR;
3842
+          goto err;
3843
+        }
3844
 
3845
-      DBUG_PRINT("info", ("log event code %d",
3846
-			  (*packet)[LOG_EVENT_OFFSET+1] ));
3847
-      if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
3848
-      {
3849
-	if (send_file(thd))
3850
-	{
3851
-	  errmsg = "failed in send_file()";
3852
-	  my_errno= ER_UNKNOWN_ERROR;
3853
-	  goto err;
3854
-	}
3855
+        DBUG_PRINT("info", ("log event code %d",
3856
+			    (*packet)[LOG_EVENT_OFFSET+1] ));
3857
+        if ((uchar)(*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
3858
+        {
3859
+          if (send_file(thd))
3860
+          {
3861
+	          errmsg = "failed in send_file()";
3862
+	          my_errno= ER_UNKNOWN_ERROR;
3863
+	          goto err;
3864
+          }
3865
+        }
3866
       }
3867
       packet->set("\0", 1, &my_charset_bin);
3868
     }
3869
@@ -677,23 +682,27 @@
3870
 
3871
 	if (read_packet)
3872
 	{
3873
-	  thd_proc_info(thd, "Sending binlog event to slave");
3874
-	  if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) )
3875
-	  {
3876
-	    errmsg = "Failed on my_net_write()";
3877
-	    my_errno= ER_UNKNOWN_ERROR;
3878
-	    goto err;
3879
-	  }
3880
-
3881
-	  if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
3882
-	  {
3883
-	    if (send_file(thd))
3884
+	  if ((uchar)(*packet)[EVENT_TYPE_OFFSET+1] != ANNOTATE_ROWS_EVENT ||
3885
+	      (flags & BINLOG_SEND_ANNOTATE_ROWS_EVENT))
3886
+    {
3887
+	    thd_proc_info(thd, "Sending binlog event to slave");
3888
+	    if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) )
3889
 	    {
3890
-	      errmsg = "failed in send_file()";
3891
+	      errmsg = "Failed on my_net_write()";
3892
 	      my_errno= ER_UNKNOWN_ERROR;
3893
 	      goto err;
3894
 	    }
3895
-	  }
3896
+
3897
+	    if ((uchar)(*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT)
3898
+	    {
3899
+	      if (send_file(thd))
3900
+	      {
3901
+	        errmsg = "failed in send_file()";
3902
+	        my_errno= ER_UNKNOWN_ERROR;
3903
+	        goto err;
3904
+	      }
3905
+	    }
3906
+    }
3907
 	  packet->set("\0", 1, &my_charset_bin);
3908
 	  /*
3909
 	    No need to net_flush because we will get to flush later when
132.1.2 by Oleg Tsarev
adapt source code
3910
@@ -1774,6 +1783,11 @@
132.1.1 by Oleg Tsarev
just add patches and tests from 5.1.49-rnt
3911
 static sys_var_const    sys_log_slave_updates(&vars, "log_slave_updates",
3912
                                               OPT_GLOBAL, SHOW_MY_BOOL,
3913
                                               (uchar*) &opt_log_slave_updates);
3914
+static sys_var_const
3915
+sys_replicate_annotate_rows_events(&vars,
3916
+                                "replicate_annotate_rows_events",
3917
+                                OPT_GLOBAL, SHOW_MY_BOOL,
3918
+                                (uchar*) &opt_replicate_annotate_rows_events);
3919
 static sys_var_const    sys_relay_log(&vars, "relay_log",
3920
                                       OPT_GLOBAL, SHOW_CHAR_PTR,
3921
                                       (uchar*) &opt_relay_logname);