I’ve a master and slave and got the slave stopped with the following error log in slave. I want to fix this and get the two servers on synch and get going again.
111128 8:42:24 [Note] Slave I/O thread: connected to master 'repl@masterIP:3306', replication started in log 'mysql-bin.000006' at position 169
111128 15:46:50 [ERROR] Slave: Query caused different errors on master and slave. Error on master: 'Deadlock found when trying to get lock; try restarting transaction' (1213), Error on slave: 'no error' (0). Default database: 'Dbase'. Query: 'insert into archieved(eid,at,rtime,scode) select id,at,avg(rtime),scode from tstatus where date(at)="2011-10-29" group by id', Error_code: 0 111128 15:46:50 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000006' position 1277768
I’m not sure how to do the following:
try restarting transaction' (1213)
Note: I’ve got the following in slave, IO running and sql stopped. I just want to resynch and also avoid this in future.
Slave_IO_State: Waiting for master to send event
Master_Host: masterIp
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000006
Read_Master_Log_Pos: 3156089
Relay_Log_File: mysql-relay-bin.000002
Relay_Log_Pos: 1277834
Relay_Master_Log_File: mysql-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Thanks.
You have to restart the transaction from your application, mysql has already forgotten about it.
When Mysql encounters a dead lock it will pick one “winner” and let that thread continue, the other thread will do rollback, release it’s locks and get the “try to restart the transaction”-error.
Your application should try to detect this and try the same query again. Hopefully you won’t get the deadlock again.
As to your slave, I haven’t seen this error before and it is a bit confusing, I would think that the query on the master that failed would never be written to the bin log and therefor there could never be a “different error on the master and slave”
Either way. To fix this you need to run
This will ignore the first statement in the bin log and then restart the server. Whatever that statement was it will not be run on the slave, so you have to manually make sure the tables are the same on the master and slave afterwards.
Good luck.