MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kgeorge Date:June 18 2007 10:51am
Subject:bk commit into 5.1 tree (gkodinov:1.2550) BUG#26418
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-18 13:51:04+03:00, gkodinov@stripped +14 -0
  Bug #26418: Slave out of sync after 
   CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
  
  To compensate for that fact that CREATE TEMPORARY 
  TABLE is processed outside the current client 
  transaction the replication master records the log for
  roll-backed transactions as well if they happen to
  contain CREATE/DROP TEMPORARY TABLE.
  This causes problems if there are DML statements 
  in the same transaction on tables that have 
  different engine types between the slave and the master.
  In such cases the storage engine on the slave may not
  be able to rollback the changes in the DML target tables.
  
  DROP TEMPORARY TABLE doesn't cause an implicit
  commit. It is also rolled back by a ROLLBACK statement.
  It is an ordinary statement in that respect.
  
  Fixed the bug by not sending to the replication slave 
  the transaction log of a rolled back transaction 
  (followed by a ROLLBACK) when there is DROP TEMPORARY 
  TABLE in the transction.
  
  Also replaced repeating code with a function call.
  Added a separate test case (to be merged later to the
  updated rpl_dll.test).

  mysql-test/r/rpl_innodb.result@stripped, 2007-06-18 13:51:01+03:00, gkodinov@stripped +62 -0
    Bug #26418: test case

  mysql-test/t/rpl_innodb.test@stripped, 2007-06-18 13:51:01+03:00, gkodinov@stripped +69 -0
    Bug #26418: test case

  sql/events.cc@stripped, 2007-06-18 13:51:01+03:00, gkodinov@stripped +3 -18
    Bug #26418: replace repeating code with a function call

  sql/sp.cc@stripped, 2007-06-18 13:51:01+03:00, gkodinov@stripped +2 -14
    Bug #26418: replace repeating code with a function call

  sql/sql_acl.cc@stripped, 2007-06-18 13:51:01+03:00, gkodinov@stripped +7 -38
    Bug #26418: replace repeating code with a function call

  sql/sql_class.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +0 -9
    Bug #26418: remove dead code

  sql/sql_class.h@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +0 -1
    Bug #26418: remove dead code

  sql/sql_delete.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +5 -10
    Bug #26418: replace repeating code with a function call

  sql/sql_parse.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +4 -26
    Bug #26418: 
     - replace repeating code with a function call
     - DROP TEMPORARY TABLE is completely rollbackable,
       so don't force sending the transaction to the 
       slave with a ROLLBACK.

  sql/sql_rename.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +1 -6
    Bug #26418: replace repeating code with a function call

  sql/sql_tablespace.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +1 -5
    Bug #26418: replace repeating code with a function call

  sql/sql_trigger.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +1 -8
    Bug #26418: replace repeating code with a function call

  sql/sql_udf.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +2 -12
    Bug #26418: replace repeating code with a function call

  sql/sql_view.cc@stripped, 2007-06-18 13:51:02+03:00, gkodinov@stripped +1 -6
    Bug #26418: replace repeating code with a function call

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/work/B26418-5.1-opt

--- 1.236/sql/sql_acl.cc	2007-06-01 10:43:53 +03:00
+++ 1.237/sql/sql_acl.cc	2007-06-18 13:51:01 +03:00
@@ -3142,12 +3142,7 @@ bool mysql_table_grant(THD *thd, TABLE_L
 
   if (!result) /* success */
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
   }
 
   rw_unlock(&LOCK_grant);
@@ -3314,12 +3309,7 @@ bool mysql_routine_grant(THD *thd, TABLE
   pthread_mutex_unlock(&acl_cache->lock);
   if (!result && !no_error)
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
   }
 
   rw_unlock(&LOCK_grant);
@@ -3434,12 +3424,7 @@ bool mysql_grant(THD *thd, const char *d
 
   if (!result)
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
   }
 
   rw_unlock(&LOCK_grant);
