List:Commits« Previous MessageNext Message »
From:Li-Bing.Song Date:September 21 2009 7:30am
Subject:bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3117) Bug#46572
View as plain text  
#At file:///home/anders/work/bzrwork/July/bug45574/mysql-5.1-bugteam/ based on revid:joro@stripped

 3117 Li-Bing.Song@stripped	2009-09-21
      BUG #46572 DROP temp-table IF EXISTS does not have a consistent behavior in ROW mode
      
      In RBR, 'DROP TEMPORARY TABLE IF EXISTS...' statement is binlogged when the table
      is not exists.
      
      In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged.
      This patch add an extra condition to fix the logic.

    added:
      mysql-test/suite/rpl/r/rpl_drop_temp_row.result
      mysql-test/suite/rpl/t/rpl_drop_temp_row.test
    modified:
      sql/sql_table.cc
=== added file 'mysql-test/suite/rpl/r/rpl_drop_temp_row.result'
--- a/mysql-test/suite/rpl/r/rpl_drop_temp_row.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_drop_temp_row.result	2009-09-21 07:30:43 +0000
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS tmp;
+DROP TABLE IF EXISTS tmp1;
+DROP TABLE IF EXISTS tmp2;
+DROP TABLE IF EXISTS tmp3;
+DROP TABLE IF EXISTS t;
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp1(c1 int);
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp2(c1 int);
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp3(c1 int);
+CREATE TABLE t(c1 int);
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
+DROP TABLE IF EXISTS tmp2, t;
+DROP TABLE IF EXISTS tmp2, t;
+DROP TEMPORARY TABLE tmp3;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tmp
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tmp1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tmp2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tmp3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t(c1 int)
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tmp2, t

=== added file 'mysql-test/suite/rpl/t/rpl_drop_temp_row.test'
--- a/mysql-test/suite/rpl/t/rpl_drop_temp_row.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp_row.test	2009-09-21 07:30:43 +0000
@@ -0,0 +1,32 @@
+#############################################################################
+# BUG#46572 DROP temp-table IF EXISTS does not have a consistent behavior in
+# ROW mode
+# 
+# In RBR, 'DROP TEMPORARY TABLE ...' statement is always not binlogged.
+#############################################################################
+source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
+disable_warnings;
+
+DROP TABLE IF EXISTS tmp;
+DROP TABLE IF EXISTS tmp1;
+DROP TABLE IF EXISTS tmp2;
+DROP TABLE IF EXISTS tmp3;
+DROP TABLE IF EXISTS t;
+
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp1(c1 int);
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp2(c1 int);
+CREATE TEMPORARY TABLE IF NOT EXISTS tmp3(c1 int);
+CREATE TABLE t(c1 int);
+
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp;
+DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
+DROP TABLE IF EXISTS tmp2, t;
+DROP TABLE IF EXISTS tmp2, t;
+DROP TEMPORARY TABLE tmp3;
+
+source include/show_binlog_events.inc;
+
+source include/master-slave-end.inc;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-09-18 13:01:18 +0000
+++ b/sql/sql_table.cc	2009-09-21 07:30:43 +0000
@@ -1949,7 +1949,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
       being built.  The string always end in a comma and the comma
       will be chopped off before being written to the binary log.
       */
-    if (thd->current_stmt_binlog_row_based && !dont_log_query)
+    if (!drop_temporary && thd->current_stmt_binlog_row_based && !dont_log_query)
     {
       non_temp_tables_count++;
       /*


Attachment: [text/bzr-bundle] bzr/li-bing.song@sun.com-20090921073043-a8r6o85lq4hukoa7.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3117) Bug#46572Li-Bing.Song21 Sep
  • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3117)Bug#46572Luís Soares21 Sep
    • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3117)Bug#46572Alfranio Correia21 Sep
      • Re: bzr commit into mysql-5.1-bugteam branch (Li-Bing.Song:3117)Bug#46572Luís Soares21 Sep