Commit ec4b9f8e authored by mats@mysql.com's avatar mats@mysql.com

Merge mysql.com:/home/bkroot/mysql-5.1-new

into  mysql.com:/home/bk/b16228-mysql-5.1-new
parents 3f7b8cfb e824e616
......@@ -71,13 +71,47 @@ CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
PRIMARY KEY USING HASH (`nid`))
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
**** On Slave ****
BEGIN;
UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
set GLOBAL slave_transaction_retries=1;
**** On Master ****
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
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
<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes No <Replicate_Ignore_Table> 146 Error in Write_rows event: error during transaction execution on table test.t1 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
**** On Slave ****
SHOW SLAVE STATUS;;
Slave_IO_State <Slave_IO_State>
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos <Read_Master_Log_Pos>
Relay_Log_File <Relay_Log_File>
Relay_Log_Pos <Relay_Log_Pos>
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table <Replicate_Ignore_Table>
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 146
Last_Error Error in Write_rows event: error during transaction execution on table test.t1
Skip_Counter 0
Exec_Master_Log_Pos <Exec_Master_Log_Pos>
Relay_Log_Space <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 <Seconds_Behind_Master>
set GLOBAL slave_transaction_retries=10;
START SLAVE;
select * from t1 order by nid;
......
......@@ -25,7 +25,7 @@ rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
rpl_ndb_2innodb : Bugs#17400: delete & update of rows in table without pk fails
rpl_ndb_2myisam : Bugs#17400: delete & update of rows in table without pk fails
rpl_ndb_auto_inc : Bug#17086
rpl_ndb_basic : Bug#16228 [IN REVIEW]
#rpl_ndb_basic : Bug#16228 [IN REVIEW]
rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_innodb2ndb : Bugs#17400: delete & update of rows in table without pk fails
......
......@@ -98,6 +98,7 @@ INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
# cause a lock on that row on the slave
--sync_slave_with_master
--connection slave
--echo **** On Slave ****
BEGIN;
UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
......@@ -107,6 +108,7 @@ set GLOBAL slave_transaction_retries=1;
# now do a change to this row on the master
# will deadlock on the slave because of lock above
--connection master
--echo **** On Master ****
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
# wait for deadlock to be detected
......@@ -119,14 +121,14 @@ UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
# replication should have stopped, since max retries where not enough
# verify with show slave status
--connection slave
--echo **** On Slave ****
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
SHOW SLAVE STATUS;
--query_vertical SHOW SLAVE STATUS;
# now set max retries high enough to succeed, and start slave again
set GLOBAL slave_transaction_retries=10;
START SLAVE;
# wait for deadlock to be detected and retried
# should be the same sleep as above for test to be valid
--sleep 5
......
......@@ -3093,6 +3093,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
else
{
exec_res= 0;
end_trans(thd, ROLLBACK);
/* chance for concurrent connection to get more locks */
safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE),
(CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli);
......@@ -3110,8 +3111,16 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
"the slave_transaction_retries variable.",
slave_trans_retries);
}
if (!((thd->options & OPTION_BEGIN) && opt_using_transactions))
rli->trans_retries= 0; // restart from fresh
else if (!((thd->options & OPTION_BEGIN) && opt_using_transactions))
{
/*
Only reset the retry counter if the event succeeded or
failed with a non-transient error. On a successful event,
the execution will proceed as usual; in the case of a
non-transient error, the slave will stop with an error.
*/
rli->trans_retries= 0; // restart from fresh
}
}
return exec_res;
}
......
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