diff options
author | unknown <aelkin/elkin@dsl-hkibras1-ff5dc300-70.dhcp.inet.fi> | 2007-05-28 22:20:22 +0300 |
---|---|---|
committer | unknown <aelkin/elkin@dsl-hkibras1-ff5dc300-70.dhcp.inet.fi> | 2007-05-28 22:20:22 +0300 |
commit | f27bf2b4635202d73b2da712c2bb0f522083cc24 (patch) | |
tree | e6587da95890e8879138617ecd484e1ea6bc30fe /mysql-test/r/binlog_killed.result | |
parent | 9f757559ee14a6fee66917429b5e36f921475442 (diff) | |
download | mariadb-git-f27bf2b4635202d73b2da712c2bb0f522083cc24.tar.gz |
Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events
The reason for the bug was that replaying of a query on slave could not be possible since its event
was recorded with the killed error. Due to the specific of handling INSERT, which per-row-while-loop is
unbreakable to killing, the query on transactional table should have not appeared in binlog unless
there was a call to a stored routine that got interrupted with killing (and then there must be an error
returned out of the loop).
The offered solution added the following rule for binlogging of INSERT that accounts the above
specifics:
For INSERT on transactional-table if the error was not set the only raised flag
is harmless and is ignored via masking out on time of creation of binlog event.
For both table types the combination of raised error and KILLED flag indicates that there
was potentially partial execution on master and consistency is under the question.
In that case the code continues to binlog an event with an appropriate killed error.
The fix relies on the specified behaviour of stored routine that must propagate the error
to the top level query handling if the thd->killed flag was raised in the routine execution.
The patch adds an arg with the default killed-status-unset value to Query_log_event::Query_log_event.
sql/log_event.cc:
killed_status as the value of thd->killed can be passed as an arg to the constructor.
if the value is different from the default the arg is set to the current thd->killed value.
A caller might need to masquerade thd->killed with THD::NOT_KILLED.
So far only mysql_insert() uses such explicit way to tell the constructor about killing status.
sql/log_event.h:
default arg to the constructor with meaning of killed status of the query.
if the arg is not explicitly provided the status of thd->killed will be snapshot
inside of the constuctor, which is potentially incorrect (see bug#27571)
sql/sql_class.h:
extending killed_state with no-state member.
sql/sql_insert.cc:
ignore the KILLED flag incl KILL_BAD_DATA when the INSERT query event
is created without an `error';
sql/sql_update.cc:
Suggestion how to fix bug#27571 as comments.
mysql-test/r/binlog_killed.result:
new result file
mysql-test/t/binlog_killed.test:
regression tests also apply for bug27563, BUG#27565
Diffstat (limited to 'mysql-test/r/binlog_killed.result')
-rw-r--r-- | mysql-test/r/binlog_killed.result | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/mysql-test/r/binlog_killed.result b/mysql-test/r/binlog_killed.result new file mode 100644 index 00000000000..196400eaf9e --- /dev/null +++ b/mysql-test/r/binlog_killed.result @@ -0,0 +1,106 @@ +create function bug27563() +RETURNS int(11) +DETERMINISTIC +begin +select get_lock("a", 10) into @a; +return 1; +end| +create function bug27565() +RETURNS int(11) +DETERMINISTIC +begin +select a from t1 where a=1 into @a for update; +return 1; +end| +create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; +create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +reset master; +select get_lock("a", 20); +get_lock("a", 20) +1 +insert into t1 values (bug27563(),1); +kill query 3; +affected rows: 1 +show master status /* must be only FD event unless Bug#27563 */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 260 +select count(*) from t1 /* must be zero unless Bug#27563 */; +count(*) +1 +begin; +insert into t1 values (bug27563(),1); +kill query 3; +affected rows: 1 +select count(*) from t1 /* must be zero unless Bug#27563 */; +count(*) +2 +commit; +reset master; +insert into t2 values (bug27563(),1); +kill query 3; +select count(*) from t2 /* must be one */; +count(*) +1 +show master status /* must have the insert event more to FD */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 225 +select RELEASE_LOCK("a"); +RELEASE_LOCK("a") +1 +delete from t1; +delete from t2; +insert into t1 values (1,1); +insert into t2 values (1,1); +begin; +update t1 set b=0 where a=1; +update t2 set b=bug27565()-1 where a=1; +kill query 3; +commit; +Got one of the listed errors +select * from t1 /* must be: (1,0) */; +a b +1 0 +select * from t2 /* must be as before: (1,1) */; +a b +1 1 +delete from t3; +reset master; +begin; +update t1 set b=0 where a=1; +insert into t3 values (0,0),(1,bug27565()); +kill query 3; +rollback; +Got one of the listed errors +select count(*) from t3 /* must be zero */; +count(*) +0 +show master status /* nothing in binlog */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +delete from t2; +reset master; +begin; +update t1 set b=0 where a=1; +insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */; +kill query 3; +rollback; +Got one of the listed errors +select count(*) from t2 /* count must be one */; +count(*) +1 +show master status /* insert into non-ta must be in binlog */; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 247 +select +(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null; +(@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) +is not null +1 +select @a like "%#%error_code=1317%" /* must return 1 */; +@a like "%#%error_code=1317%" +1 +drop table t1,t2,t3; +drop function bug27563; +drop function bug27565; |