@@ -5468,11 +5453,7 @@ bool mysql_create_user(THD *thd, List <L
 
   VOID(pthread_mutex_unlock(&acl_cache->lock));
 
-  if (mysql_bin_log.is_open())
-  {
-    thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, FALSE, thd->query, thd->query_length);
 
   rw_unlock(&LOCK_grant);
   close_thread_tables(thd);
@@ -5538,11 +5519,7 @@ bool mysql_drop_user(THD *thd, List <LEX
 
   VOID(pthread_mutex_unlock(&acl_cache->lock));
 
-  if (mysql_bin_log.is_open())
-  {
-    thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, FALSE, thd->query, thd->query_length);
 
   rw_unlock(&LOCK_grant);
   close_thread_tables(thd);
@@ -5621,11 +5598,7 @@ bool mysql_rename_user(THD *thd, List <L
 
   VOID(pthread_mutex_unlock(&acl_cache->lock));
 
-  if (mysql_bin_log.is_open())
-  {
-    thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, FALSE, thd->query, thd->query_length);
 
   rw_unlock(&LOCK_grant);
   close_thread_tables(thd);
@@ -5809,11 +5782,7 @@ bool mysql_revoke_all(THD *thd,  List <L
 
   VOID(pthread_mutex_unlock(&acl_cache->lock));
 
-  if (mysql_bin_log.is_open())
-  {
-    thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, FALSE, thd->query, thd->query_length);
 
   rw_unlock(&LOCK_grant);
   close_thread_tables(thd);

--- 1.337/sql/sql_class.cc	2007-06-01 10:43:53 +03:00
+++ 1.338/sql/sql_class.cc	2007-06-18 13:51:02 +03:00
@@ -3028,15 +3028,6 @@ int THD::binlog_flush_pending_rows_event
 }
 
 
-void THD::binlog_delete_pending_rows_event()
-{
-  if (Rows_log_event *pending= binlog_get_pending_rows_event())
-  {
-    delete pending;
-    binlog_set_pending_rows_event(0);
-  }
-}
-
 /*
   Member function that will log query, either row-based or
   statement-based depending on the value of the 'current_stmt_binlog_row_based'

--- 1.368/sql/sql_class.h	2007-06-12 16:10:59 +03:00
+++ 1.369/sql/sql_class.h	2007-06-18 13:51:02 +03:00
@@ -1096,7 +1096,6 @@ public:
   Rows_log_event* binlog_get_pending_rows_event() const;
   void            binlog_set_pending_rows_event(Rows_log_event* ev);
   int binlog_flush_pending_rows_event(bool stmt_end);
-  void binlog_delete_pending_rows_event();
 
 private:
   uint binlog_table_maps; // Number of table maps currently in the binlog

--- 1.221/sql/sql_delete.cc	2007-05-24 01:39:22 +03:00
+++ 1.222/sql/sql_delete.cc	2007-06-18 13:51:02 +03:00
@@ -975,16 +975,11 @@ end:
   {
     if (!error)
     {
-      if (mysql_bin_log.is_open())
-      {
-        /*
-          TRUNCATE must always be statement-based binlogged (not row-based) so
-          we don't test current_stmt_binlog_row_based.
-        */
-        thd->clear_error();
-        thd->binlog_query(THD::STMT_QUERY_TYPE,
-                          thd->query, thd->query_length, FALSE, FALSE);
-      }
+      /*
+        TRUNCATE must always be statement-based binlogged (not row-based) so
+        we don't test current_stmt_binlog_row_based.
+      */
+      write_bin_log(thd, TRUE, thd->query, thd->query_length);
       send_ok(thd);		// This should return record count
     }
     VOID(pthread_mutex_lock(&LOCK_open));

--- 1.679/sql/sql_parse.cc	2007-06-14 14:43:24 +03:00
+++ 1.680/sql/sql_parse.cc	2007-06-18 13:51:02 +03:00
@@ -2504,12 +2504,7 @@ end_with_restore_list:
       /*
         Presumably, REPAIR and binlog writing doesn't require synchronization
       */
-      if (mysql_bin_log.is_open())
-      {
-	thd->clear_error(); // No binlog error generated
-        thd->binlog_query(THD::STMT_QUERY_TYPE,
-                          thd->query, thd->query_length, 0, FALSE);
-      }
+      write_bin_log(thd, TRUE, thd->query, thd->query_length);
     }
     select_lex->table_list.first= (uchar*) first_table;
     lex->query_tables=all_tables;
@@ -2539,12 +2534,7 @@ end_with_restore_list:
       /*
         Presumably, ANALYZE and binlog writing doesn't require synchronization
       */
