| List: | Commits | « Previous MessageNext Message » | |
| From: | He Zhenxing | Date: | September 30 2009 8:33am |
| Subject: | Re: bzr commit into mysql-5.0-bugteam branch (zhenxing.he:2814) Bug#45520 | ||
| View as plain text | |||
Libing Song wrote: > Hi Zhenxing, > > Nice work! > Only one comment. > > He Zhenxing wrote: > > #At file:///media/sdb2/hezx/work/mysql/bzrwork/b45520/5.0-bugteam/ based on > revid:joro@stripped > > > > 2814 He Zhenxing 2009-09-28 > > BUG#45520 rpl_killed_ddl fails sporadically in pb2 > > > > There are three issues that caused rpl_killed_ddl fails sporadically > > in pb2: > > > > 1) error_code can be ER_QUERY_INTERRUPTED/ER_SERVER_SHUTDOWN when > > killed_status is NOT_KILLED > > > Maybe ER_QUERY_INTERRUPTED and ER_SERVER_SHUTDOWN are only reported to > clients which are not include slaves. I think slaves (SQL thread) can get this error too if user stops slave or shutdown slave server. > If query is interrupted, it will not be binlogged. > ER_SERVER_SHUTDOWN is only related to slave I/O thread. Both errors can be logged, ER_SERVER_SHUTDOWN can happen when you try to shutdown master. > > 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) Make sure error_code is not set to ER_SERVER_SHUTDOWN or > > ER_QUERY_INTTERUPTED if killed_status is NOT KILLED > > 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 > > > > M mysql-test/r/rpl_killed_ddl.result > > M mysql-test/t/rpl_killed_ddl.test > > M sql/log_event.cc > > === modified file 'mysql-test/r/rpl_killed_ddl.result' > > --- a/mysql-test/r/rpl_killed_ddl.result 2009-03-27 05:19:50 +0000 > > +++ b/mysql-test/r/rpl_killed_ddl.result 2009-09-28 05:42:33 +0000 > > @@ -53,7 +53,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 FUNCTION f2 () RETURNS INT DETERMINISTIC > > @@ -63,10 +63,7 @@ source include/diff_master_slave.inc; > > ALTER FUNCTION f1 SQL SECURITY INVOKER; > > source include/kill_query.inc; > > source include/diff_master_slave.inc; > > -DROP FUNCTION IF EXISTS f1; > > -source include/kill_query.inc; > > -source include/diff_master_slave.inc; > > -DROP FUNCTION IF EXISTS f2; > > +DROP FUNCTION f1; > > source include/kill_query.inc; > > source include/diff_master_slave.inc; > > CREATE PROCEDURE p2 (OUT rows INT) > > @@ -79,10 +76,7 @@ source include/diff_master_slave.inc; > > ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table t1'; > > source include/kill_query.inc; > > source include/diff_master_slave.inc; > > -DROP PROCEDURE IF EXISTS p1; > > -source include/kill_query.inc; > > -source include/diff_master_slave.inc; > > -DROP PROCEDURE IF EXISTS p2; > > +DROP PROCEDURE p1; > > source include/kill_query.inc; > > source include/diff_master_slave.inc; > > CREATE TABLE t2 (b int); > > > > === modified file 'mysql-test/t/rpl_killed_ddl.test' > > --- a/mysql-test/t/rpl_killed_ddl.test 2009-03-27 05:19:50 +0000 > > +++ b/mysql-test/t/rpl_killed_ddl.test 2009-09-28 05:42:33 +0000 > > @@ -123,7 +123,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; > > > > ######## FUNCTION ######## > > @@ -139,13 +139,21 @@ source include/kill_query_and_diff_maste > > > > # function f1 probably does not exist because the ALTER query was > > # killed > > -send DROP FUNCTION IF EXISTS f1; > > +send DROP FUNCTION f1; > > source include/kill_query_and_diff_master_slave.inc; > > > > # function f2 probably does not exist because the CREATE query was > > # killed > > -send DROP FUNCTION IF EXISTS f2; > > -source include/kill_query_and_diff_master_slave.inc; > > +# > > +# Temporarily disabled. Because of BUG#43353, KILL the query may > > +# result in function not found, and for 5.1, DROP statements will be > > +# logged if the function is not found on master, so the following DROP > > +# FUNCTION statement may be interrupted and not drop the function on > > +# master, but still get logged and executed on slave and cause > > +# inconsistence. Also disable the following DROP PROCEDURE IF EXITS > > +# below. > > +#send DROP FUNCTION IF EXISTS f2; > > +#source include/kill_query_and_diff_master_slave.inc; > > > > ######## PROCEDURE ######## > > > > @@ -163,11 +171,12 @@ source include/kill_query_and_diff_maste > > send ALTER PROCEDURE p1 SQL SECURITY INVOKER COMMENT 'return rows of table > t1'; > > source include/kill_query_and_diff_master_slave.inc; > > > > -send DROP PROCEDURE IF EXISTS p1; > > +send DROP PROCEDURE p1; > > source include/kill_query_and_diff_master_slave.inc; > > > > -send DROP PROCEDURE IF EXISTS p2; > > -source include/kill_query_and_diff_master_slave.inc; > > +# Temporarily disabled, see comment above for DROP FUNCTION IF EXISTS > > +#send DROP PROCEDURE IF EXISTS p2; > > +#source include/kill_query_and_diff_master_slave.inc; > > > > ######## TABLE ######## > > > > > > === modified file 'sql/log_event.cc' > > --- a/sql/log_event.cc 2009-08-12 03:54:05 +0000 > > +++ b/sql/log_event.cc 2009-09-28 05:42:33 +0000 > > @@ -1368,6 +1368,16 @@ Query_log_event::Query_log_event(THD* th > > ((thd_arg->system_thread & SYSTEM_THREAD_DELAYED_INSERT) ? 0 : > > thd->killed_errno()); > > > > + > > + /* thd_arg->main_da.sql_errno() might be ER_SERVER_SHUTDOWN or > > + ER_QUERY_INTERRUPTED, So here we need to make sure that > > + error_code is not set to these errors when specified NOT_KILLED > > + by the caller > > + */ > > + if ((killed_status_arg == THD::NOT_KILLED) && > > + (error_code == ER_SERVER_SHUTDOWN || error_code == > ER_QUERY_INTERRUPTED)) > > + error_code= 0; > > + > > time(&end_time); > > exec_time = (ulong) (end_time - thd->start_time); > > catalog_len = (catalog) ? (uint32) strlen(catalog) : 0; > > > > > > ------------------------------------------------------------------------ > > > >
