developers
Threads by month
- ----- 2025 -----
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 3 participants
- 6830 discussions

[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 20
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:22)=-=-
Add estimation time.
Worked 5 hours and estimate 35 hours remain (original estimate increased by 5 hours).
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
------------------------------------------------------------
-=-=(View All Progress Notes, 12 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 20
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:22)=-=-
Add estimation time.
Worked 5 hours and estimate 35 hours remain (original estimate increased by 5 hours).
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
------------------------------------------------------------
-=-=(View All Progress Notes, 12 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 20
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:22)=-=-
Add estimation time.
Worked 5 hours and estimate 35 hours remain (original estimate increased by 5 hours).
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
------------------------------------------------------------
-=-=(View All Progress Notes, 12 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Provide an " ORDER BY FIRST_JOIN.column" feature (59)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Provide an "ORDER BY FIRST_JOIN.column" feature
CREATION DATE..: Thu, 22 Oct 2009, 12:33
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 59 (http://askmonty.org/worklog/?tid=59)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 5
ESTIMATE.......: 20 (hours remain)
ORIG. ESTIMATE.: 20
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:21)=-=-
Last hours added to the wrong worklog item, sorry.
Reported zero hours worked. Estimate unchanged.
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:21)=-=-
Added the estimation time.
Worked 5 hours and estimate 20 hours remain (original estimate increased by 25 hours).
DESCRIPTION:
Question:
How much effort would be required to provide an "ORDER BY
FIRST_JOIN.column" feature? We often do self-join queries and want to
order them by index, i.e.:
create table t1 (a int, b int, unique key 'by_a_b' (a, b)));
select * from t1 x inner join t1 y on (x.b = y.b) where x.a=1 and
y.a=2 order by (x|y).b desc limit 10;
but it is only ordered by index if you order by the first table in the
optimized join order, which could be either x or y depending on which
is more selective. we don't want to force the join order because
often one is far more selective than the other, but the only way to
know what table to order by then is to explain the query first. if
there was some way to tell mysql to just order by the first join in
the optimized order, that would help us. sometimes we do this across
tables too. both of these can be solved by rewriting the query to say
"using" instead of "on" in which case we don't have to specify the
table name of the column, just "order by b desc". but, we also want
to be able to do exclusions, in which case an "on" is required and
therefore we run into ambiguous column names:
Monty answered:
MySQL has an optimization where it knows that if x.b = y.b is used
then it can replace x.b with y.b and y.b with x.b in the WHERE
part
MySQL however doesn't do it for the ORDER BY part and I don't think
that should be very hard to do.
Question continues:
create table t2 (c int, b int, unique key 'by_c_b' (c, b)));
select * from t1 x inner join t1 y using (b) left join t2 on (t2.c =
3 and t1.b = t2.b) where x.a=1 and y.a=2 and t2.c is null order by (x|
y).b desc limit 10;
if we were ordering ascending, i think we could just leave off the
order by entirely in this case and it would happen to work since it's
reading in index order. but the combination of requiring an "on" and
descending sort leaves us unable to use these tricks. if we had
either an "ORDER BY FIRST_JOIN.column" or some way to tell the server
that 'b' is in fact joined as being equivalent across tables (except
where it may be null from left joining) and that we shouldn't have to
specify the table name at all, that would save us having to figure out
the table from the explain.
Monty answers:
It may be that the eq-replacment we have would solve this.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Provide an " ORDER BY FIRST_JOIN.column" feature (59)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Provide an "ORDER BY FIRST_JOIN.column" feature
CREATION DATE..: Thu, 22 Oct 2009, 12:33
SUPERVISOR.....: Bothorsen
IMPLEMENTOR....:
COPIES TO......:
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 59 (http://askmonty.org/worklog/?tid=59)
VERSION........: WorkLog-3.4
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 5
ESTIMATE.......: 20 (hours remain)
ORIG. ESTIMATE.: 20
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:21)=-=-
Added the estimation time.
Worked 5 hours and estimate 20 hours remain (original estimate increased by 25 hours).
DESCRIPTION:
Question:
How much effort would be required to provide an "ORDER BY
FIRST_JOIN.column" feature? We often do self-join queries and want to
order them by index, i.e.:
create table t1 (a int, b int, unique key 'by_a_b' (a, b)));
select * from t1 x inner join t1 y on (x.b = y.b) where x.a=1 and
y.a=2 order by (x|y).b desc limit 10;
but it is only ordered by index if you order by the first table in the
optimized join order, which could be either x or y depending on which
is more selective. we don't want to force the join order because
often one is far more selective than the other, but the only way to
know what table to order by then is to explain the query first. if
there was some way to tell mysql to just order by the first join in
the optimized order, that would help us. sometimes we do this across
tables too. both of these can be solved by rewriting the query to say
"using" instead of "on" in which case we don't have to specify the
table name of the column, just "order by b desc". but, we also want
to be able to do exclusions, in which case an "on" is required and
therefore we run into ambiguous column names:
Monty answered:
MySQL has an optimization where it knows that if x.b = y.b is used
then it can replace x.b with y.b and y.b with x.b in the WHERE
part
MySQL however doesn't do it for the ORDER BY part and I don't think
that should be very hard to do.
Question continues:
create table t2 (c int, b int, unique key 'by_c_b' (c, b)));
select * from t1 x inner join t1 y using (b) left join t2 on (t2.c =
3 and t1.b = t2.b) where x.a=1 and y.a=2 and t2.c is null order by (x|
y).b desc limit 10;
if we were ordering ascending, i think we could just leave off the
order by entirely in this case and it would happen to work since it's
reading in index order. but the combination of requiring an "on" and
descending sort leaves us unable to use these tricks. if we had
either an "ORDER BY FIRST_JOIN.column" or some way to tell the server
that 'b' is in fact joined as being equivalent across tables (except
where it may be null from left joining) and that we shouldn't have to
specify the table name at all, that would save us having to figure out
the table from the explain.
Monty answers:
It may be that the eq-replacment we have would solve this.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 15
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
------------------------------------------------------------
-=-=(View All Progress Notes, 11 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 15
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
------------------------------------------------------------
-=-=(View All Progress Notes, 11 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0

[Maria-developers] Progress (by Bothorsen): Store in binlog text of statements that caused RBR events (47)
by worklog-noreply@askmonty.org 18 Dec '09
by worklog-noreply@askmonty.org 18 Dec '09
18 Dec '09
-----------------------------------------------------------------------
WORKLOG TASK
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TASK...........: Store in binlog text of statements that caused RBR events
CREATION DATE..: Sat, 15 Aug 2009, 23:48
SUPERVISOR.....: Monty
IMPLEMENTOR....:
COPIES TO......: Knielsen
CATEGORY.......: Server-RawIdeaBin
TASK ID........: 47 (http://askmonty.org/worklog/?tid=47)
VERSION........: Server-9.x
STATUS.........: Un-Assigned
PRIORITY.......: 60
WORKED HOURS...: 15
ESTIMATE.......: 35 (hours remain)
ORIG. ESTIMATE.: 35
PROGRESS NOTES:
-=-=(Bothorsen - Fri, 18 Dec 2009, 16:16)=-=-
This is the work done on this patch so far. Most of it done by Alex.
Worked 15 hours and estimate 035 hours remain (original estimate increased by 50 hours).
-=-=(Alexi - Fri, 04 Dec 2009, 13:00)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.14001 2009-12-04 13:00:24.000000000 +0200
+++ /tmp/wklog.47.new.14001 2009-12-04 13:00:24.000000000 +0200
@@ -6,27 +6,27 @@
New server option
~~~~~~~~~~~~~~~~~
- --binlog-annotate-row-events
+ --binlog-annotate-rows-events
-Setting this option makes RBR (row-) events in the binary log to be
+Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
-'binlog_annotate_row_events' system variable is dynamic and has both
+'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
- SET SESSION binlog_annotate_row_events=ON;
+ SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
- SET SESSION binlog_annotate_row_events=OFF;
+ SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
-Describes the query which caused the corresponding row event. In binary log,
+Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
@@ -79,6 +79,15 @@
0000012F | 0F 00 00 00 | table_id = 15
...
+New mysqlbinlog option
+~~~~~~~~~~~~~~~~~~~~~~
+ --print-annotate-rows-events
+
+With this option, mysqlbinlog prints the content of Annotate-rows
+events (if the binary log does contain them). Without this option
+(i.e. by default), mysqlbinlog skips Annotate rows events.
+
+
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
@@ -109,5 +118,5 @@
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
- both log-slave-updates and binlog-annotate-row-events options set.
+ both log-slave-updates and binlog-annotate-rows-events options set.
-=-=(Alexi - Wed, 02 Dec 2009, 13:32)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.17456 2009-12-02 13:32:18.000000000 +0200
+++ /tmp/wklog.47.new.17456 2009-12-02 13:32:18.000000000 +0200
@@ -1,8 +1 @@
-mysql_binlog_send() [sql/sql_repl.cc]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-1. When sending events to a slave, master should simply skip
- Annotate_rows events (they are not needed for replication).
- [ ??? Multi-master - currently not clear ]
-2. When sending events to mysqlbinlog (remote case), master
- must send Annotate_rows events as well.
-=-=(Alexi - Wed, 02 Dec 2009, 13:31)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.17414 2009-12-02 11:31:59.000000000 +0000
+++ /tmp/wklog.47.new.17414 2009-12-02 11:31:59.000000000 +0000
@@ -104,3 +104,10 @@
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
+When master sends Annotate rows events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. Master always sends Annotate_rows events to mysqlbinlog (in
+ remote case).
+2. Master sends Annotate_rows events to a slave only if the slave has
+ both log-slave-updates and binlog-annotate-row-events options set.
+
-=-=(Knielsen - Mon, 30 Nov 2009, 11:21)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.18210 2009-11-30 11:21:33.000000000 +0200
+++ /tmp/wklog.47.new.18210 2009-11-30 11:21:33.000000000 +0200
@@ -28,7 +28,14 @@
Describes the query which caused the corresponding row event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
-text in its data part. Example:
+text in its data part.
+
+The numeric code for this event must be assigned carefully. It should be
+coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
+uses the same numeric code for one event that MariaDB uses for
+ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
+
+Example:
...
************************
-=-=(Alexi - Mon, 30 Nov 2009, 10:33)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.16188 2009-11-30 10:33:44.000000000 +0200
+++ /tmp/wklog.47.new.16188 2009-11-30 10:33:44.000000000 +0200
@@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. When sending events to a slave, master should simply skip
Annotate_rows events (they are not needed for replication).
+ [ ??? Multi-master - currently not clear ]
2. When sending events to mysqlbinlog (remote case), master
must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 13:00)=-=-
Low Level Design modified.
--- /tmp/wklog.47.old.32047 2009-11-29 13:00:21.000000000 +0200
+++ /tmp/wklog.47.new.32047 2009-11-29 13:00:21.000000000 +0200
@@ -1 +1,7 @@
+mysql_binlog_send() [sql/sql_repl.cc]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1. When sending events to a slave, master should simply skip
+ Annotate_rows events (they are not needed for replication).
+2. When sending events to mysqlbinlog (remote case), master
+ must send Annotate_rows events as well.
-=-=(Alexi - Sun, 29 Nov 2009, 09:50)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.24993 2009-11-29 07:50:36.000000000 +0000
+++ /tmp/wklog.47.new.24993 2009-11-29 07:50:36.000000000 +0000
@@ -4,3 +4,96 @@
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
+New server option
+~~~~~~~~~~~~~~~~~
+ --binlog-annotate-row-events
+
+Setting this option makes RBR (row-) events in the binary log to be
+preceded by Annotate rows events (see below). The corresponding
+'binlog_annotate_row_events' system variable is dynamic and has both
+global and session values. Default global value is OFF.
+
+Note. Session values are usefull to make it possible to annotate only
+ some selected statements:
+
+ ...
+ SET SESSION binlog_annotate_row_events=ON;
+ ... statements to be annotated ...
+ SET SESSION binlog_annotate_row_events=OFF;
+ ... statements not to be annotated ...
+
+New binlog event type
+~~~~~~~~~~~~~~~~~~~~~
+ Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
+
+Describes the query which caused the corresponding row event. In binary log,
+precedes each Table_map_log_event. Contains empty post-header and the query
+text in its data part. Example:
+
+ ...
+ ************************
+ ANNOTATE_ROWS_EVENT [51]
+ ************************
+ 000000C7 | 54 1B 12 4B | time_when = 1259477844
+ 000000CB | 33 | event_type = 51
+ 000000CC | 64 00 00 00 | server_id = 100
+ 000000D0 | 2C 00 00 00 | event_len = 44
+ 000000D4 | F3 00 00 00 | log_pos = 000000F3
+ 000000D8 | 00 00 | flags = <none>
+ ------------------------
+ 000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
+ 000000DE | 72 74 20 69 |
+ 000000E2 | 6E 74 6F 20 |
+ 000000E6 | 74 31 20 76 |
+ 000000EA | 61 6C 75 65 |
+ 000000EE | 73 20 28 31 |
+ 000000F2 | 29 |
+ ************************
+ TABLE_MAP_EVENT [19]
+ ************************
+ 000000F3 | 54 1B 12 4B | time_when = 1259477844
+ 000000F7 | 13 | event_type = 19
+ 000000F8 | 64 00 00 00 | server_id = 100
+ 000000FC | 29 00 00 00 | event_len = 41
+ 00000100 | 1C 01 00 00 | log_pos = 0000011C
+ 00000104 | 00 00 | flags = <none>
+ ------------------------
+ ...
+ ************************
+ WRITE_ROWS_EVENT [23]
+ ************************
+ 0000011C | 54 1B 12 4B | time_when = 1259477844
+ 00000120 | 17 | event_type = 23
+ 00000121 | 64 00 00 00 | server_id = 100
+ 00000125 | 22 00 00 00 | event_len = 34
+ 00000129 | 3E 01 00 00 | log_pos = 0000013E
+ 0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
+ ------------------------
+ 0000012F | 0F 00 00 00 | table_id = 15
+ ...
+
+mysqlbinlog output
+~~~~~~~~~~~~~~~~~~
+Something like this:
+
+ ...
+ # at 199
+ # at 243
+ # at 284
+ #091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
+(1)`
+ #091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
+to number 15
+ #091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
+flags: STMT_END_F
+
+ BINLOG '
+ VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
+ VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
+ VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
+ '/*!*/;
+ ### INSERT INTO test.t1
+ ### SET
+ ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
+ ...
+
-=-=(Knielsen - Fri, 27 Nov 2009, 13:30)=-=-
Observers changed: Knielsen
-=-=(Psergey - Sun, 16 Aug 2009, 11:08)=-=-
High-Level Specification modified.
--- /tmp/wklog.47.old.12485 2009-08-16 11:08:33.000000000 +0300
+++ /tmp/wklog.47.new.12485 2009-08-16 11:08:33.000000000 +0300
@@ -1 +1,6 @@
+First suggestion:
+
+> I think for this we would actually need a new binlog event type
+> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
+> containing only a comment (a bit of a hack).
------------------------------------------------------------
-=-=(View All Progress Notes, 11 total)=-=-
http://askmonty.org/worklog/index.pl?tid=47&nolimit=1
DESCRIPTION:
Store in binlog (and show in mysqlbinlog output) texts of statements that
caused RBR events
This is needed for (list from Monty):
- Easier to understand why updates happened
- Would make it easier to find out where in application things went
wrong (as you can search for exact strings)
- Allow one to filter things based on comments in the statement.
The cost of this can be that the binlog will be approximately 2x in size
(especially insert of big blob's would be a bit painful), so this should
be an optional feature.
HIGH-LEVEL SPECIFICATION:
First suggestion:
> I think for this we would actually need a new binlog event type
> (Comment_log_event?). Unless we want to log an empty statement Query_log_event
> containing only a comment (a bit of a hack).
New server option
~~~~~~~~~~~~~~~~~
--binlog-annotate-rows-events
Setting this option makes RBR (rows-) events in the binary log to be
preceded by Annotate rows events (see below). The corresponding
'binlog_annotate_rows_events' system variable is dynamic and has both
global and session values. Default global value is OFF.
Note. Session values are usefull to make it possible to annotate only
some selected statements:
...
SET SESSION binlog_annotate_rows_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_rows_events=OFF;
... statements not to be annotated ...
New binlog event type
~~~~~~~~~~~~~~~~~~~~~
Annotate_rows_log_event [ ANNOTATE_ROWS_EVENT ]
Describes the query which caused the corresponding rows event. In binary log,
precedes each Table_map_log_event. Contains empty post-header and the query
text in its data part.
The numeric code for this event must be assigned carefully. It should be
coordinated with MySQL/Sun, otherwise we can get into a situation where MySQL
uses the same numeric code for one event that MariaDB uses for
ANNOTATE_ROWS_EVENT, which would make merging the two impossible.
Example:
...
************************
ANNOTATE_ROWS_EVENT [51]
************************
000000C7 | 54 1B 12 4B | time_when = 1259477844
000000CB | 33 | event_type = 51
000000CC | 64 00 00 00 | server_id = 100
000000D0 | 2C 00 00 00 | event_len = 44
000000D4 | F3 00 00 00 | log_pos = 000000F3
000000D8 | 00 00 | flags = <none>
------------------------
000000DA | 69 6E 73 65 | query = "insert into t1 values (1)"
000000DE | 72 74 20 69 |
000000E2 | 6E 74 6F 20 |
000000E6 | 74 31 20 76 |
000000EA | 61 6C 75 65 |
000000EE | 73 20 28 31 |
000000F2 | 29 |
************************
TABLE_MAP_EVENT [19]
************************
000000F3 | 54 1B 12 4B | time_when = 1259477844
000000F7 | 13 | event_type = 19
000000F8 | 64 00 00 00 | server_id = 100
000000FC | 29 00 00 00 | event_len = 41
00000100 | 1C 01 00 00 | log_pos = 0000011C
00000104 | 00 00 | flags = <none>
------------------------
...
************************
WRITE_ROWS_EVENT [23]
************************
0000011C | 54 1B 12 4B | time_when = 1259477844
00000120 | 17 | event_type = 23
00000121 | 64 00 00 00 | server_id = 100
00000125 | 22 00 00 00 | event_len = 34
00000129 | 3E 01 00 00 | log_pos = 0000013E
0000012D | 10 00 | flags = LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F
------------------------
0000012F | 0F 00 00 00 | table_id = 15
...
New mysqlbinlog option
~~~~~~~~~~~~~~~~~~~~~~
--print-annotate-rows-events
With this option, mysqlbinlog prints the content of Annotate-rows
events (if the binary log does contain them). Without this option
(i.e. by default), mysqlbinlog skips Annotate rows events.
mysqlbinlog output
~~~~~~~~~~~~~~~~~~
Something like this:
...
# at 199
# at 243
# at 284
#091129 9:57:24 server id 100 end_log_pos 243 Query: `insert into t1 values
(1)`
#091129 9:57:24 server id 100 end_log_pos 284 Table_map: `test`.`t1` mapped
to number 15
#091129 9:57:24 server id 100 end_log_pos 318 Write_rows: table id 15
flags: STMT_END_F
BINLOG '
VBsSSzNkAAAALAAAAPMAAAAAAGluc2VydCBpbnRvIHQxIHZhbHVlcyAoMSk=
VBsSSxNkAAAAKQAAABwBAAAAAA8AAAAAAAAABHRlc3QAAnQxAAEDAAE=
VBsSSxdkAAAAIgAAAD4BAAAQAA8AAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
...
When master sends Annotate rows events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Master always sends Annotate_rows events to mysqlbinlog (in
remote case).
2. Master sends Annotate_rows events to a slave only if the slave has
both log-slave-updates and binlog-annotate-rows-events options set.
ESTIMATED WORK TIME
ESTIMATED COMPLETION DATE
-----------------------------------------------------------------------
WorkLog (v3.5.9)
1
0
Hakan Kuecuekyilmaz <hakan(a)askmonty.org> writes:
> I would like to put the scripts to a bzr repository. I guess launchpad
> is a good place. A separate repository makes sense to me, or maybe add
> them to the MariaDB sources?
Yes. I have for some time known we need a public repository with the tools we
use for MariaDB development. So now I have created a project for this on
Launchpad.
Branch to push to:
lp:mariadb-tools
Project page:
https://launchpad.net/mariadb-tools
Wiki page:
http://askmonty.org/wiki/index.php/Tools_for_MariaDB
Everybody, please help by moving things from our internal bzr repo
hasky:/usr/local/bzr into this project where relevant. And also please help by
updating the wiki page with appropriate documentation.
> I have a first working version of the wrapper scripts to automatically
> run sql-bench with a set of different configurations.
>From this description, it sounds like something that would make sense to
include in the MariaDB source tree? If so, I guess just commit them and get a
review.
Generally, it is an advantage to keep tools that work on a specific version of
MariaDB inside the source tree, especially for automation (like
Buildbot). Eg. if different variants of the scripts are needed for different
MariaDB versions (maybe using a feature that is not present in older
versions); keeping the scripts inside the tree trivially ensures that the
versions of scripts and of MariaDB matches. It also removes any issues wiht
making sure the scripts are available on a given host.
On the other hand, if the script needs to work with different versions of
MariaDB it probably makes sense to keep it outside of the main source
tree. Maybe the script needs to check out the MariaDB source tree (like
package scripts); it cannot easily checkout itself... Or maybe it needs to
compare two different versions of MariaDB against each other (benchmarks,
upgrade testing).
For some tools the correct approach would be that part is inside the source
tree and part outside.
- Kristian.
1
0

[Maria-developers] Rev 2738: DS-MRR backport: in file:///home/psergey/dev/maria-5.2-dsmrr/
by Sergey Petrunya 16 Dec '09
by Sergey Petrunya 16 Dec '09
16 Dec '09
At file:///home/psergey/dev/maria-5.2-dsmrr/
------------------------------------------------------------
revno: 2738
revision-id: psergey(a)askmonty.org-20091216092851-9ehou85ydmgziniy
parent: psergey(a)askmonty.org-20091215223739-f6xymmvanylqlrg9
committer: Sergey Petrunya <psergey(a)askmonty.org>
branch nick: maria-5.2-dsmrr
timestamp: Wed 2009-12-16 12:28:51 +0300
message:
DS-MRR backport:
- Fix PBXT test results (PBXT doesn't support MRR or ICP, but we get result
diffs because we've also backported a fix that
- prints out "Using where" when the table has part of WHERE that it has
got from LEFT JOIN's ON expression
- Does a better job at removing equalities that are guaranteed to be true
by use of ref acccess.
=== modified file 'mysql-test/suite/pbxt/r/join_outer.result'
--- a/mysql-test/suite/pbxt/r/join_outer.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/join_outer.result 2009-12-16 09:28:51 +0000
@@ -630,7 +630,7 @@
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
-1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using index
+1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
@@ -688,8 +688,8 @@
explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
drop table t1, t2, t3;
create table t1 (
a int(11),
@@ -859,14 +859,14 @@
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
a1 a2 a3
1 NULL NULL
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
a0 a1 a2 a3
@@ -875,7 +875,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 index PRIMARY PRIMARY 4 NULL 1 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a0 1 Using index
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
INSERT INTO t0 VALUES (0);
INSERT INTO t1 VALUES (0);
=== modified file 'mysql-test/suite/pbxt/r/order_by.result'
--- a/mysql-test/suite/pbxt/r/order_by.result 2009-04-02 10:03:14 +0000
+++ b/mysql-test/suite/pbxt/r/order_by.result 2009-12-16 09:28:51 +0000
@@ -514,7 +514,7 @@
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
@@ -638,7 +638,7 @@
insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
explain select * from t1 where b=1 or b is null order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null b b 5 const 2 Using where; Using filesort
+1 SIMPLE t1 ref_or_null b b 5 const 2 Using filesort
select * from t1 where b=1 or b is null order by a;
a b
1 1
@@ -647,7 +647,7 @@
4 NULL
explain select * from t1 where b=2 or b is null order by a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref_or_null b b 5 const 2 Using where; Using filesort
+1 SIMPLE t1 ref_or_null b b 5 const 2 Using filesort
select * from t1 where b=2 or b is null order by a;
a b
3 NULL
@@ -897,7 +897,7 @@
ORDER BY c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
-1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where
SELECT t2.b as c FROM
t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
ORDER BY c;
=== modified file 'mysql-test/suite/pbxt/r/partition_pruning.result'
--- a/mysql-test/suite/pbxt/r/partition_pruning.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/partition_pruning.result 2009-12-16 09:28:51 +0000
@@ -533,15 +533,15 @@
test.t2 analyze status OK
explain partitions select * from t2 where b = 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5 Using where
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5
explain extended select * from t2 where b = 6;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t2 ref b b 5 const 5 100.00 Using where
+1 SIMPLE t2 ref b b 5 const 5 100.00
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = 6)
explain partitions select * from t2 where b = 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5 Using where
+1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 5
explain extended select * from t2 where b in (1,3,5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range b b 5 NULL 15 100.00 Using where
=== modified file 'mysql-test/suite/pbxt/r/ps_1general.result'
--- a/mysql-test/suite/pbxt/r/ps_1general.result 2009-08-31 11:07:44 +0000
+++ b/mysql-test/suite/pbxt/r/ps_1general.result 2009-12-16 09:28:51 +0000
@@ -465,9 +465,9 @@
def key_len 253 4096 1 Y 0 31 8
def ref 253 2048 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
-def Extra 253 255 27 N 1 31 8
+def Extra 253 255 48 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using MRR; Using filesort
drop table if exists t2;
create table t2 (id smallint, name varchar(20)) ;
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
=== modified file 'mysql-test/suite/pbxt/r/range.result'
--- a/mysql-test/suite/pbxt/r/range.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/range.result 2009-12-16 09:28:51 +0000
@@ -221,31 +221,31 @@
update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref y y 5 const 1 Using where
+1 SIMPLE t1 ref y y 5 const 1
1 SIMPLE t2 range x x 5 NULL 1 Using where; Using join buffer
explain select count(*) from t1 where x in (1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref x x 5 const 1 Using where; Using index
+1 SIMPLE t1 ref x x 5 const 1 Using index
explain select count(*) from t1 where x in (1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index
@@ -277,7 +277,7 @@
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a,b a 5 NULL 2 Using where
+1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where; Using MRR
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
a b
DROP TABLE t1;
@@ -920,7 +920,7 @@
('A2','2005-12-01 08:00:00',1000);
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
+1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
Warnings:
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
=== modified file 'mysql-test/suite/pbxt/r/select.result'
--- a/mysql-test/suite/pbxt/r/select.result 2009-10-07 16:56:11 +0000
+++ b/mysql-test/suite/pbxt/r/select.result 2009-12-16 09:28:51 +0000
@@ -1397,15 +1397,15 @@
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
@@ -1421,15 +1421,15 @@
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
@@ -2368,16 +2368,16 @@
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref c,d d 5 const 1 Using where
-1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
+1 SIMPLE t2 ref c,d d 5 const 1
+1 SIMPLE t1 ref a a 5 test.t2.c 1
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
4 2 4 4
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref c,d d 5 const 1 Using where
-1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
+1 SIMPLE t2 ref c,d d 5 const 1
+1 SIMPLE t1 ref a a 5 test.t2.c 1
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
@@ -2403,11 +2403,11 @@
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 1
+1 SIMPLE t2 ref a a 23 test.t1.a 1 Using where
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
-1 SIMPLE t2 ref a a 23 test.t1.a 1
+1 SIMPLE t2 ref a a 23 test.t1.a 1 Using where
DROP TABLE t1, t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
@@ -2722,7 +2722,7 @@
where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
t2.b like '%%' order by t2.b limit 0,1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort
+1 SIMPLE t1 ref b,c b 5 const 1 Using temporary; Using filesort
1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1)
DROP TABLE t1,t2,t3;
@@ -3468,12 +3468,12 @@
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 1 Using where
-1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 1
EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b PRIMARY 4 NULL 1 Using where
-1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 1
DROP TABLE t1, t2;
create table t1 (
a int unsigned not null auto_increment primary key,
@@ -3533,7 +3533,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 const idx1 NULL NULL NULL 1
-1 SIMPLE t3 ref idx1 idx1 5 const 1 Using where
+1 SIMPLE t3 ref idx1 idx1 5 const 1
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
WHERE t1.id=2;
id a b c d e
=== modified file 'mysql-test/suite/pbxt/r/select_safe.result'
--- a/mysql-test/suite/pbxt/r/select_safe.result 2009-08-17 15:57:58 +0000
+++ b/mysql-test/suite/pbxt/r/select_safe.result 2009-12-16 09:28:51 +0000
@@ -70,12 +70,12 @@
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
-1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
+1 SIMPLE t2 ref b b 21 test.t1.b 1
set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
-1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
+1 SIMPLE t2 ref b b 21 test.t1.b 1
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
create table t1 (a int);
=== modified file 'mysql-test/suite/pbxt/r/subselect.result'
--- a/mysql-test/suite/pbxt/r/subselect.result 2009-10-16 12:45:42 +0000
+++ b/mysql-test/suite/pbxt/r/subselect.result 2009-12-16 09:28:51 +0000
@@ -719,7 +719,7 @@
1
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 2 was reduced during optimization
Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
@@ -731,7 +731,7 @@
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
@@ -903,7 +903,7 @@
explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
-2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
@@ -1333,9 +1333,9 @@
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a)))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1353,8 +1353,8 @@
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using index
+2 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
insert into t1 values (3,31);
=== modified file 'mysql-test/suite/pbxt/r/union.result'
--- a/mysql-test/suite/pbxt/r/union.result 2009-10-07 16:56:11 +0000
+++ b/mysql-test/suite/pbxt/r/union.result 2009-12-16 09:28:51 +0000
@@ -505,7 +505,7 @@
explain (select * from t1 where a=1) union (select * from t1 where b=1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1
-2 UNION t1 ref b b 5 const 1 Using where
+2 UNION t1 ref b b 5 const 1
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
drop table t1,t2;
create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
1
0