Merge dsl-hkigw8-feaef900-46.dhcp.inet.fi:/home/elkin/MySQL/TEAM/BARE/5.0-merge

into  dsl-hkigw8-feaef900-46.dhcp.inet.fi:/home/elkin/MySQL/TEAM/FIXES/merge_50
parents 1ef49b93 4b134f74
......@@ -15,7 +15,8 @@
connection master;
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t3 (a INT) ENGINE=$engine_type;
# requiring 'unique' for the timeout part of the test
eval CREATE TABLE t3 (a INT UNIQUE) ENGINE=$engine_type;
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
show variables like 'slave_transaction_retries';
sync_slave_with_master;
......@@ -58,7 +59,7 @@ enable_query_log;
select * from t1 for update;
start slave;
--real_sleep 3 # hope that slave is blocked now
insert into t2 values(22); # provoke deadlock, slave should be victim
insert into t2 values(201); # provoke deadlock, slave should be victim
commit;
sync_with_master;
select * from t1; # check that slave succeeded finally
......@@ -73,11 +74,13 @@ show slave status;
# 2) Test lock wait timeout
stop slave;
change master to master_log_pos=536; # the BEGIN log event
delete from t3;
change master to master_log_pos=543; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
--real_sleep 10 # slave should have blocked, and be retrying
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
sync_with_master;
select * from t1; # check that slave succeeded finally
......@@ -96,11 +99,13 @@ set global max_relay_log_size=0;
# This is really copy-paste of 2) of above
stop slave;
change master to master_log_pos=536;
delete from t3;
change master to master_log_pos=543;
begin;
select * from t2 for update;
start slave;
--real_sleep 10
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
sync_with_master;
select * from t1;
......@@ -115,4 +120,4 @@ connection master;
drop table t1,t2,t3,t4;
sync_slave_with_master;
# End of 4.1 tests
--echo End of 5.1 tests
......@@ -3175,6 +3175,8 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
We were in a transaction which has been rolled back because of a
temporary error;
let's seek back to BEGIN log event and retry it all again.
Note, if lock wait timeout (innodb_lock_wait_timeout exceeded)
there is no rollback since 5.0.13 (ref: manual).
We have to not only seek but also
a) init_master_info(), to seek back to hot relay log's start for later
(for when we will come back to this hot log after re-processing the
......@@ -4454,7 +4456,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
'%s@%s:%d': \
Error: '%s' errno: %d retry-time: %d retries: %lu",
(reconnect ? "reconnecting" : "connecting"),
mi->user,mi->host,mi->port,
mi->user, mi->host, mi->port,
mysql_error(mysql), last_errno,
mi->connect_retry,
master_retry_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment