-
Sujatha Sivakumar authored
WITH REPLICATE-REWRITE-DB FAILS Problem: ======= As part of fix for BUG#16290902, at the time of writing the 'DROP TEMPORARY TABLE IF EXISTS' query into the binlog, the query will not be preceded by a 'use `db`' statement. The query will have a fully qualified table name. Eg: 'USE `db`; DROP TEMPORARY TABLE IF EXISTS `t1`;' will be logged as 'DROP TEMPORARY TABLE IF EXISTS `db`.`t1`;'. Because of this change application of 'replicate-rewrite-db' filter rule will fail on slave, as it works only on default database specified in 'use' statement. This causes slave to break when the 'CREATE TEMPORARY TABLE' is re-executed on slave. Analysis: ======== The intention of BUG#16290902 fix was to address a specific scenario where the default database does not exist on the slave but in spite of that DROP TEMPORARY TABLE IF EXITS query will be binlogged with 'USE default_db' statement. Which causes point in time recovery to fail when user uses Slave's binary log to re-apply. But the fix that was more generic. It completely removed 'USE default_db' for DROP TEMPORARY TABLE IF EXITS queries even when they have their default databases present. Hence the scope of the fix should have been narrowed. Fix: === At the time writing 'DROP TEMPORARY TABLE IF EXISTS' query into the binary log, check if the default database exists. If it exists then write 'USE default_db' in the binary log. If default database is not present then log the query with qualified table name.
Sujatha Sivakumar authoredWITH REPLICATE-REWRITE-DB FAILS Problem: ======= As part of fix for BUG#16290902, at the time of writing the 'DROP TEMPORARY TABLE IF EXISTS' query into the binlog, the query will not be preceded by a 'use `db`' statement. The query will have a fully qualified table name. Eg: 'USE `db`; DROP TEMPORARY TABLE IF EXISTS `t1`;' will be logged as 'DROP TEMPORARY TABLE IF EXISTS `db`.`t1`;'. Because of this change application of 'replicate-rewrite-db' filter rule will fail on slave, as it works only on default database specified in 'use' statement. This causes slave to break when the 'CREATE TEMPORARY TABLE' is re-executed on slave. Analysis: ======== The intention of BUG#16290902 fix was to address a specific scenario where the default database does not exist on the slave but in spite of that DROP TEMPORARY TABLE IF EXITS query will be binlogged with 'USE default_db' statement. Which causes point in time recovery to fail when user uses Slave's binary log to re-apply. But the fix that was more generic. It completely removed 'USE default_db' for DROP TEMPORARY TABLE IF EXITS queries even when they have their default databases present. Hence the scope of the fix should have been narrowed. Fix: === At the time writing 'DROP TEMPORARY TABLE IF EXISTS' query into the binary log, check if the default database exists. If it exists then write 'USE default_db' in the binary log. If default database is not present then log the query with qualified table name.
Loading