mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
e97722e495
"EE_ error codes (EE_DELETE, EE_WRITE) end up in the binlog, making slave stop". The problem was that during execution of the command on the master, an error can occur (for example, not space left on device, then mysqld waits and when there is space it completes successfully: so finally it worked but the error EE_WRITE remains in thd->net.last_errno and thd->net.last_error). To know if finally the command succeeded, we test the 'error' variable in every place, and if it shows no failure we reset thd->net.last_err* using the function THD::clear_error() which is backported from 4.1. A new test to see if now only real errors get to the binlog (note: the test uses "rm"). Also a bit of memory free/alloc saving in log_event.cc (do not free the whole mem_root after every query in the slave SQL thread: we can keep the initial block of it; which will be freed when the thread terminates). sql/log_event.cc: In the slave SQL thread, it's a waste to free the initial block of the mem_root after every query. We can instead keep it. It will be freed when the thread terminates (in THD::~THD()). sql/sql_acl.cc: clear the error in thd->net.last_errno as there was no error sql/sql_base.cc: clear the error in thd->net.last_errno as there was no error sql/sql_class.h: Backport of THD::clear_error() from 4.1: clears the error in thd->net.last_errno sql/sql_db.cc: clear the error in thd->net.last_errno as there was no error sql/sql_delete.cc: clear the error in thd->net.last_errno as there was no error sql/sql_insert.cc: clear the error in thd->net.last_errno as there was no error sql/sql_parse.cc: clear the error in thd->net.last_errno as there was no error sql/sql_rename.cc: clear the error in thd->net.last_errno as there was no error sql/sql_table.cc: clear the error in thd->net.last_errno as there was no error sql/sql_update.cc: clear the error in thd->net.last_errno as there was no error
30 lines
865 B
Text
30 lines
865 B
Text
# See if an EE_ error in one event of the master's binlog stops replication
|
|
# (it should not: in this configuration the EE_ error is probably not
|
|
# critical). Example: you do a DROP TABLE on a table which has no MYI file
|
|
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
|
|
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
|
|
|
|
source include/master-slave.inc;
|
|
|
|
create table t1 (a int) type=myisam;
|
|
flush tables;
|
|
system rm ./var/master-data/test/t1.MYI ;
|
|
drop table t1;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
|
|
# Now a real error.
|
|
|
|
connection master;
|
|
create table t1 (a int, unique(a)) type=myisam;
|
|
set sql_log_bin=0;
|
|
insert into t1 values(2);
|
|
set sql_log_bin=1;
|
|
save_master_pos;
|
|
--error 1062;
|
|
insert into t1 values(1),(2);
|
|
drop table t1;
|
|
save_master_pos;
|
|
connection slave;
|
|
wait_for_slave_to_stop;
|