Created by George Ormond Lorch III and last modified
Get this branch:
bzr branch lp:~gl-az/percona-server/ST-41544-5.6
Only George Ormond Lorch III can upload to this branch. If you are George Ormond Lorch III please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Recent revisions

688. By George Ormond Lorch III

bug 1313901 : When a session creates a temporary table and that table is used
within queries, the binlog format of the session is unconditionally switched to
ROW for the remainder of the session or until all temporary tables have been

This is a result of an old fix for upstream 20499.

The consequence this has on the slave is that, the slave is single threaded and
executes all queries from a single session. If the slave is also binlogging, the
slave will unconditionally binlog every statement it receives in ROW format
until all temp tables are dropped. This means statements get logged in different
format on the master and the slave and can introduce huge slave lag.

Through discussion with our varous experts, we decided to undo the original
20499 fix and change the fundamental way MIXED replication works with regard to
temp tables. The new MIXED replication behavior can be summed up as follows:

If using MIXED mode replication, all DDL and DML statements that touch a
temporary table will be marked to binlog in ROW format. This means that any
statement that is using exclusively temporary tables will not be binlogged at
all. Any DDL or DML that uses a mix of temporary and non-temporary tables will
be binlogged in ROW format for the non-temporary table operations. The one
exception is DROP table when dropping a temporary table which will always be
binlogged as DROP TEMPORARY TABLE IF EXISTS on the master.

The code changes to make this happen are very minor but have a huge impact.
Many test cases in the rpl and binlog suite need to be changes and some
eliminated entirely as they test for functionality that no longer exists.

During the testing of this feature, each and every mtr test failure was closely
scruitinized to ensure that the failure was a legitimate and expected change
in behavior. This caused a lot of back-and-forth debugging and fixing to ensure
that the resulting server behavior and mtr test cases were 100% as described in
the new behavior above.

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
This branch contains Public information 
Everyone can see this information.