From: Sven Sandberg Date: October 18 2010 10:10am Subject: Re: bzr commit into mysql-next-mr-bugfixing branch (Li-Bing.Song:3324) Bug#55478 List-Archive: http://lists.mysql.com/commits/120940 Message-Id: <4CBC1D33.7050509@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Libing, Nice work. Patch approved! /Sven On 10/18/2010 08:49 AM, Libing Song wrote: > Hi Sven, > A new patch was committed, please review it. > http://lists.mysql.com/commits/120927 > > On Fri, 2010-10-15 at 13:13 +0200, Sven Sandberg wrote: >> Hi Libing, >> >> The patch looks ok from my viewpoint. I would suggest to clarify the >> changeset comment: instead of "But there are some cases...", please say >> that row events can be generated for the base table if the temporary >> table exists and user executes CREATE TABLE...SELECT that creates the >> base table. > ok. There are two cases which cause this bug. Both of them were added > into the comment. >> >> Also, I think maybe it would be good to find a reviewer from runtime >> team on this one. I'll send a separate email and ask Kostja to find one >> and replace me. >> >> /Sven >> >> >> On 10/15/2010 10:20 AM, Li-Bing.Song@stripped wrote: >>> #At file:///home/anders/work/bzrwork1/wt2/mysql-next-mr-bugfixing/ based on revid:dao-gang.qu@stripped >>> >>> 3324 Li-Bing.Song@stripped 2010-10-15 >>> Bug#55478 Row events wrongly apply on the temporary table of the same name >>> >>> Rows events were applied wrongly on the temporary table with the same name. >>> But rows events are generated only for base tables. As temporary >>> table's data never be binlogged on row mode. Normally, base table of the >>> same name cannot be updated if a temporary table has the same name. >>> But there are some cases which can generate rows events on >>> the base table of same name. >>> >>> After this patch, slave opens only base table when applying a rows event. >>> >>> modified: >>> mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result >>> mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test >>> sql/log_event.cc >>> === modified file 'mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result' >>> --- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result 2010-08-20 02:59:58 +0000 >>> +++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result 2010-10-15 08:20:12 +0000 >>> @@ -71,3 +71,30 @@ slave-bin.000001 # Query # # BEGIN >>> slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) >>> slave-bin.000001 # Query # # COMMIT >>> slave-bin.000001 # Query # # use `test`; DROP TABLE `t3`,`t1` /* generated by server */ >>> + >>> +# Bug#55478 Row events wrongly apply on the temporary table of the same name >>> +# ========================================================================== >>> +# The statement should be binlogged >>> +CREATE TEMPORARY TABLE t1(c1 INT); >>> +show binlog events in 'master-bin.000001' from; >>> +Log_name Pos Event_type Server_id End_log_pos Info >>> +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t1(c1 INT) >>> + >>> +# The statement generates row events on t1. And the rows events should >>> +# be inserted into the base table on slave. >>> +CREATE TABLE t1 SELECT rand(); >>> +show binlog events in 'master-bin.000001' from; >>> +Log_name Pos Event_type Server_id End_log_pos Info >>> +master-bin.000001 # Query # # BEGIN >>> +master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` ( >>> + `rand()` double NOT NULL DEFAULT '0' >>> +) >>> +master-bin.000001 # Table_map # # table_id: # (test.t1) >>> +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F >>> +master-bin.000001 # Query # # COMMIT >>> + >>> +DROP TEMPORARY TABLE t1; >>> +# Compare the base table. >>> +Comparing tables master:test.t1 and slave:test.t1 >>> + >>> +DROP TABLE t1; >>> >>> === modified file 'mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test' >>> --- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test 2009-07-26 21:48:24 +0000 >>> +++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test 2010-10-15 08:20:12 +0000 >>> @@ -146,3 +146,37 @@ DROP TABLE t3, t1; >>> -- sync_slave_with_master >>> >>> -- source include/show_binlog_events.inc >>> + >>> +--echo >>> +--echo # Bug#55478 Row events wrongly apply on the temporary table of the same name >>> +--echo # ========================================================================== >>> +connection master; >>> + >>> +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); >>> +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); >>> + >>> +--echo # The statement should be binlogged >>> +CREATE TEMPORARY TABLE t1(c1 INT); >>> + >>> +source include/show_binlog_events.inc; >>> +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); >>> +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); >>> + >>> +--echo >>> +--echo # The statement generates row events on t1. And the rows events should >>> +--echo # be inserted into the base table on slave. >>> +CREATE TABLE t1 SELECT rand(); >>> + >>> +source include/show_binlog_events.inc; >>> + >>> +--echo >>> +DROP TEMPORARY TABLE t1; >>> + >>> +--echo # Compare the base table. >>> +let diff_table= test.t1; >>> +source include/rpl_diff_tables.inc; >>> + >>> +--echo >>> +connection master; >>> +DROP TABLE t1; >>> +source include/master-slave-end.inc; >>> >>> === modified file 'sql/log_event.cc' >>> --- a/sql/log_event.cc 2010-09-24 15:24:54 +0000 >>> +++ b/sql/log_event.cc 2010-10-15 08:20:12 +0000 >>> @@ -8439,6 +8439,7 @@ int Table_map_log_event::do_apply_event( >>> m_field_metadata, m_field_metadata_size, >>> m_null_bits, m_flags); >>> table_list->m_tabledef_valid= TRUE; >>> + table_list->open_type= OT_BASE_ONLY; >>> >>> /* >>> We record in the slave's information that the table should be >>> >>> >>> >>> >>> >> >> >