1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Bug#8412: For replication to work correctly, the prologue and

epilogue to an SQL statement should not have an error code even
when the SQL statement itself has an error code.
This commit is contained in:
mats@mysql.com
2005-02-14 18:39:33 +01:00
parent 548f7dbada
commit 30bf28202c
3 changed files with 35 additions and 1 deletions

View File

@ -69,3 +69,8 @@ b c
9 13
drop table t1;
drop table t2;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1);
Duplicate entry '1' for key 1

View File

@ -62,3 +62,19 @@ drop table t2;
save_master_pos;
connection slave;
sync_with_master;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS
#
connection master;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
--error 1062
INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master;

View File

@ -1182,6 +1182,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
p= strmov(strmov(buf, "SET CHARACTER SET "),
thd->variables.convert_set->name);
Query_log_event e(thd, buf, (ulong) (p - buf), 0);
e.error_code = 0; // This statement cannot fail (see [1]).
e.set_log_pos(this);
if (e.write(file))
goto err;
@ -1199,12 +1200,22 @@ bool MYSQL_LOG::write(Log_event* event_info)
{
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=0", 24, 0);
e.set_log_pos(this);
e.error_code = 0; // This statement cannot fail (see [1]).
if (e.write(file))
goto err;
}
}
/* Write the SQL command */
/*
Write the SQL command
[1] If this statement has an error code, the slave is required to fail
with the same error code or stop. The preamble and epilogue should
*not* have this error code since the execution of those is
guaranteed *not* to produce any error code. This would therefore
stop the slave even if the execution of the real statement can be
handled gracefully by the slave.
*/
event_info->set_log_pos(this);
if (event_info->write(file))
@ -1218,6 +1229,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
{
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0);
e.set_log_pos(this);
e.error_code = 0; // This statement cannot fail (see [1]).
if (e.write(file))
goto err;
}
@ -1226,6 +1238,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
{
Query_log_event e(thd, "SET CHARACTER SET DEFAULT", 25, 0);
e.set_log_pos(this);
e.error_code = 0; // This statement cannot fail (see [1]).
if (e.write(file))
goto err;
}