Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b"

Bug #702303 reported by Kristian Nielsen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
In Progress
Low
Kristian Nielsen
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Low
Unassigned
5.5
Triaged
Low
Unassigned
5.6
New
Low
Unassigned
5.7
New
Low
Unassigned

Bug Description

This bug was introduced with the implementation of MWL#36.

Normally, mysqlbinlog suppresses output of `use` statements before statements
like BEGIN, COMMIT, SAVEPOINT, ROLLBACK, as they are not needed.

However, this suppression does not happen when the MWL#36 --rewrite-db option
affects the current database.

Test case:

    -- source include/have_binlog_format_statement.inc
    -- source include/have_log_bin.inc
    -- source include/have_innodb.inc
    let $MYSQLD_DATADIR= `select @@datadir`;
    create table t1 (a int primary key) engine=innodb;
    create database test2;
    RESET MASTER;
    use test2;
    begin;
    use test;
    insert into t1 values (1);
    use test2;
    commit;
    begin;
    use test;
    insert into t1 values (2);
    use test2;
    commit;
    use test;
    select * from t1 order by a;
    flush logs;
    --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form
    --exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form --rewrite-db="test->foo" --rewrite-db="test2->bar"
    drop database test2;
    drop table t1;

The expected output is that each mysqlbinlog run should output a single `use`
statement, just before the first INSERT. However, currently, the second run
outputs extra `use` statements around the begin/commit statements.

I will commit a fix for 5.2.

Changed in maria:
assignee: nobody → Kristian Nielsen (knielsen)
importance: Undecided → Low
milestone: none → 5.2
status: New → In Progress
Stewart Smith (stewart)
Changed in percona-server:
importance: Undecided → Low
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

rewrite-db has not been ported to PS 5.5 yet, marking it as triaged for 5.5.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1841

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.