-      if (mysql_bin_log.is_open())
-      {
-	thd->clear_error(); // No binlog error generated
-        thd->binlog_query(THD::STMT_QUERY_TYPE,
-                          thd->query, thd->query_length, 0, FALSE);
-      }
+      write_bin_log(thd, TRUE, thd->query, thd->query_length);
     }
     select_lex->table_list.first= (uchar*) first_table;
     lex->query_tables=all_tables;
@@ -2566,12 +2556,7 @@ end_with_restore_list:
       /*
         Presumably, OPTIMIZE and binlog writing doesn't require synchronization
       */
-      if (mysql_bin_log.is_open())
-      {
-	thd->clear_error(); // No binlog error generated
-        thd->binlog_query(THD::STMT_QUERY_TYPE,
-                          thd->query, thd->query_length, 0, FALSE);
-      }
+      write_bin_log(thd, TRUE, thd->query, thd->query_length);
     }
     select_lex->table_list.first= (uchar*) first_table;
     lex->query_tables=all_tables;
@@ -2902,9 +2887,6 @@ end_with_restore_list:
       */
       if (thd->slave_thread)
         lex->drop_if_exists= 1;
-
-      /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
-      thd->options|= OPTION_KEEP_LOG;
     }
     /* DDL and binlog write order protected by LOCK_open */
     res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
@@ -3471,11 +3453,7 @@ end_with_restore_list:
       */
       if (!lex->no_write_to_binlog && write_to_binlog)
       {
-        if (mysql_bin_log.is_open())
-        {
-          thd->binlog_query(THD::STMT_QUERY_TYPE,
-                            thd->query, thd->query_length, 0, FALSE);
-        }
+        write_bin_log(thd, FALSE, thd->query, thd->query_length);
       }
       send_ok(thd);
     } 

--- 1.77/sql/sql_udf.cc	2007-05-24 14:11:20 +03:00
+++ 1.78/sql/sql_udf.cc	2007-06-18 13:51:02 +03:00
@@ -493,12 +493,7 @@ int mysql_create_function(THD *thd,udf_f
   rw_unlock(&THR_LOCK_udf);
 
   /* Binlog the create function. */
-  if (mysql_bin_log.is_open())
-  {
-    thd->clear_error();
-    thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, TRUE, thd->query, thd->query_length);
 
   DBUG_RETURN(0);
 
@@ -569,12 +564,7 @@ int mysql_drop_function(THD *thd,const L
   rw_unlock(&THR_LOCK_udf);
 
   /* Binlog the drop function. */
-  if (mysql_bin_log.is_open())
-  {
-    thd->clear_error();
-    thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, TRUE, thd->query, thd->query_length);
 
   DBUG_RETURN(0);
  err:

--- 1.79/sql/events.cc	2007-04-15 01:31:37 +03:00
+++ 1.80/sql/events.cc	2007-06-18 13:51:01 +03:00
@@ -425,12 +425,7 @@ Events::create_event(THD *thd, Event_par
         event_queue->create_event(thd, new_element, &created);
       /* Binlog the create event. */
       DBUG_ASSERT(thd->query && thd->query_length);
-      if (mysql_bin_log.is_open())
-      {
-        thd->clear_error();
-        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                          thd->query, thd->query_length, FALSE, FALSE);
-      }
+      write_bin_log(thd, TRUE, thd->query, thd->query_length);
     }
   }
   pthread_mutex_unlock(&LOCK_event_metadata);
@@ -551,12 +546,7 @@ Events::update_event(THD *thd, Event_par
                                   new_element);
       /* Binlog the alter event. */
       DBUG_ASSERT(thd->query && thd->query_length);
-      if (mysql_bin_log.is_open())
-      {
-        thd->clear_error();
-        thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                          thd->query, thd->query_length, FALSE, FALSE);
-      }
+      write_bin_log(thd, TRUE, thd->query, thd->query_length);
     }
   }
   pthread_mutex_unlock(&LOCK_event_metadata);
@@ -631,12 +621,7 @@ Events::drop_event(THD *thd, LEX_STRING 
       event_queue->drop_event(thd, dbname, name);
     /* Binlog the drop event. */
     DBUG_ASSERT(thd->query && thd->query_length);
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
   }
   pthread_mutex_unlock(&LOCK_event_metadata);
   DBUG_RETURN(ret);

--- 1.138/sql/sql_view.cc	2007-06-04 13:16:13 +03:00
+++ 1.139/sql/sql_view.cc	2007-06-18 13:51:02 +03:00
@@ -1467,12 +1467,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIS
     DBUG_RETURN(TRUE);
   }
 
