2005-03-02 11:29:48 +01:00
|
|
|
stop slave;
|
|
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
|
|
reset master;
|
|
|
|
reset slave;
|
|
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
|
|
start slave;
|
|
|
|
create table t1 (a int not null, key(a)) engine=innodb;
|
|
|
|
create table t2 (a int not null, key(a)) engine=innodb;
|
|
|
|
create table t3 (a int) engine=innodb;
|
|
|
|
create table t4 (a int) engine=innodb;
|
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication":
s/sleep/safe_sleep (thread safe); sleep 0/1/2/3/4/5/5/5 (get slave less late);
no message on error log (deadlock is too common sometimes), a global counter
instead (SHOW STATUS LIKE 'slave_retried_transactions').
Plus a fix for libmysql/Makefile.shared
libmysql/Makefile.shared:
When we "make clean" in libmysql/ we remove the symlinks there, so we
need to mark that they have to be recreated later: this is done by removing
../linked_libmysql_sources. If we don't do this, 'make' will fail after 'cd libmysql;make clean'.
This Makefile.shared is used by libmysql_r too.
No reason to remove linked_client_sources as we don't remove the links in client/.
mysql-test/r/rpl_deadlock.result:
result fix
mysql-test/t/rpl_deadlock.test:
small test addition
sql/mysqld.cc:
if active_mi could not be alloced, die. New SHOW STATUS LIKE "slave_retried_transactions".
sql/slave.cc:
If slave retries automatically a transaction, no message on error log
(too common situation); sleep 0 secs at first retry, then 1, 2, 3, 4,
5, 5, 5... Sleeping 0 is to get the least possible late, as deadlocks
are usually resolved at first try. New global counter rli->retried_trans
(for SHOW STATUS: total number of times the slave had to retry
any transaction). safe_sleep() is thread-safe, sleep() was not.
I change the rli->trans_retries counter to go from 0 to max instead
of the other way (better for new sleep()).
sql/slave.h:
new global counter rli->retried_trans
sql/sql_show.cc:
SHOW STATUS LIKE "slave_retried_transactions"; needs replication mutexes.
Can't be a simple SHOW_LONG, because active_mi is unset (not alloced yet)
when the static global status_vars is created (active_mi is set
in init_slave()).
sql/structs.h:
new SHOW_SLAVE_RETRIED_TRANS
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
2005-03-23 19:19:36 +01:00
|
|
|
show variables like 'slave_transaction_retries';
|
|
|
|
Variable_name Value
|
2005-03-24 16:11:58 +01:00
|
|
|
slave_transaction_retries 10
|
2005-03-02 11:29:48 +01:00
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
2005-03-02 17:52:38 +01:00
|
|
|
`a` int(11) NOT NULL,
|
2005-03-02 11:29:48 +01:00
|
|
|
KEY `a` (`a`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
|
|
show create table t2;
|
|
|
|
Table Create Table
|
|
|
|
t2 CREATE TABLE `t2` (
|
2005-03-02 17:52:38 +01:00
|
|
|
`a` int(11) NOT NULL,
|
2005-03-02 11:29:48 +01:00
|
|
|
KEY `a` (`a`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication":
s/sleep/safe_sleep (thread safe); sleep 0/1/2/3/4/5/5/5 (get slave less late);
no message on error log (deadlock is too common sometimes), a global counter
instead (SHOW STATUS LIKE 'slave_retried_transactions').
Plus a fix for libmysql/Makefile.shared
libmysql/Makefile.shared:
When we "make clean" in libmysql/ we remove the symlinks there, so we
need to mark that they have to be recreated later: this is done by removing
../linked_libmysql_sources. If we don't do this, 'make' will fail after 'cd libmysql;make clean'.
This Makefile.shared is used by libmysql_r too.
No reason to remove linked_client_sources as we don't remove the links in client/.
mysql-test/r/rpl_deadlock.result:
result fix
mysql-test/t/rpl_deadlock.test:
small test addition
sql/mysqld.cc:
if active_mi could not be alloced, die. New SHOW STATUS LIKE "slave_retried_transactions".
sql/slave.cc:
If slave retries automatically a transaction, no message on error log
(too common situation); sleep 0 secs at first retry, then 1, 2, 3, 4,
5, 5, 5... Sleeping 0 is to get the least possible late, as deadlocks
are usually resolved at first try. New global counter rli->retried_trans
(for SHOW STATUS: total number of times the slave had to retry
any transaction). safe_sleep() is thread-safe, sleep() was not.
I change the rli->trans_retries counter to go from 0 to max instead
of the other way (better for new sleep()).
sql/slave.h:
new global counter rli->retried_trans
sql/sql_show.cc:
SHOW STATUS LIKE "slave_retried_transactions"; needs replication mutexes.
Can't be a simple SHOW_LONG, because active_mi is unset (not alloced yet)
when the static global status_vars is created (active_mi is set
in init_slave()).
sql/structs.h:
new SHOW_SLAVE_RETRIED_TRANS
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
2005-03-23 19:19:36 +01:00
|
|
|
show variables like 'slave_transaction_retries';
|
|
|
|
Variable_name Value
|
|
|
|
slave_transaction_retries 2
|
2005-03-02 11:29:48 +01:00
|
|
|
stop slave;
|
|
|
|
begin;
|
|
|
|
insert into t3 select * from t2 for update;
|
|
|
|
insert into t1 values(1);
|
|
|
|
commit;
|
|
|
|
begin;
|
|
|
|
select * from t1 for update;
|
|
|
|
a
|
|
|
|
start slave;
|
|
|
|
insert into t2 values(22);
|
|
|
|
commit;
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
select * from t2;
|
|
|
|
a
|
|
|
|
22
|
|
|
|
show slave status;
|
|
|
|
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
2005-03-25 14:51:17 +01:00
|
|
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No #
|
2005-03-02 11:29:48 +01:00
|
|
|
stop slave;
|
2005-03-25 14:51:17 +01:00
|
|
|
change master to master_log_pos=532;
|
2005-03-02 11:29:48 +01:00
|
|
|
begin;
|
|
|
|
select * from t2 for update;
|
|
|
|
a
|
|
|
|
22
|
|
|
|
start slave;
|
|
|
|
commit;
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
1
|
|
|
|
select * from t2;
|
|
|
|
a
|
|
|
|
22
|
|
|
|
show slave status;
|
|
|
|
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
2005-03-25 14:51:17 +01:00
|
|
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No #
|
2005-03-02 11:29:48 +01:00
|
|
|
set global max_relay_log_size=0;
|
|
|
|
stop slave;
|
2005-03-25 14:51:17 +01:00
|
|
|
change master to master_log_pos=532;
|
2005-03-02 11:29:48 +01:00
|
|
|
begin;
|
|
|
|
select * from t2 for update;
|
|
|
|
a
|
|
|
|
22
|
|
|
|
start slave;
|
|
|
|
commit;
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
1
|
|
|
|
1
|
|
|
|
select * from t2;
|
|
|
|
a
|
|
|
|
22
|
|
|
|
show slave status;
|
|
|
|
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
2005-03-25 14:51:17 +01:00
|
|
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No #
|
2005-07-13 13:49:35 +02:00
|
|
|
drop table t1,t2,t3,t4;
|