List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:December 9 2009 6:26am
Subject:bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3252) Bug#45520
View as plain text  
#At file:///media/sdb2/hezx/work/mysql/bzrwork/b45520/5.1-bugteam/ based on revid:luis.soares@stripped

 3252 He Zhenxing	2009-12-09 [merge]
      Merge Bug#45520 fix from 5.0-bugteam

    M  mysql-test/suite/rpl/r/rpl_killed_ddl.result
    M  mysql-test/suite/rpl/t/rpl_killed_ddl.test
    M  sql/sql_db.cc
    1810.3968.17 He Zhenxing	2009-12-09
                BUG#45520 rpl_killed_ddl fails sporadically in pb2
                
                There are three issues that caused rpl_killed_ddl fails sporadically
                in pb2:
                
                 1) thd->clear_error() was not called before create Query event
                if operation is executed successfully.
                 2) DATABASE d2 might do exist because the statement to CREATE or
                ALTER it was killed
                 3) because of bug 43353, kill the query that do DROP FUNCTION or
                    DROP PROCEDURE can result in SP not found
                
                This patch fixed all above issues by:
                 1) Called thd->clear_error() if the operation succeeded.
                 2) Add IF EXISTS to the DROP DATABASE d2 statement
                 3) Temporarily disabled testing DROP FUNCTION/PROCEDURE IF EXISTS.
         @ mysql-test/t/rpl_killed_ddl.test
            DATABASE d2 might not exists, add IF EXITS to the DROP statement
         @ sql/sql_db.cc
            Called thd->clear_error() if the operation succeeded

        M  mysql-test/r/rpl_killed_ddl.result
        M  mysql-test/t/rpl_killed_ddl.test
        M  sql/sql_db.cc
=== modified file 'mysql-test/suite/rpl/r/rpl_killed_ddl.result'
--- a/mysql-test/suite/rpl/r/rpl_killed_ddl.result	2009-04-08 23:42:51 +0000
+++ b/mysql-test/suite/rpl/r/rpl_killed_ddl.result	2009-12-09 06:24:54 +0000
@@ -63,7 +63,7 @@ source include/diff_master_slave.inc;
 DROP DATABASE d1;
 source include/kill_query.inc;
 source include/diff_master_slave.inc;
-DROP DATABASE d2;
+DROP DATABASE IF EXISTS d2;
 source include/kill_query.inc;
 source include/diff_master_slave.inc;
 CREATE EVENT e2

=== modified file 'mysql-test/suite/rpl/t/rpl_killed_ddl.test'
--- a/mysql-test/suite/rpl/t/rpl_killed_ddl.test	2009-04-08 23:42:51 +0000
+++ b/mysql-test/suite/rpl/t/rpl_killed_ddl.test	2009-12-09 06:24:54 +0000
@@ -153,7 +153,7 @@ source include/kill_query_and_diff_maste
 send DROP DATABASE d1;
 source include/kill_query_and_diff_master_slave.inc;
 
-send DROP DATABASE d2;
+send DROP DATABASE IF EXISTS d2;
 source include/kill_query_and_diff_master_slave.inc;
 
 ######## EVENT ########
@@ -226,7 +226,7 @@ source include/kill_query_and_diff_maste
 send DROP PROCEDURE p1;
 source include/kill_query_and_diff_master_slave.inc;
 
-# Temporarily disabled, see comment above for DROP FUNCTION IF EXISTS
+# Temporarily disabled because of bug#43353, see comment above for DROP FUNCTION IF EXISTS
 #send DROP PROCEDURE IF EXISTS p2;
 #source include/kill_query_and_diff_master_slave.inc;
 

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	2009-10-16 10:29:42 +0000
+++ b/sql/sql_db.cc	2009-12-09 06:24:54 +0000
@@ -695,6 +695,7 @@ int mysql_create_db(THD *thd, char *db, 
       file.  In this case it's best to just continue as if nothing has
       happened.  (This is a very unlikely senario)
     */
+    thd->clear_error();
   }
 
 not_silent:
@@ -810,9 +811,9 @@ bool mysql_alter_db(THD *thd, const char
 
   if (mysql_bin_log.is_open())
   {
-    int errcode= query_error_code(thd, TRUE);
+    thd->clear_error();
     Query_log_event qinfo(thd, thd->query(), thd->query_length(), 0,
-			  /* suppress_use */ TRUE, errcode);
+			  /* suppress_use */ TRUE, 0);
 
     /*
       Write should use the database being created as the "current
@@ -822,7 +823,6 @@ bool mysql_alter_db(THD *thd, const char
     qinfo.db     = db;
     qinfo.db_len = strlen(db);
 
-    thd->clear_error();
     /* These DDL methods and logging protected with LOCK_mysql_create_db */
     mysql_bin_log.write(&qinfo);
   }
@@ -962,9 +962,9 @@ bool mysql_rm_db(THD *thd,char *db,bool 
     }
     if (mysql_bin_log.is_open())
     {
-      int errcode= query_error_code(thd, TRUE);
+      thd->clear_error();
       Query_log_event qinfo(thd, query, query_length, 0, 
-			    /* suppress_use */ TRUE, errcode);
+			    /* suppress_use */ TRUE, 0);
       /*
         Write should use the database being created as the "current
         database" and not the threads current database, which is the
@@ -973,7 +973,6 @@ bool mysql_rm_db(THD *thd,char *db,bool 
       qinfo.db     = db;
       qinfo.db_len = strlen(db);
 
-      thd->clear_error();
       /* These DDL methods and logging protected with LOCK_mysql_create_db */
       mysql_bin_log.write(&qinfo);
     }


Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20091209062454-f93phmyc2hnkrhrq.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (zhenxing.he:3252) Bug#45520He Zhenxing9 Dec