-  if (mysql_bin_log.is_open())
-  {
-    thd->clear_error();
-    thd->binlog_query(THD::STMT_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, FALSE);
-  }
+  write_bin_log(thd, TRUE, thd->query, thd->query_length);
 
   send_ok(thd);
   VOID(pthread_mutex_unlock(&LOCK_open));

--- 1.94/sql/sql_trigger.cc	2007-05-24 01:39:25 +03:00
+++ 1.95/sql/sql_trigger.cc	2007-06-18 13:51:02 +03:00
@@ -306,14 +306,7 @@ end:
 
   if (!result)
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-
-      /* Such a statement can always go directly to binlog, no trans cache. */
-      thd->binlog_query(THD::STMT_QUERY_TYPE,
-                        stmt_query.ptr(), stmt_query.length(), FALSE, FALSE);
-    }
+    write_bin_log(thd, TRUE, stmt_query.ptr(), stmt_query.length());
   }
 
   VOID(pthread_mutex_unlock(&LOCK_open));

--- 1.10/sql/sql_tablespace.cc	2007-03-02 18:43:36 +02:00
+++ 1.11/sql/sql_tablespace.cc	2007-06-18 13:51:02 +03:00
@@ -66,10 +66,6 @@ int mysql_alter_tablespace(THD *thd, st_
                         ha_resolve_storage_engine_name(hton),
                         "TABLESPACE or LOGFILE GROUP");
   }
-  if (mysql_bin_log.is_open())
-  {
-    thd->binlog_query(THD::STMT_QUERY_TYPE,
-                      thd->query, thd->query_length, FALSE, TRUE);
-  }
+  write_bin_log(thd, FALSE, thd->query, thd->query_length);
   DBUG_RETURN(FALSE);
 }

--- 1.2/mysql-test/r/rpl_innodb.result	2006-01-24 09:30:46 +02:00
+++ 1.3/mysql-test/r/rpl_innodb.result	2007-06-18 13:51:01 +03:00
@@ -35,3 +35,65 @@ SELECT * FROM t4;
 id	name	number
 3	XXX	12345
 4	XXY	12345
+FLUSH LOGS;
+FLUSH LOGS;
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
+CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB";
+SET AUTOCOMMIT = 0;
+-------- switch to slave --------
+SHOW CREATE TABLE mysqltest1.t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `f1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+-------- switch to master --------
+INSERT INTO mysqltest1.t1 SET f1= 1;
+DROP TEMPORARY TABLE mysqltest1.tmp;
+ROLLBACK;
+SHOW CREATE TABLE mysqltest1.tmp;
+ERROR 42S02: Table 'mysqltest1.tmp' doesn't exist
+SELECT * FROM mysqltest1.t1;
+f1
+INSERT INTO mysqltest1.t1 SET f1= 2;
+CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
+ROLLBACK;
+SHOW CREATE TABLE mysqltest1.tmp2;
+Table	Create Table
+tmp2	CREATE TEMPORARY TABLE `tmp2` (
+  `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM mysqltest1.t1;
+f1
+-------- switch to slave --------
+SHOW CREATE TABLE mysqltest1.tmp;
+ERROR 42S02: Table 'mysqltest1.tmp' doesn't exist
+SHOW CREATE TABLE mysqltest1.tmp2;
+ERROR 42S02: Table 'mysqltest1.tmp2' doesn't exist
+SELECT * FROM mysqltest1.t1;
+f1
+2
+FLUSH LOGS;
+SHOW BINLOG EVENTS IN 'slave-bin.000002' LIMIT 1,6;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+slave-bin.000002	106	Query	1	209	DROP DATABASE IF EXISTS mysqltest1
+slave-bin.000002	209	Query	1	304	CREATE DATABASE mysqltest1
+slave-bin.000002	304	Query	1	416	use `test`; CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT)
+slave-bin.000002	416	Query	1	533	use `test`; CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB"
+slave-bin.000002	533	Query	1	631	use `test`; INSERT INTO mysqltest1.t1 SET f1= 2
+slave-bin.000002	631	Query	1	739	use `test`; CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT)
+-------- switch to master --------
+FLUSH LOGS;
+SHOW BINLOG EVENTS IN 'master-bin.000002' LIMIT 1,8;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000002	106	Query	1	209	DROP DATABASE IF EXISTS mysqltest1
+master-bin.000002	209	Query	1	304	CREATE DATABASE mysqltest1
+master-bin.000002	304	Query	1	416	use `test`; CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT)
+master-bin.000002	416	Query	1	533	use `test`; CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB"
+master-bin.000002	533	Query	1	601	use `test`; BEGIN
+master-bin.000002	601	Query	1	98	use `test`; INSERT INTO mysqltest1.t1 SET f1= 2
+master-bin.000002	699	Query	1	206	use `test`; CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT)
+master-bin.000002	807	Query	1	878	use `test`; ROLLBACK
+DROP DATABASE mysqltest1;
+End of 5.1 tests

