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
|
|
|
|
slave_transaction_retries 0
|
2005-03-02 11:29:48 +01:00
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) NOT NULL default '0',
|
|
|
|
KEY `a` (`a`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
|
|
show create table t2;
|
|
|
|
Table Create Table
|
|
|
|
t2 CREATE TABLE `t2` (
|
|
|
|
`a` int(11) NOT NULL default '0',
|
|
|
|
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;
|
2006-04-13 20:42:48 +02:00
|
|
|
Slave_IO_State #
|
|
|
|
Master_Host 127.0.0.1
|
|
|
|
Master_User root
|
|
|
|
Master_Port MASTER_MYPORT
|
|
|
|
Connect_Retry 1
|
|
|
|
Master_Log_File master-bin.000001
|
|
|
|
Read_Master_Log_Pos 13110
|
|
|
|
Relay_Log_File #
|
|
|
|
Relay_Log_Pos #
|
|
|
|
Relay_Master_Log_File master-bin.000001
|
|
|
|
Slave_IO_Running Yes
|
|
|
|
Slave_SQL_Running Yes
|
|
|
|
Replicate_Do_DB
|
|
|
|
Replicate_Ignore_DB
|
|
|
|
Replicate_Do_Table
|
|
|
|
Replicate_Ignore_Table
|
|
|
|
Replicate_Wild_Do_Table
|
|
|
|
Replicate_Wild_Ignore_Table
|
|
|
|
Last_Errno 0
|
|
|
|
Last_Error
|
|
|
|
Skip_Counter 0
|
|
|
|
Exec_Master_Log_Pos 13110
|
|
|
|
Relay_Log_Space #
|
|
|
|
Until_Condition None
|
|
|
|
Until_Log_File
|
|
|
|
Until_Log_Pos 0
|
|
|
|
Master_SSL_Allowed No
|
|
|
|
Master_SSL_CA_File
|
|
|
|
Master_SSL_CA_Path
|
|
|
|
Master_SSL_Cert
|
|
|
|
Master_SSL_Cipher
|
|
|
|
Master_SSL_Key
|
|
|
|
Seconds_Behind_Master #
|
2005-03-02 11:29:48 +01:00
|
|
|
stop slave;
|
|
|
|
change master to master_log_pos=401;
|
|
|
|
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;
|
2006-04-13 20:42:48 +02:00
|
|
|
Slave_IO_State #
|
|
|
|
Master_Host 127.0.0.1
|
|
|
|
Master_User root
|
|
|
|
Master_Port MASTER_MYPORT
|
|
|
|
Connect_Retry 1
|
|
|
|
Master_Log_File master-bin.000001
|
|
|
|
Read_Master_Log_Pos 13110
|
|
|
|
Relay_Log_File #
|
|
|
|
Relay_Log_Pos #
|
|
|
|
Relay_Master_Log_File master-bin.000001
|
|
|
|
Slave_IO_Running #
|
|
|
|
Slave_SQL_Running Yes
|
|
|
|
Replicate_Do_DB
|
|
|
|
Replicate_Ignore_DB
|
|
|
|
Replicate_Do_Table
|
|
|
|
Replicate_Ignore_Table
|
|
|
|
Replicate_Wild_Do_Table
|
|
|
|
Replicate_Wild_Ignore_Table
|
|
|
|
Last_Errno 0
|
|
|
|
Last_Error
|
|
|
|
Skip_Counter 0
|
|
|
|
Exec_Master_Log_Pos 13110
|
|
|
|
Relay_Log_Space #
|
|
|
|
Until_Condition None
|
|
|
|
Until_Log_File
|
|
|
|
Until_Log_Pos 0
|
|
|
|
Master_SSL_Allowed No
|
|
|
|
Master_SSL_CA_File
|
|
|
|
Master_SSL_CA_Path
|
|
|
|
Master_SSL_Cert
|
|
|
|
Master_SSL_Cipher
|
|
|
|
Master_SSL_Key
|
|
|
|
Seconds_Behind_Master #
|
2005-03-02 11:29:48 +01:00
|
|
|
set global max_relay_log_size=0;
|
|
|
|
stop slave;
|
|
|
|
change master to master_log_pos=401;
|
|
|
|
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;
|
2006-04-13 20:42:48 +02:00
|
|
|
Slave_IO_State #
|
|
|
|
Master_Host 127.0.0.1
|
|
|
|
Master_User root
|
|
|
|
Master_Port MASTER_MYPORT
|
|
|
|
Connect_Retry 1
|
|
|
|
Master_Log_File master-bin.000001
|
|
|
|
Read_Master_Log_Pos 13110
|
|
|
|
Relay_Log_File #
|
|
|
|
Relay_Log_Pos #
|
|
|
|
Relay_Master_Log_File master-bin.000001
|
|
|
|
Slave_IO_Running #
|
|
|
|
Slave_SQL_Running Yes
|
|
|
|
Replicate_Do_DB
|
|
|
|
Replicate_Ignore_DB
|
|
|
|
Replicate_Do_Table
|
|
|
|
Replicate_Ignore_Table
|
|
|
|
Replicate_Wild_Do_Table
|
|
|
|
Replicate_Wild_Ignore_Table
|
|
|
|
Last_Errno 0
|
|
|
|
Last_Error
|
|
|
|
Skip_Counter 0
|
|
|
|
Exec_Master_Log_Pos 13110
|
|
|
|
Relay_Log_Space #
|
|
|
|
Until_Condition None
|
|
|
|
Until_Log_File
|
|
|
|
Until_Log_Pos 0
|
|
|
|
Master_SSL_Allowed No
|
|
|
|
Master_SSL_CA_File
|
|
|
|
Master_SSL_CA_Path
|
|
|
|
Master_SSL_Cert
|
|
|
|
Master_SSL_Cipher
|
|
|
|
Master_SSL_Key
|
|
|
|
Seconds_Behind_Master #
|
2005-07-13 13:49:35 +02:00
|
|
|
drop table t1,t2,t3,t4;
|