IDEA ==== Use single bits of the Common-Header of Log_Event to encode start and end of transactions and statements. RATIONALE ========= 1. To save space in binary log (don't need an entire event for begin/commit) 2. Easier to solve bugs such as BUG#26395 and BUG#29288. 3. We need a uniform way to determine statement/transaction start/end without having to parse the entire event. This paves the way for things like WL#3735 and WL#2540, makes debugging easier, and forces us to use a consistent model for the transactional behavior.
We want each of these event categories to be clearly expressed in
the binary log:
1. Transaction start
2. Statement start (this includes any event that is used
as "seed" for coming events)
3. Inside statement
4. Statement end
5. Transaction commit/autocommitted statement
6. Transaction rollback
Probably need 2 start bits:
01. No_start
10. Statement_start
11. Transaction_start
Probably need 2 end bits:
00. No_end
01. Transaction_commit (or autocommit)
10. Rollback
11. Statement_end
Note that a replication slave can detect that the events come from
an old master by reading the start bits: if they are 00, it must be
an old master.
Transaction_start means that the current event is the first event in
a transaction (hence, also the first in a statement).
Transaction_commit and Rollback mean that the current statement is
the last in a transaction (hence also the last in a statement).
For transactions involving XA tables, the last event describing a
statement (usually Query_log_event or row event) has only the
Statement_end flag set, and the Transaction_commit flag
is written for the following XID event.