--- 1.3/mysql-test/t/rpl_innodb.test	2006-01-24 09:30:48 +02:00
+++ 1.4/mysql-test/t/rpl_innodb.test	2007-06-18 13:51:01 +03:00
@@ -44,5 +44,74 @@ connection master;
 DROP TABLE t4;
 --enable_query_log
 sync_slave_with_master;
+connection master;
 
 # End of 4.1 tests
+
+#
+# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
+# on master
+#
+#Note Matthias: to be merged to rpl_ddl.test
+
+--source include/not_ndb_default.inc
+
+FLUSH LOGS;
+sync_slave_with_master;
+FLUSH LOGS;
+connection master;
+let $engine_type= "InnoDB";
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
+eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
+SET AUTOCOMMIT = 0;
+
+sync_slave_with_master;
+--echo -------- switch to slave --------
+connection slave;
+SHOW CREATE TABLE mysqltest1.t1;
+
+--echo -------- switch to master --------
+connection master;
+INSERT INTO mysqltest1.t1 SET f1= 1;
+DROP TEMPORARY TABLE mysqltest1.tmp;
+ROLLBACK;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp;
+# Must return no rows here
+SELECT * FROM mysqltest1.t1;
+
+INSERT INTO mysqltest1.t1 SET f1= 2;
+CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
+ROLLBACK;
+SHOW CREATE TABLE mysqltest1.tmp2;
+# Must return no rows here
+SELECT * FROM mysqltest1.t1;
+
+sync_slave_with_master;
+--echo -------- switch to slave --------
+connection slave;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp2;
+# has one row f1=2 here : as the default is MyISAM and
+# it can't be rolled back by the master's ROLLBACK.
+SELECT * FROM mysqltest1.t1;
+FLUSH LOGS;
+SHOW BINLOG EVENTS IN 'slave-bin.000002' LIMIT 1,6;
+
+--echo -------- switch to master --------
+connection master;
+FLUSH LOGS;
+SHOW BINLOG EVENTS IN 'master-bin.000002' LIMIT 1,8;
+
+DROP DATABASE mysqltest1;
+-- source include/master-slave-end.inc
+
+--echo End of 5.1 tests

--- 1.43/sql/sql_rename.cc	2006-12-31 02:06:36 +02:00
+++ 1.44/sql/sql_rename.cc	2007-06-18 13:51:02 +03:00
@@ -174,12 +174,7 @@ bool mysql_rename_tables(THD *thd, TABLE
   /* Lets hope this doesn't fail as the result will be messy */ 
   if (!silent && !error)
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::STMT_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
     send_ok(thd);
   }
 

--- 1.154/sql/sp.cc	2007-06-01 13:17:21 +03:00
+++ 1.155/sql/sp.cc	2007-06-18 13:51:01 +03:00
@@ -650,13 +650,7 @@ sp_drop_routine(THD *thd, int type, sp_n
 
   if (ret == SP_OK)
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
-
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
     sp_cache_invalidate();
   }
 
@@ -723,13 +717,7 @@ sp_update_routine(THD *thd, int type, sp
 
   if (ret == SP_OK)
   {
-    if (mysql_bin_log.is_open())
-    {
-      thd->clear_error();
-      thd->binlog_query(THD::MYSQL_QUERY_TYPE,
-                        thd->query, thd->query_length, FALSE, FALSE);
-    }
-
+    write_bin_log(thd, TRUE, thd->query, thd->query_length);
     sp_cache_invalidate();
   }
 
Thread
bk commit into 5.1 tree (gkodinov:1.2550) BUG#26418kgeorge18 Jun